Belle II Software light-2406-ragdoll
TauDecayMarkerModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <analysis/modules/TauDecayMarker/TauDecayMarkerModule.h>
10
11#include <framework/logging/Logger.h>
12#include <framework/gearbox/Const.h>
13
14#include <iostream>
15
16using namespace std;
17using namespace Belle2;
18
19//-----------------------------------------------------------------
20// Register the Module
21//-----------------------------------------------------------------
22REG_MODULE(TauDecayMarker);
23
24//-----------------------------------------------------------------
25// Implementation
26//-----------------------------------------------------------------
27
28TauDecayMarkerModule::TauDecayMarkerModule() : Module(), tauPair(false), numOfTauPlus(0), numOfTauMinus(0), idOfTauPlus(-1),
29 idOfTauMinus(-1), m_pmode(-2), m_mmode(-2), m_pprong(0), m_mprong(0)
30{
31 // Set module properties
32 setDescription("Module to identify generated tau pair decays, using MCParticle information. Each tau lepton decay channel "
33 "is numbered following the order in the default KKMC decay table. Using this module, "
34 "the channel number will be stored in the variables `tauPlusMCMode`, and `tauMinusMCMode`. "
35 "Further details and usage can be found at `TauDecayMCModes`. ");
36 //Parameter definition
37 addParam("printDecayInfo", m_printDecayInfo, "Print information of the tau pair decay from MC.", false);
38}
39
41{
42 m_tauDecay.registerInDataStore();
43
44}
45
47{
48 if (!m_tauDecay) m_tauDecay.create();
49
51 if (tauPair) {
52 m_pmode = getDecayChannelOfTau(+1) % 100;
53 m_mmode = getDecayChannelOfTau(-1) % 100;
54
57
58 if (m_printDecayInfo) {
59 B2INFO("Decay ID: " << m_pmode << " (tau+), " << m_mmode << " (tau-)." <<
60 " Topology: " << m_pprong << "-" << m_mprong << " prong");
61 }
62
63 } else {
64 m_pmode = -1;
65 m_mmode = -1;
66 }
67
68 m_tauDecay->addTauPlusIdMode(m_pmode);
69 m_tauDecay->addTauMinusIdMode(m_mmode);
70
71 m_tauDecay->addTauPlusMcProng(m_pprong);
72 m_tauDecay->addTauMinusMcProng(m_mprong);
73
74}
75
77{
78 numOfTauPlus = 0;
79 numOfTauMinus = 0;
80 idOfTauPlus = 0;
81 idOfTauMinus = 0;
82 for (int i = 0; i < m_MCParticles.getEntries(); i++) {
84
85 if (p.getStatus() == 1 && p.getPDG() == 15) {
87 idOfTauMinus = p.getIndex();
88 }
89 if (p.getStatus() == 1 && p.getPDG() == -15) {
91 idOfTauPlus = p.getIndex();
92 }
93 }
94 if (numOfTauPlus == 1 && numOfTauMinus == 1) {
95 tauPair = true;
96 } else tauPair = false;
97}
98
100{
101 if (s == 0 || !tauPair) return -1;
102 int tauid = idOfTauMinus;
103 if (s > 0) tauid = idOfTauPlus;
104 int ret = 0;
105 const MCParticle& p = *m_MCParticles[tauid - 1];
106
107 if (id == 0) {
108 for (int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
109 MCParticle& d = *m_MCParticles[i - 1];
110 if (abs(d.getPDG()) == 24)
111 ret += d.getLastDaughter() - d.getFirstDaughter() + 1;
112 else ret++;
113 }
114 } else {
115 for (int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
116 MCParticle& d = *m_MCParticles[i - 1];
117 int pdg = d.getPDG();
118 if (pdg == id || (sign == 0 && abs(pdg) == abs(id))) ret++;
119 if (abs(pdg) == 24) {
120 for (int j = d.getFirstDaughter(); j <= d.getLastDaughter(); ++j) {
121 MCParticle& e = *m_MCParticles[j - 1];
122 int pdg2 = e.getPDG();
123 if (pdg2 == id ||
124 (sign == 0)) ret++;
125 }
126 }
127 }
128 }
129 return ret;
130}
131
133{
134 if (s == 0 || !tauPair) return -1;
135 int tauid = idOfTauMinus;
136 if (s > 0) tauid = idOfTauPlus;
137 int ret = 0;
138 const MCParticle& p = *m_MCParticles[tauid - 1];
139
140 if (id == 0) {
141 for (int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
142 MCParticle& d = *m_MCParticles[i - 1];
143 if (abs(d.getPDG()) == 24) {
144 for (int j = d.getFirstDaughter(); j <= d.getLastDaughter(); ++j) {
145 MCParticle& e = *m_MCParticles[j - 1];
146 if (e.getPDG() != Const::photon.getPDGCode()) ret++;
147 }
148 } else if (d.getPDG() != Const::photon.getPDGCode()) ret++;
149 }
150 } else {
151 for (int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
152 MCParticle& d = *m_MCParticles[i - 1];
153 int pdg = d.getPDG();
154 if (abs(pdg) == 24) {
155 for (int j = d.getFirstDaughter(); j <= d.getLastDaughter(); ++j) {
156 MCParticle& e = *m_MCParticles[j - 1];
157 int pdg2 = e.getPDG();
158 if (pdg2 == id ||
159 (sign == 0 && abs(pdg2) == abs(id))) ret++;
160 }
161 } else if (pdg == id || (sign == 0 && abs(pdg) == abs(id))) ret++;
162 }
163 }
164 return ret;
165}
166
168{
169 int ret = 0;
170 if (tauPair && s != 0) {
171 if (
172 getNumDaughterOfTauExceptGamma(s, -s * (-12), 1) == 1 &&
173 getNumDaughterOfTauExceptGamma(s, -s * (11), 1) == 1 &&
174 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
176 ) ret = 1 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
177 else if (
178 getNumDaughterOfTauExceptGamma(s, -s * (-14), 1) == 1 &&
179 getNumDaughterOfTauExceptGamma(s, -s * (13), 1) == 1 &&
180 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
182 ) ret = 2 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
183 else if (
184 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
185 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
187 ) ret = 3 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
188 else if (
189 getNumDaughterOfTauExceptGamma(s, -s * (-213), 1) == 1 &&
190 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
192 ) ret = 4 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
193 else if (
194 getNumDaughterOfTauExceptGamma(s, -s * (-20213), 1) == 1 &&
195 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
197 ) ret = 5 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
198 else if (
199 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
200 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
202 ) ret = 6 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
203 else if (
204 getNumDaughterOfTauExceptGamma(s, -s * (-323), 1) == 1 &&
205 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
207 ) ret = 7 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
208 else if (
209 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
210 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
211 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
212 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
214 ) ret = 8 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
215 else if (
216 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
217 getNumDaughterOfTauExceptGamma(s, 111, 1) == 3 &&
218 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
220 ) ret = 9 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
221 else if (
222 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
223 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
224 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
225 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
227 ) ret = 10 + (getNumDaughterOfTau(s, 0, 1) - 6) * 1000;
228 else if (
229 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 3 &&
230 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
231 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 2 &&
233 ) ret = 11 + (getNumDaughterOfTau(s, 0, 1) - 6) * 1000;
234 else if (
235 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 3 &&
236 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
237 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
238 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 2 &&
240 ) ret = 12 + (getNumDaughterOfTau(s, 0, 1) - 7) * 1000;
241 else if (
242 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
243 getNumDaughterOfTauExceptGamma(s, 111, 1) == 3 &&
244 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
245 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
247 ) ret = 13 + (getNumDaughterOfTau(s, 0, 1) - 7) * 1000;
248 else if (
249 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
250 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
251 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
252 getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
254 ) ret = 14 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
255 else if (
256 getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
257 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
258 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
259 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
261 ) ret = 15 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
262 else if (
264 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 2 ||
265 getNumDaughterOfTauExceptGamma(s, 311, 0) == 2) &&
266 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
267 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
269 ) ret = 15 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000
270 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
271 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
272 else if (
273 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
274 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
275 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
276 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
278 ) ret = 16 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
279 else if (
281 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
282 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
283 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
284 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
285 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
287 ) ret = 16 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000
288 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
289 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
290 else if (
291 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
292 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
293 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
295 ) ret = 17 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
296 else if (
297 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
298 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
299 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
300 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
302 ) ret = 18 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
303 else if (
304 getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
305 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
306 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
307 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
309 ) ret = 19 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
310 else if (
312 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
313 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
314 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
315 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
316 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
318 ) ret = 19 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000
319 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
320 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
321 else if (
322 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
323 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
324 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
325 getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
327 ) ret = 20 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
328 else if (
329 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
330 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
331 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
332 getNumDaughterOfTau(s, 22, 1) >= 1 &&
334 ) ret = 21 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
335 else if (
336 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
337 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
338 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
340 ) ret = 22 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
341 else if (
343 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
344 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
345 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
346 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
348 ) ret = 22 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000
349 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
350 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
351 else if (
352 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
353 getNumDaughterOfTauExceptGamma(s, 111, 1) == 4 &&
354 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
356 ) ret = 23 + (getNumDaughterOfTau(s, 0, 1) - 6) * 1000;
357 else if (
358 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
359 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
360 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
361 getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
363 ) ret = 24 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
364 else if (
365 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
366 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
367 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
368 getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
370 ) ret = 25 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
371 else if (
372 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
373 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
374 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
375 getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
377 ) ret = 26 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
378 else if (
379 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
380 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
381 getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
383 ) ret = 27 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
384 else if (
385 getNumDaughterOfTauExceptGamma(s, -s * (-323), 1) == 1 &&
386 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
387 getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
389 ) ret = 28 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
390 else if (
391 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
392 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
393 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
394 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
395 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
397 ) ret = 29 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
398 else if (
399 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
400 getNumDaughterOfTauExceptGamma(s, 111, 1) == 3 &&
401 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
403 ) ret = 30 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
404 else if (
405 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
406 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
407 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
408 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
410 ) ret = 31 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
411 else if (
413 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
414 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
415 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
416 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
417 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
419 ) ret = 31 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
420 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
421 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
422 else if (
423 getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
424 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
425 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
426 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
428 ) ret = 32 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
429 else if (
431 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
432 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
433 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
434 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
435 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
437 ) ret = 32 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
438 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
439 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
440 else if (
441 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
442 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
443 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
444 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
445 getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
447 ) ret = 33 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
448 else if (
449 getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
450 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
451 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
452 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
453 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
455 ) ret = 34 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
456 else if (
458 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 2 ||
459 getNumDaughterOfTauExceptGamma(s, 311, 0) == 2) &&
460 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
461 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
462 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
464 ) ret = 34 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
465 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
466 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
467 else if (
468 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
469 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
470 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
471 getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
473 ) ret = 35 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
474 else if (
475 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
476 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
477 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
478 getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
480 ) ret = 36 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
481 else if (
482 getNumDaughterOfTauExceptGamma(s, -s * (-11), 1) == 1 &&
483 getNumDaughterOfTauExceptGamma(s, -s * (-12), 1) == 1 &&
484 getNumDaughterOfTauExceptGamma(s, -s * (11), 1) == 2 &&
485 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
487 ) ret = 37 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
488 else if (
489 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
490 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
491 getNumDaughterOfTauExceptGamma(s, 20223, 1) == 1 &&
493 ) ret = 38 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
494 else if (
495 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
496 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
497 getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
499 ) ret = 39 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
500 else if (
501 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
502 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
503 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
504 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
505 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
507 ) ret = 40 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
508 else if (
510 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
511 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
512 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
513 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
514 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
515 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
517 ) ret = 40 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
518 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
519 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
520 else if (
521 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
522 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
523 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
524 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
526 ) ret = 41 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
527 else if (
529 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
530 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
531 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
532 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
533 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
535 ) ret = 41 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
536 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
537 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
538 else if (
539 getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
540 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
541 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
542 getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
544 ) ret = 42 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
545 else if (
547 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
548 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
549 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
550 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
551 getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
553 ) ret = 42 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
554 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
555 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
556
557 }
558 return ret;
559}
560
561
563{
564 int ret = 0;
565 const vector<MCParticle*> daughters = p.getDaughters();
566 if (daughters.empty()) return ret;
567 for (MCParticle* d : daughters) {
568 if (!d->hasStatus(MCParticle::c_PrimaryParticle)) continue;
569 // TODO: Improve how to identify a final state particle.
570 bool isChargedFinalState = find(begin(finalStatePDGs),
571 end(finalStatePDGs),
572 abs(d->getPDG())) != end(finalStatePDGs);
573 if (isChargedFinalState) ret++;
574 else ret += getProngOfDecay(*d);
575 }
576 return ret;
577}
578
int getPDGCode() const
PDG code.
Definition: Const.h:473
static const ParticleType photon
photon particle
Definition: Const.h:673
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
@ c_PrimaryParticle
bit 0: Particle is primary particle.
Definition: MCParticle.h:47
int getLastDaughter() const
Get 1-based index of last daughter, 0 if no daughters.
Definition: MCParticle.h:259
int getPDG() const
Return PDG code of particle.
Definition: MCParticle.h:112
int getFirstDaughter() const
Get 1-based index of first daughter, 0 if no daughters.
Definition: MCParticle.h:251
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
Int_t m_mprong
Prong of the decay channel of negative tau.
const int finalStatePDGs[5]
PDG codes accepted as charged final state particles in generation: {e, mu, pi, K, p}.
int numOfTauPlus
Number of positive tau leptons in the event.
Int_t m_pprong
Prong of the decay channel of positive tau.
void IdentifyTauPair()
Identifies if the event is a generated tau pair.
virtual void initialize() override
Initializes the module.
virtual void event() override
Method is called for each event.
int getNumDaughterOfTau(int s=0, int id=0, int sign=0)
Count the number of daughers of the generated tau.
Int_t m_mmode
ID of the decay channel of negative tau.
int getNumDaughterOfTauExceptGamma(int s=0, int id=0, int sign=0)
Count the number of daughers of the generated tau except gammas.
bool tauPair
True if the generated event is a tau pair event.
int idOfTauMinus
Index of the generated negative tau.
Int_t m_pmode
ID of the decay channel of positive tau.
int numOfTauMinus
Number of negative tau leptons in the event.
int getProngOfDecay(const MCParticle &mc)
Get the prong of the generated tau decay.
int idOfTauPlus
Index of the generated positive tau.
StoreObjPtr< TauPairDecay > m_tauDecay
pointer to tau pair decay objects
int getDecayChannelOfTau(int s=0)
Gets the id of the decay channel.
bool m_printDecayInfo
If true, prints ID and prong of each tau lepton in the event.
StoreArray< MCParticle > m_MCParticles
StoreArray of MCParticles.
TauDecayMarkerModule()
Constructor: Sets the description, the properties and the parameters of the module.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24
STL namespace.