11 #ifndef GARSOFT_MCDUMPERS_MCDUMPERS_H 12 #define GARSOFT_MCDUMPERS_MCDUMPERS_H 25 #include "TLorentzVector.h" 52 template <
typename Stream>
58 template <
typename Stream>
61 {
DumpMCParticle(std::forward<Stream>(out), particle, indent, indent); }
85 template <
typename Stream>
91 template <
typename Stream>
117 template <
typename Stream>
123 template <
typename Stream>
126 {
DumpMCNeutrino(std::forward<Stream>(out), neutrino, indent, indent); }
155 template <
typename Stream>
157 Stream&& out,
simb::MCTruth const& truth,
unsigned int pointsPerLine,
161 template <
typename Stream>
163 Stream&& out,
simb::MCTruth const& truth,
unsigned int pointsPerLine,
168 (std::forward<Stream>(out), truth, pointsPerLine, indent, indent);
171 template <
typename Stream>
176 {
DumpMCTruth(std::forward<Stream>(out), truth, 0, indent, firstIndent); }
178 template <
typename Stream>
182 {
DumpMCTruth(std::forward<Stream>(out), truth, indent, indent); }
203 template <
typename Stream>
209 template <
typename Stream>
212 {
DumpGTruth(std::forward<Stream>(out), truth, indent, indent); }
226 template <
typename Stream>
233 <<
" mass=" << particle.
Mass() <<
" GeV/c2 " 237 if (particle.
Weight() != 1.0) out <<
" weight=" << particle.
Weight();
239 out <<
" rescattered (" << particle.
Rescatter()
240 <<
") at vertex " << particle.
GetGvtx();
242 out <<
"\n" << indent <<
"created via " 244 if (particle.
Mother() == 0) out <<
" by the gods";
245 else 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";
259 if ((nPoints > 1) || (nDaughters > 0)) {
260 out <<
"\n" << 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()
279 out <<
"\n" << indent <<
"comes with a trajectory " << traj.
TotalLength()
280 <<
" cm long in " << nPoints <<
" points";
287 template <
typename Stream>
292 unsigned int page = 0;
293 for (
auto const& pair: trajectory) {
294 if ((pointsPerLine > 0) && (page-- == 0)) {
295 out <<
"\n" << indent <<
" ";
296 page = pointsPerLine - 1;
300 TLorentzVector
const&
pos = pair.first;
308 template <
typename Stream>
322 out <<
", hit nucleon: " << nu.
HitNuc()
326 out <<
", hit quark: " << nu.
HitQuark()
331 <<
"x=" << nu.
X() <<
" y=" << nu.
Y() <<
" w=" << nu.
W()
332 <<
" Q^2=" << nu.
QSqr() <<
" GeV^2; theta=" << nu.
Theta()
333 <<
" rad pT=" << nu.
Pt() <<
" GeV/c" 335 out <<
'\n' << indent <<
"neutrino: ";
337 out <<
'\n' << indent <<
"outgoing lepton: ";
344 template <
typename Stream>
346 Stream&& out,
simb::MCTruth const& truth,
unsigned int pointsPerLine,
349 unsigned int const nParticles = truth.
NParticles();
351 << nParticles <<
" particles from " 354 out <<
'\n' << indent <<
"neutrino information: ";
356 (std::forward<Stream>(out), truth.
GetNeutrino(), indent +
" ",
"");
358 for (
unsigned int i = 0; i < nParticles; ++i) {
359 out <<
'\n' << indent <<
"[#" << i <<
"] ";
361 DumpMCParticle(std::forward<Stream>(out), particle, indent +
" ",
"");
364 if ((nPoints > 0) && (pointsPerLine > 0)) {
367 std::forward<Stream>(out), particle.
Trajectory(),
368 pointsPerLine, indent +
" " 377 template <
typename Stream>
383 unsigned int const nCharged
386 unsigned int const nPions
389 unsigned int const nTotalParticles = nCharged + nNeutral;
392 <<
"interaction code: " << truth.
fGint 393 <<
", neutrino scattering code: " << truth.
fGscatter 398 <<
" hit nucleon with cp=" << truth.
fHitNucP4 <<
" GeV" 399 <<
" (" << (truth.
fIsSeaQuark?
"":
"not a ") <<
"sea quark)" 401 <<
" (Z: " << truth.
ftgtZ <<
", A: " << truth.
ftgtA <<
")" 403 <<
"event interaction weight (genie internal): " << truth.
fweight 405 <<
", cross section: " << truth.
fXsec 406 <<
", differential cross section: " << truth.
fDiffXsec 408 <<
"particles after reaction, before FSI: " 411 <<
", " << truth.
fNumPi0 <<
" pi0" 415 <<
" total " << nTotalParticles <<
" particles after reaction before FSI" 416 ": " << nCharged <<
"/" << nNeutral <<
" charged/neutral" 417 ", " << nPions <<
" pions, " << nNucleons <<
" nucleons" 418 <<
"\n" << indent <<
"process " 419 << (truth.
fIsCharm?
"with":
"without") <<
" charmed hadron";
420 if (truth.
fResNum == -1) out <<
", no resonance";
421 else out <<
", resonance: #" << truth.
fResNum;
424 <<
"internal (on shell) genie kinematics: Q^2: " << truth.
fgQ2 <<
" GeV^2" 425 <<
" q^2: " << truth.
fgq2 <<
" GeV^2" 426 <<
", w: " << truth.
fgW <<
" GeV^2" 427 <<
", t: " << truth.
fgT <<
" GeV^2" 428 <<
", x: " << truth.
fgX 429 <<
", y: " << truth.
fgY 440 #endif // GARSOFT_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
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
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.
Specializations of geo_vectors_utils.h for ROOT old vector types.
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)
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
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.
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)
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.