LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
LArInteractionTypeHelper.cc
Go to the documentation of this file.
1 
12 
13 using namespace pandora;
14 
15 namespace lar_content
16 {
17 
18 LArInteractionTypeHelper::InteractionType LArInteractionTypeHelper::GetInteractionType(const MCParticleList &mcPrimaryList)
19 {
20  if (mcPrimaryList.empty())
21  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
22 
23  InteractionParameters parameters;
24  LArInteractionTypeHelper::SetInteractionParameters(mcPrimaryList, parameters);
25 
26  const InteractionType cosmicRayHypothesis(LArInteractionTypeHelper::CosmicRayHypothesis(mcPrimaryList, parameters));
27 
28  if (OTHER_INTERACTION != cosmicRayHypothesis)
29  return cosmicRayHypothesis;
30 
31  if ((1 == mcPrimaryList.size()) && LArMCParticleHelper::IsBeamParticle(mcPrimaryList.front()))
32  {
33  if (1 == parameters.m_nMuons)
34  return BEAM_PARTICLE_MU;
35  if (1 == parameters.m_nProtons)
36  return BEAM_PARTICLE_P;
37  if (1 == parameters.m_nElectrons)
38  return BEAM_PARTICLE_E;
39  if (1 == parameters.m_nPhotons)
40  return BEAM_PARTICLE_PHOTON;
41  if (1 == parameters.m_nPiPlus)
42  return BEAM_PARTICLE_PI_PLUS;
43  if (1 == parameters.m_nPiMinus)
44  return BEAM_PARTICLE_PI_MINUS;
45  if (1 == parameters.m_nKaonPlus)
46  return BEAM_PARTICLE_KAON_PLUS;
47  if (1 == parameters.m_nKaonMinus)
48  return BEAM_PARTICLE_KAON_MINUS;
49  else
50  return BEAM_PARTICLE_OTHER;
51  }
52 
53  const MCParticle *pMCNeutrino(nullptr);
54 
55  for (const MCParticle *const pMCPrimary : mcPrimaryList)
56  {
57  if (!LArMCParticleHelper::IsBeamNeutrinoFinalState(pMCPrimary) ||
58  (pMCNeutrino && (pMCNeutrino != LArMCParticleHelper::GetParentMCParticle(pMCPrimary))))
59  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
60 
61  pMCNeutrino = LArMCParticleHelper::GetParentMCParticle(pMCPrimary);
62  }
63 
64  if (!pMCNeutrino)
65  throw StatusCodeException(STATUS_CODE_FAILURE);
66 
67  const int nuNuanceCode(LArMCParticleHelper::GetNuanceCode(pMCNeutrino));
68 
69  if (1001 == nuNuanceCode)
70  {
71  if ((1 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (0 == parameters.m_nProtons))
72  return CCQEL_MU;
73  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (1 == parameters.m_nProtons))
74  return CCQEL_MU_P;
75  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (2 == parameters.m_nProtons))
76  return CCQEL_MU_P_P;
77  if ((4 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (3 == parameters.m_nProtons))
78  return CCQEL_MU_P_P_P;
79  if ((5 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (4 == parameters.m_nProtons))
80  return CCQEL_MU_P_P_P_P;
81  if ((6 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (5 == parameters.m_nProtons))
82  return CCQEL_MU_P_P_P_P_P;
83 
84  if ((1 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (0 == parameters.m_nProtons))
85  return CCQEL_E;
86  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (1 == parameters.m_nProtons))
87  return CCQEL_E_P;
88  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (2 == parameters.m_nProtons))
89  return CCQEL_E_P_P;
90  if ((4 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (3 == parameters.m_nProtons))
91  return CCQEL_E_P_P_P;
92  if ((5 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (4 == parameters.m_nProtons))
93  return CCQEL_E_P_P_P_P;
94  if ((6 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (5 == parameters.m_nProtons))
95  return CCQEL_E_P_P_P_P_P;
96  }
97 
98  if (1002 == nuNuanceCode)
99  {
100  if ((1 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons))
101  return NCQEL_P;
102  if ((2 == parameters.m_nNonNeutrons) && (2 == parameters.m_nProtons))
103  return NCQEL_P_P;
104  if ((3 == parameters.m_nNonNeutrons) && (3 == parameters.m_nProtons))
105  return NCQEL_P_P_P;
106  if ((4 == parameters.m_nNonNeutrons) && (4 == parameters.m_nProtons))
107  return NCQEL_P_P_P_P;
108  if ((5 == parameters.m_nNonNeutrons) && (5 == parameters.m_nProtons))
109  return NCQEL_P_P_P_P_P;
110  }
111 
112  if ((nuNuanceCode >= 1003) && (nuNuanceCode <= 1005))
113  {
114  if ((1 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (0 == parameters.m_nProtons))
115  return CCRES_MU;
116  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (1 == parameters.m_nProtons))
117  return CCRES_MU_P;
118  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (2 == parameters.m_nProtons))
119  return CCRES_MU_P_P;
120  if ((4 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (3 == parameters.m_nProtons))
121  return CCRES_MU_P_P_P;
122  if ((5 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (4 == parameters.m_nProtons))
123  return CCRES_MU_P_P_P_P;
124  if ((6 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (5 == parameters.m_nProtons))
125  return CCRES_MU_P_P_P_P_P;
126 
127  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (0 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
128  return CCRES_MU_PIPLUS;
129  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (1 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
130  return CCRES_MU_P_PIPLUS;
131  if ((4 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (2 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
132  return CCRES_MU_P_P_PIPLUS;
133  if ((5 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (3 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
134  return CCRES_MU_P_P_P_PIPLUS;
135  if ((6 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (4 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
136  return CCRES_MU_P_P_P_P_PIPLUS;
137  if ((7 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (5 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
138  return CCRES_MU_P_P_P_P_P_PIPLUS;
139 
140  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (0 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
141  return CCRES_MU_PHOTON;
142  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (1 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
143  return CCRES_MU_P_PHOTON;
144  if ((4 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (2 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
145  return CCRES_MU_P_P_PHOTON;
146  if ((5 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (3 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
147  return CCRES_MU_P_P_P_PHOTON;
148  if ((6 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (4 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
149  return CCRES_MU_P_P_P_P_PHOTON;
150  if ((7 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (5 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
151  return CCRES_MU_P_P_P_P_P_PHOTON;
152 
153  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (0 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
154  return CCRES_MU_PIZERO;
155  if ((4 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (1 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
156  return CCRES_MU_P_PIZERO;
157  if ((5 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (2 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
158  return CCRES_MU_P_P_PIZERO;
159  if ((6 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (3 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
160  return CCRES_MU_P_P_P_PIZERO;
161  if ((7 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (4 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
162  return CCRES_MU_P_P_P_P_PIZERO;
163  if ((8 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (5 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
164  return CCRES_MU_P_P_P_P_P_PIZERO;
165 
166  if ((1 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (0 == parameters.m_nProtons))
167  return CCRES_E;
168  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (1 == parameters.m_nProtons))
169  return CCRES_E_P;
170  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (2 == parameters.m_nProtons))
171  return CCRES_E_P_P;
172  if ((4 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (3 == parameters.m_nProtons))
173  return CCRES_E_P_P_P;
174  if ((5 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (4 == parameters.m_nProtons))
175  return CCRES_E_P_P_P_P;
176  if ((6 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (5 == parameters.m_nProtons))
177  return CCRES_E_P_P_P_P_P;
178 
179  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (0 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
180  return CCRES_E_PIPLUS;
181  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (1 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
182  return CCRES_E_P_PIPLUS;
183  if ((4 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (2 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
184  return CCRES_E_P_P_PIPLUS;
185  if ((5 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (3 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
186  return CCRES_E_P_P_P_PIPLUS;
187  if ((6 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (4 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
188  return CCRES_E_P_P_P_P_PIPLUS;
189  if ((7 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (5 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
190  return CCRES_E_P_P_P_P_P_PIPLUS;
191 
192  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (0 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
193  return CCRES_E_PHOTON;
194  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (1 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
195  return CCRES_E_P_PHOTON;
196  if ((4 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (2 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
197  return CCRES_E_P_P_PHOTON;
198  if ((5 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (3 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
199  return CCRES_E_P_P_P_PHOTON;
200  if ((6 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (4 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
201  return CCRES_E_P_P_P_P_PHOTON;
202  if ((7 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (5 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
203  return CCRES_E_P_P_P_P_P_PHOTON;
204 
205  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (0 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
206  return CCRES_E_PIZERO;
207  if ((4 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (1 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
208  return CCRES_E_P_PIZERO;
209  if ((5 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (2 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
210  return CCRES_E_P_P_PIZERO;
211  if ((6 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (3 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
212  return CCRES_E_P_P_P_PIZERO;
213  if ((7 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (4 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
214  return CCRES_E_P_P_P_P_PIZERO;
215  if ((8 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons) && (5 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
216  return CCRES_E_P_P_P_P_P_PIZERO;
217  }
218 
219  if ((nuNuanceCode >= 1006) && (nuNuanceCode <= 1009))
220  {
221  if ((1 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons))
222  return NCRES_P;
223  if ((2 == parameters.m_nNonNeutrons) && (2 == parameters.m_nProtons))
224  return NCRES_P_P;
225  if ((3 == parameters.m_nNonNeutrons) && (3 == parameters.m_nProtons))
226  return NCRES_P_P_P;
227  if ((4 == parameters.m_nNonNeutrons) && (4 == parameters.m_nProtons))
228  return NCRES_P_P_P_P;
229  if ((5 == parameters.m_nNonNeutrons) && (5 == parameters.m_nProtons))
230  return NCRES_P_P_P_P_P;
231 
232  if ((1 == parameters.m_nNonNeutrons) && (0 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
233  return NCRES_PIPLUS;
234  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
235  return NCRES_P_PIPLUS;
236  if ((3 == parameters.m_nNonNeutrons) && (2 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
237  return NCRES_P_P_PIPLUS;
238  if ((4 == parameters.m_nNonNeutrons) && (3 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
239  return NCRES_P_P_P_PIPLUS;
240  if ((5 == parameters.m_nNonNeutrons) && (4 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
241  return NCRES_P_P_P_P_PIPLUS;
242  if ((6 == parameters.m_nNonNeutrons) && (5 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
243  return NCRES_P_P_P_P_P_PIPLUS;
244 
245  if ((1 == parameters.m_nNonNeutrons) && (0 == parameters.m_nProtons) && (1 == parameters.m_nPiMinus))
246  return NCRES_PIMINUS;
247  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons) && (1 == parameters.m_nPiMinus))
248  return NCRES_P_PIMINUS;
249  if ((3 == parameters.m_nNonNeutrons) && (2 == parameters.m_nProtons) && (1 == parameters.m_nPiMinus))
250  return NCRES_P_P_PIMINUS;
251  if ((4 == parameters.m_nNonNeutrons) && (3 == parameters.m_nProtons) && (1 == parameters.m_nPiMinus))
252  return NCRES_P_P_P_PIMINUS;
253  if ((5 == parameters.m_nNonNeutrons) && (4 == parameters.m_nProtons) && (1 == parameters.m_nPiMinus))
254  return NCRES_P_P_P_P_PIMINUS;
255  if ((6 == parameters.m_nNonNeutrons) && (5 == parameters.m_nProtons) && (1 == parameters.m_nPiMinus))
256  return NCRES_P_P_P_P_P_PIMINUS;
257 
258  if ((1 == parameters.m_nNonNeutrons) && (0 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
259  return NCRES_PHOTON;
260  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
261  return NCRES_P_PHOTON;
262  if ((3 == parameters.m_nNonNeutrons) && (2 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
263  return NCRES_P_P_PHOTON;
264  if ((4 == parameters.m_nNonNeutrons) && (3 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
265  return NCRES_P_P_P_PHOTON;
266  if ((5 == parameters.m_nNonNeutrons) && (4 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
267  return NCRES_P_P_P_P_PHOTON;
268  if ((6 == parameters.m_nNonNeutrons) && (5 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
269  return NCRES_P_P_P_P_P_PHOTON;
270 
271  if ((2 == parameters.m_nNonNeutrons) && (0 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
272  return NCRES_PIZERO;
273  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
274  return NCRES_P_PIZERO;
275  if ((4 == parameters.m_nNonNeutrons) && (2 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
276  return NCRES_P_P_PIZERO;
277  if ((5 == parameters.m_nNonNeutrons) && (3 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
278  return NCRES_P_P_P_PIZERO;
279  if ((6 == parameters.m_nNonNeutrons) && (4 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
280  return NCRES_P_P_P_P_PIZERO;
281  if ((7 == parameters.m_nNonNeutrons) && (5 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
282  return NCRES_P_P_P_P_P_PIZERO;
283  }
284 
285  if (1091 == nuNuanceCode)
286  {
287  if ((1 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (0 == parameters.m_nProtons))
288  return CCDIS_MU;
289  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (1 == parameters.m_nProtons))
290  return CCDIS_MU_P;
291  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (2 == parameters.m_nProtons))
292  return CCDIS_MU_P_P;
293  if ((4 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (3 == parameters.m_nProtons))
294  return CCDIS_MU_P_P_P;
295  if ((5 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (4 == parameters.m_nProtons))
296  return CCDIS_MU_P_P_P_P;
297  if ((6 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (5 == parameters.m_nProtons))
298  return CCDIS_MU_P_P_P_P_P;
299 
300  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (0 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
301  return CCDIS_MU_PIPLUS;
302  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (1 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
303  return CCDIS_MU_P_PIPLUS;
304  if ((4 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (2 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
305  return CCDIS_MU_P_P_PIPLUS;
306  if ((5 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (3 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
307  return CCDIS_MU_P_P_P_PIPLUS;
308  if ((6 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (4 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
309  return CCDIS_MU_P_P_P_P_PIPLUS;
310  if ((7 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (5 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
311  return CCDIS_MU_P_P_P_P_P_PIPLUS;
312 
313  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (0 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
314  return CCDIS_MU_PHOTON;
315  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (1 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
316  return CCDIS_MU_P_PHOTON;
317  if ((4 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (2 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
318  return CCDIS_MU_P_P_PHOTON;
319  if ((5 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (3 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
320  return CCDIS_MU_P_P_P_PHOTON;
321  if ((6 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (4 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
322  return CCDIS_MU_P_P_P_P_PHOTON;
323  if ((7 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (5 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
324  return CCDIS_MU_P_P_P_P_P_PHOTON;
325 
326  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (0 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
327  return CCDIS_MU_PIZERO;
328  if ((4 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (1 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
329  return CCDIS_MU_P_PIZERO;
330  if ((5 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (2 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
331  return CCDIS_MU_P_P_PIZERO;
332  if ((6 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (3 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
333  return CCDIS_MU_P_P_P_PIZERO;
334  if ((7 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (4 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
335  return CCDIS_MU_P_P_P_P_PIZERO;
336  if ((8 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons) && (5 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
337  return CCDIS_MU_P_P_P_P_P_PIZERO;
338  }
339 
340  if (1092 == nuNuanceCode)
341  {
342  if ((1 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons))
343  return NCDIS_P;
344  if ((2 == parameters.m_nNonNeutrons) && (2 == parameters.m_nProtons))
345  return NCDIS_P_P;
346  if ((3 == parameters.m_nNonNeutrons) && (3 == parameters.m_nProtons))
347  return NCDIS_P_P_P;
348  if ((4 == parameters.m_nNonNeutrons) && (4 == parameters.m_nProtons))
349  return NCDIS_P_P_P_P;
350  if ((5 == parameters.m_nNonNeutrons) && (5 == parameters.m_nProtons))
351  return NCDIS_P_P_P_P_P;
352 
353  if ((1 == parameters.m_nNonNeutrons) && (0 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
354  return NCDIS_PIPLUS;
355  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
356  return NCDIS_P_PIPLUS;
357  if ((3 == parameters.m_nNonNeutrons) && (2 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
358  return NCDIS_P_P_PIPLUS;
359  if ((4 == parameters.m_nNonNeutrons) && (3 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
360  return NCDIS_P_P_P_PIPLUS;
361  if ((5 == parameters.m_nNonNeutrons) && (4 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
362  return NCDIS_P_P_P_P_PIPLUS;
363  if ((6 == parameters.m_nNonNeutrons) && (5 == parameters.m_nProtons) && (1 == parameters.m_nPiPlus))
364  return NCDIS_P_P_P_P_P_PIPLUS;
365 
366  if ((1 == parameters.m_nNonNeutrons) && (0 == parameters.m_nProtons) && (1 == parameters.m_nPiMinus))
367  return NCDIS_PIMINUS;
368  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons) && (1 == parameters.m_nPiMinus))
369  return NCDIS_P_PIMINUS;
370  if ((3 == parameters.m_nNonNeutrons) && (2 == parameters.m_nProtons) && (1 == parameters.m_nPiMinus))
371  return NCDIS_P_P_PIMINUS;
372  if ((4 == parameters.m_nNonNeutrons) && (3 == parameters.m_nProtons) && (1 == parameters.m_nPiMinus))
373  return NCDIS_P_P_P_PIMINUS;
374  if ((5 == parameters.m_nNonNeutrons) && (4 == parameters.m_nProtons) && (1 == parameters.m_nPiMinus))
375  return NCDIS_P_P_P_P_PIMINUS;
376  if ((6 == parameters.m_nNonNeutrons) && (5 == parameters.m_nProtons) && (1 == parameters.m_nPiMinus))
377  return NCDIS_P_P_P_P_P_PIMINUS;
378 
379  if ((1 == parameters.m_nNonNeutrons) && (0 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
380  return NCDIS_PHOTON;
381  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
382  return NCDIS_P_PHOTON;
383  if ((3 == parameters.m_nNonNeutrons) && (2 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
384  return NCDIS_P_P_PHOTON;
385  if ((4 == parameters.m_nNonNeutrons) && (3 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
386  return NCDIS_P_P_P_PHOTON;
387  if ((5 == parameters.m_nNonNeutrons) && (4 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
388  return NCDIS_P_P_P_P_PHOTON;
389  if ((6 == parameters.m_nNonNeutrons) && (5 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
390  return NCDIS_P_P_P_P_P_PHOTON;
391 
392  if ((2 == parameters.m_nNonNeutrons) && (0 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
393  return NCDIS_PIZERO;
394  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
395  return NCDIS_P_PIZERO;
396  if ((4 == parameters.m_nNonNeutrons) && (2 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
397  return NCDIS_P_P_PIZERO;
398  if ((5 == parameters.m_nNonNeutrons) && (3 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
399  return NCDIS_P_P_P_PIZERO;
400  if ((6 == parameters.m_nNonNeutrons) && (4 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
401  return NCDIS_P_P_P_P_PIZERO;
402  if ((7 == parameters.m_nNonNeutrons) && (5 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
403  return NCDIS_P_P_P_P_P_PIZERO;
404  }
405 
406  if (1096 == nuNuanceCode)
407  return NCCOH;
408  if (1097 == nuNuanceCode)
409  return CCCOH;
410 
411  return OTHER_INTERACTION;
412 }
413 
414 //------------------------------------------------------------------------------------------------------------------------------------------
415 
416 InteractionDescriptor LArInteractionTypeHelper::GetInteractionDescriptor(const MCParticleList &mcPrimaryList)
417 {
418  if (mcPrimaryList.empty())
419  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
420 
421  InteractionParameters parameters;
422  LArInteractionTypeHelper::SetInteractionParameters(mcPrimaryList, parameters);
423 
424  const MCParticle *pMCNeutrino(nullptr);
425 
426  for (const MCParticle *const pMCPrimary : mcPrimaryList)
427  {
428  if (!LArMCParticleHelper::IsBeamNeutrinoFinalState(pMCPrimary) ||
429  (pMCNeutrino && (pMCNeutrino != LArMCParticleHelper::GetParentMCParticle(pMCPrimary))))
430  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
431 
432  pMCNeutrino = LArMCParticleHelper::GetParentMCParticle(pMCPrimary);
433  }
434 
435  if (!pMCNeutrino)
436  throw StatusCodeException(STATUS_CODE_FAILURE);
437 
438  const int nuNuanceCode(LArMCParticleHelper::GetNuanceCode(pMCNeutrino));
439 
440  if (1001 == nuNuanceCode)
441  {
442  return InteractionDescriptor(
443  true, true, false, false, false, parameters.m_nMuons == 1, parameters.m_nElectrons == 1, 0, 0, 0, parameters.m_nProtons);
444  }
445 
446  if (1002 == nuNuanceCode)
447  {
448  return InteractionDescriptor(false, true, false, false, false, false, false, 0, 0, 0, parameters.m_nProtons);
449  }
450 
451  if ((nuNuanceCode >= 1003) && (nuNuanceCode <= 1005))
452  {
453  return InteractionDescriptor(true, false, true, false, false, parameters.m_nMuons == 1, parameters.m_nElectrons == 1,
454  parameters.m_nPiPlus, parameters.m_nPiMinus, parameters.m_nPhotons, parameters.m_nProtons);
455  }
456 
457  if ((nuNuanceCode >= 1006) && (nuNuanceCode <= 1009))
458  {
459  return InteractionDescriptor(false, false, true, false, false, parameters.m_nMuons == 1, parameters.m_nElectrons == 1,
460  parameters.m_nPiPlus, parameters.m_nPiMinus, parameters.m_nPhotons, parameters.m_nProtons);
461  }
462 
463  if (1091 == nuNuanceCode)
464  {
465  return InteractionDescriptor(true, false, false, true, false, parameters.m_nMuons == 1, parameters.m_nElectrons == 1,
466  parameters.m_nPiPlus, parameters.m_nPiMinus, parameters.m_nPhotons, parameters.m_nProtons);
467  }
468 
469  if (1092 == nuNuanceCode)
470  {
471  return InteractionDescriptor(false, false, false, true, false, parameters.m_nMuons == 1, parameters.m_nElectrons == 1,
472  parameters.m_nPiPlus, parameters.m_nPiMinus, parameters.m_nPhotons, parameters.m_nProtons);
473  }
474 
475  if (1096 == nuNuanceCode)
476  {
477  return InteractionDescriptor(false, false, false, false, true, parameters.m_nMuons == 1, parameters.m_nElectrons == 1, 0, 0, 0, 0);
478  }
479  if (1097 == nuNuanceCode)
480  {
481  return InteractionDescriptor(true, false, false, false, true, parameters.m_nMuons == 1, parameters.m_nElectrons == 1, 0, 0, 0, 0);
482  }
483 
484  return InteractionDescriptor(false, false, false, false, false, false, false, 0, 0, 0, 0);
485 }
486 
487 //------------------------------------------------------------------------------------------------------------------------------------------
488 
489 LArInteractionTypeHelper::InteractionType LArInteractionTypeHelper::GetTestBeamHierarchyInteractionType(const MCParticleList &mcPrimaryList)
490 {
491  if (mcPrimaryList.empty())
492  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
493 
494  InteractionParameters parameters;
495  LArInteractionTypeHelper::SetInteractionParameters(mcPrimaryList, parameters);
496 
497  const InteractionType cosmicRayHypothesis(LArInteractionTypeHelper::CosmicRayHypothesis(mcPrimaryList, parameters));
498 
499  if (OTHER_INTERACTION != cosmicRayHypothesis)
500  return cosmicRayHypothesis;
501 
502  int targetParentId(0);
503 
504  for (const MCParticle *const pMCPrimary : mcPrimaryList)
505  {
506  if (LArMCParticleHelper::GetParentMCParticle(pMCPrimary) != pMCPrimary)
507  continue;
508 
509  if (13 == std::fabs(pMCPrimary->GetParticleId()))
510  --parameters.m_nMuons;
511  else if (11 == std::fabs(pMCPrimary->GetParticleId()))
512  --parameters.m_nElectrons;
513  else if (2212 == std::fabs(pMCPrimary->GetParticleId()))
514  --parameters.m_nProtons;
515  else if (22 == pMCPrimary->GetParticleId())
516  --parameters.m_nPhotons;
517  else if (211 == pMCPrimary->GetParticleId())
518  --parameters.m_nPiPlus;
519  else if (-211 == pMCPrimary->GetParticleId())
520  --parameters.m_nPiMinus;
521  else if (321 == pMCPrimary->GetParticleId())
522  --parameters.m_nKaonPlus;
523  else if (-321 == pMCPrimary->GetParticleId())
524  --parameters.m_nKaonMinus;
525 
526  --parameters.m_nNonNeutrons;
527  targetParentId = pMCPrimary->GetParticleId();
528  }
529 
530  MCParticleSet piZero, kaon0L;
531  for (const MCParticle *const pMCPrimary : mcPrimaryList)
532  {
533  if (22 == pMCPrimary->GetParticleId() && pMCPrimary->GetParentList().size() == 1)
534  {
535  const MCParticle *const pParentMCParticle(pMCPrimary->GetParentList().front());
536  if (pParentMCParticle->GetParticleId() == 111 && !piZero.count(pParentMCParticle))
537  piZero.insert(pParentMCParticle);
538  }
539  else if ((111 == pMCPrimary->GetParticleId() || 211 == std::fabs(pMCPrimary->GetParticleId())) && pMCPrimary->GetParentList().size() == 1)
540  {
541  const MCParticle *const pParentMCParticle(pMCPrimary->GetParentList().front());
542  if (pParentMCParticle->GetParticleId() == 130 && !kaon0L.count(pParentMCParticle))
543  kaon0L.insert(pParentMCParticle);
544  }
545  }
546 
547  parameters.m_nPiZero = piZero.size();
548  parameters.m_nKaon0L = kaon0L.size();
549 
550  if (211 == targetParentId)
551  {
552  if ((1 == parameters.m_nNonNeutrons) && (1 == parameters.m_nPiPlus))
553  return BEAM_PARTICLE_PI_PLUS_PI_PLUS;
554  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nPiPlus) && (1 == parameters.m_nPhotons))
555  return BEAM_PARTICLE_PI_PLUS_PI_PLUS_PHOTON;
556  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nPiPlus) && (1 == parameters.m_nPiZero))
557  return BEAM_PARTICLE_PI_PLUS_PI_PLUS_PIZERO;
558  return BEAM_PARTICLE_PI_PLUS_COMPLEX;
559  }
560  else if (-211 == targetParentId)
561  {
562  if ((1 == parameters.m_nNonNeutrons) && (1 == parameters.m_nPiMinus))
563  return BEAM_PARTICLE_PI_MINUS_PI_MINUS;
564  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nPiMinus) && (1 == parameters.m_nPhotons))
565  return BEAM_PARTICLE_PI_MINUS_PI_MINUS_PHOTON;
566  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nPiMinus) && (1 == parameters.m_nPiZero))
567  return BEAM_PARTICLE_PI_MINUS_PI_MINUS_PIZERO;
568  return BEAM_PARTICLE_PI_MINUS_COMPLEX;
569  }
570  else if (2212 == targetParentId)
571  {
572  if ((1 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons))
573  return BEAM_PARTICLE_P_P;
574  if ((2 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
575  return BEAM_PARTICLE_P_P_PHOTON;
576  if ((3 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
577  return BEAM_PARTICLE_P_P_PHOTON_PHOTON;
578  if ((4 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons) && (3 == parameters.m_nPhotons))
579  return BEAM_PARTICLE_P_P_PHOTON_PHOTON_PHOTON;
580  if ((5 == parameters.m_nNonNeutrons) && (1 == parameters.m_nProtons) && (4 == parameters.m_nPhotons))
581  return BEAM_PARTICLE_P_P_PHOTON_PHOTON_PHOTON_PHOTON;
582 
583  if ((2 == parameters.m_nNonNeutrons) && (2 == parameters.m_nProtons))
584  return BEAM_PARTICLE_P_P_P;
585  if ((3 == parameters.m_nNonNeutrons) && (2 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
586  return BEAM_PARTICLE_P_P_P_PHOTON;
587  if ((4 == parameters.m_nNonNeutrons) && (2 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
588  return BEAM_PARTICLE_P_P_P_PHOTON_PHOTON;
589  if ((5 == parameters.m_nNonNeutrons) && (2 == parameters.m_nProtons) && (3 == parameters.m_nPhotons))
590  return BEAM_PARTICLE_P_P_P_PHOTON_PHOTON_PHOTON;
591 
592  if ((3 == parameters.m_nNonNeutrons) && (3 == parameters.m_nProtons))
593  return BEAM_PARTICLE_P_P_P_P;
594  if ((4 == parameters.m_nNonNeutrons) && (3 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
595  return BEAM_PARTICLE_P_P_P_P_PHOTON;
596  if ((5 == parameters.m_nNonNeutrons) && (3 == parameters.m_nProtons) && (2 == parameters.m_nPhotons))
597  return BEAM_PARTICLE_P_P_P_P_PHOTON_PHOTON;
598 
599  if ((4 == parameters.m_nNonNeutrons) && (4 == parameters.m_nProtons))
600  return BEAM_PARTICLE_P_P_P_P_P;
601  if ((5 == parameters.m_nNonNeutrons) && (4 == parameters.m_nProtons) && (1 == parameters.m_nPhotons))
602  return BEAM_PARTICLE_P_P_P_P_P_PHOTON;
603 
604  if ((5 == parameters.m_nNonNeutrons) && (5 == parameters.m_nProtons))
605  return BEAM_PARTICLE_P_P_P_P_P_P;
606 
607  return BEAM_PARTICLE_P_COMPLEX;
608  }
609  else if (13 == std::fabs(targetParentId))
610  {
611  if (0 == parameters.m_nNonNeutrons)
612  return BEAM_PARTICLE_MU;
613  if ((1 == parameters.m_nNonNeutrons) && (1 == parameters.m_nElectrons))
614  return BEAM_PARTICLE_MU_E;
615  return BEAM_PARTICLE_MU_COMPLEX;
616  }
617  else if (321 == targetParentId)
618  {
619  if ((1 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons))
620  return BEAM_PARTICLE_KAON_PLUS_MU;
621  if ((parameters.m_nNonNeutrons >= 2) && (1 == parameters.m_nKaonPlus) && (1 == parameters.m_nKaon0L))
622  return BEAM_PARTICLE_KAON_PLUS_KAON_PLUS_KAON0L_COMPLEX;
623  if ((parameters.m_nNonNeutrons > 1) && (1 == parameters.m_nKaonPlus))
624  return BEAM_PARTICLE_KAON_PLUS_KAON_PLUS_COMPLEX;
625  return BEAM_PARTICLE_KAON_PLUS_COMPLEX;
626  }
627  else if (-321 == targetParentId)
628  {
629  if ((1 == parameters.m_nNonNeutrons) && (1 == parameters.m_nMuons))
630  return BEAM_PARTICLE_KAON_MINUS_MU;
631  if ((parameters.m_nNonNeutrons >= 2) && (1 == parameters.m_nKaonMinus) && (1 == parameters.m_nKaon0L))
632  return BEAM_PARTICLE_KAON_MINUS_KAON_MINUS_KAON0L_COMPLEX;
633  if ((parameters.m_nNonNeutrons > 1) && (1 == parameters.m_nKaonMinus))
634  return BEAM_PARTICLE_KAON_MINUS_KAON_MINUS_COMPLEX;
635  return BEAM_PARTICLE_KAON_MINUS_COMPLEX;
636  }
637  else if (11 == std::fabs(targetParentId))
638  {
639  if (0 == parameters.m_nNonNeutrons)
640  return BEAM_PARTICLE_E;
641  return BEAM_PARTICLE_E_COMPLEX;
642  }
643 
644  if (parameters.m_nNonNeutrons > 5)
645  return BEAM_PARTICLE_COMPLEX_HIERARCHY;
646 
647  return BEAM_PARTICLE_UNKNOWN_HIERARCHY;
648 }
649 
650 //------------------------------------------------------------------------------------------------------------------------------------------
651 
652 void LArInteractionTypeHelper::SetInteractionParameters(const MCParticleList &mcPrimaryList, InteractionParameters &parameters)
653 {
654  for (const MCParticle *const pMCPrimary : mcPrimaryList)
655  {
656  if (2112 != pMCPrimary->GetParticleId())
657  ++parameters.m_nNonNeutrons;
658  if (13 == std::fabs(pMCPrimary->GetParticleId()))
659  ++parameters.m_nMuons;
660  if (11 == std::fabs(pMCPrimary->GetParticleId()))
661  ++parameters.m_nElectrons;
662  else if (2212 == std::fabs(pMCPrimary->GetParticleId()))
663  ++parameters.m_nProtons;
664  else if (22 == pMCPrimary->GetParticleId())
665  ++parameters.m_nPhotons;
666  else if (211 == pMCPrimary->GetParticleId())
667  ++parameters.m_nPiPlus;
668  else if (-211 == pMCPrimary->GetParticleId())
669  ++parameters.m_nPiMinus;
670  else if (321 == pMCPrimary->GetParticleId())
671  ++parameters.m_nKaonPlus;
672  else if (-321 == pMCPrimary->GetParticleId())
673  ++parameters.m_nKaonMinus;
674  }
675 }
676 
677 //------------------------------------------------------------------------------------------------------------------------------------------
678 
679 LArInteractionTypeHelper::InteractionType LArInteractionTypeHelper::CosmicRayHypothesis(
680  const MCParticleList &mcPrimaryList, const InteractionParameters &parameters)
681 {
682  if ((1 == mcPrimaryList.size()) && LArMCParticleHelper::IsCosmicRay(mcPrimaryList.front()))
683  {
684  if (1 == parameters.m_nMuons)
685  return COSMIC_RAY_MU;
686  if (1 == parameters.m_nProtons)
687  return COSMIC_RAY_P;
688  if (1 == parameters.m_nElectrons)
689  return COSMIC_RAY_E;
690  if (1 == parameters.m_nPhotons)
691  return COSMIC_RAY_PHOTON;
692  else
693  return COSMIC_RAY_OTHER;
694  }
695 
696  return OTHER_INTERACTION;
697 }
698 
699 //------------------------------------------------------------------------------------------------------------------------------------------
700 
701 std::string LArInteractionTypeHelper::ToString(const InteractionType interactionType)
702 {
703  switch (interactionType)
704  {
706  default:
707  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
708  }
709 }
710 
711 //------------------------------------------------------------------------------------------------------------------------------------------
712 //------------------------------------------------------------------------------------------------------------------------------------------
713 
714 LArInteractionTypeHelper::InteractionParameters::InteractionParameters() :
715  m_nNonNeutrons(0),
716  m_nMuons(0),
717  m_nElectrons(0),
718  m_nPhotons(0),
719  m_nProtons(0),
720  m_nPiPlus(0),
721  m_nPiMinus(0),
722  m_nPiZero(0),
723  m_nKaonPlus(0),
724  m_nKaonMinus(0),
725  m_nKaon0L(0)
726 {
727 }
728 
729 //------------------------------------------------------------------------------------------------------------------------------------------
730 //------------------------------------------------------------------------------------------------------------------------------------------
731 
732 const int InteractionDescriptor::CC = 8192;
733 const int InteractionDescriptor::NC = 4096;
734 const int InteractionDescriptor::QE = 2560;
735 const int InteractionDescriptor::RES = 2048;
736 const int InteractionDescriptor::DIS = 1536;
737 const int InteractionDescriptor::COH = 1024;
738 const int InteractionDescriptor::OTH = 512;
739 const int InteractionDescriptor::MU = 256;
740 const int InteractionDescriptor::E = 128;
741 const int InteractionDescriptor::PIZERO = 64;
742 const int InteractionDescriptor::PIPLUS = 32;
743 const int InteractionDescriptor::PIMINUS = 16;
744 const int InteractionDescriptor::PHOTON = 8;
745 const int InteractionDescriptor::NP = 6;
746 
747 InteractionDescriptor::InteractionDescriptor(const bool isCC, const bool isQE, const bool isRes, const bool isDIS, const bool isCoherent,
748  const bool isNumu, const bool isNue, const unsigned int nPiPlus, const unsigned int nPiMinus, const unsigned int nPhotons,
749  const unsigned int nProtons) :
750  m_isCC{isCC},
751  m_isQE{isQE},
752  m_isResonant{isRes},
753  m_isDIS{isDIS},
754  m_isCoherent{isCoherent},
755  m_isNumu{isNumu},
756  m_isNue{isNue},
757  m_nPiZero{nPhotons / 2},
758  m_nPiPlus{nPiPlus},
759  m_nPiMinus{nPiMinus},
760  m_nPhotons{nPhotons % 2},
761  m_nProtons{nProtons},
762  m_id{0},
763  m_descriptor{}
764 {
765  m_id += m_isCC ? CC : NC;
766  m_descriptor += m_isCC ? "CC" : "NC";
767  if (isQE)
768  {
769  m_id += QE;
770  m_descriptor += "QE";
771  }
772  else if (isRes)
773  {
774  m_id += RES;
775  m_descriptor += "RES";
776  }
777  else if (isDIS)
778  {
779  m_id += DIS;
780  m_descriptor += "DIS";
781  }
782  else if (isCoherent)
783  {
784  m_id += COH;
785  m_descriptor += "COH";
786  }
787  else
788  {
789  m_id += OTH;
790  m_descriptor += "OTH";
791  }
792 
793  if (m_isNumu)
794  {
795  m_id += MU;
796  m_descriptor += "_MU";
797  }
798  else if (m_isNue)
799  {
800  m_id += E;
801  m_descriptor += "_E";
802  }
803 
804  m_id += m_nPiZero == 1 ? PIZERO : 0;
805  m_descriptor += m_nPiZero == 1 ? "_PIZERO" : m_nPiZero > 0 ? "_NPIZERO" : "";
806  m_id += m_nPiPlus == 1 ? PIPLUS : 0;
807  m_descriptor += m_nPiPlus == 1 ? "_PIPLUS" : m_nPiPlus > 0 ? "_NPIPLUS" : "";
808  m_id += m_nPiMinus == 1 ? PIMINUS : 0;
809  m_descriptor += m_nPiMinus == 1 ? "_PIMINUS" : m_nPiMinus > 0 ? "_NPIMINUS" : "";
810  m_id += m_nPhotons == 1 ? PHOTON : 0;
811  m_descriptor += m_nPhotons == 1 ? "_PHOTON" : "";
812  m_id += m_nProtons < NP ? m_nProtons : NP;
813  m_descriptor += m_nProtons >= NP ? "NP" : m_nProtons > 0 ? "_" + std::to_string(m_nProtons) + "P" : "";
814 }
815 
816 } // namespace lar_content
Header file for the interaction type helper class.
#define GET_INTERACTION_TYPE_NAME_SWITCH(a)
The name switch statement macro.
Header file for the lar monitoring helper helper class.
if(nlines<=0)
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.
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.
#define INTERACTION_TYPE_TABLE(d)