11 #ifndef LARDATAALG_MCDUMPERS_MCDUMPERS_H 12 #define LARDATAALG_MCDUMPERS_MCDUMPERS_H 26 #include "TLorentzVector.h" 53 template <
typename Stream>
59 template <
typename Stream>
86 template <
typename Stream>
92 template <
typename Stream>
118 template <
typename Stream>
124 template <
typename Stream>
156 template <
typename Stream>
158 Stream&& out,
simb::MCTruth const& truth,
unsigned int pointsPerLine,
162 template <
typename Stream>
164 Stream&& out,
simb::MCTruth const& truth,
unsigned int pointsPerLine,
169 (std::forward<Stream>(out), truth, pointsPerLine,
indent,
indent);
172 template <
typename Stream>
177 {
DumpMCTruth(std::forward<Stream>(out), truth, 0, indent, firstIndent); }
179 template <
typename Stream>
183 {
DumpMCTruth(std::forward<Stream>(out), truth, indent, indent); }
204 template <
typename Stream>
210 template <
typename Stream>
213 {
DumpGTruth(std::forward<Stream>(out), truth, indent, indent); }
227 template <
typename Stream>
234 <<
" mass=" << particle.
Mass() <<
" GeV/c2 " 238 if (particle.
Weight() != 1.0) out <<
" weight=" << particle.
Weight();
240 out <<
" rescattered (" << particle.
Rescatter() <<
")";
242 out <<
"; generator vertex " << particle.
GetGvtx();
243 out <<
"\n" << indent <<
"created via " 245 if (particle.
Mother() == 0) out <<
" by the gods";
246 else out <<
" from ID=" << particle.
Mother();
251 TLorentzVector
const& start = particle.
Position();
252 TLorentzVector
const& start_mom = particle.
Momentum();
253 out <<
" at " << start <<
" cm with momentum " << start_mom <<
" GeV/c";
260 if ((nPoints > 1) || (nDaughters > 0)) {
261 out <<
"\n" << indent << ((nDaughters > 0)?
"ends":
"stops") <<
" by " 264 TLorentzVector
const& stop = particle.
EndPosition();
265 TLorentzVector
const& stop_mom = particle.
EndMomentum();
266 out <<
" at " << stop <<
" cm with momentum " << stop_mom <<
" GeV/c";
268 if (nDaughters > 0) {
273 out << nDaughters <<
" particles from ID=" << particle.
FirstDaughter()
280 out <<
"\n" << indent <<
"comes with a trajectory " << traj.
TotalLength()
281 <<
" cm long in " << nPoints <<
" points";
288 template <
typename Stream>
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;
301 TLorentzVector
const&
pos = pair.first;
309 template <
typename Stream>
323 out <<
", hit nucleon: " << nu.
HitNuc()
327 out <<
", hit quark: " << nu.
HitQuark()
332 <<
"x=" << nu.
X() <<
" y=" << nu.
Y() <<
" w=" << nu.
W()
333 <<
" Q^2=" << nu.
QSqr() <<
" GeV^2; theta=" << nu.
Theta()
334 <<
" rad pT=" << nu.
Pt() <<
" GeV/c" 336 out <<
'\n' << indent <<
"neutrino: ";
338 out <<
'\n' << indent <<
"outgoing lepton: ";
345 template <
typename Stream>
347 Stream&& out,
simb::MCTruth const& truth,
unsigned int pointsPerLine,
350 unsigned int const nParticles = truth.
NParticles();
352 << nParticles <<
" particles from " 355 out <<
'\n' << indent <<
"neutrino information: ";
357 (std::forward<Stream>(out), truth.
GetNeutrino(), indent +
" ",
"");
359 for (
unsigned int i = 0; i < nParticles; ++i) {
360 out <<
'\n' << indent <<
"[#" << i <<
"] ";
362 DumpMCParticle(std::forward<Stream>(out), particle, indent +
" ",
"");
365 if ((nPoints > 0) && (pointsPerLine > 0)) {
368 std::forward<Stream>(out), particle.
Trajectory(),
369 pointsPerLine, indent +
" " 378 template <
typename Stream>
384 unsigned int const nCharged
387 unsigned int const nPions
390 unsigned int const nTotalParticles = nCharged + nNeutral;
393 <<
"interaction code: " << truth.
fGint 394 <<
", neutrino scattering code: " << truth.
fGscatter 399 <<
" hit nucleon with cp=" << truth.
fHitNucP4 <<
" GeV" 400 <<
" (" << (truth.
fIsSeaQuark?
"":
"not a ") <<
"sea quark)" 402 <<
" (Z: " << truth.
ftgtZ <<
", A: " << truth.
ftgtA <<
")" 404 <<
"event interaction weight (genie internal): " << truth.
fweight 406 <<
", cross section: " << truth.
fXsec 407 <<
", differential cross section: " << truth.
fDiffXsec 409 <<
"particles after reaction, before FSI: " 412 <<
", " << truth.
fNumPi0 <<
" pi0" 416 <<
" total " << nTotalParticles <<
" particles after reaction before FSI" 417 ": " << nCharged <<
"/" << nNeutral <<
" charged/neutral" 418 ", " << nPions <<
" pions, " << nNucleons <<
" nucleons" 419 <<
"\n" << indent <<
"process " 420 << (truth.
fIsCharm?
"with":
"without") <<
" charmed hadron";
421 if (truth.
fResNum == -1) out <<
", no resonance";
422 else out <<
", resonance: #" << truth.
fResNum;
425 <<
"internal (on shell) genie kinematics: Q^2: " << truth.
fgQ2 <<
" GeV^2" 426 <<
" q^2: " << truth.
fgq2 <<
" GeV^2" 427 <<
", w: " << truth.
fgW <<
" GeV^2" 428 <<
", t: " << truth.
fgT <<
" GeV^2" 429 <<
", x: " << truth.
fgX 430 <<
", y: " << truth.
fgY 441 #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
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
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
std::string EndProcess() const
int fGscatter
neutrino scattering code
int fNumPi0
number of pi0 after reaction, before FSI
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)
Code to link reconstructed objects back to the MC truth information.
Specializations of geo_vectors_utils.h for ROOT old vector types.
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.
const TLorentzVector & Momentum(const int i=0) const
TLorentzVector fFShadSystP4
generated final state hadronic system (LAB frame)
Utility functions to print MC truth information.
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.