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:
genie::EventRecordVisitorI genie::Algorithm

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)
 
- 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
 
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< boolfOwnerships
 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 <constantinos.andreopoulos cern.ch> University of Liverpool & STFC Rutherford Appleton Laboratory

November 19, 2004

Copyright (c) 2003-2020, 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 }
static Config * config
Definition: config.cpp:1054
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 201 of file NucBindEnergyAggregator.cxx.

202 {
203  Algorithm::Configure(config);
204  this->LoadConfig();
205 }
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 207 of file NucBindEnergyAggregator.cxx.

208 {
210  this->LoadConfig();
211 }
static Config * config
Definition: config.cpp:1054
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
void NucBindEnergyAggregator::LoadConfig ( void  )
private

Definition at line 213 of file NucBindEnergyAggregator.cxx.

214 {
215  GetParamDef("AllowNuclRecombination",fAllowRecombination, true ) ;
216 
217 }
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.

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  KE = TMath::Max(0.,KE);
92 
93  LOG("Nuclear", pINFO) << "Kinetic energy after subtraction = " << KE;
94 
95  En = KE+M;
96 
97  if(En>M || !fAllowRecombination) {
98  double pmag_old = p->P4()->P();
99  double pmag_new = TMath::Sqrt(utils::math::NonNegative(En*En-M*M));
100  double scale = pmag_new / pmag_old;
101  LOG("Nuclear", pINFO)
102  << "|pnew| = " << pmag_new << ", |pold| = " << pmag_old
103  << ", scale = " << scale;
104 
105  double pxn = scale * p->Px();
106  double pyn = scale * p->Py();
107  double pzn = scale * p->Pz();
108 
109  double pxb = (1-scale) * p->Px();
110  double pyb = (1-scale) * p->Py();
111  double pzb = (1-scale) * p->Pz();
112 
113  p->SetEnergy ( En );
114  p->SetPx ( pxn );
115  p->SetPy ( pyn );
116  p->SetPz ( pzn );
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  LOG("Nuclear", pERROR)
132  << "*** This functionality is temporarily disabled";
133 /*
134  LOG("Nuclear", pNOTICE) << *evrec;
135 
136  // find the remnant nucleus
137  int rnucpos = evrec->RemnantNucleusPosition();
138  assert(rnucpos);
139 
140  GHepParticle * rnucl = evrec->Particle(rnucpos);
141 
142  // mark both the remnant nucleus and the final state nucleon as
143  // intermediate states
144  rnucl -> SetStatus(kIStIntermediateState);
145  p -> SetStatus(kIStIntermediateState);
146 
147  // figure out the recombined nucleus PDG code
148  int Z = rnucl->Z();
149  int A = rnucl->A();
150  if(pdg::IsProton(p->Pdg())) Z++;
151  A++;
152  int ipdgc = pdg::IonPdgCode(A,Z);
153 
154  // add-up their 4-momenta
155  double pxnuc = rnucl->Px() + p->Px();
156  double pynuc = rnucl->Py() + p->Py();
157  double pznuc = rnucl->Pz() + p->Pz();
158  double Enuc = rnucl->E() + p->E();
159 
160  evrec->AddParticle(ipdgc, kIStStableFinalState,
161  rnucpos,-1,-1,-1, pxnuc,pynuc,pznuc,Enuc, 0,0,0,0);
162 */
163  }
164  }
165 }
#define pERROR
Definition: Messenger.h:59
void SetPz(double pz)
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:78
const int kPdgBindino
Definition: PDGCodes.h:212
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
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
p
Definition: test.py:223
#define pINFO
Definition: Messenger.h:62
bool IsNeutronOrProton(int pdgc)
Definition: PDGUtils.cxx:348
double NonNegative(double x)
Definition: MathUtils.cxx:273
#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.


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