GENIEGenerator
Loading...
Searching...
No Matches
genie::FermiMover Class Reference

It visits the event record & computes a Fermi motion momentum for initial state nucleons bound in nuclei. Is a concrete implementation of the EventRecordVisitorI interface. More...

#include <FermiMover.h>

Inheritance diagram for genie::FermiMover:
[legend]
Collaboration diagram for genie::FermiMover:
[legend]

Public Member Functions

 FermiMover ()
 FermiMover (string config)
 ~FermiMover ()
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.
virtual AlgStatus_t GetStatus (void) const
 Get algorithm status.
virtual bool AllowReconfig (void) const
virtual AlgCmp_t Compare (const Algorithm *alg) const
 Compare with input algorithm.
virtual void SetId (const AlgId &id)
 Set algorithm ID.
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.

Private Member Functions

void KickHitNucleon (GHepRecord *evrec) const
 give hit nucleon a momentum
void AddTargetNucleusRemnant (GHepRecord *evrec) const
 add a recoiled nucleus remnant
void LoadConfig (void)

Private Attributes

bool fKeepNuclOnMassShell
 keep hit bound nucleon on the mass shell?
bool fMomDepErmv
 use momentum dependent calculation of Ermv
const NuclearModelIfNuclModel
 nuclear model
const SecondNucleonEmissionIfSecondEmitter

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.
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.
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.
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
int AddLowRegistry (Registry *rp, bool owns=true)
 add registry with lowest priority, also update ownership
int MergeTopRegistry (const Registry &r)
int AddTopRegisties (const vector< Registry * > &rs, bool owns=false)
 Add registries with top priority, also udated Ownerships.
Protected Attributes inherited from genie::Algorithm
bool fAllowReconfig
bool fOwnsSubstruc
 true if it owns its substructure (sub-algs,...)
AlgId fID
 algorithm name and configuration set
vector< Registry * > fConfVect
vector< bool > fOwnerships
 ownership for every registry in fConfVect
AlgStatus_t fStatus
 algorithm execution status
AlgMapfOwnedSubAlgMp
 local pool for owned sub-algs (taken out of the factory pool)

Detailed Description

It visits the event record & computes a Fermi motion momentum for initial state nucleons bound in nuclei. Is a concrete implementation of the EventRecordVisitorI interface.

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

Definition at line 35 of file FermiMover.h.

Constructor & Destructor Documentation

◆ FermiMover() [1/2]

FermiMover::FermiMover ( )

Definition at line 65 of file FermiMover.cxx.

65 :
66EventRecordVisitorI("genie::FermiMover")
67{
68
69}

References genie::EventRecordVisitorI::EventRecordVisitorI().

◆ FermiMover() [2/2]

FermiMover::FermiMover ( string config)

Definition at line 71 of file FermiMover.cxx.

71 :
72EventRecordVisitorI("genie::FermiMover", config)
73{
74
75}

References genie::EventRecordVisitorI::EventRecordVisitorI().

◆ ~FermiMover()

FermiMover::~FermiMover ( )

Definition at line 77 of file FermiMover.cxx.

78{
79
80}

Member Function Documentation

◆ AddTargetNucleusRemnant()

void FermiMover::AddTargetNucleusRemnant ( GHepRecord * evrec) const
private

add a recoiled nucleus remnant

Definition at line 224 of file FermiMover.cxx.

225{
226// add the remnant nuclear target at the GHEP record
227
228 LOG("FermiMover", pINFO) << "Adding final state nucleus";
229
230 double Px = 0;
231 double Py = 0;
232 double Pz = 0;
233 double E = 0;
234
235 GHepParticle * nucleus = evrec->TargetNucleus();
236 int A = nucleus->A();
237 int Z = nucleus->Z();
238
239 int fd = nucleus->FirstDaughter();
240 int ld = nucleus->LastDaughter();
241
242 for(int id = fd; id <= ld; id++) {
243
244 // compute A,Z for final state nucleus & get its PDG code and its mass
245 GHepParticle * particle = evrec->Particle(id);
246 assert(particle);
247 int pdgc = particle->Pdg();
248 bool is_p = pdg::IsProton (pdgc);
249 bool is_n = pdg::IsNeutron(pdgc);
250
251 if (is_p) Z--;
252 if (is_p || is_n) A--;
253
254 Px += particle->Px();
255 Py += particle->Py();
256 Pz += particle->Pz();
257 E += particle->E();
258
259 }//daughters
260
261 TParticlePDG * remn = 0;
262 int ipdgc = pdg::IonPdgCode(A, Z);
263 remn = PDGLibrary::Instance()->Find(ipdgc);
264 if(!remn) {
265 LOG("HadronicVtx", pFATAL)
266 << "No particle with [A = " << A << ", Z = " << Z
267 << ", pdgc = " << ipdgc << "] in PDGLibrary!";
268 assert(remn);
269 }
270
271 double Mi = nucleus->Mass();
272 Px *= -1;
273 Py *= -1;
274 Pz *= -1;
275 E = Mi-E;
276
277 // Add the nucleus to the event record
278 LOG("FermiMover", pINFO)
279 << "Adding nucleus [A = " << A << ", Z = " << Z
280 << ", pdgc = " << ipdgc << "]";
281
282 int imom = evrec->TargetNucleusPosition();
283 evrec->AddParticle(
284 ipdgc,kIStStableFinalState, imom,-1,-1,-1, Px,Py,Pz,E, 0,0,0,0);
285}
#define pINFO
Definition Messenger.h:62
#define pFATAL
Definition Messenger.h:56
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
int Pdg(void) const
double Mass(void) const
Mass that corresponds to the PDG code.
int LastDaughter(void) const
double Px(void) const
Get Px.
int Z(void) const
double E(void) const
Get energy.
double Pz(void) const
Get Pz.
double Py(void) const
Get Py.
int A(void) const
int FirstDaughter(void) const
virtual GHepParticle * TargetNucleus(void) const
virtual void AddParticle(const GHepParticle &p)
virtual int TargetNucleusPosition(void) const
virtual GHepParticle * Particle(int position) const
static PDGLibrary * Instance(void)
TParticlePDG * Find(int pdgc, bool must_exist=true)
int IonPdgCode(int A, int Z)
Definition PDGUtils.cxx:71
bool IsProton(int pdgc)
Definition PDGUtils.cxx:336
bool IsNeutron(int pdgc)
Definition PDGUtils.cxx:341
@ kIStStableFinalState
Definition GHepStatus.h:30

References genie::GHepParticle::A(), genie::GHepRecord::AddParticle(), genie::GHepParticle::E(), genie::PDGLibrary::Find(), genie::GHepParticle::FirstDaughter(), genie::PDGLibrary::Instance(), genie::pdg::IonPdgCode(), genie::pdg::IsNeutron(), genie::pdg::IsProton(), genie::kIStStableFinalState, genie::GHepParticle::LastDaughter(), LOG, genie::GHepParticle::Mass(), genie::GHepRecord::Particle(), genie::GHepParticle::Pdg(), pFATAL, pINFO, genie::GHepParticle::Px(), genie::GHepParticle::Py(), genie::GHepParticle::Pz(), genie::GHepRecord::TargetNucleus(), genie::GHepRecord::TargetNucleusPosition(), and genie::GHepParticle::Z().

Referenced by ProcessEventRecord().

◆ Configure() [1/2]

void FermiMover::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 287 of file FermiMover.cxx.

288{
289 Algorithm::Configure(config);
290 this->LoadConfig();
291}
virtual void Configure(const Registry &config)
Definition Algorithm.cxx:62
void LoadConfig(void)

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

◆ Configure() [2/2]

void FermiMover::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 293 of file FermiMover.cxx.

294{
295 Algorithm::Configure(config);
296 this->LoadConfig();
297}

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

◆ KickHitNucleon()

void FermiMover::KickHitNucleon ( GHepRecord * evrec) const
private

give hit nucleon a momentum

Definition at line 100 of file FermiMover.cxx.

101{
102 Interaction * interaction = evrec -> Summary();
103 InitialState * init_state = interaction -> InitStatePtr();
104 Target * tgt = init_state -> TgtPtr();
105
106 // do nothing for non-nuclear targets
107 if(!tgt->IsNucleus()) return;
108
109 TLorentzVector * p4 = tgt->HitNucP4Ptr();
110
111 // do nothing if the struct nucleon 4-momentum was set (eg as part of the
112 // initial state selection)
113 if(p4->Px()>0 || p4->Py()>0 || p4->Pz()>0) return;
114
115 // access the hit nucleon and target nucleus at the GHEP record
116 GHepParticle * nucleon = evrec->HitNucleon();
117 GHepParticle * nucleus = evrec->TargetNucleus();
118 assert(nucleon);
119 assert(nucleus);
120
121 // generate a Fermi momentum & removal energy
122 // call GenerateNucleon with a radius in case the model is LocalFGM
123 double rad = nucleon->X4()->Vect().Mag();
124 fNuclModel->GenerateNucleon(*tgt,rad);
125
126 TVector3 p3 = fNuclModel->Momentum3();
127 double w = fNuclModel->RemovalEnergy();
128
129 LOG("FermiMover", pINFO)
130 << "Generated nucleon momentum: ("
131 << p3.Px() << ", " << p3.Py() << ", " << p3.Pz() << "), "
132 << "|p| = " << p3.Mag();
133 LOG("FermiMover", pINFO)
134 << "Generated nucleon removal energy: w = " << w;
135
136 double pF2 = p3.Mag2(); // (fermi momentum)^2
137
138 nucleon->SetRemovalEnergy(w);
139
140 // struck nucleon energy:
141 // two possible prescriptions depending on whether you want to force
142 // the sruck nucleon to be on the mass-shell or not...
143
144 double EN=0;
145 FermiMoverInteractionType_t interaction_type = fNuclModel->GetFermiMoverInteractionType();
146
147 // EffectiveSF treatment or momentum-dependent removal energy
148 if (interaction_type == kFermiMoveEffectiveSF1p1h || fMomDepErmv ) {
149 EN = nucleon->Mass() - w - pF2 / (2 * (nucleus->Mass() - nucleon->Mass()));
150 } else if (interaction_type == kFermiMoveEffectiveSF2p2h_eject ||
151 interaction_type == kFermiMoveEffectiveSF2p2h_noeject) {
152
153 int other_nucleon_pdg = nucleon->Pdg() == kPdgProton ? kPdgNeutron : kPdgProton ;
154 TParticlePDG * other_nucleon = PDGLibrary::Instance()->Find( other_nucleon_pdg );
155
156 TParticlePDG * deuteron = PDGLibrary::Instance()->Find(1000010020);
157 EN = deuteron->Mass() - 2 * w - TMath::Sqrt(pF2 + other_nucleon->Mass() * other_nucleon->Mass());
158
159 // Do default Fermi Moving
160 } else {
162 //-- compute A,Z for final state nucleus & get its PDG code
163 int nucleon_pdgc = nucleon->Pdg();
164 bool is_p = pdg::IsProton(nucleon_pdgc);
165 int Z = (is_p) ? nucleus->Z()-1 : nucleus->Z();
166 int A = nucleus->A() - 1;
167
168 TParticlePDG * fnucleus = 0;
169 int ipdgc = pdg::IonPdgCode(A, Z);
170 fnucleus = PDGLibrary::Instance()->Find(ipdgc);
171 if(!fnucleus) {
172 LOG("FermiMover", pFATAL)
173 << "No particle with [A = " << A << ", Z = " << Z
174 << ", pdgc = " << ipdgc << "] in PDGLibrary!";
175 exit(1);
176 }
177 //-- compute the energy of the struck (off the mass-shell) nucleus
178
179 double Mf = fnucleus -> Mass(); // remnant nucleus mass
180 double Mi = nucleus -> Mass(); // initial nucleus mass
181
182 EN = Mi - TMath::Sqrt(pF2 + Mf*Mf);
183 } else {
184 double MN = nucleon->Mass();
185 double MN2 = TMath::Power(MN,2);
186 EN = TMath::Sqrt(MN2+pF2);
187 }
188
189 }
190
191 //-- update the struck nucleon 4p at the interaction summary and at
192 // the GHEP record
193 p4->SetPx( p3.Px() );
194 p4->SetPy( p3.Py() );
195 p4->SetPz( p3.Pz() );
196 p4->SetE ( EN );
197
198 nucleon->SetMomentum(*p4); // update GHEP value
199
200 // Sometimes, for interactions near threshold, Fermi momentum might bring
201 // the neutrino energy in the nucleon rest frame below threshold (for the
202 // selected interaction). In this case mark the event as unphysical and
203 // abort the current thread.
204 const KPhaseSpace & kps = interaction->PhaseSpace();
205 if(!kps.IsAboveThreshold()) {
206 LOG("FermiMover", pNOTICE)
207 << "Event below threshold after generating Fermi momentum";
208
209 double Ethr = kps.Threshold();
210 double Ev = init_state->ProbeE(kRfHitNucRest);
211 LOG("FermiMover", pNOTICE)
212 << "Ev (@ nucleon rest frame) = " << Ev << ", Ethr = " << Ethr;
213
214 evrec->EventFlags()->SetBitNumber(kBelowThrNRF, true);
215 genie::exceptions::EVGThreadException exception;
216 exception.SetReason("E < Ethr after generating nucleon Fermi momentum");
217 exception.SwitchOnFastForward();
218 throw exception;
219 }
220
221
222}
#define pNOTICE
Definition Messenger.h:61
const NuclearModelI * fNuclModel
nuclear model
Definition FermiMover.h:60
bool fKeepNuclOnMassShell
keep hit bound nucleon on the mass shell?
Definition FermiMover.h:58
bool fMomDepErmv
use momentum dependent calculation of Ermv
Definition FermiMover.h:59
void SetMomentum(const TLorentzVector &p4)
void SetRemovalEnergy(double Erm)
const TLorentzVector * X4(void) const
virtual TBits * EventFlags(void) const
Definition GHepRecord.h:117
virtual GHepParticle * HitNucleon(void) const
double ProbeE(RefFrame_t rf) const
const KPhaseSpace & PhaseSpace(void) const
Definition Interaction.h:73
double Threshold(void) const
Energy threshold.
bool IsAboveThreshold(void) const
Checks whether the interaction is above the energy threshold.
TLorentzVector * HitNucP4Ptr(void) const
Definition Target.cxx:247
bool IsNucleus(void) const
Definition Target.cxx:272
double Mass(Resonance_t res)
resonance mass (GeV)
enum genie::EFermiMoverInteractionType FermiMoverInteractionType_t
const int kPdgProton
Definition PDGCodes.h:81
const int kPdgNeutron
Definition PDGCodes.h:83
@ kRfHitNucRest
Definition RefFrame.h:30
@ kBelowThrNRF
Definition GHepFlags.h:29
@ kFermiMoveEffectiveSF2p2h_noeject
@ kFermiMoveEffectiveSF2p2h_eject
@ kFermiMoveEffectiveSF1p1h

References genie::GHepParticle::A(), genie::GHepRecord::EventFlags(), genie::PDGLibrary::Find(), fKeepNuclOnMassShell, fMomDepErmv, fNuclModel, genie::GHepRecord::HitNucleon(), genie::Target::HitNucP4Ptr(), genie::PDGLibrary::Instance(), genie::pdg::IonPdgCode(), genie::KPhaseSpace::IsAboveThreshold(), genie::Target::IsNucleus(), genie::pdg::IsProton(), genie::kBelowThrNRF, genie::kFermiMoveEffectiveSF1p1h, genie::kFermiMoveEffectiveSF2p2h_eject, genie::kFermiMoveEffectiveSF2p2h_noeject, genie::kPdgNeutron, genie::kPdgProton, genie::kRfHitNucRest, LOG, genie::GHepParticle::Mass(), genie::GHepParticle::Pdg(), pFATAL, genie::Interaction::PhaseSpace(), pINFO, pNOTICE, genie::InitialState::ProbeE(), genie::GHepParticle::SetMomentum(), genie::exceptions::EVGThreadException::SetReason(), genie::GHepParticle::SetRemovalEnergy(), genie::exceptions::EVGThreadException::SwitchOnFastForward(), genie::GHepRecord::TargetNucleus(), genie::KPhaseSpace::Threshold(), genie::GHepParticle::X4(), and genie::GHepParticle::Z().

Referenced by ProcessEventRecord().

◆ LoadConfig()

void FermiMover::LoadConfig ( void )
private

Definition at line 299 of file FermiMover.cxx.

300{
301 RgKey nuclkey = "NuclearModel";
302 fNuclModel = 0;
303 fNuclModel = dynamic_cast<const NuclearModelI *> (this->SubAlg(nuclkey));
304 assert(fNuclModel);
305
306 this->GetParamDef("KeepHitNuclOnMassShell", fKeepNuclOnMassShell, false);
307
308 bool mom_dep_energy_removal_def = false;
309 this->GetParamDef("LFG-MomentumDependentErmv", mom_dep_energy_removal_def, false ) ;
310 // it defaults to whatever the nuclear model sets. Since only the LFG has this option
311 // this simple search is enough.
312
313 this->GetParamDef("MomentumDependentErmv", fMomDepErmv, mom_dep_energy_removal_def);
314
315 RgKey nuclearrecoilkey = "SecondNucleonEmitter" ;
316 fSecondEmitter = dynamic_cast<const SecondNucleonEmissionI *> (this->SubAlg(nuclearrecoilkey));
317
318 assert(fSecondEmitter);
319
320}
string RgKey
bool GetParamDef(const RgKey &name, T &p, const T &def) const
const Algorithm * SubAlg(const RgKey &registry_key) const
const SecondNucleonEmissionI * fSecondEmitter
Definition FermiMover.h:62

References fKeepNuclOnMassShell, fMomDepErmv, fNuclModel, fSecondEmitter, genie::Algorithm::GetParamDef(), and genie::Algorithm::SubAlg().

Referenced by Configure(), and Configure().

◆ ProcessEventRecord()

void FermiMover::ProcessEventRecord ( GHepRecord * event_rec) const
virtual

Implements genie::EventRecordVisitorI.

Definition at line 82 of file FermiMover.cxx.

83{
84 // skip if not a nuclear target
85 if(! evrec->Summary()->InitState().Tgt().IsNucleus()) return;
86
87 // skip if no hit nucleon is set
88 if(! evrec->HitNucleon()) return;
89
90 // give hit nucleon a Fermi momentum
91 this->KickHitNucleon(evrec);
92
93 // handle the addition of the recoil nucleon
95
96 // add a recoiled nucleus remnant
97 this->AddTargetNucleusRemnant(evrec);
98}
void ProcessEventRecord(GHepRecord *event_rec) const
void KickHitNucleon(GHepRecord *evrec) const
give hit nucleon a momentum
void AddTargetNucleusRemnant(GHepRecord *evrec) const
add a recoiled nucleus remnant

References AddTargetNucleusRemnant(), fSecondEmitter, genie::GHepRecord::HitNucleon(), genie::Interaction::InitState(), genie::Target::IsNucleus(), KickHitNucleon(), ProcessEventRecord(), genie::GHepRecord::Summary(), and genie::InitialState::Tgt().

Referenced by ProcessEventRecord().

Member Data Documentation

◆ fKeepNuclOnMassShell

bool genie::FermiMover::fKeepNuclOnMassShell
private

keep hit bound nucleon on the mass shell?

Definition at line 58 of file FermiMover.h.

Referenced by KickHitNucleon(), and LoadConfig().

◆ fMomDepErmv

bool genie::FermiMover::fMomDepErmv
private

use momentum dependent calculation of Ermv

Definition at line 59 of file FermiMover.h.

Referenced by KickHitNucleon(), and LoadConfig().

◆ fNuclModel

const NuclearModelI* genie::FermiMover::fNuclModel
private

nuclear model

Definition at line 60 of file FermiMover.h.

Referenced by KickHitNucleon(), and LoadConfig().

◆ fSecondEmitter

const SecondNucleonEmissionI* genie::FermiMover::fSecondEmitter
private

Definition at line 62 of file FermiMover.h.

Referenced by LoadConfig(), and ProcessEventRecord().


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