15 #include <TLorentzVector.h> 18 #include <TRootIOCtor.h> 20 #include "Framework/Conventions/GBuild.h" 38 using namespace genie;
54 TClonesArray(
"genie::GHepParticle")
60 TClonesArray(
"genie::GHepParticle", size)
66 TClonesArray(
"genie::GHepParticle", record.GetEntries())
73 TClonesArray(
"genie::GHepParticle"),
94 LOG(
"GHEP",
pWARN) <<
"Returning NULL interaction";
108 if( position >=0 && position < this->GetEntries() ) {
110 if(particle)
return particle;
113 <<
"No particle found with: (pos = " << position <<
")";
125 for(
int i = start; i <
nentries; i++) {
131 <<
"No particle found with: (pos >= " << start
132 <<
", pdg = " << pdg <<
", ist = " << status <<
")";
144 for(
int i = start; i <
nentries; i++) {
150 <<
"No particle found with: (pos >= " << start
151 <<
", pdg = " << pdg <<
", ist = " << status <<
")";
162 for(
int i = start; i <
nentries; i++) {
164 if( p->
Compare(particle) )
return i;
168 <<
"No particle found with pos >= " << start
169 <<
" matching particle: " << *particle;
181 if(position<0 || position>=nentries)
return 0;
187 descendants->push_back(position);
192 if(i==position)
continue;
195 bool is_descendant=
false;
198 if(mom==position) is_descendant=
true;
200 descendants->push_back(i);
216 int p0pdg = p0->
Pdg();
218 int p1pdg = p1->
Pdg();
282 if(ipos>-1)
return this->
Particle(ipos);
292 if(ipos>-1)
return this->
Particle(ipos);
302 if(ipos>-1)
return this->
Particle(ipos);
312 if(ipos>-1)
return this->
Particle(ipos);
322 if(ipos>-1)
return this->
Particle(ipos);
331 if(ipos>-1)
return this->
Particle(ipos);
341 if(ipos>-1)
return this->
Particle(ipos);
400 if(dau1==-1 && dau2==-1)
return -1;
402 for(
int i=dau1; i<=dau2; i++) {
404 int dpdgc = dp->
Pdg();
420 int ipos = (nucleus) ? 2 : 1;
428 if(isN && p->
Status()==ist)
return ipos;
440 int ipos = (nucleus) ? 2 : 1;
457 if(!probe)
return -1;
473 for(
int i = start; i < this->GetEntries(); i++) {
475 if(p->
Pdg()==pdg && p->
Status()==ist) nentries++;
484 for(
int i = start; i < this->GetEntries(); i++) {
486 if(p->
Pdg()==
pdg) nentries++;
495 unsigned int pos = this->GetEntries();
497 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 499 <<
"Adding particle with pdgc = " << p.
Pdg() <<
" at slot = " <<
pos;
510 const TLorentzVector &
p,
const TLorentzVector & v)
514 unsigned int pos = this->GetEntries();
516 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 518 <<
"Adding particle with pdgc = " << pdg <<
" at slot = " <<
pos;
520 new ((*this)[
pos])
GHepParticle(pdg,status, mom1,mom2,dau1,dau2, p, v);
529 double px,
double py,
double pz,
double E,
530 double x,
double y,
double z,
double t)
534 unsigned int pos = this->GetEntries();
536 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 538 <<
"Adding particle with pdgc = " << pdg <<
" at slot = " <<
pos;
541 pdg, status, mom1, mom2, dau1, dau2, px, py, pz, E, x, y, z, t);
550 int pos = this->GetEntries() - 1;
552 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 554 <<
"Updating the daughter-list for the mother of particle at: " <<
pos;
561 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 562 LOG(
"GHEP",
pINFO) <<
"Mother particle is at slot: " << mom_pos;
564 if(mom_pos==-1)
return;
575 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 577 <<
"Done! Daughter-list is compact: [" << pos <<
", " << pos <<
"]";
585 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 587 <<
"Done! Daughter-list is compact: [" << pos <<
", " << dau2 <<
"]";
595 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 597 <<
"Done! Daughter-list is compact: [" << dau1 <<
", " << pos <<
"]";
605 <<
"Daughter-list is not compact - Running compactifier";
611 LOG(
"GHEP",
pNOTICE) <<
"Removing all intermediate particles from GHEP";
632 <<
"Removing: " << p->
Name() <<
" from slot: " << i;
637 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 638 LOG(
"GHEP",
pDEBUG) <<
"Compressing GHEP record to remove empty slots";
645 int n = this->GetEntries();
654 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 656 <<
"Particle's " << i <<
" daughter list is " 657 << ((compact) ?
"compact" :
"__not__ compact");
665 int ndau = dau2-dau1+1;
667 if(dau1==-1) {ndau=0;}
670 while (curr_pos > ndp) {
685 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 687 <<
"Done ompactifying daughter-list for particle at slot: " << i;
694 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 695 LOG(
"GHEP",
pDEBUG) <<
"Examining daughter-list of particle at: " <<
pos;
704 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 705 LOG(
"GHEP",
pDEBUG) <<
"Particle at: " << i <<
" is a daughter";
707 daughters.push_back(i);
712 bool is_compact =
true;
713 if(daughters.
size()>1) {
714 sort(daughters.begin(), daughters.end());
717 for(; diter != daughters.end(); ++diter) {
719 is_compact = is_compact && (TMath::Abs(prev-curr)<=1);
723 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 725 <<
"Daughter-list of particle at: " << pos <<
" is " 726 << (is_compact ?
"" :
"not") <<
" compact";
746 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 747 LOG(
"GHEP",
pINFO) <<
"Swapping GHepParticles : " << i <<
" <--> " << j;
749 int n = this->GetEntries();
750 assert(i>=0 && j>=0 && i<n && j<n);
765 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 767 << pi->
Name() <<
"(previously at pos: " << j
768 <<
") is now at pos: " << i <<
" -> Notify daughters";
770 for(
int k=0;
k<
n;
k++) {
771 if(this->
Particle(
k)->FirstMother()==j) {
778 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 780 << pj->
Name() <<
"(previously at pos: " << i
781 <<
") is now at pos: " << j <<
" -> Notify daughters";
783 for(
int k=0;
k<
n;
k++) {
784 if(this->
Particle(
k)->FirstMother()==i) {
808 dau1 = (dau1<0) ? i2 : TMath::Min(dau1,i2);
809 dau2 = (dau2<0) ? i2 : TMath::Max(dau2,i2);
814 p1 -> SetFirstDaughter (dau1);
815 p1 -> SetLastDaughter (dau2);
821 fVtx->SetXYZT(x,y,z,t);
826 fVtx->SetXYZT(vtx.X(),vtx.Y(),vtx.Z(),vtx.T());
831 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 832 LOG(
"GHEP",
pDEBUG) <<
"Initializing GHepRecord";
840 fVtx =
new TLorentzVector(0,0,0,0);
855 this->SetOwner(
true);
860 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 861 LOG(
"GHEP",
pDEBUG) <<
"Cleaning up GHepRecord";
868 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 869 LOG(
"GHEP",
pDEBUG) <<
"Reseting GHepRecord";
889 TClonesArray::Clear(opt);
905 unsigned int ientry = 0;
907 TIter ghepiter(&record);
919 TLorentzVector * v = record.
Vertex();
920 fVtx->SetXYZT(v->X(),v->Y(),v->Z(),v->T());
943 TBits bitwiseand = flags &
mask;
944 bool accept = (bitwiseand.CountBits() == 0);
969 bool accept_input_print_level =
973 int printlevel = (accept_input_print_level) ?
fPrintLevel : 3;
974 int printlevel_orig = printlevel;
976 bool showpos =
false;
977 if(printlevel >= 10) {
985 stream <<
"\n|GENIE GHEP Event Record [print level: " 986 <<
setfill(
' ') <<
setw(3) << printlevel_orig <<
"]" 999 <<
setfill(
' ') <<
setw(10) << ((showpos) ?
"Px(x) |" :
"Px | ")
1000 <<
setfill(
' ') <<
setw(10) << ((showpos) ?
"Py(y) |" :
"Py | ")
1001 <<
setfill(
' ') <<
setw(10) << ((showpos) ?
"Pz(z) |" :
"Pz | ")
1002 <<
setfill(
' ') <<
setw(10) << ((showpos) ?
"E(t) |" :
"E | ")
1009 TObjArrayIter piter(
this);
1010 TVector3 polarization(0,0,0);
1012 unsigned int idx = 0;
1022 stream <<
setfill(
' ') <<
setw(3) << idx++ <<
" | ";
1040 << p->
P4()->M() <<
" ";
1044 stream <<
"P = (" << polarization.x() <<
"," << polarization.y()
1045 <<
"," << polarization.z() <<
")";
1098 stream <<
setfill(
' ') <<
setw(17) <<
"Fin-Init: " 1104 stream <<
setfill(
' ') <<
setw(7) << sum_px <<
" | ";
1105 stream <<
setfill(
' ') <<
setw(7) << sum_py <<
" | ";
1106 stream <<
setfill(
' ') <<
setw(7) << sum_pz <<
" | ";
1107 stream <<
setfill(
' ') <<
setw(7) << sum_E <<
" | ";
1120 << ((probe) ? probe->
Name() :
"unknown probe") <<
" @ (";
1139 stream <<
"Err flag [bits:" <<
fEventFlags->GetNbits()-1 <<
"->0] : " 1146 stream <<
"Err mask [bits:" <<
fEventMask->GetNbits()-1 <<
"->0] : " 1161 stream <<
"sig(Ev) = " 1187 stream <<
" Weight = " 1202 else stream <<
"NULL Interaction!" <<
endl;
static void SetPrintLevel(int print_level)
void SetFirstMother(int m)
int RescatterCode(void) const
virtual GHepParticle * Particle(int position) const
virtual int ParticlePosition(int pdg, GHepStatus_t i, int start=0) const
virtual void Copy(const GHepRecord &record)
virtual void UpdateDaughterLists(void)
double fProb
event probability (for given flux neutrino and density-weighted path-length for target element) ...
void Print(ostream &stream) const
bool IsOnMassShell(void) const
virtual void SwapParticles(int i, int j)
THE MAIN GENIE PROJECT NAMESPACE
double E(void) const
Get energy.
virtual GHepParticle * HitElectron(void) const
virtual Interaction * Summary(void) const
virtual GHepParticle * FindParticle(int pdg, GHepStatus_t ist, int start) const
const TLorentzVector * P4(void) const
int FirstDaughter(void) const
virtual int RemnantNucleusPosition(void) const
string BoolAsYNString(bool b)
enum genie::EGHepFlag GHepFlag_t
virtual void RemoveIntermediateParticles(void)
virtual void FinalizeDaughterLists(void)
TLorentzVector * fVtx
vertex in the detector coordinate system
virtual int HitNucleonPosition(void) const
bool IsDarkMatter(int pdgc)
TBits * fEventMask
an input bit-field mask allowing one to ignore bits set in fEventFlags
virtual unsigned int NEntries(int pdg, GHepStatus_t ist, int start=0) const
double Mass(void) const
Mass that corresponds to the PDG code.
double Pz(void) const
Get Pz.
static const char * Describe(GHepFlag_t flag)
GHepStatus_t Status(void) const
Q_EXPORT QTSManip setprecision(int p)
virtual void AttachSummary(Interaction *interaction)
virtual TLorentzVector * Vertex(void) const
double Px(void) const
Get Px.
bool Compare(const GHepParticle *p) const
virtual GHepParticle * Probe(void) const
int LastMother(void) const
double Vt(void) const
Get production time.
int FirstMother(void) const
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
string Name(void) const
Name that corresponds to the PDG code.
Enumeration of GENIE event generation modes.
double fXSec
cross section for selected event
Summary information for an interaction.
Interaction * fInteraction
attached summary information
int LastDaughter(void) const
TBits * fEventFlags
event flags indicating various pathologies or an unphysical event
static unsigned int NFlags(void)
virtual bool Accept(void) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
void SetLastDaughter(int d)
bool IsAntiDarkMatter(int pdgc)
static constexpr double cm2
bool HasDaughters(void) const
virtual bool HasCompactDaughterList(int pos)
void Copy(const GHepParticle &particle)
virtual int FirstNonInitStateEntry(void)
virtual GHepParticle * FinalStatePrimaryLepton(void) const
GEvGenMode_t EventGenerationMode(void) const
static int GetPrintLevel()
virtual GHepParticle * TargetNucleus(void) const
virtual vector< int > * GetStableDescendants(int position) const
virtual void ResetRecord(void)
virtual int HitElectronPosition(void) const
virtual GHepParticle * FinalStateHadronicSystem(void) const
bool PolzIsSet(void) const
Q_EXPORT QTSManip setw(int w)
void GetPolarization(TVector3 &polz)
bool Is2NucleonCluster(int pdgc)
virtual void CompactifyDaughterLists(void)
ClassImp(EDep::TEventChangeManager) namespace
virtual TBits * EventFlags(void) const
void SetLastMother(int m)
virtual bool IsUnphysical(void) const
double Vz(void) const
Get production z.
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
virtual void Clear(Option_t *opt="")
virtual GHepParticle * HitNucleon(void) const
virtual void SetVertex(double x, double y, double z, double t)
KinePhaseSpace_t fDiffXSecPhSp
specifies which differential cross-section (dsig/dQ2, dsig/dQ2dW, dsig/dxdy,...)
virtual GHepParticle * RemnantNucleus(void) const
virtual void AddParticle(const GHepParticle &p)
double Vy(void) const
Get production y.
double fWeight
event weight
virtual int ProbePosition(void) const
void SetFirstDaughter(int d)
void Compress(gar::raw::ADCvector_t &adc, gar::raw::Compress_t compress)
In-place compression of raw data buffer.
const int kPdgHadronicSyst
void SetUnphysEventMask(const TBits &mask)
GENIE's GHEP MC event record.
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
Q_EXPORT QTSManip setfill(int f)
STDHEP-like event record entry that can fit a particle or a nucleus.
virtual int FinalStateHadronicSystemPosition(void) const
double fDiffXSec
differential cross section for selected event kinematics
virtual int FinalStatePrimaryLeptonPosition(void) const
virtual int TargetNucleusPosition(void) const
bool IsElectron(int pdgc)
QTextStream & endl(QTextStream &s)
enum genie::EGHepStatus GHepStatus_t
virtual TBits * EventMask(void) const
double Vx(void) const
Get production x.
double Py(void) const
Get Py.