GTruth.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file GTruth.h
3 /// \Class to hold the additional information needed to recreate a genie::EventRecord
4 /// \author nathan.mayer@tufts.edu
5 ////////////////////////////////////////////////////////////////////////
6 
7 /// This class stores/retrieves the additional information needed (and not in MCTruth) to recreate a genie::EventRecord
8 /// for genie based event reweighting.
9 
11 
12 #include <vector>
13 #include <iostream>
14 #include <string>
15 #include <sstream> // for ostringstream
16 #include <iomanip>
17 
18 namespace simb {
19 
20  //---------------------------------------------------------------
22  : fVertex(0, 0, 0, 0)
23  , fweight(0)
24  , fprobability(0)
25  , fXsec(0)
26  , fDiffXsec(0)
27  , fGPhaseSpace(-1)
28 
29  , fProbePDG(-1)
30  , fProbeP4(0, 0, 0, 0)
31  , fTgtP4(0, 0, 0, 0)
32 
33  , ftgtZ(0)
34  , ftgtA(0)
35  , ftgtPDG(0)
36  , fHitNucPDG(kUndefinedValue)
37  , fHitQrkPDG(kUndefinedValue)
38  , fIsSeaQuark(false)
39  , fHitNucP4(0, 0, 0, 0)
40  , fHitNucPos(0)
41 
42  , fGscatter(-1)
43  , fGint(-1)
44 
45  , fgQ2(kUndefinedValue)
46  , fgq2(kUndefinedValue)
47  , fgW(kUndefinedValue)
48  , fgT(kUndefinedValue)
49  , fgX(kUndefinedValue)
50  , fgY(kUndefinedValue)
51  , fFSleptonP4(0, 0, 0, 0)
52  , fFShadSystP4(0, 0, 0, 0)
53 
54  , fIsCharm(false)
55  , fCharmHadronPdg(0)
56  , fIsStrange(false)
57  , fStrangeHadronPdg(0)
58  , fNumProton(-1)
59  , fNumNeutron(-1)
60  , fNumPi0(-1)
61  , fNumPiPlus(-1)
62  , fNumPiMinus(-1)
63  , fResNum(-1)
64  , fDecayMode(-1)
65  {
66 
67  }
68 
69  namespace gtruthaux {
70  std::string stringifyTLorentzVector(const TLorentzVector& tv4) {
71  std::ostringstream s;
72  s << "[ "
73  << std::setw(11) << tv4.X() << " "
74  << std::setw(11) << tv4.Y() << " "
75  << std::setw(11) << tv4.Z() << " "
76  << std::setw(11) << tv4.T() << " ]";
77  return s.str();
78  }
79  }
80  //......................................................................
81  std::ostream& operator<< (std::ostream& output, const simb::GTruth &gtruth)
82  {
83  output
84  << "GTruth:" << std::endl
85  // 123456789012
86  << " Vertex " << gtruthaux::stringifyTLorentzVector(gtruth.fVertex) << std::endl
87  << " weight " << std::setw(11) << gtruth.fweight << " "
88  << " prob " << std::setw(11) << gtruth.fprobability << std::endl
89  << " Xsec " << std::setw(11) << gtruth.fXsec << " "
90  << " DiffXsec " << std::setw(11) << gtruth.fDiffXsec << " "
91  << " GPhaseSpace " << std::setw(9) << gtruth.fGPhaseSpace << std::endl
92 
93  << " probe " << std::setw(11) << gtruth.fProbePDG << std::endl
94  << " ProbeP4 " << gtruthaux::stringifyTLorentzVector(gtruth.fProbeP4) << std::endl
95  << " TgtP4 " << gtruthaux::stringifyTLorentzVector(gtruth.fTgtP4) << std::endl
96 
97  << " Z A PDG (nuc,qrk) " << std::setw(4) << gtruth.ftgtZ << " "
98  << std::setw(4) << gtruth.ftgtA << " "
99  << std::setw(11) << gtruth.ftgtPDG << " ("
100  << std::setw(11) << gtruth.fHitNucPDG << " "
101  << std::setw(11) << gtruth.fHitQrkPDG << ") "
102  << " IsSeaQuark " << std::setw(4) << ((gtruth.fIsSeaQuark)?"yes":"no") << std::endl
103  << " HitNucP4 " << gtruthaux::stringifyTLorentzVector(gtruth.fHitNucP4) << " "
104  << " HitNucPos " << std::setw(11) << gtruth.fHitNucPos << std::endl
105 
106  << " Gscatter " << std::setw(11) << gtruth.fGscatter << " "
107  << " Gint " << std::setw(11) << gtruth.fGint << std::endl
108 
109  << " Q2 q2 " << std::setw(11) << gtruth.fgQ2 << " "
110  << std::setw(11) << gtruth.fgq2 << std::endl
111  << " W T " << std::setw(11) << gtruth.fgW << " "
112  << std::setw(11) << gtruth.fgT << std::endl
113  << " X Y " << std::setw(11) << gtruth.fgX << " "
114  << std::setw(11) << gtruth.fgY << std::endl
115  << " FSlepton " << gtruthaux::stringifyTLorentzVector(gtruth.fFSleptonP4) << std::endl
116  << " FShadSyst " << gtruthaux::stringifyTLorentzVector(gtruth.fFShadSystP4) << std::endl
117 
118  << " IsCharm " << std::setw(4) << ((gtruth.fIsCharm)?"yes":"no") << " "
119  << " CharmPDG " << std::setw(6) << gtruth.fCharmHadronPdg << " "
120  << " IsStrange " << std::setw(4) << ((gtruth.fIsStrange)?"yes":"no") << " "
121  << " StrangePDG " << std::setw(6) << gtruth.fStrangeHadronPdg << std::endl
122  << " Np Nn " << std::setw(4) << gtruth.fNumProton << " "
123  << std::setw(4) << gtruth.fNumNeutron << " "
124  << " Npi(0,+,-) " << std::setw(4) << gtruth.fNumPi0 << " "
125  << std::setw(4) << gtruth.fNumPiPlus << " "
126  << std::setw(4) << gtruth.fNumPiMinus << std::endl
127  << " ResNum " << std::setw(4) << gtruth.fResNum << " "
128  << " DecayMode " << std::setw(4) << gtruth.fDecayMode << std::endl
129 
130  << std::endl ;
131 
132  return output;
133  }
134 
135 } // namespace simb
double fgW
Definition: GTruth.h:63
int fGint
interaction code
Definition: GTruth.h:56
ofstream output
double fgq2
Definition: GTruth.h:62
friend std::ostream & operator<<(std::ostream &output, const simb::GTruth &gtruth)
Definition: GTruth.cxx:81
double fgX
Definition: GTruth.h:65
int ftgtA
Definition: GTruth.h:46
int fGPhaseSpace
phase space system of DiffXSec
Definition: GTruth.h:32
int fNumNeutron
number of neutrons after reaction, before FSI
Definition: GTruth.h:76
int ftgtZ
Definition: GTruth.h:45
double fXsec
cross section of interaction
Definition: GTruth.h:30
int fNumPiPlus
number of pi pluses after reaction, before FSI
Definition: GTruth.h:78
int fNumPiMinus
number of pi minuses after reaction, before FSI
Definition: GTruth.h:79
bool fIsStrange
strange production // added version 13
Definition: GTruth.h:73
TLorentzVector fProbeP4
Definition: GTruth.h:41
int fResNum
resonance number
Definition: GTruth.h:80
const XML_Char * s
Definition: expat.h:262
int fNumProton
number of protons after reaction, before FSI
Definition: GTruth.h:75
int fDecayMode
Definition: GTruth.h:81
double fprobability
interaction probability
Definition: GTruth.h:29
int fProbePDG
Definition: GTruth.h:39
TLorentzVector fFSleptonP4
generated final state primary lepton (LAB frame) // added version 13
Definition: GTruth.h:67
std::string stringifyTLorentzVector(const TLorentzVector &tv4)
Definition: GTruth.cxx:70
int fGscatter
neutrino scattering code
Definition: GTruth.h:55
int fNumPi0
number of pi0 after reaction, before FSI
Definition: GTruth.h:77
int fCharmHadronPdg
Definition: GTruth.h:72
int fHitQrkPDG
hit quark PDG code // added version 13
Definition: GTruth.h:49
bool fIsCharm
did the interaction produce a charmed hadron?
Definition: GTruth.h:71
double fweight
event interaction weight (genie internal)
Definition: GTruth.h:28
TLorentzVector fHitNucP4
Definition: GTruth.h:51
This class describes a particle created in the detector Monte Carlo simulation.
double fHitNucPos
Definition: GTruth.h:52
int ftgtPDG
PDG of Target Nucleus, nucleon only if free.
Definition: GTruth.h:47
double fgQ2
Definition: GTruth.h:61
TLorentzVector fFShadSystP4
generated final state hadronic system (LAB frame)
Definition: GTruth.h:68
TLorentzVector fTgtP4
Definition: GTruth.h:42
int fHitNucPDG
hit nucleon PDG code // added version 13
Definition: GTruth.h:48
double fgT
Definition: GTruth.h:64
bool fIsSeaQuark
Definition: GTruth.h:50
TLorentzVector fVertex
Definition: GTruth.h:26
double fgY
Definition: GTruth.h:66
double fDiffXsec
differential cross section of interaction
Definition: GTruth.h:31
int fStrangeHadronPdg
Definition: GTruth.h:74
enum BeamMode string