Functions
genie::utils::fragmrec Namespace Reference

Simple utilities for the Fragmentation Event Record. More...

Functions

int NParticles (int pdg_code, const TClonesArray *const particle_list)
 
int NParticles (int pdg_code, int status, const TClonesArray *const particle_list)
 
int NPositives (const TClonesArray *const particle_list)
 
int NNegatives (const TClonesArray *const particle_list)
 
void Print (const TClonesArray *const part_list)
 

Detailed Description

Simple utilities for the Fragmentation Event Record.

The Fragmentation event record is a TClonesArray of TMCParticles - equivalent to PYTHIA's PYJETS.

Author
Costas Andreopoulos <costas.andreopoulos stfc.ac.uk> University of Liverpool & STFC Rutherford Appleton Lab

November 26, 2004

Copyright (c) 2003-2019, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE

Function Documentation

int genie::utils::fragmrec::NNegatives ( const TClonesArray *const  particle_list)

Definition at line 77 of file FragmRecUtils.cxx.

References genie::PDGLibrary::Find(), and genie::PDGLibrary::Instance().

78 {
79 // Find out the number of negative particles in the particle container
80 
81  TIter piter(part_list);
82 
83  TMCParticle * p = 0;
84  int nneg = 0;
85 
86  while( (p = (TMCParticle *) piter.Next()) )
87  if( PDGLibrary::Instance()->Find(p->GetKF())->Charge() < 0 ) nneg++;
88 
89  return nneg;
90 }
const char * p
Definition: xmltok.h:285
int genie::utils::fragmrec::NParticles ( int  pdg_code,
const TClonesArray *const  particle_list 
)

Definition at line 32 of file FragmRecUtils.cxx.

Referenced by beamlinerecoana::WCTrackRecoAnalysis::analyze(), and main().

34 {
35  int nparticles = 0;
36  TMCParticle* p = 0;
37 
38  TObjArrayIter particle_iter(particle_list);
39 
40  while( (p = (TMCParticle *) particle_iter.Next()) ) {
41  if(p->GetKF() == pdg_code) {
42  if(p->GetKS()<10) nparticles++;
43  }
44  }
45  return nparticles;
46 }
const char * p
Definition: xmltok.h:285
int genie::utils::fragmrec::NParticles ( int  pdg_code,
int  status,
const TClonesArray *const  particle_list 
)

Definition at line 48 of file FragmRecUtils.cxx.

References fabricate::status.

50 {
51  int nparticles = 0;
52  TMCParticle* p = 0;
53 
54  TObjArrayIter particle_iter(particle_list);
55 
56  while( (p = (TMCParticle *) particle_iter.Next()) )
57  if(p->GetKF() == pdg_code && p->GetKS() == status) nparticles++;
58 
59  return nparticles;
60 }
int status
Definition: fabricate.py:1613
const char * p
Definition: xmltok.h:285
int genie::utils::fragmrec::NPositives ( const TClonesArray *const  particle_list)

Definition at line 62 of file FragmRecUtils.cxx.

References genie::PDGLibrary::Find(), and genie::PDGLibrary::Instance().

63 {
64 // Find out the number of negative particles in the particle container
65 
66  TIter piter(part_list);
67 
68  TMCParticle * p = 0;
69  int npos = 0;
70 
71  while( (p = (TMCParticle *) piter.Next()) )
72  if( PDGLibrary::Instance()->Find(p->GetKF())->Charge() > 0 ) npos++;
73 
74  return npos;
75 }
const char * p
Definition: xmltok.h:285
void genie::utils::fragmrec::Print ( const TClonesArray *const  part_list)

Definition at line 92 of file FragmRecUtils.cxx.

References MECModelEnuComparisons::i, pINFO, and SLOG.

Referenced by genie::PythiaHadronization::Hadronize(), and main().

93 {
94  TIter piter(part_list);
95 
96  unsigned int i=0;
97  TMCParticle * particle = 0;
98 
99  double sum_px = 0, sum_py = 0, sum_pz = 0, sum_E = 0;
100 
101 
102  while( (particle = (TMCParticle *) piter.Next()) ) {
103 
104  sum_E += (particle->GetEnergy());
105  sum_px += (particle->GetPx());
106  sum_py += (particle->GetPy());
107  sum_pz += (particle->GetPz());
108 
109  SLOG("FragmRecUtils", pINFO)
110  << "-> " << i++ << " " << particle->GetName()
111  << " KF = " << particle->GetKF()
112  << " KS = " << particle->GetKS()
113  << " mom = " << particle->GetParent()
114  << " kids = {"
115  << particle->GetFirstChild() << ", " << particle->GetLastChild()
116  << "}(E = " << particle->GetEnergy()
117  << ",Px = " << particle->GetPx()
118  << ",Py = " << particle->GetPy()
119  << ",Pz = " << particle->GetPz() << ")";
120  }
121 
122  SLOG("FragmRecUtils", pINFO)
123  << "SUMS: E = " << sum_E
124  << ", px = " << sum_px << ", py = " << sum_py << ", pz = " << sum_pz;
125 
126 }
#define pINFO
Definition: Messenger.h:63
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:85