Belle II Software development
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
14using namespace std;
15using namespace Belle2;
16
17//-----------------------------------------------------------------
18// Register the Module
19//-----------------------------------------------------------------
20REG_MODULE(TauDecayMarker);
21
22//-----------------------------------------------------------------
23// Implementation
24//-----------------------------------------------------------------
25
27 idOfTauMinus(-1), m_pmode(-2), m_mmode(-2), m_pprong(0), m_mprong(0)
28{
29 // Set module properties
30 setDescription("Module to identify generated tau pair decays, using MCParticle information. Each tau lepton decay channel "
31 "is numbered following the order in the default KKMC decay table. Using this module, "
32 "the channel number will be stored in the variables `tauPlusMCMode`, and `tauMinusMCMode`. "
33 "Further details and usage can be found at `TauDecayMCModes`. ");
35 //Parameter definition
36 addParam("printDecayInfo", m_printDecayInfo, "Print information of the tau pair decay from MC.", false);
37}
38
40{
41 m_tauDecay.registerInDataStore();
42
43}
44
46{
47 if (!m_tauDecay) m_tauDecay.create();
48
50 if (tauPair) {
51 m_pmode = getDecayChannelOfTau(+1) % 100;
52 m_mmode = getDecayChannelOfTau(-1) % 100;
53
56
57 if (m_printDecayInfo) {
58 B2INFO("Decay ID: " << m_pmode << " (tau+), " << m_mmode << " (tau-)." <<
59 " Topology: " << m_pprong << "-" << m_mprong << " prong");
60 }
61
62 } else {
63 m_pmode = -1;
64 m_mmode = -1;
65 }
66
67 m_tauDecay->addTauPlusIdMode(m_pmode);
68 m_tauDecay->addTauMinusIdMode(m_mmode);
69
70 m_tauDecay->addTauPlusMcProng(m_pprong);
71 m_tauDecay->addTauMinusMcProng(m_mprong);
72
73}
74
76{
77 numOfTauPlus = 0;
78 numOfTauMinus = 0;
79 idOfTauPlus = 0;
80 idOfTauMinus = 0;
81 for (int i = 0; i < m_MCParticles.getEntries(); i++) {
82 const MCParticle& p = *m_MCParticles[i];
83
84 if (p.getStatus() == 1 && p.getPDG() == 15) {
86 idOfTauMinus = p.getIndex();
87 }
88 if (p.getStatus() == 1 && p.getPDG() == -15) {
90 idOfTauPlus = p.getIndex();
91 }
92 }
93 if (numOfTauPlus == 1 && numOfTauMinus == 1) {
94 tauPair = true;
95 } else tauPair = false;
96}
97
99{
100 if (s == 0 || !tauPair) return -1;
101 int tauid = idOfTauMinus;
102 if (s > 0) tauid = idOfTauPlus;
103 int ret = 0;
104 const MCParticle& p = *m_MCParticles[tauid - 1];
105
106 if (id == 0) {
107 for (int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
108 const MCParticle& d = *m_MCParticles[i - 1];
109 if (abs(d.getPDG()) == 24)
110 ret += d.getLastDaughter() - d.getFirstDaughter() + 1;
111 else ret++;
112 }
113 } else {
114 for (int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
115 const MCParticle& d = *m_MCParticles[i - 1];
116 int pdg = d.getPDG();
117 if (pdg == id || (sign == 0 && abs(pdg) == abs(id))) ret++;
118 if (abs(pdg) == 24) {
119 for (int j = d.getFirstDaughter(); j <= d.getLastDaughter(); ++j) {
120 const MCParticle& e = *m_MCParticles[j - 1];
121 int pdg2 = e.getPDG();
122 if (pdg2 == id ||
123 (sign == 0)) ret++;
124 }
125 }
126 }
127 }
128 return ret;
129}
130
132{
133 if (s == 0 || !tauPair) return -1;
134 int tauid = idOfTauMinus;
135 if (s > 0) tauid = idOfTauPlus;
136 int ret = 0;
137 const MCParticle& p = *m_MCParticles[tauid - 1];
138
139 if (id == 0) {
140 for (int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
141 const MCParticle& d = *m_MCParticles[i - 1];
142 if (abs(d.getPDG()) == 24) {
143 for (int j = d.getFirstDaughter(); j <= d.getLastDaughter(); ++j) {
144 const MCParticle& e = *m_MCParticles[j - 1];
145 if (e.getPDG() != Const::photon.getPDGCode()) ret++;
146 }
147 } else if (d.getPDG() != Const::photon.getPDGCode()) ret++;
148 }
149 } else {
150 for (int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
151 const MCParticle& d = *m_MCParticles[i - 1];
152 int pdg = d.getPDG();
153 if (abs(pdg) == 24) {
154 for (int j = d.getFirstDaughter(); j <= d.getLastDaughter(); ++j) {
155 const MCParticle& e = *m_MCParticles[j - 1];
156 int pdg2 = e.getPDG();
157 if (pdg2 == id ||
158 (sign == 0 && abs(pdg2) == abs(id))) ret++;
159 }
160 } else if (pdg == id || (sign == 0 && abs(pdg) == abs(id))) ret++;
161 }
162 }
163 return ret;
164}
165
167{
168 if (!tauPair || s == 0) return 0;
169 if (
170 getNumDaughterOfTauExceptGamma(s, -s * (-12), 1) == 1 &&
171 getNumDaughterOfTauExceptGamma(s, -s * (11), 1) == 1 &&
172 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
174 ) return 1 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
175 if (
176 getNumDaughterOfTauExceptGamma(s, -s * (-14), 1) == 1 &&
177 getNumDaughterOfTauExceptGamma(s, -s * (13), 1) == 1 &&
178 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
180 ) return 2 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
181 if (
182 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
183 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
185 ) return 3 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
186 if (
187 getNumDaughterOfTauExceptGamma(s, -s * (-213), 1) == 1 &&
188 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
190 ) return 4 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
191 if (
192 getNumDaughterOfTauExceptGamma(s, -s * (-20213), 1) == 1 &&
193 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
195 ) return 5 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
196 if (
197 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
198 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
200 ) return 6 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
201 if (
202 getNumDaughterOfTauExceptGamma(s, -s * (-323), 1) == 1 &&
203 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
205 ) return 7 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
206 if (
207 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
208 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
209 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
210 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
212 ) return 8 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
213 if (
214 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
215 getNumDaughterOfTauExceptGamma(s, 111, 1) == 3 &&
216 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
218 ) return 9 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
219 if (
220 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
221 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
222 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
223 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
225 ) return 10 + (getNumDaughterOfTau(s, 0, 1) - 6) * 1000;
226 if (
227 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 3 &&
228 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
229 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 2 &&
231 ) return 11 + (getNumDaughterOfTau(s, 0, 1) - 6) * 1000;
232 if (
233 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 3 &&
234 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
235 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
236 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 2 &&
238 ) return 12 + (getNumDaughterOfTau(s, 0, 1) - 7) * 1000;
239 if (
240 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
241 getNumDaughterOfTauExceptGamma(s, 111, 1) == 3 &&
242 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
243 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
245 ) return 13 + (getNumDaughterOfTau(s, 0, 1) - 7) * 1000;
246 if (
247 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
248 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
249 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
250 getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
252 ) return 14 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
253 if (
254 getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
255 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
256 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
257 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
259 ) return 15 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
260 if (
262 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 2 ||
263 getNumDaughterOfTauExceptGamma(s, 311, 0) == 2) &&
264 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
265 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
267 ) return 15 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000
268 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
269 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
270 if (
271 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
272 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
273 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
274 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
276 ) return 16 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
277 if (
279 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
280 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
281 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
282 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
283 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
285 ) return 16 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000
286 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
287 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
288 if (
289 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
290 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
291 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
293 ) return 17 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
294 if (
295 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
296 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
297 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
298 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
300 ) return 18 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
301 if (
302 getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
303 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
304 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
305 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
307 ) return 19 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
308 if (
310 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
311 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
312 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
313 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
314 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
316 ) return 19 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000
317 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
318 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
319 if (
320 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
321 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
322 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
323 getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
325 ) return 20 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
326 if (
327 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
328 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
329 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
330 getNumDaughterOfTau(s, 22, 1) >= 1 &&
332 ) return 21 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
333 if (
334 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
335 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
336 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
338 ) return 22 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
339 if (
341 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
342 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
343 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
344 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
346 ) return 22 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000
347 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
348 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
349 if (
350 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
351 getNumDaughterOfTauExceptGamma(s, 111, 1) == 4 &&
352 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
354 ) return 23 + (getNumDaughterOfTau(s, 0, 1) - 6) * 1000;
355 if (
356 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
357 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
358 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
359 getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
361 ) return 24 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
362 if (
363 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
364 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
365 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
366 getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
368 ) return 25 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
369 if (
370 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
371 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
372 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
373 getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
375 ) return 26 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
376 if (
377 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
378 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
379 getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
381 ) return 27 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
382 if (
383 getNumDaughterOfTauExceptGamma(s, -s * (-323), 1) == 1 &&
384 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
385 getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
387 ) return 28 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
388 if (
389 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
390 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
391 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
392 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
393 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
395 ) return 29 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
396 if (
397 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
398 getNumDaughterOfTauExceptGamma(s, 111, 1) == 3 &&
399 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
401 ) return 30 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
402 if (
403 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
404 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
405 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
406 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
408 ) return 31 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
409 if (
411 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
412 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
413 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
414 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
415 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
417 ) return 31 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
418 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
419 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
420 if (
421 getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
422 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
423 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
424 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
426 ) return 32 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
427 if (
429 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
430 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
431 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
432 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
433 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
435 ) return 32 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
436 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
437 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
438 if (
439 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
440 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
441 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
442 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
443 getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
445 ) return 33 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
446 if (
447 getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
448 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
449 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
450 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
451 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
453 ) return 34 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
454 if (
456 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 2 ||
457 getNumDaughterOfTauExceptGamma(s, 311, 0) == 2) &&
458 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
459 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
460 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
462 ) return 34 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
463 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
464 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
465 if (
466 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
467 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
468 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
469 getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
471 ) return 35 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
472 if (
473 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
474 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
475 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
476 getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
478 ) return 36 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
479 if (
480 getNumDaughterOfTauExceptGamma(s, -s * (-11), 1) == 1 &&
481 getNumDaughterOfTauExceptGamma(s, -s * (-12), 1) == 1 &&
482 getNumDaughterOfTauExceptGamma(s, -s * (11), 1) == 2 &&
483 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
485 ) return 37 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
486 if (
487 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
488 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
489 getNumDaughterOfTauExceptGamma(s, 20223, 1) == 1 &&
491 ) return 38 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
492 if (
493 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
494 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
495 getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
497 ) return 39 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
498 if (
499 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
500 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
501 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
502 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
503 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
505 ) return 40 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
506 if (
508 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
509 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
510 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
511 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
512 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
513 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
515 ) return 40 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
516 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
517 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
518 if (
519 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
520 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
521 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
522 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
524 ) return 41 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
525 if (
527 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
528 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
529 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
530 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
531 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
533 ) return 41 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
534 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
535 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
536 if (
537 getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
538 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
539 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
540 getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
542 ) return 42 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
543 if (
545 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
546 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
547 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
548 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
549 getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
551 ) return 42 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
552 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
553 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
554 return 0;
555}
556
557
559{
560 int ret = 0;
561 const vector<MCParticle*> daughters = p.getDaughters();
562 if (daughters.empty()) return ret;
563 for (const MCParticle* d : daughters) {
564 if (!d->hasStatus(MCParticle::c_PrimaryParticle)) continue;
565 // TODO: Improve how to identify a final state particle.
566 bool isChargedFinalState = find(finalStatePDGs.begin(),
567 finalStatePDGs.end(),
568 abs(d->getPDG())) != finalStatePDGs.end();
569 if (isChargedFinalState) ret++;
570 else ret += getProngOfDecay(*d);
571 }
572 return ret;
573}
574
static const ParticleType photon
photon particle
Definition Const.h:674
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
void setDescription(const std::string &description)
Sets the description of the module.
Definition Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition Module.cc:208
Module()
Constructor.
Definition Module.cc:30
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition Module.h:80
Int_t m_mprong
Prong of the decay channel of negative tau.
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.
static 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.
static constexpr std::array< int, 5 > finalStatePDGs
PDG codes accepted as charged final state particles in generation: {e, mu, pi, K, p}...
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.
STL namespace.