11 #ifndef LARDATAALG_MCDUMPERS_MCDUMPERS_H 12 #define LARDATAALG_MCDUMPERS_MCDUMPERS_H 26 #include "TLorentzVector.h" 52 template <
typename Stream>
56 std::string firstIndent);
58 template <
typename Stream>
61 DumpMCParticle(std::forward<Stream>(out), particle, indent, indent);
85 template <
typename Stream>
88 unsigned int pointsPerLine,
91 template <
typename Stream>
115 template <
typename Stream>
119 std::string firstIndent);
121 template <
typename Stream>
124 DumpMCNeutrino(std::forward<Stream>(out), neutrino, indent, indent);
153 template <
typename Stream>
156 unsigned int pointsPerLine,
158 std::string firstIndent);
160 template <
typename Stream>
163 unsigned int pointsPerLine,
164 std::string indent =
"")
166 DumpMCTruth(std::forward<Stream>(out), truth, pointsPerLine, indent, indent);
169 template <
typename Stream>
173 std::string firstIndent)
175 DumpMCTruth(std::forward<Stream>(out), truth, 0, indent, firstIndent);
178 template <
typename Stream>
181 DumpMCTruth(std::forward<Stream>(out), truth, indent, indent);
202 template <
typename Stream>
206 std::string firstIndent);
208 template <
typename Stream>
211 DumpGTruth(std::forward<Stream>(out), truth, indent, indent);
225 template <
typename Stream>
229 std::string firstIndent)
232 <<
" mass=" << particle.
Mass() <<
" GeV/c2 " 235 if (particle.
Weight() != 1.0) out <<
" weight=" << particle.
Weight();
237 out <<
" rescattered (" << particle.
Rescatter() <<
")";
239 out <<
"; generator vertex " << particle.
GetGvtx();
241 << indent <<
"created via " << (particle.
Process().empty() ?
"magics" : particle.
Process());
242 if (particle.
Mother() == 0)
243 out <<
" by the gods";
245 out <<
" from ID=" << particle.
Mother();
250 TLorentzVector
const& start = particle.
Position();
251 TLorentzVector
const& start_mom = particle.
Momentum();
252 out <<
" at " << start <<
" cm with momentum " << start_mom <<
" GeV/c";
258 if ((nPoints > 1) || (nDaughters > 0)) {
260 << indent << ((nDaughters > 0) ?
"ends" :
"stops") <<
" by " 263 TLorentzVector
const& stop = particle.
EndPosition();
264 TLorentzVector
const& stop_mom = particle.
EndMomentum();
265 out <<
" at " << stop <<
" cm with momentum " << stop_mom <<
" GeV/c";
267 if (nDaughters > 0) {
272 out << nDaughters <<
" particles from ID=" << particle.
FirstDaughter()
280 << indent <<
"comes with a trajectory " << traj.
TotalLength() <<
" cm long in " << nPoints
287 template <
typename Stream>
290 unsigned int pointsPerLine,
293 unsigned int page = 0;
294 for (
auto const& pair : trajectory) {
295 if ((pointsPerLine > 0) && (page-- == 0)) {
296 out <<
"\n" << indent <<
" ";
297 page = pointsPerLine - 1;
302 TLorentzVector
const& pos = pair.first;
309 template <
typename Stream>
313 std::string firstIndent)
327 << indent <<
"x=" << nu.
X() <<
" y=" << nu.
Y() <<
" w=" << nu.
W() <<
" Q^2=" << nu.
QSqr()
328 <<
" GeV^2; theta=" << nu.
Theta() <<
" rad pT=" << nu.
Pt() <<
" GeV/c";
329 out <<
'\n' << indent <<
"neutrino: ";
331 out <<
'\n' << indent <<
"outgoing lepton: ";
337 template <
typename Stream>
340 unsigned int pointsPerLine,
342 std::string firstIndent)
346 out <<
"Generator ID: " << (int)genInfo.
generator <<
"\n";
347 out <<
"Generator Version: " << genInfo.generatorVersion <<
"\n";
348 out <<
"Generator configuration string map. Pairs separated by colons. " 350 for (
const auto& gci : genInfo.generatorConfig) {
351 out <<
" " << gci.first <<
" : " << gci.second <<
"\n";
354 unsigned int const nParticles = truth.
NParticles();
357 out <<
'\n' << indent <<
"neutrino information: ";
360 for (
unsigned int i = 0; i < nParticles; ++i) {
361 out <<
'\n' << indent <<
"[#" << i <<
"] ";
363 DumpMCParticle(std::forward<Stream>(out), particle, indent +
" ",
"");
366 if ((nPoints > 0) && (pointsPerLine > 0)) {
369 std::forward<Stream>(out), particle.
Trajectory(), pointsPerLine, indent +
" ");
376 template <
typename Stream>
380 std::string firstIndent)
387 unsigned int const nTotalParticles = nCharged + nNeutral;
389 out << firstIndent <<
"interaction code: " << truth.
fGint 390 <<
", neutrino scattering code: " << truth.
fGscatter <<
" at " << truth.
fVertex <<
"\n" 392 <<
" hit nucleon with cp=" << truth.
fHitNucP4 <<
" GeV" 393 <<
" (" << (truth.
fIsSeaQuark ?
"" :
"not a ") <<
"sea quark)" 395 <<
", A: " << truth.
ftgtA <<
")" 397 << indent <<
"event interaction weight (genie internal): " << truth.
fweight 398 <<
", interaction probability: " << truth.
fprobability <<
", cross section: " << truth.
fXsec 399 <<
", differential cross section: " << truth.
fDiffXsec <<
"\n" 400 << indent <<
"particles after reaction, before FSI: " << truth.
fNumPiPlus <<
" pi+" 402 <<
", " << truth.
fNumPi0 <<
" pi0" 406 << indent <<
" total " << nTotalParticles
407 <<
" particles after reaction before FSI" 409 << nCharged <<
"/" << nNeutral
410 <<
" charged/neutral" 412 << nPions <<
" pions, " << nNucleons <<
" nucleons" 414 << indent <<
"process " << (truth.
fIsCharm ?
"with" :
"without") <<
" charmed hadron";
416 out <<
", no resonance";
418 out <<
", resonance: #" << truth.
fResNum;
420 << indent <<
"internal (on shell) genie kinematics: Q^2: " << truth.
fgQ2 <<
" GeV^2" 421 <<
" q^2: " << truth.
fgq2 <<
" GeV^2" 422 <<
", w: " << truth.
fgW <<
" GeV^2" 423 <<
", t: " << truth.
fgT <<
" GeV^2" 424 <<
", x: " << truth.
fgX <<
", y: " << truth.
fgY <<
"\n" 431 #endif // LARDATAALG_MCDUMPERS_MCDUMPERS_H
int fGint
interaction code
unsigned int NumberTrajectoryPoints() const
const TVector3 & Polarization() const
const TLorentzVector & Position(const int i=0) const
Specializations of geo_vectors_utils.h for ROOT old vector types.
double Theta() const
angle between incoming and outgoing leptons, in radians
const simb::MCNeutrino & GetNeutrino() const
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
void DumpGTruth(Stream &&out, simb::GTruth const &truth, std::string indent, std::string firstIndent)
Dumps the content of the GENIE truth in the output stream.
std::string TruthInteractionTypeName(int type)
const TLorentzVector & EndPosition() const
static const int s_uninitialized
int FirstDaughter() const
const simb::MCTrajectory & Trajectory() const
const simb::MCParticle & Nu() const
simb::Origin_t Origin() const
double Pt() const
transverse momentum of interaction, in GeV/c
int fNumNeutron
number of neutrons after reaction, before FSI
void DumpMCParticleTrajectory(Stream &&out, simb::MCTrajectory const &trajectory, unsigned int pointsPerLine, std::string indent)
Dumps the specified particle trajectory into the output stream.
double fXsec
cross section of interaction
for(Int_t i=0;i< nentries;i++)
int fNumPiPlus
number of pi pluses after reaction, before FSI
int fNumPiMinus
number of pi minuses after reaction, before FSI
std::string TruthCCNCname(int ccnc)
std::string Process() const
TLorentzVector GetGvtx() const
int NumberDaughters() const
int fResNum
resonance number
int fNumProton
number of protons after reaction, before FSI
int InteractionType() const
double fprobability
interaction probability
std::string TruthReactionMode(int mode)
Returns the "mode" of the reaction (a lesser version of interaction type).
const simb::MCParticle & Lepton() const
Utilities to dump objects into a stream.
std::string EndProcess() const
int fGscatter
neutrino scattering code
int fNumPi0
number of pi0 after reaction, before FSI
simb::Generator_t generator
event generator that generated this event
std::string indent(std::size_t const i)
std::string ParticleName(int pigid)
Returns a string with the name of particle the specified with PDG ID.
void DumpMCTruth(Stream &&out, simb::MCTruth const &truth, unsigned int pointsPerLine, std::string indent, std::string firstIndent)
Dumps the content of the specified MC truth in the output stream.
bool fIsCharm
did the interaction produce a charmed hadron?
double fweight
event interaction weight (genie internal)
Collection of utilities for dumping data on screen.
const simb::MCParticle & GetParticle(int i) const
std::string TruthOriginName(simb::Origin_t origin)
Returns a string representing the specified process origin.
double TotalLength() const
int ftgtPDG
PDG of Target Nucleus, nucleon only if free.
Utility functions to print MC truth information.
const TLorentzVector & Momentum(const int i=0) const
TLorentzVector fFShadSystP4
generated final state hadronic system (LAB frame)
void DumpMCNeutrino(Stream &&out, simb::MCNeutrino const &neutrino, std::string indent, std::string firstIndent)
Dumps the content of the specified neutrino in the output stream.
Event generator information.
Event generator information.
std::string ParticleStatusName(int code)
Describes the status of a particle (simb::MCParticle::StatusCode()).
const TLorentzVector & EndMomentum() const
double fgY
a common running variable to be recorded
double fDiffXsec
differential cross section of interaction
void DumpMCParticle(Stream &&out, simb::MCParticle const &particle, std::string indent, std::string firstIndent)
Dumps the content of the specified particle in the output stream.
const simb::MCGeneratorInfo & GeneratorInfo() const