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
26TauDecayMarkerModule::TauDecayMarkerModule() : Module(), tauPair(false), numOfTauPlus(0), numOfTauMinus(0), idOfTauPlus(-1),
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++) {
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 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 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 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 MCParticle& d = *m_MCParticles[i - 1];
142 if (abs(d.getPDG()) == 24) {
143 for (int j = d.getFirstDaughter(); j <= d.getLastDaughter(); ++j) {
144 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 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 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 int ret = 0;
169 if (tauPair && s != 0) {
170 if (
171 getNumDaughterOfTauExceptGamma(s, -s * (-12), 1) == 1 &&
172 getNumDaughterOfTauExceptGamma(s, -s * (11), 1) == 1 &&
173 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
175 ) ret = 1 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
176 else if (
177 getNumDaughterOfTauExceptGamma(s, -s * (-14), 1) == 1 &&
178 getNumDaughterOfTauExceptGamma(s, -s * (13), 1) == 1 &&
179 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
181 ) ret = 2 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
182 else if (
183 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
184 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
186 ) ret = 3 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
187 else if (
188 getNumDaughterOfTauExceptGamma(s, -s * (-213), 1) == 1 &&
189 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
191 ) ret = 4 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
192 else if (
193 getNumDaughterOfTauExceptGamma(s, -s * (-20213), 1) == 1 &&
194 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
196 ) ret = 5 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
197 else if (
198 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
199 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
201 ) ret = 6 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
202 else if (
203 getNumDaughterOfTauExceptGamma(s, -s * (-323), 1) == 1 &&
204 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
206 ) ret = 7 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
207 else if (
208 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
209 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
210 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
211 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
213 ) ret = 8 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
214 else if (
215 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
216 getNumDaughterOfTauExceptGamma(s, 111, 1) == 3 &&
217 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
219 ) ret = 9 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
220 else if (
221 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
222 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
223 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
224 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
226 ) ret = 10 + (getNumDaughterOfTau(s, 0, 1) - 6) * 1000;
227 else if (
228 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 3 &&
229 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
230 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 2 &&
232 ) ret = 11 + (getNumDaughterOfTau(s, 0, 1) - 6) * 1000;
233 else if (
234 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 3 &&
235 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
236 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
237 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 2 &&
239 ) ret = 12 + (getNumDaughterOfTau(s, 0, 1) - 7) * 1000;
240 else if (
241 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
242 getNumDaughterOfTauExceptGamma(s, 111, 1) == 3 &&
243 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
244 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
246 ) ret = 13 + (getNumDaughterOfTau(s, 0, 1) - 7) * 1000;
247 else if (
248 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
249 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
250 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
251 getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
253 ) ret = 14 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
254 else if (
255 getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
256 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
257 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
258 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
260 ) ret = 15 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
261 else if (
263 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 2 ||
264 getNumDaughterOfTauExceptGamma(s, 311, 0) == 2) &&
265 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
266 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
268 ) ret = 15 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000
269 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
270 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
271 else if (
272 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
273 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
274 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
275 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
277 ) ret = 16 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
278 else if (
280 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
281 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
282 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
283 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
284 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
286 ) ret = 16 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000
287 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
288 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
289 else if (
290 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
291 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
292 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
294 ) ret = 17 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
295 else if (
296 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
297 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
298 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
299 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
301 ) ret = 18 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
302 else if (
303 getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
304 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
305 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
306 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
308 ) ret = 19 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
309 else if (
311 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
312 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
313 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
314 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
315 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
317 ) ret = 19 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000
318 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
319 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
320 else if (
321 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
322 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
323 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
324 getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
326 ) ret = 20 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
327 else if (
328 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
329 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
330 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
331 getNumDaughterOfTau(s, 22, 1) >= 1 &&
333 ) ret = 21 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
334 else if (
335 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
336 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
337 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
339 ) ret = 22 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
340 else if (
342 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
343 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
344 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
345 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
347 ) ret = 22 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000
348 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
349 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
350 else if (
351 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
352 getNumDaughterOfTauExceptGamma(s, 111, 1) == 4 &&
353 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
355 ) ret = 23 + (getNumDaughterOfTau(s, 0, 1) - 6) * 1000;
356 else if (
357 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
358 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
359 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
360 getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
362 ) ret = 24 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
363 else if (
364 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
365 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
366 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
367 getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
369 ) ret = 25 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
370 else if (
371 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
372 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
373 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
374 getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
376 ) ret = 26 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
377 else if (
378 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
379 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
380 getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
382 ) ret = 27 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
383 else if (
384 getNumDaughterOfTauExceptGamma(s, -s * (-323), 1) == 1 &&
385 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
386 getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
388 ) ret = 28 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
389 else if (
390 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
391 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
392 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
393 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
394 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
396 ) ret = 29 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
397 else if (
398 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
399 getNumDaughterOfTauExceptGamma(s, 111, 1) == 3 &&
400 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
402 ) ret = 30 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
403 else if (
404 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
405 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
406 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
407 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
409 ) ret = 31 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
410 else if (
412 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
413 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
414 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
415 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
416 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
418 ) ret = 31 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
419 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
420 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
421 else if (
422 getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
423 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
424 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
425 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
427 ) ret = 32 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
428 else if (
430 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
431 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
432 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
433 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
434 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
436 ) ret = 32 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
437 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
438 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
439 else if (
440 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
441 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
442 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
443 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
444 getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
446 ) ret = 33 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
447 else if (
448 getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
449 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
450 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
451 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
452 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
454 ) ret = 34 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
455 else if (
457 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 2 ||
458 getNumDaughterOfTauExceptGamma(s, 311, 0) == 2) &&
459 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
460 getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
461 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
463 ) ret = 34 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
464 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
465 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
466 else if (
467 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
468 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
469 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
470 getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
472 ) ret = 35 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
473 else if (
474 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
475 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
476 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
477 getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
479 ) ret = 36 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
480 else if (
481 getNumDaughterOfTauExceptGamma(s, -s * (-11), 1) == 1 &&
482 getNumDaughterOfTauExceptGamma(s, -s * (-12), 1) == 1 &&
483 getNumDaughterOfTauExceptGamma(s, -s * (11), 1) == 2 &&
484 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
486 ) ret = 37 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
487 else if (
488 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
489 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
490 getNumDaughterOfTauExceptGamma(s, 20223, 1) == 1 &&
492 ) ret = 38 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
493 else if (
494 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
495 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
496 getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
498 ) ret = 39 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
499 else if (
500 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
501 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
502 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
503 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
504 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
506 ) ret = 40 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
507 else if (
509 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
510 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
511 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
512 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
513 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
514 getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
516 ) ret = 40 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
517 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
518 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
519 else if (
520 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
521 getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
522 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
523 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
525 ) ret = 41 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
526 else if (
528 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
529 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
530 getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
531 getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
532 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
534 ) ret = 41 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
535 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
536 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
537 else if (
538 getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
539 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
540 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
541 getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
543 ) ret = 42 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
544 else if (
546 + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
547 getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
548 getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
549 getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
550 getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
552 ) ret = 42 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
553 + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
554 + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
555
556 }
557 return ret;
558}
559
560
562{
563 int ret = 0;
564 const vector<MCParticle*> daughters = p.getDaughters();
565 if (daughters.empty()) return ret;
566 for (MCParticle* d : daughters) {
567 if (!d->hasStatus(MCParticle::c_PrimaryParticle)) continue;
568 // TODO: Improve how to identify a final state particle.
569 bool isChargedFinalState = find(begin(finalStatePDGs),
570 end(finalStatePDGs),
571 abs(d->getPDG())) != end(finalStatePDGs);
572 if (isChargedFinalState) ret++;
573 else ret += getProngOfDecay(*d);
574 }
575 return ret;
576}
577
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
Base class for Modules.
Definition: Module.h:72
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
@ 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 getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
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:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:649
Abstract base class for different kinds of events.
STL namespace.