LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
LArInteractionTypeHelper.h
Go to the documentation of this file.
1 
8 #ifndef LAR_INTERACTION_TYPE_HELPER_H
9 #define LAR_INTERACTION_TYPE_HELPER_H 1
10 
12 
14 
15 namespace lar_content
16 {
17 
18 // clang-format off
19 #define INTERACTION_TYPE_TABLE(d) \
20  d(CCQEL_MU ) \
21  d(CCQEL_MU_P ) \
22  d(CCQEL_MU_P_P ) \
23  d(CCQEL_MU_P_P_P ) \
24  d(CCQEL_MU_P_P_P_P ) \
25  d(CCQEL_MU_P_P_P_P_P ) \
26  d(CCQEL_E ) \
27  d(CCQEL_E_P ) \
28  d(CCQEL_E_P_P ) \
29  d(CCQEL_E_P_P_P ) \
30  d(CCQEL_E_P_P_P_P ) \
31  d(CCQEL_E_P_P_P_P_P ) \
32  d(NCQEL_P ) \
33  d(NCQEL_P_P ) \
34  d(NCQEL_P_P_P ) \
35  d(NCQEL_P_P_P_P ) \
36  d(NCQEL_P_P_P_P_P ) \
37  d(CCRES_MU ) \
38  d(CCRES_MU_P ) \
39  d(CCRES_MU_P_P ) \
40  d(CCRES_MU_P_P_P ) \
41  d(CCRES_MU_P_P_P_P ) \
42  d(CCRES_MU_P_P_P_P_P ) \
43  d(CCRES_MU_PIPLUS ) \
44  d(CCRES_MU_P_PIPLUS ) \
45  d(CCRES_MU_P_P_PIPLUS ) \
46  d(CCRES_MU_P_P_P_PIPLUS ) \
47  d(CCRES_MU_P_P_P_P_PIPLUS ) \
48  d(CCRES_MU_P_P_P_P_P_PIPLUS ) \
49  d(CCRES_MU_PHOTON ) \
50  d(CCRES_MU_P_PHOTON ) \
51  d(CCRES_MU_P_P_PHOTON ) \
52  d(CCRES_MU_P_P_P_PHOTON ) \
53  d(CCRES_MU_P_P_P_P_PHOTON ) \
54  d(CCRES_MU_P_P_P_P_P_PHOTON ) \
55  d(CCRES_MU_PIZERO ) \
56  d(CCRES_MU_P_PIZERO ) \
57  d(CCRES_MU_P_P_PIZERO ) \
58  d(CCRES_MU_P_P_P_PIZERO ) \
59  d(CCRES_MU_P_P_P_P_PIZERO ) \
60  d(CCRES_MU_P_P_P_P_P_PIZERO ) \
61  d(CCRES_E ) \
62  d(CCRES_E_P ) \
63  d(CCRES_E_P_P ) \
64  d(CCRES_E_P_P_P ) \
65  d(CCRES_E_P_P_P_P ) \
66  d(CCRES_E_P_P_P_P_P ) \
67  d(CCRES_E_PIPLUS ) \
68  d(CCRES_E_P_PIPLUS ) \
69  d(CCRES_E_P_P_PIPLUS ) \
70  d(CCRES_E_P_P_P_PIPLUS ) \
71  d(CCRES_E_P_P_P_P_PIPLUS ) \
72  d(CCRES_E_P_P_P_P_P_PIPLUS ) \
73  d(CCRES_E_PHOTON ) \
74  d(CCRES_E_P_PHOTON ) \
75  d(CCRES_E_P_P_PHOTON ) \
76  d(CCRES_E_P_P_P_PHOTON ) \
77  d(CCRES_E_P_P_P_P_PHOTON ) \
78  d(CCRES_E_P_P_P_P_P_PHOTON ) \
79  d(CCRES_E_PIZERO ) \
80  d(CCRES_E_P_PIZERO ) \
81  d(CCRES_E_P_P_PIZERO ) \
82  d(CCRES_E_P_P_P_PIZERO ) \
83  d(CCRES_E_P_P_P_P_PIZERO ) \
84  d(CCRES_E_P_P_P_P_P_PIZERO ) \
85  d(NCRES_P ) \
86  d(NCRES_P_P ) \
87  d(NCRES_P_P_P ) \
88  d(NCRES_P_P_P_P ) \
89  d(NCRES_P_P_P_P_P ) \
90  d(NCRES_PIPLUS ) \
91  d(NCRES_P_PIPLUS ) \
92  d(NCRES_P_P_PIPLUS ) \
93  d(NCRES_P_P_P_PIPLUS ) \
94  d(NCRES_P_P_P_P_PIPLUS ) \
95  d(NCRES_P_P_P_P_P_PIPLUS ) \
96  d(NCRES_PIMINUS ) \
97  d(NCRES_P_PIMINUS ) \
98  d(NCRES_P_P_PIMINUS ) \
99  d(NCRES_P_P_P_PIMINUS ) \
100  d(NCRES_P_P_P_P_PIMINUS ) \
101  d(NCRES_P_P_P_P_P_PIMINUS ) \
102  d(NCRES_PHOTON ) \
103  d(NCRES_P_PHOTON ) \
104  d(NCRES_P_P_PHOTON ) \
105  d(NCRES_P_P_P_PHOTON ) \
106  d(NCRES_P_P_P_P_PHOTON ) \
107  d(NCRES_P_P_P_P_P_PHOTON ) \
108  d(NCRES_PIZERO ) \
109  d(NCRES_P_PIZERO ) \
110  d(NCRES_P_P_PIZERO ) \
111  d(NCRES_P_P_P_PIZERO ) \
112  d(NCRES_P_P_P_P_PIZERO ) \
113  d(NCRES_P_P_P_P_P_PIZERO ) \
114  d(CCDIS_MU ) \
115  d(CCDIS_MU_P ) \
116  d(CCDIS_MU_P_P ) \
117  d(CCDIS_MU_P_P_P ) \
118  d(CCDIS_MU_P_P_P_P ) \
119  d(CCDIS_MU_P_P_P_P_P ) \
120  d(CCDIS_MU_PIPLUS ) \
121  d(CCDIS_MU_P_PIPLUS ) \
122  d(CCDIS_MU_P_P_PIPLUS ) \
123  d(CCDIS_MU_P_P_P_PIPLUS ) \
124  d(CCDIS_MU_P_P_P_P_PIPLUS ) \
125  d(CCDIS_MU_P_P_P_P_P_PIPLUS ) \
126  d(CCDIS_MU_PHOTON ) \
127  d(CCDIS_MU_P_PHOTON ) \
128  d(CCDIS_MU_P_P_PHOTON ) \
129  d(CCDIS_MU_P_P_P_PHOTON ) \
130  d(CCDIS_MU_P_P_P_P_PHOTON ) \
131  d(CCDIS_MU_P_P_P_P_P_PHOTON ) \
132  d(CCDIS_MU_PIZERO ) \
133  d(CCDIS_MU_P_PIZERO ) \
134  d(CCDIS_MU_P_P_PIZERO ) \
135  d(CCDIS_MU_P_P_P_PIZERO ) \
136  d(CCDIS_MU_P_P_P_P_PIZERO ) \
137  d(CCDIS_MU_P_P_P_P_P_PIZERO ) \
138  d(NCDIS_P ) \
139  d(NCDIS_P_P ) \
140  d(NCDIS_P_P_P ) \
141  d(NCDIS_P_P_P_P ) \
142  d(NCDIS_P_P_P_P_P ) \
143  d(NCDIS_PIPLUS ) \
144  d(NCDIS_P_PIPLUS ) \
145  d(NCDIS_P_P_PIPLUS ) \
146  d(NCDIS_P_P_P_PIPLUS ) \
147  d(NCDIS_P_P_P_P_PIPLUS ) \
148  d(NCDIS_P_P_P_P_P_PIPLUS ) \
149  d(NCDIS_PIMINUS ) \
150  d(NCDIS_P_PIMINUS ) \
151  d(NCDIS_P_P_PIMINUS ) \
152  d(NCDIS_P_P_P_PIMINUS ) \
153  d(NCDIS_P_P_P_P_PIMINUS ) \
154  d(NCDIS_P_P_P_P_P_PIMINUS ) \
155  d(NCDIS_PHOTON ) \
156  d(NCDIS_P_PHOTON ) \
157  d(NCDIS_P_P_PHOTON ) \
158  d(NCDIS_P_P_P_PHOTON ) \
159  d(NCDIS_P_P_P_P_PHOTON ) \
160  d(NCDIS_P_P_P_P_P_PHOTON ) \
161  d(NCDIS_PIZERO ) \
162  d(NCDIS_P_PIZERO ) \
163  d(NCDIS_P_P_PIZERO ) \
164  d(NCDIS_P_P_P_PIZERO ) \
165  d(NCDIS_P_P_P_P_PIZERO ) \
166  d(NCDIS_P_P_P_P_P_PIZERO ) \
167  d(CCCOH ) \
168  d(NCCOH ) \
169  d(COSMIC_RAY_MU ) \
170  d(COSMIC_RAY_P ) \
171  d(COSMIC_RAY_E ) \
172  d(COSMIC_RAY_PHOTON ) \
173  d(COSMIC_RAY_OTHER ) \
174  d(BEAM_PARTICLE_MU ) \
175  d(BEAM_PARTICLE_P ) \
176  d(BEAM_PARTICLE_E ) \
177  d(BEAM_PARTICLE_PHOTON ) \
178  d(BEAM_PARTICLE_PI_PLUS ) \
179  d(BEAM_PARTICLE_PI_MINUS ) \
180  d(BEAM_PARTICLE_KAON_PLUS ) \
181  d(BEAM_PARTICLE_KAON_MINUS ) \
182  d(BEAM_PARTICLE_OTHER ) \
183  d(BEAM_PARTICLE_PI_PLUS_PI_PLUS ) \
184  d(BEAM_PARTICLE_PI_PLUS_PI_PLUS_PHOTON ) \
185  d(BEAM_PARTICLE_PI_PLUS_PI_PLUS_PIZERO ) \
186  d(BEAM_PARTICLE_PI_PLUS_COMPLEX ) \
187  d(BEAM_PARTICLE_PI_MINUS_PI_MINUS ) \
188  d(BEAM_PARTICLE_PI_MINUS_PI_MINUS_PHOTON ) \
189  d(BEAM_PARTICLE_PI_MINUS_PI_MINUS_PIZERO ) \
190  d(BEAM_PARTICLE_PI_MINUS_COMPLEX ) \
191  d(BEAM_PARTICLE_P_P ) \
192  d(BEAM_PARTICLE_P_P_PHOTON ) \
193  d(BEAM_PARTICLE_P_P_PHOTON_PHOTON ) \
194  d(BEAM_PARTICLE_P_P_PHOTON_PHOTON_PHOTON ) \
195  d(BEAM_PARTICLE_P_P_PHOTON_PHOTON_PHOTON_PHOTON ) \
196  d(BEAM_PARTICLE_P_P_P ) \
197  d(BEAM_PARTICLE_P_P_P_PHOTON ) \
198  d(BEAM_PARTICLE_P_P_P_PHOTON_PHOTON ) \
199  d(BEAM_PARTICLE_P_P_P_PHOTON_PHOTON_PHOTON ) \
200  d(BEAM_PARTICLE_P_P_P_P ) \
201  d(BEAM_PARTICLE_P_P_P_P_PHOTON ) \
202  d(BEAM_PARTICLE_P_P_P_P_PHOTON_PHOTON ) \
203  d(BEAM_PARTICLE_P_P_P_P_P ) \
204  d(BEAM_PARTICLE_P_P_P_P_P_PHOTON ) \
205  d(BEAM_PARTICLE_P_P_P_P_P_P ) \
206  d(BEAM_PARTICLE_P_COMPLEX ) \
207  d(BEAM_PARTICLE_MU_E ) \
208  d(BEAM_PARTICLE_MU_COMPLEX ) \
209  d(BEAM_PARTICLE_KAON_PLUS_MU ) \
210  d(BEAM_PARTICLE_KAON_PLUS_KAON_PLUS_KAON0L_COMPLEX ) \
211  d(BEAM_PARTICLE_KAON_PLUS_KAON_PLUS_COMPLEX ) \
212  d(BEAM_PARTICLE_KAON_PLUS_COMPLEX ) \
213  d(BEAM_PARTICLE_KAON_MINUS_MU ) \
214  d(BEAM_PARTICLE_KAON_MINUS_KAON_MINUS_KAON0L_COMPLEX) \
215  d(BEAM_PARTICLE_KAON_MINUS_KAON_MINUS_COMPLEX ) \
216  d(BEAM_PARTICLE_KAON_MINUS_COMPLEX ) \
217  d(BEAM_PARTICLE_E_COMPLEX ) \
218  d(BEAM_PARTICLE_COMPLEX_HIERARCHY ) \
219  d(BEAM_PARTICLE_UNKNOWN_HIERARCHY ) \
220  d(OTHER_INTERACTION ) \
221  d(ALL_INTERACTIONS )
222 
226 #define GET_INTERACTION_TYPE_ENTRY(a) \
227  a,
228 
232 #define GET_INTERACTION_TYPE_NAME_SWITCH(a) \
233  case a : return std::string(#a);
234 // clang-format on
235 
236 class InteractionDescriptor;
237 
242 {
243 public:
247  enum InteractionType : unsigned int
248  {
250  };
251 
256  {
257  public:
261  InteractionParameters();
262 
263  unsigned int m_nNonNeutrons;
264  unsigned int m_nMuons;
265  unsigned int m_nElectrons;
266  unsigned int m_nPhotons;
267  unsigned int m_nProtons;
268  unsigned int m_nPiPlus;
269  unsigned int m_nPiMinus;
270  unsigned int m_nPiZero;
271  unsigned int m_nKaonPlus;
272  unsigned int m_nKaonMinus;
273  unsigned int m_nKaon0L;
274  };
275 
283  static InteractionType GetInteractionType(const pandora::MCParticleList &mcPrimaryList);
284 
292  static InteractionDescriptor GetInteractionDescriptor(const pandora::MCParticleList &mcPrimaryList);
293 
301  static InteractionType GetTestBeamHierarchyInteractionType(const pandora::MCParticleList &mcPrimaryList);
302 
309  static void SetInteractionParameters(const pandora::MCParticleList &mcPrimaryList, InteractionParameters &parameters);
310 
319  static InteractionType CosmicRayHypothesis(const pandora::MCParticleList &mcPrimaryList, const InteractionParameters &parameters);
320 
328  static std::string ToString(const InteractionType interactionType);
329 };
330 
332 {
333 public:
349  InteractionDescriptor(const bool isCC, const bool isQE, const bool isRes, const bool isDIS, const bool isCoherent, const bool isNumu,
350  const bool isNue, const unsigned int nPiPlus, const unsigned int nPiMinus, const unsigned int nPhotons, const unsigned int nProtons);
351 
357  bool IsCC() const;
358 
364  bool IsQE() const;
365 
371  bool IsResonant() const;
372 
378  bool IsDIS() const;
379 
385  bool IsCoherent() const;
386 
392  bool IsMuonNeutrino() const;
393 
399  bool IsElectronNeutrino() const;
400 
406  unsigned int GetNumPiZero() const;
407 
413  unsigned int GetNumPiPlus() const;
414 
420  unsigned int GetNumPiMinus() const;
421 
427  unsigned int GetNumPhotons() const;
428 
434  unsigned int GetNumProtons() const;
435 
442  int GetUniqueId() const;
443 
449  const std::string &ToString() const;
450 
451  static const int CC;
452  static const int NC;
453  static const int QE;
454  static const int RES;
455  static const int DIS;
456  static const int COH;
457  static const int OTH;
458  static const int MU;
459  static const int E;
460  static const int PIZERO;
461  static const int PIPLUS;
462  static const int PIMINUS;
463  static const int PHOTON;
464  static const int NP;
465 
466 private:
467  const bool m_isCC;
468  const bool m_isQE;
469  const bool m_isResonant;
470  const bool m_isDIS;
471  const bool m_isCoherent;
472  const bool m_isNumu;
473  const bool m_isNue;
474  const unsigned int m_nPiZero;
475  const unsigned int m_nPiPlus;
476  const unsigned int m_nPiMinus;
477  const unsigned int m_nPhotons;
478  const unsigned int m_nProtons;
479  int m_id;
480  std::string m_descriptor;
481 };
482 
483 //------------------------------------------------------------------------------------------------------------------------------------------
484 
485 inline bool InteractionDescriptor::IsCC() const
486 {
487  return m_isCC;
488 }
489 
490 //------------------------------------------------------------------------------------------------------------------------------------------
491 
492 inline bool InteractionDescriptor::IsQE() const
493 {
494  return m_isQE;
495 }
496 
497 //------------------------------------------------------------------------------------------------------------------------------------------
498 
500 {
501  return m_isResonant;
502 }
503 
504 //------------------------------------------------------------------------------------------------------------------------------------------
505 
506 inline bool InteractionDescriptor::IsDIS() const
507 {
508  return m_isDIS;
509 }
510 
511 //------------------------------------------------------------------------------------------------------------------------------------------
512 
514 {
515  return m_isCoherent;
516 }
517 
518 //------------------------------------------------------------------------------------------------------------------------------------------
519 
521 {
522  return m_isNumu;
523 }
524 
525 //------------------------------------------------------------------------------------------------------------------------------------------
526 
528 {
529  return m_isNue;
530 }
531 
532 //------------------------------------------------------------------------------------------------------------------------------------------
533 
534 inline unsigned int InteractionDescriptor::GetNumPiZero() const
535 {
536  return m_nPiZero;
537 }
538 
539 //------------------------------------------------------------------------------------------------------------------------------------------
540 
541 inline unsigned int InteractionDescriptor::GetNumPiPlus() const
542 {
543  return m_nPiPlus;
544 }
545 
546 //------------------------------------------------------------------------------------------------------------------------------------------
547 
548 inline unsigned int InteractionDescriptor::GetNumPiMinus() const
549 {
550  return m_nPiMinus;
551 }
552 
553 //------------------------------------------------------------------------------------------------------------------------------------------
554 
555 inline unsigned int InteractionDescriptor::GetNumPhotons() const
556 {
557  return m_nPhotons;
558 }
559 
560 //------------------------------------------------------------------------------------------------------------------------------------------
561 
562 inline unsigned int InteractionDescriptor::GetNumProtons() const
563 {
564  return m_nProtons;
565 }
566 
567 //------------------------------------------------------------------------------------------------------------------------------------------
568 
570 {
571  return m_id;
572 }
573 
574 //------------------------------------------------------------------------------------------------------------------------------------------
575 
576 inline const std::string &InteractionDescriptor::ToString() const
577 {
578  return m_descriptor;
579 }
580 
581 } // namespace lar_content
582 
583 #endif // #ifndef LAR_INTERACTION_TYPE_HELPER_H
unsigned int GetNumPiZero() const
Retrieve the number of pi zeros.
bool IsElectronNeutrino() const
Whether or not the interaction is electron neutrino.
bool IsQE() const
Whether or not the interaction is QE.
unsigned int GetNumPhotons() const
Retrieve the number of photons.
unsigned int GetNumPiMinus() const
Retrieve the number of pi minus.
bool IsResonant() const
Whether or not the interaction is resonant.
static void SetInteractionParameters(const pandora::MCParticleList &mcPrimaryList, InteractionParameters &parameters)
Set parameters describing the number and species of primary interaction products. ...
static InteractionType GetInteractionType(const pandora::MCParticleList &mcPrimaryList)
Get the interaction type of an event.
bool IsCoherent() const
Whether or not the interaction is coherent.
const std::string & ToString() const
Retrieve the string descriptor for the event.
unsigned int GetNumProtons() const
Retrieve the number of protons.
#define GET_INTERACTION_TYPE_ENTRY(a)
The particle type enum macro.
Header file for the lar monte carlo particle helper helper class.
static std::string ToString(const InteractionType interactionType)
Get a string representation of an interaction type.
Header file for the lar mc particle class.
bool IsMuonNeutrino() const
Whether or not the interaction is muon neutrino.
int GetUniqueId() const
Retrieve a unique ID describing the event (that is, a given type of interaction with specific final s...
static InteractionType GetTestBeamHierarchyInteractionType(const pandora::MCParticleList &mcPrimaryList)
Get the test beam hierarchy interaction type of an event.
static InteractionDescriptor GetInteractionDescriptor(const pandora::MCParticleList &mcPrimaryList)
Get the interaction descriptor of an event.
static InteractionType CosmicRayHypothesis(const pandora::MCParticleList &mcPrimaryList, const InteractionParameters &parameters)
Get the interaction type of an event under a cosmic ray hypothesis.
unsigned int GetNumPiPlus() const
Retrieve the number of pi plus.
bool IsDIS() const
Whether or not the interaction is DIS.
bool IsCC() const
Whether or not the interaction is CC.