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, GHepStatus_t 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 GHepParticle's - 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 75 of file FragmRecUtils.cxx.

76 {
77 // Find out the number of negative particles in the particle container
78 
79  TIter piter(part_list);
80 
81  GHepParticle * p = 0;
82  int nneg = 0;
83 
84  while( (p = (GHepParticle *) piter.Next()) )
85  if( PDGLibrary::Instance()->Find(p->Pdg())->Charge() < 0 ) nneg++;
86 
87  return nneg;
88 }
int Pdg(void) const
Definition: GHepParticle.h:64
p
Definition: test.py:223
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
int genie::utils::fragmrec::NParticles ( int  pdg_code,
const TClonesArray *const  particle_list 
)

Definition at line 30 of file FragmRecUtils.cxx.

32 {
33  int nparticles = 0;
34  GHepParticle* p = 0;
35 
36  TObjArrayIter particle_iter(particle_list);
37 
38  while( (p = (GHepParticle *) particle_iter.Next()) ) {
39  if(p->Pdg() == pdg_code) {
40  if(p->Status()<10) nparticles++;
41  }
42  }
43  return nparticles;
44 }
GHepStatus_t Status(void) const
Definition: GHepParticle.h:65
int Pdg(void) const
Definition: GHepParticle.h:64
p
Definition: test.py:223
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
int genie::utils::fragmrec::NParticles ( int  pdg_code,
GHepStatus_t  status,
const TClonesArray *const  particle_list 
)

Definition at line 46 of file FragmRecUtils.cxx.

48 {
49  int nparticles = 0;
50  GHepParticle* p = 0;
51 
52  TObjArrayIter particle_iter(particle_list);
53 
54  while( (p = (GHepParticle *) particle_iter.Next()) )
55  if(p->Pdg() == pdg_code && p->Status() == status) nparticles++;
56 
57  return nparticles;
58 }
GHepStatus_t Status(void) const
Definition: GHepParticle.h:65
int Pdg(void) const
Definition: GHepParticle.h:64
p
Definition: test.py:223
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
int genie::utils::fragmrec::NPositives ( const TClonesArray *const  particle_list)

Definition at line 60 of file FragmRecUtils.cxx.

61 {
62 // Find out the number of negative particles in the particle container
63 
64  TIter piter(part_list);
65 
66  GHepParticle * p = 0;
67  int npos = 0;
68 
69  while( (p = (GHepParticle *) piter.Next()) )
70  if( PDGLibrary::Instance()->Find(p->Pdg())->Charge() > 0 ) npos++;
71 
72  return npos;
73 }
int Pdg(void) const
Definition: GHepParticle.h:64
p
Definition: test.py:223
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
void genie::utils::fragmrec::Print ( const TClonesArray *const  part_list)

Definition at line 90 of file FragmRecUtils.cxx.

91 {
92  TIter piter(part_list);
93 
94  unsigned int i=0;
95  GHepParticle * particle = 0;
96 
97  double sum_px = 0, sum_py = 0, sum_pz = 0, sum_E = 0;
98 
99 
100  while( (particle = (GHepParticle *) piter.Next()) ) {
101 
102  sum_E += (particle->Energy());
103  sum_px += (particle->Px());
104  sum_py += (particle->Py());
105  sum_pz += (particle->Pz());
106 
107  SLOG("FragmRecUtils", pINFO)
108  << "-> " << i++ << " " << particle->Name()
109  << " PDG = " << particle->Pdg()
110  << " status = " << particle->Status()
111  << " moms = {"
112  << particle->FirstMother() << ", " << particle->LastMother()
113  << "} kids = {"
114  << particle->FirstDaughter() << ", " << particle->LastDaughter()
115  << "}(E = " << particle->Energy()
116  << ",Px = " << particle->Px()
117  << ",Py = " << particle->Py()
118  << ",Pz = " << particle->Pz() << ")";
119  }
120 
121  SLOG("FragmRecUtils", pINFO)
122  << "SUMS: E = " << sum_E
123  << ", px = " << sum_px << ", py = " << sum_py << ", pz = " << sum_pz;
124 
125 }
int FirstDaughter(void) const
Definition: GHepParticle.h:69
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:91
GHepStatus_t Status(void) const
Definition: GHepParticle.h:65
double Energy(void) const
Get energy.
Definition: GHepParticle.h:93
double Px(void) const
Get Px.
Definition: GHepParticle.h:89
int LastMother(void) const
Definition: GHepParticle.h:68
int Pdg(void) const
Definition: GHepParticle.h:64
int FirstMother(void) const
Definition: GHepParticle.h:67
string Name(void) const
Name that corresponds to the PDG code.
int LastDaughter(void) const
Definition: GHepParticle.h:70
#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
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
double Py(void) const
Get Py.
Definition: GHepParticle.h:90