34 #include <TRootIOCtor.h> 45 using namespace genie;
49 using std::setprecision;
63 particle.
Print(stream);
76 int mother1,
int mother2,
int daughter1,
int daughter2,
77 const TLorentzVector &
p,
const TLorentzVector &
v) :
87 fP4 =
new TLorentzVector(p);
88 fX4 =
new TLorentzVector(v);
99 int mother1,
int mother2,
int daughter1,
int daughter2,
100 double px,
double py,
double pz,
double En,
101 double x,
double y,
double z,
double t) :
111 fP4 =
new TLorentzVector(px,py,pz,En);
112 fX4 =
new TLorentzVector(x,y,z,t);
126 this->
Copy(particle);
180 LOG(
"GHepParticle",
pWARN) <<
"4-momentum not yet set!";
184 double En =
fP4->Energy();
185 double M = ( (mass_from_pdg) ? this->
Mass() :
fP4->M() );
188 K = TMath::Max(K,0.);
218 TLorentzVector *
p4 =
new TLorentzVector(*
fP4);
219 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 225 LOG(
"GHepParticle",
pWARN) <<
"NULL 4-momentum TLorentzVector";
236 TLorentzVector * x4 =
new TLorentzVector(*
fX4);
237 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 243 LOG(
"GHepParticle",
pWARN) <<
"NULL 4-position TLorentzVector";
257 fP4->SetPxPyPzE( p4.Px(), p4.Py(), p4.Pz(), p4.Energy() );
259 fP4 =
new TLorentzVector(p4);
265 fP4->SetPxPyPzE(px, py, pz, En);
267 fP4 =
new TLorentzVector(px, py, pz, En);
277 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 279 <<
"Setting position to (x = " << x <<
", y = " 280 << y <<
", z = " << z <<
", t = " << t <<
")";
283 if(
fX4)
fX4->SetXYZT(x,y,z,t);
284 else fX4 =
new TLorentzVector(x,y,z,t);
313 double Mpdg = p->Mass();
314 double M4p = (
fP4) ?
fP4->M() : 0.;
338 polz.SetXYZ(0.,0.,0.);
350 if(theta>=0 && theta<=kPi && phi>=0 && phi<2*
kPi)
357 <<
"Invalid polarization angles (polar = " << theta
358 <<
", azimuthal = " << phi <<
")";
366 double p = polz.Mag();
369 <<
"Input polarization vector has non-positive norm! Ignoring it";
373 double theta = TMath::ACos(polz.z()/
p);
374 double phi =
kPi + TMath::ATan2(-polz.y(), -polz.x());
383 if(!is_nucleon && bound) {
385 <<
"Refusing to set the bound flag for particles other than nucleons";
387 <<
"(Requested for pdg = " <<
fPdgCode <<
")";
419 fP4 =
new TLorentzVector(0,0,0,0);
420 fX4 =
new TLorentzVector(0,0,0,0);
453 stream << setfill(
' ') << setw(14) << this->
Name() <<
" | ";
454 stream << setfill(
' ') << setw(14) << this->
Pdg() <<
" | ";
455 stream << setfill(
' ') << setw(6) << this->
Status() <<
" | ";
456 stream << setfill(
' ') << setw(3) << this->
FirstMother() <<
" | ";
457 stream << setfill(
' ') << setw(3) << this->
LastMother() <<
" | ";
458 stream << setfill(
' ') << setw(3) << this->
FirstDaughter() <<
" | ";
459 stream << setfill(
' ') << setw(3) << this->
LastDaughter() <<
" | ";
460 stream << std::fixed << setprecision(3);
461 stream << setfill(
' ') << setw(6) << this->
Px() <<
" | ";
462 stream << setfill(
' ') << setw(6) << this->
Py() <<
" | ";
463 stream << setfill(
' ') << setw(6) << this->
Pz() <<
" | ";
464 stream << setfill(
' ') << setw(6) << this->
E() <<
" | ";
465 stream << setfill(
' ') << setw(6) << this->
Mass() <<
" | ";
468 if( rescat_code != -1 )
470 stream << setfill(
' ') << setw(5) << rescat_code <<
" | ";
489 if( !same_particle || !same_status )
return false;
522 double dE = TMath::Abs( this->
E() - p->
E() );
523 double dPx = TMath::Abs( this->
Px() - p->
Px() );
524 double dPy = TMath::Abs( this->
Py() - p->
Py() );
525 double dPz = TMath::Abs( this->
Pz() - p->
Pz() );
530 return same_momentum;
558 <<
"\n** You are attempting to insert particle with PDG code = " 559 <<
fPdgCode <<
" into the event record." 560 <<
"\n** This particle can not be found in " 561 <<
"$GENIE/data/evgen/catalogues/pdg/genie_pdg_table.txt";
void SetFirstMother(int m)
int RescatterCode(void) const
TLorentzVector * GetX4(void) const
string P4AsShortString(const TLorentzVector *p)
bool IsOnMassShell(void) const
THE MAIN GENIE PROJECT NAMESPACE
double E(void) const
Get energy.
double fRemovalEnergy
removal energy for bound nucleons (GeV)
const TLorentzVector * P4(void) const
int FirstDaughter(void) const
int fLastDaughter
last daughter idx
enum genie::EGHepStatus GHepStatus_t
int fPdgCode
particle PDG code
int IonPdgCodeToA(int pdgc)
void AssertIsKnownParticle(void) const
void SetBound(bool bound)
void SetMomentum(const TLorentzVector &p4)
GHepParticle & operator=(const GHepParticle &p)
double Mass(void) const
Mass that corresponds to the PDG code.
void SetPolarization(double theta, double phi)
int fFirstMother
first mother idx
double fPolzPhi
azimuthal polarization angle (rad)
bool fIsBound
'is it a bound particle?' flag
GHepStatus_t fStatus
particle status
double Pz(void) const
Get Pz.
GHepStatus_t Status(void) const
int fFirstDaughter
first daughter idx
double Px(void) const
Get Px.
bool CompareMomentum(const GHepParticle *p) const
bool Compare(const GHepParticle *p) const
int LastMother(void) const
int FirstMother(void) const
string Name(void) const
Name that corresponds to the PDG code.
void Clear(Option_t *option)
TLorentzVector * fP4
momentum 4-vector (GeV)
void SetPosition(const TLorentzVector &v4)
int LastDaughter(void) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
bool operator==(const GHepParticle &p) const
void SetLastDaughter(int d)
int fRescatterCode
rescattering code
void SetRescatterCode(int code)
void Copy(const GHepParticle &particle)
TLorentzVector * GetP4(void) const
bool ComparePdgCodes(const GHepParticle *p) const
void Print(ostream &stream) const
double Charge(void) const
Chrg that corresponds to the PDG code.
bool PolzIsSet(void) const
bool IsOffMassShell(void) const
void GetPolarization(TVector3 &polz)
bool CompareStatusCodes(const GHepParticle *p) const
void SetRemovalEnergy(double Erm)
TLorentzVector * fX4
position 4-vector (in the target nucleus coordinate system / x,y,z in fm / t=0)
bool CompareFamily(const GHepParticle *p) const
double KinE(bool mass_from_pdg=false) const
Get kinetic energy.
static PDGLibrary * Instance(void)
void SetLastMother(int m)
const TLorentzVector * X4(void) const
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
void SetStatus(GHepStatus_t s)
bool IsNeutronOrProton(int pdgc)
int fLastMother
last mother idx
TParticlePDG * Find(int pdgc)
int IonPdgCodeToZ(int pdgc)
double fPolzTheta
polar polarization angle (rad)
string X4AsString(const TLorentzVector *x)
void SetFirstDaughter(int d)
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
STDHEP-like event record entry that can fit a particle or a nucleus.
ClassImp(GHepParticle) namespace genie
double Py(void) const
Get Py.