GENIEGenerator
Loading...
Searching...
No Matches
HadronicSystemGenerator.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*
3 Copyright (c) 2003-2025, The GENIE Collaboration
4 For the full text of the license visit http://copyright.genie-mc.org
5
6 Costas Andreopoulos <c.andreopoulos \at cern.ch>
7 University of Liverpool
8*/
9//____________________________________________________________________________
10
21
22using namespace genie;
23using namespace genie::utils::print;
24
25//___________________________________________________________________________
31//___________________________________________________________________________
37//___________________________________________________________________________
43//___________________________________________________________________________
48//___________________________________________________________________________
50{
51// Adds a GHEP entry for the sum of the f/s hadronic system.
52// Intended for DIS hadronic system generators.
53
54 TLorentzVector p4 = this->Hadronic4pLAB(evrec);
55 LOG("HadronicVtx", pNOTICE) << "\n HadrSyst [LAB]: " << P4AsString(&p4);
56
57 TLorentzVector v4(0,0,0,0);
58 int mom = evrec->HitNucleonPosition();
59
60 evrec->AddParticle(
61 kPdgHadronicSyst, kIStDISPreFragmHadronicState, mom,-1,-1,-1, p4, v4);
62
63 // update the interaction summary
64 evrec->Summary()->KinePtr()->SetHadSystP4(p4);
65}
66//___________________________________________________________________________
68 GHepRecord * evrec) const
69{
70// add the remnant nuclear target at the GHEP record
71
72 LOG("HadronicVtx", pDEBUG) << "Adding final state nucleus";
73
74 //-- skip for non nuclear targets
75 GHepParticle * nucleus = evrec->TargetNucleus();
76 if (!nucleus) {
77 LOG("HadronicVtx", pDEBUG)
78 << "Initial state not a nucleus - no remnant nucleus to add";
79 return;
80 }
81
82 //-- compute A,Z for final state nucleus & get its PDG code and its mass
83 GHepParticle * nucleon = evrec->HitNucleon();
84 assert(nucleon);
85 int npdgc = nucleon->Pdg();
86 bool is_p = pdg::IsProton(npdgc);
87 int A = nucleus->A();
88 int Z = nucleus->Z();
89 if (is_p) Z--;
90 A--;
91 TParticlePDG * particle = 0;
92 int ipdgc = pdg::IonPdgCode(A, Z);
93 particle = PDGLibrary::Instance()->Find(ipdgc);
94 if(!particle) {
95 LOG("HadronicVtx", pFATAL)
96 << "No particle with [A = " << A << ", Z = " << Z
97 << ", pdgc = " << ipdgc << "] in PDGLibrary!";
98 assert(particle);
99 }
100 double Mf = particle->Mass(); // remnant nucleus rest mass
101 double Mf2 = TMath::Power(Mf,2);
102
103 //-- Has opposite momentum from the struck nucleon
104 double px = -1.* nucleon->Px();
105 double py = -1.* nucleon->Py();
106 double pz = -1.* nucleon->Pz();
107 double E = TMath::Sqrt(Mf2 + nucleon->P4()->Vect().Mag2());
108
109 //-- Add the nucleus to the event record
110 LOG("HadronicVtx", pINFO)
111 << "Adding nucleus [A = " << A << ", Z = " << Z
112 << ", pdgc = " << ipdgc << "]";
113
114 int mom = evrec->TargetNucleusPosition();
115 evrec->AddParticle(
116 ipdgc,kIStStableFinalState, mom,-1,-1,-1, px,py,pz,E, 0,0,0,0);
117}
118//___________________________________________________________________________
120 GHepRecord * evrec) const
121{
122 if(fPreINukeDecayer) {
123 fPreINukeDecayer->ProcessEventRecord(evrec);
124 }
125}
126//___________________________________________________________________________
128 GHepRecord * evrec) const
129{
130// Returns the final state hadronic system 4-p in LAB
131
132 GHepParticle * nu = evrec->Probe(); // incoming v
133 GHepParticle * N = evrec->HitNucleon(); // struck nucleon
134 GHepParticle * l = evrec->FinalStatePrimaryLepton(); // f/s primary lepton
135
136 assert(nu);
137 assert(N);
138 assert(l);
139
140 LOG("HadronicVtx", pINFO)
141 << "\n v [LAB]: " << P4AsString( nu->P4() )
142 << "\n N [LAB]: " << P4AsString( N->P4() )
143 << "\n l [LAB]: " << P4AsString( l->P4() );
144
145 //-- Compute the Final State Hadronic System 4p (PX = Pv + PN - Pl)
146
147 const TLorentzVector & p4nu = *(nu->P4());
148 const TLorentzVector & p4N = *(N ->P4());
149 const TLorentzVector & p4l = *(l ->P4());
150
151 TLorentzVector pX4 = p4nu + p4N - p4l;
152
153 LOG("HadronicVtx", pINFO) << "\n HadrSyst [LAB]: " << P4AsString(&pX4);
154
155 return pX4;
156}
157//___________________________________________________________________________
159 GHepRecord * evrec) const
160{
161 GHepParticle * nu = evrec->Probe(); // incoming v
162 GHepParticle * l = evrec->FinalStatePrimaryLepton(); // f/s primary lepton
163
164 assert(nu);
165 assert(l);
166
167 const TLorentzVector & p4nu = *(nu->P4());
168 const TLorentzVector & p4l = *(l ->P4());
169
170 TLorentzVector pq4 = p4nu - p4l; // q
171
172 LOG("HadronicVtx", pNOTICE)
173 << "\n Momentum Transfer [LAB]: " << P4AsString(&pq4);
174 return pq4;
175}
176//___________________________________________________________________________
178{
179// Velocity for the Hadronic CM -> LAB active Lorentz transform
180
181 TLorentzVector pH = this->Hadronic4pLAB(evrec);
182
183 //-- Compute the velocity of the LAB frame in the Final State Hadronic
184 // CM Frame (PxH/EH, PyH/EH, PzH/EH)
185
186 TVector3 beta = pH.BoostVector();
187
188 LOG("HadronicVtx", pINFO) << "beta (HCM->LAB): " << Vec3AsString(&beta);
189
190 return beta;
191}
192//___________________________________________________________________________
194{
195// Returns the hadron shower charge in units of +e
196// eg in v n -> l- X the hadron shower charge is +1
197
198 int hadronShowerCharge = 0;
199
200 Interaction * interaction = evrec->Summary();
201 const InitialState & init_state = interaction->InitState();
202
203 int hit_nucleon = init_state.Tgt().HitNucPdg();
204
205 assert( pdg::IsProton(hit_nucleon) || pdg::IsNeutron(hit_nucleon) );
206
207 double qfsl = interaction->FSPrimLepton()->Charge() / 3.;
208 double qp = interaction->InitState().Probe()->Charge() / 3.;
209 double qnuc = PDGLibrary::Instance()->Find(hit_nucleon)->Charge() / 3.;
210
211 // probe + nucleon - primary final state lepton
212 hadronShowerCharge = (int) (qp + qnuc - qfsl);
213
214 return hadronShowerCharge;
215}
216//____________________________________________________________________________
218{
219 return this->HadronShowerCharge(evrec);
220}
221//____________________________________________________________________________
#define pNOTICE
Definition Messenger.h:61
#define pINFO
Definition Messenger.h:62
#define pFATAL
Definition Messenger.h:56
#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
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.
int Pdg(void) const
const TLorentzVector * P4(void) const
double Px(void) const
Get Px.
int Z(void) const
double Pz(void) const
Get Pz.
double Py(void) const
Get Py.
int A(void) const
GENIE's GHEP MC event record.
Definition GHepRecord.h:45
virtual GHepParticle * Probe(void) const
virtual GHepParticle * TargetNucleus(void) const
virtual Interaction * Summary(void) const
virtual void AddParticle(const GHepParticle &p)
virtual int TargetNucleusPosition(void) const
virtual GHepParticle * FinalStatePrimaryLepton(void) const
virtual int HitNucleonPosition(void) const
virtual GHepParticle * HitNucleon(void) const
TVector3 HCM2LAB(GHepRecord *event_rec) const
void PreHadronTransportDecays(GHepRecord *event_rec) const
int HadronShowerCharge(GHepRecord *event_rec) const
void AddFinalHadronicSyst(GHepRecord *event_rec) const
TLorentzVector MomentumTransferLAB(GHepRecord *event_rec) const
const EventRecordVisitorI * fPreINukeDecayer
void AddTargetNucleusRemnant(GHepRecord *event_rec) const
TLorentzVector Hadronic4pLAB(GHepRecord *event_rec) const
int ResonanceCharge(GHepRecord *event_rec) const
Initial State information.
const Target & Tgt(void) const
TParticlePDG * Probe(void) const
Summary information for an interaction.
Definition Interaction.h:56
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
const InitialState & InitState(void) const
Definition Interaction.h:69
Kinematics * KinePtr(void) const
Definition Interaction.h:76
void SetHadSystP4(const TLorentzVector &p4)
static PDGLibrary * Instance(void)
TParticlePDG * Find(int pdgc, bool must_exist=true)
int HitNucPdg(void) const
Definition Target.cxx:304
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
Simple functions for loading and reading nucleus dependent keys from config files.
Simple printing utilities.
string Vec3AsString(const TVector3 *vec)
string P4AsString(const TLorentzVector *p)
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25
@ kIStDISPreFragmHadronicState
Definition GHepStatus.h:35
@ kIStStableFinalState
Definition GHepStatus.h:30
const int kPdgHadronicSyst
Definition PDGCodes.h:210