GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
genie::GHepRecord Class Reference

GENIE's GHEP MC event record. More...

#include <GHepRecord.h>

Inheritance diagram for genie::GHepRecord:
Inheritance graph
[legend]
Collaboration diagram for genie::GHepRecord:
Collaboration graph
[legend]

Public Member Functions

 GHepRecord ()
 
 GHepRecord (int size)
 
 GHepRecord (const GHepRecord &record)
 
 GHepRecord (TRootIOCtor *)
 
virtual ~GHepRecord ()
 
virtual InteractionSummary (void) const
 
virtual void AttachSummary (Interaction *interaction)
 
virtual void AddParticle (const GHepParticle &p)
 
virtual void AddParticle (int pdg, GHepStatus_t ist, int mom1, int mom2, int dau1, int dau2, const TLorentzVector &p, const TLorentzVector &v)
 
virtual void AddParticle (int pdg, GHepStatus_t ist, int mom1, int mom2, int dau1, int dau2, double px, double py, double pz, double E, double x, double y, double z, double t)
 
virtual GHepParticleParticle (int position) const
 
virtual GHepParticleFindParticle (int pdg, GHepStatus_t ist, int start) const
 
virtual int ParticlePosition (int pdg, GHepStatus_t i, int start=0) const
 
virtual int ParticlePosition (GHepParticle *particle, int start=0) const
 
virtual vector< int > * GetStableDescendants (int position) const
 
GEvGenMode_t EventGenerationMode (void) const
 
virtual GHepParticleProbe (void) const
 
virtual GHepParticleTargetNucleus (void) const
 
virtual GHepParticleRemnantNucleus (void) const
 
virtual GHepParticleHitNucleon (void) const
 
virtual GHepParticleHitElectron (void) const
 
virtual GHepParticleFinalStatePrimaryLepton (void) const
 
virtual GHepParticleFinalStateHadronicSystem (void) const
 
virtual int ProbePosition (void) const
 
virtual int TargetNucleusPosition (void) const
 
virtual int RemnantNucleusPosition (void) const
 
virtual int HitNucleonPosition (void) const
 
virtual int HitElectronPosition (void) const
 
virtual int FinalStatePrimaryLeptonPosition (void) const
 
virtual int FinalStateHadronicSystemPosition (void) const
 
virtual unsigned int NEntries (int pdg, GHepStatus_t ist, int start=0) const
 
virtual unsigned int NEntries (int pdg, int start=0) const
 
virtual TBits * EventFlags (void) const
 
virtual TBits * EventMask (void) const
 
virtual bool IsUnphysical (void) const
 
virtual bool Accept (void) const
 
virtual double Weight (void) const
 
virtual double Probability (void) const
 
virtual double XSec (void) const
 
virtual double DiffXSec (void) const
 
virtual KinePhaseSpace_t DiffXSecVars (void) const
 
virtual void SetWeight (double wght)
 
virtual void SetProbability (double prob)
 
virtual void SetXSec (double xsec)
 
virtual void SetDiffXSec (double xsec, KinePhaseSpace_t ps)
 
virtual TLorentzVector * Vertex (void) const
 
virtual void SetVertex (double x, double y, double z, double t)
 
virtual void SetVertex (const TLorentzVector &vtx)
 
virtual void Copy (const GHepRecord &record)
 
virtual void Clear (Option_t *opt="")
 
virtual void ResetRecord (void)
 
virtual void CompactifyDaughterLists (void)
 
virtual void RemoveIntermediateParticles (void)
 
void SetUnphysEventMask (const TBits &mask)
 
void Print (ostream &stream) const
 

Static Public Member Functions

static void SetPrintLevel (int print_level)
 
static int GetPrintLevel ()
 

Protected Member Functions

void InitRecord (void)
 
void CleanRecord (void)
 
virtual void UpdateDaughterLists (void)
 
virtual bool HasCompactDaughterList (int pos)
 
virtual void SwapParticles (int i, int j)
 
virtual void FinalizeDaughterLists (void)
 
virtual int FirstNonInitStateEntry (void)
 

Protected Attributes

InteractionfInteraction
 attached summary information More...
 
TLorentzVector * fVtx
 vertex in the detector coordinate system More...
 
TBits * fEventFlags
 event flags indicating various pathologies or an unphysical event More...
 
TBits * fEventMask
 an input bit-field mask allowing one to ignore bits set in fEventFlags More...
 
double fWeight
 event weight More...
 
double fProb
 event probability (for given flux neutrino and density-weighted path-length for target element) More...
 
double fXSec
 cross section for selected event More...
 
double fDiffXSec
 differential cross section for selected event kinematics More...
 
KinePhaseSpace_t fDiffXSecPhSp
 specifies which differential cross-section (dsig/dQ2, dsig/dQ2dW, dsig/dxdy,...) More...
 

Static Protected Attributes

static int fPrintLevel = 3
 

Friends

ostream & operator<< (ostream &stream, const GHepRecord &event)
 

Detailed Description

GENIE's GHEP MC event record.

Author
Costas Andreopoulos <c.andreopoulos cern.ch> University of Liverpool
Created:
October 1, 2004
License:
Copyright (c) 2003-2024, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 45 of file GHepRecord.h.

Constructor & Destructor Documentation

GHepRecord::GHepRecord ( )

Definition at line 53 of file GHepRecord.cxx.

References InitRecord().

53  :
54 TClonesArray("genie::GHepParticle")
55 {
56  this->InitRecord();
57 }
void InitRecord(void)
Definition: GHepRecord.cxx:837
GHepRecord::GHepRecord ( int  size)

Definition at line 59 of file GHepRecord.cxx.

References InitRecord().

59  :
60 TClonesArray("genie::GHepParticle", size)
61 {
62  this->InitRecord();
63 }
void InitRecord(void)
Definition: GHepRecord.cxx:837
GHepRecord::GHepRecord ( const GHepRecord record)

Definition at line 65 of file GHepRecord.cxx.

References Copy(), and InitRecord().

65  :
66 TClonesArray("genie::GHepParticle", record.GetEntries())
67 {
68  this->InitRecord();
69  this->Copy(record);
70 }
virtual void Copy(const GHepRecord &record)
Definition: GHepRecord.cxx:907
void InitRecord(void)
Definition: GHepRecord.cxx:837
GHepRecord::GHepRecord ( TRootIOCtor *  )

Definition at line 72 of file GHepRecord.cxx.

72  :
73 TClonesArray("genie::GHepParticle"),
74 fInteraction(0),
75 fVtx(0),
76 fEventFlags(0),
77 fEventMask(0),
78 fWeight(0.),
79 fProb(0.),
80 fXSec(0.),
81 fDiffXSec(0.)
82 {
83 
84 }
double fProb
event probability (for given flux neutrino and density-weighted path-length for target element) ...
Definition: GHepRecord.h:179
TLorentzVector * fVtx
vertex in the detector coordinate system
Definition: GHepRecord.h:171
TBits * fEventMask
an input bit-field mask allowing one to ignore bits set in fEventFlags
Definition: GHepRecord.h:175
double fXSec
cross section for selected event
Definition: GHepRecord.h:180
Interaction * fInteraction
attached summary information
Definition: GHepRecord.h:168
TBits * fEventFlags
event flags indicating various pathologies or an unphysical event
Definition: GHepRecord.h:174
double fWeight
event weight
Definition: GHepRecord.h:178
double fDiffXSec
differential cross section for selected event kinematics
Definition: GHepRecord.h:181
GHepRecord::~GHepRecord ( )
virtual

Definition at line 86 of file GHepRecord.cxx.

References CleanRecord().

87 {
88  this->CleanRecord();
89 }
void CleanRecord(void)
Definition: GHepRecord.cxx:866

Member Function Documentation

bool GHepRecord::Accept ( void  ) const
virtual

Definition at line 947 of file GHepRecord.cxx.

References fEventFlags, and fEventMask.

Referenced by Print(), and genie::EventGenerator::ProcessEventRecord().

948 {
949  TBits flags = *fEventFlags;
950  TBits mask = *fEventMask;
951  TBits bitwiseand = flags & mask;
952  bool accept = (bitwiseand.CountBits() == 0);
953  return accept;
954 }
TBits * fEventMask
an input bit-field mask allowing one to ignore bits set in fEventFlags
Definition: GHepRecord.h:175
TBits * fEventFlags
event flags indicating various pathologies or an unphysical event
Definition: GHepRecord.h:174
void GHepRecord::AddParticle ( const GHepParticle p)
virtual

Definition at line 499 of file GHepRecord.cxx.

References LOG, genie::GHepParticle::Pdg(), pINFO, and UpdateDaughterLists().

Referenced by genie::HNIntranuke2018::AbsorbHN(), genie::NuETargetRemnantGenerator::AddElectronNeutrino(), genie::DMETargetRemnantGenerator::AddElectronNeutrino(), genie::HadronicSystemGenerator::AddFinalHadronicSyst(), genie::AMNuGammaGenerator::AddFinalStateNeutrino(), genie::hnl::Decayer::AddInitialState(), genie::InitialStateAppender::AddNeutrino(), genie::InitialStateAppender::AddNucleus(), genie::AMNuGammaGenerator::AddPhoton(), genie::NucDeExcitationSim::AddPhoton(), genie::HEDISGenerator::AddPrimaryLepton(), genie::QELHadronicSystemGenerator::AddRecoilBaryon(), genie::IBDHadronicSystemGenerator::AddRecoilBaryon(), genie::AMNuGammaGenerator::AddRecoilNucleon(), genie::RSPPResonanceSelector::AddResonance(), genie::RESHadronicSystemGenerator::AddResonance(), genie::RSPPHadronicSystemGenerator::AddResonanceDecayProducts(), genie::InitialStateAppender::AddStruckParticle(), genie::NuETargetRemnantGenerator::AddTargetNucleusRemnant(), genie::DMETargetRemnantGenerator::AddTargetNucleusRemnant(), genie::HadronicSystemGenerator::AddTargetNucleusRemnant(), genie::QELEventGenerator::AddTargetNucleusRemnant(), genie::FermiMover::AddTargetNucleusRemnant(), genie::DMELEventGenerator::AddTargetNucleusRemnant(), genie::QELEventGeneratorSM::AddTargetNucleusRemnant(), genie::AMNuGammaGenerator::AddTargetRemnant(), genie::PrimaryLeptonGenerator::AddToEventRecord(), genie::OutgoingDarkGenerator::AddToEventRecord(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_AlvarezRuso(), genie::SKHadronicSystemGenerator::CalculateHadronicSystem_AtharSingleKaon(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_BergerSehgalFM(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_ReinSehgal(), ConvertToGHepMock(), genie::HAIntranuke::ElasHA(), genie::HAIntranuke2018::ElasHA(), genie::HNIntranuke2018::ElasHN(), genie::SecondNucleonEmissionI::EmitSecondNucleon(), genie::HNIntranuke2018::GammaInelasticHN(), genie::HNIntranuke2018::HandleCompoundNucleus(), genie::HAIntranuke::Inelastic(), genie::HAIntranuke2018::Inelastic(), genie::HAIntranuke::InelasticHA(), genie::HAIntranuke2018::InelasticHA(), genie::HNIntranuke2018::InelasticHN(), InitializeEvent(), genie::utils::intranuke::PhaseSpaceDecay(), genie::utils::intranuke2018::PhaseSpaceDecay(), genie::utils::intranuke::PionProduction(), genie::utils::intranuke2018::PionProduction(), genie::DFRHadronicSystemGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::PhotonCOHGenerator::ProcessEventRecord(), genie::PhotonRESGenerator::ProcessEventRecord(), genie::NormGenerator::ProcessEventRecord(), genie::NucBindEnergyAggregator::ProcessEventRecord(), genie::DMELEventGenerator::ProcessEventRecord(), genie::QELEventGeneratorSM::ProcessEventRecord(), genie::SPPEventGenerator::ProcessEventRecord(), genie::hnl::VertexGenerator::ProcessEventRecord(), genie::hnl::FluxCreator::ProcessEventRecord(), genie::HAIntranuke::SimulateHadronicFinalState(), genie::HAIntranuke2018::SimulateHadronicFinalState(), genie::HNIntranuke2018::SimulateHadronicFinalState(), genie::Intranuke::TransportHadrons(), genie::Intranuke2018::TransportHadrons(), and genie::HadronTransporter::TransportInTransparentNuc().

500 {
501 // Provides a simplified method for inserting entries in the TClonesArray
502 
503  unsigned int pos = this->GetEntries();
504 
505 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
506  LOG("GHEP", pINFO)
507  << "Adding particle with pdgc = " << p.Pdg() << " at slot = " << pos;
508 #endif
509  new ((*this)[pos]) GHepParticle(p);
510 
511  // Update the mother's daughter list. If the newly inserted particle broke
512  // compactification, then run CompactifyDaughterLists()
513  this->UpdateDaughterLists();
514 }
virtual void UpdateDaughterLists(void)
Definition: GHepRecord.cxx:556
int Pdg(void) const
Definition: GHepParticle.h:63
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
void GHepRecord::AddParticle ( int  pdg,
GHepStatus_t  ist,
int  mom1,
int  mom2,
int  dau1,
int  dau2,
const TLorentzVector &  p,
const TLorentzVector &  v 
)
virtual

Definition at line 516 of file GHepRecord.cxx.

References LOG, pINFO, and UpdateDaughterLists().

519 {
520 // Provides a 'simplified' method for inserting entries in the TClonesArray
521 
522  unsigned int pos = this->GetEntries();
523 
524 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
525  LOG("GHEP", pINFO)
526  << "Adding particle with pdgc = " << pdg << " at slot = " << pos;
527 #endif
528  new ((*this)[pos]) GHepParticle(pdg,status, mom1,mom2,dau1,dau2, p, v);
529 
530  // Update the mother's daughter list. If the newly inserted particle broke
531  // compactification, then run CompactifyDaughterLists()
532  this->UpdateDaughterLists();
533 }
virtual void UpdateDaughterLists(void)
Definition: GHepRecord.cxx:556
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
void GHepRecord::AddParticle ( int  pdg,
GHepStatus_t  ist,
int  mom1,
int  mom2,
int  dau1,
int  dau2,
double  px,
double  py,
double  pz,
double  E,
double  x,
double  y,
double  z,
double  t 
)
virtual

Definition at line 535 of file GHepRecord.cxx.

References LOG, pINFO, and UpdateDaughterLists().

539 {
540 // Provides a 'simplified' method for inserting entries in the TClonesArray
541 
542  unsigned int pos = this->GetEntries();
543 
544 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
545  LOG("GHEP", pINFO)
546  << "Adding particle with pdgc = " << pdg << " at slot = " << pos;
547 #endif
548  new ( (*this)[pos] ) GHepParticle (
549  pdg, status, mom1, mom2, dau1, dau2, px, py, pz, E, x, y, z, t);
550 
551  // Update the mother's daughter list. If the newly inserted particle broke
552  // compactification, then run CompactifyDaughterLists()
553  this->UpdateDaughterLists();
554 }
virtual void UpdateDaughterLists(void)
Definition: GHepRecord.cxx:556
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
void GHepRecord::AttachSummary ( Interaction interaction)
virtual

Definition at line 99 of file GHepRecord.cxx.

References fInteraction.

Referenced by InitializeEvent(), genie::PhysInteractionSelector::SelectInteraction(), and genie::ToyInteractionSelector::SelectInteraction().

100 {
101  fInteraction = interaction;
102 }
Interaction * fInteraction
attached summary information
Definition: GHepRecord.h:168
void GHepRecord::CleanRecord ( void  )
protected

Definition at line 866 of file GHepRecord.cxx.

References Clear(), LOG, and pDEBUG.

Referenced by ResetRecord(), and ~GHepRecord().

867 {
868 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
869  LOG("GHEP", pDEBUG) << "Cleaning up GHepRecord";
870 #endif
871  this->Clear("C");
872 }
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
virtual void Clear(Option_t *opt="")
Definition: GHepRecord.cxx:883
#define pDEBUG
Definition: Messenger.h:63
void GHepRecord::Clear ( Option_t *  opt = "")
virtual

Definition at line 883 of file GHepRecord.cxx.

References fEventFlags, fEventMask, fInteraction, and fVtx.

Referenced by CleanRecord().

884 {
885  if (fInteraction) delete fInteraction;
886  fInteraction=0;
887 
888  if (fVtx) delete fVtx;
889  fVtx=0;
890 
891  if(fEventFlags) delete fEventFlags;
892  fEventFlags=0;
893 
894  if(fEventMask) delete fEventMask;
895  fEventMask=0;
896 
897  TClonesArray::Clear(opt);
898 
899 // if (fInteraction) delete fInteraction;
900 // delete fVtx;
901 //
902 // delete fEventFlags;
903 //
904 // TClonesArray::Clear(opt);
905 }
TLorentzVector * fVtx
vertex in the detector coordinate system
Definition: GHepRecord.h:171
TBits * fEventMask
an input bit-field mask allowing one to ignore bits set in fEventFlags
Definition: GHepRecord.h:175
Interaction * fInteraction
attached summary information
Definition: GHepRecord.h:168
TBits * fEventFlags
event flags indicating various pathologies or an unphysical event
Definition: GHepRecord.h:174
void GHepRecord::CompactifyDaughterLists ( void  )
virtual

compact

Definition at line 651 of file GHepRecord.cxx.

References FinalizeDaughterLists(), genie::GHepParticle::FirstDaughter(), genie::GHepParticle::FirstMother(), HasCompactDaughterList(), genie::GHepParticle::LastDaughter(), LOG, Particle(), pINFO, pNOTICE, genie::GHepParticle::SetFirstDaughter(), genie::GHepParticle::SetLastDaughter(), and SwapParticles().

Referenced by UpdateDaughterLists().

652 {
653  int n = this->GetEntries();
654  if(n<1) return;
655 
656  int i = this->Particle(n-1)->FirstMother();
657  if(i<0) return;
658 
659  // for(int i=0; i<n; i++) {
660  bool compact = this->HasCompactDaughterList(i);
661 
662 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
663  LOG("GHEP", pNOTICE)
664  << "Particle's " << i << " daughter list is "
665  << ((compact) ? "compact" : "__not__ compact");
666 #endif
667 
668  if(!compact) {
669  GHepParticle * p = this->Particle(i);
670 
671  int dau1 = p->FirstDaughter();
672  int dau2 = p->LastDaughter();
673  int ndau = dau2-dau1+1;
674  int ndp = dau2+1;
675  if(dau1==-1) {ndau=0;}
676 
677  int curr_pos = n-1;
678  while (curr_pos > ndp) {
679  this->SwapParticles(curr_pos,curr_pos-1);
680  curr_pos--;
681  }
682  if(ndau>0) {
683  this->Particle(i)->SetFirstDaughter(dau1);
684  this->Particle(i)->SetLastDaughter(dau2+1);
685  } else {
686  this->Particle(i)->SetFirstDaughter(-1);
687  this->Particle(i)->SetLastDaughter(-1);
688  }
689  this->FinalizeDaughterLists();
690 
691  } //!compact
692 
693 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
694  LOG("GHEP", pINFO)
695  << "Done ompactifying daughter-list for particle at slot: " << i;
696 #endif
697  // }
698 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
virtual void SwapParticles(int i, int j)
Definition: GHepRecord.cxx:752
int FirstDaughter(void) const
Definition: GHepParticle.h:68
virtual void FinalizeDaughterLists(void)
Definition: GHepRecord.cxx:799
int FirstMother(void) const
Definition: GHepParticle.h:66
int LastDaughter(void) const
Definition: GHepParticle.h:69
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
void SetLastDaughter(int d)
Definition: GHepParticle.h:135
virtual bool HasCompactDaughterList(int pos)
Definition: GHepRecord.cxx:700
#define pINFO
Definition: Messenger.h:62
#define pNOTICE
Definition: Messenger.h:61
void SetFirstDaughter(int d)
Definition: GHepParticle.h:134
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
void GHepRecord::Copy ( const GHepRecord record)
virtual

Definition at line 907 of file GHepRecord.cxx.

References EventFlags(), EventMask(), fDiffXSec, fDiffXSecPhSp, fEventFlags, fEventMask, fInteraction, fProb, fVtx, fWeight, fXSec, ResetRecord(), and Vertex().

Referenced by genie::EventRecord::Copy(), GHepRecord(), and genie::EventGenerator::ProcessEventRecord().

908 {
909  // clean up
910  this->ResetRecord();
911 
912  // copy event record entries
913  unsigned int ientry = 0;
914  GHepParticle * p = 0;
915  TIter ghepiter(&record);
916  while ( (p = (GHepParticle *) ghepiter.Next()) )
917  new ( (*this)[ientry++] ) GHepParticle(*p);
918 
919  // copy summary
920  fInteraction = new Interaction( *record.fInteraction );
921 
922  // copy flags & mask
923  *fEventFlags = *(record.EventFlags());
924  *fEventMask = *(record.EventMask());
925 
926  // copy vtx position
927  TLorentzVector * v = record.Vertex();
928  fVtx->SetXYZT(v->X(),v->Y(),v->Z(),v->T());
929 
930  // copy weights & xsecs
931  fWeight = record.fWeight;
932  fProb = record.fProb;
933  fXSec = record.fXSec;
934  fDiffXSec = record.fDiffXSec;
935  fDiffXSecPhSp = record.fDiffXSecPhSp;
936 }
double fProb
event probability (for given flux neutrino and density-weighted path-length for target element) ...
Definition: GHepRecord.h:179
TLorentzVector * fVtx
vertex in the detector coordinate system
Definition: GHepRecord.h:171
TBits * fEventMask
an input bit-field mask allowing one to ignore bits set in fEventFlags
Definition: GHepRecord.h:175
virtual TLorentzVector * Vertex(void) const
Definition: GHepRecord.h:140
double fXSec
cross section for selected event
Definition: GHepRecord.h:180
Summary information for an interaction.
Definition: Interaction.h:56
Interaction * fInteraction
attached summary information
Definition: GHepRecord.h:168
TBits * fEventFlags
event flags indicating various pathologies or an unphysical event
Definition: GHepRecord.h:174
virtual void ResetRecord(void)
Definition: GHepRecord.cxx:874
virtual TBits * EventFlags(void) const
Definition: GHepRecord.h:117
KinePhaseSpace_t fDiffXSecPhSp
specifies which differential cross-section (dsig/dQ2, dsig/dQ2dW, dsig/dxdy,...)
Definition: GHepRecord.h:182
double fWeight
event weight
Definition: GHepRecord.h:178
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
double fDiffXSec
differential cross section for selected event kinematics
Definition: GHepRecord.h:181
virtual TBits * EventMask(void) const
Definition: GHepRecord.h:118
virtual double genie::GHepRecord::DiffXSec ( void  ) const
inlinevirtual

Definition at line 127 of file GHepRecord.h.

References fDiffXSec.

127 { return fDiffXSec; }
double fDiffXSec
differential cross section for selected event kinematics
Definition: GHepRecord.h:181
virtual KinePhaseSpace_t genie::GHepRecord::DiffXSecVars ( void  ) const
inlinevirtual

Definition at line 128 of file GHepRecord.h.

References fDiffXSecPhSp.

128 { return fDiffXSecPhSp; }
KinePhaseSpace_t fDiffXSecPhSp
specifies which differential cross-section (dsig/dQ2, dsig/dQ2dW, dsig/dxdy,...)
Definition: GHepRecord.h:182
virtual TBits* genie::GHepRecord::EventFlags ( void  ) const
inlinevirtual

Definition at line 117 of file GHepRecord.h.

References fEventFlags.

Referenced by genie::SKHadronicSystemGenerator::CalculateHadronicSystem_AtharSingleKaon(), genie::SKKinematicsGenerator::CalculateKin_AtharSingleKaon(), Copy(), genie::FermiMover::KickHitNucleon(), genie::KineGeneratorWithCache::MaxXSec(), genie::DFRPrimaryLeptonGenerator::ProcessEventRecord(), genie::HELeptonKinematicsGenerator::ProcessEventRecord(), genie::DISPrimaryLeptonGenerator::ProcessEventRecord(), genie::DFRHadronicSystemGenerator::ProcessEventRecord(), genie::NuEKinematicsGenerator::ProcessEventRecord(), genie::DFRKinematicsGenerator::ProcessEventRecord(), genie::SKPrimaryLeptonGenerator::ProcessEventRecord(), genie::DMEKinematicsGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::ProcessEventRecord(), genie::DMDISOutgoingDarkGenerator::ProcessEventRecord(), genie::RESKinematicsGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::IBDKinematicsGenerator::ProcessEventRecord(), genie::DMELKinematicsGenerator::ProcessEventRecord(), genie::DISKinematicsGenerator::ProcessEventRecord(), genie::HEDISKinematicsGenerator::ProcessEventRecord(), genie::DMELEventGenerator::ProcessEventRecord(), genie::DMDISKinematicsGenerator::ProcessEventRecord(), genie::PauliBlocker::ProcessEventRecord(), genie::QELEventGeneratorSM::ProcessEventRecord(), genie::SPPEventGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::SpectralFuncExperimentalCode(), genie::DMELKinematicsGenerator::SpectralFuncExperimentalCode(), and genie::COHKinematicsGenerator::throwOnTooManyIterations().

117 { return fEventFlags; }
TBits * fEventFlags
event flags indicating various pathologies or an unphysical event
Definition: GHepRecord.h:174
GEvGenMode_t GHepRecord::EventGenerationMode ( void  ) const

Definition at line 209 of file GHepRecord.cxx.

References genie::pdg::IsAntiDarkMatter(), genie::pdg::IsDarkMatter(), genie::pdg::IsHadron(), genie::pdg::IsHNL(), genie::pdg::IsIon(), genie::pdg::IsLepton(), genie::pdg::IsNucleon(), genie::kGMdDarkMatterNucleus, genie::kGMdHadronNucleus, genie::kGMdHNLDecay, genie::kGMdLeptonNucleus, genie::kGMdNucleonDecay, genie::kGMdPhotonNucleus, genie::kGMdUnknown, genie::kIStDecayedState, genie::kIStInitialState, genie::kPdgGamma, Particle(), genie::GHepParticle::Pdg(), and genie::GHepParticle::Status().

Referenced by ProbePosition(), genie::Intranuke2018::ProcessEventRecord(), genie::Intranuke::ProcessEventRecord(), and TargetNucleusPosition().

210 {
211  GHepParticle * p0 = this->Particle(0);
212  if(!p0) return kGMdUnknown;
213  GHepParticle * p1 = this->Particle(1);
214  if(!p1) return kGMdUnknown;
215 
216  int p0pdg = p0->Pdg();
217  GHepStatus_t p0st = p0->Status();
218  int p1pdg = p1->Pdg();
219  GHepStatus_t p1st = p1->Status();
220 
221  // In lepton+nucleon/nucleus mode, the 1st entry in the event record
222  // is a charged or neutral lepton with status code = kIStInitialState
223  if( pdg::IsLepton(p0pdg) && p0st == kIStInitialState )
224  {
225  return kGMdLeptonNucleus;
226  }
227 
228  // In dark matter mode, the 1st entry in the event record is a dark
229  // matter particle
230  if( (pdg::IsDarkMatter(p0pdg) || pdg::IsAntiDarkMatter(p0pdg)) && p0st == kIStInitialState )
231  {
232  return kGMdDarkMatterNucleus;
233  }
234 
235  // In hadron+nucleon/nucleus mode, the 1st entry in the event record
236  // is a hadron with status code = kIStInitialState and the 2nd entry
237  // is a nucleon or nucleus with status code = kIStInitialState
238  if( pdg::IsHadron(p0pdg) && p0st == kIStInitialState )
239  {
240  if( (pdg::IsIon(p1pdg) || pdg::IsNucleon(p1pdg)) && p1st == kIStInitialState)
241  {
242  return kGMdHadronNucleus;
243  }
244  }
245 
246  // As above, with a photon as a probe
247  if( p0pdg == kPdgGamma && p0st == kIStInitialState )
248  {
249  if( (pdg::IsIon(p1pdg) || pdg::IsNucleon(p1pdg)) && p1st == kIStInitialState)
250  {
251  return kGMdPhotonNucleus;
252  }
253  }
254 
255  // In nucleon decay mode,
256  // - [if the decayed nucleon was a bound one] the 1st entry in the event
257  // record is a nucleus with status code = kIStInitialState and the
258  // 2nd entry is a nucleon with code = kIStDecayedState
259  // - [if the decayed nucleon was a free one] the first entry in the event
260  // record is a nucleon with status code = kIStInitialState and it has a
261  // single daughter which is a nucleon with status code = kIStDecayedState.
262 
263  if( pdg::IsIon(p0pdg) && p0st == kIStInitialState &&
264  pdg::IsNucleon(p1pdg) && p1st == kIStDecayedState)
265  {
266  return kGMdNucleonDecay;
267  }
268  if( pdg::IsNucleon(p0pdg) && p0st == kIStInitialState &&
269  pdg::IsNucleon(p1pdg) && p1st == kIStDecayedState)
270  {
271  return kGMdNucleonDecay;
272  }
273 
274  // In HNL decay mode, the first entry is a HNL.
275 
276  if( pdg::IsHNL(p0pdg) && p0st == kIStInitialState )
277  {
278  return kGMdHNLDecay;
279  }
280 
281  return kGMdUnknown;
282 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
bool IsNucleon(int pdgc)
Definition: PDGUtils.cxx:346
bool IsDarkMatter(int pdgc)
Definition: PDGUtils.cxx:127
bool IsHNL(int pdgc)
Definition: PDGUtils.cxx:419
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
int Pdg(void) const
Definition: GHepParticle.h:63
bool IsHadron(int pdgc)
Definition: PDGUtils.cxx:392
bool IsAntiDarkMatter(int pdgc)
Definition: PDGUtils.cxx:133
const int kPdgGamma
Definition: PDGCodes.h:189
bool IsIon(int pdgc)
Definition: PDGUtils.cxx:42
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
bool IsLepton(int pdgc)
Definition: PDGUtils.cxx:86
enum genie::EGHepStatus GHepStatus_t
virtual TBits* genie::GHepRecord::EventMask ( void  ) const
inlinevirtual

Definition at line 118 of file GHepRecord.h.

References fEventMask.

Referenced by Copy().

118 { return fEventMask; }
TBits * fEventMask
an input bit-field mask allowing one to ignore bits set in fEventFlags
Definition: GHepRecord.h:175
void GHepRecord::FinalizeDaughterLists ( void  )
protectedvirtual

Definition at line 799 of file GHepRecord.cxx.

References genie::GHepParticle::FirstMother().

Referenced by CompactifyDaughterLists().

800 {
801 // Update all daughter-lists based on particle 'first mother' field.
802 // To work correctly, the daughter-lists must have been compactified first.
803 
804  GHepParticle * p1 = 0;
805  TIter iter1(this);
806  int i1=0;
807  while( (p1 = (GHepParticle *)iter1.Next()) ) {
808  int dau1 = -1;
809  int dau2 = -1;
810  GHepParticle * p2 = 0;
811  TIter iter2(this);
812  int i2=0;
813  while( (p2 = (GHepParticle *)iter2.Next()) ) {
814 
815  if(p2->FirstMother() == i1) {
816  dau1 = (dau1<0) ? i2 : TMath::Min(dau1,i2);
817  dau2 = (dau2<0) ? i2 : TMath::Max(dau2,i2);
818  }
819  i2++;
820  }
821  i1++;
822  p1 -> SetFirstDaughter (dau1);
823  p1 -> SetLastDaughter (dau2);
824  }
825 }
int FirstMother(void) const
Definition: GHepParticle.h:66
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
GHepParticle * GHepRecord::FinalStateHadronicSystem ( void  ) const
virtual

Definition at line 342 of file GHepRecord.cxx.

References FinalStateHadronicSystemPosition(), and Particle().

Referenced by genie::DISHadronicSystemGenerator::SimulateFormationZone().

343 {
344 // Returns the GHepParticle representing the sum of the DIS pre-fragm f/s
345 // hadronic system, or 0 if it does not exist.
346 
347  int ipos = this->FinalStateHadronicSystemPosition();
348  if(ipos>-1) return this->Particle(ipos);
349  return 0;
350 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
virtual int FinalStateHadronicSystemPosition(void) const
Definition: GHepRecord.cxx:471
int GHepRecord::FinalStateHadronicSystemPosition ( void  ) const
virtual

Definition at line 471 of file GHepRecord.cxx.

References genie::kIStDISPreFragmHadronicState, genie::kPdgHadronicSyst, and ParticlePosition().

Referenced by FinalStateHadronicSystem().

472 {
473  return this->ParticlePosition(
475 }
virtual int ParticlePosition(int pdg, GHepStatus_t i, int start=0) const
Definition: GHepRecord.cxx:137
const int kPdgHadronicSyst
Definition: PDGCodes.h:210
GHepParticle * GHepRecord::FinalStatePrimaryLepton ( void  ) const
virtual

Definition at line 333 of file GHepRecord.cxx.

References FinalStatePrimaryLeptonPosition(), and Particle().

Referenced by genie::NuETargetRemnantGenerator::AddElectronNeutrino(), genie::DMETargetRemnantGenerator::AddElectronNeutrino(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_AlvarezRuso(), genie::SKHadronicSystemGenerator::CalculateHadronicSystem_AtharSingleKaon(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_BergerSehgalFM(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_ReinSehgal(), genie::hnl::Decayer::GenerateDecayProducts(), genie::HadronicSystemGenerator::Hadronic4pLAB(), genie::HadronicSystemGenerator::MomentumTransferLAB(), genie::DFRHadronicSystemGenerator::ProcessEventRecord(), genie::DFRPrimaryLeptonGenerator::ProcessEventRecord(), genie::DISPrimaryLeptonGenerator::ProcessEventRecord(), genie::SKPrimaryLeptonGenerator::ProcessEventRecord(), genie::DMDISOutgoingDarkGenerator::ProcessEventRecord(), genie::OutgoingDarkGenerator::SetPolarization(), genie::utils::SetPrimaryLeptonPolarization(), and genie::hnl::Decayer::UpdateEventRecord().

334 {
335 // Returns the GHepParticle representing the final state primary lepton.
336 
337  int ipos = this->FinalStatePrimaryLeptonPosition();
338  if(ipos>-1) return this->Particle(ipos);
339  return 0;
340 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
virtual int FinalStatePrimaryLeptonPosition(void) const
Definition: GHepRecord.cxx:459
int GHepRecord::FinalStatePrimaryLeptonPosition ( void  ) const
virtual

Definition at line 459 of file GHepRecord.cxx.

References genie::GHepParticle::FirstDaughter(), and Probe().

Referenced by FinalStatePrimaryLepton().

460 {
461 // Returns the GHEP position GHepParticle representing the final state
462 // primary lepton.
463 
464  GHepParticle * probe = this->Probe();
465  if(!probe) return -1;
466 
467  int ifsl = probe->FirstDaughter();
468  return ifsl;
469 }
int FirstDaughter(void) const
Definition: GHepParticle.h:68
virtual GHepParticle * Probe(void) const
Definition: GHepRecord.cxx:284
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
GHepParticle * GHepRecord::FindParticle ( int  pdg,
GHepStatus_t  ist,
int  start 
) const
virtual

Definition at line 118 of file GHepRecord.cxx.

References LOG, genie::GHepParticle::Pdg(), pINFO, and genie::GHepParticle::Status().

Referenced by genie::NucBindEnergyAggregator::ProcessEventRecord().

120 {
121 // Returns the first GHepParticle with the input pdg-code and status
122 // starting from the specified position of the event record.
123 
124  int nentries = this->GetEntries();
125  for(int i = start; i < nentries; i++) {
126  GHepParticle * p = (GHepParticle *) (*this)[i];
127  if(p->Status() == status && p->Pdg() == pdg) return p;
128  }
129 
130  LOG("GHEP", pINFO)
131  << "No particle found with: (pos >= " << start
132  << ", pdg = " << pdg << ", ist = " << status << ")";
133 
134  return 0;
135 }
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
int Pdg(void) const
Definition: GHepParticle.h:63
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
int GHepRecord::FirstNonInitStateEntry ( void  )
protectedvirtual

Definition at line 739 of file GHepRecord.cxx.

References genie::kIStInitialState, genie::kIStNucleonTarget, and genie::GHepParticle::Status().

740 {
741  GHepParticle * p = 0;
742  TIter iter(this);
743  int pos = 0;
744  while( (p = (GHepParticle *)iter.Next()) ) {
745  int ist = p->Status();
746  if(ist != kIStInitialState && ist != kIStNucleonTarget) return pos;
747  pos++;
748  }
749  return pos;
750 }
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
int GHepRecord::GetPrintLevel ( )
static

Definition at line 960 of file GHepRecord.cxx.

References fPrintLevel.

961 {
962  return fPrintLevel;
963 }
static int fPrintLevel
Definition: GHepRecord.h:196
vector< int > * GHepRecord::GetStableDescendants ( int  position) const
virtual

Definition at line 174 of file GHepRecord.cxx.

References genie::GHepParticle::FirstMother(), genie::kIStStableFinalState, Particle(), and genie::GHepParticle::Status().

Referenced by genie::utils::intranuke::PreEquilibrium(), and genie::utils::intranuke2018::PreEquilibrium().

175 {
176 // Returns a list of all stable descendants of the GHEP entry in the input
177 // slot. The user adopts the output vector.
178 
179  // return null if particle index is out of range
180  int nentries = this->GetEntries();
181  if(position<0 || position>=nentries) return 0;
182 
183  vector<int> * descendants = new vector<int>;
184 
185  // return itself if it is a stable final state particle
186  if(this->Particle(position)->Status() == kIStStableFinalState) {
187  descendants->push_back(position);
188  return descendants;
189  }
190 
191  for(int i = 0; i < nentries; i++) {
192  if(i==position) continue;
193  GHepParticle * p = (GHepParticle *) (*this)[i];
194  if(p->Status() != kIStStableFinalState) continue;
195  bool is_descendant=false;
196  int mom = p->FirstMother();
197  while(mom>-1) {
198  if(mom==position) is_descendant=true;
199  if(is_descendant) {
200  descendants->push_back(i);
201  break;
202  }
203  mom = this->Particle(mom)->FirstMother();
204  }
205  }
206  return descendants;
207 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
int FirstMother(void) const
Definition: GHepParticle.h:66
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
bool GHepRecord::HasCompactDaughterList ( int  pos)
protectedvirtual

Definition at line 700 of file GHepRecord.cxx.

References genie::GHepParticle::FirstMother(), LOG, pDEBUG, and pINFO.

Referenced by CompactifyDaughterLists().

701 {
702 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
703  LOG("GHEP", pDEBUG) << "Examining daughter-list of particle at: " << pos;
704 #endif
705  vector<int> daughters;
706  GHepParticle * p = 0;
707  TIter iter(this);
708  int i=0;
709  while( (p = (GHepParticle *)iter.Next()) ) {
710  if(p->FirstMother() == pos) {
711 
712 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
713  LOG("GHEP", pDEBUG) << "Particle at: " << i << " is a daughter";
714 #endif
715  daughters.push_back(i);
716  }
717  i++;
718  }
719 
720  bool is_compact = true;
721  if(daughters.size()>1) {
722  sort(daughters.begin(), daughters.end());
723  vector<int>::iterator diter = daughters.begin();
724  int prev = *diter;
725  for(; diter != daughters.end(); ++diter) {
726  int curr = *diter;
727  is_compact = is_compact && (TMath::Abs(prev-curr)<=1);
728  prev = curr;
729  }
730  }
731 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
732  LOG("GHEP", pINFO)
733  << "Daughter-list of particle at: " << pos << " is "
734  << (is_compact ? "" : "not") << " compact";
735 #endif
736  return is_compact;
737 }
int FirstMother(void) const
Definition: GHepParticle.h:66
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
#define pDEBUG
Definition: Messenger.h:63
GHepParticle * GHepRecord::HitElectron ( void  ) const
virtual

Definition at line 323 of file GHepRecord.cxx.

References HitElectronPosition(), and Particle().

Referenced by genie::NuETargetRemnantGenerator::AddElectronNeutrino(), and genie::DMETargetRemnantGenerator::AddElectronNeutrino().

324 {
325 // Returns the GHepParticle representing the struck electron, or 0 if it does
326 // not exist.
327 
328  int ipos = this->HitElectronPosition();
329  if(ipos>-1) return this->Particle(ipos);
330  return 0;
331 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
virtual int HitElectronPosition(void) const
Definition: GHepRecord.cxx:441
int GHepRecord::HitElectronPosition ( void  ) const
virtual

Definition at line 441 of file GHepRecord.cxx.

References genie::pdg::IsElectron(), genie::kIStInitialState, Particle(), genie::GHepParticle::Pdg(), genie::GHepParticle::Status(), and TargetNucleus().

Referenced by genie::NuETargetRemnantGenerator::AddElectronNeutrino(), genie::DMETargetRemnantGenerator::AddElectronNeutrino(), and HitElectron().

442 {
443 // Returns the GHEP position of the GHepParticle representing a hit electron.
444 // Same as above..
445 
446  GHepParticle * nucleus = this->TargetNucleus();
447 
448  int ipos = (nucleus) ? 2 : 1;
449 
450  GHepParticle * p = this->Particle(ipos);
451  if(!p) return -1;
452 
453  bool ise = pdg::IsElectron(p->Pdg());
454  if(ise && p->Status()==kIStInitialState) return ipos;
455 
456  return -1;
457 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
int Pdg(void) const
Definition: GHepParticle.h:63
virtual GHepParticle * TargetNucleus(void) const
Definition: GHepRecord.cxx:293
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
bool IsElectron(int pdgc)
Definition: PDGUtils.cxx:188
GHepParticle * GHepRecord::HitNucleon ( void  ) const
virtual

Definition at line 313 of file GHepRecord.cxx.

References HitNucleonPosition(), and Particle().

Referenced by genie::AMNuGammaGenerator::AddPhoton(), genie::AMNuGammaGenerator::AddRecoilNucleon(), genie::HadronicSystemGenerator::AddTargetNucleusRemnant(), genie::AMNuGammaGenerator::AddTargetRemnant(), genie::NucDeExcitationSim::ArgonTargetSim(), genie::SKHadronicSystemGenerator::CalculateHadronicSystem_AtharSingleKaon(), genie::NucDeExcitationSim::CarbonTargetSim(), genie::SecondNucleonEmissionI::EmitSecondNucleon(), genie::HadronicSystemGenerator::Hadronic4pLAB(), genie::FermiMover::KickHitNucleon(), genie::NucDeExcitationSim::OxygenTargetSim(), genie::DFRHadronicSystemGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::PhotonRESGenerator::ProcessEventRecord(), genie::DMELKinematicsGenerator::ProcessEventRecord(), genie::SRCNuclearRecoil::ProcessEventRecord(), genie::DMELEventGenerator::ProcessEventRecord(), genie::FermiMover::ProcessEventRecord(), genie::PauliBlocker::ProcessEventRecord(), genie::SpectralFunction2p2h::ProcessEventRecord(), genie::QELEventGeneratorSM::ProcessEventRecord(), genie::SPPEventGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::SpectralFuncExperimentalCode(), and genie::DMELKinematicsGenerator::SpectralFuncExperimentalCode().

314 {
315 // Returns the GHepParticle representing the struck nucleon, or 0 if it does
316 // not exist.
317 
318  int ipos = this->HitNucleonPosition();
319  if(ipos>-1) return this->Particle(ipos);
320  return 0;
321 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
virtual int HitNucleonPosition(void) const
Definition: GHepRecord.cxx:418
int GHepRecord::HitNucleonPosition ( void  ) const
virtual

Definition at line 418 of file GHepRecord.cxx.

References genie::pdg::Is2NucleonCluster(), genie::pdg::IsNucleon(), genie::kIStInitialState, genie::kIStNucleonTarget, Particle(), genie::GHepParticle::Pdg(), genie::GHepParticle::Status(), and TargetNucleus().

Referenced by genie::HadronicSystemGenerator::AddFinalHadronicSyst(), genie::QELHadronicSystemGenerator::AddRecoilBaryon(), genie::IBDHadronicSystemGenerator::AddRecoilBaryon(), genie::AMNuGammaGenerator::AddRecoilNucleon(), genie::RSPPResonanceSelector::AddResonance(), genie::RESHadronicSystemGenerator::AddResonance(), genie::SKHadronicSystemGenerator::CalculateHadronicSystem_AtharSingleKaon(), HitNucleon(), genie::DFRHadronicSystemGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::DMELEventGenerator::ProcessEventRecord(), genie::QELEventGeneratorSM::ProcessEventRecord(), and genie::SPPEventGenerator::ProcessEventRecord().

419 {
420 // Returns the GHEP position of the GHepParticle representing the hit nucleon.
421 // If a struck nucleon is set it will be at slot 2 (for scattering off nuclear
422 // targets) or at slot 1 (for free nucleon scattering).
423 // If the struck nucleon is not set (eg coherent scattering, ve- scattering)
424 // it returns 0.
425 
426  GHepParticle * nucleus = this->TargetNucleus();
427 
428  int ipos = (nucleus) ? 2 : 1;
429  GHepStatus_t ist = (nucleus) ? kIStNucleonTarget : kIStInitialState;
430 
431  GHepParticle * p = this->Particle(ipos);
432  if(!p) return -1;
433 
434 // bool isN = pdg::IsNeutronOrProton(p->Pdg());
435  bool isN = pdg::IsNucleon(p->Pdg()) || pdg::Is2NucleonCluster(p->Pdg());
436  if(isN && p->Status()==ist) return ipos;
437 
438  return -1;
439 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
bool IsNucleon(int pdgc)
Definition: PDGUtils.cxx:346
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
int Pdg(void) const
Definition: GHepParticle.h:63
virtual GHepParticle * TargetNucleus(void) const
Definition: GHepRecord.cxx:293
bool Is2NucleonCluster(int pdgc)
Definition: PDGUtils.cxx:402
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
enum genie::EGHepStatus GHepStatus_t
void GHepRecord::InitRecord ( void  )
protected

Definition at line 837 of file GHepRecord.cxx.

References fDiffXSec, fDiffXSecPhSp, fEventFlags, fEventMask, fInteraction, fProb, fVtx, fWeight, fXSec, genie::kPSNull, LOG, genie::GHepFlags::NFlags(), pDEBUG, and pINFO.

Referenced by GHepRecord(), and ResetRecord().

838 {
839 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
840  LOG("GHEP", pDEBUG) << "Initializing GHepRecord";
841 #endif
842  fInteraction = 0;
843  fWeight = 1.;
844  fProb = 1.;
845  fXSec = 0.;
846  fDiffXSec = 0.;
848  fVtx = new TLorentzVector(0,0,0,0);
849 
850  fEventFlags = new TBits(GHepFlags::NFlags());
851  fEventFlags -> ResetAllBits(false);
852 
853  fEventMask = new TBits(GHepFlags::NFlags());
854 //fEventMask -> ResetAllBits(true);
855  for(unsigned int i = 0; i < GHepFlags::NFlags(); i++) {
856  fEventMask->SetBitNumber(i, true);
857  }
858 
859  LOG("GHEP", pINFO)
860  << "Initialised unphysical event mask (bits: " << GHepFlags::NFlags() - 1
861  << " -> 0) : " << *fEventMask;
862 
863  this->SetOwner(true);
864 }
double fProb
event probability (for given flux neutrino and density-weighted path-length for target element) ...
Definition: GHepRecord.h:179
TLorentzVector * fVtx
vertex in the detector coordinate system
Definition: GHepRecord.h:171
TBits * fEventMask
an input bit-field mask allowing one to ignore bits set in fEventFlags
Definition: GHepRecord.h:175
double fXSec
cross section for selected event
Definition: GHepRecord.h:180
Interaction * fInteraction
attached summary information
Definition: GHepRecord.h:168
TBits * fEventFlags
event flags indicating various pathologies or an unphysical event
Definition: GHepRecord.h:174
static unsigned int NFlags(void)
Definition: GHepFlags.h:76
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
KinePhaseSpace_t fDiffXSecPhSp
specifies which differential cross-section (dsig/dQ2, dsig/dQ2dW, dsig/dxdy,...)
Definition: GHepRecord.h:182
double fWeight
event weight
Definition: GHepRecord.h:178
double fDiffXSec
differential cross section for selected event kinematics
Definition: GHepRecord.h:181
#define pDEBUG
Definition: Messenger.h:63
virtual bool genie::GHepRecord::IsUnphysical ( void  ) const
inlinevirtual

Definition at line 119 of file GHepRecord.h.

References fEventFlags.

Referenced by GenerateEvent(), and Print().

119 { return (fEventFlags->CountBits()>0); }
TBits * fEventFlags
event flags indicating various pathologies or an unphysical event
Definition: GHepRecord.h:174
unsigned int GHepRecord::NEntries ( int  pdg,
GHepStatus_t  ist,
int  start = 0 
) const
virtual

Definition at line 477 of file GHepRecord.cxx.

References genie::GHepParticle::Pdg(), and genie::GHepParticle::Status().

478 {
479  unsigned int nentries = 0;
480 
481  for(int i = start; i < this->GetEntries(); i++) {
482  GHepParticle * p = (GHepParticle *) (*this)[i];
483  if(p->Pdg()==pdg && p->Status()==ist) nentries++;
484  }
485  return nentries;
486 }
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
int Pdg(void) const
Definition: GHepParticle.h:63
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
unsigned int GHepRecord::NEntries ( int  pdg,
int  start = 0 
) const
virtual

Definition at line 488 of file GHepRecord.cxx.

References genie::GHepParticle::Pdg().

489 {
490  unsigned int nentries = 0;
491 
492  for(int i = start; i < this->GetEntries(); i++) {
493  GHepParticle * p = (GHepParticle *) (*this)[i];
494  if(p->Pdg()==pdg) nentries++;
495  }
496  return nentries;
497 }
int Pdg(void) const
Definition: GHepParticle.h:63
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
GHepParticle * GHepRecord::Particle ( int  position) const
virtual

Definition at line 104 of file GHepRecord.cxx.

References LOG, and pINFO.

Referenced by AcceptEvent(), genie::AMNuGammaGenerator::AddFinalStateNeutrino(), genie::hnl::Decayer::AddInitialState(), genie::NucDeExcitationSim::AddPhoton(), genie::QELHadronicSystemGenerator::AddRecoilBaryon(), genie::IBDHadronicSystemGenerator::AddRecoilBaryon(), genie::RSPPHadronicSystemGenerator::AddResonanceDecayProducts(), genie::QELEventGenerator::AddTargetNucleusRemnant(), genie::FermiMover::AddTargetNucleusRemnant(), genie::DMELEventGenerator::AddTargetNucleusRemnant(), genie::QELEventGeneratorSM::AddTargetNucleusRemnant(), genie::AMNuGammaGenerator::AddTargetRemnant(), CompactifyDaughterLists(), EventGenerationMode(), FinalStateHadronicSystem(), FinalStatePrimaryLepton(), genie::hnl::Decayer::GenerateDecayProducts(), GetStableDescendants(), HitElectron(), HitElectronPosition(), HitNucleon(), HitNucleonPosition(), main(), genie::utils::ghep::NeutReactionCode(), genie::utils::intranuke::PreEquilibrium(), genie::utils::intranuke2018::PreEquilibrium(), Probe(), genie::HEDISGenerator::ProcessEventRecord(), genie::NucBindEnergyAggregator::ProcessEventRecord(), genie::PauliBlocker::ProcessEventRecord(), genie::hnl::VertexGenerator::ProcessEventRecord(), genie::hnl::FluxCreator::ProcessEventRecord(), RemnantNucleus(), RemnantNucleusPosition(), genie::HAIntranuke::SimulateHadronicFinalState(), genie::HAIntranuke2018::SimulateHadronicFinalState(), genie::HNIntranuke2018::SimulateHadronicFinalState(), genie::HAIntranuke::SimulateHadronicFinalStateKinematics(), genie::HAIntranuke2018::SimulateHadronicFinalStateKinematics(), SwapParticles(), TargetNucleus(), TargetNucleusPosition(), genie::Intranuke::TransportHadrons(), genie::Intranuke2018::TransportHadrons(), UpdateDaughterLists(), and genie::hnl::Decayer::UpdateEventRecord().

105 {
106 // Returns the GHepParticle from the specified position of the event record.
107 
108  if( position >=0 && position < this->GetEntries() ) {
109  GHepParticle * particle = (GHepParticle *) (*this)[position];
110  if(particle) return particle;
111  }
112  LOG("GHEP", pINFO)
113  << "No particle found with: (pos = " << position << ")";
114 
115  return 0;
116 }
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
int GHepRecord::ParticlePosition ( int  pdg,
GHepStatus_t  i,
int  start = 0 
) const
virtual

Definition at line 137 of file GHepRecord.cxx.

References LOG, genie::GHepParticle::Pdg(), pINFO, and genie::GHepParticle::Status().

Referenced by FinalStateHadronicSystemPosition(), genie::utils::intranuke::PhaseSpaceDecay(), and genie::utils::intranuke2018::PhaseSpaceDecay().

139 {
140 // Returns the position of the first GHepParticle with the input pdg-code
141 // and status starting from the specified position of the event record.
142 
143  int nentries = this->GetEntries();
144  for(int i = start; i < nentries; i++) {
145  GHepParticle * p = (GHepParticle *) (*this)[i];
146  if(p->Status() == status && p->Pdg() == pdg) return i;
147  }
148 
149  LOG("GHEP", pINFO)
150  << "No particle found with: (pos >= " << start
151  << ", pdg = " << pdg << ", ist = " << status << ")";
152 
153  return -1;
154 }
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
int Pdg(void) const
Definition: GHepParticle.h:63
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
int GHepRecord::ParticlePosition ( GHepParticle particle,
int  start = 0 
) const
virtual

Definition at line 156 of file GHepRecord.cxx.

References genie::GHepParticle::Compare(), LOG, and pINFO.

157 {
158 // Returns the position of the first match with the specified GHepParticle
159 // starting from the specified position of the event record.
160 
161  int nentries = this->GetEntries();
162  for(int i = start; i < nentries; i++) {
163  GHepParticle * p = (GHepParticle *) (*this)[i];
164  if( p->Compare(particle) ) return i;
165  }
166 
167  LOG("GHEP", pINFO)
168  << "No particle found with pos >= " << start
169  << " matching particle: " << *particle;
170 
171  return -1;
172 }
bool Compare(const GHepParticle *p) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
void GHepRecord::Print ( ostream &  stream) const

Definition at line 965 of file GHepRecord.cxx.

References Accept(), genie::utils::print::BoolAsYNString(), genie::units::cm2, genie::GHepFlags::Describe(), genie::GHepParticle::E(), fDiffXSec, fDiffXSecPhSp, fEventFlags, fEventMask, fInteraction, genie::GHepParticle::FirstDaughter(), genie::GHepParticle::FirstMother(), fPrintLevel, fWeight, fXSec, genie::GHepParticle::GetPolarization(), genie::GHepParticle::IsOnMassShell(), IsUnphysical(), genie::kIStFinalStateNuclearRemnant, genie::kIStInitialState, genie::kIStStableFinalState, genie::kPSQ2fE, genie::kPSQ2vpfE, genie::kPSWQ2ctpphipfE, genie::kPSWQ2fE, genie::kPSxyfE, genie::kPSxytfE, genie::kPSyfE, genie::GHepParticle::LastDaughter(), genie::GHepParticle::LastMother(), genie::GHepParticle::Mass(), genie::GHepParticle::Name(), genie::GHepParticle::P4(), genie::GHepParticle::Pdg(), genie::GHepParticle::PolzIsSet(), Probe(), genie::GHepParticle::Px(), genie::GHepParticle::Py(), genie::GHepParticle::Pz(), genie::GHepParticle::RescatterCode(), genie::GHepParticle::Status(), Vertex(), genie::GHepParticle::Vt(), genie::GHepParticle::Vx(), genie::GHepParticle::Vy(), and genie::GHepParticle::Vz().

Referenced by genie::operator<<(), and genie::EventRecord::Print().

966 {
967  // Print levels:
968  // 0 -> prints particle list
969  // 1 -> prints particle list + event flags
970  // 2 -> prints particle list + event flags + wght/xsec
971  // 3 -> prints particle list + event flags + wght/xsec + summary
972  // 10 -> as in level 0 but showing particle positions too
973  // 11 -> as in level 1 but showing particle positions too
974  // 12 -> as in level 2 but showing particle positions too
975  // 13 -> as in level 3 but showing particle positions too
976 
977  bool accept_input_print_level =
978  (fPrintLevel >= 0 && fPrintLevel <= 3) ||
979  (fPrintLevel >=10 && fPrintLevel <=13);
980 
981  int printlevel = (accept_input_print_level) ? fPrintLevel : 3;
982  int printlevel_orig = printlevel;
983 
984  bool showpos = false;
985  if(printlevel >= 10) {
986  printlevel-=10;
987  showpos=true;
988  }
989 
990  stream << "\n\n|";
991  stream << setfill('-') << setw(115) << "|";
992 
993  stream << "\n|GENIE GHEP Event Record [print level: "
994  << setfill(' ') << setw(3) << printlevel_orig << "]"
995  << setfill(' ') << setw(73) << "|";
996 
997  stream << "\n|";
998  stream << setfill('-') << setw(115) << "|";
999 
1000  stream << "\n| ";
1001  stream << setfill(' ') << setw(6) << "Idx | "
1002  << setfill(' ') << setw(16) << "Name | "
1003  << setfill(' ') << setw(6) << "Ist | "
1004  << setfill(' ') << setw(13) << "PDG | "
1005  << setfill(' ') << setw(12) << "Mother | "
1006  << setfill(' ') << setw(12) << "Daughter | "
1007  << setfill(' ') << setw(10) << ((showpos) ? "Px(x) |" : "Px | ")
1008  << setfill(' ') << setw(10) << ((showpos) ? "Py(y) |" : "Py | ")
1009  << setfill(' ') << setw(10) << ((showpos) ? "Pz(z) |" : "Pz | ")
1010  << setfill(' ') << setw(10) << ((showpos) ? "E(t) |" : "E | ")
1011  << setfill(' ') << setw(10) << "m | ";
1012 
1013  stream << "\n|";
1014  stream << setfill('-') << setw(115) << "|";
1015 
1016  GHepParticle * p = 0;
1017  TObjArrayIter piter(this);
1018  TVector3 polarization(0,0,0);
1019 
1020  unsigned int idx = 0;
1021 
1022  double sum_E = 0;
1023  double sum_px = 0;
1024  double sum_py = 0;
1025  double sum_pz = 0;
1026 
1027  while( (p = (GHepParticle *) piter.Next()) ) {
1028 
1029  stream << "\n| ";
1030  stream << setfill(' ') << setw(3) << idx++ << " | ";
1031  stream << setfill(' ') << setw(13) << p->Name() << " | ";
1032  stream << setfill(' ') << setw(3) << p->Status() << " | ";
1033  stream << setfill(' ') << setw(10) << p->Pdg() << " | ";
1034  stream << setfill(' ') << setw(3) << p->FirstMother() << " | ";
1035  stream << setfill(' ') << setw(3) << p->LastMother() << " | ";
1036  stream << setfill(' ') << setw(3) << p->FirstDaughter() << " | ";
1037  stream << setfill(' ') << setw(3) << p->LastDaughter() << " | ";
1038  stream << std::fixed << setprecision(3);
1039  stream << setfill(' ') << setw(7) << p->Px() << " | ";
1040  stream << setfill(' ') << setw(7) << p->Py() << " | ";
1041  stream << setfill(' ') << setw(7) << p->Pz() << " | ";
1042  stream << setfill(' ') << setw(7) << p->E() << " | ";
1043 
1044  if (p->IsOnMassShell())
1045  stream << setfill(' ') << setw(7) << p->Mass() << " | ";
1046  else
1047  stream << setfill('*') << setw(7) << p->Mass() << " | M = "
1048  << p->P4()->M() << " ";
1049 
1050  if (p->PolzIsSet()) {
1051  p->GetPolarization(polarization);
1052  stream << "P = (" << polarization.x() << "," << polarization.y()
1053  << "," << polarization.z() << ")";
1054  }
1055 
1056  if (p->RescatterCode() != -1) {
1057  stream << "FSI = " << p->RescatterCode();
1058  }
1059 
1060  // plot particle position if requested
1061  if(showpos) {
1062  stream << "\n| ";
1063  stream << setfill(' ') << setw(6) << " | ";
1064  stream << setfill(' ') << setw(16) << " | ";
1065  stream << setfill(' ') << setw(6) << " | ";
1066  stream << setfill(' ') << setw(13) << " | ";
1067  stream << setfill(' ') << setw(6) << " | ";
1068  stream << setfill(' ') << setw(6) << " | ";
1069  stream << setfill(' ') << setw(6) << " | ";
1070  stream << setfill(' ') << setw(6) << " | ";
1071  stream << std::fixed << setprecision(3);
1072  stream << setfill(' ') << setw(7) << p->Vx() << " | ";
1073  stream << setfill(' ') << setw(7) << p->Vy() << " | ";
1074  stream << setfill(' ') << setw(7) << p->Vz() << " | ";
1075  stream << setfill(' ') << setw(7) << p->Vt() << " | ";
1076  stream << setfill(' ') << setw(10) << " | ";
1077  }
1078 
1079  // compute P4_{final} - P4_{nitial}
1080 
1081  if(p->Status() == kIStStableFinalState ||
1083 
1084  sum_E += p->E();
1085  sum_px += p->Px();
1086  sum_py += p->Py();
1087  sum_pz += p->Pz();
1088  } else
1089  if(p->Status() == kIStInitialState) {
1090  /*
1091  if(p->Status() == kIStInitialState || p->Status() == kIStNucleonTarget) {
1092  */
1093  sum_E -= p->E();
1094  sum_px -= p->Px();
1095  sum_py -= p->Py();
1096  sum_pz -= p->Pz();
1097  }
1098 
1099  } // loop over particles
1100 
1101  stream << "\n|";
1102  stream << setfill('-') << setw(115) << "|";
1103 
1104  // Print SUMS
1105  stream << "\n| ";
1106  stream << setfill(' ') << setw(17) << "Fin-Init: "
1107  << setfill(' ') << setw(6) << " "
1108  << setfill(' ') << setw(18) << " "
1109  << setfill(' ') << setw(12) << " "
1110  << setfill(' ') << setw(12) << " | ";
1111  stream << std::fixed << setprecision(3);
1112  stream << setfill(' ') << setw(7) << sum_px << " | ";
1113  stream << setfill(' ') << setw(7) << sum_py << " | ";
1114  stream << setfill(' ') << setw(7) << sum_pz << " | ";
1115  stream << setfill(' ') << setw(7) << sum_E << " | ";
1116  stream << setfill(' ') << setw(10) << " | ";
1117 
1118  stream << "\n|";
1119  stream << setfill('-') << setw(115) << "|";
1120 
1121  // Print vertex
1122 
1123  GHepParticle * probe = this->Probe();
1124  if(probe){
1125  stream << "\n| ";
1126  stream << setfill(' ') << setw(17) << "Vertex: ";
1127  stream << setfill(' ') << setw(11)
1128  << ((probe) ? probe->Name() : "unknown probe") << " @ (";
1129 
1130  stream << std::fixed << setprecision(5);
1131  stream << "x = " << setfill(' ') << setw(11) << this->Vertex()->X() << " m, ";
1132  stream << "y = " << setfill(' ') << setw(11) << this->Vertex()->Y() << " m, ";
1133  stream << "z = " << setfill(' ') << setw(11) << this->Vertex()->Z() << " m, ";
1134  stream << std::scientific << setprecision(6);
1135  stream << "t = " << setfill(' ') << setw(15) << this->Vertex()->T() << " s) ";
1136  stream << std::fixed << setprecision(3);
1137  stream << setfill(' ') << setw(2) << "|";
1138 
1139  stream << "\n|";
1140  stream << setfill('-') << setw(115) << "|";
1141  }
1142 
1143  // Print FLAGS
1144 
1145  if(printlevel>=1) {
1146  stream << "\n| ";
1147  stream << "Err flag [bits:" << fEventFlags->GetNbits()-1 << "->0] : "
1148  << *fEventFlags << " | "
1149  << "1st set: " << setfill(' ') << setw(56)
1150  << ( this->IsUnphysical() ?
1151  GHepFlags::Describe(GHepFlag_t(fEventFlags->FirstSetBit())) :
1152  "none") << " | ";
1153  stream << "\n| ";
1154  stream << "Err mask [bits:" << fEventMask->GetNbits()-1 << "->0] : "
1155  << *fEventMask << " | "
1156  << "Is unphysical: " << setfill(' ') << setw(5)
1157  << utils::print::BoolAsYNString(this->IsUnphysical()) << " | "
1158  << "Accepted: " << setfill(' ') << setw(5)
1160  << " |";
1161  stream << "\n|";
1162  stream << setfill('-') << setw(115) << "|";
1163  }
1164 
1165  if(printlevel>=2) {
1166  stream << "\n| ";
1167  stream << std::scientific << setprecision(5);
1168 
1169  stream << "sig(Ev) = "
1170  << setfill(' ') << setw(17) << fXSec/units::cm2
1171  << " cm^2 |";
1172 
1173  switch(fDiffXSecPhSp) {
1174  case ( kPSyfE ) :
1175  stream << " dsig(y;E)/dy = " << setfill(' ') << setw(13) << fDiffXSec/units::cm2 << " cm^2 |";
1176  break;
1177  case ( kPSxyfE ) :
1178  stream << " d2sig(x,y;E)/dxdy = " << setfill(' ') << setw(13) << fDiffXSec/units::cm2 << " cm^2 |";
1179  break;
1180  case ( kPSxytfE ) :
1181  stream << " d3sig(x,y,t;E)/dxdydt = " << setfill(' ') << setw(13) << fDiffXSec/units::cm2 << " cm^2/GeV^2 |";
1182  break;
1183  case ( kPSQ2fE ) :
1184  stream << " dsig(Q2;E)/dQ2 = " << setfill(' ') << setw(13) << fDiffXSec/units::cm2 << " cm^2/GeV^2 |";
1185  break;
1186  case ( kPSQ2vpfE ) :
1187  stream << " dsig(Q2,v,p;E)/dQ2dvdp =" << setfill(' ') << setw(13) << fDiffXSec/units::cm2 << " cm^2/GeV^4 |";
1188  break;
1189  case ( kPSWQ2fE ) :
1190  stream << " d2sig(W,Q2;E)/dWdQ2 = " << setfill(' ') << setw(13) << fDiffXSec/units::cm2 << " cm^2/GeV^3 |";
1191  break;
1192  case ( kPSWQ2ctpphipfE ) :
1193  stream << " d4sig(W,Q2,cos(theta),phi;E)/dWdQ2dOmega = " << setfill(' ') << setw(13) << fDiffXSec/units::cm2 << " cm^2/GeV^3 |";
1194  break;
1195  default :
1196  stream << " dsig(Ev;{K_s})/dK = " << setfill(' ') << setw(13) << fDiffXSec/units::cm2 << " cm^2/{K} |";
1197  }
1198  stream << " Weight = "
1199  << setfill(' ') << setw(16)
1200  << std::fixed << setprecision(5)
1201  << fWeight
1202  << " |";
1203 
1204  stream << "\n|";
1205  stream << setfill('-') << setw(115) << "|";
1206  }
1207 
1208  stream << "\n";
1209  stream << setfill(' ');
1210 
1211  if(printlevel==3) {
1212  if(fInteraction) stream << *fInteraction;
1213  else stream << "NULL Interaction!" << endl;
1214  }
1215  stream << "\n";
1216 }
int RescatterCode(void) const
Definition: GHepParticle.h:65
bool IsOnMassShell(void) const
double E(void) const
Get energy.
Definition: GHepParticle.h:91
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:78
int FirstDaughter(void) const
Definition: GHepParticle.h:68
string BoolAsYNString(bool b)
Definition: PrintUtils.cxx:108
enum genie::EGHepFlag GHepFlag_t
TBits * fEventMask
an input bit-field mask allowing one to ignore bits set in fEventFlags
Definition: GHepRecord.h:175
double Mass(void) const
Mass that corresponds to the PDG code.
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:90
static const char * Describe(GHepFlag_t flag)
Definition: GHepFlags.h:42
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
virtual TLorentzVector * Vertex(void) const
Definition: GHepRecord.h:140
double Px(void) const
Get Px.
Definition: GHepParticle.h:88
virtual GHepParticle * Probe(void) const
Definition: GHepRecord.cxx:284
int LastMother(void) const
Definition: GHepParticle.h:67
double Vt(void) const
Get production time.
Definition: GHepParticle.h:97
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.
double fXSec
cross section for selected event
Definition: GHepRecord.h:180
Interaction * fInteraction
attached summary information
Definition: GHepRecord.h:168
int LastDaughter(void) const
Definition: GHepParticle.h:69
TBits * fEventFlags
event flags indicating various pathologies or an unphysical event
Definition: GHepRecord.h:174
virtual bool Accept(void) const
Definition: GHepRecord.cxx:947
static constexpr double cm2
Definition: Units.h:69
bool PolzIsSet(void) const
void GetPolarization(TVector3 &polz)
virtual bool IsUnphysical(void) const
Definition: GHepRecord.h:119
double Vz(void) const
Get production z.
Definition: GHepParticle.h:96
KinePhaseSpace_t fDiffXSecPhSp
specifies which differential cross-section (dsig/dQ2, dsig/dQ2dW, dsig/dxdy,...)
Definition: GHepRecord.h:182
double Vy(void) const
Get production y.
Definition: GHepParticle.h:95
double fWeight
event weight
Definition: GHepRecord.h:178
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
double fDiffXSec
differential cross section for selected event kinematics
Definition: GHepRecord.h:181
static int fPrintLevel
Definition: GHepRecord.h:196
double Vx(void) const
Get production x.
Definition: GHepParticle.h:94
double Py(void) const
Get Py.
Definition: GHepParticle.h:89
virtual double genie::GHepRecord::Probability ( void  ) const
inlinevirtual

Definition at line 125 of file GHepRecord.h.

References fProb.

125 { return fProb; }
double fProb
event probability (for given flux neutrino and density-weighted path-length for target element) ...
Definition: GHepRecord.h:179
GHepParticle * GHepRecord::Probe ( void  ) const
virtual

Definition at line 284 of file GHepRecord.cxx.

References Particle(), and ProbePosition().

Referenced by genie::NuETargetRemnantGenerator::AddElectronNeutrino(), genie::DMETargetRemnantGenerator::AddElectronNeutrino(), genie::MECGenerator::AddFinalStateLepton(), genie::AMNuGammaGenerator::AddFinalStateNeutrino(), genie::AMNuGammaGenerator::AddPhoton(), genie::HEDISGenerator::AddPrimaryLepton(), genie::QELHadronicSystemGenerator::AddRecoilBaryon(), genie::IBDHadronicSystemGenerator::AddRecoilBaryon(), genie::AMNuGammaGenerator::AddRecoilNucleon(), genie::RESHadronicSystemGenerator::AddResonance(), genie::PrimaryLeptonGenerator::AddToEventRecord(), genie::OutgoingDarkGenerator::AddToEventRecord(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_AlvarezRuso(), genie::SKHadronicSystemGenerator::CalculateHadronicSystem_AtharSingleKaon(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_BergerSehgalFM(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_ReinSehgal(), FinalStatePrimaryLeptonPosition(), FindhAFate(), genie::hnl::Decayer::GenerateDecayProducts(), genie::Intranuke::GenerateVertex(), genie::Intranuke2018::GenerateVertex(), genie::HadronicSystemGenerator::Hadronic4pLAB(), genie::HAIntranuke::InelasticHA(), genie::HAIntranuke2018::InelasticHA(), genie::HadronicSystemGenerator::MomentumTransferLAB(), Print(), genie::NuEPrimaryLeptonGenerator::ProcessEventRecord(), genie::DFRHadronicSystemGenerator::ProcessEventRecord(), genie::PrimaryLeptonGenerator::ProcessEventRecord(), genie::DMEOutgoingDarkGenerator::ProcessEventRecord(), genie::PhotonRESGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::OutgoingDarkGenerator::ProcessEventRecord(), genie::PhotonCOHGenerator::ProcessEventRecord(), genie::NormGenerator::ProcessEventRecord(), genie::DMELEventGenerator::ProcessEventRecord(), genie::QELEventGeneratorSM::ProcessEventRecord(), genie::SPPEventGenerator::ProcessEventRecord(), genie::QELEventGeneratorSuSA::SelectLeptonKinematics(), genie::MECGenerator::SelectNSVLeptonKinematics(), and genie::MECGenerator::SelectSuSALeptonKinematics().

285 {
286 // Returns the GHepParticle representing the probe (neutrino, e,...).
287 
288  int ipos = this->ProbePosition();
289  if(ipos>-1) return this->Particle(ipos);
290  return 0;
291 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
virtual int ProbePosition(void) const
Definition: GHepRecord.cxx:352
int GHepRecord::ProbePosition ( void  ) const
virtual

Definition at line 352 of file GHepRecord.cxx.

References EventGenerationMode(), genie::kGMdDarkMatterNucleus, genie::kGMdHadronNucleus, genie::kGMdHNLDecay, genie::kGMdLeptonNucleus, and genie::kGMdPhotonNucleus.

Referenced by genie::COHDNuEventGenerator::AddFinalStateDarkNeutrino(), genie::HEDISGenerator::AddPrimaryLepton(), genie::PrimaryLeptonGenerator::AddToEventRecord(), genie::OutgoingDarkGenerator::AddToEventRecord(), Probe(), genie::QELEventGenerator::ProcessEventRecord(), genie::NormGenerator::ProcessEventRecord(), genie::DMELEventGenerator::ProcessEventRecord(), genie::QELEventGeneratorSM::ProcessEventRecord(), and genie::SPPEventGenerator::ProcessEventRecord().

353 {
354 // Returns the GHEP position of the GHepParticle representing the probe
355 // (neutrino, e,...).
356 
357  // The probe is *always* at slot 0.
358  GEvGenMode_t mode = this->EventGenerationMode();
359  if(mode == kGMdLeptonNucleus ||
360  mode == kGMdDarkMatterNucleus ||
361  mode == kGMdHadronNucleus ||
362  mode == kGMdPhotonNucleus ||
363  mode == kGMdHNLDecay)
364  {
365  return 0;
366  }
367  return -1;
368 }
Enumeration of GENIE event generation modes.
GEvGenMode_t EventGenerationMode(void) const
Definition: GHepRecord.cxx:209
GHepParticle * GHepRecord::RemnantNucleus ( void  ) const
virtual

Definition at line 303 of file GHepRecord.cxx.

References Particle(), and RemnantNucleusPosition().

304 {
305 // Returns the GHepParticle representing the remnant nucleus,
306 // or 0 if it does not exist.
307 
308  int ipos = this->RemnantNucleusPosition();
309  if(ipos>-1) return this->Particle(ipos);
310  return 0;
311 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
virtual int RemnantNucleusPosition(void) const
Definition: GHepRecord.cxx:397
int GHepRecord::RemnantNucleusPosition ( void  ) const
virtual

Definition at line 397 of file GHepRecord.cxx.

References genie::GHepParticle::FirstDaughter(), genie::pdg::IsIon(), genie::kIStStableFinalState, genie::GHepParticle::LastDaughter(), Particle(), genie::GHepParticle::Pdg(), genie::GHepParticle::Status(), and TargetNucleus().

Referenced by genie::HEDISGenerator::ProcessEventRecord(), genie::NucBindEnergyAggregator::ProcessEventRecord(), RemnantNucleus(), genie::Intranuke::TransportHadrons(), and genie::Intranuke2018::TransportHadrons().

398 {
399 // Returns the GHEP position of the GHepParticle representing the remnant
400 // nucleus - or -1 if the interaction takes place at a free nucleon.
401 
402  GHepParticle * p = this->TargetNucleus();
403  if(!p) return -1;
404 
405  int dau1 = p->FirstDaughter();
406  int dau2 = p->LastDaughter();
407 
408  if(dau1==-1 && dau2==-1) return -1;
409 
410  for(int i=dau1; i<=dau2; i++) {
411  GHepParticle * dp = this->Particle(i);
412  int dpdgc = dp->Pdg();
413  if(pdg::IsIon(dpdgc) && dp->Status()==kIStStableFinalState) return i;
414  }
415  return -1;
416 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
int FirstDaughter(void) const
Definition: GHepParticle.h:68
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
int Pdg(void) const
Definition: GHepParticle.h:63
int LastDaughter(void) const
Definition: GHepParticle.h:69
virtual GHepParticle * TargetNucleus(void) const
Definition: GHepRecord.cxx:293
bool IsIon(int pdgc)
Definition: PDGUtils.cxx:42
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
void GHepRecord::RemoveIntermediateParticles ( void  )
virtual

Definition at line 617 of file GHepRecord.cxx.

References genie::kIStInitialState, genie::kIStNucleonTarget, genie::kIStStableFinalState, LOG, genie::GHepParticle::Name(), pDEBUG, pNOTICE, genie::GHepParticle::SetFirstDaughter(), genie::GHepParticle::SetFirstMother(), genie::GHepParticle::SetLastDaughter(), genie::GHepParticle::SetLastMother(), and genie::GHepParticle::Status().

618 {
619  LOG("GHEP", pNOTICE) << "Removing all intermediate particles from GHEP";
620  this->Compress();
621 
622  int i=0;
623  GHepParticle * p = 0;
624 
625  TIter iter(this);
626  while( (p = (GHepParticle *)iter.Next()) ) {
627 
628  if(!p) continue;
629  GHepStatus_t ist = p->Status();
630 
631  bool keep = (ist==kIStInitialState) ||
632  (ist==kIStStableFinalState) || (ist==kIStNucleonTarget);
633  if(keep) {
634  p->SetFirstDaughter(-1);
635  p->SetLastDaughter(-1);
636  p->SetFirstMother(-1);
637  p->SetLastMother(-1);
638  } else {
639  LOG("GHEP", pNOTICE)
640  << "Removing: " << p->Name() << " from slot: " << i;
641  this->RemoveAt(i);
642  }
643  i++;
644  }
645 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
646  LOG("GHEP", pDEBUG) << "Compressing GHEP record to remove empty slots";
647 #endif
648  this->Compress();
649 }
void SetFirstMother(int m)
Definition: GHepParticle.h:132
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
string Name(void) const
Name that corresponds to the PDG code.
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
void SetLastDaughter(int d)
Definition: GHepParticle.h:135
void SetLastMother(int m)
Definition: GHepParticle.h:133
#define pNOTICE
Definition: Messenger.h:61
void SetFirstDaughter(int d)
Definition: GHepParticle.h:134
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
enum genie::EGHepStatus GHepStatus_t
#define pDEBUG
Definition: Messenger.h:63
void GHepRecord::ResetRecord ( void  )
virtual

Definition at line 874 of file GHepRecord.cxx.

References CleanRecord(), InitRecord(), LOG, and pDEBUG.

Referenced by Copy(), and genie::EventGenerator::ProcessEventRecord().

875 {
876 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
877  LOG("GHEP", pDEBUG) << "Reseting GHepRecord";
878 #endif
879  this->CleanRecord();
880  this->InitRecord();
881 }
void InitRecord(void)
Definition: GHepRecord.cxx:837
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pDEBUG
Definition: Messenger.h:63
void CleanRecord(void)
Definition: GHepRecord.cxx:866
virtual void genie::GHepRecord::SetDiffXSec ( double  xsec,
KinePhaseSpace_t  ps 
)
inlinevirtual

Definition at line 133 of file GHepRecord.h.

References fDiffXSec, fDiffXSecPhSp, and genie::units::ps.

Referenced by genie::COHKinematicsGenerator::CalculateKin_AlvarezRuso(), genie::SKKinematicsGenerator::CalculateKin_AtharSingleKaon(), genie::COHKinematicsGenerator::CalculateKin_BergerSehgal(), genie::COHKinematicsGenerator::CalculateKin_BergerSehgalFM(), genie::COHKinematicsGenerator::CalculateKin_ReinSehgal(), genie::KineGeneratorWithCache::MaxXSec(), genie::HELeptonKinematicsGenerator::ProcessEventRecord(), genie::NuEKinematicsGenerator::ProcessEventRecord(), genie::DFRKinematicsGenerator::ProcessEventRecord(), genie::DMEKinematicsGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::ProcessEventRecord(), genie::RESKinematicsGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::DMELKinematicsGenerator::ProcessEventRecord(), genie::IBDKinematicsGenerator::ProcessEventRecord(), genie::DISKinematicsGenerator::ProcessEventRecord(), genie::NormGenerator::ProcessEventRecord(), genie::HEDISKinematicsGenerator::ProcessEventRecord(), genie::DMELEventGenerator::ProcessEventRecord(), genie::DMDISKinematicsGenerator::ProcessEventRecord(), genie::QELEventGeneratorSM::ProcessEventRecord(), genie::SPPEventGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::SpectralFuncExperimentalCode(), and genie::DMELKinematicsGenerator::SpectralFuncExperimentalCode().

134  { fDiffXSecPhSp = ps;
135  fDiffXSec = (xsec>0) ? xsec : 0.;
136  }
static constexpr double ps
Definition: Units.h:99
KinePhaseSpace_t fDiffXSecPhSp
specifies which differential cross-section (dsig/dQ2, dsig/dQ2dW, dsig/dxdy,...)
Definition: GHepRecord.h:182
double fDiffXSec
differential cross section for selected event kinematics
Definition: GHepRecord.h:181
void GHepRecord::SetPrintLevel ( int  print_level)
static

Definition at line 956 of file GHepRecord.cxx.

References fPrintLevel.

Referenced by main(), and TestDecay().

957 {
958  fPrintLevel = print_level;
959 }
static int fPrintLevel
Definition: GHepRecord.h:196
virtual void genie::GHepRecord::SetProbability ( double  prob)
inlinevirtual

Definition at line 131 of file GHepRecord.h.

References fProb.

Referenced by main().

131 { fProb = (prob>0) ? prob : 0.; }
double fProb
event probability (for given flux neutrino and density-weighted path-length for target element) ...
Definition: GHepRecord.h:179
void GHepRecord::SetUnphysEventMask ( const TBits &  mask)

Definition at line 938 of file GHepRecord.cxx.

References fEventMask, LOG, genie::GHepFlags::NFlags(), and pINFO.

939 {
940  *fEventMask = mask;
941 
942  LOG("GHEP", pINFO)
943  << "Setting unphysical event mask (bits: " << GHepFlags::NFlags() - 1
944  << " -> 0) : " << *fEventMask;
945 }
TBits * fEventMask
an input bit-field mask allowing one to ignore bits set in fEventFlags
Definition: GHepRecord.h:175
static unsigned int NFlags(void)
Definition: GHepFlags.h:76
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
void GHepRecord::SetVertex ( double  x,
double  y,
double  z,
double  t 
)
virtual

Definition at line 827 of file GHepRecord.cxx.

References fVtx.

Referenced by genie::hnl::VertexGenerator::ProcessEventRecord(), and genie::hnl::FluxCreator::ProcessEventRecord().

828 {
829  fVtx->SetXYZT(x,y,z,t);
830 }
TLorentzVector * fVtx
vertex in the detector coordinate system
Definition: GHepRecord.h:171
void GHepRecord::SetVertex ( const TLorentzVector &  vtx)
virtual

Definition at line 832 of file GHepRecord.cxx.

References fVtx.

833 {
834  fVtx->SetXYZT(vtx.X(),vtx.Y(),vtx.Z(),vtx.T());
835 }
TLorentzVector * fVtx
vertex in the detector coordinate system
Definition: GHepRecord.h:171
virtual void genie::GHepRecord::SetWeight ( double  wght)
inlinevirtual
virtual void genie::GHepRecord::SetXSec ( double  xsec)
inlinevirtual

Definition at line 132 of file GHepRecord.h.

References fXSec.

Referenced by genie::hnl::FluxCreator::ProcessEventRecord(), and genie::PhysInteractionSelector::SelectInteraction().

132 { fXSec = (xsec>0) ? xsec : 0.; }
double fXSec
cross section for selected event
Definition: GHepRecord.h:180
Interaction * GHepRecord::Summary ( void  ) const
virtual

Definition at line 91 of file GHepRecord.cxx.

References fInteraction, LOG, and pWARN.

Referenced by genie::NuETargetRemnantGenerator::AddElectronNeutrino(), genie::DMETargetRemnantGenerator::AddElectronNeutrino(), genie::HadronicSystemGenerator::AddFinalHadronicSyst(), genie::InitialStateAppender::AddNeutrino(), genie::InitialStateAppender::AddNucleus(), genie::HEDISGenerator::AddPrimaryLepton(), genie::QELHadronicSystemGenerator::AddRecoilBaryon(), genie::IBDHadronicSystemGenerator::AddRecoilBaryon(), genie::RSPPResonanceSelector::AddResonance(), genie::RSPPHadronicSystemGenerator::AddResonanceDecayProducts(), genie::InitialStateAppender::AddStruckParticle(), genie::NuETargetRemnantGenerator::AddTargetNucleusRemnant(), genie::DMETargetRemnantGenerator::AddTargetNucleusRemnant(), genie::PrimaryLeptonGenerator::AddToEventRecord(), genie::OutgoingDarkGenerator::AddToEventRecord(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_AlvarezRuso(), genie::SKHadronicSystemGenerator::CalculateHadronicSystem_AtharSingleKaon(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_BergerSehgalFM(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_ReinSehgal(), genie::COHKinematicsGenerator::CalculateKin_AlvarezRuso(), genie::SKKinematicsGenerator::CalculateKin_AtharSingleKaon(), genie::COHKinematicsGenerator::CalculateKin_BergerSehgal(), genie::COHKinematicsGenerator::CalculateKin_BergerSehgalFM(), genie::COHKinematicsGenerator::CalculateKin_ReinSehgal(), genie::COHPrimaryLeptonGenerator::CalculatePrimaryLepton_AlvarezRuso(), genie::RESHadronicSystemGenerator::GetResonancePdgCode(), genie::HadronicSystemGenerator::HadronShowerCharge(), main(), genie::KineGeneratorWithCache::MaxXSec(), genie::PrimaryLeptonGenerator::NucRestFrame2Lab(), genie::OutgoingDarkGenerator::NucRestFrame2Lab(), genie::NuEPrimaryLeptonGenerator::ProcessEventRecord(), genie::DFRHadronicSystemGenerator::ProcessEventRecord(), genie::DISHadronicSystemGenerator::ProcessEventRecord(), genie::HELeptonKinematicsGenerator::ProcessEventRecord(), genie::VertexGenerator::ProcessEventRecord(), genie::NuEKinematicsGenerator::ProcessEventRecord(), genie::DMEOutgoingDarkGenerator::ProcessEventRecord(), genie::DFRKinematicsGenerator::ProcessEventRecord(), genie::PrimaryLeptonGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::ProcessEventRecord(), genie::DMEKinematicsGenerator::ProcessEventRecord(), genie::RESKinematicsGenerator::ProcessEventRecord(), genie::PhotonCOHGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::OutgoingDarkGenerator::ProcessEventRecord(), genie::PhotonRESGenerator::ProcessEventRecord(), genie::DMELKinematicsGenerator::ProcessEventRecord(), genie::IBDKinematicsGenerator::ProcessEventRecord(), genie::RSPPResonanceSelector::ProcessEventRecord(), genie::DISKinematicsGenerator::ProcessEventRecord(), genie::QELEventGeneratorSuSA::ProcessEventRecord(), genie::HEDISKinematicsGenerator::ProcessEventRecord(), genie::NormGenerator::ProcessEventRecord(), genie::NucDeExcitationSim::ProcessEventRecord(), genie::DMELEventGenerator::ProcessEventRecord(), genie::DMDISKinematicsGenerator::ProcessEventRecord(), genie::FermiMover::ProcessEventRecord(), genie::PauliBlocker::ProcessEventRecord(), genie::QELEventGeneratorSM::ProcessEventRecord(), genie::SPPEventGenerator::ProcessEventRecord(), genie::RSPPResonanceSelector::SelectResonance(), genie::QELKinematicsGenerator::SpectralFuncExperimentalCode(), and genie::DMELKinematicsGenerator::SpectralFuncExperimentalCode().

92 {
93  if(!fInteraction) {
94  LOG("GHEP", pWARN) << "Returning NULL interaction";
95  }
96  return fInteraction;
97 }
Interaction * fInteraction
attached summary information
Definition: GHepRecord.h:168
#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
void GHepRecord::SwapParticles ( int  i,
int  j 
)
protectedvirtual

Definition at line 752 of file GHepRecord.cxx.

References genie::GHepParticle::Copy(), genie::GHepParticle::HasDaughters(), LOG, genie::GHepParticle::Name(), Particle(), pINFO, and genie::GHepParticle::SetFirstMother().

Referenced by CompactifyDaughterLists().

753 {
754 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
755  LOG("GHEP", pINFO) << "Swapping GHepParticles : " << i << " <--> " << j;
756 #endif
757  int n = this->GetEntries();
758  assert(i>=0 && j>=0 && i<n && j<n);
759 
760  if(i==j) return;
761 
762  GHepParticle * pi = this->Particle(i);
763  GHepParticle * pj = this->Particle(j);
764  GHepParticle * tmp = new GHepParticle(*pi);
765 
766  pi->Copy(*pj);
767  pj->Copy(*tmp);
768 
769  delete tmp;
770 
771  // tell their daughters
772  if(pi->HasDaughters()) {
773 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
774  LOG("GHEP", pINFO)
775  << pi->Name() << "(previously at pos: " << j
776  << ") is now at pos: " << i << " -> Notify daughters";
777 #endif
778  for(int k=0; k<n; k++) {
779  if(this->Particle(k)->FirstMother()==j) {
780  this->Particle(k)->SetFirstMother(i);
781  }
782  }
783  }
784 
785  if(pj->HasDaughters()) {
786 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
787  LOG("GHEP", pINFO)
788  << pj->Name() << "(previously at pos: " << i
789  << ") is now at pos: " << j << " -> Notify daughters";
790 #endif
791  for(int k=0; k<n; k++) {
792  if(this->Particle(k)->FirstMother()==i) {
793  this->Particle(k)->SetFirstMother(j);
794  }
795  }
796  }
797 }
void SetFirstMother(int m)
Definition: GHepParticle.h:132
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
string Name(void) const
Name that corresponds to the PDG code.
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
bool HasDaughters(void) const
Definition: GHepParticle.h:70
void Copy(const GHepParticle &particle)
#define pINFO
Definition: Messenger.h:62
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
GHepParticle * GHepRecord::TargetNucleus ( void  ) const
virtual

Definition at line 293 of file GHepRecord.cxx.

References Particle(), and TargetNucleusPosition().

Referenced by genie::HNIntranuke2018::AbsorbHN(), genie::AMNuGammaGenerator::AddRecoilNucleon(), genie::CEvNSEventGenerator::AddRecoilNucleus(), genie::COHDNuEventGenerator::AddRecoilNucleus(), genie::HadronicSystemGenerator::AddTargetNucleusRemnant(), genie::QELEventGenerator::AddTargetNucleusRemnant(), genie::FermiMover::AddTargetNucleusRemnant(), genie::DMELEventGenerator::AddTargetNucleusRemnant(), genie::QELEventGeneratorSM::AddTargetNucleusRemnant(), genie::AMNuGammaGenerator::AddTargetRemnant(), genie::PrimaryLeptonGenerator::AddToEventRecord(), genie::OutgoingDarkGenerator::AddToEventRecord(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_AlvarezRuso(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_BergerSehgalFM(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_ReinSehgal(), genie::HAIntranuke::ElasHA(), genie::HAIntranuke2018::ElasHA(), genie::HNIntranuke2018::ElasHN(), genie::utils::intranuke::Equilibrium(), genie::HNIntranuke2018::GammaInelasticHN(), genie::Intranuke::GenerateVertex(), genie::Intranuke2018::GenerateVertex(), HitElectronPosition(), HitNucleonPosition(), genie::HAIntranuke::Inelastic(), genie::HAIntranuke2018::Inelastic(), genie::HAIntranuke::InelasticHA(), genie::HAIntranuke2018::InelasticHA(), genie::FermiMover::KickHitNucleon(), genie::utils::intranuke::PreEquilibrium(), genie::VertexGenerator::ProcessEventRecord(), genie::HadronTransporter::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::SRCNuclearRecoil::ProcessEventRecord(), genie::NormGenerator::ProcessEventRecord(), genie::NucBindEnergyAggregator::ProcessEventRecord(), genie::NucDeExcitationSim::ProcessEventRecord(), genie::DMELEventGenerator::ProcessEventRecord(), genie::PauliBlocker::ProcessEventRecord(), genie::Intranuke::ProcessEventRecord(), genie::Intranuke2018::ProcessEventRecord(), RemnantNucleusPosition(), genie::DISHadronicSystemGenerator::SimulateFormationZone(), genie::utils::intranuke::ThreeBodyKinematics(), genie::utils::intranuke2018::ThreeBodyKinematics(), genie::utils::intranuke::TwoBodyCollision(), and genie::utils::intranuke2018::TwoBodyCollision().

294 {
295 // Returns the GHepParticle representing the target / initial state nucleus,
296 // or 0 if it does not exist.
297 
298  int ipos = this->TargetNucleusPosition();
299  if(ipos>-1) return this->Particle(ipos);
300  return 0;
301 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
virtual int TargetNucleusPosition(void) const
Definition: GHepRecord.cxx:370
int GHepRecord::TargetNucleusPosition ( void  ) const
virtual

Definition at line 370 of file GHepRecord.cxx.

References EventGenerationMode(), genie::pdg::IsIon(), genie::kGMdDarkMatterNucleus, genie::kGMdHadronNucleus, genie::kGMdLeptonNucleus, genie::kGMdNucleonDecay, genie::kGMdPhotonNucleus, genie::kIStInitialState, Particle(), genie::GHepParticle::Pdg(), and genie::GHepParticle::Status().

Referenced by genie::NuETargetRemnantGenerator::AddTargetNucleusRemnant(), genie::DMETargetRemnantGenerator::AddTargetNucleusRemnant(), genie::HadronicSystemGenerator::AddTargetNucleusRemnant(), genie::QELEventGenerator::AddTargetNucleusRemnant(), genie::FermiMover::AddTargetNucleusRemnant(), genie::DMELEventGenerator::AddTargetNucleusRemnant(), genie::QELEventGeneratorSM::AddTargetNucleusRemnant(), genie::AMNuGammaGenerator::AddTargetRemnant(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_AlvarezRuso(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_BergerSehgalFM(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_ReinSehgal(), genie::SecondNucleonEmissionI::EmitSecondNucleon(), genie::NormGenerator::ProcessEventRecord(), TargetNucleus(), genie::Intranuke::TransportHadrons(), and genie::Intranuke2018::TransportHadrons().

371 {
372 // Returns the GHEP position of the GHepParticle representing the target
373 // nucleus - or -1 if the interaction takes place at a free nucleon.
374 
375  GEvGenMode_t mode = this->EventGenerationMode();
376 
377  if(mode == kGMdLeptonNucleus ||
378  mode == kGMdDarkMatterNucleus ||
379  mode == kGMdHadronNucleus ||
380  mode == kGMdPhotonNucleus)
381  {
382  GHepParticle * p = this->Particle(1); // If exists, it will be at slot 1
383  if(!p) return -1;
384  int pdgc = p->Pdg();
385  if(pdg::IsIon(pdgc) && p->Status()==kIStInitialState) return 1;
386  }
387  if(mode == kGMdNucleonDecay) {
388  GHepParticle * p = this->Particle(0); // If exists, it will be at slot 0
389  if(!p) return -1;
390  int pdgc = p->Pdg();
391  if(pdg::IsIon(pdgc) && p->Status()==kIStInitialState) return 0;
392  }
393 
394  return -1;
395 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
int Pdg(void) const
Definition: GHepParticle.h:63
Enumeration of GENIE event generation modes.
GEvGenMode_t EventGenerationMode(void) const
Definition: GHepRecord.cxx:209
bool IsIon(int pdgc)
Definition: PDGUtils.cxx:42
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
void GHepRecord::UpdateDaughterLists ( void  )
protectedvirtual

Definition at line 556 of file GHepRecord.cxx.

References CompactifyDaughterLists(), genie::GHepParticle::FirstDaughter(), genie::GHepParticle::FirstMother(), genie::GHepParticle::LastDaughter(), LOG, Particle(), pINFO, pNOTICE, genie::GHepParticle::SetFirstDaughter(), and genie::GHepParticle::SetLastDaughter().

Referenced by AddParticle().

557 {
558  int pos = this->GetEntries() - 1; // position of last entry
559 
560 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
561  LOG("GHEP", pINFO)
562  << "Updating the daughter-list for the mother of particle at: " << pos;
563 #endif
564 
565  GHepParticle * p = this->Particle(pos);
566  assert(p);
567 
568  int mom_pos = p->FirstMother();
569 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
570  LOG("GHEP", pINFO) << "Mother particle is at slot: " << mom_pos;
571 #endif
572  if(mom_pos==-1) return; // may not have mom (eg init state)
573  GHepParticle * mom = this->Particle(mom_pos);
574  if(!mom) return; // may not have mom (eg init state)
575 
576  int dau1 = mom->FirstDaughter();
577  int dau2 = mom->LastDaughter();
578 
579  // handles the case where the daughter list was initially empty
580  if(dau1 == -1) {
581  mom->SetFirstDaughter(pos);
582  mom->SetLastDaughter(pos);
583  #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
584  LOG("GHEP", pINFO)
585  << "Done! Daughter-list is compact: [" << pos << ", " << pos << "]";
586  #endif
587  return;
588  }
589  // handles the case where the new daughter is added at the slot just before
590  // an already compact daughter list
591  if(pos == dau1-1) {
592  mom->SetFirstDaughter(pos);
593  #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
594  LOG("GHEP", pINFO)
595  << "Done! Daughter-list is compact: [" << pos << ", " << dau2 << "]";
596  #endif
597  return;
598  }
599  // handles the case where the new daughter is added at the slot just after
600  // an already compact daughter list
601  if(pos == dau2+1) {
602  mom->SetLastDaughter(pos);
603  #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
604  LOG("GHEP", pINFO)
605  << "Done! Daughter-list is compact: [" << dau1 << ", " << pos << "]";
606  #endif
607  return;
608  }
609 
610  // If you are here, then the last particle insertion broke the daughter
611  // list compactification - Run the compactifier
612  LOG("GHEP", pNOTICE)
613  << "Daughter-list is not compact - Running compactifier";
614  this->CompactifyDaughterLists();
615 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
int FirstDaughter(void) const
Definition: GHepParticle.h:68
int FirstMother(void) const
Definition: GHepParticle.h:66
int LastDaughter(void) const
Definition: GHepParticle.h:69
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
void SetLastDaughter(int d)
Definition: GHepParticle.h:135
#define pINFO
Definition: Messenger.h:62
virtual void CompactifyDaughterLists(void)
Definition: GHepRecord.cxx:651
#define pNOTICE
Definition: Messenger.h:61
void SetFirstDaughter(int d)
Definition: GHepParticle.h:134
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
virtual TLorentzVector* genie::GHepRecord::Vertex ( void  ) const
inlinevirtual

Definition at line 140 of file GHepRecord.h.

References fVtx.

Referenced by genie::hnl::Decayer::AddInitialState(), Copy(), Print(), and genie::hnl::VertexGenerator::ProcessEventRecord().

140 { return fVtx; }
TLorentzVector * fVtx
vertex in the detector coordinate system
Definition: GHepRecord.h:171
virtual double genie::GHepRecord::Weight ( void  ) const
inlinevirtual
virtual double genie::GHepRecord::XSec ( void  ) const
inlinevirtual

Friends And Related Function Documentation

ostream& operator<< ( ostream &  stream,
const GHepRecord event 
)
friend

Definition at line 46 of file GHepRecord.cxx.

47  {
48  rec.Print(stream);
49  return stream;
50  }

Member Data Documentation

double genie::GHepRecord::fDiffXSec
protected

differential cross section for selected event kinematics

Definition at line 181 of file GHepRecord.h.

Referenced by Copy(), DiffXSec(), InitRecord(), Print(), and SetDiffXSec().

KinePhaseSpace_t genie::GHepRecord::fDiffXSecPhSp
protected

specifies which differential cross-section (dsig/dQ2, dsig/dQ2dW, dsig/dxdy,...)

Definition at line 182 of file GHepRecord.h.

Referenced by Copy(), DiffXSecVars(), InitRecord(), Print(), and SetDiffXSec().

TBits* genie::GHepRecord::fEventFlags
protected

event flags indicating various pathologies or an unphysical event

Definition at line 174 of file GHepRecord.h.

Referenced by Accept(), Clear(), Copy(), EventFlags(), InitRecord(), IsUnphysical(), and Print().

TBits* genie::GHepRecord::fEventMask
protected

an input bit-field mask allowing one to ignore bits set in fEventFlags

Definition at line 175 of file GHepRecord.h.

Referenced by Accept(), Clear(), Copy(), EventMask(), InitRecord(), Print(), and SetUnphysEventMask().

Interaction* genie::GHepRecord::fInteraction
protected

attached summary information

Definition at line 168 of file GHepRecord.h.

Referenced by AttachSummary(), Clear(), Copy(), InitRecord(), Print(), and Summary().

int GHepRecord::fPrintLevel = 3
staticprotected

Definition at line 196 of file GHepRecord.h.

Referenced by GetPrintLevel(), Print(), and SetPrintLevel().

double genie::GHepRecord::fProb
protected

event probability (for given flux neutrino and density-weighted path-length for target element)

Definition at line 179 of file GHepRecord.h.

Referenced by Copy(), InitRecord(), Probability(), and SetProbability().

TLorentzVector* genie::GHepRecord::fVtx
protected

vertex in the detector coordinate system

Definition at line 171 of file GHepRecord.h.

Referenced by Clear(), Copy(), InitRecord(), SetVertex(), and Vertex().

double genie::GHepRecord::fWeight
protected

event weight

Definition at line 178 of file GHepRecord.h.

Referenced by Copy(), InitRecord(), Print(), SetWeight(), and Weight().

double genie::GHepRecord::fXSec
protected

cross section for selected event

Definition at line 180 of file GHepRecord.h.

Referenced by Copy(), InitRecord(), Print(), SetXSec(), and XSec().


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