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

Abstract class. Is used to pass common implementation to concrete implementations of the EventRecordVisitorI interface generating the primary lepton for a specific processes (QEL,DIS,RES,IMD,...) More...

#include <PrimaryLeptonGenerator.h>

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

Public Member Functions

virtual void ProcessEventRecord (GHepRecord *evrec) const
virtual void SetPolarization (GHepRecord *ev) const
virtual TVector3 NucRestFrame2Lab (GHepRecord *ev) const
virtual void AddToEventRecord (GHepRecord *ev, int pdgc, const TLorentzVector &p4) 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.

Protected Member Functions

 PrimaryLeptonGenerator ()
 PrimaryLeptonGenerator (string name)
 PrimaryLeptonGenerator (string name, string config)
virtual ~PrimaryLeptonGenerator ()
void LoadConfig (void)
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

bool fApplyCoulombCorrection
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)

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)

Detailed Description

Abstract class. Is used to pass common implementation to concrete implementations of the EventRecordVisitorI interface generating the primary lepton for a specific processes (QEL,DIS,RES,IMD,...)

Author
Costas Andreopoulos <c.andreopoulos \at cern.ch> University of Liverpool
Created:\n October 03, 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 30 of file PrimaryLeptonGenerator.h.

Constructor & Destructor Documentation

◆ PrimaryLeptonGenerator() [1/3]

◆ PrimaryLeptonGenerator() [2/3]

PrimaryLeptonGenerator::PrimaryLeptonGenerator ( string name)
protected

Definition at line 40 of file PrimaryLeptonGenerator.cxx.

40 :
42{
43
44}

References genie::EventRecordVisitorI::EventRecordVisitorI().

◆ PrimaryLeptonGenerator() [3/3]

PrimaryLeptonGenerator::PrimaryLeptonGenerator ( string name,
string config )
protected

Definition at line 46 of file PrimaryLeptonGenerator.cxx.

46 :
47EventRecordVisitorI(name, config)
48{
49
50}

References genie::EventRecordVisitorI::EventRecordVisitorI().

◆ ~PrimaryLeptonGenerator()

PrimaryLeptonGenerator::~PrimaryLeptonGenerator ( )
protectedvirtual

Definition at line 52 of file PrimaryLeptonGenerator.cxx.

53{
54
55}

Member Function Documentation

◆ AddToEventRecord()

void PrimaryLeptonGenerator::AddToEventRecord ( GHepRecord * ev,
int pdgc,
const TLorentzVector & p4 ) const
virtual

Definition at line 141 of file PrimaryLeptonGenerator.cxx.

143{
144// Adds the final state primary lepton GHepParticle to the event record.
145// To be called by all concrete PrimaryLeptonGenerators before exiting.
146
147 Interaction * interaction = evrec->Summary();
148
149 GHepParticle * mom = evrec->Probe();
150 int imom = evrec->ProbePosition();
151
152 const TLorentzVector & vtx = *(mom->X4());
153
154 TLorentzVector x4l(vtx); // position 4-vector
155 TLorentzVector p4l(p4); // momentum 4-vector
156
157 GHepParticle * nucltgt = evrec->TargetNucleus();
158
159 bool is_ve = interaction->ProcInfo().IsInverseMuDecay() ||
160 interaction->ProcInfo().IsIMDAnnihilation() ||
161 interaction->ProcInfo().IsNuElectronElastic();
162
163 bool can_correct = fApplyCoulombCorrection && nucltgt!=0 && !is_ve;
164 if(can_correct) {
165 LOG("LeptonicVertex", pINFO)
166 << "Correcting f/s lepton energy for Coulomb effects";
167
168 double m = interaction->FSPrimLepton()->Mass();
169 double Z = nucltgt->Z();
170 double A = nucltgt->A();
171
172 // charge radius of nucleus in GeV^-1
173 double Rc = (1.1*TMath::Power(A,1./3.) + 0.86*TMath::Power(A,-1./3.))/0.197;
174
175 // shift of lepton energy in homogenous sphere with radius Rc
176 double Vo = 3*kAem*Z/(2*Rc);
177 Vo *= 0.75; // as suggested in R.Gran's note
178
179 double Elo = p4l.Energy();
180 double e = TMath::Min(Vo, Elo-m);
181 double El = TMath::Max(0., Elo-e);
182
183 LOG("LeptonicVertex", pINFO)
184 << "Lepton energy subtraction: E = " << Elo << " --> " << El;
185
186 double pmag_old = p4l.P();
187 double pmag_new = TMath::Sqrt(utils::math::NonNegative(El*El-m*m));
188 double scale = pmag_new / pmag_old;
189 LOG("LeptonicVertex", pDEBUG)
190 << "|pnew| = " << pmag_new << ", |pold| = " << pmag_old
191 << ", scale = " << scale;
192
193 double pxl = scale * p4l.Px();
194 double pyl = scale * p4l.Py();
195 double pzl = scale * p4l.Pz();
196
197 p4l.SetPxPyPzE(pxl,pyl,pzl,El);
198
199 TLorentzVector p4c = p4 - p4l;
200 TLorentzVector x4dummy(0,0,0,0);;
201
202 evrec->AddParticle(
203 kPdgCoulobtron, kIStStableFinalState, -1,-1,-1,-1, p4c, x4dummy);
204 }
205
206 evrec->AddParticle(pdgc, kIStStableFinalState, imom,-1,-1,-1, p4l, x4l);
207
208 // update the interaction summary
209 evrec->Summary()->KinePtr()->SetFSLeptonP4(p4l);
210}
#define pINFO
Definition Messenger.h:62
#define pDEBUG
Definition Messenger.h:63
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
const TLorentzVector * X4(void) const
int Z(void) const
int A(void) const
const ProcessInfo & ProcInfo(void) const
Definition Interaction.h:70
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
bool IsNuElectronElastic(void) const
bool IsInverseMuDecay(void) const
bool IsIMDAnnihilation(void) const
const double e
double NonNegative(double x)
@ kIStStableFinalState
Definition GHepStatus.h:30
const int kPdgCoulobtron
Definition PDGCodes.h:213

References genie::GHepParticle::A(), genie::GHepRecord::AddParticle(), e, fApplyCoulombCorrection, genie::Interaction::FSPrimLepton(), genie::ProcessInfo::IsIMDAnnihilation(), genie::ProcessInfo::IsInverseMuDecay(), genie::ProcessInfo::IsNuElectronElastic(), genie::constants::kAem, genie::Interaction::KinePtr(), genie::kIStStableFinalState, genie::kPdgCoulobtron, LOG, genie::utils::math::NonNegative(), pDEBUG, pINFO, genie::GHepRecord::Probe(), genie::GHepRecord::ProbePosition(), genie::Interaction::ProcInfo(), genie::Kinematics::SetFSLeptonP4(), genie::GHepRecord::Summary(), genie::GHepRecord::TargetNucleus(), genie::GHepParticle::X4(), and genie::GHepParticle::Z().

Referenced by genie::COHPrimaryLeptonGenerator::CalculatePrimaryLepton_AlvarezRuso(), genie::NuEPrimaryLeptonGenerator::ProcessEventRecord(), and ProcessEventRecord().

◆ Configure() [1/2]

void PrimaryLeptonGenerator::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 220 of file PrimaryLeptonGenerator.cxx.

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

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

◆ Configure() [2/2]

void PrimaryLeptonGenerator::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 226 of file PrimaryLeptonGenerator.cxx.

227{
228 Algorithm::Configure(config);
229 this->LoadConfig();
230}

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

◆ LoadConfig()

void PrimaryLeptonGenerator::LoadConfig ( void )
protected

Definition at line 232 of file PrimaryLeptonGenerator.cxx.

233{
234 GetParam( "ApplyCoulombCorrection", fApplyCoulombCorrection ) ;
235
236}
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const

References fApplyCoulombCorrection, and genie::Algorithm::GetParam().

Referenced by Configure(), and Configure().

◆ NucRestFrame2Lab()

TVector3 PrimaryLeptonGenerator::NucRestFrame2Lab ( GHepRecord * ev) const
virtual

Definition at line 127 of file PrimaryLeptonGenerator.cxx.

128{
129// Velocity for an active Lorentz transform taking the final state primary
130// lepton from the [nucleon rest frame] --> [LAB]
131
132 Interaction * interaction = evrec->Summary();
133 const InitialState & init_state = interaction->InitState();
134
135 const TLorentzVector & pnuc4 = init_state.Tgt().HitNucP4(); //[@LAB]
136 TVector3 beta = pnuc4.BoostVector();
137
138 return beta;
139}
const Target & Tgt(void) const
const InitialState & InitState(void) const
Definition Interaction.h:69
const TLorentzVector & HitNucP4(void) const
Definition Target.h:91

References genie::Target::HitNucP4(), genie::Interaction::InitState(), genie::GHepRecord::Summary(), and genie::InitialState::Tgt().

Referenced by ProcessEventRecord().

◆ ProcessEventRecord()

void PrimaryLeptonGenerator::ProcessEventRecord ( GHepRecord * evrec) const
virtual

Implements genie::EventRecordVisitorI.

Reimplemented in genie::COHPrimaryLeptonGenerator, genie::DFRPrimaryLeptonGenerator, genie::DISPrimaryLeptonGenerator, genie::IBDPrimaryLeptonGenerator, genie::NuEPrimaryLeptonGenerator, genie::QELPrimaryLeptonGenerator, genie::RESPrimaryLeptonGenerator, and genie::SKPrimaryLeptonGenerator.

Definition at line 57 of file PrimaryLeptonGenerator.cxx.

58{
59// This method generates the final state primary lepton
60
61 Interaction * interaction = evrec->Summary();
62
63 // Boost vector for [LAB] <-> [Nucleon Rest Frame] transforms
64 TVector3 beta = this->NucRestFrame2Lab(evrec);
65
66 // Neutrino 4p
67 TLorentzVector * p4v = evrec->Probe()->GetP4(); // v 4p @ LAB
68 p4v->Boost(-1.*beta); // v 4p @ Nucleon rest frame
69
70 // Look-up selected kinematics & other needed kinematical params
71 double Q2 = interaction->Kine().Q2(true);
72 double y = interaction->Kine().y(true);
73 double Ev = p4v->E();
74 double ml = interaction->FSPrimLepton()->Mass();
75 double ml2 = TMath::Power(ml,2);
76
77 LOG("LeptonicVertex", pNOTICE)
78 << "Ev = " << Ev << ", Q2 = " << Q2 << ", y = " << y;
79
80 // Compute the final state primary lepton energy and momentum components
81 // along and perpendicular the neutrino direction
82 double El = (1-y)*Ev;
83 double plp = El - 0.5*(Q2+ml2)/Ev; // p(//)
84 double plt = TMath::Sqrt(TMath::Max(0.,El*El-plp*plp-ml2)); // p(-|)
85
86 LOG("LeptonicVertex", pNOTICE)
87 << "fsl: E = " << El << ", |p//| = " << plp << ", [pT] = " << plt;
88
89 // Randomize transverse components
90 RandomGen * rnd = RandomGen::Instance();
91 double phi = 2*kPi * rnd->RndLep().Rndm();
92 double pltx = plt * TMath::Cos(phi);
93 double plty = plt * TMath::Sin(phi);
94
95 // Take a unit vector along the neutrino direction @ the nucleon rest frame
96 TVector3 unit_nudir = p4v->Vect().Unit();
97
98 // Rotate lepton momentum vector from the reference frame (x'y'z') where
99 // {z':(neutrino direction), z'x':(theta plane)} to the nucleon rest frame
100 TVector3 p3l(pltx,plty,plp);
101 p3l.RotateUz(unit_nudir);
102
103 // Lepton 4-momentum in the nucleon rest frame
104 TLorentzVector p4l(p3l,El);
105
106 LOG("LeptonicVertex", pNOTICE)
107 << "fsl @ NRF: " << utils::print::P4AsString(&p4l);
108
109 // Boost final state primary lepton to the lab frame
110 p4l.Boost(beta); // active Lorentz transform
111
112 LOG("LeptonicVertex", pNOTICE)
113 << "fsl @ LAB: " << utils::print::P4AsString(&p4l);
114
115 // Figure out the Final State Lepton PDG Code
116 int pdgc = interaction->FSPrimLepton()->PdgCode();
117
118 // Create a GHepParticle and add it to the event record
119 this->AddToEventRecord(evrec, pdgc, p4l);
120
121 // Set final state lepton polarization
122 this->SetPolarization(evrec);
123
124 delete p4v;
125}
#define pNOTICE
Definition Messenger.h:61
TLorentzVector * GetP4(void) const
virtual GHepParticle * Probe(void) const
virtual Interaction * Summary(void) const
const Kinematics & Kine(void) const
Definition Interaction.h:71
double Q2(bool selected=false) const
double y(bool selected=false) const
virtual TVector3 NucRestFrame2Lab(GHepRecord *ev) const
virtual void SetPolarization(GHepRecord *ev) const
virtual void AddToEventRecord(GHepRecord *ev, int pdgc, const TLorentzVector &p4) const
static RandomGen * Instance()
Access instance.
Definition RandomGen.cxx:74
TRandom3 & RndLep(void) const
rnd number generator used by final state primary lepton generators
Definition RandomGen.h:62
double Q2(const Interaction *const i)
string P4AsString(const TLorentzVector *p)

References AddToEventRecord(), genie::Interaction::FSPrimLepton(), genie::GHepParticle::GetP4(), genie::RandomGen::Instance(), genie::Interaction::Kine(), genie::constants::kPi, LOG, NucRestFrame2Lab(), genie::utils::print::P4AsString(), pNOTICE, genie::GHepRecord::Probe(), genie::Kinematics::Q2(), genie::RandomGen::RndLep(), SetPolarization(), genie::GHepRecord::Summary(), and genie::Kinematics::y().

Referenced by genie::COHPrimaryLeptonGenerator::ProcessEventRecord(), genie::DFRPrimaryLeptonGenerator::ProcessEventRecord(), genie::DISPrimaryLeptonGenerator::ProcessEventRecord(), genie::IBDPrimaryLeptonGenerator::ProcessEventRecord(), genie::QELPrimaryLeptonGenerator::ProcessEventRecord(), genie::RESPrimaryLeptonGenerator::ProcessEventRecord(), and genie::SKPrimaryLeptonGenerator::ProcessEventRecord().

◆ SetPolarization()

void PrimaryLeptonGenerator::SetPolarization ( GHepRecord * ev) const
virtual

Definition at line 212 of file PrimaryLeptonGenerator.cxx.

213{
214 // The default treatment is just to delegate to the utility function.
215 // Derived classes that need a different approach may override this
216 // member function.
218}
void SetPrimaryLeptonPolarization(GHepRecord *ev)

References genie::utils::SetPrimaryLeptonPolarization().

Referenced by genie::COHPrimaryLeptonGenerator::CalculatePrimaryLepton_AlvarezRuso(), genie::NuEPrimaryLeptonGenerator::ProcessEventRecord(), and ProcessEventRecord().

Member Data Documentation

◆ fApplyCoulombCorrection

bool genie::PrimaryLeptonGenerator::fApplyCoulombCorrection
protected

Definition at line 59 of file PrimaryLeptonGenerator.h.

Referenced by AddToEventRecord(), and LoadConfig().


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