Belle II Software  release-05-01-25
TauDecayMarkerModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Kiyoshi Hayasaka, Michel Villanueva *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <analysis/modules/TauDecayMarker/TauDecayMarkerModule.h>
12 #include <analysis/dataobjects/TauPairDecay.h>
13 
14 #include <framework/datastore/StoreArray.h>
15 #include <framework/datastore/StoreObjPtr.h>
16 
17 #include <framework/logging/Logger.h>
18 
19 #include <iostream>
20 
21 using namespace std;
22 using namespace Belle2;
23 
24 //-----------------------------------------------------------------
25 // Register the Module
26 //-----------------------------------------------------------------
27 REG_MODULE(TauDecayMarker)
28 
29 //-----------------------------------------------------------------
30 // Implementation
31 //-----------------------------------------------------------------
32 
33 TauDecayMarkerModule::TauDecayMarkerModule() : Module(), tauPair(false), numOfTauPlus(0), numOfTauMinus(0), idOfTauPlus(-1),
34  idOfTauMinus(-1), m_pmode(-2), m_mmode(-2), m_pprong(0), m_mprong(0)
35 {
36  // Set module properties
37  setDescription("Module to identify generated tau pair decays, using MCParticle information. Each tau lepton decay channel "
38  "is numbered following the order in the default KKMC decay table. Using this module, "
39  "the channel number will be stored in the variables ``tauPlusMcMode``, and ``tauMinusMcMode``. "
40  "Further details and usage can be found at `TauDecayMCModes`. ");
41  //Parameter definition
42  addParam("printDecayInfo", m_printDecayInfo, "Print information of the tau pair decay from MC.", false);
43 }
44 
45 void TauDecayMarkerModule::initialize()
46 {
48  tauDecay.registerInDataStore();
49 
50 }
51 
52 void TauDecayMarkerModule::event()
53 {
55  StoreArray<MCParticle> MCParticles;
56 
57  if (!tauDecay) tauDecay.create();
58 
59  IdentifyTauPair();
60  if (tauPair) {
61  m_pmode = getDecayChannelOfTau(+1) % 100;
62  m_mmode = getDecayChannelOfTau(-1) % 100;
63 
64  m_pprong = getProngOfDecay(*MCParticles[idOfTauPlus - 1]);
65  m_mprong = getProngOfDecay(*MCParticles[idOfTauMinus - 1]);
66 
67  if (m_printDecayInfo) {
68  B2INFO("Decay ID: " << m_pmode << " (tau+), " << m_mmode << " (tau-)." <<
69  " Topology: " << m_pprong << "-" << m_mprong << " prong");
70  }
71 
72  } else {
73  m_pmode = -1;
74  m_mmode = -1;
75  }
76 
77  tauDecay->addTauPlusIdMode(m_pmode);
78  tauDecay->addTauMinusIdMode(m_mmode);
79 
80  tauDecay->addTauPlusMcProng(m_pprong);
81  tauDecay->addTauMinusMcProng(m_mprong);
82 
83 }
84 
85 void TauDecayMarkerModule::IdentifyTauPair()
86 {
87  StoreArray<MCParticle> MCParticles;
88  numOfTauPlus = 0;
89  numOfTauMinus = 0;
90  idOfTauPlus = 0;
91  idOfTauMinus = 0;
92  for (int i = 0; i < MCParticles.getEntries(); i++) {
93  MCParticle& p = *MCParticles[i];
94 
95  if (p.getStatus() == 1 && p.getPDG() == 15) {
96  numOfTauMinus++;
97  idOfTauMinus = p.getIndex();
98  }
99  if (p.getStatus() == 1 && p.getPDG() == -15) {
100  numOfTauPlus++;
101  idOfTauPlus = p.getIndex();
102  }
103  }
104  if (numOfTauPlus == 1 && numOfTauMinus == 1) {
105  tauPair = true;
106  } else tauPair = false;
107 }
108 
109 int TauDecayMarkerModule::getNumDaughterOfTau(int s, int id, int sign)
110 {
111  if (s == 0 || !tauPair) return -1;
112  int tauid = idOfTauMinus;
113  if (s > 0) tauid = idOfTauPlus;
114  int ret = 0;
115  StoreArray<MCParticle> MCParticles;
116  const MCParticle& p = *MCParticles[tauid - 1];
117 
118  if (id == 0) {
119  for (int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
120  MCParticle& d = *MCParticles[i - 1];
121  if (abs(d.getPDG()) == 24)
122  ret += d.getLastDaughter() - d.getFirstDaughter() + 1;
123  else ret++;
124  }
125  } else {
126  for (int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
127  MCParticle& d = *MCParticles[i - 1];
128  int pdg = d.getPDG();
129  if (pdg == id || (sign == 0 && abs(pdg) == abs(id))) ret++;
130  if (abs(pdg) == 24) {
131  for (int j = d.getFirstDaughter(); j <= d.getLastDaughter(); ++j) {
132  MCParticle& e = *MCParticles[j - 1];
133  int pdg2 = e.getPDG();
134  if (pdg2 == id ||
135  (sign == 0)) ret++;
136  }
137  }
138  }
139  }
140  return ret;
141 }
142 
143 int TauDecayMarkerModule::getNumDaughterOfTauExceptGamma(int s, int id, int sign)
144 {
145  if (s == 0 || !tauPair) return -1;
146  int tauid = idOfTauMinus;
147  if (s > 0) tauid = idOfTauPlus;
148  int ret = 0;
149  StoreArray<MCParticle> MCParticles;
150  const MCParticle& p = *MCParticles[tauid - 1];
151 
152  if (id == 0) {
153  for (int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
154  MCParticle& d = *MCParticles[i - 1];
155  if (abs(d.getPDG()) == 24) {
156  for (int j = d.getFirstDaughter(); j <= d.getLastDaughter(); ++j) {
157  MCParticle& e = *MCParticles[j - 1];
158  if (e.getPDG() != 22) ret++;
159  }
160  } else if (d.getPDG() != 22) ret++;
161  }
162  } else {
163  for (int i = p.getFirstDaughter(); i <= p.getLastDaughter(); ++i) {
164  MCParticle& d = *MCParticles[i - 1];
165  int pdg = d.getPDG();
166  if (abs(pdg) == 24) {
167  for (int j = d.getFirstDaughter(); j <= d.getLastDaughter(); ++j) {
168  MCParticle& e = *MCParticles[j - 1];
169  int pdg2 = e.getPDG();
170  if (pdg2 == id ||
171  (sign == 0 && abs(pdg2) == abs(id))) ret++;
172  }
173  } else if (pdg == id || (sign == 0 && abs(pdg) == abs(id))) ret++;
174  }
175  }
176  return ret;
177 }
178 
179 int TauDecayMarkerModule::getDecayChannelOfTau(int s)
180 {
181  int ret = 0;
182  if (tauPair && s != 0) {
183  if (
184  getNumDaughterOfTauExceptGamma(s, -s * (-12), 1) == 1 &&
185  getNumDaughterOfTauExceptGamma(s, -s * (11), 1) == 1 &&
186  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
187  getNumDaughterOfTauExceptGamma(s, 0, 1) == 3
188  ) ret = 1 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
189  else if (
190  getNumDaughterOfTauExceptGamma(s, -s * (-14), 1) == 1 &&
191  getNumDaughterOfTauExceptGamma(s, -s * (13), 1) == 1 &&
192  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
193  getNumDaughterOfTauExceptGamma(s, 0, 1) == 3
194  ) ret = 2 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
195  else if (
196  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
197  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
198  getNumDaughterOfTauExceptGamma(s, 0, 1) == 2
199  ) ret = 3 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
200  else if (
201  getNumDaughterOfTauExceptGamma(s, -s * (-213), 1) == 1 &&
202  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
203  getNumDaughterOfTauExceptGamma(s, 0, 1) == 2
204  ) ret = 4 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
205  else if (
206  getNumDaughterOfTauExceptGamma(s, -s * (-20213), 1) == 1 &&
207  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
208  getNumDaughterOfTauExceptGamma(s, 0, 1) == 2
209  ) ret = 5 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
210  else if (
211  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
212  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
213  getNumDaughterOfTauExceptGamma(s, 0, 1) == 2
214  ) ret = 6 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
215  else if (
216  getNumDaughterOfTauExceptGamma(s, -s * (-323), 1) == 1 &&
217  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
218  getNumDaughterOfTauExceptGamma(s, 0, 1) == 2
219  ) ret = 7 + (getNumDaughterOfTau(s, 0, 1) - 2) * 1000;
220  else if (
221  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
222  getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
223  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
224  getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
225  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
226  ) ret = 8 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
227  else if (
228  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
229  getNumDaughterOfTauExceptGamma(s, 111, 1) == 3 &&
230  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
231  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
232  ) ret = 9 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
233  else if (
234  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
235  getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
236  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
237  getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
238  getNumDaughterOfTauExceptGamma(s, 0, 1) == 6
239  ) ret = 10 + (getNumDaughterOfTau(s, 0, 1) - 6) * 1000;
240  else if (
241  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 3 &&
242  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
243  getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 2 &&
244  getNumDaughterOfTauExceptGamma(s, 0, 1) == 6
245  ) ret = 11 + (getNumDaughterOfTau(s, 0, 1) - 6) * 1000;
246  else if (
247  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 3 &&
248  getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
249  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
250  getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 2 &&
251  getNumDaughterOfTauExceptGamma(s, 0, 1) == 7
252  ) ret = 12 + (getNumDaughterOfTau(s, 0, 1) - 7) * 1000;
253  else if (
254  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
255  getNumDaughterOfTauExceptGamma(s, 111, 1) == 3 &&
256  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
257  getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
258  getNumDaughterOfTauExceptGamma(s, 0, 1) == 7
259  ) ret = 13 + (getNumDaughterOfTau(s, 0, 1) - 7) * 1000;
260  else if (
261  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
262  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
263  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
264  getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
265  getNumDaughterOfTauExceptGamma(s, 0, 1) == 4
266  ) ret = 14 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
267  else if (
268  getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
269  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
270  getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
271  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
272  getNumDaughterOfTauExceptGamma(s, 0, 1) == 4
273  ) ret = 15 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
274  else if (
275  (getNumDaughterOfTauExceptGamma(s, 130, 0)
276  + getNumDaughterOfTauExceptGamma(s, 310, 0) == 2 ||
277  getNumDaughterOfTauExceptGamma(s, 311, 0) == 2) &&
278  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
279  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
280  getNumDaughterOfTauExceptGamma(s, 0, 1) == 4
281  ) ret = 15 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000
282  + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
283  + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
284  else if (
285  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
286  getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
287  getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
288  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
289  getNumDaughterOfTauExceptGamma(s, 0, 1) == 4
290  ) ret = 16 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
291  else if (
292  (getNumDaughterOfTauExceptGamma(s, 130, 0)
293  + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
294  getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
295  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
296  getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
297  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
298  getNumDaughterOfTauExceptGamma(s, 0, 1) == 4
299  ) ret = 16 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000
300  + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
301  + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
302  else if (
303  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
304  getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
305  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
306  getNumDaughterOfTauExceptGamma(s, 0, 1) == 4
307  ) ret = 17 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
308  else if (
309  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
310  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
311  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
312  getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
313  getNumDaughterOfTauExceptGamma(s, 0, 1) == 4
314  ) ret = 18 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
315  else if (
316  getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
317  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
318  getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
319  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
320  getNumDaughterOfTauExceptGamma(s, 0, 1) == 4
321  ) ret = 19 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
322  else if (
323  (getNumDaughterOfTauExceptGamma(s, 130, 0)
324  + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
325  getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
326  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
327  getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
328  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
329  getNumDaughterOfTauExceptGamma(s, 0, 1) == 4
330  ) ret = 19 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000
331  + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
332  + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
333  else if (
334  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
335  getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
336  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
337  getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
338  getNumDaughterOfTauExceptGamma(s, 0, 1) == 4
339  ) ret = 20 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
340  else if (
341  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
342  getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
343  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
344  getNumDaughterOfTau(s, 22, 1) >= 1 &&
345  getNumDaughterOfTauExceptGamma(s, 0, 1) == 3
346  ) ret = 21 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
347  else if (
348  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
349  getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
350  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
351  getNumDaughterOfTauExceptGamma(s, 0, 1) == 3
352  ) ret = 22 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
353  else if (
354  (getNumDaughterOfTauExceptGamma(s, 130, 0)
355  + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
356  getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
357  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
358  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
359  getNumDaughterOfTauExceptGamma(s, 0, 1) == 3
360  ) ret = 22 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000
361  + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
362  + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
363  else if (
364  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
365  getNumDaughterOfTauExceptGamma(s, 111, 1) == 4 &&
366  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
367  getNumDaughterOfTauExceptGamma(s, 0, 1) == 6
368  ) ret = 23 + (getNumDaughterOfTau(s, 0, 1) - 6) * 1000;
369  else if (
370  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
371  getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
372  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
373  getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
374  getNumDaughterOfTauExceptGamma(s, 0, 1) == 4
375  ) ret = 24 + (getNumDaughterOfTau(s, 0, 1) - 4) * 1000;
376  else if (
377  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
378  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
379  getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
380  getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
381  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
382  ) ret = 25 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
383  else if (
384  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
385  getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
386  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
387  getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
388  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
389  ) ret = 26 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
390  else if (
391  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
392  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
393  getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
394  getNumDaughterOfTauExceptGamma(s, 0, 1) == 3
395  ) ret = 27 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
396  else if (
397  getNumDaughterOfTauExceptGamma(s, -s * (-323), 1) == 1 &&
398  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
399  getNumDaughterOfTauExceptGamma(s, 221, 1) == 1 &&
400  getNumDaughterOfTauExceptGamma(s, 0, 1) == 3
401  ) ret = 28 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
402  else if (
403  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
404  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
405  getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
406  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
407  getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
408  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
409  ) ret = 29 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
410  else if (
411  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
412  getNumDaughterOfTauExceptGamma(s, 111, 1) == 3 &&
413  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
414  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
415  ) ret = 30 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
416  else if (
417  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
418  getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
419  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
420  getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
421  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
422  ) ret = 31 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
423  else if (
424  (getNumDaughterOfTauExceptGamma(s, 130, 0)
425  + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
426  getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
427  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
428  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
429  getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
430  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
431  ) ret = 31 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
432  + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
433  + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
434  else if (
435  getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
436  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
437  getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
438  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
439  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
440  ) ret = 32 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
441  else if (
442  (getNumDaughterOfTauExceptGamma(s, 130, 0)
443  + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
444  getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
445  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
446  getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
447  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
448  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
449  ) ret = 32 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
450  + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
451  + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
452  else if (
453  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
454  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
455  getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
456  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
457  getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
458  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
459  ) ret = 33 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
460  else if (
461  getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
462  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
463  getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
464  getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
465  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
466  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
467  ) ret = 34 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
468  else if (
469  (getNumDaughterOfTauExceptGamma(s, 130, 0)
470  + getNumDaughterOfTauExceptGamma(s, 310, 0) == 2 ||
471  getNumDaughterOfTauExceptGamma(s, 311, 0) == 2) &&
472  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
473  getNumDaughterOfTauExceptGamma(s, 111, 1) == 1 &&
474  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
475  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
476  ) ret = 34 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
477  + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
478  + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
479  else if (
480  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
481  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
482  getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
483  getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
484  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
485  ) ret = 35 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
486  else if (
487  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
488  getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
489  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
490  getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
491  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
492  ) ret = 36 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
493  else if (
494  getNumDaughterOfTauExceptGamma(s, -s * (-11), 1) == 1 &&
495  getNumDaughterOfTauExceptGamma(s, -s * (-12), 1) == 1 &&
496  getNumDaughterOfTauExceptGamma(s, -s * (11), 1) == 2 &&
497  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
498  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
499  ) ret = 37 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
500  else if (
501  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
502  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
503  getNumDaughterOfTauExceptGamma(s, 20223, 1) == 1 &&
504  getNumDaughterOfTauExceptGamma(s, 0, 1) == 3
505  ) ret = 38 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
506  else if (
507  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
508  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
509  getNumDaughterOfTauExceptGamma(s, 223, 1) == 1 &&
510  getNumDaughterOfTauExceptGamma(s, 0, 1) == 3
511  ) ret = 39 + (getNumDaughterOfTau(s, 0, 1) - 3) * 1000;
512  else if (
513  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
514  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
515  getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
516  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
517  getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
518  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
519  ) ret = 40 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
520  else if (
521  (getNumDaughterOfTauExceptGamma(s, 130, 0)
522  + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
523  getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
524  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 1 &&
525  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
526  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
527  getNumDaughterOfTauExceptGamma(s, -s * (211), 1) == 1 &&
528  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
529  ) ret = 40 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
530  + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
531  + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
532  else if (
533  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
534  getNumDaughterOfTauExceptGamma(s, -s * (10313), 1) == 1 &&
535  getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
536  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
537  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
538  ) ret = 41 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
539  else if (
540  (getNumDaughterOfTauExceptGamma(s, 130, 0)
541  + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
542  getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
543  getNumDaughterOfTauExceptGamma(s, -s * (-321), 1) == 1 &&
544  getNumDaughterOfTauExceptGamma(s, 111, 1) == 2 &&
545  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
546  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
547  ) ret = 41 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
548  + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
549  + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
550  else if (
551  getNumDaughterOfTauExceptGamma(s, -s * (-10313), 1) == 1 &&
552  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
553  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
554  getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
555  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
556  ) ret = 42 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000;
557  else if (
558  (getNumDaughterOfTauExceptGamma(s, 130, 0)
559  + getNumDaughterOfTauExceptGamma(s, 310, 0) == 1 ||
560  getNumDaughterOfTauExceptGamma(s, 311, 0) == 1) &&
561  getNumDaughterOfTauExceptGamma(s, -s * (-211), 1) == 2 &&
562  getNumDaughterOfTauExceptGamma(s, -s * (16), 1) == 1 &&
563  getNumDaughterOfTauExceptGamma(s, -s * (321), 1) == 1 &&
564  getNumDaughterOfTauExceptGamma(s, 0, 1) == 5
565  ) ret = 42 + (getNumDaughterOfTau(s, 0, 1) - 5) * 1000
566  + getNumDaughterOfTauExceptGamma(s, 310, 0) * 10000
567  + getNumDaughterOfTauExceptGamma(s, 130, 0) * 100000;
568 
569  }
570  return ret;
571 }
572 
573 
574 int TauDecayMarkerModule::getProngOfDecay(const MCParticle& p)
575 {
576  int ret = 0;
577  const vector<MCParticle*> daughters = p.getDaughters();
578  if (daughters.empty()) return ret;
579  for (MCParticle* d : daughters) {
580  if (!d->hasStatus(MCParticle::c_PrimaryParticle)) continue;
581  // TODO: Improve how to identify a final state particle.
582  bool isChargedFinalState = find(begin(finalStatePDGs),
583  end(finalStatePDGs),
584  abs(d->getPDG())) != end(finalStatePDGs);
585  if (isChargedFinalState) ret++;
586  else ret += getProngOfDecay(*d);
587  }
588  return ret;
589 }
590 
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::TauDecayMarkerModule
Module to identify generated tau pair decays, using MCParticle information.
Definition: TauDecayMarkerModule.h:39
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreObjPtr
Type-safe access to single objects in the data store.
Definition: ParticleList.h:33
Belle2::MCParticle
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:43
Belle2::StoreArray< MCParticle >
Belle2::StoreArray::getEntries
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:226