GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HEDISGenerator.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  or see $GENIE/LICENSE
6 
7  Author: Alfonso Garcia <alfonsog \at nikhef.nl>
8  NIKHEF
9 
10  For the class documentation see the corresponding header file.
11 
12 */
13 //____________________________________________________________________________
14 
23 
24 #include <RVersion.h>
25 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,6)
26 #include <TMCParticle.h>
27 #else
28 #include <TMCParticle6.h>
29 #endif
30 
31 using namespace genie;
32 using namespace genie::utils::math;
33 
34 //___________________________________________________________________________
36 HadronicSystemGenerator("genie::HEDISGenerator")
37 {
38  this->Initialize();
39 }
40 //___________________________________________________________________________
42 HadronicSystemGenerator("genie::HEDISGenerator", config)
43 {
44  this->Initialize();
45 }
46 //___________________________________________________________________________
48 {
49 
50 }
51 //____________________________________________________________________________
53 {
54 
55 }
56 //___________________________________________________________________________
58 {
59 // This method generates the final state hadronic system
60 
61  //-- Add the target remnant
62  this->AddTargetNucleusRemnant(evrec);
63  GHepParticle * target = evrec -> TargetNucleus();
64  if(target) evrec->Particle(evrec->RemnantNucleusPosition())->SetStatus(kIStFinalStateNuclearRemnant);
65 
66  //-- Add the primary lepton
67  this->AddPrimaryLepton(evrec);
68 
69  //-- Run the hadronization model and get the fragmentation products
71 
72 }
73 //___________________________________________________________________________
75 {
76 
77  Interaction * interaction = evrec->Summary();
78 
79  // Neutrino 4p
80  LongLorentzVector p4v( * evrec->Probe()->P4() );
81  LOG("HEDISGenerator", pINFO) << "NEUTRINO @ LAB' => E = " << p4v.E() << " // m = " << p4v.M() << " // p = " << p4v.P();
82  LOG("HEDISGenerator", pINFO) << " dir = " << p4v.Dx() << " , " << p4v.Dy() << " , " << p4v.Dz();
83 
84  // Look-up selected kinematics & other needed kinematical params
85  long double Q2 = interaction->Kine().Q2(true);
86  long double y = interaction->Kine().y(true);
87  long double Ev = p4v.E();
88  long double ml = interaction->FSPrimLepton()->Mass();
89  long double ml2 = powl(ml,2);
90 
91  // Compute the final state primary lepton energy and momentum components
92  // along and perpendicular the neutrino direction
93  long double El = (1-y)*Ev;
94  long double plp = El - 0.5*(Q2+ml2)/Ev; // p(//)
95  long double plt = sqrtl(fmaxl(0.,El*El-plp*plp-ml2)); // p(-|)
96  // Randomize transverse components
98  long double phi = 2 * constants::kPi * rnd->RndLep().Rndm();
99  long double pltx = plt * cosl(phi);
100  long double plty = plt * sinl(phi);
101 
102  // Lepton 4-momentum in the LAB frame
103  LongLorentzVector p4llong( pltx, plty, plp, El );
104  p4llong.Rotate(p4v);
105  LOG("HEDISGenerator", pINFO) << "LEPTON @ LAB' => E = " << p4llong.E() << " // m = " << p4llong.M() << " // p = " << p4llong.P();
106  LOG("HEDISGenerator", pINFO) << " dir = " << p4llong.Dx() << " , " << p4llong.Dy() << " , " << p4llong.Dz();
107 
108  // Translate from long double to double
109  TLorentzVector p4l( (double)p4llong.Px(), (double)p4llong.Py(), (double)p4llong.Pz(), (double)p4llong.E() );
110 
111  // Add lepton to EventRecord
112  int pdgl = interaction->FSPrimLepton()->PdgCode();
113  evrec->AddParticle(pdgl, kIStStableFinalState, evrec->ProbePosition(),-1,-1,-1, p4l, *(evrec->Probe()->X4()));
114  evrec->Summary()->KinePtr()->SetFSLeptonP4(p4l);
115 
116 }
117 //___________________________________________________________________________
119 {
120  Algorithm::Configure(config);
121  this->LoadConfig();
122 }
123 //____________________________________________________________________________
124 void HEDISGenerator::Configure(string config)
125 {
126  Algorithm::Configure(config);
127  this->LoadConfig();
128 }
129 //____________________________________________________________________________
131 {
133 
134  //-- Get the requested hadronization model
136  dynamic_cast<const EventRecordVisitorI *> (this->SubAlg("Hadronizer"));
137  assert(fHadronizationModel);
138 
139 }
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
void AddPrimaryLepton(GHepRecord *evrec) const
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
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:78
Kinematics * KinePtr(void) const
Definition: Interaction.h:76
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the &#39;Visito...
virtual int RemnantNucleusPosition(void) const
Definition: GHepRecord.cxx:397
void AddTargetNucleusRemnant(GHepRecord *event_rec) const
void ProcessEventRecord(GHepRecord *evrec) const
void Initialize(void) const
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
virtual void ProcessEventRecord(GHepRecord *event_rec) const =0
void SetFSLeptonP4(const TLorentzVector &p4)
Definition: Kinematics.cxx:297
const Kinematics & Kine(void) const
Definition: Interaction.h:71
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
#define pINFO
Definition: Messenger.h:62
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
const EventRecordVisitorI * fHadronizationModel
const TLorentzVector * X4(void) const
Definition: GHepParticle.h:79
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:65
virtual void AddParticle(const GHepParticle &p)
Definition: GHepRecord.cxx:499
Abstract class. Is used to pass some commonly recurring methods to all concrete implementations of th...
double Q2(bool selected=false) const
Definition: Kinematics.cxx:125
virtual int ProbePosition(void) const
Definition: GHepRecord.cxx:352
void Rotate(LongLorentzVector axis)
Definition: MathUtils.h:68
GENIE&#39;s GHEP MC event record.
Definition: GHepRecord.h:45
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
void Configure(const Registry &config)
const Algorithm * SubAlg(const RgKey &registry_key) const
Definition: Algorithm.cxx:345