GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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:
Inheritance graph
[legend]
Collaboration diagram for genie::PrimaryLeptonGenerator:
Collaboration graph
[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. 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

 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. 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

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

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 cern.ch> University of Liverpool
Created:
October 03, 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 30 of file PrimaryLeptonGenerator.h.

Constructor & Destructor Documentation

PrimaryLeptonGenerator::PrimaryLeptonGenerator ( )
protected

Definition at line 34 of file PrimaryLeptonGenerator.cxx.

34  :
36 {
37 
38 }
PrimaryLeptonGenerator::PrimaryLeptonGenerator ( string  name)
protected

Definition at line 40 of file PrimaryLeptonGenerator.cxx.

40  :
42 {
43 
44 }
const char * name
PrimaryLeptonGenerator::PrimaryLeptonGenerator ( string  name,
string  config 
)
protected

Definition at line 46 of file PrimaryLeptonGenerator.cxx.

46  :
48 {
49 
50 }
const char * name
PrimaryLeptonGenerator::~PrimaryLeptonGenerator ( )
protectedvirtual

Definition at line 52 of file PrimaryLeptonGenerator.cxx.

53 {
54 
55 }

Member Function Documentation

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

Definition at line 141 of file PrimaryLeptonGenerator.cxx.

References genie::units::A, 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::units::m, 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().

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 }
int Z(void) const
bool IsInverseMuDecay(void) const
const int kPdgCoulobtron
Definition: PDGCodes.h:213
bool IsIMDAnnihilation(void) const
Summary information for an interaction.
Definition: Interaction.h:56
const double e
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
bool IsNuElectronElastic(void) const
static constexpr double A
Definition: Units.h:74
#define pINFO
Definition: Messenger.h:62
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
const TLorentzVector * X4(void) const
Definition: GHepParticle.h:79
const ProcessInfo & ProcInfo(void) const
Definition: Interaction.h:70
double NonNegative(double x)
Definition: MathUtils.cxx:273
int A(void) const
static constexpr double m
Definition: Units.h:71
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
#define pDEBUG
Definition: Messenger.h:63
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.

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

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

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

227 {
228  Algorithm::Configure(config);
229  this->LoadConfig();
230 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
void PrimaryLeptonGenerator::LoadConfig ( void  )
protected

Definition at line 232 of file PrimaryLeptonGenerator.cxx.

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

Referenced by Configure().

233 {
234  GetParam( "ApplyCoulombCorrection", fApplyCoulombCorrection ) ;
235 
236 }
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
TVector3 PrimaryLeptonGenerator::NucRestFrame2Lab ( GHepRecord ev) const
virtual

Definition at line 127 of file PrimaryLeptonGenerator.cxx.

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

Referenced by ProcessEventRecord().

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 }
Summary information for an interaction.
Definition: Interaction.h:56
const TLorentzVector & HitNucP4(void) const
Definition: Target.h:91
const InitialState & InitState(void) const
Definition: Interaction.h:69
const Target & Tgt(void) const
Definition: InitialState.h:66
Initial State information.
Definition: InitialState.h:48
void PrimaryLeptonGenerator::ProcessEventRecord ( GHepRecord evrec) const
virtual

Implements genie::EventRecordVisitorI.

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

Definition at line 57 of file PrimaryLeptonGenerator.cxx.

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::utils::kinematics::Q2(), genie::RandomGen::RndLep(), SetPolarization(), genie::GHepRecord::Summary(), and genie::Kinematics::y().

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

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
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 }
TRandom3 & RndLep(void) const
rnd number generator used by final state primary lepton generators
Definition: RandomGen.h:62
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:1077
virtual Interaction * Summary(void) const
Definition: GHepRecord.cxx:91
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:71
string P4AsString(const TLorentzVector *p)
Definition: PrintUtils.cxx:27
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:29
virtual GHepParticle * Probe(void) const
Definition: GHepRecord.cxx:284
double y(bool selected=false) const
Definition: Kinematics.cxx:112
Summary information for an interaction.
Definition: Interaction.h:56
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
TLorentzVector * GetP4(void) const
const Kinematics & Kine(void) const
Definition: Interaction.h:71
virtual TVector3 NucRestFrame2Lab(GHepRecord *ev) const
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
virtual void SetPolarization(GHepRecord *ev) const
double Q2(bool selected=false) const
Definition: Kinematics.cxx:125
#define pNOTICE
Definition: Messenger.h:61
virtual void AddToEventRecord(GHepRecord *ev, int pdgc, const TLorentzVector &p4) const
void PrimaryLeptonGenerator::SetPolarization ( GHepRecord ev) const
virtual

Definition at line 212 of file PrimaryLeptonGenerator.cxx.

References genie::utils::SetPrimaryLeptonPolarization().

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

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)

Member Data Documentation

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: