Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
genie::GHepParticle Class Reference

STDHEP-like event record entry that can fit a particle or a nucleus. More...

#include <GHepParticle.h>

Inheritance diagram for genie::GHepParticle:

Public Member Functions

 GHepParticle ()
 
 GHepParticle (const GHepParticle &particle)
 
 GHepParticle (int pdg, GHepStatus_t status, int mother1, int mother2, int daughter1, int daughter2, const TLorentzVector &p, const TLorentzVector &v)
 
 GHepParticle (int pdg, GHepStatus_t status, int mother1, int mother2, int daughter1, int daughter2, double px, double py, double pz, double E, double x, double y, double z, double t)
 
 GHepParticle (TRootIOCtor *)
 
 ~GHepParticle ()
 
int Pdg (void) const
 
GHepStatus_t Status (void) const
 
int RescatterCode (void) const
 
int FirstMother (void) const
 
int LastMother (void) const
 
int FirstDaughter (void) const
 
int LastDaughter (void) const
 
bool HasDaughters (void) const
 
bool IsBound (void) const
 
string Name (void) const
 Name that corresponds to the PDG code. More...
 
double Mass (void) const
 Mass that corresponds to the PDG code. More...
 
double Charge (void) const
 Chrg that corresponds to the PDG code. More...
 
const TLorentzVector * P4 (void) const
 
const TLorentzVector * X4 (void) const
 
TLorentzVector * P4 (void)
 
TLorentzVector * X4 (void)
 
TLorentzVector * GetP4 (void) const
 
TLorentzVector * GetX4 (void) const
 
double Px (void) const
 Get Px. More...
 
double Py (void) const
 Get Py. More...
 
double Pz (void) const
 Get Pz. More...
 
double E (void) const
 Get energy. More...
 
double Energy (void) const
 Get energy. More...
 
double KinE (bool mass_from_pdg=false) const
 Get kinetic energy. More...
 
double Vx (void) const
 Get production x. More...
 
double Vy (void) const
 Get production y. More...
 
double Vz (void) const
 Get production z. More...
 
double Vt (void) const
 Get production time. More...
 
double RemovalEnergy (void) const
 Get removal energy. More...
 
bool Compare (const GHepParticle *p) const
 
bool ComparePdgCodes (const GHepParticle *p) const
 
bool CompareStatusCodes (const GHepParticle *p) const
 
bool CompareFamily (const GHepParticle *p) const
 
bool CompareMomentum (const GHepParticle *p) const
 
bool IsOnMassShell (void) const
 
bool IsOffMassShell (void) const
 
int Z (void) const
 
int A (void) const
 
double PolzPolarAngle (void) const
 
double PolzAzimuthAngle (void) const
 
bool PolzIsSet (void) const
 
void GetPolarization (TVector3 &polz)
 
void SetPdgCode (int c)
 
void SetStatus (GHepStatus_t s)
 
void SetRescatterCode (int code)
 
void SetFirstMother (int m)
 
void SetLastMother (int m)
 
void SetFirstDaughter (int d)
 
void SetLastDaughter (int d)
 
void SetMomentum (const TLorentzVector &p4)
 
void SetPosition (const TLorentzVector &v4)
 
void SetMomentum (double px, double py, double pz, double E)
 
void SetPosition (double x, double y, double z, double t)
 
void SetEnergy (double E)
 
void SetPx (double px)
 
void SetPy (double py)
 
void SetPz (double pz)
 
void SetPolarization (double theta, double phi)
 
void SetPolarization (const TVector3 &polz)
 
void SetBound (bool bound)
 
void SetRemovalEnergy (double Erm)
 
void CleanUp (void)
 
void Reset (void)
 
void Clear (Option_t *option)
 
void Copy (const GHepParticle &particle)
 
void Print (ostream &stream) const
 
void Print (Option_t *opt) const
 
bool operator== (const GHepParticle &p) const
 
GHepParticleoperator= (const GHepParticle &p)
 

Private Member Functions

void Init (void)
 
void AssertIsKnownParticle (void) const
 

Private Attributes

int fPdgCode
 particle PDG code More...
 
GHepStatus_t fStatus
 particle status More...
 
int fRescatterCode
 rescattering code More...
 
int fFirstMother
 first mother idx More...
 
int fLastMother
 last mother idx More...
 
int fFirstDaughter
 first daughter idx More...
 
int fLastDaughter
 last daughter idx More...
 
TLorentzVector * fP4
 momentum 4-vector (GeV) More...
 
TLorentzVector * fX4
 position 4-vector (in the target nucleus coordinate system / x,y,z in fm / t from the moment of the primary interaction in ys(yocto second = 10^-24 s) More...
 
double fPolzTheta
 polar polarization angle (rad) More...
 
double fPolzPhi
 azimuthal polarization angle (rad) More...
 
double fRemovalEnergy
 removal energy for bound nucleons (GeV) More...
 
bool fIsBound
 'is it a bound particle?' flag More...
 

Friends

ostream & operator<< (ostream &stream, const GHepParticle &p)
 

Detailed Description

STDHEP-like event record entry that can fit a particle or a nucleus.

Author
Costas Andreopoulos <constantinos.andreopoulos cern.ch> University of Liverpool & STFC Rutherford Appleton Laboratory

November 18, 2004

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

Definition at line 39 of file GHepParticle.h.

Constructor & Destructor Documentation

GHepParticle::GHepParticle ( )

Definition at line 50 of file GHepParticle.cxx.

50  :
51 TObject()
52 {
53  this->Init();
54 }
GHepParticle::GHepParticle ( const GHepParticle particle)

Definition at line 104 of file GHepParticle.cxx.

104  :
105 TObject()
106 {
107  this->Init();
108  this->Copy(particle);
109 }
void Copy(const GHepParticle &particle)
GHepParticle::GHepParticle ( int  pdg,
GHepStatus_t  status,
int  mother1,
int  mother2,
int  daughter1,
int  daughter2,
const TLorentzVector &  p,
const TLorentzVector &  v 
)

Definition at line 57 of file GHepParticle.cxx.

59  :
60 TObject(),
62 fFirstMother(mother1),
63 fLastMother(mother2),
64 fFirstDaughter(daughter1),
65 fLastDaughter(daughter2)
66 {
67  this->SetPdgCode(pdg);
68 
69  fP4 = new TLorentzVector(p);
70  fX4 = new TLorentzVector(v);
71 
72  fRescatterCode = -1;
73  fPolzTheta = -999;
74  fPolzPhi = -999;
75  fIsBound = false;
76  fRemovalEnergy = 0.;
77 }
double fRemovalEnergy
removal energy for bound nucleons (GeV)
Definition: GHepParticle.h:185
int fLastDaughter
last daughter idx
Definition: GHepParticle.h:180
int fFirstMother
first mother idx
Definition: GHepParticle.h:177
double fPolzPhi
azimuthal polarization angle (rad)
Definition: GHepParticle.h:184
bool fIsBound
&#39;is it a bound particle?&#39; flag
Definition: GHepParticle.h:186
GHepStatus_t fStatus
particle status
Definition: GHepParticle.h:175
int fFirstDaughter
first daughter idx
Definition: GHepParticle.h:179
TLorentzVector * fP4
momentum 4-vector (GeV)
Definition: GHepParticle.h:181
int fRescatterCode
rescattering code
Definition: GHepParticle.h:176
p
Definition: test.py:223
TLorentzVector * fX4
position 4-vector (in the target nucleus coordinate system / x,y,z in fm / t from the moment of the p...
Definition: GHepParticle.h:182
int fLastMother
last mother idx
Definition: GHepParticle.h:178
double fPolzTheta
polar polarization angle (rad)
Definition: GHepParticle.h:183
void SetPdgCode(int c)
GHepParticle::GHepParticle ( int  pdg,
GHepStatus_t  status,
int  mother1,
int  mother2,
int  daughter1,
int  daughter2,
double  px,
double  py,
double  pz,
double  E,
double  x,
double  y,
double  z,
double  t 
)

Definition at line 80 of file GHepParticle.cxx.

83  :
84 TObject(),
86 fFirstMother(mother1),
87 fLastMother(mother2),
88 fFirstDaughter(daughter1),
89 fLastDaughter(daughter2)
90 {
91  this->SetPdgCode(pdg);
92 
93  fP4 = new TLorentzVector(px,py,pz,En);
94  fX4 = new TLorentzVector(x,y,z,t);
95 
96  fRescatterCode = -1;
97  fPolzTheta = -999;
98  fPolzPhi = -999;
99  fIsBound = false;
100  fRemovalEnergy = 0.;
101 }
double fRemovalEnergy
removal energy for bound nucleons (GeV)
Definition: GHepParticle.h:185
int fLastDaughter
last daughter idx
Definition: GHepParticle.h:180
int fFirstMother
first mother idx
Definition: GHepParticle.h:177
double fPolzPhi
azimuthal polarization angle (rad)
Definition: GHepParticle.h:184
bool fIsBound
&#39;is it a bound particle?&#39; flag
Definition: GHepParticle.h:186
GHepStatus_t fStatus
particle status
Definition: GHepParticle.h:175
int fFirstDaughter
first daughter idx
Definition: GHepParticle.h:179
TLorentzVector * fP4
momentum 4-vector (GeV)
Definition: GHepParticle.h:181
int fRescatterCode
rescattering code
Definition: GHepParticle.h:176
TLorentzVector * fX4
position 4-vector (in the target nucleus coordinate system / x,y,z in fm / t from the moment of the p...
Definition: GHepParticle.h:182
int fLastMother
last mother idx
Definition: GHepParticle.h:178
list x
Definition: train.py:276
double fPolzTheta
polar polarization angle (rad)
Definition: GHepParticle.h:183
void SetPdgCode(int c)
GHepParticle::GHepParticle ( TRootIOCtor *  )

Definition at line 111 of file GHepParticle.cxx.

111  :
112 TObject(),
113 fPdgCode(0),
115 fRescatterCode(-1),
116 fFirstMother(-1),
117 fLastMother(-1),
118 fFirstDaughter(-1),
119 fLastDaughter(-1),
120 fP4(0),
121 fX4(0),
122 fPolzTheta(-999.),
123 fPolzPhi(-999.),
124 fRemovalEnergy(0),
125 fIsBound(false)
126 {
127 
128 }
double fRemovalEnergy
removal energy for bound nucleons (GeV)
Definition: GHepParticle.h:185
int fLastDaughter
last daughter idx
Definition: GHepParticle.h:180
int fPdgCode
particle PDG code
Definition: GHepParticle.h:174
int fFirstMother
first mother idx
Definition: GHepParticle.h:177
double fPolzPhi
azimuthal polarization angle (rad)
Definition: GHepParticle.h:184
bool fIsBound
&#39;is it a bound particle?&#39; flag
Definition: GHepParticle.h:186
GHepStatus_t fStatus
particle status
Definition: GHepParticle.h:175
int fFirstDaughter
first daughter idx
Definition: GHepParticle.h:179
TLorentzVector * fP4
momentum 4-vector (GeV)
Definition: GHepParticle.h:181
int fRescatterCode
rescattering code
Definition: GHepParticle.h:176
TLorentzVector * fX4
position 4-vector (in the target nucleus coordinate system / x,y,z in fm / t from the moment of the p...
Definition: GHepParticle.h:182
int fLastMother
last mother idx
Definition: GHepParticle.h:178
double fPolzTheta
polar polarization angle (rad)
Definition: GHepParticle.h:183
GHepParticle::~GHepParticle ( )

Definition at line 130 of file GHepParticle.cxx.

131 {
132  this->CleanUp();
133 }

Member Function Documentation

int GHepParticle::A ( void  ) const

Definition at line 184 of file GHepParticle.cxx.

185 {
186 // Decoding A from the PDG code
187 
188  if(!pdg::IsIon(fPdgCode))
189  return -1;
190  else
192 }
int fPdgCode
particle PDG code
Definition: GHepParticle.h:174
int IonPdgCodeToA(int pdgc)
Definition: PDGUtils.cxx:60
bool IsIon(int pdgc)
Definition: PDGUtils.cxx:39
void GHepParticle::AssertIsKnownParticle ( void  ) const
private

Definition at line 535 of file GHepParticle.cxx.

536 {
537  TParticlePDG * p = PDGLibrary::Instance()->Find(fPdgCode);
538  if(!p) {
539  LOG("GHepParticle", pFATAL)
540  << "\n** You are attempting to insert particle with PDG code = "
541  << fPdgCode << " into the event record."
542  << "\n** This particle can not be found in "
543  << "$GENIE/data/evgen/catalogues/pdg/genie_pdg_table.txt";
544  gAbortingInErr = true;
545  exit(1);
546  }
547 }
int fPdgCode
particle PDG code
Definition: GHepParticle.h:174
#define pFATAL
Definition: Messenger.h:56
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
p
Definition: test.py:223
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:57
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:75
bool gAbortingInErr
Definition: Messenger.cxx:34
double GHepParticle::Charge ( void  ) const

Chrg that corresponds to the PDG code.

Definition at line 151 of file GHepParticle.cxx.

152 {
153  this->AssertIsKnownParticle();
154 
155  TParticlePDG * p = PDGLibrary::Instance()->Find(fPdgCode);
156  return p->Charge();
157 }
int fPdgCode
particle PDG code
Definition: GHepParticle.h:174
void AssertIsKnownParticle(void) const
p
Definition: test.py:223
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:57
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:75
void GHepParticle::CleanUp ( void  )

Definition at line 405 of file GHepParticle.cxx.

406 {
407 // deallocate memory
408 
409  if(fP4) delete fP4;
410  if(fX4) delete fX4;
411  fP4 = 0;
412  fX4 = 0;
413 }
TLorentzVector * fP4
momentum 4-vector (GeV)
Definition: GHepParticle.h:181
TLorentzVector * fX4
position 4-vector (in the target nucleus coordinate system / x,y,z in fm / t from the moment of the p...
Definition: GHepParticle.h:182
void GHepParticle::Clear ( Option_t *  option)

Definition at line 423 of file GHepParticle.cxx.

424 {
425 // implement the Clear(Option_t *) method so that the GHepParticle when is a
426 // member of a GHepRecord, gets deleted properly when calling TClonesArray's
427 // Clear("C")
428 
429  this->CleanUp();
430 }
bool GHepParticle::Compare ( const GHepParticle p) const

Definition at line 463 of file GHepParticle.cxx.

464 {
465 // Do the comparisons in steps & put the ones that cost most
466 // in the inner-most {}
467 
468  bool same_particle = (this->fPdgCode == p->fPdgCode);
469  bool same_status = (this->fStatus == p->fStatus );
470 
471  if( !same_particle || !same_status ) return false;
472  else {
473  if ( ! this->CompareFamily(p) ) return false;
474  else {
475  if( ! this->CompareMomentum(p) ) return false;
476  else return true;
477  }
478  }
479 }
int fPdgCode
particle PDG code
Definition: GHepParticle.h:174
GHepStatus_t fStatus
particle status
Definition: GHepParticle.h:175
bool CompareMomentum(const GHepParticle *p) const
bool CompareFamily(const GHepParticle *p) const
bool GHepParticle::CompareFamily ( const GHepParticle p) const

Definition at line 491 of file GHepParticle.cxx.

492 {
493  bool same_family = (
494  this->fFirstMother == p->fFirstMother &&
495  this->fLastMother == p->fLastMother &&
496  this->fFirstDaughter == p->fFirstDaughter &&
497  this->fLastDaughter == p->fLastDaughter
498  );
499  return same_family;
500 }
int fLastDaughter
last daughter idx
Definition: GHepParticle.h:180
int fFirstMother
first mother idx
Definition: GHepParticle.h:177
int fFirstDaughter
first daughter idx
Definition: GHepParticle.h:179
int fLastMother
last mother idx
Definition: GHepParticle.h:178
bool GHepParticle::CompareMomentum ( const GHepParticle p) const

Definition at line 502 of file GHepParticle.cxx.

503 {
504  double dE = TMath::Abs( this->E() - p->E() );
505  double dPx = TMath::Abs( this->Px() - p->Px() );
506  double dPy = TMath::Abs( this->Py() - p->Py() );
507  double dPz = TMath::Abs( this->Pz() - p->Pz() );
508 
509  bool same_momentum =
510  (dE < kPCutOff && dPx < kPCutOff && dPy < kPCutOff && dPz < kPCutOff);
511 
512  return same_momentum;
513 }
const double kPCutOff
double E(void) const
Get energy.
Definition: GHepParticle.h:91
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:90
double Px(void) const
Get Px.
Definition: GHepParticle.h:88
double Py(void) const
Get Py.
Definition: GHepParticle.h:89
bool GHepParticle::ComparePdgCodes ( const GHepParticle p) const

Definition at line 481 of file GHepParticle.cxx.

482 {
483  return (this->fPdgCode == p->fPdgCode);
484 }
int fPdgCode
particle PDG code
Definition: GHepParticle.h:174
bool GHepParticle::CompareStatusCodes ( const GHepParticle p) const

Definition at line 486 of file GHepParticle.cxx.

487 {
488  return (this->fStatus == p->fStatus);
489 }
GHepStatus_t fStatus
particle status
Definition: GHepParticle.h:175
void GHepParticle::Copy ( const GHepParticle particle)

Definition at line 515 of file GHepParticle.cxx.

516 {
517  this->SetStatus (particle.Status() );
518  this->SetPdgCode (particle.Pdg() );
519  this->SetRescatterCode (particle.RescatterCode() );
520  this->SetFirstMother (particle.FirstMother() );
521  this->SetLastMother (particle.LastMother() );
522  this->SetFirstDaughter (particle.FirstDaughter() );
523  this->SetLastDaughter (particle.LastDaughter() );
524 
525  this->SetMomentum (*particle.P4());
526  this->SetPosition (*particle.X4());
527 
528  this->fPolzTheta = particle.fPolzTheta;
529  this->fPolzPhi = particle.fPolzPhi;
530 
531  this->fIsBound = particle.fIsBound;
532  this->fRemovalEnergy = particle.fRemovalEnergy;
533 }
void SetFirstMother(int m)
Definition: GHepParticle.h:132
int RescatterCode(void) const
Definition: GHepParticle.h:65
double fRemovalEnergy
removal energy for bound nucleons (GeV)
Definition: GHepParticle.h:185
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:78
int FirstDaughter(void) const
Definition: GHepParticle.h:68
void SetMomentum(const TLorentzVector &p4)
double fPolzPhi
azimuthal polarization angle (rad)
Definition: GHepParticle.h:184
bool fIsBound
&#39;is it a bound particle?&#39; flag
Definition: GHepParticle.h:186
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
int LastMother(void) const
Definition: GHepParticle.h:67
int Pdg(void) const
Definition: GHepParticle.h:63
int FirstMother(void) const
Definition: GHepParticle.h:66
void SetPosition(const TLorentzVector &v4)
int LastDaughter(void) const
Definition: GHepParticle.h:69
void SetLastDaughter(int d)
Definition: GHepParticle.h:135
void SetRescatterCode(int code)
Definition: GHepParticle.h:129
void SetLastMother(int m)
Definition: GHepParticle.h:133
const TLorentzVector * X4(void) const
Definition: GHepParticle.h:79
void SetStatus(GHepStatus_t s)
Definition: GHepParticle.h:126
double fPolzTheta
polar polarization angle (rad)
Definition: GHepParticle.h:183
void SetFirstDaughter(int d)
Definition: GHepParticle.h:134
void SetPdgCode(int c)
double genie::GHepParticle::E ( void  ) const
inline

Get energy.

Definition at line 91 of file GHepParticle.h.

double genie::GHepParticle::Energy ( void  ) const
inline

Get energy.

Definition at line 92 of file GHepParticle.h.

int genie::GHepParticle::FirstDaughter ( void  ) const
inline

Definition at line 68 of file GHepParticle.h.

68 { return fFirstDaughter; }
int fFirstDaughter
first daughter idx
Definition: GHepParticle.h:179
int genie::GHepParticle::FirstMother ( void  ) const
inline

Definition at line 66 of file GHepParticle.h.

66 { return fFirstMother; }
int fFirstMother
first mother idx
Definition: GHepParticle.h:177
TLorentzVector * GHepParticle::GetP4 ( void  ) const

Definition at line 194 of file GHepParticle.cxx.

195 {
196 // see GHepParticle::P4() for a method that does not create a new object and
197 // transfers its ownership
198 
199  if(fP4) {
200  TLorentzVector * p4 = new TLorentzVector(*fP4);
201 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
202  LOG("GHepParticle", pDEBUG)
203  << "Return vp = " << utils::print::P4AsShortString(p4);
204 #endif
205  return p4;
206  } else {
207  LOG("GHepParticle", pWARN) << "NULL 4-momentum TLorentzVector";
208  return 0;
209  }
210 }
string P4AsShortString(const TLorentzVector *p)
Definition: PrintUtils.cxx:45
TLorentzVector * fP4
momentum 4-vector (GeV)
Definition: GHepParticle.h:181
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pWARN
Definition: Messenger.h:60
#define pDEBUG
Definition: Messenger.h:63
void GHepParticle::GetPolarization ( TVector3 &  polz)

Definition at line 315 of file GHepParticle.cxx.

316 {
317 // gets the polarization vector
318 
319  if(! this->PolzIsSet() ) {
320  polz.SetXYZ(0.,0.,0.);
321  return;
322  }
323  polz.SetX( TMath::Sin(fPolzTheta) * TMath::Cos(fPolzPhi) );
324  polz.SetY( TMath::Sin(fPolzTheta) * TMath::Sin(fPolzPhi) );
325  polz.SetZ( TMath::Cos(fPolzTheta) );
326 }
double fPolzPhi
azimuthal polarization angle (rad)
Definition: GHepParticle.h:184
bool PolzIsSet(void) const
double fPolzTheta
polar polarization angle (rad)
Definition: GHepParticle.h:183
TLorentzVector * GHepParticle::GetX4 ( void  ) const

Definition at line 212 of file GHepParticle.cxx.

213 {
214 // see GHepParticle::X4() for a method that does not create a new object and
215 // transfers its ownership
216 
217  if(fX4) {
218  TLorentzVector * x4 = new TLorentzVector(*fX4);
219 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
220  LOG("GHepParticle", pDEBUG)
221  << "Return x4 = " << utils::print::X4AsString(x4);
222 #endif
223  return x4;
224  } else {
225  LOG("GHepParticle", pWARN) << "NULL 4-position TLorentzVector";
226  return 0;
227  }
228 }
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pWARN
Definition: Messenger.h:60
TLorentzVector * fX4
position 4-vector (in the target nucleus coordinate system / x,y,z in fm / t from the moment of the p...
Definition: GHepParticle.h:182
string X4AsString(const TLorentzVector *x)
Definition: PrintUtils.cxx:57
#define pDEBUG
Definition: Messenger.h:63
bool genie::GHepParticle::HasDaughters ( void  ) const
inline

Definition at line 70 of file GHepParticle.h.

70 { return (fFirstDaughter!=-1); }
int fFirstDaughter
first daughter idx
Definition: GHepParticle.h:179
void GHepParticle::Init ( void  )
private

Definition at line 388 of file GHepParticle.cxx.

389 {
390  fPdgCode = 0;
392  fRescatterCode = -1;
393  fFirstMother = -1;
394  fLastMother = -1;
395  fFirstDaughter = -1;
396  fLastDaughter = -1;
397  fPolzTheta = -999;
398  fPolzPhi = -999;
399  fIsBound = false;
400  fRemovalEnergy = 0.;
401  fP4 = new TLorentzVector(0,0,0,0);
402  fX4 = new TLorentzVector(0,0,0,0);
403 }
double fRemovalEnergy
removal energy for bound nucleons (GeV)
Definition: GHepParticle.h:185
int fLastDaughter
last daughter idx
Definition: GHepParticle.h:180
int fPdgCode
particle PDG code
Definition: GHepParticle.h:174
int fFirstMother
first mother idx
Definition: GHepParticle.h:177
double fPolzPhi
azimuthal polarization angle (rad)
Definition: GHepParticle.h:184
bool fIsBound
&#39;is it a bound particle?&#39; flag
Definition: GHepParticle.h:186
GHepStatus_t fStatus
particle status
Definition: GHepParticle.h:175
int fFirstDaughter
first daughter idx
Definition: GHepParticle.h:179
TLorentzVector * fP4
momentum 4-vector (GeV)
Definition: GHepParticle.h:181
int fRescatterCode
rescattering code
Definition: GHepParticle.h:176
TLorentzVector * fX4
position 4-vector (in the target nucleus coordinate system / x,y,z in fm / t from the moment of the p...
Definition: GHepParticle.h:182
int fLastMother
last mother idx
Definition: GHepParticle.h:178
double fPolzTheta
polar polarization angle (rad)
Definition: GHepParticle.h:183
bool genie::GHepParticle::IsBound ( void  ) const
inline

Definition at line 71 of file GHepParticle.h.

71 { return fIsBound; }
bool fIsBound
&#39;is it a bound particle?&#39; flag
Definition: GHepParticle.h:186
bool GHepParticle::IsOffMassShell ( void  ) const

Definition at line 303 of file GHepParticle.cxx.

304 {
305  return (! this->IsOnMassShell());
306 }
bool IsOnMassShell(void) const
bool GHepParticle::IsOnMassShell ( void  ) const

Definition at line 289 of file GHepParticle.cxx.

290 {
291  this->AssertIsKnownParticle();
292 
293  TParticlePDG * p = PDGLibrary::Instance()->Find(fPdgCode);
294 
295  double Mpdg = p->Mass();
296  double M4p = (fP4) ? fP4->M() : 0.;
297 
298 // return utils::math::AreEqual(Mpdg, M4p);
299 
300  return (TMath::Abs(M4p-Mpdg) < kOffShellDm);
301 }
int fPdgCode
particle PDG code
Definition: GHepParticle.h:174
void AssertIsKnownParticle(void) const
TLorentzVector * fP4
momentum 4-vector (GeV)
Definition: GHepParticle.h:181
p
Definition: test.py:223
const double kOffShellDm
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:57
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:75
double GHepParticle::KinE ( bool  mass_from_pdg = false) const

Get kinetic energy.

Definition at line 159 of file GHepParticle.cxx.

160 {
161  if(!fP4) {
162  LOG("GHepParticle", pWARN) << "4-momentum not yet set!";
163  return 0;
164  }
165 
166  double En = fP4->Energy();
167  double M = ( (mass_from_pdg) ? this->Mass() : fP4->M() );
168  double K = En - M;
169 
170  K = TMath::Max(K,0.);
171  return K;
172 }
double Mass(void) const
Mass that corresponds to the PDG code.
TLorentzVector * fP4
momentum 4-vector (GeV)
Definition: GHepParticle.h:181
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pWARN
Definition: Messenger.h:60
int genie::GHepParticle::LastDaughter ( void  ) const
inline

Definition at line 69 of file GHepParticle.h.

69 { return fLastDaughter; }
int fLastDaughter
last daughter idx
Definition: GHepParticle.h:180
int genie::GHepParticle::LastMother ( void  ) const
inline

Definition at line 67 of file GHepParticle.h.

67 { return fLastMother; }
int fLastMother
last mother idx
Definition: GHepParticle.h:178
double GHepParticle::Mass ( void  ) const

Mass that corresponds to the PDG code.

Definition at line 143 of file GHepParticle.cxx.

144 {
145  this->AssertIsKnownParticle();
146 
147  TParticlePDG * p = PDGLibrary::Instance()->Find(fPdgCode);
148  return p->Mass();
149 }
int fPdgCode
particle PDG code
Definition: GHepParticle.h:174
void AssertIsKnownParticle(void) const
p
Definition: test.py:223
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:57
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:75
string GHepParticle::Name ( void  ) const

Name that corresponds to the PDG code.

Definition at line 135 of file GHepParticle.cxx.

136 {
137  this->AssertIsKnownParticle();
138 
139  TParticlePDG * p = PDGLibrary::Instance()->Find(fPdgCode);
140  return p->GetName();
141 }
int fPdgCode
particle PDG code
Definition: GHepParticle.h:174
void AssertIsKnownParticle(void) const
p
Definition: test.py:223
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:57
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:75
GHepParticle & GHepParticle::operator= ( const GHepParticle p)

Definition at line 554 of file GHepParticle.cxx.

555 {
556  this->Copy(p);
557  return (*this);
558 }
void Copy(const GHepParticle &particle)
bool GHepParticle::operator== ( const GHepParticle p) const

Definition at line 549 of file GHepParticle.cxx.

550 {
551  return (this->Compare(&p));
552 }
bool Compare(const GHepParticle *p) const
const TLorentzVector* genie::GHepParticle::P4 ( void  ) const
inline

Definition at line 78 of file GHepParticle.h.

78 { return fP4; }
TLorentzVector * fP4
momentum 4-vector (GeV)
Definition: GHepParticle.h:181
TLorentzVector* genie::GHepParticle::P4 ( void  )
inline

Definition at line 80 of file GHepParticle.h.

80 { return fP4; }
TLorentzVector * fP4
momentum 4-vector (GeV)
Definition: GHepParticle.h:181
int genie::GHepParticle::Pdg ( void  ) const
inline

Definition at line 63 of file GHepParticle.h.

63 { return fPdgCode; }
int fPdgCode
particle PDG code
Definition: GHepParticle.h:174
double genie::GHepParticle::PolzAzimuthAngle ( void  ) const
inline

Definition at line 120 of file GHepParticle.h.

120 { return fPolzPhi; }
double fPolzPhi
azimuthal polarization angle (rad)
Definition: GHepParticle.h:184
bool GHepParticle::PolzIsSet ( void  ) const

Definition at line 308 of file GHepParticle.cxx.

309 {
310 // checks whether the polarization angles have been set
311 
312  return (fPolzTheta > -999 && fPolzPhi > -999);
313 }
double fPolzPhi
azimuthal polarization angle (rad)
Definition: GHepParticle.h:184
double fPolzTheta
polar polarization angle (rad)
Definition: GHepParticle.h:183
double genie::GHepParticle::PolzPolarAngle ( void  ) const
inline

Definition at line 119 of file GHepParticle.h.

119 { return fPolzTheta; }
double fPolzTheta
polar polarization angle (rad)
Definition: GHepParticle.h:183
void GHepParticle::Print ( ostream &  stream) const

Definition at line 432 of file GHepParticle.cxx.

433 {
434  stream << "\n |";
435  stream << setfill(' ') << setw(14) << this->Name() << " | ";
436  stream << setfill(' ') << setw(14) << this->Pdg() << " | ";
437  stream << setfill(' ') << setw(6) << this->Status() << " | ";
438  stream << setfill(' ') << setw(3) << this->FirstMother() << " | ";
439  stream << setfill(' ') << setw(3) << this->LastMother() << " | ";
440  stream << setfill(' ') << setw(3) << this->FirstDaughter() << " | ";
441  stream << setfill(' ') << setw(3) << this->LastDaughter() << " | ";
442  stream << std::fixed << setprecision(3);
443  stream << setfill(' ') << setw(6) << this->Px() << " | ";
444  stream << setfill(' ') << setw(6) << this->Py() << " | ";
445  stream << setfill(' ') << setw(6) << this->Pz() << " | ";
446  stream << setfill(' ') << setw(6) << this->E() << " | ";
447  stream << setfill(' ') << setw(6) << this->Mass() << " | ";
448 
449  int rescat_code = this->RescatterCode();
450  if( rescat_code != -1 )
451  {
452  stream << setfill(' ') << setw(5) << rescat_code << " | ";
453  }
454 }
int RescatterCode(void) const
Definition: GHepParticle.h:65
double E(void) const
Get energy.
Definition: GHepParticle.h:91
int FirstDaughter(void) const
Definition: GHepParticle.h:68
double Mass(void) const
Mass that corresponds to the PDG code.
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:90
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
Q_EXPORT QTSManip setprecision(int p)
Definition: qtextstream.h:343
double Px(void) const
Get Px.
Definition: GHepParticle.h:88
int LastMother(void) const
Definition: GHepParticle.h:67
int Pdg(void) const
Definition: GHepParticle.h:63
int FirstMother(void) const
Definition: GHepParticle.h:66
string Name(void) const
Name that corresponds to the PDG code.
int LastDaughter(void) const
Definition: GHepParticle.h:69
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
Q_EXPORT QTSManip setfill(int f)
Definition: qtextstream.h:337
double Py(void) const
Get Py.
Definition: GHepParticle.h:89
void GHepParticle::Print ( Option_t *  opt) const

Definition at line 456 of file GHepParticle.cxx.

457 {
458 // implement the TObject's Print(Option_t *) method
459 
460  this->Print(cout);
461 }
void Print(ostream &stream) const
double genie::GHepParticle::Px ( void  ) const
inline

Get Px.

Definition at line 88 of file GHepParticle.h.

double genie::GHepParticle::Py ( void  ) const
inline

Get Py.

Definition at line 89 of file GHepParticle.h.

double genie::GHepParticle::Pz ( void  ) const
inline

Get Pz.

Definition at line 90 of file GHepParticle.h.

double genie::GHepParticle::RemovalEnergy ( void  ) const
inline

Get removal energy.

Definition at line 100 of file GHepParticle.h.

int genie::GHepParticle::RescatterCode ( void  ) const
inline

Definition at line 65 of file GHepParticle.h.

65 { return fRescatterCode; }
int fRescatterCode
rescattering code
Definition: GHepParticle.h:176
void GHepParticle::Reset ( void  )

Definition at line 415 of file GHepParticle.cxx.

416 {
417 // deallocate memory + initialize
418 
419  this->CleanUp();
420  this->Init();
421 }
void GHepParticle::SetBound ( bool  bound)

Definition at line 361 of file GHepParticle.cxx.

362 {
363  // only set it for p or n
364  bool is_nucleon = pdg::IsNeutronOrProton(fPdgCode);
365  if(!is_nucleon && bound) {
366  LOG("GHepParticle", pERROR)
367  << "Refusing to set the bound flag for particles other than nucleons";
368  LOG("GHepParticle", pERROR)
369  << "(Requested for pdg = " << fPdgCode << ")";
370  return;
371  }
372  // if the particles isn't bound then make sure that its removal energy = 0
373  if(!bound) {
374  fRemovalEnergy = 0;
375  }
376  // set the flag
377  fIsBound = bound;
378 }
#define pERROR
Definition: Messenger.h:59
double fRemovalEnergy
removal energy for bound nucleons (GeV)
Definition: GHepParticle.h:185
int fPdgCode
particle PDG code
Definition: GHepParticle.h:174
bool fIsBound
&#39;is it a bound particle?&#39; flag
Definition: GHepParticle.h:186
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
bool IsNeutronOrProton(int pdgc)
Definition: PDGUtils.cxx:348
void GHepParticle::SetEnergy ( double  E)

Definition at line 269 of file GHepParticle.cxx.

270 {
271  this->SetMomentum(this->Px(), this->Py(), this->Pz(), En);
272 }
void SetMomentum(const TLorentzVector &p4)
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:90
double Px(void) const
Get Px.
Definition: GHepParticle.h:88
double Py(void) const
Get Py.
Definition: GHepParticle.h:89
void genie::GHepParticle::SetFirstDaughter ( int  d)
inline

Definition at line 134 of file GHepParticle.h.

134 { fFirstDaughter = d; }
int fFirstDaughter
first daughter idx
Definition: GHepParticle.h:179
void genie::GHepParticle::SetFirstMother ( int  m)
inline

Definition at line 132 of file GHepParticle.h.

132 { fFirstMother = m; }
int fFirstMother
first mother idx
Definition: GHepParticle.h:177
void genie::GHepParticle::SetLastDaughter ( int  d)
inline

Definition at line 135 of file GHepParticle.h.

135 { fLastDaughter = d; }
int fLastDaughter
last daughter idx
Definition: GHepParticle.h:180
void genie::GHepParticle::SetLastMother ( int  m)
inline

Definition at line 133 of file GHepParticle.h.

133 { fLastMother = m; }
int fLastMother
last mother idx
Definition: GHepParticle.h:178
void GHepParticle::SetMomentum ( const TLorentzVector &  p4)

Definition at line 236 of file GHepParticle.cxx.

237 {
238  if(fP4)
239  fP4->SetPxPyPzE( p4.Px(), p4.Py(), p4.Pz(), p4.Energy() );
240  else
241  fP4 = new TLorentzVector(p4);
242 }
TLorentzVector * fP4
momentum 4-vector (GeV)
Definition: GHepParticle.h:181
void GHepParticle::SetMomentum ( double  px,
double  py,
double  pz,
double  E 
)

Definition at line 244 of file GHepParticle.cxx.

245 {
246  if(fP4)
247  fP4->SetPxPyPzE(px, py, pz, En);
248  else
249  fP4 = new TLorentzVector(px, py, pz, En);
250 }
TLorentzVector * fP4
momentum 4-vector (GeV)
Definition: GHepParticle.h:181
void GHepParticle::SetPdgCode ( int  c)

Definition at line 230 of file GHepParticle.cxx.

231 {
232  fPdgCode = code;
233  this->AssertIsKnownParticle();
234 }
int fPdgCode
particle PDG code
Definition: GHepParticle.h:174
void AssertIsKnownParticle(void) const
CodeOutputInterface * code
void GHepParticle::SetPolarization ( double  theta,
double  phi 
)

Definition at line 328 of file GHepParticle.cxx.

329 {
330 // sets the polarization angles
331 
332  if(theta>=0 && theta<=kPi && phi>=0 && phi<2*kPi)
333  {
334  fPolzTheta = theta;
335  fPolzPhi = phi;
336 
337  } else {
338  LOG("GHepParticle", pERROR)
339  << "Invalid polarization angles (polar = " << theta
340  << ", azimuthal = " << phi << ")";
341  }
342 }
#define pERROR
Definition: Messenger.h:59
double fPolzPhi
azimuthal polarization angle (rad)
Definition: GHepParticle.h:184
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
double fPolzTheta
polar polarization angle (rad)
Definition: GHepParticle.h:183
static const double kPi
Definition: Constants.h:37
void GHepParticle::SetPolarization ( const TVector3 &  polz)

Definition at line 344 of file GHepParticle.cxx.

345 {
346 // sets the polarization angles
347 
348  double p = polz.Mag();
349  if(! (p>0) ) {
350  LOG("GHepParticle", pERROR)
351  << "Input polarization vector has non-positive norm! Ignoring it";
352  return;
353  }
354 
355  double theta = TMath::ACos(polz.z()/p);
356  double phi = kPi + TMath::ATan2(-polz.y(), -polz.x());
357 
358  this->SetPolarization(theta,phi);
359 }
#define pERROR
Definition: Messenger.h:59
void SetPolarization(double theta, double phi)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
p
Definition: test.py:223
static const double kPi
Definition: Constants.h:37
void GHepParticle::SetPosition ( const TLorentzVector &  v4)

Definition at line 252 of file GHepParticle.cxx.

253 {
254  this->SetPosition(v4.X(), v4.Y(), v4.Z(), v4.T());
255 }
void SetPosition(const TLorentzVector &v4)
void GHepParticle::SetPosition ( double  x,
double  y,
double  z,
double  t 
)

Definition at line 257 of file GHepParticle.cxx.

258 {
259 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
260  LOG("GHepParticle", pDEBUG)
261  << "Setting position to (x = " << x << ", y = "
262  << y << ", z = " << z << ", t = " << t << ")";
263 #endif
264 
265  if(fX4) fX4->SetXYZT(x,y,z,t);
266  else fX4 = new TLorentzVector(x,y,z,t);
267 }
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
TLorentzVector * fX4
position 4-vector (in the target nucleus coordinate system / x,y,z in fm / t from the moment of the p...
Definition: GHepParticle.h:182
list x
Definition: train.py:276
#define pDEBUG
Definition: Messenger.h:63
void GHepParticle::SetPx ( double  px)

Definition at line 274 of file GHepParticle.cxx.

275 {
276  this->SetMomentum(px, this->Py(), this->Pz(), this->E());
277 }
double E(void) const
Get energy.
Definition: GHepParticle.h:91
void SetMomentum(const TLorentzVector &p4)
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:90
double Py(void) const
Get Py.
Definition: GHepParticle.h:89
void GHepParticle::SetPy ( double  py)

Definition at line 279 of file GHepParticle.cxx.

280 {
281  this->SetMomentum(this->Px(), py, this->Pz(), this->E());
282 }
double E(void) const
Get energy.
Definition: GHepParticle.h:91
void SetMomentum(const TLorentzVector &p4)
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:90
double Px(void) const
Get Px.
Definition: GHepParticle.h:88
void GHepParticle::SetPz ( double  pz)

Definition at line 284 of file GHepParticle.cxx.

285 {
286  this->SetMomentum(this->Px(), this->Py(), pz, this->E());
287 }
double E(void) const
Get energy.
Definition: GHepParticle.h:91
void SetMomentum(const TLorentzVector &p4)
double Px(void) const
Get Px.
Definition: GHepParticle.h:88
double Py(void) const
Get Py.
Definition: GHepParticle.h:89
void GHepParticle::SetRemovalEnergy ( double  Erm)

Definition at line 380 of file GHepParticle.cxx.

381 {
382  fRemovalEnergy = TMath::Max(Erm, 0.); // non-negative
383 
384  // if a value was set, make sure that the IsBound flag is turned on
385  if(fRemovalEnergy>0) this->SetBound(true);
386 }
double fRemovalEnergy
removal energy for bound nucleons (GeV)
Definition: GHepParticle.h:185
void SetBound(bool bound)
void genie::GHepParticle::SetRescatterCode ( int  code)
inline

Definition at line 129 of file GHepParticle.h.

129 { fRescatterCode = code; }
int fRescatterCode
rescattering code
Definition: GHepParticle.h:176
CodeOutputInterface * code
void genie::GHepParticle::SetStatus ( GHepStatus_t  s)
inline

Definition at line 126 of file GHepParticle.h.

126 { fStatus = s; }
GHepStatus_t fStatus
particle status
Definition: GHepParticle.h:175
static QCString * s
Definition: config.cpp:1042
GHepStatus_t genie::GHepParticle::Status ( void  ) const
inline

Definition at line 64 of file GHepParticle.h.

64 { return fStatus; }
GHepStatus_t fStatus
particle status
Definition: GHepParticle.h:175
double genie::GHepParticle::Vt ( void  ) const
inline

Get production time.

Definition at line 97 of file GHepParticle.h.

double genie::GHepParticle::Vx ( void  ) const
inline

Get production x.

Definition at line 94 of file GHepParticle.h.

double genie::GHepParticle::Vy ( void  ) const
inline

Get production y.

Definition at line 95 of file GHepParticle.h.

double genie::GHepParticle::Vz ( void  ) const
inline

Get production z.

Definition at line 96 of file GHepParticle.h.

const TLorentzVector* genie::GHepParticle::X4 ( void  ) const
inline

Definition at line 79 of file GHepParticle.h.

79 { return fX4; }
TLorentzVector * fX4
position 4-vector (in the target nucleus coordinate system / x,y,z in fm / t from the moment of the p...
Definition: GHepParticle.h:182
TLorentzVector* genie::GHepParticle::X4 ( void  )
inline

Definition at line 81 of file GHepParticle.h.

81 { return fX4; }
TLorentzVector * fX4
position 4-vector (in the target nucleus coordinate system / x,y,z in fm / t from the moment of the p...
Definition: GHepParticle.h:182
int GHepParticle::Z ( void  ) const

Definition at line 174 of file GHepParticle.cxx.

175 {
176 // Decoding Z from the PDG code
177 
178  if(!pdg::IsIon(fPdgCode))
179  return -1;
180  else
182 }
int fPdgCode
particle PDG code
Definition: GHepParticle.h:174
bool IsIon(int pdgc)
Definition: PDGUtils.cxx:39
int IonPdgCodeToZ(int pdgc)
Definition: PDGUtils.cxx:52

Friends And Related Function Documentation

ostream& operator<< ( ostream &  stream,
const GHepParticle p 
)
friend

Member Data Documentation

int genie::GHepParticle::fFirstDaughter
private

first daughter idx

Definition at line 179 of file GHepParticle.h.

int genie::GHepParticle::fFirstMother
private

first mother idx

Definition at line 177 of file GHepParticle.h.

bool genie::GHepParticle::fIsBound
private

'is it a bound particle?' flag

Definition at line 186 of file GHepParticle.h.

int genie::GHepParticle::fLastDaughter
private

last daughter idx

Definition at line 180 of file GHepParticle.h.

int genie::GHepParticle::fLastMother
private

last mother idx

Definition at line 178 of file GHepParticle.h.

TLorentzVector* genie::GHepParticle::fP4
private

momentum 4-vector (GeV)

Definition at line 181 of file GHepParticle.h.

int genie::GHepParticle::fPdgCode
private

particle PDG code

Definition at line 174 of file GHepParticle.h.

double genie::GHepParticle::fPolzPhi
private

azimuthal polarization angle (rad)

Definition at line 184 of file GHepParticle.h.

double genie::GHepParticle::fPolzTheta
private

polar polarization angle (rad)

Definition at line 183 of file GHepParticle.h.

double genie::GHepParticle::fRemovalEnergy
private

removal energy for bound nucleons (GeV)

Definition at line 185 of file GHepParticle.h.

int genie::GHepParticle::fRescatterCode
private

rescattering code

Definition at line 176 of file GHepParticle.h.

GHepStatus_t genie::GHepParticle::fStatus
private

particle status

Definition at line 175 of file GHepParticle.h.

TLorentzVector* genie::GHepParticle::fX4
private

position 4-vector (in the target nucleus coordinate system / x,y,z in fm / t from the moment of the primary interaction in ys(yocto second = 10^-24 s)

Definition at line 182 of file GHepParticle.h.


The documentation for this class was generated from the following files: