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

A nuclear binding energy 'collector' which visits the event record, finds nucleons originating from within a nuclei and subtracts the binding energy they had in the nucleus. To record this action in the event record a hypothetical BINDINO is added to the event record. Is a concerete implementation of the EventRecordVisitorI interface. More...

#include <NucBindEnergyAggregator.h>

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

Public Member Functions

 NucBindEnergyAggregator ()
 
 NucBindEnergyAggregator (string config)
 
 ~NucBindEnergyAggregator ()
 
void ProcessEventRecord (GHepRecord *event_rec) const
 
void Configure (const Registry &config)
 
void Configure (string config)
 
- Public Member Functions inherited from genie::EventRecordVisitorI
virtual ~EventRecordVisitorI ()
 
- Public Member Functions inherited from genie::Algorithm
virtual ~Algorithm ()
 
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...
 

Private Member Functions

void LoadConfig (void)
 

Private Attributes

bool fAllowRecombination
 

Additional Inherited Members

- Static Public Member Functions inherited from genie::Algorithm
static string BuildParamVectKey (const std::string &comm_name, unsigned int i)
 
static string BuildParamVectSizeKey (const std::string &comm_name)
 
static string BuildParamMatKey (const std::string &comm_name, unsigned int i, unsigned int j)
 
static string BuildParamMatRowSizeKey (const std::string &comm_name)
 
static string BuildParamMatColSizeKey (const std::string &comm_name)
 
- Protected Member Functions inherited from genie::EventRecordVisitorI
 EventRecordVisitorI ()
 
 EventRecordVisitorI (string name)
 
 EventRecordVisitorI (string name, string config)
 
- Protected Member Functions inherited from genie::Algorithm
 Algorithm ()
 
 Algorithm (string name)
 
 Algorithm (string name, string config)
 
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 >
int GetParamVect (const std::string &comm_name, std::vector< T > &v, bool is_top_call=true) const
 Handle to load vectors of parameters. More...
 
int GetParamVectKeys (const std::string &comm_name, std::vector< RgKey > &k, bool is_top_call=true) const
 
template<class T >
int GetParamMat (const std::string &comm_name, TMatrixT< T > &mat, bool is_top_call=true) const
 Handle to load matrix of parameters. More...
 
template<class T >
int GetParamMatSym (const std::string &comm_name, TMatrixTSym< T > &mat, bool is_top_call=true) const
 
int GetParamMatKeys (const std::string &comm_name, std::vector< RgKey > &k, 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 inherited from genie::Algorithm
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...
 

Detailed Description

A nuclear binding energy 'collector' which visits the event record, finds nucleons originating from within a nuclei and subtracts the binding energy they had in the nucleus. To record this action in the event record a hypothetical BINDINO is added to the event record. Is a concerete implementation of the EventRecordVisitorI interface.

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

Definition at line 33 of file NucBindEnergyAggregator.h.

Constructor & Destructor Documentation

NucBindEnergyAggregator::NucBindEnergyAggregator ( )

Definition at line 36 of file NucBindEnergyAggregator.cxx.

36  :
37 EventRecordVisitorI("genie::NucBindEnergyAggregator")
38 {
39 
40 }
NucBindEnergyAggregator::NucBindEnergyAggregator ( string  config)

Definition at line 42 of file NucBindEnergyAggregator.cxx.

42  :
43 EventRecordVisitorI("genie::NucBindEnergyAggregator", config)
44 {
45 
46 }
NucBindEnergyAggregator::~NucBindEnergyAggregator ( )

Definition at line 48 of file NucBindEnergyAggregator.cxx.

49 {
50 
51 }

Member Function Documentation

void NucBindEnergyAggregator::Configure ( const Registry config)
virtual

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 213 of file NucBindEnergyAggregator.cxx.

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

214 {
215  Algorithm::Configure(config);
216  this->LoadConfig();
217 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
void NucBindEnergyAggregator::Configure ( string  config)
virtual

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 219 of file NucBindEnergyAggregator.cxx.

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

220 {
221  Algorithm::Configure(config);
222  this->LoadConfig();
223 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
void NucBindEnergyAggregator::LoadConfig ( void  )
private

Definition at line 225 of file NucBindEnergyAggregator.cxx.

References fAllowRecombination, and genie::Algorithm::GetParamDef().

Referenced by Configure().

226 {
227  GetParamDef("AllowNuclRecombination",fAllowRecombination, true ) ;
228 
229 }
bool GetParamDef(const RgKey &name, T &p, const T &def) const
void NucBindEnergyAggregator::ProcessEventRecord ( GHepRecord event_rec) const
virtual

Implements genie::EventRecordVisitorI.

Definition at line 53 of file NucBindEnergyAggregator.cxx.

References genie::units::A, genie::GHepParticle::A(), genie::GHepRecord::AddParticle(), genie::GHepParticle::E(), genie::GHepParticle::Energy(), fAllowRecombination, genie::GHepRecord::FindParticle(), genie::pdg::IonPdgCode(), genie::pdg::IsNeutronOrProton(), genie::pdg::IsProton(), genie::kIStFinalStateNuclearRemnant, genie::kIStIntermediateState, genie::kIStStableFinalState, genie::kPdgBindino, genie::kPdgHadronicBlob, LOG, genie::GHepParticle::Mass(), genie::utils::math::NonNegative(), genie::GHepParticle::P4(), genie::GHepRecord::Particle(), genie::GHepParticle::Pdg(), pINFO, pNOTICE, genie::GHepParticle::Px(), genie::GHepParticle::Py(), genie::GHepParticle::Pz(), genie::GHepRecord::RemnantNucleusPosition(), genie::GHepParticle::RemovalEnergy(), genie::GHepParticle::SetEnergy(), genie::GHepParticle::SetMomentum(), genie::GHepParticle::SetPx(), genie::GHepParticle::SetPy(), genie::GHepParticle::SetPz(), genie::GHepParticle::SetRemovalEnergy(), genie::GHepParticle::Status(), genie::GHepRecord::TargetNucleus(), and genie::GHepParticle::Z().

54 {
55  // Return if the neutrino was not scatterred off a nuclear target
56  GHepParticle * nucltgt = evrec->TargetNucleus();
57  if (!nucltgt) {
58  LOG("Nuclear", pINFO)
59  << "No nuclear target found - Not subtracting any binding energy";
60  return;
61  }
62 
63  // Loop over particles, find final state nucleons for which a removal
64  // energy has been set and subtract it from their energy
65  TIter stdhep_iter(evrec);
66  GHepParticle * p = 0;
67 
68  while( (p = (GHepParticle * ) stdhep_iter.Next()) ) {
69 
70  bool is_nucleon = pdg::IsNeutronOrProton(p->Pdg());
71  bool in_fin_state = (p->Status() == kIStStableFinalState);
72  bool had_bind_e = (p->RemovalEnergy() > 0.);
73 
74  bool handle = is_nucleon && in_fin_state && had_bind_e;
75  if(!handle) continue;
76 
77  //-- ask for the binding energy set by the nuclear model
78  double bindE = p->RemovalEnergy();
79  LOG("Nuclear", pINFO) << "Binding energy = " << bindE;
80 
81  //-- subtract this energy from the final state nucleon
82  LOG("Nuclear", pINFO)
83  << "Subtracting the binding energy from the escaped nucleon";
84 
85  double M = p->Mass();
86  double En = p->Energy();
87  double KE = En-M;
88 
89  LOG("Nuclear", pINFO) << "Kinetic energy before subtraction = " << KE;
90  KE -= bindE;
91 
92  LOG("Nuclear", pINFO) << "Kinetic energy after subtraction = " << KE;
93 
94  En = KE+M;
95 
96  if(En>M || !fAllowRecombination) {
97  double pmag_old = p->P4()->P();
98  double pmag_new = TMath::Sqrt(utils::math::NonNegative(En*En-M*M));
99  double scale = pmag_new / pmag_old;
100  LOG("Nuclear", pINFO)
101  << "|pnew| = " << pmag_new << ", |pold| = " << pmag_old
102  << ", scale = " << scale;
103 
104  double pxn = scale * p->Px();
105  double pyn = scale * p->Py();
106  double pzn = scale * p->Pz();
107 
108  double pxb = (1-scale) * p->Px();
109  double pyb = (1-scale) * p->Py();
110  double pzb = (1-scale) * p->Pz();
111 
112  p->SetEnergy ( En );
113  p->SetPx ( pxn );
114  p->SetPy ( pyn );
115  p->SetPz ( pzn );
116  p->SetRemovalEnergy(0);
117 
118  //-- and add a GHEP entry to record this in the event record and
119  // conserve energy/momentum
120  LOG("Nuclear", pINFO)
121  << "Adding a [BindingE] to account for nuclear binding energy";
122 
123  evrec->AddParticle(kPdgBindino, kIStStableFinalState,
124  -1,-1,-1,-1, pxb,pyb,pzb,bindE, 0,0,0,0);
125  } else {
126  LOG("Nuclear", pNOTICE)
127  << "Nucleon is above the Fermi sea but can't escape the nucleus";
128  LOG("Nuclear", pNOTICE)
129  << "Recombining remnant nucleus + f/s nucleon";
130 
131 
132  // find the remnant nucleus if corresponding cascade modules provide it
133  int rnucpos = evrec->RemnantNucleusPosition();
134 
135  if (rnucpos != -1)
136  {
137  GHepParticle * rnucl = evrec->Particle(rnucpos);
138 
139  // mark both the remnant nucleus and the final state nucleon as
140  // intermediate states
141  rnucl -> SetStatus(kIStIntermediateState);
142  p -> SetStatus(kIStIntermediateState);
143 
144  // figure out the recombined nucleus PDG code
145  int Z = rnucl->Z();
146  int A = rnucl->A();
147  if(pdg::IsProton(p->Pdg())) Z++;
148  A++;
149  int ipdgc = pdg::IonPdgCode(A,Z);
150 
151  // add-up their 4-momenta
152  double pxnuc = rnucl->Px() + p->Px();
153  double pynuc = rnucl->Py() + p->Py();
154  double pznuc = rnucl->Pz() + p->Pz();
155  double Enuc = rnucl->E() + p->E();
156 
157  evrec->AddParticle(ipdgc, kIStStableFinalState,
158  rnucpos,-1,-1,-1, pxnuc,pynuc,pznuc,Enuc, 0,0,0,0);
159  }
160  else
161  {
162  // Find hadronic blob which is provided by Intranuke models
163  GHepParticle *hblob = evrec->FindParticle(kPdgHadronicBlob , kIStFinalStateNuclearRemnant, 0);
164  // If there is no hadronic blob do nothing
165  if (hblob == nullptr) return;
166  p -> SetStatus(kIStIntermediateState);
167 
168  // add-up their 4-momenta
169  double pxhblob = hblob->Px() + p->Px();
170  double pyhblob = hblob->Py() + p->Py();
171  double pzhblob = hblob->Pz() + p->Pz();
172  double Ehblob = hblob->E() + p->E();
173  hblob->SetMomentum(pxhblob, pyhblob, pzhblob, Ehblob);
174  }
175  }
176  }
177 }
int Z(void) const
double E(void) const
Get energy.
Definition: GHepParticle.h:91
void SetPz(double pz)
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:78
const int kPdgHadronicBlob
Definition: PDGCodes.h:211
const int kPdgBindino
Definition: PDGCodes.h:212
void SetMomentum(const TLorentzVector &p4)
double RemovalEnergy(void) const
Get removal energy.
Definition: GHepParticle.h:100
double Mass(void) const
Mass that corresponds to the PDG code.
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:90
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
void SetPx(double px)
double Energy(void) const
Get energy.
Definition: GHepParticle.h:92
double Px(void) const
Get Px.
Definition: GHepParticle.h:88
int Pdg(void) const
Definition: GHepParticle.h:63
bool IsProton(int pdgc)
Definition: PDGUtils.cxx:336
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
static constexpr double A
Definition: Units.h:74
#define pINFO
Definition: Messenger.h:62
void SetRemovalEnergy(double Erm)
bool IsNeutronOrProton(int pdgc)
Definition: PDGUtils.cxx:351
int IonPdgCode(int A, int Z)
Definition: PDGUtils.cxx:71
double NonNegative(double x)
Definition: MathUtils.cxx:273
int A(void) const
#define pNOTICE
Definition: Messenger.h:61
void SetEnergy(double E)
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
void SetPy(double py)
double Py(void) const
Get Py.
Definition: GHepParticle.h:89

Member Data Documentation

bool genie::NucBindEnergyAggregator::fAllowRecombination
private

Definition at line 52 of file NucBindEnergyAggregator.h.

Referenced by LoadConfig(), and ProcessEventRecord().


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