16 #include <TRootIOCtor.h>
18 #include "Framework/Conventions/GBuild.h"
27 using namespace genie;
28 using namespace genie::constants;
31 using std::setprecision;
45 particle.
Print(stream);
58 int mother1,
int mother2,
int daughter1,
int daughter2,
59 const TLorentzVector & p,
const TLorentzVector & v) :
62 fFirstMother(mother1),
64 fFirstDaughter(daughter1),
65 fLastDaughter(daughter2)
69 fP4 =
new TLorentzVector(p);
70 fX4 =
new TLorentzVector(v);
81 int mother1,
int mother2,
int daughter1,
int daughter2,
82 double px,
double py,
double pz,
double En,
83 double x,
double y,
double z,
double t) :
86 fFirstMother(mother1),
88 fFirstDaughter(daughter1),
89 fLastDaughter(daughter2)
93 fP4 =
new TLorentzVector(px,py,pz,En);
94 fX4 =
new TLorentzVector(x,y,z,t);
108 this->
Copy(particle);
162 LOG(
"GHepParticle",
pWARN) <<
"4-momentum not yet set!";
166 double En =
fP4->Energy();
167 double M = ( (mass_from_pdg) ? this->
Mass() :
fP4->M() );
170 K = TMath::Max(K,0.);
200 TLorentzVector * p4 =
new TLorentzVector(*
fP4);
201 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
207 LOG(
"GHepParticle",
pWARN) <<
"NULL 4-momentum TLorentzVector";
218 TLorentzVector * x4 =
new TLorentzVector(*
fX4);
219 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
225 LOG(
"GHepParticle",
pWARN) <<
"NULL 4-position TLorentzVector";
239 fP4->SetPxPyPzE( p4.Px(), p4.Py(), p4.Pz(), p4.Energy() );
241 fP4 =
new TLorentzVector(p4);
247 fP4->SetPxPyPzE(px, py, pz, En);
249 fP4 =
new TLorentzVector(px, py, pz, En);
259 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
261 <<
"Setting position to (x = " << x <<
", y = "
262 << y <<
", z = " << z <<
", t = " << t <<
")";
265 if(
fX4)
fX4->SetXYZT(x,y,z,t);
266 else fX4 =
new TLorentzVector(x,y,z,t);
295 double Mpdg = p->Mass();
296 double M4p = (
fP4) ?
fP4->M() : 0.;
320 polz.SetXYZ(0.,0.,0.);
332 if(theta>=0 && theta<=kPi && phi>=0 && phi<2*
kPi)
339 <<
"Invalid polarization angles (polar = " << theta
340 <<
", azimuthal = " << phi <<
")";
348 double p = polz.Mag();
351 <<
"Input polarization vector has non-positive norm! Ignoring it";
355 double theta = TMath::ACos(polz.z()/p);
356 double phi =
kPi + TMath::ATan2(-polz.y(), -polz.x());
365 if(!is_nucleon && bound) {
367 <<
"Refusing to set the bound flag for particles other than nucleons";
369 <<
"(Requested for pdg = " <<
fPdgCode <<
")";
401 fP4 =
new TLorentzVector(0,0,0,0);
402 fX4 =
new TLorentzVector(0,0,0,0);
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() <<
" | ";
450 if( rescat_code != -1 )
452 stream << setfill(
' ') << setw(5) << rescat_code <<
" | ";
471 if( !same_particle || !same_status )
return false;
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() );
512 return same_momentum;
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";
void SetFirstMother(int m)
int RescatterCode(void) const
TLorentzVector * GetX4(void) const
string P4AsShortString(const TLorentzVector *p)
bool IsOnMassShell(void) const
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
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 from the moment of the p...
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
int IonPdgCodeToZ(int pdgc)
TParticlePDG * Find(int pdgc, bool must_exist=true)
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.
enum genie::EGHepStatus GHepStatus_t
double Py(void) const
Get Py.