LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
MCDumperUtils.cxx
Go to the documentation of this file.
1 
10 // library header
12 
13 // nusimdata
15 
16 // GENIE headers
17 #ifdef HAS_GENIE // does not happen in LArSoft
18 #include "GENIE/HadronTransport/INukeHadroFates.h"
19 #endif // HAS_GENIE
20 
21 // ROOT
22 #include "TDatabasePDG.h"
23 #include "TParticlePDG.h"
24 
25 //------------------------------------------------------------------------------
27 {
28  switch (origin) {
29  case simb::kUnknown: return "unknown origin";
30  case simb::kBeamNeutrino: return "neutrinos from beam";
31  case simb::kCosmicRay: return "cosmic rays";
32  case simb::kSuperNovaNeutrino: return "supernova neutrinos";
33  case simb::kSingleParticle: return "single particle";
34  default: return "unsupported (" + std::to_string((int)origin) + ")";
35  } // switch
36 } // sim::TruthOriginName()
37 
38 //------------------------------------------------------------------------------
39 std::string sim::TruthCCNCname(int ccnc)
40 {
41  switch (ccnc) {
42  case simb::kCC: return "charged weak current";
43  case simb::kNC: return "neutral weak current";
44  default: return "unsupported (" + std::to_string(ccnc) + ")";
45  } // switch
46 } // sim::TruthCCNCname()
47 
48 //------------------------------------------------------------------------------
49 std::string sim::TruthReactionMode(int mode)
50 {
51 
52  switch (mode) {
53  case 0: return "quasi-elastic";
54  case 1: return "resonant";
55  case 2: return "deep inelastic";
56  case 3: return "coherent";
57  default: return "unknown mode";
58  } // switch
59 
60 } // sim::TruthReactionMode()
61 
62 //------------------------------------------------------------------------------
64 {
65  switch (type) {
66  case simb::kUnknownInteraction: return "unknown interaction";
67  case simb::kQE: return "quasi-elastic scattering";
68  case simb::kRes: return "resonant scattering";
69  case simb::kDIS: return "deep inelastic scattering";
70  case simb::kCoh: return "coherent scattering";
71  case simb::kCohElastic: return "coherent elastic scattering";
72  case simb::kElectronScattering: return "electron scattering";
73  case simb::kIMDAnnihilation: return "inverse muon decay annihilation";
74  case simb::kInverseBetaDecay: return "inverse beta decay";
75  case simb::kGlashowResonance: return "Glashow resonance";
76  case simb::kAMNuGamma: return "anomalous neutrino-photon interaction";
77  case simb::kMEC: return "meson exchange current";
78  case simb::kDiffractive: return "diffractive";
79  case simb::kEM: return "electromagnetic";
80  case simb::kWeakMix: return "weak mixing";
81  case simb::kNuanceOffset: return "<nuance offset>";
82  case simb::kCCQE: return "charged current quasi-elastic scattering";
83  case simb::kNCQE: return "neutral current quasi-elastic scattering";
84  case simb::kResCCNuProtonPiPlus: return "resonant charged current neutrino proton pi+";
85  case simb::kResCCNuNeutronPi0: return "resonant charged current neutrino neutron pi0";
86  case simb::kResCCNuNeutronPiPlus: return "resonant charged current neutrino neutron pi+";
87  case simb::kResNCNuProtonPi0: return "resonant neutral current neutrino proton pi0";
88  case simb::kResNCNuProtonPiPlus: return "resonant neutral current neutrino proton pi+";
89  case simb::kResNCNuNeutronPi0: return "resonant neutral current neutrino neutron pi0";
90  case simb::kResNCNuNeutronPiMinus: return "resonant neutral current neutrino neutron pi-";
91  case simb::kResCCNuBarNeutronPiMinus: return "resonant charged current antineutrino neutron pi-";
92  case simb::kResCCNuBarProtonPi0: return "resonant charged current antineutrino proton pi0";
93  case simb::kResCCNuBarProtonPiMinus: return "resonant charged current antineutrino proton pi-";
94  case simb::kResNCNuBarProtonPi0: return "resonant neutral current antineutrino proton pi0";
95  case simb::kResNCNuBarProtonPiPlus: return "resonant neutral current antineutrino proton pi+";
96  case simb::kResNCNuBarNeutronPi0: return "resonant neutral current antineutrino neutron pi0";
97  case simb::kResNCNuBarNeutronPiMinus: return "resonant neutral current antineutrino neutron pi-";
98  case simb::kResCCNuDeltaPlusPiPlus: return "resonant charged current neutrino Delta+ pi+";
99  case simb::kResCCNuDelta2PlusPiMinus: return "resonant charged current neutrino Delta++ pi-";
100  case simb::kResCCNuBarDelta0PiMinus: return "resonant charged current antineutrino Delta0 pi-";
101  case simb::kResCCNuBarDeltaMinusPiPlus: return "resonant charged current antineutrino Delta- pi+";
102  case simb::kResCCNuProtonRhoPlus: return "resonant charged current neutrino proton rho+";
103  case simb::kResCCNuNeutronRhoPlus: return "resonant charged current neutrino neutron rho+";
105  return "resonant charged current antineutrino neutron rho-";
106  case simb::kResCCNuBarNeutronRho0: return "resonant charged current antineutrino neutron rho0";
107  case simb::kResCCNuSigmaPlusKaonPlus: return "resonant charged current neutrino Sigma+ kaon+";
108  case simb::kResCCNuSigmaPlusKaon0: return "resonant charged current neutrino Sigma+ kaon0";
110  return "resonant charged current antineutrino Sigma- kaon0";
111  case simb::kResCCNuBarSigma0Kaon0: return "resonant charged current antineutrino Sigma0 kaon0";
112  case simb::kResCCNuProtonEta: return "resonant charged current neutrino proton eta";
113  case simb::kResCCNuBarNeutronEta: return "resonant charged current antineutrino neutron eta";
114  case simb::kResCCNuKaonPlusLambda0: return "resonant charged current neutrino Kaon+ Lambda0";
115  case simb::kResCCNuBarKaon0Lambda0: return "resonant charged current antineutrino kaon0 Lambda0";
116  case simb::kResCCNuProtonPiPlusPiMinus: return "resonant charged current neutrino proton pi+ pi-";
117  case simb::kResCCNuProtonPi0Pi0: return "resonant charged current neutrino proton pi0 pi0";
119  return "resonant charged current antineutrino neutron pi+ pi-";
121  return "resonant charged current antineutrino neutron pi0 pi0";
122  case simb::kResCCNuBarProtonPi0Pi0: return "resonant charged current antineutrino proton pi0 pi0";
123  case simb::kCCDIS: return "charged current deep inelastic scattering";
124  case simb::kNCDIS: return "neutral current deep inelastic scattering";
125  case simb::kUnUsed1: return "unused (1)";
126  case simb::kUnUsed2: return "unused (2)";
127  case simb::kCCQEHyperon: return "charged current quasi-elastic scattering with hyperon";
128  case simb::kNCCOH: return "neutral current coherent scattering";
129  case simb::kCCCOH: return "charged current coherent scattering";
130  case simb::kNuElectronElastic: return "electron neutrino elastic";
131  case simb::kInverseMuDecay: return "inverse muon decay";
132  default: return "unsupported (" + std::to_string(type) + ")";
133  } // switch
134 } // sim::TruthInteractionTypeName()
135 
136 //------------------------------------------------------------------------------
137 std::string sim::ParticleStatusName(int code)
138 {
139 
140  switch (code) {
141  case -1: return "undefined";
142  case 0: return "initial state";
143  case 1: return "stable final state";
144  case 2: return "intermediate";
145  case 3: return "decayed";
146  case 11: return "nucleon target";
147  case 12: return "pre-fragmentation hadronic state";
148  case 13: return "pre-decay resonant state";
149  case 14: return "hadron in nucleus";
150  case 15: return "final state nuclear remnant";
151  case 16: return "nucleon cluster target";
152  default: return "unknown";
153  } // switch
154 
155 } // sim::ParticleStatusName
156 
157 //------------------------------------------------------------------------------
158 std::string sim::ParticleName(int pigid)
159 {
160  TParticlePDG const* PDGinfo = TDatabasePDG::Instance()->GetParticle(pigid);
161  return PDGinfo ? PDGinfo->GetTitle() : ("PDG ID " + std::to_string(pigid));
162 } // sim::ParticleName()
163 
164 //------------------------------------------------------------------------------
165 std::string sim::RescatteringName(int code,
166  RescatterCategory cat /* = RescatterCategory::LArSoftDefault */)
167 {
168  using namespace std::string_literals;
169 
170  if (code == simb::MCParticle::s_uninitialized) return "(unset)"s;
171 
172  switch (cat) {
173  case RescatterCategory::GENIE_INukeFateHA: return GENIE_INukeFateHA_RescatteringName(code);
174  default:
175  return "unknown category "s + std::to_string(static_cast<int>(cat)) + " (code: "s +
176  std::to_string(code) + ")"s;
177  } // switch(code)
178 
179 } // sim::RescatteringName()
180 
181 //------------------------------------------------------------------------------
183 {
184 
185 #ifdef _INTRANUKE_FATES_H_ // from GENIE
186 
187  return genie::INukeHadroFates::AsString(static_cast<genie::INukeFateHA_t>(code));
188 
189 #else // !_INTRANUKE_FATES_H_:
190 
191  using namespace std::string_literals;
192 
193  /*
194  * Here we do an horrible thing, that is to copy GENIE code into LArSoft.
195  * By defining `HAS_GENIE`, the proper code branch would be taken instead,
196  * which directly refers to GENIE.
197  * But LArSoft does not do that, because we don't want to be forced to have
198  * GENIE around all the time we use `simb::MCParticle`.
199  *
200  */
201  switch (code) {
202  // from Fermilab UPS GENIE v3_0_0_b4a, `Physics/HadronTransport/INukeHadroFates.h`:
203  case 0 /* kIHAFtUndefined */: return "** Undefined HA-mode fate **"s; break;
204  case 1 /* kIHAFtNoInteraction */: return "HA-mode / no interaction"s; break;
205  case 2 /* kIHAFtCEx */: return "HA-mode / cex"s; break;
206  case 3 /* kIHAFtElas */: return "HA-mode / elas"s; break;
207  case 4 /* kIHAFtInelas */: return "HA-mode / inelas"s; break;
208  case 5 /* kIHAFtAbs */: return "HA-mode / abs"s; break;
209  case 6 /* kIHAFtKo */: return "HA-mode / knock-out"s; break;
210  case 7 /* kIHAFtCmp */: return "HA-mode / compound"s; break;
211  case 8 /* kIHAFtPiProd */: return "HA-mode / pi-production"s; break;
212  case 9 /* kIHAFtInclPip */: return "HA-mode / pi-prod incl pi+"s; break;
213  case 10 /* kIHAFtInclPim */: return "HA-mode / pi-prod incl pi-"s; break;
214  case 11 /* kIHAFtInclPi0 */: return "HA-mode / pi-prod incl pi0"s; break;
215  case 12 /* kIHAFtDCEx */: return "HA-mode / dcex"s; break;
216  default: return "unknown ("s + std::to_string(code) + ")"s;
217  } // switch(code)
218 
219 #endif // ?_INTRANUKE_FATES_H_
220 
221 } // sim::GENIE_INukeFateHA_RescatteringName()
222 
223 //------------------------------------------------------------------------------
neutral current quasi-elastic
Definition: MCNeutrino.h:97
RescatterCategory
Possible sources of rescattering code (which is generator-dependent).
Definition: MCDumperUtils.h:37
resonant charged current, nubar p -> nubar n pi+
Definition: MCNeutrino.h:109
resonant neutral current, nu p -> nu p pi0
Definition: MCNeutrino.h:101
charged current deep inelastic scatter
Definition: MCNeutrino.h:134
std::string TruthInteractionTypeName(int type)
resonant charged current, nubar p -> l+ p pi-
Definition: MCNeutrino.h:107
static const int s_uninitialized
Definition: MCParticle.h:28
neutrino electron elastic scatter
Definition: MCNeutrino.h:140
resonant charged current, nubar p -> l+ n pi0
Definition: MCNeutrino.h:106
enum simb::_ev_origin Origin_t
event origin types
offset to account for adding in Nuance codes to this enum
Definition: MCNeutrino.h:95
std::string TruthCCNCname(int ccnc)
std::string RescatteringName(int code, RescatterCategory cat=RescatterCategory::LArSoftDefault)
The name of the specified rescattering code.
charged current quasi-elastic
Definition: MCNeutrino.h:96
Particle class.
resonant charged current, nubar p -> nubar p pi0
Definition: MCNeutrino.h:108
resonant charged current, nu n -> l- p pi0
Definition: MCNeutrino.h:99
std::string TruthReactionMode(int mode)
Returns the "mode" of the reaction (a lesser version of interaction type).
resonant neutral current, nu n -> nu n pi0
Definition: MCNeutrino.h:103
resonant charged current, nu n -> l- n pi+
Definition: MCNeutrino.h:100
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
single particles thrown at the detector
Definition: MCTruth.h:26
resonant charged current, nubar n -> nubar p pi-
Definition: MCNeutrino.h:111
std::string ParticleName(int pigid)
Returns a string with the name of particle the specified with PDG ID.
charged current deep inelastic scatter
Definition: MCNeutrino.h:133
resonant charged current, nu p -> l- p pi+
Definition: MCNeutrino.h:98
n.b.: this group is similar but not quite, entirely unlike GENIE ScatteringType convention ...
Definition: MCNeutrino.h:80
std::string TruthOriginName(simb::Origin_t origin)
Returns a string representing the specified process origin.
charged current coherent pion
Definition: MCNeutrino.h:139
resonant neutral current, nu n -> nu p pi-
Definition: MCNeutrino.h:104
std::string GENIE_INukeFateHA_RescatteringName(int code)
Description of a rescattering code from GENIE INukeFateHA_t.
Utility functions to print MC truth information.
inverse muon decay
Definition: MCNeutrino.h:141
resonant charged current, nubar n -> l+ n pi-
Definition: MCNeutrino.h:105
Supernova neutrinos.
Definition: MCTruth.h:25
resonant charged current, nubar n -> nubar n pi0
Definition: MCNeutrino.h:110
std::string ParticleStatusName(int code)
Describes the status of a particle (simb::MCParticle::StatusCode()).
resonant neutral current, nu p -> nu p pi+
Definition: MCNeutrino.h:102
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:229
Cosmic rays.
Definition: MCTruth.h:24
Beam neutrinos.
Definition: MCTruth.h:23