LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
GTruth.cxx
Go to the documentation of this file.
1 
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  , fgWrun(kUndefinedValue)
52 
53  , fFSleptonP4(0, 0, 0, 0)
54  , fFShadSystP4(0, 0, 0, 0)
55 
56  , fIsCharm(false)
57  , fCharmHadronPdg(0)
58  , fIsStrange(false)
59  , fStrangeHadronPdg(0)
60  , fNumProton(-1)
61  , fNumNeutron(-1)
62  , fNumPi0(-1)
63  , fNumPiPlus(-1)
64  , fNumPiMinus(-1)
65  , fNumSingleGammas(-1)
66  , fNumRho0(-1)
67  , fNumRhoPlus(-1)
68  , fNumRhoMinus(-1)
69  , fResNum(-1)
70  , fDecayMode(-1)
71  , fFinalQuarkPdg(0)
72  , fFinalLeptonPdg(0)
73  {
74 
75  }
76 
77  namespace gtruthaux {
78  std::string stringifyTLorentzVector(const TLorentzVector& tv4) {
79  std::ostringstream s;
80  s << "[ "
81  << std::setw(11) << tv4.X() << " "
82  << std::setw(11) << tv4.Y() << " "
83  << std::setw(11) << tv4.Z() << " "
84  << std::setw(11) << tv4.T() << " ]";
85  return s.str();
86  }
87  }
88  //......................................................................
89  std::ostream& operator<< (std::ostream& output, const simb::GTruth &gtruth)
90  {
91  output
92  << "GTruth:" << std::endl
93  // 123456789012
94  << " Vertex " << gtruthaux::stringifyTLorentzVector(gtruth.fVertex) << std::endl
95  << " weight " << std::setw(11) << gtruth.fweight << " "
96  << " prob " << std::setw(11) << gtruth.fprobability << std::endl
97  << " Xsec " << std::setw(11) << gtruth.fXsec << " "
98  << " DiffXsec " << std::setw(11) << gtruth.fDiffXsec << " "
99  << " GPhaseSpace " << std::setw(9) << gtruth.fGPhaseSpace << std::endl
100 
101  << " probe " << std::setw(11) << gtruth.fProbePDG << std::endl
102  << " ProbeP4 " << gtruthaux::stringifyTLorentzVector(gtruth.fProbeP4) << std::endl
103  << " TgtP4 " << gtruthaux::stringifyTLorentzVector(gtruth.fTgtP4) << std::endl
104 
105  << " Z A PDG (nuc,qrk) " << std::setw(4) << gtruth.ftgtZ << " "
106  << std::setw(4) << gtruth.ftgtA << " "
107  << std::setw(11) << gtruth.ftgtPDG << " ("
108  << std::setw(11) << gtruth.fHitNucPDG << " "
109  << std::setw(11) << gtruth.fHitQrkPDG << ") "
110  << " IsSeaQuark " << std::setw(4) << ((gtruth.fIsSeaQuark)?"yes":"no") << std::endl
111  << " HitNucP4 " << gtruthaux::stringifyTLorentzVector(gtruth.fHitNucP4) << " "
112  << " HitNucPos " << std::setw(11) << gtruth.fHitNucPos << std::endl
113 
114  << " Gscatter " << std::setw(11) << gtruth.fGscatter << " "
115  << " Gint " << std::setw(11) << gtruth.fGint << std::endl
116 
117  << " Q2 q2 " << std::setw(11) << gtruth.fgQ2 << " "
118  << std::setw(11) << gtruth.fgq2 << std::endl
119  << " W T " << std::setw(11) << gtruth.fgW << " "
120  << std::setw(11) << gtruth.fgT << std::endl
121  << " X Y " << std::setw(11) << gtruth.fgX << " "
122  << std::setw(11) << gtruth.fgY << std::endl
123  << " Wrun " << std::setw(11) << gtruth.fgWrun << std::endl
124  << " FSlepton " << gtruthaux::stringifyTLorentzVector(gtruth.fFSleptonP4) << std::endl
125  << " FShadSyst " << gtruthaux::stringifyTLorentzVector(gtruth.fFShadSystP4) << std::endl
126 
127  << " IsCharm " << std::setw(4) << ((gtruth.fIsCharm)?"yes":"no") << " "
128  << " CharmPDG " << std::setw(6) << gtruth.fCharmHadronPdg << " "
129  << " IsStrange " << std::setw(4) << ((gtruth.fIsStrange)?"yes":"no") << " "
130  << " StrangePDG " << std::setw(6) << gtruth.fStrangeHadronPdg << std::endl
131  << " Np Nn " << std::setw(4) << gtruth.fNumProton << " "
132  << std::setw(4) << gtruth.fNumNeutron << " "
133  << " Npi(0,+,-) " << std::setw(4) << gtruth.fNumPi0 << " "
134  << std::setw(4) << gtruth.fNumPiPlus << " "
135  << std::setw(4) << gtruth.fNumPiMinus << std::endl
136  << " NSingleGammas " << std::setw(4) << gtruth.fNumSingleGammas
137  << " NRho(0,+,-) " << std::setw(4) << gtruth.fNumRho0 << " "
138  << std::setw(4) << gtruth.fNumRhoPlus << " "
139  << std::setw(4) << gtruth.fNumRhoMinus << std::endl
140  << " ResNum " << std::setw(4) << gtruth.fResNum << " "
141  << " DecayMode " << std::setw(4) << gtruth.fDecayMode << std::endl
142  << " FinalQuarkPdg " << std::setw(4) << gtruth.fFinalQuarkPdg << " "
143  << " FinalLeptonPdg " << std::setw(4) << gtruth.fFinalLeptonPdg
144 
145  << std::endl ;
146 
147  return output;
148  }
149 
150 } // namespace simb
double fgW
Definition: GTruth.h:64
int fGint
interaction code
Definition: GTruth.h:56
double fgq2
Definition: GTruth.h:63
friend std::ostream & operator<<(std::ostream &output, const simb::GTruth &gtruth)
Definition: GTruth.cxx:89
double fgX
Definition: GTruth.h:66
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:81
double fgWrun
Definition: GTruth.h:70
int fNumRhoPlus
number of pi pluses after reaction, before FSI
Definition: GTruth.h:87
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:83
int fNumSingleGammas
number of gammas after reaction, before FSI
Definition: GTruth.h:85
int fNumPiMinus
number of pi minuses after reaction, before FSI
Definition: GTruth.h:84
bool fIsStrange
strange production // added version 13
Definition: GTruth.h:78
TLorentzVector fProbeP4
Definition: GTruth.h:41
int fResNum
resonance number
Definition: GTruth.h:89
int fNumProton
number of protons after reaction, before FSI
Definition: GTruth.h:80
int fDecayMode
Definition: GTruth.h:90
double fprobability
interaction probability
Definition: GTruth.h:29
int fFinalLeptonPdg
Definition: GTruth.h:93
int fProbePDG
Definition: GTruth.h:39
TLorentzVector fFSleptonP4
generated final state primary lepton (LAB frame) // added version 13
Definition: GTruth.h:72
std::string stringifyTLorentzVector(const TLorentzVector &tv4)
Definition: GTruth.cxx:78
int fGscatter
neutrino scattering code
Definition: GTruth.h:55
int fNumRhoMinus
number of pi minuses after reaction, before FSI
Definition: GTruth.h:88
int fNumPi0
number of pi0 after reaction, before FSI
Definition: GTruth.h:82
int fCharmHadronPdg
Definition: GTruth.h:77
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:76
double fweight
event interaction weight (genie internal)
Definition: GTruth.h:28
TLorentzVector fHitNucP4
Definition: GTruth.h:51
ART objects.
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:62
int fNumRho0
number of pi0 after reaction, before FSI
Definition: GTruth.h:86
TLorentzVector fFShadSystP4
generated final state hadronic system (LAB frame)
Definition: GTruth.h:73
TLorentzVector fTgtP4
Definition: GTruth.h:42
int fHitNucPDG
hit nucleon PDG code // added version 13
Definition: GTruth.h:48
int fFinalQuarkPdg
Definition: GTruth.h:92
double fgT
Definition: GTruth.h:65
bool fIsSeaQuark
Definition: GTruth.h:50
TLorentzVector fVertex
Definition: GTruth.h:26
double fgY
a common running variable to be recorded
Definition: GTruth.h:67
double fDiffXsec
differential cross section of interaction
Definition: GTruth.h:31
int fStrangeHadronPdg
Definition: GTruth.h:79