GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HENuElGenerator.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2024, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Alfonso Garcia <aagarciasoto \at km3net.de>
7  IFIC & Harvard University
8 */
9 //____________________________________________________________________________
10 
11 #include <cstring>
12 
13 #include <RVersion.h>
14 #include <TClonesArray.h>
15 #include <TMath.h>
16 
30 
31 #ifdef __GENIE_PYTHIA6_ENABLED__
32 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,6)
33 #include <TMCParticle.h>
34 #else
35 #include <TMCParticle6.h>
36 #endif
37 #endif // __GENIE_PYTHIA6_ENABLED__
38 
39 using namespace genie;
40 using namespace genie::constants;
41 using namespace genie::utils::math;
42 
43 //___________________________________________________________________________
45 EventRecordVisitorI("genie::HENuElGenerator")
46 {
47  born = new Born();
48 }
49 //___________________________________________________________________________
51 EventRecordVisitorI("genie::HENuElGenerator", config)
52 {
53 
54 }
55 //___________________________________________________________________________
57 {
58 
59 }
60 //___________________________________________________________________________
62 {
63 
64  Interaction * interaction = event->Summary();
65  const InitialState & init_state = interaction->InitState();
66  const ProcessInfo & proc_info = interaction->ProcInfo();
67 
68  //incoming v & struck particle & remnant nucleus
69  GHepParticle * nu = event->Probe();
70 
71  GHepParticle * target = event -> TargetNucleus();
72  if(target) event->AddParticle(target->Pdg(), kIStFinalStateNuclearRemnant, 1,-1,-1,-1, *(target->P4()), *(target->X4()) );
73 
74  TVector3 unit_nu = nu->P4()->Vect().Unit();
75 
76  bool isCC = proc_info.IsWeakCC();
77 
78  long double mlout = interaction->FSPrimLepton()->Mass(); //mass of charged lepton
79  long double mlin = kElectronMass; //mass of incoming charged lepton
80 
81  long double Enuin = init_state.ProbeE(kRfLab);
82  long double s = born->GetS(mlin,Enuin);
83 
84  long double n1 = interaction->Kine().GetKV(kKVn1);
85  long double n2 = interaction->Kine().GetKV(kKVn2);
86 
87  long double costhCM = n1;
88  long double sinthCM = sqrtl(1-costhCM*costhCM);
89 
90  long double t = born->GetT( mlin, mlout, s, n1 );
91  long double zeta = born->GetReAlpha()/kPi*(2.0*logl(sqrtl(-t)/kElectronMass)-1.0);
92  long double omx = powl(n2, 1.0/zeta );
93  long double s_r = s*( 1.-omx );
94 
95  // Boost velocity CM -> LAB
96  long double EnuinCM = (s_r-mlin*mlin)/sqrtl(s_r)/2.;
97  long double beta = (powl(Enuin,2)-powl(EnuinCM,2))/(powl(Enuin,2)+powl(EnuinCM,2));
98 
99  // Final state primary lepton PDG code
100  int pdgl = interaction->FSPrimLeptonPdg();
101  assert(pdgl!=0);
102 
103  long double ElpoutCM = (s_r+mlout*mlout)/sqrtl(s_r)/2.;
104  long double EnuoutCM = (s_r-mlout*mlout)/sqrtl(s_r)/2.;
105  LongLorentzVector p4_lpout( 0., EnuoutCM*sinthCM, EnuoutCM*costhCM, ElpoutCM );
106  LongLorentzVector p4_nuout( 0., -EnuoutCM*sinthCM, -EnuoutCM*costhCM, EnuoutCM );
107 
108  p4_lpout.BoostZ(beta);
109  p4_nuout.BoostZ(beta);
110 
111  TLorentzVector p4lp_o( (double)p4_lpout.Px(), (double)p4_lpout.Py(), (double)p4_lpout.Pz(), (double)p4_lpout.E() );
112  TLorentzVector p4nu_o( (double)p4_nuout.Px(), (double)p4_nuout.Py(), (double)p4_nuout.Pz(), (double)p4_nuout.E() );
113 
114  // Randomize transverse components
115  RandomGen * rnd = RandomGen::Instance();
116  double phi = 2* kPi * rnd->RndLep().Rndm();
117  p4lp_o.RotateZ(phi);
118  p4nu_o.RotateZ(phi);
119 
120  //rotate from LAB=[0,0,Ev,Ev]->[px,py,pz,E]
121  p4lp_o.RotateUz(unit_nu);
122  p4nu_o.RotateUz(unit_nu);
123 
124  int pdgvout = 0;
125  if (isCC) pdgvout = kPdgNuE;
126  else pdgvout = nu->Pdg();
127 
128  // Create a GHepParticle and add it to the event record
129  event->AddParticle( pdgl, kIStStableFinalState, 4, -1, -1, -1, p4lp_o, *(nu->X4()) );
130  event->AddParticle( pdgvout, kIStStableFinalState, 4, -1, -1, -1, p4nu_o, *(nu->X4()) );
131  event->Summary()->KinePtr()->SetFSLeptonP4(p4lp_o);
132 
133 }
134 //___________________________________________________________________________
136 {
137  Algorithm::Configure(config);
138  this->LoadConfig();
139 }
140 //____________________________________________________________________________
141 void HENuElGenerator::Configure(string config)
142 {
143  Algorithm::Configure(config);
144  this->LoadConfig();
145 }
146 //____________________________________________________________________________
148 {
149 
150 
151 }
152 //____________________________________________________________________________
bool IsWeakCC(void) const
const int kPdgNuE
Definition: PDGCodes.h:28
double GetT(double mlin, double mlout, double s, double costhCM)
Definition: Born.cxx:200
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:71
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:78
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the &#39;Visito...
static constexpr double s
Definition: Units.h:95
void Configure(const Registry &config)
static const double kElectronMass
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:29
int FSPrimLeptonPdg(void) const
final state primary lepton pdg
double GetReAlpha(void)
Definition: Born.h:32
int Pdg(void) const
Definition: GHepParticle.h:63
Summary information for an interaction.
Definition: Interaction.h:56
A class encapsulating an enumeration of interaction types (EM, Weak-CC, Weak-NC) and scattering types...
Definition: ProcessInfo.h:46
const Kinematics & Kine(void) const
Definition: Interaction.h:71
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
double GetKV(KineVar_t kv) const
Definition: Kinematics.cxx:323
double GetS(double mlin, double Enuin)
Definition: Born.cxx:195
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
Born level nu-electron cross section.
Definition: Born.h:26
void ProcessEventRecord(GHepRecord *event) const
const TLorentzVector * X4(void) const
Definition: GHepParticle.h:79
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:65
const InitialState & InitState(void) const
Definition: Interaction.h:69
const ProcessInfo & ProcInfo(void) const
Definition: Interaction.h:70
double ProbeE(RefFrame_t rf) const
GENIE&#39;s GHEP MC event record.
Definition: GHepRecord.h:45
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
Initial State information.
Definition: InitialState.h:48