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

#include "/cvmfs/nova.opensciencegrid.org/externals/genie/v3_00_06_p01a/Linux64bit+3.10-2.17-e19-debug/GENIE-Generator/src/Physics/HadronTransport/HNIntranuke2018.h"

Inheritance diagram for genie::HNIntranuke2018:
genie::Intranuke2018 genie::EventRecordVisitorI genie::Algorithm

Public Member Functions

 HNIntranuke2018 ()
 
 HNIntranuke2018 (string config)
 
 ~HNIntranuke2018 ()
 
void ProcessEventRecord (GHepRecord *event_rec) const
 
virtual string GetINukeMode () const
 
virtual string GetGenINukeMode () const
 
virtual void Configure (const Registry &config)
 
virtual void Configure (string param_set)
 
virtual void FindConfig (void)
 
virtual const RegistryGetConfig (void) const
 
RegistryGetOwnedConfig (void)
 
virtual const AlgIdId (void) const
 Get algorithm ID. More...
 
virtual AlgStatus_t GetStatus (void) const
 Get algorithm status. More...
 
virtual bool AllowReconfig (void) const
 
virtual AlgCmp_t Compare (const Algorithm *alg) const
 Compare with input algorithm. More...
 
virtual void SetId (const AlgId &id)
 Set algorithm ID. More...
 
virtual void SetId (string name, string config)
 
const AlgorithmSubAlg (const RgKey &registry_key) const
 
void AdoptConfig (void)
 
void AdoptSubstructure (void)
 
virtual void Print (ostream &stream) const
 Print algorithm info. More...
 

Protected Member Functions

void TransportHadrons (GHepRecord *ev) const
 
void GenerateVertex (GHepRecord *ev) const
 
bool NeedsRescattering (const GHepParticle *p) const
 
bool CanRescatter (const GHepParticle *p) const
 
bool IsInNucleus (const GHepParticle *p) const
 
void SetTrackingRadius (const GHepParticle *p) const
 
double GenerateStep (GHepRecord *ev, GHepParticle *p) const
 
void Initialize (void)
 
void DeleteConfig (void)
 
void DeleteSubstructure (void)
 
RegistryExtractLocalConfig (const Registry &in) const
 
RegistryExtractLowerConfig (const Registry &in, const string &alg_key) const
 Split an incoming configuration Registry into a block valid for the sub-algo identified by alg_key. More...
 
template<class T >
bool GetParam (const RgKey &name, T &p, bool is_top_call=true) const
 
template<class T >
bool GetParamDef (const RgKey &name, T &p, const T &def) const
 
template<class T >
bool GetParamVect (const std::string &comm_name, std::vector< T > &v, unsigned int max, bool is_top_call=true) const
 
int AddTopRegistry (Registry *rp, bool owns=true)
 add registry with top priority, also update ownership More...
 
int AddLowRegistry (Registry *rp, bool owns=true)
 add registry with lowest priority, also update ownership More...
 
int MergeTopRegistry (const Registry &r)
 
int AddTopRegisties (const vector< Registry * > &rs, bool owns=false)
 Add registries with top priority, also udated Ownerships. More...
 

Protected Attributes

double fTrackingRadius
 tracking radius for the nucleus in the current event More...
 
TGenPhaseSpace fGenPhaseSpace
 a phase space generator More...
 
INukeHadroData2018fHadroData2018
 a collection of h+N,h+A data & calculations More...
 
AlgFactoryfAlgf
 algorithm factory instance More...
 
const NuclearModelIfNuclmodel
 nuclear model used to generate fermi momentum More...
 
int fRemnA
 remnant nucleus A More...
 
int fRemnZ
 remnant nucleus Z More...
 
TLorentzVector fRemnP4
 P4 of remnant system. More...
 
GEvGenMode_t fGMode
 event generation mode (lepton+A, hadron+A, ...) More...
 
double fR0
 effective nuclear size param More...
 
double fNR
 param multiplying the nuclear radius, determining how far to track hadrons beyond the "nuclear boundary" More...
 
double fNucRmvE
 binding energy to subtract from cascade nucleons More...
 
double fDelRPion
 factor by which Pion Compton wavelength gets multiplied to become nuclear size enhancement More...
 
double fDelRNucleon
 factor by which Nucleon Compton wavelength gets multiplied to become nuclear size enhancement More...
 
double fHadStep
 step size for intranuclear hadron transport More...
 
double fNucAbsFac
 absorption xsec correction factor (hN Mode) More...
 
double fNucCEXFac
 charge exchange xsec correction factor (hN Mode) More...
 
double fEPreEq
 threshold for pre-equilibrium reaction More...
 
double fFermiFac
 testing parameter to modify fermi momentum More...
 
double fFermiMomentum
 whether or not particle collision is pauli blocked More...
 
bool fDoFermi
 whether or not to do fermi mom. More...
 
bool fDoMassDiff
 whether or not to do mass diff. mode More...
 
bool fDoCompoundNucleus
 whether or not to do compound nucleus considerations More...
 
bool fUseOset
 Oset model for low energy pion in hN. More...
 
bool fAltOset
 NuWro's table-based implementation (not recommended) More...
 
bool fXsecNNCorr
 use nuclear medium correction for NN cross section More...
 
double fPionMFPScale
 tweaking factors for tuning More...
 
double fPionFracCExScale
 
double fPionFracInelScale
 
double fPionFracAbsScale
 
double fPionFracPiProdScale
 
double fNucleonMFPScale
 
double fNucleonFracCExScale
 
double fNucleonFracInelScale
 
double fNucleonFracAbsScale
 
double fNucleonFracPiProdScale
 
bool fAllowReconfig
 
bool fOwnsSubstruc
 true if it owns its substructure (sub-algs,...) More...
 
AlgId fID
 algorithm name and configuration set More...
 
vector< Registry * > fConfVect
 
vector< bool > fOwnerships
 ownership for every registry in fConfVect More...
 
AlgStatus_t fStatus
 algorithm execution status More...
 
AlgMapfOwnedSubAlgMp
 local pool for owned sub-algs (taken out of the factory pool) More...
 

Private Member Functions

void LoadConfig (void)
 
void SimulateHadronicFinalState (GHepRecord *ev, GHepParticle *p) const
 
INukeFateHN_t HadronFateHN (const GHepParticle *p) const
 
INukeFateHN_t HadronFateOset () const
 
double FateWeight (int pdgc, INukeFateHN_t fate) const
 
void ElasHN (GHepRecord *ev, GHepParticle *p, INukeFateHN_t fate) const
 
void AbsorbHN (GHepRecord *ev, GHepParticle *p, INukeFateHN_t fate) const
 
void InelasticHN (GHepRecord *ev, GHepParticle *p) const
 
void GammaInelasticHN (GHepRecord *ev, GHepParticle *p, INukeFateHN_t fate) const
 
bool HandleCompoundNucleusHN (GHepRecord *ev, GHepParticle *p) const
 
int HandleCompoundNucleus (GHepRecord *ev, GHepParticle *p, int mom) const
 

Private Attributes

int nuclA
 value of A for the target nucleus in hA mode More...
 
double fNucQEFac
 

Friends

class IntranukeTester
 

Detailed Description

Definition at line 51 of file HNIntranuke2018.h.

Constructor & Destructor Documentation

HNIntranuke2018::HNIntranuke2018 ( )

Definition at line 96 of file HNIntranuke2018.cxx.

96  :
97 Intranuke2018("genie::HNIntranuke2018")
98 {
99 
100 }
HNIntranuke2018::HNIntranuke2018 ( string  config)

Definition at line 102 of file HNIntranuke2018.cxx.

102  :
103 Intranuke2018("genie::HNIntranuke2018",config)
104 {
105 
106 }
Definition: config.py:1
HNIntranuke2018::~HNIntranuke2018 ( )

Definition at line 108 of file HNIntranuke2018.cxx.

109 {
110 
111 }

Member Function Documentation

void HNIntranuke2018::AbsorbHN ( GHepRecord ev,
GHepParticle p,
INukeFateHN_t  fate 
) const
private

Definition at line 388 of file HNIntranuke2018.cxx.

References genie::GHepRecord::AddParticle(), genie::INukeHadroFates::AsString(), beta, genie::GHepParticle::E(), genie::Intranuke2018::fDoFermi, genie::Intranuke2018::fFermiFac, genie::Intranuke2018::fFermiMomentum, genie::Intranuke2018::fHadroData2018, genie::PDGLibrary::Find(), genie::GHepParticle::FirstMother(), genie::Intranuke2018::fNuclmodel, genie::Intranuke2018::fRemnA, genie::Intranuke2018::fRemnP4, genie::Intranuke2018::fRemnZ, genie::Intranuke2018::fUseOset, genie::NuclearModelI::GenerateNucleon(), gm, genie::PDGLibrary::Instance(), genie::RandomGen::Instance(), genie::INukeHadroData2018::IntBounce(), genie::kIHNFtAbs, genie::GHepParticle::KinE(), genie::kIStHadronInTheNucleus, genie::kIStStableFinalState, kPi, genie::GHepParticle::LastMother(), LOG, Mag(), genie::units::MeV, genie::NuclearModelI::Momentum3(), genie::GHepParticle::Name(), genie::GHepParticle::P4(), pDEBUG, genie::GHepParticle::Pdg(), pINFO, pWARN, generate_hists::rnd, genie::RandomGen::RndFsi(), genie::GHepParticle::SetFirstMother(), genie::GHepParticle::SetLastMother(), genie::GHepParticle::SetMomentum(), genie::GHepParticle::SetPdgCode(), genie::exceptions::INukeException::SetReason(), genie::GHepParticle::SetStatus(), confusionMatrixTree::t, genie::GHepRecord::TargetNucleus(), and Unit().

Referenced by GetGenINukeMode(), and SimulateHadronicFinalState().

390 {
391  // handles pi+d->2p, pi-d->nn, pi0 d->pn absorbtion, all using pi+d values
392 
393  int pdgc = p->Pdg();
394 
395 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
396  LOG("HNIntranuke2018", pDEBUG)
397  << "AbsorbHN() is invoked for a : " << p->Name()
398  << " whose fate is : " << INukeHadroFates::AsString(fate);
399 #endif
400 
401  // check fate
402  if(fate!=kIHNFtAbs)
403  {
404  LOG("HNIntranuke2018", pWARN)
405  << "AbsorbHN() cannot handle fate: " << INukeHadroFates::AsString(fate);
406  return;
407  }
408 
409  // random number generator
411 
412  // Notes on the kinematics
413  // -- Simple variables are used for efficiency
414  // -- Variables are numbered according to particle
415  // -- -- #1 -> incoming particle
416  // -- -- #2 -> target (here, 2_1 and 2_2 for individual particles)
417  // -- -- #3 -> scattered incoming (Particle tracked in hA mode)
418  // -- -- #4 -> other scattered particle
419  // -- Suffix "L" is for lab frame, suffix "CM" is for center of mass frame
420  // -- Subscript "z" is for parallel component, "t" is for transverse
421 
422  int pcode, t1code, t2code, scode, s2code; // particles
423  double M1, M2_1, M2_2, M3, M4; // rest energies, in GeV
424  double E1L, P1L, E2L, P2L, E3L, P3L, E4L, P4L;
425  double P1zL, P2zL;
426  double beta, gm; // speed and gamma for CM frame in lab
427  double Et, E2CM;
428  double C3CM, S3CM; // cos and sin of scattering angle
429  double Theta1, Theta2, theta5;
430  double PHI3; // transverse scattering angle
431  double E1CM, E3CM, E4CM, P3CM;
432  double P3zL, P3tL, P4zL, P4tL;
433  double E2_1L, E2_2L;
434  TVector3 tP2_1L, tP2_2L, tP1L, tP2L, tPtot, P1zCM, P2zCM;
435  TVector3 tP3L, tP4L;
436  TVector3 bDir, tTrans, tbeta, tVect;
437 
438  // Library instance for reference
439  PDGLibrary * pLib = PDGLibrary::Instance();
440 
441  // Handle fermi target
442  Target target(ev->TargetNucleus()->Pdg());
443 
444  // Target should be a deuteron, but for now
445  // handling it as seperate nucleons
446  if(pdgc==211) // pi-plus
447  {
448  pcode = 211;
449  t1code = 2212; // proton
450  t2code = 2112; // neutron
451  scode = 2212;
452  s2code = 2212;
453  }
454  else if(pdgc==-211) // pi-minus
455  {
456  pcode = -211;
457  t1code = 2212;
458  t2code = 2112;
459  scode = 2112;
460  s2code = 2112;
461  }
462  else if(pdgc==111) // pi-zero
463  {
464  pcode = 111;
465  t1code = 2212;
466  t2code = 2112;
467  scode = 2212;
468  s2code = 2112;
469  }
470  else
471  {
472  LOG("HNIntranuke2018", pWARN)
473  << "AbsorbHN() cannot handle probe: " << pdgc;
474  return;
475  }
476 
477  // assign proper masses
478  M1 = pLib->Find(pcode) ->Mass();
479  M2_1 = pLib->Find(t1code)->Mass();
480  M2_2 = pLib->Find(t2code)->Mass();
481  M3 = pLib->Find(scode) ->Mass();
482  M4 = pLib->Find(s2code)->Mass();
483 
484  // handle fermi momentum
485  if(fDoFermi)
486  {
487  target.SetHitNucPdg(t1code);
489  tP2_1L=fFermiFac * fNuclmodel->Momentum3();
490  E2_1L = TMath::Sqrt(tP2_1L.Mag2() + M2_1*M2_1);
491 
492  target.SetHitNucPdg(t2code);
494  tP2_2L=fFermiFac * fNuclmodel->Momentum3();
495  E2_2L = TMath::Sqrt(tP2_2L.Mag2() + M2_2*M2_2);
496  }
497  else
498  {
499  tP2_1L.SetXYZ(0.0, 0.0, 0.0);
500  E2_1L = M2_1;
501 
502  tP2_2L.SetXYZ(0.0, 0.0, 0.0);
503  E2_2L = M2_2;
504  }
505 
506  E2L = E2_1L + E2_2L;
507 
508  // adjust p to reflect scattering
509  // get random scattering angle
510  C3CM = fHadroData2018->IntBounce(p,t1code,scode,fate);
511  if (C3CM<-1.)
512  {
514  ev->AddParticle(*p);
515  return;
516  }
517  S3CM = TMath::Sqrt(1.0 - C3CM*C3CM);
518 
519  // Get lab energy and momenta
520  E1L = p->E();
521  if(E1L<0.001) E1L=0.001;
522  P1L = TMath::Sqrt(E1L*E1L - M1*M1);
523  tP1L = p->P4()->Vect();
524  tP2L = tP2_1L + tP2_2L;
525  P2L = tP2L.Mag();
526  tPtot = tP1L + tP2L;
527 
528  // get unit vectors and angles needed for later
529  bDir = tPtot.Unit();
530  Theta1 = tP1L.Angle(bDir);
531  Theta2 = tP2L.Angle(bDir);
532 
533  // get parallel and transverse components
534  P1zL = P1L*TMath::Cos(Theta1);
535  P2zL = P2L*TMath::Cos(Theta2);
536  tVect.SetXYZ(1,0,0);
537  if(TMath::Abs((tVect - bDir).Mag())<.01) tVect.SetXYZ(0,1,0);
538  theta5 = tVect.Angle(bDir);
539  tTrans = (tVect - TMath::Cos(theta5)*bDir).Unit();
540 
541  // calculate beta and gamma
542  tbeta = tPtot * (1.0 / (E1L + E2L));
543  beta = tbeta.Mag();
544  gm = 1.0 / TMath::Sqrt(1.0 - beta*beta);
545 
546  // boost to CM frame to get scattered particle momenta
547  E1CM = gm*E1L - gm*beta*P1zL;
548  P1zCM = gm*P1zL*bDir - gm*tbeta*E1L;
549  E2CM = gm*E2L - gm*beta*P2zL;
550  P2zCM = gm*P2zL*bDir - gm*tbeta*E2L;
551  Et = E1CM + E2CM;
552  E3CM = (Et*Et + (M3*M3) - (M4*M4)) / (2.0*Et);
553  E4CM = Et - E3CM;
554  P3CM = TMath::Sqrt(E3CM*E3CM - M3*M3);
555 
556  // boost back to lab
557  P3zL = gm*beta*E3CM + gm*P3CM*C3CM;
558  P3tL = P3CM*S3CM;
559  P4zL = gm*beta*E4CM + gm*P3CM*(-C3CM);
560  P4tL = P3CM*(-S3CM);
561 
562  P3L = TMath::Sqrt(P3zL*P3zL + P3tL*P3tL);
563  P4L = TMath::Sqrt(P4zL*P4zL + P4tL*P4tL);
564 
565  // check for too small values
566  // may introduce error, so warn if it occurs
567  if(!(TMath::Finite(P3L))||P3L<.001)
568  {
569  LOG("HNIntranuke2018",pINFO)
570  << "Particle 3 " << M3 << " momentum small or non-finite: " << P3L
571  << "\n" << "--> Assigning .001 as new momentum";
572  P3tL = 0;
573  P3zL = .001;
574  P3L = .001;
575  E3L = TMath::Sqrt(P3L*P3L + M3*M3);
576  }
577 
578  if(!(TMath::Finite(P4L))||P4L<.001)
579  {
580  LOG("HNIntranuke2018",pINFO)
581  << "Particle 4 " << M4 << " momentum small or non-finite: " << P4L
582  << "\n" << "--> Assigning .001 as new momentum";
583  P4tL = 0;
584  P4zL = .001;
585  P4L = .001;
586  E4L = TMath::Sqrt(P4L*P4L + M4*M4);
587  }
588 
589  // pauli blocking (do not apply PB for Oset)
590  //if(!fUseOset && (P3L < fFermiMomentum || P4L < fFermiMomentum))
591  double ke = p->KinE() / units::MeV;
592  if((!fUseOset || ke > 350.0 ) && (P3L < fFermiMomentum || P4L < fFermiMomentum))
593  {
594 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
595  LOG("HNIntranuke2018",pINFO) << "AbsorbHN failed: Pauli blocking";
596 #endif
597  /*
598  p->SetStatus(kIStHadronInTheNucleus);
599  //disable until needed
600  // utils::intranuke2018::StepParticle(p,fFreeStep,fTrackingRadius);
601  ev->AddParticle(*p);
602  return;
603  */
604  // new attempt at error handling:
605  LOG("HNIntranuke2018", pINFO) << "AbsorbHN failed: Pauli blocking";
607  exception.SetReason("hN absorption failed");
608  throw exception;
609  }
610 
611  // handle remnant nucleus updates
612  fRemnZ--;
613  fRemnA -=2;
614  fRemnP4 -= TLorentzVector(tP2_1L,E2_1L);
615  fRemnP4 -= TLorentzVector(tP2_2L,E2_2L);
616 
617  // get random phi angle, distributed uniformally in 360 deg
618  PHI3 = 2 * kPi * rnd->RndFsi().Rndm();
619 
620  tP3L = P3zL*bDir + P3tL*tTrans;
621  tP4L = P4zL*bDir + P4tL*tTrans;
622 
623  tP3L.Rotate(PHI3,bDir); // randomize transverse components
624  tP4L.Rotate(PHI3,bDir);
625 
626  E3L = TMath::Sqrt(P3L*P3L + M3*M3);
627  E4L = TMath::Sqrt(P4L*P4L + M4*M4);
628 
629  // create t particle w/ appropriate momenta, code, and status
630  // set target's mom to be the mom of the hadron that was cloned
631  GHepParticle * t = new GHepParticle(*p);
632  t->SetFirstMother(p->FirstMother());
633  t->SetLastMother(p->LastMother());
634 
635  TLorentzVector t4P4L(tP4L,E4L);
636  t->SetPdgCode(s2code);
637  t->SetMomentum(t4P4L);
639 
640  // adjust p to reflect scattering
641  TLorentzVector t4P3L(tP3L,E3L);
642  p->SetPdgCode(scode);
643  p->SetMomentum(t4P3L);
645 
646 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
647  LOG("HNIntranuke2018", pDEBUG)
648  << "|p3| = " << (P3L) << ", E3 = " << (E3L);
649  LOG("HNIntranuke2018", pDEBUG)
650  << "|p4| = " << (P4L) << ", E4 = " << (E4L);
651 #endif
652 
653  ev->AddParticle(*p);
654  ev->AddParticle(*t);
655 
656  delete t; // delete particle clone
657 }
const double kPi
An exception thrown by SimulateHadronState for kinematics problems. TwoBodyCollision/Kinematics used ...
void SetFirstMother(int m)
Definition: GHepParticle.h:133
TRandom3 & RndFsi(void) const
rnd number generator used by intranuclear cascade monte carlos
Definition: RandomGen.h:60
double fFermiMomentum
whether or not particle collision is pauli blocked
const XML_Char * target
Definition: expat.h:268
double E(void) const
Get energy.
Definition: GHepParticle.h:92
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:79
double fFermiFac
testing parameter to modify fermi momentum
static const double MeV
Definition: Units.h:130
int fRemnA
remnant nucleus A
Definition: Intranuke2018.h:99
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
void SetMomentum(const TLorentzVector &p4)
Double_t beta
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
const NuclearModelI * fNuclmodel
nuclear model used to generate fermi momentum
Definition: Intranuke2018.h:98
const TVector3 & Momentum3(void) const
Definition: NuclearModelI.h:67
int LastMother(void) const
Definition: GHepParticle.h:68
int Pdg(void) const
Definition: GHepParticle.h:64
int FirstMother(void) const
Definition: GHepParticle.h:67
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:97
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
Definition: Target.h:41
virtual GHepParticle * TargetNucleus(void) const
Definition: GHepRecord.cxx:330
bool fDoFermi
whether or not to do fermi mom.
#define pINFO
Definition: Messenger.h:63
TVector3 Unit() const
#define pWARN
Definition: Messenger.h:61
double KinE(bool mass_from_pdg=false) const
Get kinetic energy.
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:43
void SetLastMother(int m)
Definition: GHepParticle.h:134
Singleton class to load & serve a TDatabasePDG.
Definition: PDGLibrary.h:30
void SetStatus(GHepStatus_t s)
Definition: GHepParticle.h:127
static string AsString(INukeFateHN_t fate)
INukeHadroData2018 * fHadroData2018
a collection of h+N,h+A data & calculations
Definition: Intranuke2018.h:96
TParticlePDG * Find(int pdgc)
Definition: PDGLibrary.cxx:61
float Mag() const
virtual bool GenerateNucleon(const Target &) const =0
virtual void AddParticle(const GHepParticle &p)
Definition: GHepRecord.cxx:535
bool fUseOset
Oset model for low energy pion in hN.
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
TGeoManager * gm
Definition: make_fe_box.C:4
double IntBounce(const GHepParticle *p, int target, int s1, INukeFateHN_t fate)
int fRemnZ
remnant nucleus Z
#define pDEBUG
Definition: Messenger.h:64
void SetPdgCode(int c)
TLorentzVector fRemnP4
P4 of remnant system.
int Algorithm::AddLowRegistry ( Registry rp,
bool  owns = true 
)
protectedinherited

add registry with lowest priority, also update ownership

Definition at line 601 of file Algorithm.cxx.

Referenced by genie::EventGenerator::Configure().

601  {
602 
603  fConfVect.push_back( rp ) ;
604  fOwnerships.push_back( own ) ;
605 
606  if ( fConfig ) {
607  delete fConfig ;
608  fConfig = 0 ;
609  }
610 
611  return fConfVect.size() ;
612 
613 }
vector< Registry * > fConfVect
Definition: Algorithm.h:161
vector< bool > fOwnerships
ownership for every registry in fConfVect
Definition: Algorithm.h:164
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
int Algorithm::AddTopRegisties ( const vector< Registry * > &  rs,
bool  owns = false 
)
protectedinherited

Add registries with top priority, also udated Ownerships.

Definition at line 653 of file Algorithm.cxx.

653  {
654 
655  fConfVect.insert( fConfVect.begin(), rs.begin(), rs.end() ) ;
656 
657  fOwnerships.insert( fOwnerships.begin(), rs.size(), own ) ;
658 
659  if ( fConfig ) {
660  delete fConfig ;
661  fConfig = 0 ;
662  }
663 
664  return fConfVect.size() ;
665 
666 }
vector< Registry * > fConfVect
Definition: Algorithm.h:161
vector< bool > fOwnerships
ownership for every registry in fConfVect
Definition: Algorithm.h:164
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
int Algorithm::AddTopRegistry ( Registry rp,
bool  owns = true 
)
protectedinherited

add registry with top priority, also update ownership

Definition at line 585 of file Algorithm.cxx.

Referenced by genie::EventGeneratorListAssembler::AssembleGeneratorList().

585  {
586 
587  fConfVect.insert( fConfVect.begin(), rp ) ;
588  fOwnerships.insert( fOwnerships.begin(), own ) ;
589 
590  if ( fConfig ) {
591  delete fConfig ;
592  fConfig = 0 ;
593  }
594 
595  return fConfVect.size() ;
596 
597 }
vector< Registry * > fConfVect
Definition: Algorithm.h:161
vector< bool > fOwnerships
ownership for every registry in fConfVect
Definition: Algorithm.h:164
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
void Algorithm::AdoptConfig ( void  )
inherited

Clone the configuration registry looked up from the configuration pool and take its ownership

Definition at line 394 of file Algorithm.cxx.

References Configure(), GetConfig(), LOG, and pNOTICE.

Referenced by genie::Algorithm::AllowReconfig().

394  {
395 
396  LOG("Algorithm", pNOTICE)
397  << this->Id().Key() << " is taking ownership of its configuration";
398 
399  // if(fOwnsConfig) {
400  // LOG("Algorithm", pWARN)
401  // << this->Id().Key() << " already owns its configuration!";
402  // return;
403  // }
404 
405  this->Configure( GetConfig() );
406 }
virtual const Registry & GetConfig(void) const
Definition: Algorithm.cxx:254
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
#define pNOTICE
Definition: Messenger.h:62
string Key(void) const
Definition: AlgId.h:47
void Algorithm::AdoptSubstructure ( void  )
inherited

Take ownership of the algorithms subtructure (sub-algorithms,...) by copying them from the AlgFactory pool to the local pool Also bring all the configuration variables to the top level config Registry. This can be used to group together a series of algorithms & their configurations and extract (a clone of) this group from the shared pools. Having a series of algorithms/configurations behaving as a monolithic block, with a single point of configuration (the top level) is to be used when bits & pieces of GENIE are used in isolation for data fitting or reweighting

Definition at line 408 of file Algorithm.cxx.

References genie::AlgFactory::AdoptAlgorithm(), genie::Algorithm::AdoptSubstructure(), GetConfig(), genie::AlgFactory::Instance(), genie::kRgAlg, LOG, pDEBUG, pNOTICE, and genie::RegistryItemI::TypeInfo().

Referenced by genie::Algorithm::AdoptSubstructure(), genie::Algorithm::AllowReconfig(), main(), and testReconfigInOwnedModules().

409 {
410 // Take ownership of the algorithms subtructure (sub-algorithms,..) by copying
411 // them from the AlgFactory pool to the local pool. Also bring all the
412 // configuration variables to the top level. See the header for more details.
413 // A secial naming convention is required for configuration parameter keys
414 // for parameters belonging to sub-algorithms (or sub-algorithms of these
415 // sub-algorithms and so on...).
416 // The convention is: "sub-alg-key/sub-sub-alg-key/.../original name"
417 // This is a recursive method: The AdoptSubtructure()of all sub-algorithms is
418 // invoked.
419 //
420  LOG("Algorithm", pNOTICE)
421  << "Algorithm: " << this->Id().Key() << " is adopting its substructure";
422 
423 // Registry deep_config;
424 // deep_config.UnLock();
425 // deep_config.SetName(this->Id().Key());
426 
427  // deep_config.SetName(this->Id().Config() + ";D");
428  // fID.SetConfig(this->Id().Config() + ";D");
429 
430  if(fOwnsSubstruc) this->DeleteSubstructure();
431 
432  fOwnedSubAlgMp = new AlgMap;
433  fOwnsSubstruc = true;
434 
435  AlgFactory * algf = AlgFactory::Instance();
436 
437  const RgIMap & rgmap = GetConfig().GetItemMap();
438 
439  RgIMapConstIter iter = rgmap.begin();
440  for( ; iter != rgmap.end(); ++iter) {
441 
442  RgKey reg_key = iter->first;
443  RegistryItemI * ri = iter->second;
444 
445  if(ri->TypeInfo() == kRgAlg) {
446  LOG("Algorithm", pDEBUG)
447  << "Found sub-algorithm pointed to by " << reg_key;
448  RgAlg reg_alg = fConfig->GetAlg(reg_key);
449  AlgId id(reg_alg);
450 
451  LOG("Algorithm", pDEBUG) << "Adopting sub-algorithm = " << id.Key();
452  Algorithm * subalg = algf->AdoptAlgorithm(id.Name(),id.Config());
453  subalg->AdoptSubstructure();
454 
455  LOG("Algorithm", pDEBUG) << "Adding sub-algorithm to local pool";
456  AlgMapPair key_alg_pair(reg_key, subalg);
457  fOwnedSubAlgMp->insert(key_alg_pair);
458 
459  }
460 
461  }
462 
463 
464  if ( fConfig ) {
465  delete fConfig ;
466  fConfig = 0 ;
467  }
468 
469 }
::xsd::cxx::tree::id< char, ncname > id
Definition: Database.h:165
void DeleteSubstructure(void)
Definition: Algorithm.cxx:496
AlgMap * fOwnedSubAlgMp
local pool for owned sub-algs (taken out of the factory pool)
Definition: Algorithm.h:167
bool fOwnsSubstruc
true if it owns its substructure (sub-algs,...)
Definition: Algorithm.h:155
Algorithm abstract base class.
Definition: Algorithm.h:54
map< string, Algorithm * > AlgMap
Definition: Algorithm.h:49
Registry item pABC.
Definition: RegistryItemI.h:30
virtual const Registry & GetConfig(void) const
Definition: Algorithm.cxx:254
virtual RgType_t TypeInfo(void) const =0
typename config_impl< T >::type Config
Definition: ModuleMacros.h:54
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
const RgIMap & GetItemMap(void) const
Definition: Registry.h:162
void AdoptSubstructure(void)
Definition: Algorithm.cxx:408
pair< string, Algorithm * > AlgMapPair
Definition: Algorithm.h:52
Algorithm * AdoptAlgorithm(const AlgId &algid) const
Definition: AlgFactory.cxx:127
Algorithm ID (algorithm name + configuration set name)
Definition: AlgId.h:35
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
static AlgFactory * Instance()
Definition: AlgFactory.cxx:75
string RgKey
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
#define pNOTICE
Definition: Messenger.h:62
The GENIE Algorithm Factory.
Definition: AlgFactory.h:40
string Key(void) const
Definition: AlgId.h:47
RgAlg GetAlg(RgKey key) const
Definition: Registry.cxx:503
#define pDEBUG
Definition: Messenger.h:64
map< RgKey, RegistryItemI * > RgIMap
Definition: Registry.h:46
virtual bool genie::Algorithm::AllowReconfig ( void  ) const
inlinevirtualinherited
bool Intranuke2018::CanRescatter ( const GHepParticle p) const
protectedinherited

Definition at line 236 of file Intranuke2018.cxx.

References ana::assert(), genie::kPdgKP, genie::kPdgNeutron, genie::kPdgPi0, genie::kPdgPiM, genie::kPdgPiP, genie::kPdgProton, and genie::GHepParticle::Pdg().

Referenced by genie::Intranuke2018::GetGenINukeMode(), and genie::Intranuke2018::TransportHadrons().

237 {
238 // checks whether a particle that needs to be rescattered, can in fact be
239 // rescattered by this cascade MC
240 
241  assert(p);
242  return ( p->Pdg() == kPdgPiP ||
243  p->Pdg() == kPdgPiM ||
244  p->Pdg() == kPdgPi0 ||
245  p->Pdg() == kPdgProton ||
246  p->Pdg() == kPdgNeutron ||
247  // p->Pdg() == kPdgGamma ||
248  p->Pdg() == kPdgKP //||
249  // p->Pdg() == kPdgKM
250  );
251 }
int Pdg(void) const
Definition: GHepParticle.h:64
const int kPdgKP
Definition: PDGCodes.h:149
const int kPdgPiP
Definition: PDGCodes.h:135
const int kPdgPi0
Definition: PDGCodes.h:137
assert(nhit_max >=nhit_nbins)
const int kPdgPiM
Definition: PDGCodes.h:136
const int kPdgProton
Definition: PDGCodes.h:65
const int kPdgNeutron
Definition: PDGCodes.h:67
AlgCmp_t Algorithm::Compare ( const Algorithm alg) const
virtualinherited

Compare with input algorithm.

Definition at line 294 of file Algorithm.cxx.

References genie::AlgId::Config(), genie::Algorithm::Id(), genie::kAlgCmpDiffAlg, genie::kAlgCmpDiffConfig, genie::kAlgCmpIdentical, genie::kAlgCmpUnknown, and genie::AlgId::Name().

Referenced by genie::Algorithm::AllowReconfig().

295 {
296 // Compares itself with the input algorithm
297 
298  string alg1 = this->Id().Name();
299  string config1 = this->Id().Config();
300  string alg2 = algo->Id().Name();
301  string config2 = algo->Id().Config();
302 
303  if(alg1 == alg2)
304  {
305  if(config1 == config2) return kAlgCmpIdentical;
306  else return kAlgCmpDiffConfig;
307  }
308  else return kAlgCmpDiffAlg;
309 
310  return kAlgCmpUnknown;
311 }
string Name(void) const
Definition: AlgId.h:45
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
string Config(void) const
Definition: AlgId.h:46
void Intranuke2018::Configure ( const Registry config)
virtualinherited

Configure the algorithm with an external registry The registry is merged with the top level registry if it is owned, Otherwise a copy of it is added with the highest priority

Reimplemented from genie::Algorithm.

Definition at line 432 of file Intranuke2018.cxx.

References genie::Algorithm::Configure(), and genie::Intranuke2018::LoadConfig().

433 {
434  Algorithm::Configure(config);
435  this->LoadConfig();
436 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
virtual void LoadConfig(void)=0
void Intranuke2018::Configure ( string  config)
virtualinherited

Configure the algorithm from the AlgoConfigPool based on param_set string given in input An algorithm contains a vector of registries coming from different xml configuration files, which are loaded according a very precise prioriy This methods will load a number registries in order of priority: 1) "Tunable" parameter set from CommonParametes. This is loaded with the highest prioriry and it is designed to be used for tuning procedure Usage not expected from the user. 2) For every string defined in "CommonParame" the corresponding parameter set will be loaded from CommonParameter.xml 3) parameter set specified by the config string and defined in the xml file of the algorithm 4) if config is not "Default" also the Default parameter set from the same xml file will be loaded Effectively this avoids the repetion of a parameter when it is not changed in the requested configuration

Reimplemented from genie::Algorithm.

Definition at line 438 of file Intranuke2018.cxx.

References genie::Algorithm::Configure(), and genie::Intranuke2018::LoadConfig().

439 {
440  Algorithm::Configure(param_set);
441  this->LoadConfig();
442 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
virtual void LoadConfig(void)=0
void Algorithm::DeleteConfig ( void  )
protectedinherited

Definition at line 471 of file Algorithm.cxx.

References MECModelEnuComparisons::i.

Referenced by genie::Algorithm::AllowReconfig().

472 {
473  // there is nothing to delete if the configuration is not owned but is
474  // rather looked up from the configuration pool
475  //
476 
477  for ( unsigned int i = 0 ; i < fConfVect.size() ; ++i ) {
478  if ( fOwnerships[i] ) {
479  delete fConfVect[i] ;
480  }
481  }
482 
483  fConfVect.clear() ;
484  fOwnerships.clear() ;
485 
486  // delete owned configuration registry
487 
488  if(fConfig) {
489  delete fConfig;
490  fConfig=0;
491  }
492 
493 }
vector< Registry * > fConfVect
Definition: Algorithm.h:161
vector< bool > fOwnerships
ownership for every registry in fConfVect
Definition: Algorithm.h:164
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
void Algorithm::DeleteSubstructure ( void  )
protectedinherited

Definition at line 496 of file Algorithm.cxx.

Referenced by genie::Algorithm::AllowReconfig().

497 {
498  // there is nothing to delete if the sub-algorithms are not owned but rather
499  // taken from the AlgFactory's pool
500  //
501  if(!fOwnsSubstruc) return;
502 
503  // delete local algorithm pool
504  //
505  AlgMapIter iter = fOwnedSubAlgMp->begin();
506  for( ; iter != fOwnedSubAlgMp->end(); ++iter) {
507  Algorithm * alg = iter->second;
508  if(alg) {
509  delete alg;
510  alg=0;
511  }
512  }
513  delete fOwnedSubAlgMp;
514  fOwnedSubAlgMp = 0;
515 }
AlgMap * fOwnedSubAlgMp
local pool for owned sub-algs (taken out of the factory pool)
Definition: Algorithm.h:167
bool fOwnsSubstruc
true if it owns its substructure (sub-algs,...)
Definition: Algorithm.h:155
Algorithm abstract base class.
Definition: Algorithm.h:54
map< string, Algorithm * >::iterator AlgMapIter
Definition: Algorithm.h:50
void HNIntranuke2018::ElasHN ( GHepRecord ev,
GHepParticle p,
INukeFateHN_t  fate 
) const
private

Definition at line 659 of file HNIntranuke2018.cxx.

References genie::GHepRecord::AddParticle(), genie::INukeHadroFates::AsString(), genie::Intranuke2018::fDoFermi, genie::Intranuke2018::fFermiFac, genie::Intranuke2018::fHadroData2018, genie::Intranuke2018::fNuclmodel, genie::Intranuke2018::fRemnA, genie::Intranuke2018::fRemnP4, genie::Intranuke2018::fRemnZ, genie::NuclearModelI::GenerateNucleon(), genie::RandomGen::Instance(), genie::INukeHadroData2018::IntBounce(), genie::kIHNFtCEx, genie::kIHNFtElas, genie::kIMdHN, genie::kIStStableFinalState, genie::kPdgK0, genie::kPdgKP, genie::kPdgNeutron, genie::kPdgPi0, genie::kPdgPiM, genie::kPdgPiP, genie::kPdgProton, LOG, genie::GHepParticle::Mass(), genie::NuclearModelI::Momentum3(), genie::GHepParticle::Name(), pDEBUG, genie::GHepParticle::Pdg(), pINFO, pWARN, generate_hists::rnd, genie::RandomGen::RndFsi(), genie::GHepParticle::SetMomentum(), genie::GHepParticle::SetPdgCode(), genie::exceptions::INukeException::SetReason(), genie::GHepParticle::SetStatus(), confusionMatrixTree::t, genie::GHepRecord::TargetNucleus(), and genie::utils::intranuke2018::TwoBodyCollision().

Referenced by GetGenINukeMode(), and SimulateHadronicFinalState().

661 {
662  // scatters particle within nucleus
663 
664 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
665  LOG("HNIntranuke2018", pDEBUG)
666  << "ElasHN() is invoked for a : " << p->Name()
667  << " whose fate is : " << INukeHadroFates::AsString(fate);
668 #endif
669 
670  if(fate!=kIHNFtCEx && fate!=kIHNFtElas)
671  {
672  LOG("HNIntranuke2018", pWARN)
673  << "ElasHN() cannot handle fate: " << INukeHadroFates::AsString(fate);
674  return;
675  }
676 
677  // Random number generator
679 
680  // vars for incoming particle, target, and scattered pdg codes
681  int pcode = p->Pdg();
682  int tcode, scode, s2code;
683  double ppcnt = (double) fRemnZ / (double) fRemnA; // % of protons
684 
685  // Select a target randomly, weighted to #
686  // -- Unless, of course, the fate is CEx,
687  // -- in which case the target may be deterministic
688  // Also assign scattered particle code
689  if(fate==kIHNFtCEx)
690  {
691  if(pcode==kPdgPiP) {tcode = kPdgNeutron; scode = kPdgPi0; s2code = kPdgProton;}
692  else if(pcode==kPdgPiM) {tcode = kPdgProton; scode = kPdgPi0; s2code = kPdgNeutron;}
693  else if(pcode==kPdgKP) {tcode = kPdgNeutron; scode = kPdgK0; s2code = kPdgProton;}
694  else
695  {
696  // for pi0
697  tcode = (rnd->RndFsi().Rndm()<=ppcnt)?(kPdgProton) :(kPdgNeutron);
698  scode = (tcode == kPdgProton) ?(kPdgPiP) :(kPdgPiM);
699  s2code = (tcode == kPdgProton) ?(kPdgNeutron):(kPdgProton);
700  }
701  }
702  else
703  {
704  tcode = (rnd->RndFsi().Rndm()<=ppcnt)?(kPdgProton):(kPdgNeutron);
705  scode = pcode;
706  s2code = tcode;
707  }
708 
709  // get random scattering angle
710  double C3CM = fHadroData2018->IntBounce(p,tcode,scode,fate);
711  if (C3CM<-1.)
712  {
714  ev->AddParticle(*p);
715  return;
716  }
717 
718  // create scattered particle
719  GHepParticle * t = new GHepParticle(*p);
720  t->SetPdgCode(tcode);
721  double Mt = t->Mass();
722  //t->SetMomentum(TLorentzVector(0,0,0,Mt));
723 
724  // handle fermi momentum
725  if(fDoFermi)
726  {
727  // Handle fermi target
728  Target target(ev->TargetNucleus()->Pdg());
729  //LOG("HAIntranuke2018", pNOTICE) << "Nuclmodel= " << fNuclmodel->ModelType(target) ;
730  target.SetHitNucPdg(tcode);
732  TVector3 tP3L = fFermiFac * fNuclmodel->Momentum3();
733  double tE = TMath::Sqrt(tP3L.Mag2() + Mt*Mt);
734  t->SetMomentum(TLorentzVector(tP3L,tE));
735  }
736  else
737  {
738  t->SetMomentum(TLorentzVector(0,0,0,Mt));
739  }
740 
741  bool pass = utils::intranuke2018::TwoBodyCollision(ev,pcode,tcode,scode,s2code,C3CM,
743 
744 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
745  LOG("HNIntranuke2018",pDEBUG)
746  << "|p3| = " << P3L << ", E3 = " << E3L;
747  LOG("HNIntranuke2018",pDEBUG)
748  << "|p4| = " << P4L << ", E4 = " << E4L;
749 #endif
750 
751  if (pass==true)
752  {
753  ev->AddParticle(*p);
754  ev->AddParticle(*t);
755  } else
756  {
757  delete t; //fixes memory leak
758  LOG("HNIntranuke2018", pINFO) << "Elastic in hN failed calling TwoBodyCollision";
760  exception.SetReason("hN scattering kinematics through TwoBodyCollision failed");
761  throw exception;
762  }
763 
764  delete t;
765 
766 }
An exception thrown by SimulateHadronState for kinematics problems. TwoBodyCollision/Kinematics used ...
TRandom3 & RndFsi(void) const
rnd number generator used by intranuclear cascade monte carlos
Definition: RandomGen.h:60
const XML_Char * target
Definition: expat.h:268
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
double fFermiFac
testing parameter to modify fermi momentum
int fRemnA
remnant nucleus A
Definition: Intranuke2018.h:99
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
void SetMomentum(const TLorentzVector &p4)
double Mass(void) const
Mass that corresponds to the PDG code.
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
const NuclearModelI * fNuclmodel
nuclear model used to generate fermi momentum
Definition: Intranuke2018.h:98
const TVector3 & Momentum3(void) const
Definition: NuclearModelI.h:67
const int kPdgK0
Definition: PDGCodes.h:151
int Pdg(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:97
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
Definition: Target.h:41
const int kPdgKP
Definition: PDGCodes.h:149
bool TwoBodyCollision(GHepRecord *ev, int pcode, int tcode, int scode, int s2code, double C3CM, GHepParticle *p, GHepParticle *t, int &RemnA, int &RemnZ, TLorentzVector &RemnP4, EINukeMode mode=kIMdHA)
Intranuke utility functions.
const int kPdgPiP
Definition: PDGCodes.h:135
const int kPdgPi0
Definition: PDGCodes.h:137
virtual GHepParticle * TargetNucleus(void) const
Definition: GHepRecord.cxx:330
bool fDoFermi
whether or not to do fermi mom.
#define pINFO
Definition: Messenger.h:63
#define pWARN
Definition: Messenger.h:61
void SetStatus(GHepStatus_t s)
Definition: GHepParticle.h:127
static string AsString(INukeFateHN_t fate)
INukeHadroData2018 * fHadroData2018
a collection of h+N,h+A data & calculations
Definition: Intranuke2018.h:96
const int kPdgPiM
Definition: PDGCodes.h:136
virtual bool GenerateNucleon(const Target &) const =0
virtual void AddParticle(const GHepParticle &p)
Definition: GHepRecord.cxx:535
const int kPdgProton
Definition: PDGCodes.h:65
const int kPdgNeutron
Definition: PDGCodes.h:67
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
double IntBounce(const GHepParticle *p, int target, int s1, INukeFateHN_t fate)
int fRemnZ
remnant nucleus Z
#define pDEBUG
Definition: Messenger.h:64
void SetPdgCode(int c)
TLorentzVector fRemnP4
P4 of remnant system.
Registry * Algorithm::ExtractLocalConfig ( const Registry in) const
protectedinherited

Split an incoming configuration Registry into a block valid for this algorithm Ownership of the returned registry belongs to the algo

Definition at line 518 of file Algorithm.cxx.

References genie::RegistryItemI::Clone(), genie::Registry::GetItemMap(), genie::Registry::Name(), and confusionMatrixTree::out.

Referenced by genie::Algorithm::AllowReconfig().

518  {
519 
520  const RgIMap & rgmap = in.GetItemMap();
521  Registry * out = new Registry( in.Name(), false );
522 
523  for( RgIMapConstIter reg_iter = rgmap.begin();
524  reg_iter != rgmap.end(); ++reg_iter ) {
525 
526  RgKey reg_key = reg_iter->first;
527  if( reg_key.find( '/' ) != string::npos) continue;
528 
529  // at this point
530  // this key is referred to the local algorithm
531  // it has to be copied in out;
532 
533  RegistryItemI * ri = reg_iter->second;
534  RgIMapPair key_item_pair( reg_key, ri->Clone() );
535  out -> Set(key_item_pair);
536 
537  }
538 
539  if ( out -> NEntries() <= 0 ) {
540  delete out ;
541  out = 0 ;
542  }
543 
544  return out ;
545 }
Registry item pABC.
Definition: RegistryItemI.h:30
string Name(void) const
get the registry name
Definition: Registry.cxx:612
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
const RgIMap & GetItemMap(void) const
Definition: Registry.h:162
pair< RgKey, RegistryItemI * > RgIMapPair
Definition: Registry.h:47
string RgKey
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
virtual RegistryItemI * Clone(void) const =0
map< RgKey, RegistryItemI * > RgIMap
Definition: Registry.h:46
Registry * Algorithm::ExtractLowerConfig ( const Registry in,
const string alg_key 
) const
protectedinherited

Split an incoming configuration Registry into a block valid for the sub-algo identified by alg_key.

Definition at line 549 of file Algorithm.cxx.

References genie::RegistryItemI::Clone(), genie::Registry::GetItemMap(), genie::Registry::Name(), and confusionMatrixTree::out.

Referenced by genie::Algorithm::AllowReconfig().

549  {
550 
551  const RgIMap & rgmap = in.GetItemMap();
552  Registry * out = new Registry( in.Name(), false );
553 
554  for( RgIMapConstIter reg_iter = rgmap.begin();
555  reg_iter != rgmap.end(); ++reg_iter ) {
556 
557  RgKey reg_key = reg_iter->first;
558  if( reg_key.find(alg_key+"/") == string::npos) continue;
559 
560  // at this point
561  // this key is referred to the sub-algorithm
562  // indicated by alg_key: it has to be copied in out;
563 
564  int new_key_start = reg_key.find_first_of('/')+1;
565  RgKey new_reg_key = reg_key.substr( new_key_start, reg_key.length() );
566 
567  RegistryItemI * ri = reg_iter->second;
568  RgIMapPair key_item_pair(new_reg_key, ri->Clone());
569  out -> Set(key_item_pair);
570 
571  }
572 
573  if ( out -> NEntries() <= 0 ) {
574  delete out ;
575  out = 0 ;
576  }
577 
578  return out ;
579 
580 }
Registry item pABC.
Definition: RegistryItemI.h:30
string Name(void) const
get the registry name
Definition: Registry.cxx:612
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
const RgIMap & GetItemMap(void) const
Definition: Registry.h:162
pair< RgKey, RegistryItemI * > RgIMapPair
Definition: Registry.h:47
string RgKey
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
virtual RegistryItemI * Clone(void) const =0
map< RgKey, RegistryItemI * > RgIMap
Definition: Registry.h:46
double HNIntranuke2018::FateWeight ( int  pdgc,
INukeFateHN_t  fate 
) const
private

Definition at line 363 of file HNIntranuke2018.cxx.

References genie::Intranuke2018::fDoCompoundNucleus, genie::Intranuke2018::fRemnA, genie::Intranuke2018::fRemnZ, genie::kIHNFtAbs, genie::kIHNFtCEx, genie::kIHNFtCmp, genie::kPdgKP, genie::kPdgNeutron, genie::kPdgPiM, genie::kPdgPiP, genie::kPdgProton, LOG, and pERROR.

Referenced by GetGenINukeMode(), and HadronFateHN().

364 {
365  // turn fates off if the remnant nucleus does not have the number of p,n
366  // required
367 
368  int np = fRemnZ;
369  int nn = fRemnA - fRemnZ;
370 
371  if (np < 1 && nn < 1)
372  {
373  LOG("HNIntranuke2018", pERROR) << "** Nothing left in nucleus!!! **";
374  return 0;
375  }
376  else
377  {
378  if (fate == kIHNFtCEx && pdgc==kPdgPiP ) { return (nn>=1) ? 1. : 0.; }
379  if (fate == kIHNFtCEx && pdgc==kPdgPiM ) { return (np>=1) ? 1. : 0.; }
380  if (fate == kIHNFtCEx && pdgc==kPdgKP ) { return (nn>=1) ? 1. : 0.; } //Added, changed np to nn
381  if (fate == kIHNFtAbs) { return ((nn>=1) && (np>=1)) ? 1. : 0.; }
382  if (fate == kIHNFtCmp ) { return ((pdgc==kPdgProton||pdgc==kPdgNeutron)&&fDoCompoundNucleus&&fRemnA>5) ? 1. : 0.; }
383 
384  }
385  return 1.;
386 }
#define pERROR
Definition: Messenger.h:60
int fRemnA
remnant nucleus A
Definition: Intranuke2018.h:99
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
const int kPdgKP
Definition: PDGCodes.h:149
const int kPdgPiP
Definition: PDGCodes.h:135
bool fDoCompoundNucleus
whether or not to do compound nucleus considerations
const int kPdgPiM
Definition: PDGCodes.h:136
const int kPdgProton
Definition: PDGCodes.h:65
const int kPdgNeutron
Definition: PDGCodes.h:67
int fRemnZ
remnant nucleus Z
void Algorithm::FindConfig ( void  )
virtualinherited

Lookup configuration from the config pool Similar logic from void Configure(string)

Definition at line 135 of file Algorithm.cxx.

References gen_hdf5record::config, exit(), genie::AlgConfigPool::FindRegistry(), genie::Registry::GetItemMap(), genie::Registry::GetString(), MECModelEnuComparisons::i, genie::AlgConfigPool::Instance(), it, genie::Registry::ItemIsLocal(), parse_dependency_file_t::list, LOG, pDEBUG, pFATAL, time_estimates::pool, pWARN, moon_position_table_new3::second, genie::utils::str::Split(), string, and APDHVSetting::temp.

136 {
137 // Finds its configration Registry from the ConfigPool and gets a pointer to
138 // it. If the Registry comes from the ConfigPool then the Algorithm does not
139 // own its configuration (the ConfigPool singleton keeps the ownership and the
140 // responsibility to -eventually- delete all the Registries it instantiates
141 // by parsing the XML config files).
142 
143  DeleteConfig() ;
144 
146 
147  Registry * config = 0 ;
148 
149  // load the Default config if config is not the default
150  if ( fID.Config() != "Default" ) {
151  config = pool -> FindRegistry( fID.Name(), "Default" );
152  if ( config ) {
153  if ( config -> NEntries() > 0 ) {
154  AddTopRegistry( config, false ) ;
155  LOG("Algorithm", pDEBUG) << "\n" << *config;
156  }
157  }
158  }
159 
160  // Load the right config
161  config = pool->FindRegistry(this);
162 
163  if(!config)
164  // notify & keep whatever config Registry was used before.
165  LOG("Algorithm", pWARN)
166  << "No Configuration available for "
167  << this->Id().Key() << " at the ConfigPool";
168  else {
169  if ( config -> NEntries() > 0 ) {
170  AddTopRegistry( config, false ) ;
171  LOG("Algorithm", pDEBUG) << "\n" << config;
172  }
173  }
174 
175  const string common_key_root = "Common" ;
176  std::map<string, string> common_lists;
177 
178  // Load Common Parameters if key that start with "Common" is found
179  for ( unsigned int i = 0 ; i < fConfVect.size() ; ++i ) {
180  const Registry & temp = * fConfVect[i] ;
181  for ( RgIMapConstIter it = temp.GetItemMap().begin() ; it != temp.GetItemMap().end() ; ++it ) {
182 
183  // check if it is a "Common" entry
184  if ( it -> first.find( common_key_root ) == 0 ) {
185  // retrieve the type of the common entry
186  std::string type = it -> first.substr(common_key_root.size() ) ;
187 
188  if ( temp.ItemIsLocal( it -> first ) ) {
189 
190  string temp_list = temp.GetString( it -> first ) ;
191  if ( temp_list.length() > 0 ) {
192  common_lists[type] = temp_list ;
193  }
194  }
195  }
196 
197  }
198 
199  } // loop over the local registries
200 
201 
202  for ( std::map<string, string>::const_iterator it = common_lists.begin() ;
203  it != common_lists.end() ; ++it ) {
204 
205  vector<string> list = str::Split( it -> second , "," ) ;
206 
207  for ( unsigned int i = 0; i < list.size(); ++i ) {
208 
209  config = pool -> CommonList( it -> first, list[i] ) ;
210 
211  if ( ! config ) {
212  LOG("Algorithm", pFATAL)
213  << "No Commom parameters available for " << it -> first << " list "
214  << list[i] << " at the ConfigPool";
215 
216  exit( 78 ) ;
217  }
218  else {
219  AddLowRegistry( config, false ) ;
220  LOG("Algorithm", pDEBUG) << "Loading "
221  << it -> first << " registry "
222  << list[i] << " \n" << config;
223  }
224 
225  }
226 
227  }
228 
229 
230  // Load Tunable from CommonParameters
231  // only if the option is specified in RunOpt
232  config = pool -> CommonList( "Param", "Tunable" ) ;
233  if ( config ) {
234  if ( config -> NEntries() > 0 ) {
235  AddTopRegistry( config, false ) ;
236  LOG("Algorithm", pDEBUG) << "Loading Tunable registry \n" << config;
237  }
238  }
239  else {
240  // notify & keep whatever config Registry was used before.
241  LOG("Algorithm", pWARN)
242  << "No Tunable parameter set available at the ConfigPool";
243  }
244 
245  if ( fConfig ) {
246  delete fConfig ;
247  fConfig = 0 ;
248  }
249 
250 }
set< int >::iterator it
A singleton class holding all configuration registries built while parsing all loaded XML configurati...
Definition: AlgConfigPool.h:41
#define pFATAL
Definition: Messenger.h:57
Definition: config.py:1
AlgId fID
algorithm name and configuration set
Definition: Algorithm.h:156
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
const RgIMap & GetItemMap(void) const
Definition: Registry.h:162
string Name(void) const
Definition: AlgId.h:45
bool ItemIsLocal(RgKey key) const
local or global?
Definition: Registry.cxx:193
int AddTopRegistry(Registry *rp, bool owns=true)
add registry with top priority, also update ownership
Definition: Algorithm.cxx:585
#define pWARN
Definition: Messenger.h:61
void DeleteConfig(void)
Definition: Algorithm.cxx:471
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
RgStr GetString(RgKey key) const
Definition: Registry.cxx:496
vector< Registry * > fConfVect
Definition: Algorithm.h:161
vector< string > Split(string input, string delim)
Definition: StringUtils.cxx:42
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
exit(0)
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
Registry * FindRegistry(string key) const
int AddLowRegistry(Registry *rp, bool owns=true)
add registry with lowest priority, also update ownership
Definition: Algorithm.cxx:601
string Key(void) const
Definition: AlgId.h:47
static AlgConfigPool * Instance()
#define pDEBUG
Definition: Messenger.h:64
string Config(void) const
Definition: AlgId.h:46
enum BeamMode string
void HNIntranuke2018::GammaInelasticHN ( GHepRecord ev,
GHepParticle p,
INukeFateHN_t  fate 
) const
private

Definition at line 801 of file HNIntranuke2018.cxx.

References genie::GHepRecord::AddParticle(), genie::INukeHadroFates::AsString(), genie::Intranuke2018::fDoFermi, genie::Intranuke2018::fFermiFac, genie::Intranuke2018::fHadroData2018, genie::Intranuke2018::fNuclmodel, genie::Intranuke2018::fRemnA, genie::Intranuke2018::fRemnP4, genie::Intranuke2018::fRemnZ, genie::NuclearModelI::GenerateNucleon(), genie::RandomGen::Instance(), genie::INukeHadroData2018::IntBounce(), genie::kIHNFtInelas, genie::kIMdHN, genie::GHepParticle::KinE(), genie::kPdgGamma, genie::kPdgNeutron, genie::kPdgPi0, genie::kPdgPiM, genie::kPdgPiP, genie::kPdgProton, LOG, genie::GHepParticle::Mass(), genie::units::MeV, genie::NuclearModelI::Momentum3(), genie::GHepParticle::Name(), pDEBUG, genie::GHepParticle::Pdg(), pERROR, pNOTICE, pWARN, generate_hists::rnd, genie::RandomGen::RndFsi(), genie::GHepParticle::SetMomentum(), genie::GHepParticle::SetPdgCode(), confusionMatrixTree::t, genie::GHepRecord::TargetNucleus(), and genie::utils::intranuke2018::TwoBodyCollision().

Referenced by GetGenINukeMode(), and SimulateHadronicFinalState().

802 {
803  // This function handles pion photoproduction reactions
804 
805 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
806  LOG("HNIntranuke2018", pDEBUG)
807  << "GammaInelasticHN() is invoked for a : " << p->Name()
808  << " whose fate is : " << INukeHadroFates::AsString(fate);
809 #endif
810 
811  if(fate!=kIHNFtInelas && p->Pdg()!=kPdgGamma)
812  {
813  LOG("HNIntranuke2018", pWARN)
814  << "GammaInelasticHN() cannot handle fate: " << INukeHadroFates::AsString(fate);
815  return;
816  }
817 
818  // random number generator
820 
821  // vars for incoming particle, target, and scattered reaction products
822  double ppcnt = (double) fRemnZ / (double) fRemnA; // % of protons
823  int pcode = p->Pdg();
824  int tcode = (rnd->RndFsi().Rndm()<=ppcnt)?(kPdgProton):(kPdgNeutron);
825  int scode, s2code;
826  double ke = p->KinE() / units::MeV;
827 
828  LOG("HNIntranuke2018", pNOTICE)
829  << "Particle code: " << pcode << ", target: " << tcode;
830 
831 
832  if (rnd->RndFsi().Rndm() * (fHadroData2018 -> XSecGamp_fs() -> Evaluate(ke) +
833  fHadroData2018 -> XSecGamn_fs() -> Evaluate(ke) )
834  <= fHadroData2018 -> XSecGamp_fs() -> Evaluate(ke) ) { scode = kPdgProton; }
835  else { scode = kPdgNeutron; }
836 
837  //scode=fHadroData2018->AngleAndProduct(p,tcode,C3CM,fate);
838  //double C3CM = 0.0; // cos of scattering angle
839  double C3CM = fHadroData2018->IntBounce(p,tcode,scode,fate);
840 
841  if ((tcode == kPdgProton ) && (scode==kPdgProton )) {s2code=kPdgPi0;}
842  else if ((tcode == kPdgProton ) && (scode==kPdgNeutron)) {s2code=kPdgPiP;}
843  else if ((tcode == kPdgNeutron) && (scode==kPdgProton )) {s2code=kPdgPiM;}
844  else if ((tcode == kPdgNeutron) && (scode==kPdgNeutron)) {s2code=kPdgPi0;}
845  else {
846  LOG("HNIntranuke2018", pERROR)
847  << "Error: could not determine particle final states";
848  ev->AddParticle(*p);
849  return;
850  }
851 
852  LOG("HNIntranuke2018", pNOTICE)
853  << "GammaInelastic fate: " << INukeHadroFates::AsString(fate);
854  LOG("HNIntranuke2018", pNOTICE)
855  << " final state: " << scode << " and " << s2code;
856  LOG("HNIntranuke2018", pNOTICE)
857  << " scattering angle: " << C3CM;
858 
859  GHepParticle * t = new GHepParticle(*p);
860  t->SetPdgCode(tcode);
861  double Mt = t->Mass();
862 
863  // handle fermi momentum
864  if(fDoFermi)
865  {
866  // Handle fermi target
867  Target target(ev->TargetNucleus()->Pdg());
868 
869  target.SetHitNucPdg(tcode);
871  TVector3 tP3L = fFermiFac * fNuclmodel->Momentum3();
872  double tE = TMath::Sqrt(tP3L.Mag2() + Mt*Mt);
873  t->SetMomentum(TLorentzVector(tP3L,tE));
874  }
875  else
876  {
877  t->SetMomentum(TLorentzVector(0,0,0,Mt));
878  }
879 
880  bool pass = utils::intranuke2018::TwoBodyCollision(ev,pcode,tcode,scode,s2code,C3CM,
882 
883 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
884  LOG("HNIntranuke2018",pDEBUG)
885  << "|p3| = " << P3L << ", E3 = " << E3L;
886  LOG("HNIntranuke2018",pDEBUG)
887  << "|p4| = " << P4L << ", E4 = " << E4L;
888 #endif
889 
890  if (pass==true)
891  {
892  //p->SetStatus(kIStStableFinalState);
893  //t->SetStatus(kIStStableFinalState);
894  ev->AddParticle(*p);
895  ev->AddParticle(*t);
896  } else
897  {
898  ev->AddParticle(*p);
899  }
900 
901  delete t;
902 
903 }
TRandom3 & RndFsi(void) const
rnd number generator used by intranuclear cascade monte carlos
Definition: RandomGen.h:60
const XML_Char * target
Definition: expat.h:268
#define pERROR
Definition: Messenger.h:60
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
double fFermiFac
testing parameter to modify fermi momentum
static const double MeV
Definition: Units.h:130
int fRemnA
remnant nucleus A
Definition: Intranuke2018.h:99
void SetMomentum(const TLorentzVector &p4)
double Mass(void) const
Mass that corresponds to the PDG code.
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
const NuclearModelI * fNuclmodel
nuclear model used to generate fermi momentum
Definition: Intranuke2018.h:98
const TVector3 & Momentum3(void) const
Definition: NuclearModelI.h:67
int Pdg(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:97
const int kPdgGamma
Definition: PDGCodes.h:166
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
Definition: Target.h:41
bool TwoBodyCollision(GHepRecord *ev, int pcode, int tcode, int scode, int s2code, double C3CM, GHepParticle *p, GHepParticle *t, int &RemnA, int &RemnZ, TLorentzVector &RemnP4, EINukeMode mode=kIMdHA)
Intranuke utility functions.
const int kPdgPiP
Definition: PDGCodes.h:135
const int kPdgPi0
Definition: PDGCodes.h:137
virtual GHepParticle * TargetNucleus(void) const
Definition: GHepRecord.cxx:330
bool fDoFermi
whether or not to do fermi mom.
#define pWARN
Definition: Messenger.h:61
double KinE(bool mass_from_pdg=false) const
Get kinetic energy.
static string AsString(INukeFateHN_t fate)
INukeHadroData2018 * fHadroData2018
a collection of h+N,h+A data & calculations
Definition: Intranuke2018.h:96
const int kPdgPiM
Definition: PDGCodes.h:136
virtual bool GenerateNucleon(const Target &) const =0
virtual void AddParticle(const GHepParticle &p)
Definition: GHepRecord.cxx:535
const int kPdgProton
Definition: PDGCodes.h:65
#define pNOTICE
Definition: Messenger.h:62
const int kPdgNeutron
Definition: PDGCodes.h:67
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
double IntBounce(const GHepParticle *p, int target, int s1, INukeFateHN_t fate)
int fRemnZ
remnant nucleus Z
#define pDEBUG
Definition: Messenger.h:64
void SetPdgCode(int c)
TLorentzVector fRemnP4
P4 of remnant system.
double Intranuke2018::GenerateStep ( GHepRecord ev,
GHepParticle p 
) const
protectedinherited

Definition at line 396 of file Intranuke2018.cxx.

References d, genie::Intranuke2018::fAltOset, genie::Intranuke2018::fDelRNucleon, genie::Intranuke2018::fDelRPion, genie::Intranuke2018::fNucleonMFPScale, genie::Intranuke2018::fPionMFPScale, genie::Intranuke2018::fRemnA, genie::Intranuke2018::fRemnZ, genie::Intranuke2018::fUseOset, genie::Intranuke2018::fXsecNNCorr, genie::Intranuke2018::GetGenINukeMode(), genie::Intranuke2018::GetINukeMode(), genie::RandomGen::Instance(), genie::kPdgNeutron, genie::kPdgPi0, genie::kPdgPiM, genie::kPdgPiP, genie::kPdgProton, CLHEP::L, LOG, genie::utils::intranuke2018::MeanFreePath(), pDEBUG, generate_hists::rnd, genie::RandomGen::RndFsi(), and scale.

Referenced by genie::Intranuke2018::GetGenINukeMode(), and genie::Intranuke2018::TransportHadrons().

397 {
398 // Generate a step (in fermis) for particle p in the input event.
399 // Computes the mean free path L and generate an 'interaction' distance d
400 // from an exp(-d/L) distribution
401 
402  int pdgc = p->Pdg();
403 
404  double scale = 1.;
405  if (pdgc==kPdgPiP || pdgc==kPdgPiM || pdgc==kPdgPi0) {
406  scale = fPionMFPScale;
407  }
408  else if (pdgc==kPdgProton || pdgc==kPdgNeutron) {
409  scale = fNucleonMFPScale;
410  }
411 
413 
414  string fINukeMode = this->GetINukeMode();
415  string fINukeModeGen = this->GetGenINukeMode();
416 
417  double L = utils::intranuke2018::MeanFreePath(p->Pdg(), *p->X4(), *p->P4(), fRemnA,
419 
420  LOG("Intranuke2018", pDEBUG) << "mode= " << fINukeModeGen;
421  if(fINukeModeGen == "hA") L *= scale;
422 
423  double d = -1.*L * TMath::Log(rnd->RndFsi().Rndm());
424 
425  /* LOG("Intranuke2018", pDEBUG)
426  << "mode= " << fINukeMode << "; Mean free path = " << L << " fm / "
427  << "Generated path length = " << d << " fm";
428  */
429  return d;
430 }
TRandom3 & RndFsi(void) const
rnd number generator used by intranuclear cascade monte carlos
Definition: RandomGen.h:60
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:79
double fDelRPion
factor by which Pion Compton wavelength gets multiplied to become nuclear size enhancement ...
virtual string GetINukeMode() const
Definition: Intranuke2018.h:72
int fRemnA
remnant nucleus A
Definition: Intranuke2018.h:99
bool fXsecNNCorr
use nuclear medium correction for NN cross section
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
int Pdg(void) const
Definition: GHepParticle.h:64
Double_t scale
Definition: plot.C:25
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
static constexpr double L
double fPionMFPScale
tweaking factors for tuning
Float_t d
Definition: plot.C:236
const int kPdgPiP
Definition: PDGCodes.h:135
const int kPdgPi0
Definition: PDGCodes.h:137
double MeanFreePath(int pdgc, const TLorentzVector &x4, const TLorentzVector &p4, double A, double Z, double nRpi=0.5, double nRnuc=1.0, const bool useOset=false, const bool altOset=false, const bool xsecNNCorr=false, string INukeMode="XX2018")
Mean free path (pions, nucleons)
virtual string GetGenINukeMode() const
Definition: Intranuke2018.h:73
const TLorentzVector * X4(void) const
Definition: GHepParticle.h:80
bool fAltOset
NuWro&#39;s table-based implementation (not recommended)
double fDelRNucleon
factor by which Nucleon Compton wavelength gets multiplied to become nuclear size enhancement ...
const int kPdgPiM
Definition: PDGCodes.h:136
const int kPdgProton
Definition: PDGCodes.h:65
const int kPdgNeutron
Definition: PDGCodes.h:67
bool fUseOset
Oset model for low energy pion in hN.
int fRemnZ
remnant nucleus Z
#define pDEBUG
Definition: Messenger.h:64
void Intranuke2018::GenerateVertex ( GHepRecord ev) const
protectedinherited

Definition at line 156 of file Intranuke2018.cxx.

References ana::assert(), epsilon, genie::Intranuke2018::fTrackingRadius, genie::RandomGen::Instance(), genie::pdg::IsIon(), genie::pdg::IsPseudoParticle(), LOG, genie::GHepParticle::P4(), genie::GHepParticle::Pdg(), pNOTICE, genie::GHepRecord::Probe(), generate_hists::rnd, genie::RandomGen::RndFsi(), genie::GHepParticle::SetPosition(), genie::GHepRecord::TargetNucleus(), genie::utils::print::Vec3AsString(), submit_syst::x, and submit_syst::y.

Referenced by genie::Intranuke2018::GetGenINukeMode(), and genie::Intranuke2018::ProcessEventRecord().

157 {
158 // Sets a vertex in the nucleus periphery
159 // Called onlt in hadron/photon-nucleus interactions.
160 
161  GHepParticle * nucltgt = evrec->TargetNucleus();
162  assert(nucltgt);
163 
165  TVector3 vtx(999999.,999999.,999999.);
166 
167  // *** For h+A events (test mode):
168  // Assume a hadron beam with uniform intensity across an area,
169  // so we need to choose events uniformly within that area.
170  double x=999999., y=999999., epsilon = 0.001;
171  double R2 = TMath::Power(fTrackingRadius,2.);
172  double rp2 = TMath::Power(x,2.) + TMath::Power(y,2.);
173  while(rp2 > R2-epsilon) {
174  x = (fTrackingRadius-epsilon) * rnd->RndFsi().Rndm();
175  y = -fTrackingRadius + 2*fTrackingRadius * rnd->RndFsi().Rndm();
176  y -= ((y>0) ? epsilon : -epsilon);
177  rp2 = TMath::Power(x,2.) + TMath::Power(y,2.);
178  }
179  vtx.SetXYZ(x,y, -1.*TMath::Sqrt(TMath::Max(0.,R2-rp2)) + epsilon);
180 
181  // get the actual unit vector along the incoming hadron direction
182  TVector3 direction = evrec->Probe()->P4()->Vect().Unit();
183 
184  // rotate the vtx position
185  vtx.RotateUz(direction);
186 
187  LOG("Intranuke2018", pNOTICE)
188  << "Generated vtx @ R = " << vtx.Mag() << " fm / "
189  << print::Vec3AsString(&vtx);
190 
191  TObjArrayIter piter(evrec);
192  GHepParticle * p = 0;
193  while( (p = (GHepParticle *) piter.Next()) )
194  {
195  if(pdg::IsPseudoParticle(p->Pdg())) continue;
196  if(pdg::IsIon (p->Pdg())) continue;
197 
198  p->SetPosition(vtx.x(), vtx.y(), vtx.z(), 0.);
199  }
200 }
TRandom3 & RndFsi(void) const
rnd number generator used by intranuclear cascade monte carlos
Definition: RandomGen.h:60
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
const char * p
Definition: xmltok.h:285
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
int Pdg(void) const
Definition: GHepParticle.h:64
void SetPosition(const TLorentzVector &v4)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
bool IsIon(int pdgc)
Definition: PDGUtils.cxx:40
bool IsPseudoParticle(int pdgc)
Definition: PDGUtils.cxx:25
double epsilon
assert(nhit_max >=nhit_nbins)
#define pNOTICE
Definition: Messenger.h:62
double fTrackingRadius
tracking radius for the nucleus in the current event
Definition: Intranuke2018.h:94
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
string Vec3AsString(const TVector3 *vec)
Definition: PrintUtils.cxx:87
const Registry & Algorithm::GetConfig ( void  ) const
virtualinherited

Get configuration registry Evaluate the summary of the configuration and returns it The summary of a configuration is a merge of all the registries known to the algorithm (see Configure() methods) but every parameter is appearing only once and in case of repetitions, only the parameter from the registry with the highest prioriry is considered.

Definition at line 254 of file Algorithm.cxx.

References febshutoff_auto::end, genie::Algorithm::GetConfig(), MECModelEnuComparisons::i, LOG, pDEBUG, r(), and moon_position_table_new3::second.

Referenced by genie::EventGeneratorListAssembler::AssembleGeneratorList(), GetAlgorithms(), genie::Algorithm::GetConfig(), genie::GRV98LO::GRV98LO(), genie::NewQELXSec::Integrate(), genie::LHAPDF5::LHAPDF5(), genie::IBDXSecMap::LoadConfig(), genie::Decayer::LoadConfig(), genie::PythiaHadronization::LoadConfig(), genie::FGMBodekRitchie::LoadConfig(), genie::NuclearModelMap::LoadConfig(), genie::SmithMonizUtils::LoadConfig(), main(), genie::AlgFactory::Print(), TestPythiaTauDecays(), testReconfigInOwnedModules(), and genie::P33PaschosLalakulichPXSec::XSec().

254  {
255 
256  if ( fConfig ) return * fConfig ;
257 
258  const_cast<Algorithm*>( this ) -> fConfig = new Registry( fID.Key() + "_summary", false ) ;
259 
260  // loop and append
261  // understand the append mechanism
262  for ( unsigned int i = 0 ; i < fConfVect.size(); ++i ) {
263  fConfig -> Append( * fConfVect[i] ) ;
264  }
265 
266  if ( fOwnsSubstruc ) {
267 
268  for ( AlgMapConstIter iter = fOwnedSubAlgMp -> begin() ;
269  iter != fOwnedSubAlgMp -> end() ; ++iter ) {
270 
271  Algorithm * subalg = iter -> second ;
272 
273  LOG("Algorithm", pDEBUG) << "Appending config from " << iter -> first << " -> " << subalg -> Id() ;
274  const Registry & r = subalg->GetConfig();
275  RgKey prefix = iter -> first + "/";
276  fConfig -> Append(r,prefix);
277 
278  }
279 
280  } //if owned substructure
281 
282  return * fConfig ;
283 }
AlgMap * fOwnedSubAlgMp
local pool for owned sub-algs (taken out of the factory pool)
Definition: Algorithm.h:167
bool fOwnsSubstruc
true if it owns its substructure (sub-algs,...)
Definition: Algorithm.h:155
Algorithm abstract base class.
Definition: Algorithm.h:54
AlgId fID
algorithm name and configuration set
Definition: Algorithm.h:156
virtual const Registry & GetConfig(void) const
Definition: Algorithm.cxx:254
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
const XML_Char * prefix
Definition: expat.h:380
map< string, Algorithm * >::const_iterator AlgMapConstIter
Definition: Algorithm.h:51
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
vector< Registry * > fConfVect
Definition: Algorithm.h:161
string RgKey
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
TRandom3 r(0)
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
string Key(void) const
Definition: AlgId.h:47
#define pDEBUG
Definition: Messenger.h:64
virtual string genie::HNIntranuke2018::GetGenINukeMode ( ) const
inlinevirtual
virtual string genie::HNIntranuke2018::GetINukeMode ( ) const
inlinevirtual

Reimplemented from genie::Intranuke2018.

Definition at line 62 of file HNIntranuke2018.h.

62 {return "hN2018";};
Registry * Algorithm::GetOwnedConfig ( void  )
inherited

Returns the pointer of the summary registry, see previous method Gives access to the summary so it could be changed. The usage of this method is deprecated as it is mantained only for back compatibility. If you need to add or chage a parter (or more), use the AddTopRegistry() instead

Definition at line 287 of file Algorithm.cxx.

References GetConfig().

Referenced by genie::TransverseEnhancementFFModel::LoadConfig(), and genie::EffectiveSF::LoadConfig().

288 {
289 
290  GetConfig() ;
291  return fConfig;
292 }
virtual const Registry & GetConfig(void) const
Definition: Algorithm.cxx:254
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
template<class T >
bool genie::Algorithm::GetParam ( const RgKey name,
T p,
bool  is_top_call = true 
) const
protectedinherited

Ideal access to a parameter value from the vector of registries Returns true if the value is found and the parameters is set

Referenced by genie::CollinsSpillerFragm::BuildFunction(), genie::PetersonFragm::BuildFunction(), genie::INukeDeltaPropg::LoadConfig(), genie::COHXSec::LoadConfig(), genie::DISXSec::LoadConfig(), genie::HadronTransporter::LoadConfig(), genie::DFRKinematicsGenerator::LoadConfig(), genie::RSHelicityAmplModelNCn::LoadConfig(), genie::RSHelicityAmplModelNCp::LoadConfig(), genie::BaryonResonanceDecayer::LoadConfig(), genie::RESKinematicsGenerator::LoadConfig(), genie::DMDISXSec::LoadConfig(), genie::DipoleAxialFormFactorModel::LoadConfig(), genie::DipoleELFormFactorsModel::LoadConfig(), genie::COHKinematicsGenerator::LoadConfig(), genie::VertexGenerator::LoadConfig(), genie::H3AMNuGammaPXSec::LoadConfig(), genie::RSPPResonanceSelector::LoadConfig(), genie::IBDXSecMap::LoadConfig(), genie::Decayer::LoadConfig(), genie::DISHadronicSystemGenerator::LoadConfig(), genie::EmpiricalMECPXSec2015::LoadConfig(), genie::COHElasticPXSec::LoadConfig(), genie::KuzminNaumov2016AxialFormFactorModel::LoadConfig(), genie::SlowRsclCharmDISPXSecLO::LoadConfig(), genie::UnstableParticleDecayer::LoadConfig(), genie::AhrensNCELPXSec::LoadConfig(), genie::AlamSimoAtharVacasSKPXSec2014::LoadConfig(), genie::PythiaHadronization::LoadConfig(), genie::ReinDFRPXSec::LoadConfig(), genie::RosenbluthPXSec::LoadConfig(), genie::StrumiaVissaniIBDPXSec::LoadConfig(), genie::MECGenerator::LoadConfig(), genie::BYPDF::LoadConfig(), genie::QPMDISPXSec::LoadConfig(), genie::DFRXSec::LoadConfig(), genie::KNOPythiaHadronization::LoadConfig(), genie::P33PaschosLalakulichPXSec::LoadConfig(), genie::AhrensDMELPXSec::LoadConfig(), genie::MECXSec::LoadConfig(), genie::AivazisCharmPXSecLO::LoadConfig(), genie::BergerSehgalFMCOHPiPXSec2015::LoadConfig(), genie::ZExpAxialFormFactorModel::LoadConfig(), genie::QPMDMDISPXSec::LoadConfig(), genie::BergerSehgalCOHPiPXSec2015::LoadConfig(), genie::BBA03ELFormFactorsModel::LoadConfig(), genie::BBA05ELFormFactorsModel::LoadConfig(), genie::LwlynSmithQELCCPXSec::LoadConfig(), genie::ReinSehgalRESXSec::LoadConfig(), genie::PrimaryLeptonGenerator::LoadConfig(), genie::NuElectronPXSec::LoadConfig(), genie::ReinSehgalCOHPiPXSec::LoadConfig(), genie::PaisQELLambdaPXSec::LoadConfig(), genie::FGMBodekRitchie::LoadConfig(), genie::SpectralFunc1d::LoadConfig(), genie::OutgoingDarkGenerator::LoadConfig(), genie::ReinSehgalRESXSecFast::LoadConfig(), genie::CharmHadronization::LoadConfig(), genie::NievesSimoVacasMECPXSec2016::LoadConfig(), genie::LHAPDF6::LoadConfig(), genie::ReinSehgalSPPXSec::LoadConfig(), genie::EventGenerator::LoadConfig(), genie::NuclearModelMap::LoadConfig(), genie::ReinSehgalRESPXSec::LoadConfig(), genie::LwlynSmithFF::LoadConfig(), genie::QPMDISStrucFuncBase::LoadConfig(), genie::SmithMonizQELCCPXSec::LoadConfig(), genie::BBA07ELFormFactorsModel::LoadConfig(), genie::HAIntranuke::LoadConfig(), genie::NievesQELCCPXSec::LoadConfig(), genie::HAIntranuke2018::LoadConfig(), genie::LocalFGM::LoadConfig(), LoadConfig(), genie::BSKLNBaseRESPXSec2014::LoadConfig(), genie::EffectiveSF::LoadConfig(), genie::ReinSehgalSPPPXSec::LoadConfig(), genie::KNOHadronization::LoadConfig(), genie::SmithMonizUtils::LoadConfig(), genie::MECInteractionListGenerator::LoadConfigData(), genie::PhysInteractionSelector::LoadConfigData(), genie::RESInteractionListGenerator::LoadConfigData(), genie::PauliBlocker::LoadModelType(), genie::BYStrucFunc::ReadBYParams(), and genie::LHAPDF5::SetPDFSetFromConfig().

template<class T >
bool genie::Algorithm::GetParamDef ( const RgKey name,
T p,
const T def 
) const
protectedinherited

Ideal access to a parameter value from the vector of registries, With default value. Returns true if the value is set from the registries, false if the value is the default

Referenced by genie::IMDXSec::LoadConfig(), genie::COHXSec::LoadConfig(), genie::DISXSec::LoadConfig(), genie::RESXSec::LoadConfig(), genie::DFRKinematicsGenerator::LoadConfig(), genie::COHXSecAR::LoadConfig(), genie::NuEKinematicsGenerator::LoadConfig(), genie::QELXSec::LoadConfig(), genie::RESKinematicsGenerator::LoadConfig(), genie::DMDISXSec::LoadConfig(), genie::BaryonResonanceDecayer::LoadConfig(), genie::SKKinematicsGenerator::LoadConfig(), genie::COHElKinematicsGenerator::LoadConfig(), genie::COHKinematicsGenerator::LoadConfig(), genie::IBDKinematicsGenerator::LoadConfig(), genie::NuEInteractionListGenerator::LoadConfig(), genie::QELKinematicsGenerator::LoadConfig(), genie::DMELXSec::LoadConfig(), genie::DISHadronicSystemGenerator::LoadConfig(), genie::DISKinematicsGenerator::LoadConfig(), genie::NucBindEnergyAggregator::LoadConfig(), genie::DMELKinematicsGenerator::LoadConfig(), genie::DMDISKinematicsGenerator::LoadConfig(), genie::QPMDISPXSec::LoadConfig(), genie::DFRXSec::LoadConfig(), genie::P33PaschosLalakulichPXSec::LoadConfig(), genie::MECXSec::LoadConfig(), genie::FermiMover::LoadConfig(), genie::AlamSimoAtharVacasSKXSec::LoadConfig(), genie::AhrensDMELPXSec::LoadConfig(), genie::NuElectronXSec::LoadConfig(), genie::QELEventGenerator::LoadConfig(), genie::QPMDMDISPXSec::LoadConfig(), genie::LwlynSmithQELCCPXSec::LoadConfig(), genie::ReinSehgalRESXSec::LoadConfig(), genie::FGMBodekRitchie::LoadConfig(), genie::ReinSehgalRESXSecFast::LoadConfig(), genie::KovalenkoQELCharmPXSec::LoadConfig(), genie::SmithMonizQELCCXSec::LoadConfig(), genie::ReinSehgalSPPXSec::LoadConfig(), genie::ReinSehgalRESPXSec::LoadConfig(), genie::QELEventGeneratorSM::LoadConfig(), genie::QPMDISStrucFuncBase::LoadConfig(), genie::SmithMonizQELCCPXSec::LoadConfig(), genie::NievesQELCCPXSec::LoadConfig(), genie::HAIntranuke::LoadConfig(), genie::LocalFGM::LoadConfig(), LoadConfig(), genie::HAIntranuke2018::LoadConfig(), genie::BSKLNBaseRESPXSec2014::LoadConfig(), genie::EffectiveSF::LoadConfig(), genie::KNOHadronization::LoadConfig(), genie::NewQELXSec::LoadConfig(), genie::DFRInteractionListGenerator::LoadConfigData(), genie::MECInteractionListGenerator::LoadConfigData(), genie::QELInteractionListGenerator::LoadConfigData(), genie::SKInteractionListGenerator::LoadConfigData(), genie::COHInteractionListGenerator::LoadConfigData(), genie::RESInteractionListGenerator::LoadConfigData(), genie::DMELInteractionListGenerator::LoadConfigData(), genie::RSPPInteractionListGenerator::LoadConfigData(), genie::DISInteractionListGenerator::LoadConfigData(), and genie::DMDISInteractionListGenerator::LoadConfigData().

template<class T >
bool genie::Algorithm::GetParamVect ( const std::string comm_name,
std::vector< T > &  v,
unsigned int  max,
bool  is_top_call = true 
) const
protectedinherited

Handle to load vectors of parameters It looks for different registry item with name comm_name0, comm_name1, etc...

virtual AlgStatus_t genie::Algorithm::GetStatus ( void  ) const
inlinevirtualinherited

Get algorithm status.

Definition at line 101 of file Algorithm.h.

References genie::Algorithm::fStatus.

101 { return fStatus; }
AlgStatus_t fStatus
algorithm execution status
Definition: Algorithm.h:166
INukeFateHN_t HNIntranuke2018::HadronFateHN ( const GHepParticle p) const
private

Definition at line 208 of file HNIntranuke2018.cxx.

References genie::INukeHadroFates::AsString(), FateWeight(), genie::Intranuke2018::fHadroData2018, genie::Intranuke2018::fNucAbsFac, genie::Intranuke2018::fNucCEXFac, fNucQEFac, genie::INukeHadroData2018::Frac(), genie::Intranuke2018::fRemnA, genie::Intranuke2018::fRemnZ, genie::Intranuke2018::fUseOset, HadronFateOset(), genie::RandomGen::Instance(), genie::kIHNFtAbs, genie::kIHNFtCEx, genie::kIHNFtCmp, genie::kIHNFtElas, genie::kIHNFtInelas, genie::kIHNFtUndefined, genie::GHepParticle::KinE(), genie::kPdgGamma, genie::kPdgKP, genie::kPdgNeutron, genie::kPdgPi0, genie::kPdgPiM, genie::kPdgPiP, genie::kPdgProton, genie::controls::kRjMaxIterations, LOG, genie::units::MeV, genie::GHepParticle::Name(), pDEBUG, genie::GHepParticle::Pdg(), pINFO, pNOTICE, pWARN, r(), generate_hists::rnd, and genie::RandomGen::RndFsi().

Referenced by GetGenINukeMode(), and SimulateHadronicFinalState().

209 {
210 // Select a hadron fate in HN mode
211 //
213 
214  // get pdgc code & kinetic energy in MeV
215  int pdgc = p->Pdg();
216  double ke = p->KinE() / units::MeV;
217 
218  bool isPion = (pdgc == kPdgPiP or pdgc == kPdgPi0 or pdgc == kPdgPiM);
219 
220  if (isPion and fUseOset and ke < 350.0) return HadronFateOset ();
221 
222  LOG("HNIntranuke2018", pNOTICE)
223  << "Selecting hN fate for " << p->Name() << " with KE = " << ke << " MeV";
224 
225  // try to generate a hadron fate
226  unsigned int iter = 0;
227  while(iter++ < kRjMaxIterations) {
228 
229  // handle pions
230  //
231  if (pdgc==kPdgPiP || pdgc==kPdgPiM || pdgc==kPdgPi0) {
232 
233  double frac_cex = this->FateWeight(pdgc, kIHNFtCEx)
234  * fHadroData2018->Frac(pdgc, kIHNFtCEx, ke, fRemnA, fRemnZ);
235  double frac_elas = this->FateWeight(pdgc, kIHNFtElas)
236  * fHadroData2018->Frac(pdgc, kIHNFtElas, ke, fRemnA, fRemnZ);
237  double frac_inel = this->FateWeight(pdgc, kIHNFtInelas)
238  * fHadroData2018->Frac(pdgc, kIHNFtInelas, ke, fRemnA, fRemnZ);
239  double frac_abs = this->FateWeight(pdgc, kIHNFtAbs)
240  * fHadroData2018->Frac(pdgc, kIHNFtAbs, ke, fRemnA, fRemnZ);
241 
242  frac_cex *= fNucCEXFac; // scaling factors
243  frac_abs *= fNucAbsFac;
244  frac_elas *= fNucQEFac;
245  if(pdgc==kPdgPi0) frac_abs*= 0.665; //isospin factor
246 
247  LOG("HNIntranuke2018", pNOTICE)
248  << "\n frac{" << INukeHadroFates::AsString(kIHNFtCEx) << "} = " << frac_cex
249  << "\n frac{" << INukeHadroFates::AsString(kIHNFtElas) << "} = " << frac_elas
250  << "\n frac{" << INukeHadroFates::AsString(kIHNFtInelas) << "} = " << frac_inel
251  << "\n frac{" << INukeHadroFates::AsString(kIHNFtAbs) << "} = " << frac_abs;
252 
253  // compute total fraction (can be <1 if fates have been switched off)
254  double tf = frac_cex +
255  frac_elas +
256  frac_inel +
257  frac_abs;
258 
259  double r = tf * rnd->RndFsi().Rndm();
260 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
261  LOG("HNIntranuke2018", pDEBUG) << "r = " << r << " (max = " << tf << ")";
262 #endif
263 
264  double cf=0; // current fraction
265 
266  if(r < (cf += frac_cex )) return kIHNFtCEx; //cex
267  if(r < (cf += frac_elas )) return kIHNFtElas; //elas
268  if(r < (cf += frac_inel )) return kIHNFtInelas; //inelas
269  if(r < (cf += frac_abs )) return kIHNFtAbs; //abs
270 
271  LOG("HNIntranuke2018", pWARN)
272  << "No selection after going through all fates! "
273  << "Total fraction = " << tf << " (r = " << r << ")";
274  ////////////////////////////
275  return kIHNFtUndefined;
276  }
277 
278  // handle nucleons
279  else if (pdgc==kPdgProton || pdgc==kPdgNeutron) {
280 
281  double frac_elas = this->FateWeight(pdgc, kIHNFtElas)
282  * fHadroData2018->Frac(pdgc, kIHNFtElas, ke, fRemnA, fRemnZ);
283  double frac_inel = this->FateWeight(pdgc, kIHNFtInelas)
284  * fHadroData2018->Frac(pdgc, kIHNFtInelas, ke, fRemnA, fRemnZ);
285  double frac_cmp = this->FateWeight(pdgc, kIHNFtCmp)
286  * fHadroData2018->Frac(pdgc, kIHNFtCmp, ke, fRemnA , fRemnZ);
287 
288  LOG("HNIntranuke2018", pINFO)
289  << "\n frac{" << INukeHadroFates::AsString(kIHNFtElas) << "} = " << frac_elas
290  << "\n frac{" << INukeHadroFates::AsString(kIHNFtInelas) << "} = " << frac_inel;
291 
292  // compute total fraction (can be <1 if fates have been switched off)
293  double tf = frac_elas +
294  frac_inel +
295  frac_cmp;
296 
297  double r = tf * rnd->RndFsi().Rndm();
298 
299 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
300  LOG("HNIntranuke2018", pDEBUG) << "r = " << r << " (max = " << tf << ")";
301 #endif
302 
303  double cf=0; // current fraction
304  if(r < (cf += frac_elas )) return kIHNFtElas; // elas
305  if(r < (cf += frac_inel )) return kIHNFtInelas; // inelas
306  if(r < (cf += frac_cmp )) return kIHNFtCmp; // cmp
307 
308  LOG("HNIntranuke2018", pWARN)
309  << "No selection after going through all fates! "
310  << "Total fraction = " << tf << " (r = " << r << ")";
311  //////////////////////////
312  return kIHNFtUndefined;
313  }
314 
315  // handle gamma -- does not currently consider the elastic case
316  else if (pdgc==kPdgGamma) return kIHNFtInelas;
317  // Handle kaon -- elastic + charge exchange
318  else if (pdgc==kPdgKP){
319  double frac_cex = this->FateWeight(pdgc, kIHNFtCEx)
320  * fHadroData2018->Frac(pdgc, kIHNFtCEx, ke, fRemnA, fRemnZ);
321  double frac_elas = this->FateWeight(pdgc, kIHNFtElas)
322  * fHadroData2018->Frac(pdgc, kIHNFtElas, ke, fRemnA, fRemnZ);
323 
324  // frac_cex *= fNucCEXFac; // scaling factors
325  // frac_elas *= fNucQEFac; // Flor - Correct scaling factors?
326 
327  LOG("HNIntranuke", pINFO)
328  << "\n frac{" << INukeHadroFates::AsString(kIHNFtCEx) << "} = " << frac_cex
329  << "\n frac{" << INukeHadroFates::AsString(kIHNFtElas) << "} = " << frac_elas;
330 
331  // compute total fraction (can be <1 if fates have been switched off)
332  double tf = frac_cex +
333  frac_elas;
334 
335  double r = tf * rnd->RndFsi().Rndm();
336 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
337  LOG("HNIntranuke", pDEBUG) << "r = " << r << " (max = " << tf << ")";
338 #endif
339 
340  double cf=0; // current fraction
341 
342  if(r < (cf += frac_cex )) return kIHNFtCEx; //cex
343  if(r < (cf += frac_elas )) return kIHNFtElas; //elas
344 
345  LOG("HNIntranuke", pWARN)
346  << "No selection after going through all fates! "
347  << "Total fraction = " << tf << " (r = " << r << ")";
348  ////////////////////////////
349  return kIHNFtUndefined;
350  }//End K+
351 
352  /*else if (pdgc==kPdgKM){
353 
354  return kIHNFtElas;
355  }//End K-*/
356 
357  }//iterations
358 
359  return kIHNFtUndefined;
360 }
TRandom3 & RndFsi(void) const
rnd number generator used by intranuclear cascade monte carlos
Definition: RandomGen.h:60
double Frac(int hpdgc, INukeFateHN_t fate, double ke, int targA=0, int targZ=0) const
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
static const double MeV
Definition: Units.h:130
int fRemnA
remnant nucleus A
Definition: Intranuke2018.h:99
double FateWeight(int pdgc, INukeFateHN_t fate) const
Timing fit.
double fNucAbsFac
absorption xsec correction factor (hN Mode)
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
int Pdg(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:97
const int kPdgGamma
Definition: PDGCodes.h:166
const int kPdgKP
Definition: PDGCodes.h:149
INukeFateHN_t HadronFateOset() const
const int kPdgPiP
Definition: PDGCodes.h:135
const int kPdgPi0
Definition: PDGCodes.h:137
#define pINFO
Definition: Messenger.h:63
double fNucCEXFac
charge exchange xsec correction factor (hN Mode)
#define pWARN
Definition: Messenger.h:61
double KinE(bool mass_from_pdg=false) const
Get kinetic energy.
static string AsString(INukeFateHN_t fate)
INukeHadroData2018 * fHadroData2018
a collection of h+N,h+A data & calculations
Definition: Intranuke2018.h:96
TRandom3 r(0)
const int kPdgPiM
Definition: PDGCodes.h:136
const int kPdgProton
Definition: PDGCodes.h:65
#define pNOTICE
Definition: Messenger.h:62
static const unsigned int kRjMaxIterations
Definition: Controls.h:27
const int kPdgNeutron
Definition: PDGCodes.h:67
bool fUseOset
Oset model for low energy pion in hN.
int fRemnZ
remnant nucleus Z
#define pDEBUG
Definition: Messenger.h:64
INukeFateHN_t HNIntranuke2018::HadronFateOset ( ) const
private

Definition at line 1003 of file HNIntranuke2018.cxx.

References osetUtils::currentInstance, INukeOset::getCexFraction(), genie::RandomGen::Instance(), genie::kIHNFtAbs, genie::kIHNFtCEx, genie::kIHNFtElas, and genie::RandomGen::RndFsi().

Referenced by GetGenINukeMode(), and HadronFateHN().

1004 {
1005  //LOG("HNIntranuke2018", pWARN) << "IN HadronFateOset";
1006 
1007  //LOG("HNIntranuke2018", pWARN) << "{ frac abs = " << osetUtils::currentInstance->getAbsorptionFraction();
1008  //LOG("HNIntranuke2018", pWARN) << " frac cex = " << osetUtils::currentInstance->getCexFraction() << " }";
1009 
1010  const double fractionAbsorption = osetUtils::currentInstance->
1011  getAbsorptionFraction();
1012  const double fractionCex = osetUtils::currentInstance->getCexFraction ();
1013 
1014  RandomGen *randomGenerator = RandomGen::Instance();
1015  const double randomNumber = randomGenerator->RndFsi().Rndm();
1016 
1017  //LOG("HNIntranuke2018", pWARN) << "{ frac abs = " << fractionAbsorption;
1018  //LOG("HNIntranuke2018", pWARN) << " frac cex = " << fractionCex;
1019  //LOG("HNIntranuke2018", pWARN) << " frac elas = " << 1-fractionAbsorption-fractionCex << " }";
1020 
1021  if (randomNumber < fractionAbsorption && fRemnA > 1) return kIHNFtAbs;
1022  else if (randomNumber < fractionAbsorption + fractionCex) return kIHNFtCEx;
1023  else return kIHNFtElas;
1024 }
TRandom3 & RndFsi(void) const
rnd number generator used by intranuclear cascade monte carlos
Definition: RandomGen.h:60
INukeOset * currentInstance
Definition: INukeOset.cxx:5
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
double getCexFraction() const
return fraction of cex events
Definition: INukeOset.h:53
int HNIntranuke2018::HandleCompoundNucleus ( GHepRecord ev,
GHepParticle p,
int  mom 
) const
privatevirtual

Implements genie::Intranuke2018.

Definition at line 905 of file HNIntranuke2018.cxx.

References genie::GHepRecord::AddParticle(), genie::utils::intranuke2018::Equilibrium(), genie::Intranuke2018::fDoCompoundNucleus, genie::Intranuke2018::fDoFermi, genie::Intranuke2018::fEPreEq, genie::Intranuke2018::fFermiFac, genie::Intranuke2018::fNuclmodel, genie::Intranuke2018::fNucRmvE, genie::Intranuke2018::fRemnA, genie::Intranuke2018::fRemnP4, genie::Intranuke2018::fRemnZ, genie::Intranuke2018::IsInNucleus(), genie::pdg::IsNeutronOrProton(), genie::kIMdHN, genie::GHepParticle::KinE(), genie::kIStStableFinalState, LOG, genie::GHepParticle::Pdg(), pNOTICE, genie::GHepParticle::SetFirstMother(), and genie::GHepParticle::SetStatus().

Referenced by GetGenINukeMode(), and HandleCompoundNucleusHN().

906 {
907 
908  // handle compound nucleus option
909  // -- Call the PreEquilibrium function
911  { // random number generator
912  //unused var - quiet compiler warning//RandomGen * rnd = RandomGen::Instance();
913 
914  if((p->KinE() < fEPreEq) )
915  {
916  if(fRemnA>4) //this needs to be matched to what is in PreEq and Eq
917  {
918  GHepParticle * sp = new GHepParticle(*p);
919  sp->SetFirstMother(mom);
920  // this was PreEquilibrium - now just used for hN
921  //same arguement lists for PreEq and Eq
924 
925  delete sp;
926  return 2;
927  }
928  else
929  {
930  // nothing left to interact with!
931  LOG("HNIntranuke2018", pNOTICE)
932  << "*** Nothing left to interact with, escaping.";
933  GHepParticle * sp = new GHepParticle(*p);
934  sp->SetFirstMother(mom);
936  ev->AddParticle(*sp);
937  delete sp;
938  return 1;
939  }
940  }
941  }
942  return 0;
943 }
void SetFirstMother(int m)
Definition: GHepParticle.h:133
double fEPreEq
threshold for pre-equilibrium reaction
double fFermiFac
testing parameter to modify fermi momentum
int fRemnA
remnant nucleus A
Definition: Intranuke2018.h:99
bool IsInNucleus(const GHepParticle *p) const
const NuclearModelI * fNuclmodel
nuclear model used to generate fermi momentum
Definition: Intranuke2018.h:98
int Pdg(void) const
Definition: GHepParticle.h:64
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
bool fDoFermi
whether or not to do fermi mom.
void Equilibrium(GHepRecord *ev, GHepParticle *p, int &RemnA, int &RemnZ, TLorentzVector &RemnP4, bool DoFermi, double FermiFac, const NuclearModelI *Nuclmodel, double NucRmvE, EINukeMode mode=kIMdHN)
bool fDoCompoundNucleus
whether or not to do compound nucleus considerations
double KinE(bool mass_from_pdg=false) const
Get kinetic energy.
void SetStatus(GHepStatus_t s)
Definition: GHepParticle.h:127
bool IsNeutronOrProton(int pdgc)
Definition: PDGUtils.cxx:314
virtual void AddParticle(const GHepParticle &p)
Definition: GHepRecord.cxx:535
#define pNOTICE
Definition: Messenger.h:62
double fNucRmvE
binding energy to subtract from cascade nucleons
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
int fRemnZ
remnant nucleus Z
TLorentzVector fRemnP4
P4 of remnant system.
bool HNIntranuke2018::HandleCompoundNucleusHN ( GHepRecord ev,
GHepParticle p 
) const
private

Definition at line 945 of file HNIntranuke2018.cxx.

References genie::GHepParticle::FirstMother(), and HandleCompoundNucleus().

Referenced by GetGenINukeMode().

946 {
947  return (this->HandleCompoundNucleus(ev,p,p->FirstMother())==2);
948 }
int FirstMother(void) const
Definition: GHepParticle.h:67
int HandleCompoundNucleus(GHepRecord *ev, GHepParticle *p, int mom) const
virtual const AlgId& genie::Algorithm::Id ( void  ) const
inlinevirtualinherited

Get algorithm ID.

Definition at line 98 of file Algorithm.h.

References genie::Algorithm::fID.

Referenced by genie::KineGeneratorWithCache::AccessCacheBranch(), genie::QELEventGeneratorSM::AccessCacheBranch2(), genie::QELEventGeneratorSM::AccessCacheBranchDiffv(), genie::InteractionListAssembler::AssembleInteractionList(), genie::XSecAlgorithmMap::BuildMap(), genie::InteractionGeneratorMap::BuildMap(), genie::XSecSplineList::BuildSplineKey(), genie::DISXSec::CacheBranchName(), genie::ReinSehgalRESXSecWithCache::CacheBranchName(), genie::DMDISXSec::CacheBranchName(), genie::ReinSehgalRESXSecWithCacheFast::CacheBranchName(), genie::Algorithm::Compare(), genie::RESKinematicsGenerator::ComputeMaxXSec(), genie::COHElKinematicsGenerator::ComputeMaxXSec(), genie::SKKinematicsGenerator::ComputeMaxXSec(), genie::COHKinematicsGenerator::ComputeMaxXSec(), genie::Algorithm::Configure(), genie::GEVGDriver::CreateSplines(), genie::QPMDISPXSec::DISRESJoinSuppressionFactor(), genie::QPMDMDISPXSec::DMDISRESJoinSuppressionFactor(), genie::AlgConfigPool::FindRegistry(), genie::AlgFactory::ForceReconfiguration(), genie::GEVGDriver::GenerateEvent(), GetAlgorithms(), genie::LwlynSmithQELCCPXSec::Integral(), genie::NievesQELCCPXSec::Integral(), genie::COHXSec::Integrate(), genie::QPMDISPXSec::LoadConfig(), genie::QPMDMDISPXSec::LoadConfig(), genie::EventGenerator::LoadConfig(), genie::EventGeneratorListAssembler::LoadGenerator(), main(), genie::COHKinematicsGenerator::MaxXSec_AlvarezRuso(), genie::XSecAlgorithmMap::Print(), genie::InteractionGeneratorMap::Print(), genie::AlgFactory::Print(), genie::COHHadronicSystemGenerator::ProcessEventRecord(), genie::COHPrimaryLeptonGenerator::ProcessEventRecord(), genie::COHKinematicsGenerator::ProcessEventRecord(), genie::MECGenerator::ProcessEventRecord(), genie::EventGenerator::ProcessEventRecord(), genie::KNOPythiaHadronization::SelectHadronizer(), TestPythiaTauDecays(), and genie::GEVGDriver::UseSplines().

98 { return fID; }
AlgId fID
algorithm name and configuration set
Definition: Algorithm.h:156
void HNIntranuke2018::InelasticHN ( GHepRecord ev,
GHepParticle p 
) const
private

Definition at line 768 of file HNIntranuke2018.cxx.

References genie::GHepRecord::AddParticle(), genie::Intranuke2018::fDoFermi, genie::Intranuke2018::fFermiFac, genie::Intranuke2018::fFermiMomentum, genie::Intranuke2018::fNuclmodel, genie::Intranuke2018::fRemnA, genie::Intranuke2018::fRemnP4, genie::Intranuke2018::fRemnZ, genie::kIStHadronInTheNucleus, LOG, genie::utils::intranuke2018::PionProduction(), pNOTICE, genie::exceptions::INukeException::SetReason(), and genie::GHepParticle::SetStatus().

Referenced by GetGenINukeMode(), and SimulateHadronicFinalState().

769 {
770  // Aaron Meyer (Jan 2010)
771  // Updated version of InelasticHN
772 
773  GHepParticle s1(*p);
774  GHepParticle s2(*p);
775  GHepParticle s3(*p);
776 
777 
779  {
780  // set status of particles and return
781 
782  s1.SetStatus(kIStHadronInTheNucleus);
783  s2.SetStatus(kIStHadronInTheNucleus);
784  s3.SetStatus(kIStHadronInTheNucleus);
785 
786  ev->AddParticle(s1);
787  ev->AddParticle(s2);
788  ev->AddParticle(s3);
789  }
790  else
791  {
792  LOG("HNIntranuke2018", pNOTICE) << "Error: could not create pion production final state";
794  exception.SetReason("PionProduction in hN failed");
795  throw exception;
796  }
797  return;
798 
799 }
An exception thrown by SimulateHadronState for kinematics problems. TwoBodyCollision/Kinematics used ...
double fFermiMomentum
whether or not particle collision is pauli blocked
double fFermiFac
testing parameter to modify fermi momentum
int fRemnA
remnant nucleus A
Definition: Intranuke2018.h:99
bool PionProduction(GHepRecord *ev, GHepParticle *p, GHepParticle *s1, GHepParticle *s2, GHepParticle *s3, int &RemnA, int &RemnZ, TLorentzVector &RemnP4, bool DoFermi, double FermiFac, double FermiMomentum, const NuclearModelI *Nuclmodel)
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
const NuclearModelI * fNuclmodel
nuclear model used to generate fermi momentum
Definition: Intranuke2018.h:98
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
bool fDoFermi
whether or not to do fermi mom.
virtual void AddParticle(const GHepParticle &p)
Definition: GHepRecord.cxx:535
#define pNOTICE
Definition: Messenger.h:62
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
int fRemnZ
remnant nucleus Z
TLorentzVector fRemnP4
P4 of remnant system.
void Algorithm::Initialize ( void  )
protectedinherited

Definition at line 343 of file Algorithm.cxx.

Referenced by genie::Algorithm::AllowReconfig().

344 {
345 // Algorithm initialization
346 //
347  fAllowReconfig = true;
348  fOwnsSubstruc = false;
349  fConfig = 0;
350  fOwnedSubAlgMp = 0;
351 }
AlgMap * fOwnedSubAlgMp
local pool for owned sub-algs (taken out of the factory pool)
Definition: Algorithm.h:167
bool fOwnsSubstruc
true if it owns its substructure (sub-algs,...)
Definition: Algorithm.h:155
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
bool Intranuke2018::IsInNucleus ( const GHepParticle p) const
protectedinherited

Definition at line 253 of file Intranuke2018.cxx.

References genie::Intranuke2018::fHadStep, genie::Intranuke2018::fTrackingRadius, and genie::GHepParticle::X4().

Referenced by genie::Intranuke2018::GetGenINukeMode(), HandleCompoundNucleus(), and genie::Intranuke2018::TransportHadrons().

254 {
255 // check whether the input particle is still within the nucleus
256 //
257  return (p->X4()->Vect().Mag() < fTrackingRadius + fHadStep);
258 }
const TLorentzVector * X4(void) const
Definition: GHepParticle.h:80
double fHadStep
step size for intranuclear hadron transport
double fTrackingRadius
tracking radius for the nucleus in the current event
Definition: Intranuke2018.h:94
void HNIntranuke2018::LoadConfig ( void  )
privatevirtual

Implements genie::Intranuke2018.

Definition at line 951 of file HNIntranuke2018.cxx.

References genie::INukeMode::AsString(), genie::Intranuke2018::fAltOset, genie::Intranuke2018::fDelRNucleon, genie::Intranuke2018::fDelRPion, genie::Intranuke2018::fDoCompoundNucleus, genie::Intranuke2018::fDoFermi, genie::Intranuke2018::fEPreEq, genie::Intranuke2018::fFermiFac, genie::Intranuke2018::fFermiMomentum, genie::Intranuke2018::fHadroData2018, genie::Intranuke2018::fHadStep, genie::Intranuke2018::fNR, genie::Intranuke2018::fNucAbsFac, genie::Intranuke2018::fNucCEXFac, genie::Intranuke2018::fNuclmodel, fNucQEFac, genie::Intranuke2018::fNucRmvE, genie::Intranuke2018::fR0, genie::Intranuke2018::fUseOset, genie::Intranuke2018::fXsecNNCorr, genie::Algorithm::GetParam(), genie::Algorithm::GetParamDef(), genie::INukeHadroData2018::Instance(), genie::kIMdHN, LOG, pINFO, pWARN, and genie::Algorithm::SubAlg().

Referenced by GetGenINukeMode().

952 {
953  // load hadronic cross sections
955 
956  // fermi momentum setup
957  // this is specifically set in Intranuke2018::Configure(string)
958  fNuclmodel = dynamic_cast<const NuclearModelI *>( this -> SubAlg("NuclearModel") ) ;
959 
960  // other intranuke config params
961  GetParam( "NUCL-R0", fR0 ); // fm
962  GetParam( "NUCL-NR", fNR );
963 
964  GetParam( "INUKE-NucRemovalE", fNucRmvE ); // GeV
965  GetParam( "INUKE-HadStep", fHadStep ) ;
966  GetParam( "INUKE-NucAbsFac", fNucAbsFac ) ;
967  GetParam( "INUKE-NucQEFac", fNucQEFac ) ;
968  GetParam( "INUKE-NucCEXFac", fNucCEXFac ) ;
969  GetParam( "INUKE-Energy_Pre_Eq", fEPreEq ) ;
970  GetParam( "INUKE-FermiFac", fFermiFac ) ;
971  GetParam( "INUKE-FermiMomentum", fFermiMomentum ) ;
972 
973  GetParam( "INUKE-DoCompoundNucleus", fDoCompoundNucleus ) ;
974  GetParam( "INUKE-DoFermi", fDoFermi ) ;
975  GetParam( "INUKE-XsecNNCorr", fXsecNNCorr ) ;
976  GetParamDef( "AltOset", fAltOset, false ) ;
977 
978  GetParam( "HNINUKE-UseOset", fUseOset ) ;
979  GetParam( "HNINUKE-DelRPion", fDelRPion ) ;
980  GetParam( "HNINUKE-DelRNucleon", fDelRNucleon ) ;
981 
982  // report
983  LOG("HNIntranuke2018", pINFO) << "Settings for Intranuke2018 mode: " << INukeMode::AsString(kIMdHN);
984  LOG("HNIntranuke2018", pWARN) << "R0 = " << fR0 << " fermi";
985  LOG("HNIntranuke2018", pWARN) << "NR = " << fNR;
986  LOG("HNIntranuke2018", pWARN) << "DelRPion = " << fDelRPion;
987  LOG("HNIntranuke2018", pWARN) << "DelRNucleon = " << fDelRNucleon;
988  LOG("HNIntranuke2018", pWARN) << "HadStep = " << fHadStep << " fermi";
989  LOG("HNIntranuke2018", pWARN) << "NucAbsFac = " << fNucAbsFac;
990  LOG("HNIntranuke2018", pWARN) << "NucQEFac = " << fNucQEFac;
991  LOG("HNIntranuke2018", pWARN) << "NucCEXFac = " << fNucCEXFac;
992  LOG("HNIntranuke2018", pWARN) << "EPreEq = " << fEPreEq;
993  LOG("HNIntranuke2018", pWARN) << "FermiFac = " << fFermiFac;
994  LOG("HNIntranuke2018", pWARN) << "FermiMomtm = " << fFermiMomentum;
995  LOG("HNIntranuke2018", pWARN) << "DoFermi? = " << ((fDoFermi)?(true):(false));
996  LOG("HNIntranuke2018", pWARN) << "DoCmpndNuc? = " << ((fDoCompoundNucleus)?(true):(false));
997  LOG("HNIntranuke2018", pWARN) << "useOset = " << fUseOset;
998  LOG("HNIntranuke2018", pWARN) << "altOset = " << fAltOset;
999  LOG("HNIntranuke2018", pWARN) << "XsecNNCorr? = " << ((fXsecNNCorr)?(true):(false));
1000 }
static string AsString(INukeMode_t mode)
Definition: INukeMode.h:41
double fFermiMomentum
whether or not particle collision is pauli blocked
double fDelRPion
factor by which Pion Compton wavelength gets multiplied to become nuclear size enhancement ...
double fEPreEq
threshold for pre-equilibrium reaction
double fNR
param multiplying the nuclear radius, determining how far to track hadrons beyond the "nuclear bounda...
double fFermiFac
testing parameter to modify fermi momentum
Pure abstract base class. Defines the NuclearModelI interface to be implemented by any physics model ...
Definition: NuclearModelI.h:42
bool fXsecNNCorr
use nuclear medium correction for NN cross section
double fNucAbsFac
absorption xsec correction factor (hN Mode)
const NuclearModelI * fNuclmodel
nuclear model used to generate fermi momentum
Definition: Intranuke2018.h:98
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
bool fDoFermi
whether or not to do fermi mom.
#define pINFO
Definition: Messenger.h:63
double fNucCEXFac
charge exchange xsec correction factor (hN Mode)
double fR0
effective nuclear size param
#define pWARN
Definition: Messenger.h:61
bool fDoCompoundNucleus
whether or not to do compound nucleus considerations
static INukeHadroData2018 * Instance(void)
bool fAltOset
NuWro&#39;s table-based implementation (not recommended)
INukeHadroData2018 * fHadroData2018
a collection of h+N,h+A data & calculations
Definition: Intranuke2018.h:96
double fDelRNucleon
factor by which Nucleon Compton wavelength gets multiplied to become nuclear size enhancement ...
double fHadStep
step size for intranuclear hadron transport
bool GetParamDef(const RgKey &name, T &p, const T &def) const
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
double fNucRmvE
binding energy to subtract from cascade nucleons
bool fUseOset
Oset model for low energy pion in hN.
const Algorithm * SubAlg(const RgKey &registry_key) const
Definition: Algorithm.cxx:353
int Algorithm::MergeTopRegistry ( const Registry r)
protectedinherited

Merge with top level registry if first reg of the vector is owned Otherwise an owned copy is added as a top registry

Definition at line 618 of file Algorithm.cxx.

618  {
619 
620  if ( fOwnerships.empty() ) {
621 
622  // this algorithm is not configured right now, the incoming registry is the only configuration
623  Registry * p = new Registry( r ) ;
624  AddTopRegistry( p ) ;
625 
626  return 1 ;
627  }
628 
629  if ( fOwnerships[0] ) {
630  //the top registry is owned: it can be changed with no consequences for other algorithms
631  fConfVect[0] -> Merge( r ) ;
632  }
633  else {
634  // The top registry is not owned so it cannot be changed
635  // The registry will be added with top priority
636 
637  Registry * p = new Registry( r ) ;
638  AddTopRegistry( p ) ;
639  }
640 
641  // The configuration has changed so the summary is not updated anymore and must be deleted
642  if ( fConfig ) {
643  delete fConfig ;
644  fConfig = 0 ;
645  }
646 
647  return fConfVect.size() ;
648 }
const char * p
Definition: xmltok.h:285
int AddTopRegistry(Registry *rp, bool owns=true)
add registry with top priority, also update ownership
Definition: Algorithm.cxx:585
vector< Registry * > fConfVect
Definition: Algorithm.h:161
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
vector< bool > fOwnerships
ownership for every registry in fConfVect
Definition: Algorithm.h:164
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
bool Intranuke2018::NeedsRescattering ( const GHepParticle p) const
protectedinherited

Definition at line 217 of file Intranuke2018.cxx.

References ana::assert(), genie::Intranuke2018::fGMode, genie::pdg::IsIon(), genie::kGMdHadronNucleus, genie::kGMdPhotonNucleus, genie::kIStHadronInTheNucleus, genie::kIStInitialState, genie::GHepParticle::Pdg(), and genie::GHepParticle::Status().

Referenced by genie::Intranuke2018::GetGenINukeMode(), and genie::Intranuke2018::TransportHadrons().

218 {
219 // checks whether the particle should be rescattered
220 
221  assert(p);
222 
223  if(fGMode == kGMdHadronNucleus ||
225  // hadron/photon-nucleus scattering propagate the incoming particle
226  return (
228  && !pdg::IsIon(p->Pdg()));
229  }
230  else {
231  // attempt to rescatter anything marked as 'hadron in the nucleus'
232  return (p->Status() == kIStHadronInTheNucleus);
233  }
234 }
GHepStatus_t Status(void) const
Definition: GHepParticle.h:65
GEvGenMode_t fGMode
event generation mode (lepton+A, hadron+A, ...)
int Pdg(void) const
Definition: GHepParticle.h:64
bool IsIon(int pdgc)
Definition: PDGUtils.cxx:40
assert(nhit_max >=nhit_nbins)
void Algorithm::Print ( ostream &  stream) const
virtualinherited

Print algorithm info.

Definition at line 323 of file Algorithm.cxx.

References GetConfig(), and r().

Referenced by genie::Algorithm::AllowReconfig(), and genie::operator<<().

324 {
325  // print algorithm name & parameter-set
326  stream << "\nAlgorithm Key: " << this->fID.Key();
327  stream << " - Owns Substruc: " << ((fOwnsSubstruc) ? "[true]" : "[false]");
328 
329  // print algorithm configuration
330  const Registry & r = this->GetConfig();
331  stream << r;
332 
333  if(fOwnsSubstruc) {
334  AlgMapConstIter iter = fOwnedSubAlgMp->begin();
335  for(; iter!=fOwnedSubAlgMp->end(); ++iter) {
336  Algorithm * alg = iter->second;
337  stream << "<Next algorithm is owned by : " << this->fID.Key() << ">";
338  stream << *alg;
339  }
340  }
341 }
AlgMap * fOwnedSubAlgMp
local pool for owned sub-algs (taken out of the factory pool)
Definition: Algorithm.h:167
bool fOwnsSubstruc
true if it owns its substructure (sub-algs,...)
Definition: Algorithm.h:155
Algorithm abstract base class.
Definition: Algorithm.h:54
AlgId fID
algorithm name and configuration set
Definition: Algorithm.h:156
virtual const Registry & GetConfig(void) const
Definition: Algorithm.cxx:254
map< string, Algorithm * >::const_iterator AlgMapConstIter
Definition: Algorithm.h:51
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
TRandom3 r(0)
string Key(void) const
Definition: AlgId.h:47
void HNIntranuke2018::ProcessEventRecord ( GHepRecord event_rec) const
virtual

Reimplemented from genie::Intranuke2018.

Definition at line 113 of file HNIntranuke2018.cxx.

References LOG, pINFO, pNOTICE, and genie::Intranuke2018::ProcessEventRecord().

114 {
115  LOG("HNIntranuke2018", pNOTICE)
116  << "************ Running hN2018 MODE INTRANUKE ************";
117 
118  /* LOG("HNIntranuke2018", pWARN)
119  << print::PrintFramedMesg(
120  "Experimental code (INTRANUKE/hN model) - Run at your own risk");
121  */
122 
124 
125  LOG("HNIntranuke2018", pINFO) << "Done with this event";
126 }
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pINFO
Definition: Messenger.h:63
virtual void ProcessEventRecord(GHepRecord *event_rec) const
#define pNOTICE
Definition: Messenger.h:62
void Algorithm::SetId ( const AlgId id)
virtualinherited

Set algorithm ID.

Definition at line 313 of file Algorithm.cxx.

Referenced by genie::Algorithm::AllowReconfig().

314 {
315  fID.Copy(id);
316 }
AlgId fID
algorithm name and configuration set
Definition: Algorithm.h:156
void Copy(const AlgId &id)
Definition: AlgId.cxx:78
void Algorithm::SetId ( string  name,
string  config 
)
virtualinherited

Definition at line 318 of file Algorithm.cxx.

319 {
320  fID.SetId(name, config);
321 }
const XML_Char * name
Definition: expat.h:151
Definition: config.py:1
AlgId fID
algorithm name and configuration set
Definition: Algorithm.h:156
void SetId(string name, string config="")
Definition: AlgId.cxx:70
void Intranuke2018::SetTrackingRadius ( const GHepParticle p) const
protectedinherited

Definition at line 202 of file Intranuke2018.cxx.

References genie::units::A, genie::GHepParticle::A(), ana::assert(), genie::Intranuke2018::fNR, genie::Intranuke2018::fR0, genie::Intranuke2018::fTrackingRadius, genie::pdg::IsIon(), LOG, genie::GHepParticle::Pdg(), and pNOTICE.

Referenced by genie::Intranuke2018::GetGenINukeMode(), and genie::Intranuke2018::ProcessEventRecord().

203 {
204  assert(p && pdg::IsIon(p->Pdg()));
205  double A = p->A();
206  fTrackingRadius = fR0 * TMath::Power(A, 1./3.);
207 
208  // multiply that by some input factor so that hadrons are tracked
209  // beyond the nuclear 'boundary' since the nuclear density distribution
210  // is not zero there
211  fTrackingRadius *= fNR;
212 
213  LOG("Intranuke2018", pNOTICE)
214  << "Setting tracking radius to R = " << fTrackingRadius;
215 }
double fNR
param multiplying the nuclear radius, determining how far to track hadrons beyond the "nuclear bounda...
int Pdg(void) const
Definition: GHepParticle.h:64
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
double fR0
effective nuclear size param
static const double A
Definition: Units.h:82
bool IsIon(int pdgc)
Definition: PDGUtils.cxx:40
assert(nhit_max >=nhit_nbins)
int A(void) const
#define pNOTICE
Definition: Messenger.h:62
double fTrackingRadius
tracking radius for the nucleus in the current event
Definition: Intranuke2018.h:94
void HNIntranuke2018::SimulateHadronicFinalState ( GHepRecord ev,
GHepParticle p 
) const
privatevirtual

Implements genie::Intranuke2018.

Definition at line 128 of file HNIntranuke2018.cxx.

References AbsorbHN(), genie::GHepRecord::AddParticle(), genie::INukeHadroFates::AsString(), ElasHN(), genie::Intranuke2018::fDoFermi, genie::Intranuke2018::fFermiFac, genie::GHepParticle::FirstMother(), genie::Intranuke2018::fNuclmodel, genie::Intranuke2018::fNucRmvE, genie::Intranuke2018::fRemnA, genie::Intranuke2018::fRemnP4, genie::Intranuke2018::fRemnZ, GammaInelasticHN(), HadronFateHN(), InelasticHN(), genie::kIHNFtAbs, genie::kIHNFtCEx, genie::kIHNFtCmp, genie::kIHNFtElas, genie::kIHNFtInelas, genie::kIHNFtNoInteraction, genie::kIHNFtUndefined, genie::kIMdHN, genie::kIStStableFinalState, genie::kPdgGamma, genie::kPdgKP, genie::kPdgNeutron, genie::kPdgPi0, genie::kPdgPiM, genie::kPdgPiP, genie::kPdgProton, LOG, genie::GHepParticle::Name(), genie::GHepRecord::Particle(), pDEBUG, genie::GHepParticle::Pdg(), pERROR, pNOTICE, genie::utils::intranuke2018::PreEquilibrium(), and genie::GHepParticle::SetStatus().

Referenced by GetGenINukeMode().

129 {
130 // Simulate a hadron interaction for the input particle p in HN mode
131 //
132  if(!p || !ev)
133  {
134  LOG("HNIntranuke2018", pERROR) << "** Null input!";
135  return;
136  }
137 
138  // check particle id
139  int pdgc = p->Pdg();
140  bool is_pion = (pdgc==kPdgPiP || pdgc==kPdgPiM || pdgc==kPdgPi0);
141  bool is_kaon = (pdgc==kPdgKP);
142  bool is_baryon = (pdgc==kPdgProton || pdgc==kPdgNeutron);
143  bool is_gamma = (pdgc==kPdgGamma);
144  if(!(is_pion || is_baryon || is_gamma || is_kaon))
145  {
146  LOG("HNIntranuke2018", pERROR) << "** Cannot handle particle: " << p->Name();
147  return;
148  }
149  try
150  {
151  // select a fate for the input particle
152  INukeFateHN_t fate = this->HadronFateHN(p);
153 
154  // store the fate
155  ev->Particle(p->FirstMother())->SetRescatterCode((int)fate);
156 
157  if(fate == kIHNFtUndefined)
158  {
159  LOG("HNIntranuke2018", pERROR) << "** Couldn't select a fate";
160  LOG("HNIntranuke2018", pERROR) << "** Num Protons: " << fRemnZ
161  << ", Num Neutrons: "<<(fRemnA-fRemnZ);
162  LOG("HNIntranuke2018", pERROR) << "** Particle: " << "\n" << (*p);
163  //LOG("HNIntranuke2018", pERROR) << "** Event Record: " << "\n" << (*ev);
164  //p->SetStatus(kIStUndefined);
165  p->SetStatus(kIStStableFinalState);
166  ev->AddParticle(*p);
167  return;
168  }
169 
170  LOG("HNIntranuke2018", pNOTICE)
171  << "Selected " << p->Name() << " fate: " << INukeHadroFates::AsString(fate);
172 
173  // handle the reaction
174  if(fate == kIHNFtCEx || fate == kIHNFtElas)
175  {
176  this->ElasHN(ev,p,fate);
177  }
178  else if(fate == kIHNFtAbs) {this-> AbsorbHN(ev,p,fate);}
179  else if(fate == kIHNFtInelas && pdgc != kPdgGamma)
180  {
181 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
182  LOG("HNIntranuke2018", pDEBUG)
183  << "Invoking InelasticHN() for a : " << p->Name()
184  << " whose fate is : " << INukeHadroFates::AsString(fate);
185 #endif
186 
187  this-> InelasticHN(ev,p);
188  }
189  else if(fate == kIHNFtInelas && pdgc == kPdgGamma) {this-> GammaInelasticHN(ev,p,fate);}
191  else if(fate == kIHNFtNoInteraction)
192  {
193  p->SetStatus(kIStStableFinalState);
194  ev->AddParticle(*p);
195  return;
196  }
197  }
199  {
200  this->SimulateHadronicFinalState(ev,p);
201  LOG("HNIntranuke2018", pNOTICE)
202  << "retry call to SimulateHadronicFinalState ";
203  LOG("HNIntranuke2018", pNOTICE) << exception;
204 
205  }
206 }
An exception thrown by SimulateHadronState for kinematics problems. TwoBodyCollision/Kinematics used ...
void PreEquilibrium(GHepRecord *ev, GHepParticle *p, int &RemnA, int &RemnZ, TLorentzVector &RemnP4, bool DoFermi, double FermiFac, const NuclearModelI *Nuclmodel, double NucRmvE, EINukeMode mode=kIMdHN)
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:148
#define pERROR
Definition: Messenger.h:60
double fFermiFac
testing parameter to modify fermi momentum
int fRemnA
remnant nucleus A
Definition: Intranuke2018.h:99
void ElasHN(GHepRecord *ev, GHepParticle *p, INukeFateHN_t fate) const
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
void SimulateHadronicFinalState(GHepRecord *ev, GHepParticle *p) const
const NuclearModelI * fNuclmodel
nuclear model used to generate fermi momentum
Definition: Intranuke2018.h:98
int Pdg(void) const
Definition: GHepParticle.h:64
void InelasticHN(GHepRecord *ev, GHepParticle *p) const
int FirstMother(void) const
Definition: GHepParticle.h:67
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:97
enum genie::EINukeFateHN_t INukeFateHN_t
const int kPdgGamma
Definition: PDGCodes.h:166
const int kPdgKP
Definition: PDGCodes.h:149
const int kPdgPiP
Definition: PDGCodes.h:135
const int kPdgPi0
Definition: PDGCodes.h:137
bool fDoFermi
whether or not to do fermi mom.
INukeFateHN_t HadronFateHN(const GHepParticle *p) const
static string AsString(INukeFateHN_t fate)
const int kPdgPiM
Definition: PDGCodes.h:136
virtual void AddParticle(const GHepParticle &p)
Definition: GHepRecord.cxx:535
const int kPdgProton
Definition: PDGCodes.h:65
#define pNOTICE
Definition: Messenger.h:62
void GammaInelasticHN(GHepRecord *ev, GHepParticle *p, INukeFateHN_t fate) const
double fNucRmvE
binding energy to subtract from cascade nucleons
void AbsorbHN(GHepRecord *ev, GHepParticle *p, INukeFateHN_t fate) const
const int kPdgNeutron
Definition: PDGCodes.h:67
int fRemnZ
remnant nucleus Z
#define pDEBUG
Definition: Messenger.h:64
TLorentzVector fRemnP4
P4 of remnant system.
const Algorithm * Algorithm::SubAlg ( const RgKey registry_key) const
inherited

Access the sub-algorithm pointed to by the input key, either from the local pool or from AlgFactory's pool

Definition at line 353 of file Algorithm.cxx.

References ana::assert(), genie::AlgFactory::GetAlgorithm(), genie::AlgFactory::Instance(), LOG, pERROR, and pINFO.

Referenced by genie::Algorithm::AllowReconfig(), genie::utils::gsl::FullQELdXSec::FullQELdXSec(), genie::NewQELXSec::Integrate(), genie::HadronTransporter::LoadConfig(), genie::NucleonDecayPrimaryVtxGenerator::LoadConfig(), genie::IBDXSecMap::LoadConfig(), genie::COHElasticPXSec::LoadConfig(), genie::DISHadronicSystemGenerator::LoadConfig(), genie::EmpiricalMECPXSec2015::LoadConfig(), genie::SlowRsclCharmDISPXSecLO::LoadConfig(), genie::AhrensNCELPXSec::LoadConfig(), genie::AlamSimoAtharVacasSKPXSec2014::LoadConfig(), genie::UnstableParticleDecayer::LoadConfig(), genie::ReinDFRPXSec::LoadConfig(), genie::PythiaHadronization::LoadConfig(), genie::BYPDF::LoadConfig(), genie::QPMDISPXSec::LoadConfig(), genie::AlvarezRusoCOHPiPXSec::LoadConfig(), genie::RosenbluthPXSec::LoadConfig(), genie::StrumiaVissaniIBDPXSec::LoadConfig(), genie::MECGenerator::LoadConfig(), genie::NNBarOscPrimaryVtxGenerator::LoadConfig(), genie::FermiMover::LoadConfig(), genie::AhrensDMELPXSec::LoadConfig(), genie::IMDAnnihilationPXSec::LoadConfig(), genie::QELEventGenerator::LoadConfig(), genie::KNOPythiaHadronization::LoadConfig(), genie::AivazisCharmPXSecLO::LoadConfig(), genie::RESHadronicSystemGenerator::LoadConfig(), genie::P33PaschosLalakulichPXSec::LoadConfig(), genie::BergerSehgalFMCOHPiPXSec2015::LoadConfig(), genie::QPMDMDISPXSec::LoadConfig(), genie::BergerSehgalCOHPiPXSec2015::LoadConfig(), genie::LwlynSmithQELCCPXSec::LoadConfig(), genie::NuElectronPXSec::LoadConfig(), genie::PaisQELLambdaPXSec::LoadConfig(), genie::ReinSehgalCOHPiPXSec::LoadConfig(), genie::NievesSimoVacasMECPXSec2016::LoadConfig(), genie::CharmHadronization::LoadConfig(), genie::KovalenkoQELCharmPXSec::LoadConfig(), genie::EventGenerator::LoadConfig(), genie::NuclearModelMap::LoadConfig(), genie::SmithMonizQELCCXSec::LoadConfig(), genie::BardinIMDRadCorPXSec::LoadConfig(), genie::MartiniEricsonChanfrayMarteauMECPXSec2016::LoadConfig(), genie::QELEventGeneratorSM::LoadConfig(), genie::ReinSehgalRESPXSec::LoadConfig(), genie::LwlynSmithFF::LoadConfig(), genie::SmithMonizQELCCPXSec::LoadConfig(), genie::QPMDISStrucFuncBase::LoadConfig(), genie::HAIntranuke::LoadConfig(), genie::NievesQELCCPXSec::LoadConfig(), genie::HAIntranuke2018::LoadConfig(), LoadConfig(), genie::BSKLNBaseRESPXSec2014::LoadConfig(), genie::ReinSehgalSPPPXSec::LoadConfig(), genie::KNOHadronization::LoadConfig(), and genie::EventGeneratorListAssembler::LoadGenerator().

354 {
355 // Returns the sub-algorithm pointed to this algorithm's XML config file using
356 // the the values of the key.
357 // This method asserts the existence of these keys in the XML config.
358 // Note: Since only 1 parameter is used, the key value should contain both the
359 // algorithm name and its configuration set according to the usual scheme:
360 // namespace::algorithm_name/configuration_set
361 //
362  LOG("Algorithm", pINFO)
363  << "Fetching sub-alg within alg: " << this->Id().Key()
364  << " pointed to by key: " << registry_key;
365 
366  //-- if the algorithm owns its substructure:
367  // return the sub-algorithm from the local pool
368  //
369  if(fOwnsSubstruc) {
370  AlgMapConstIter iter = fOwnedSubAlgMp->find(registry_key);
371  if(iter!=fOwnedSubAlgMp->end()) return iter->second;
372  LOG("Algorithm", pERROR)
373  << "Owned sub-alg pointed to by key: " << registry_key
374  << " was not found within alg: " << this->Id().Key();
375  return 0;
376  }
377 
378  //-- if the algorithm does not own its substructure:
379  // return the sub-algorithm from the AlgFactory's pool
380  RgAlg alg ;
381  GetParam( registry_key, alg ) ;
382 
383  LOG("Algorithm", pINFO)
384  << "Registry key: " << registry_key << " points to algorithm: " << alg;
385 
386  // retrieve the Algorithm object from the the Algorithm factory
387  AlgFactory * algf = AlgFactory::Instance();
388  const Algorithm * algbase = algf->GetAlgorithm(alg.name, alg.config);
389  assert(algbase);
390 
391  return algbase;
392 }
#define pERROR
Definition: Messenger.h:60
AlgMap * fOwnedSubAlgMp
local pool for owned sub-algs (taken out of the factory pool)
Definition: Algorithm.h:167
bool fOwnsSubstruc
true if it owns its substructure (sub-algs,...)
Definition: Algorithm.h:155
Algorithm abstract base class.
Definition: Algorithm.h:54
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
const Algorithm * GetAlgorithm(const AlgId &algid)
Definition: AlgFactory.cxx:86
#define pINFO
Definition: Messenger.h:63
map< string, Algorithm * >::const_iterator AlgMapConstIter
Definition: Algorithm.h:51
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
static AlgFactory * Instance()
Definition: AlgFactory.cxx:75
assert(nhit_max >=nhit_nbins)
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
The GENIE Algorithm Factory.
Definition: AlgFactory.h:40
string Key(void) const
Definition: AlgId.h:47
void Intranuke2018::TransportHadrons ( GHepRecord ev) const
protectedinherited

Definition at line 260 of file Intranuke2018.cxx.

References genie::GHepParticle::A(), genie::GHepRecord::AddParticle(), genie::Intranuke2018::CanRescatter(), d, genie::Intranuke2018::fGMode, genie::Intranuke2018::fHadStep, genie::GHepParticle::FirstMother(), genie::Intranuke2018::fRemnA, genie::Intranuke2018::fRemnP4, genie::Intranuke2018::fRemnZ, genie::Intranuke2018::fTrackingRadius, genie::Intranuke2018::GenerateStep(), genie::Intranuke2018::IsInNucleus(), genie::kGMdDarkMatterNucleus, genie::kGMdHadronNucleus, genie::kGMdLeptonNucleus, genie::kGMdNucleonDecay, genie::kGMdPhotonNucleus, genie::GHepParticle::KinE(), genie::kIStFinalStateNuclearRemnant, genie::kIStIntermediateState, genie::kIStStableFinalState, genie::kPdgHadronicBlob, LOG, genie::GHepParticle::Name(), genie::Intranuke2018::NeedsRescattering(), genie::GHepParticle::P4(), genie::GHepRecord::Particle(), pERROR, pNOTICE, genie::GHepRecord::RemnantNucleusPosition(), genie::GHepParticle::SetFirstMother(), genie::GHepParticle::SetStatus(), genie::Intranuke2018::SimulateHadronicFinalState(), genie::utils::intranuke2018::StepParticle(), genie::GHepRecord::TargetNucleusPosition(), genie::GHepParticle::X4(), and genie::GHepParticle::Z().

Referenced by genie::Intranuke2018::GetGenINukeMode(), and genie::Intranuke2018::ProcessEventRecord().

261 {
262 // transport all hadrons outside the nucleus
263 
264  int inucl = -1;
265  fRemnA = -1;
266  fRemnZ = -1;
267 
268  // Get 'nuclear environment' at the beginning of hadron transport
269  // and keep track of the remnant nucleus A,Z
270 
271  if(fGMode == kGMdHadronNucleus ||
273  {
274  inucl = evrec->TargetNucleusPosition();
275  }
276  else if(fGMode == kGMdLeptonNucleus ||
279  inucl = evrec->RemnantNucleusPosition();
280  }
281 
282  LOG("Intranuke2018", pNOTICE)
283  << "Propagating hadrons within nucleus found in position = " << inucl;
284  GHepParticle * nucl = evrec->Particle(inucl);
285  if(!nucl) {
286  LOG("Intranuke2018", pERROR)
287  << "No nucleus found in position = " << inucl;
288  LOG("Intranuke2018", pERROR)
289  << *evrec;
290  return;
291  }
292 
293  fRemnA = nucl->A();
294  fRemnZ = nucl->Z();
295 
296  LOG("Intranuke2018", pNOTICE)
297  << "Nucleus (A,Z) = (" << fRemnA << ", " << fRemnZ << ")";
298 
299  const TLorentzVector & p4nucl = *(nucl->P4());
300  fRemnP4 = p4nucl;
301 
302  // Loop over GHEP and run intranuclear rescattering on handled particles
303  TObjArrayIter piter(evrec);
304  GHepParticle * p = 0;
305  int icurr = -1;
306 
307  while( (p = (GHepParticle *) piter.Next()) )
308  {
309  icurr++;
310 
311  // Check whether the particle needs rescattering, otherwise skip it
312  if( ! this->NeedsRescattering(p) ) continue;
313 
314  LOG("Intranuke2018", pNOTICE)
315  << " >> Stepping a " << p->Name()
316  << " with kinetic E = " << p->KinE() << " GeV";
317 
318  // Rescatter a clone, not the original particle
319  GHepParticle * sp = new GHepParticle(*p);
320 
321  // Set clone's mom to be the hadron that was cloned
322  sp->SetFirstMother(icurr);
323 
324  // Check whether the particle can be rescattered
325  if(!this->CanRescatter(sp)) {
326 
327  // if I can't rescatter it, I will just take it out of the nucleus
328  LOG("Intranuke2018", pNOTICE)
329  << "... Current version can't rescatter a " << sp->Name();
330  sp->SetFirstMother(icurr);
332  evrec->AddParticle(*sp);
333  delete sp;
334  continue; // <-- skip to next GHEP entry
335  }
336 
337  // Start stepping particle out of the nucleus
338  bool has_interacted = false;
339  while ( this-> IsInNucleus(sp) )
340  {
341  // advance the hadron by a step
343 
344  // check whether it interacts
345  double d = this->GenerateStep(evrec,sp);
346  has_interacted = (d<fHadStep);
347  if(has_interacted) break;
348  }//stepping
349 
350  //updating the position of the original particle with the position of the clone
351  evrec->Particle(sp->FirstMother())->SetPosition(*(sp->X4()));
352 
353  if(has_interacted && fRemnA>0) {
354  // the particle interacts - simulate the hadronic interaction
355  LOG("Intranuke2018", pNOTICE)
356  << "Particle has interacted at location: "
357  << sp->X4()->Vect().Mag() << " / nucl rad= " << fTrackingRadius;
358  this->SimulateHadronicFinalState(evrec,sp);
359  } else if(has_interacted && fRemnA<=0) {
360  // nothing left to interact with!
361  LOG("Intranuke2018", pNOTICE)
362  << "*** Nothing left to interact with, escaping.";
364  evrec->AddParticle(*sp);
365  evrec->Particle(sp->FirstMother())->SetRescatterCode(1);
366  } else {
367  // the exits the nucleus without interacting - Done with it!
368  LOG("Intranuke2018", pNOTICE)
369  << "*** Hadron escaped the nucleus! Done with it.";
371  evrec->AddParticle(*sp);
372  evrec->Particle(sp->FirstMother())->SetRescatterCode(1);
373  }
374  delete sp;
375 
376  // Current snapshot
377  //LOG("Intranuke2018", pINFO) << "Current event record snapshot: " << *evrec;
378 
379  }// GHEP entries
380 
381  // Add remnant nucleus - that 'hadronic blob' has all the remaining hadronic
382  // 4p not put explicitly into the simulated particles
383  TLorentzVector v4(0.,0.,0.,0.);
384  GHepParticle remnant_nucleus(
386  evrec->AddParticle(remnant_nucleus);
387  // Mark the initial remnant nucleus as an intermediate state
388  // Don't do that in the hadron/photon-nucleus scatterig mode since the initial
389  // remnant nucleus and the target nucleus coincide.
390  if(fGMode != kGMdHadronNucleus &&
392  evrec->Particle(inucl)->SetStatus(kIStIntermediateState);
393  }
394 }
int Z(void) const
void SetFirstMother(int m)
Definition: GHepParticle.h:133
#define pERROR
Definition: Messenger.h:60
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:79
const int kPdgHadronicBlob
Definition: PDGCodes.h:188
void StepParticle(GHepParticle *p, double step, double nuclear_radius=-1.)
Step particle.
const char * p
Definition: xmltok.h:285
int fRemnA
remnant nucleus A
Definition: Intranuke2018.h:99
bool IsInNucleus(const GHepParticle *p) const
bool CanRescatter(const GHepParticle *p) const
GEvGenMode_t fGMode
event generation mode (lepton+A, hadron+A, ...)
int FirstMother(void) const
Definition: GHepParticle.h:67
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:97
bool NeedsRescattering(const GHepParticle *p) const
Float_t d
Definition: plot.C:236
double GenerateStep(GHepRecord *ev, GHepParticle *p) const
double KinE(bool mass_from_pdg=false) const
Get kinetic energy.
const TLorentzVector * X4(void) const
Definition: GHepParticle.h:80
void SetStatus(GHepStatus_t s)
Definition: GHepParticle.h:127
double fHadStep
step size for intranuclear hadron transport
int A(void) const
#define pNOTICE
Definition: Messenger.h:62
double fTrackingRadius
tracking radius for the nucleus in the current event
Definition: Intranuke2018.h:94
virtual void SimulateHadronicFinalState(GHepRecord *ev, GHepParticle *p) const =0
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
int fRemnZ
remnant nucleus Z
TLorentzVector fRemnP4
P4 of remnant system.

Friends And Related Function Documentation

friend class IntranukeTester
friend

Definition at line 53 of file HNIntranuke2018.h.

Member Data Documentation

AlgFactory* genie::Intranuke2018::fAlgf
protectedinherited

algorithm factory instance

Definition at line 97 of file Intranuke2018.h.

bool genie::Algorithm::fAllowReconfig
protectedinherited
bool genie::Intranuke2018::fAltOset
protectedinherited

NuWro's table-based implementation (not recommended)

Definition at line 120 of file Intranuke2018.h.

Referenced by genie::Intranuke2018::GenerateStep(), LoadConfig(), and genie::HAIntranuke2018::LoadConfig().

vector<Registry*> genie::Algorithm::fConfVect
protectedinherited

ideally these members should go private Registry will be access only through the GetParam method configurations registries from various sources the order of the vector is the precedence in case of repeated parameters position 0 -> Highest precedence

Definition at line 161 of file Algorithm.h.

double genie::Intranuke2018::fDelRNucleon
protectedinherited

factor by which Nucleon Compton wavelength gets multiplied to become nuclear size enhancement

Definition at line 109 of file Intranuke2018.h.

Referenced by genie::Intranuke2018::GenerateStep(), LoadConfig(), and genie::HAIntranuke2018::LoadConfig().

double genie::Intranuke2018::fDelRPion
protectedinherited

factor by which Pion Compton wavelength gets multiplied to become nuclear size enhancement

Definition at line 108 of file Intranuke2018.h.

Referenced by genie::Intranuke2018::GenerateStep(), LoadConfig(), and genie::HAIntranuke2018::LoadConfig().

bool genie::Intranuke2018::fDoCompoundNucleus
protectedinherited

whether or not to do compound nucleus considerations

Definition at line 118 of file Intranuke2018.h.

Referenced by FateWeight(), HandleCompoundNucleus(), LoadConfig(), and genie::HAIntranuke2018::LoadConfig().

bool genie::Intranuke2018::fDoFermi
protectedinherited
bool genie::Intranuke2018::fDoMassDiff
protectedinherited

whether or not to do mass diff. mode

Definition at line 117 of file Intranuke2018.h.

double genie::Intranuke2018::fEPreEq
protectedinherited

threshold for pre-equilibrium reaction

Definition at line 113 of file Intranuke2018.h.

Referenced by HandleCompoundNucleus(), genie::HAIntranuke2018::LoadConfig(), and LoadConfig().

double genie::Intranuke2018::fFermiFac
protectedinherited
double genie::Intranuke2018::fFermiMomentum
protectedinherited

whether or not particle collision is pauli blocked

Definition at line 115 of file Intranuke2018.h.

Referenced by AbsorbHN(), genie::HAIntranuke2018::Inelastic(), InelasticHN(), LoadConfig(), and genie::HAIntranuke2018::LoadConfig().

TGenPhaseSpace genie::Intranuke2018::fGenPhaseSpace
mutableprotectedinherited

a phase space generator

Definition at line 95 of file Intranuke2018.h.

GEvGenMode_t genie::Intranuke2018::fGMode
mutableprotectedinherited

event generation mode (lepton+A, hadron+A, ...)

Definition at line 102 of file Intranuke2018.h.

Referenced by genie::Intranuke2018::NeedsRescattering(), genie::Intranuke2018::ProcessEventRecord(), and genie::Intranuke2018::TransportHadrons().

INukeHadroData2018* genie::Intranuke2018::fHadroData2018
protectedinherited
double genie::Intranuke2018::fHadStep
protectedinherited

step size for intranuclear hadron transport

Definition at line 110 of file Intranuke2018.h.

Referenced by genie::Intranuke2018::IsInNucleus(), LoadConfig(), genie::HAIntranuke2018::LoadConfig(), and genie::Intranuke2018::TransportHadrons().

AlgId genie::Algorithm::fID
protectedinherited

algorithm name and configuration set

Definition at line 156 of file Algorithm.h.

Referenced by genie::Algorithm::Id().

double genie::Intranuke2018::fNR
protectedinherited

param multiplying the nuclear radius, determining how far to track hadrons beyond the "nuclear boundary"

Definition at line 106 of file Intranuke2018.h.

Referenced by genie::HAIntranuke2018::LoadConfig(), LoadConfig(), and genie::Intranuke2018::SetTrackingRadius().

double genie::Intranuke2018::fNucAbsFac
protectedinherited

absorption xsec correction factor (hN Mode)

Definition at line 111 of file Intranuke2018.h.

Referenced by HadronFateHN(), genie::HAIntranuke2018::LoadConfig(), and LoadConfig().

double genie::Intranuke2018::fNucCEXFac
protectedinherited

charge exchange xsec correction factor (hN Mode)

Definition at line 112 of file Intranuke2018.h.

Referenced by HadronFateHN(), genie::HAIntranuke2018::LoadConfig(), and LoadConfig().

double genie::Intranuke2018::fNucleonFracAbsScale
protectedinherited
double genie::Intranuke2018::fNucleonFracCExScale
protectedinherited
double genie::Intranuke2018::fNucleonFracInelScale
protectedinherited
double genie::Intranuke2018::fNucleonFracPiProdScale
protectedinherited
double genie::Intranuke2018::fNucleonMFPScale
protectedinherited
const NuclearModelI* genie::Intranuke2018::fNuclmodel
protectedinherited
double genie::HNIntranuke2018::fNucQEFac
private

Definition at line 84 of file HNIntranuke2018.h.

Referenced by HadronFateHN(), and LoadConfig().

double genie::Intranuke2018::fNucRmvE
protectedinherited
AlgMap* genie::Algorithm::fOwnedSubAlgMp
protectedinherited

local pool for owned sub-algs (taken out of the factory pool)

Definition at line 167 of file Algorithm.h.

vector<bool> genie::Algorithm::fOwnerships
protectedinherited

ownership for every registry in fConfVect

Definition at line 164 of file Algorithm.h.

bool genie::Algorithm::fOwnsSubstruc
protectedinherited

true if it owns its substructure (sub-algs,...)

Definition at line 155 of file Algorithm.h.

double genie::Intranuke2018::fPionFracAbsScale
protectedinherited
double genie::Intranuke2018::fPionFracCExScale
protectedinherited
double genie::Intranuke2018::fPionFracInelScale
protectedinherited
double genie::Intranuke2018::fPionFracPiProdScale
protectedinherited
double genie::Intranuke2018::fPionMFPScale
protectedinherited

tweaking factors for tuning

Definition at line 123 of file Intranuke2018.h.

Referenced by genie::Intranuke2018::GenerateStep(), and genie::HAIntranuke2018::LoadConfig().

double genie::Intranuke2018::fR0
protectedinherited

effective nuclear size param

Definition at line 105 of file Intranuke2018.h.

Referenced by genie::HAIntranuke2018::LoadConfig(), LoadConfig(), and genie::Intranuke2018::SetTrackingRadius().

int genie::Intranuke2018::fRemnA
mutableprotectedinherited
TLorentzVector genie::Intranuke2018::fRemnP4
mutableprotectedinherited
int genie::Intranuke2018::fRemnZ
mutableprotectedinherited
AlgStatus_t genie::Algorithm::fStatus
protectedinherited

algorithm execution status

Definition at line 166 of file Algorithm.h.

Referenced by genie::Algorithm::GetStatus().

double genie::Intranuke2018::fTrackingRadius
mutableprotectedinherited
bool genie::Intranuke2018::fUseOset
protectedinherited

Oset model for low energy pion in hN.

Definition at line 119 of file Intranuke2018.h.

Referenced by AbsorbHN(), genie::Intranuke2018::GenerateStep(), HadronFateHN(), LoadConfig(), and genie::HAIntranuke2018::LoadConfig().

bool genie::Intranuke2018::fXsecNNCorr
protectedinherited

use nuclear medium correction for NN cross section

Definition at line 121 of file Intranuke2018.h.

Referenced by genie::Intranuke2018::GenerateStep(), LoadConfig(), and genie::HAIntranuke2018::LoadConfig().

int genie::HNIntranuke2018::nuclA
mutableprivate

value of A for the target nucleus in hA mode

Definition at line 81 of file HNIntranuke2018.h.


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