GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HadronicSystemGenerator.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  Costas Andreopoulos <c.andreopoulos \at cern.ch>
7  University of Liverpool
8 */
9 //____________________________________________________________________________
10 
21 
22 using namespace genie;
23 using namespace genie::utils::print;
24 
25 //___________________________________________________________________________
28 {
29 
30 }
31 //___________________________________________________________________________
34 {
35 
36 }
37 //___________________________________________________________________________
39 EventRecordVisitorI(name, config)
40 {
41 
42 }
43 //___________________________________________________________________________
45 {
46 
47 }
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) {
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 //____________________________________________________________________________
int Z(void) const
TLorentzVector Hadronic4pLAB(GHepRecord *event_rec) const
virtual Interaction * Summary(void) const
Definition: GHepRecord.cxx:91
int HitNucPdg(void) const
Definition: Target.cxx:304
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...
#define pFATAL
Definition: Messenger.h:56
const EventRecordVisitorI * fPreINukeDecayer
void AddTargetNucleusRemnant(GHepRecord *event_rec) const
string P4AsString(const TLorentzVector *p)
Definition: PrintUtils.cxx:27
virtual int HitNucleonPosition(void) const
Definition: GHepRecord.cxx:418
TParticlePDG * Probe(void) const
int HadronShowerCharge(GHepRecord *event_rec) const
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:90
double Px(void) const
Get Px.
Definition: GHepParticle.h:88
virtual GHepParticle * Probe(void) const
Definition: GHepRecord.cxx:284
int Pdg(void) const
Definition: GHepParticle.h:63
bool IsNeutron(int pdgc)
Definition: PDGUtils.cxx:341
Summary information for an interaction.
Definition: Interaction.h:56
bool IsProton(int pdgc)
Definition: PDGUtils.cxx:336
#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
static constexpr double A
Definition: Units.h:74
virtual GHepParticle * FinalStatePrimaryLepton(void) const
Definition: GHepRecord.cxx:333
TLorentzVector MomentumTransferLAB(GHepRecord *event_rec) const
virtual GHepParticle * TargetNucleus(void) const
Definition: GHepRecord.cxx:293
#define pINFO
Definition: Messenger.h:62
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:68
virtual GHepParticle * HitNucleon(void) const
Definition: GHepRecord.cxx:313
int ResonanceCharge(GHepRecord *event_rec) const
int IonPdgCode(int A, int Z)
Definition: PDGUtils.cxx:71
void SetHadSystP4(const TLorentzVector &p4)
Definition: Kinematics.cxx:307
const InitialState & InitState(void) const
Definition: Interaction.h:69
virtual void AddParticle(const GHepParticle &p)
Definition: GHepRecord.cxx:499
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:86
int A(void) const
#define pNOTICE
Definition: Messenger.h:61
const Target & Tgt(void) const
Definition: InitialState.h:66
TVector3 HCM2LAB(GHepRecord *event_rec) const
void AddFinalHadronicSyst(GHepRecord *event_rec) const
const int kPdgHadronicSyst
Definition: PDGCodes.h:210
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
string Vec3AsString(const TVector3 *vec)
Definition: PrintUtils.cxx:80
virtual int TargetNucleusPosition(void) const
Definition: GHepRecord.cxx:370
Initial State information.
Definition: InitialState.h:48
#define pDEBUG
Definition: Messenger.h:63
void PreHadronTransportDecays(GHepRecord *event_rec) const
double Py(void) const
Get Py.
Definition: GHepParticle.h:89