HadronicSystemGenerator.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2019, 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: Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
8  University of Liverpool & STFC Rutherford Appleton Lab
9 
10  For the class documentation see the corresponding header file.
11 
12  Important revisions after version 2.0.0 :
13  @ Oct 20, 2009 - CA
14  Modified HadronShowerCharge() to take into account the probe charge (so as
15  to conserve charge in charged lepton scattering)
16  @ Jul 23, 2010 - CA
17  Moved ResonanceCharge() from utils::res. Identical to HadronShowerCharge()
18  but maintained the method name nevertheless.
19 */
20 //____________________________________________________________________________
21 
32 
33 using namespace genie;
34 using namespace genie::utils::print;
35 
36 //___________________________________________________________________________
39 {
40 
41 }
42 //___________________________________________________________________________
45 {
46 
47 }
48 //___________________________________________________________________________
50 EventRecordVisitorI(name, config)
51 {
52 
53 }
54 //___________________________________________________________________________
56 {
57 
58 }
59 //___________________________________________________________________________
61 {
62 // Adds a GHEP entry for the sum of the f/s hadronic system.
63 // Intended for DIS hadronic system generators.
64 
65  TLorentzVector p4 = this->Hadronic4pLAB(evrec);
66  LOG("HadronicVtx", pNOTICE) << "\n HadrSyst [LAB]: " << P4AsString(&p4);
67 
68  TLorentzVector v4(0,0,0,0);
69  int mom = evrec->HitNucleonPosition();
70 
71  evrec->AddParticle(
72  kPdgHadronicSyst, kIStDISPreFragmHadronicState, mom,-1,-1,-1, p4, v4);
73 
74  // update the interaction summary
75  evrec->Summary()->KinePtr()->SetHadSystP4(p4);
76 }
77 //___________________________________________________________________________
79  GHepRecord * evrec) const
80 {
81 // add the remnant nuclear target at the GHEP record
82 
83  LOG("HadronicVtx", pDEBUG) << "Adding final state nucleus";
84 
85  //-- skip for non nuclear targets
86  GHepParticle * nucleus = evrec->TargetNucleus();
87  if (!nucleus) {
88  LOG("HadronicVtx", pDEBUG)
89  << "Initial state not a nucleus - no remnant nucleus to add";
90  return;
91  }
92 
93  //-- compute A,Z for final state nucleus & get its PDG code and its mass
94  GHepParticle * nucleon = evrec->HitNucleon();
95  assert(nucleon);
96  int npdgc = nucleon->Pdg();
97  bool is_p = pdg::IsProton(npdgc);
98  int A = nucleus->A();
99  int Z = nucleus->Z();
100  if (is_p) Z--;
101  A--;
102  TParticlePDG * particle = 0;
103  int ipdgc = pdg::IonPdgCode(A, Z);
104  particle = PDGLibrary::Instance()->Find(ipdgc);
105  if(!particle) {
106  LOG("HadronicVtx", pFATAL)
107  << "No particle with [A = " << A << ", Z = " << Z
108  << ", pdgc = " << ipdgc << "] in PDGLibrary!";
109  assert(particle);
110  }
111  double Mf = particle->Mass(); // remnant nucleus rest mass
112  double Mf2 = TMath::Power(Mf,2);
113 
114  //-- Has opposite momentum from the struck nucleon
115  double px = -1.* nucleon->Px();
116  double py = -1.* nucleon->Py();
117  double pz = -1.* nucleon->Pz();
118  double E = TMath::Sqrt(Mf2 + nucleon->P4()->Vect().Mag2());
119 
120  //-- Add the nucleus to the event record
121  LOG("HadronicVtx", pINFO)
122  << "Adding nucleus [A = " << A << ", Z = " << Z
123  << ", pdgc = " << ipdgc << "]";
124 
125  int mom = evrec->TargetNucleusPosition();
126  evrec->AddParticle(
127  ipdgc,kIStStableFinalState, mom,-1,-1,-1, px,py,pz,E, 0,0,0,0);
128 }
129 //___________________________________________________________________________
131  GHepRecord * evrec) const
132 {
133  if(fPreINukeDecayer) {
135  }
136 }
137 //___________________________________________________________________________
139  GHepRecord * evrec) const
140 {
141 // Returns the final state hadronic system 4-p in LAB
142 
143  GHepParticle * nu = evrec->Probe(); // incoming v
144  GHepParticle * N = evrec->HitNucleon(); // struck nucleon
145  GHepParticle * l = evrec->FinalStatePrimaryLepton(); // f/s primary lepton
146 
147  assert(nu);
148  assert(N);
149  assert(l);
150 
151  LOG("HadronicVtx", pINFO)
152  << "\n v [LAB]: " << P4AsString( nu->P4() )
153  << "\n N [LAB]: " << P4AsString( N->P4() )
154  << "\n l [LAB]: " << P4AsString( l->P4() );
155 
156  //-- Compute the Final State Hadronic System 4p (PX = Pv + PN - Pl)
157 
158  const TLorentzVector & p4nu = *(nu->P4());
159  const TLorentzVector & p4N = *(N ->P4());
160  const TLorentzVector & p4l = *(l ->P4());
161 
162  TLorentzVector pX4 = p4nu + p4N - p4l;
163 
164  LOG("HadronicVtx", pINFO) << "\n HadrSyst [LAB]: " << P4AsString(&pX4);
165 
166  return pX4;
167 }
168 //___________________________________________________________________________
170  GHepRecord * evrec) const
171 {
172  GHepParticle * nu = evrec->Probe(); // incoming v
173  GHepParticle * l = evrec->FinalStatePrimaryLepton(); // f/s primary lepton
174 
175  assert(nu);
176  assert(l);
177 
178  const TLorentzVector & p4nu = *(nu->P4());
179  const TLorentzVector & p4l = *(l ->P4());
180 
181  TLorentzVector pq4 = p4nu - p4l; // q
182 
183  LOG("HadronicVtx", pNOTICE)
184  << "\n Momentum Transfer [LAB]: " << P4AsString(&pq4);
185  return pq4;
186 }
187 //___________________________________________________________________________
189 {
190 // Velocity for the Hadronic CM -> LAB active Lorentz transform
191 
192  TLorentzVector pH = this->Hadronic4pLAB(evrec);
193 
194  //-- Compute the velocity of the LAB frame in the Final State Hadronic
195  // CM Frame (PxH/EH, PyH/EH, PzH/EH)
196 
197  TVector3 beta = pH.BoostVector();
198 
199  LOG("HadronicVtx", pINFO) << "beta (HCM->LAB): " << Vec3AsString(&beta);
200 
201  return beta;
202 }
203 //___________________________________________________________________________
205 {
206 // Returns the hadron shower charge in units of +e
207 // eg in v n -> l- X the hadron shower charge is +1
208 
209  int hadronShowerCharge = 0;
210 
211  Interaction * interaction = evrec->Summary();
212  const InitialState & init_state = interaction->InitState();
213 
214  int hit_nucleon = init_state.Tgt().HitNucPdg();
215 
216  assert( pdg::IsProton(hit_nucleon) || pdg::IsNeutron(hit_nucleon) );
217 
218  double qfsl = interaction->FSPrimLepton()->Charge() / 3.;
219  double qp = interaction->InitState().Probe()->Charge() / 3.;
220  double qnuc = PDGLibrary::Instance()->Find(hit_nucleon)->Charge() / 3.;
221 
222  // probe + nucleon - primary final state lepton
223  hadronShowerCharge = (int) (qp + qnuc - qfsl);
224 
225  return hadronShowerCharge;
226 }
227 //____________________________________________________________________________
229 {
230  return this->HadronShowerCharge(evrec);
231 }
232 //____________________________________________________________________________
const XML_Char * name
Definition: expat.h:151
int Z(void) const
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
virtual void ProcessEventRecord(GHepRecord *event_rec) const =0
TLorentzVector Hadronic4pLAB(GHepRecord *event_rec) const
virtual Interaction * Summary(void) const
Definition: GHepRecord.cxx:135
int HitNucPdg(void) const
Definition: Target.cxx:321
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:79
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:57
const EventRecordVisitorI * fPreINukeDecayer
void AddTargetNucleusRemnant(GHepRecord *event_rec) const
string P4AsString(const TLorentzVector *p)
Definition: PrintUtils.cxx:34
virtual int HitNucleonPosition(void) const
Definition: GHepRecord.cxx:454
TParticlePDG * Probe(void) const
int HadronShowerCharge(GHepRecord *event_rec) const
Definition: config.py:1
Double_t beta
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:91
double Px(void) const
Get Px.
Definition: GHepParticle.h:89
virtual GHepParticle * Probe(void) const
Definition: GHepRecord.cxx:321
Float_t Z
Definition: plot.C:38
int Pdg(void) const
Definition: GHepParticle.h:64
bool IsNeutron(int pdgc)
Definition: PDGUtils.cxx:304
Summary information for an interaction.
Definition: Interaction.h:56
bool IsProton(int pdgc)
Definition: PDGUtils.cxx:299
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
Float_t E
Definition: plot.C:20
virtual GHepParticle * FinalStatePrimaryLepton(void) const
Definition: GHepRecord.cxx:370
TLorentzVector MomentumTransferLAB(GHepRecord *event_rec) const
virtual GHepParticle * TargetNucleus(void) const
Definition: GHepRecord.cxx:330
#define pINFO
Definition: Messenger.h:63
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
Simple printing utilities.
static const double A
Definition: Units.h:82
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:43
Var Sqrt(const Var &v)
Use to take sqrt of a var.
Definition: Var.cxx:324
virtual GHepParticle * HitNucleon(void) const
Definition: GHepRecord.cxx:350
int ResonanceCharge(GHepRecord *event_rec) const
TParticlePDG * Find(int pdgc)
Definition: PDGLibrary.cxx:61
int IonPdgCode(int A, int Z)
Definition: PDGUtils.cxx:69
assert(nhit_max >=nhit_nbins)
void SetHadSystP4(const TLorentzVector &p4)
Definition: Kinematics.cxx:317
const InitialState & InitState(void) const
Definition: Interaction.h:69
virtual void AddParticle(const GHepParticle &p)
Definition: GHepRecord.cxx:535
int A(void) const
#define pNOTICE
Definition: Messenger.h:62
const Target & Tgt(void) const
Definition: InitialState.h:67
TVector3 HCM2LAB(GHepRecord *event_rec) const
void AddFinalHadronicSyst(GHepRecord *event_rec) const
const int kPdgHadronicSyst
Definition: PDGCodes.h:187
GENIE&#39;s GHEP MC event record.
Definition: GHepRecord.h:46
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:40
string Vec3AsString(const TVector3 *vec)
Definition: PrintUtils.cxx:87
virtual int TargetNucleusPosition(void) const
Definition: GHepRecord.cxx:406
Initial State information.
Definition: InitialState.h:49
#define pDEBUG
Definition: Messenger.h:64
void PreHadronTransportDecays(GHepRecord *event_rec) const
double Py(void) const
Get Py.
Definition: GHepParticle.h:90