20 if (mcPrimaryList.empty())
21 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
24 LArInteractionTypeHelper::SetInteractionParameters(mcPrimaryList, parameters);
26 const InteractionType cosmicRayHypothesis(LArInteractionTypeHelper::CosmicRayHypothesis(mcPrimaryList, parameters));
28 if (OTHER_INTERACTION != cosmicRayHypothesis)
29 return cosmicRayHypothesis;
31 if ((1 == mcPrimaryList.size()) && LArMCParticleHelper::IsBeamParticle(mcPrimaryList.front()))
34 return BEAM_PARTICLE_MU;
36 return BEAM_PARTICLE_P;
38 return BEAM_PARTICLE_E;
40 return BEAM_PARTICLE_PHOTON;
42 return BEAM_PARTICLE_PI_PLUS;
44 return BEAM_PARTICLE_PI_MINUS;
46 return BEAM_PARTICLE_KAON_PLUS;
48 return BEAM_PARTICLE_KAON_MINUS;
50 return BEAM_PARTICLE_OTHER;
53 const MCParticle *pMCNeutrino(
nullptr);
55 for (
const MCParticle *
const pMCPrimary : mcPrimaryList)
57 if (!LArMCParticleHelper::IsBeamNeutrinoFinalState(pMCPrimary) ||
58 (pMCNeutrino && (pMCNeutrino != LArMCParticleHelper::GetParentMCParticle(pMCPrimary))))
59 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
61 pMCNeutrino = LArMCParticleHelper::GetParentMCParticle(pMCPrimary);
65 throw StatusCodeException(STATUS_CODE_FAILURE);
67 const int nuNuanceCode(LArMCParticleHelper::GetNuanceCode(pMCNeutrino));
69 if (1001 == nuNuanceCode)
78 return CCQEL_MU_P_P_P;
80 return CCQEL_MU_P_P_P_P;
82 return CCQEL_MU_P_P_P_P_P;
93 return CCQEL_E_P_P_P_P;
95 return CCQEL_E_P_P_P_P_P;
98 if (1002 == nuNuanceCode)
107 return NCQEL_P_P_P_P;
109 return NCQEL_P_P_P_P_P;
112 if ((nuNuanceCode >= 1003) && (nuNuanceCode <= 1005))
121 return CCRES_MU_P_P_P;
123 return CCRES_MU_P_P_P_P;
125 return CCRES_MU_P_P_P_P_P;
128 return CCRES_MU_PIPLUS;
130 return CCRES_MU_P_PIPLUS;
132 return CCRES_MU_P_P_PIPLUS;
134 return CCRES_MU_P_P_P_PIPLUS;
136 return CCRES_MU_P_P_P_P_PIPLUS;
138 return CCRES_MU_P_P_P_P_P_PIPLUS;
141 return CCRES_MU_PHOTON;
143 return CCRES_MU_P_PHOTON;
145 return CCRES_MU_P_P_PHOTON;
147 return CCRES_MU_P_P_P_PHOTON;
149 return CCRES_MU_P_P_P_P_PHOTON;
151 return CCRES_MU_P_P_P_P_P_PHOTON;
154 return CCRES_MU_PIZERO;
156 return CCRES_MU_P_PIZERO;
158 return CCRES_MU_P_P_PIZERO;
160 return CCRES_MU_P_P_P_PIZERO;
162 return CCRES_MU_P_P_P_P_PIZERO;
164 return CCRES_MU_P_P_P_P_P_PIZERO;
173 return CCRES_E_P_P_P;
175 return CCRES_E_P_P_P_P;
177 return CCRES_E_P_P_P_P_P;
180 return CCRES_E_PIPLUS;
182 return CCRES_E_P_PIPLUS;
184 return CCRES_E_P_P_PIPLUS;
186 return CCRES_E_P_P_P_PIPLUS;
188 return CCRES_E_P_P_P_P_PIPLUS;
190 return CCRES_E_P_P_P_P_P_PIPLUS;
193 return CCRES_E_PHOTON;
195 return CCRES_E_P_PHOTON;
197 return CCRES_E_P_P_PHOTON;
199 return CCRES_E_P_P_P_PHOTON;
201 return CCRES_E_P_P_P_P_PHOTON;
203 return CCRES_E_P_P_P_P_P_PHOTON;
206 return CCRES_E_PIZERO;
208 return CCRES_E_P_PIZERO;
210 return CCRES_E_P_P_PIZERO;
212 return CCRES_E_P_P_P_PIZERO;
214 return CCRES_E_P_P_P_P_PIZERO;
216 return CCRES_E_P_P_P_P_P_PIZERO;
219 if ((nuNuanceCode >= 1006) && (nuNuanceCode <= 1009))
228 return NCRES_P_P_P_P;
230 return NCRES_P_P_P_P_P;
235 return NCRES_P_PIPLUS;
237 return NCRES_P_P_PIPLUS;
239 return NCRES_P_P_P_PIPLUS;
241 return NCRES_P_P_P_P_PIPLUS;
243 return NCRES_P_P_P_P_P_PIPLUS;
246 return NCRES_PIMINUS;
248 return NCRES_P_PIMINUS;
250 return NCRES_P_P_PIMINUS;
252 return NCRES_P_P_P_PIMINUS;
254 return NCRES_P_P_P_P_PIMINUS;
256 return NCRES_P_P_P_P_P_PIMINUS;
261 return NCRES_P_PHOTON;
263 return NCRES_P_P_PHOTON;
265 return NCRES_P_P_P_PHOTON;
267 return NCRES_P_P_P_P_PHOTON;
269 return NCRES_P_P_P_P_P_PHOTON;
274 return NCRES_P_PIZERO;
276 return NCRES_P_P_PIZERO;
278 return NCRES_P_P_P_PIZERO;
280 return NCRES_P_P_P_P_PIZERO;
282 return NCRES_P_P_P_P_P_PIZERO;
285 if (1091 == nuNuanceCode)
294 return CCDIS_MU_P_P_P;
296 return CCDIS_MU_P_P_P_P;
298 return CCDIS_MU_P_P_P_P_P;
301 return CCDIS_MU_PIPLUS;
303 return CCDIS_MU_P_PIPLUS;
305 return CCDIS_MU_P_P_PIPLUS;
307 return CCDIS_MU_P_P_P_PIPLUS;
309 return CCDIS_MU_P_P_P_P_PIPLUS;
311 return CCDIS_MU_P_P_P_P_P_PIPLUS;
314 return CCDIS_MU_PHOTON;
316 return CCDIS_MU_P_PHOTON;
318 return CCDIS_MU_P_P_PHOTON;
320 return CCDIS_MU_P_P_P_PHOTON;
322 return CCDIS_MU_P_P_P_P_PHOTON;
324 return CCDIS_MU_P_P_P_P_P_PHOTON;
327 return CCDIS_MU_PIZERO;
329 return CCDIS_MU_P_PIZERO;
331 return CCDIS_MU_P_P_PIZERO;
333 return CCDIS_MU_P_P_P_PIZERO;
335 return CCDIS_MU_P_P_P_P_PIZERO;
337 return CCDIS_MU_P_P_P_P_P_PIZERO;
340 if (1092 == nuNuanceCode)
349 return NCDIS_P_P_P_P;
351 return NCDIS_P_P_P_P_P;
356 return NCDIS_P_PIPLUS;
358 return NCDIS_P_P_PIPLUS;
360 return NCDIS_P_P_P_PIPLUS;
362 return NCDIS_P_P_P_P_PIPLUS;
364 return NCDIS_P_P_P_P_P_PIPLUS;
367 return NCDIS_PIMINUS;
369 return NCDIS_P_PIMINUS;
371 return NCDIS_P_P_PIMINUS;
373 return NCDIS_P_P_P_PIMINUS;
375 return NCDIS_P_P_P_P_PIMINUS;
377 return NCDIS_P_P_P_P_P_PIMINUS;
382 return NCDIS_P_PHOTON;
384 return NCDIS_P_P_PHOTON;
386 return NCDIS_P_P_P_PHOTON;
388 return NCDIS_P_P_P_P_PHOTON;
390 return NCDIS_P_P_P_P_P_PHOTON;
395 return NCDIS_P_PIZERO;
397 return NCDIS_P_P_PIZERO;
399 return NCDIS_P_P_P_PIZERO;
401 return NCDIS_P_P_P_P_PIZERO;
403 return NCDIS_P_P_P_P_P_PIZERO;
406 if (1096 == nuNuanceCode)
408 if (1097 == nuNuanceCode)
411 return OTHER_INTERACTION;
418 if (mcPrimaryList.empty())
419 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
422 LArInteractionTypeHelper::SetInteractionParameters(mcPrimaryList, parameters);
424 const MCParticle *pMCNeutrino(
nullptr);
426 for (
const MCParticle *
const pMCPrimary : mcPrimaryList)
428 if (!LArMCParticleHelper::IsBeamNeutrinoFinalState(pMCPrimary) ||
429 (pMCNeutrino && (pMCNeutrino != LArMCParticleHelper::GetParentMCParticle(pMCPrimary))))
430 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
432 pMCNeutrino = LArMCParticleHelper::GetParentMCParticle(pMCPrimary);
436 throw StatusCodeException(STATUS_CODE_FAILURE);
438 const int nuNuanceCode(LArMCParticleHelper::GetNuanceCode(pMCNeutrino));
440 if (1001 == nuNuanceCode)
443 true,
true,
false,
false,
false, parameters.
m_nMuons == 1, parameters.
m_nElectrons == 1, 0, 0, 0, parameters.
m_nProtons);
446 if (1002 == nuNuanceCode)
448 return InteractionDescriptor(
false,
true,
false,
false,
false,
false,
false, 0, 0, 0, parameters.
m_nProtons);
451 if ((nuNuanceCode >= 1003) && (nuNuanceCode <= 1005))
457 if ((nuNuanceCode >= 1006) && (nuNuanceCode <= 1009))
463 if (1091 == nuNuanceCode)
469 if (1092 == nuNuanceCode)
475 if (1096 == nuNuanceCode)
477 return InteractionDescriptor(
false,
false,
false,
false,
true, parameters.
m_nMuons == 1, parameters.
m_nElectrons == 1, 0, 0, 0, 0);
479 if (1097 == nuNuanceCode)
481 return InteractionDescriptor(
true,
false,
false,
false,
true, parameters.
m_nMuons == 1, parameters.
m_nElectrons == 1, 0, 0, 0, 0);
484 return InteractionDescriptor(
false,
false,
false,
false,
false,
false,
false, 0, 0, 0, 0);
491 if (mcPrimaryList.empty())
492 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
495 LArInteractionTypeHelper::SetInteractionParameters(mcPrimaryList, parameters);
497 const InteractionType cosmicRayHypothesis(LArInteractionTypeHelper::CosmicRayHypothesis(mcPrimaryList, parameters));
499 if (OTHER_INTERACTION != cosmicRayHypothesis)
500 return cosmicRayHypothesis;
502 int targetParentId(0);
504 for (
const MCParticle *
const pMCPrimary : mcPrimaryList)
506 if (LArMCParticleHelper::GetParentMCParticle(pMCPrimary) != pMCPrimary)
509 if (13 == std::fabs(pMCPrimary->GetParticleId()))
511 else if (11 == std::fabs(pMCPrimary->GetParticleId()))
513 else if (2212 == std::fabs(pMCPrimary->GetParticleId()))
515 else if (22 == pMCPrimary->GetParticleId())
517 else if (211 == pMCPrimary->GetParticleId())
519 else if (-211 == pMCPrimary->GetParticleId())
521 else if (321 == pMCPrimary->GetParticleId())
523 else if (-321 == pMCPrimary->GetParticleId())
527 targetParentId = pMCPrimary->GetParticleId();
530 MCParticleSet piZero, kaon0L;
531 for (
const MCParticle *
const pMCPrimary : mcPrimaryList)
533 if (22 == pMCPrimary->GetParticleId() && pMCPrimary->GetParentList().size() == 1)
535 const MCParticle *
const pParentMCParticle(pMCPrimary->GetParentList().front());
536 if (pParentMCParticle->GetParticleId() == 111 && !piZero.count(pParentMCParticle))
537 piZero.insert(pParentMCParticle);
539 else if ((111 == pMCPrimary->GetParticleId() || 211 == std::fabs(pMCPrimary->GetParticleId())) && pMCPrimary->GetParentList().size() == 1)
541 const MCParticle *
const pParentMCParticle(pMCPrimary->GetParentList().front());
542 if (pParentMCParticle->GetParticleId() == 130 && !kaon0L.count(pParentMCParticle))
543 kaon0L.insert(pParentMCParticle);
550 if (211 == targetParentId)
553 return BEAM_PARTICLE_PI_PLUS_PI_PLUS;
555 return BEAM_PARTICLE_PI_PLUS_PI_PLUS_PHOTON;
557 return BEAM_PARTICLE_PI_PLUS_PI_PLUS_PIZERO;
558 return BEAM_PARTICLE_PI_PLUS_COMPLEX;
560 else if (-211 == targetParentId)
563 return BEAM_PARTICLE_PI_MINUS_PI_MINUS;
565 return BEAM_PARTICLE_PI_MINUS_PI_MINUS_PHOTON;
567 return BEAM_PARTICLE_PI_MINUS_PI_MINUS_PIZERO;
568 return BEAM_PARTICLE_PI_MINUS_COMPLEX;
570 else if (2212 == targetParentId)
573 return BEAM_PARTICLE_P_P;
575 return BEAM_PARTICLE_P_P_PHOTON;
577 return BEAM_PARTICLE_P_P_PHOTON_PHOTON;
579 return BEAM_PARTICLE_P_P_PHOTON_PHOTON_PHOTON;
581 return BEAM_PARTICLE_P_P_PHOTON_PHOTON_PHOTON_PHOTON;
584 return BEAM_PARTICLE_P_P_P;
586 return BEAM_PARTICLE_P_P_P_PHOTON;
588 return BEAM_PARTICLE_P_P_P_PHOTON_PHOTON;
590 return BEAM_PARTICLE_P_P_P_PHOTON_PHOTON_PHOTON;
593 return BEAM_PARTICLE_P_P_P_P;
595 return BEAM_PARTICLE_P_P_P_P_PHOTON;
597 return BEAM_PARTICLE_P_P_P_P_PHOTON_PHOTON;
600 return BEAM_PARTICLE_P_P_P_P_P;
602 return BEAM_PARTICLE_P_P_P_P_P_PHOTON;
605 return BEAM_PARTICLE_P_P_P_P_P_P;
607 return BEAM_PARTICLE_P_COMPLEX;
609 else if (13 == std::fabs(targetParentId))
612 return BEAM_PARTICLE_MU;
614 return BEAM_PARTICLE_MU_E;
615 return BEAM_PARTICLE_MU_COMPLEX;
617 else if (321 == targetParentId)
620 return BEAM_PARTICLE_KAON_PLUS_MU;
622 return BEAM_PARTICLE_KAON_PLUS_KAON_PLUS_KAON0L_COMPLEX;
624 return BEAM_PARTICLE_KAON_PLUS_KAON_PLUS_COMPLEX;
625 return BEAM_PARTICLE_KAON_PLUS_COMPLEX;
627 else if (-321 == targetParentId)
630 return BEAM_PARTICLE_KAON_MINUS_MU;
632 return BEAM_PARTICLE_KAON_MINUS_KAON_MINUS_KAON0L_COMPLEX;
634 return BEAM_PARTICLE_KAON_MINUS_KAON_MINUS_COMPLEX;
635 return BEAM_PARTICLE_KAON_MINUS_COMPLEX;
637 else if (11 == std::fabs(targetParentId))
640 return BEAM_PARTICLE_E;
641 return BEAM_PARTICLE_E_COMPLEX;
645 return BEAM_PARTICLE_COMPLEX_HIERARCHY;
647 return BEAM_PARTICLE_UNKNOWN_HIERARCHY;
652 void LArInteractionTypeHelper::SetInteractionParameters(
const MCParticleList &mcPrimaryList,
InteractionParameters ¶meters)
654 for (
const MCParticle *
const pMCPrimary : mcPrimaryList)
656 if (2112 != pMCPrimary->GetParticleId())
658 if (13 == std::fabs(pMCPrimary->GetParticleId()))
660 if (11 == std::fabs(pMCPrimary->GetParticleId()))
662 else if (2212 == std::fabs(pMCPrimary->GetParticleId()))
664 else if (22 == pMCPrimary->GetParticleId())
666 else if (211 == pMCPrimary->GetParticleId())
668 else if (-211 == pMCPrimary->GetParticleId())
670 else if (321 == pMCPrimary->GetParticleId())
672 else if (-321 == pMCPrimary->GetParticleId())
682 if ((1 == mcPrimaryList.size()) && LArMCParticleHelper::IsCosmicRay(mcPrimaryList.front()))
685 return COSMIC_RAY_MU;
691 return COSMIC_RAY_PHOTON;
693 return COSMIC_RAY_OTHER;
696 return OTHER_INTERACTION;
703 switch (interactionType)
707 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
714 LArInteractionTypeHelper::InteractionParameters::InteractionParameters() :
748 const bool isNumu,
const bool isNue,
const unsigned int nPiPlus,
const unsigned int nPiMinus,
const unsigned int nPhotons,
749 const unsigned int nProtons) :
Header file for the interaction type helper class.
#define GET_INTERACTION_TYPE_NAME_SWITCH(a)
The name switch statement macro.
const unsigned int m_nPiPlus
const unsigned int m_nPhotons
Header file for the lar monitoring helper helper class.
const unsigned int m_nProtons
unsigned int m_nNonNeutrons
Header file for the lar monte carlo particle helper helper class.
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
const unsigned int m_nPiZero
InteractionType
InteractionType enum.
const unsigned int m_nPiMinus
InteractionDescriptor(const bool isCC, const bool isQE, const bool isRes, const bool isDIS, const bool isCoherent, const bool isNumu, const bool isNue, const unsigned int nPiPlus, const unsigned int nPiMinus, const unsigned int nPhotons, const unsigned int nProtons)
Constructor.
unsigned int m_nElectrons
#define INTERACTION_TYPE_TABLE(d)
unsigned int m_nKaonMinus