Belle II Software development
TauDecayModeModule.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/TauDecayMode/TauDecayModeModule.h>
10#include <framework/datastore/StoreArray.h>
11#include <framework/datastore/StoreObjPtr.h>
12#include <framework/logging/Logger.h>
13#include <framework/particledb/EvtGenDatabasePDG.h>
14#include <vector>
15#include <algorithm>
16#include <TParticlePDG.h>
17#include <map>
18#include <fstream>
19#include <Math/LorentzRotation.h>
20#include <Math/Boost.h>
21using namespace std;
22using namespace Belle2;
23
24std::map<std::string, int> make_map(const std::string& file, int chg)
25{
26 std::string fileName;
27 if (file == "") {
28 if (chg < 0) {
29 B2INFO("Missing input mapping file: use mp_file_minus=basf2.find_file('data/analysis/modules/TauDecayMode/map_tauminus.txt') TauDecayMode.param('file_minus', mp_file_minus) to classify with default mapping.");
30 } else {
31 B2INFO("Missing input mapping file: use mp_file_plus=basf2.find_file('data/analysis/modules/TauDecayMode/map_tauplus.txt') TauDecayMode.param('file_plus', mp_file_plus) to classify with default mapping.");
32 }
33 } else {
34 fileName = file;
35 }
36
37 ifstream f;
38 f.open(fileName);
39 std::string line;
40 std::string key;
41 int value;
42 std::map <std::string, int> map_tau;
43 while (f.good()) {
44 getline(f, line);
45 istringstream ss(line);
46 ss >> key >> value;
47 map_tau[key] = value;
48 }
49 f.close();
50 return map_tau;
51}
52
53//-----------------------------------------------------------------
54// Register the Module
55//-----------------------------------------------------------------
56REG_MODULE(TauDecayMode);
57//-----------------------------------------------------------------
58// Implementation
59//-----------------------------------------------------------------
60
61TauDecayModeModule::TauDecayModeModule() : Module(), m_taum_no(0), m_taup_no(0), m_mmode(-2), m_pmode(-2),
62 m_mprong(0), m_pprong(0), m_megstar(0), m_pegstar(0),
63 tauPair(false), numOfTauMinus(0), numOfTauPlus(0), idOfTauMinus(-1), idOfTauPlus(-1),
64 m_isEtaPizPizPizFromTauMinus(false), m_isEtaPizPizPizFromTauPlus(false),
65 m_isOmegaPimPipFromTauMinus(false), m_isOmegaPimPipFromTauPlus(false)
66{
67 // Set module properties
68 setDescription("Module to identify generated tau pair decays, using MCParticle information.\n"
69 "By default, each tau decay is numbered as TauolaBelle2DecayMode [Ref: BELLE2-NOTE-PH-2020-055]");
70 //Parameter definition
71 addParam("printmode", m_printmode, "Printout more information from each event", std::string("default"));
72 addParam("file_minus", m_file_minus, "Path for an alternative mapping for tau- decays", std::string(""));
73 addParam("file_plus", m_file_plus, "Path for an alternative mapping for tau+ decays", std::string(""));
74}
75
76//
78{
79 mode_decay_minus = make_map(m_file_minus, -1);
80 mode_decay_plus = make_map(m_file_plus, 1);
81 m_tauDecay.registerInDataStore();
82 m_event_metadata.isRequired();
83}
84
85//
87{
88
90 if (tauPair) {
91
93
94 if (m_printmode == "missing") {
95 if (m_mmode == -1) {
96 B2INFO("TauDecayMode:: EventNumber = " << m_event_metadata->getEvent()
97 << " Decay: tau- -> " << m_tauminusdecaymode << " Mode = " << m_mmode);
98 }
99 if (m_pmode == -1) {
100 B2INFO("TauDecayMode:: EventNumber = " << m_event_metadata->getEvent()
101 << " Decay: tau+ -> " << m_tauplusdecaymode << " Mode = " << m_pmode);
102 }
103 }
104
105 if (m_printmode == "all") {
106 B2INFO("TauDecayMode:: EventNumber = " << m_event_metadata->getEvent()
107 << " Decay: tau- -> " << m_tauminusdecaymode << " Mode = " << m_mmode);
108 B2INFO("TauDecayMode:: EventNumber = " << m_event_metadata->getEvent()
109 << " Decay: tau+ -> " << m_tauplusdecaymode << " Mode = " << m_pmode);
110 }
111
112 //
113 if (m_mmode == -1) {
114 m_taum_no = m_taum_no - 1;
116 }
117 if (m_pmode == -1) {
118 m_taup_no = m_taup_no - 1;
120 }
121
124
127
128 } else {
129 m_pmode = -1;
130 m_mmode = -1;
131 m_pprong = -1;
132 m_mprong = -1;
133 m_megstar = -1;
134 m_pegstar = -1;
135 }
136
137 if (!m_tauDecay) m_tauDecay.create();
138 m_tauDecay->addTauMinusIdMode(m_mmode);
139 m_tauDecay->addTauPlusIdMode(m_pmode);
140
141 m_tauDecay->addTauPlusMcProng(m_pprong);
142 m_tauDecay->addTauMinusMcProng(m_mprong);
143
144 m_tauDecay->addTauMinusEgstar(m_megstar);
145 m_tauDecay->addTauPlusEgstar(m_pegstar);
146}
147
149{
150 // Clear local vectors
151 vec_nut.clear();
152 vec_anut.clear();
153 vec_numu.clear();
154 vec_anumu.clear();
155 vec_nue.clear();
156 vec_anue.clear();
157 vec_em.clear();
158 vec_ep.clear();
159 vec_mum.clear();
160 vec_mup.clear();
161 vec_pim.clear();
162 vec_pip.clear();
163 vec_km.clear();
164 vec_kp.clear();
165 vec_apro.clear();
166 vec_pro.clear();
167 vec_pi0.clear();
168 vec_k0s.clear();
169 vec_k0l.clear();
170 vec_eta.clear();
171 vec_omega.clear();
172 vec_etapr.clear();
173 vec_phi.clear();
174 vec_rhom.clear();
175 vec_rhop.clear();
176 vec_rho0.clear();
177 vec_kstarm.clear();
178 vec_kstarp.clear();
179 vec_kstar0.clear();
180 vec_kstar0_br.clear();
181 vec_a1m.clear();
182 vec_a1p.clear();
183 vec_a00_980.clear();
184 vec_a0m_980.clear();
185 vec_a0p_980.clear();
186 vec_a00_1450.clear();
187 vec_a0m_1450.clear();
188 vec_a0p_1450.clear();
189 vec_b1m.clear();
190 vec_b1p.clear();
191 vec_f1.clear();
192 vec_f0.clear();
193 vec_lambda.clear();
194 vec_lmb_br.clear();
195 vec_alpha.clear();
196 vec_gam.clear();
197 vec_radgam_taum.clear();
198 vec_radgam_taup.clear();
199 //
200 map<int, std::vector<int>> map_vec;
201 //
202 map_vec[11] = vec_em;
203 map_vec[-11] = vec_ep;
204 map_vec[12] = vec_nue;
205 map_vec[-12] = vec_anue;
206 map_vec[13] = vec_mum;
207 map_vec[-13] = vec_mup;
208 map_vec[14] = vec_numu;
209 map_vec[-14] = vec_anumu;
210 map_vec[16] = vec_nut;
211 map_vec[-16] = vec_anut;
212 map_vec[-211] = vec_pim;
213 map_vec[211] = vec_pip;
214 map_vec[-321] = vec_km;
215 map_vec[321] = vec_kp;
216 map_vec[-2212] = vec_apro;
217 map_vec[2212] = vec_pro;
218 map_vec[111] = vec_pi0;
219 map_vec[310] = vec_k0s;
220 map_vec[130] = vec_k0l;
221 map_vec[221] = vec_eta;
222 map_vec[223] = vec_omega;
223 map_vec[331] = vec_etapr;
224 map_vec[333] = vec_phi;
225 map_vec[-213] = vec_rhom;
226 map_vec[213] = vec_rhop;
227 map_vec[113] = vec_rho0;
228 map_vec[-323] = vec_kstarm;
229 map_vec[323] = vec_kstarp;
230 map_vec[313] = vec_kstar0;
231 map_vec[-313] = vec_kstar0_br;
232 map_vec[-20213] = vec_a1m;
233 map_vec[20213] = vec_a1p;
234 map_vec[-9000211] = vec_a0m_980;
235 map_vec[9000211] = vec_a0p_980;
236 map_vec[9000111] = vec_a00_980;
237 map_vec[-10211] = vec_a0m_1450;
238 map_vec[10211] = vec_a0p_1450;
239 map_vec[10111] = vec_a00_1450;
240 map_vec[-10213] = vec_b1m;
241 map_vec[10213] = vec_b1p;
242 map_vec[20223] = vec_f1;
243 map_vec[9010221] = vec_f0;
244 map_vec[3122] = vec_lambda;
245 map_vec[-3122] = vec_lmb_br;
246 map_vec[94144] = vec_alpha;
247 map_vec[22] = vec_gam;
248
249 bool TauMinusIsLeptonicDecay = false;
250 bool TauPlusIsLeptonicDecay = false;
251
252 bool elecFirst = true;
253 bool muonFirst = true;
254
255 bool isPiPizGamTauMinusFirst = true;
256 bool isPiPizGamTauPlusFirst = true;
257
258 bool isLFVTauMinus2BodyDecayFirst = true;
259 bool isLFVTauPlus2BodyDecayFirst = true;
260
261 bool isChargedRhoFromTauMinusFirst = true;
262 bool isChargedRhoFromTauPlusFirst = true;
263
264 bool isChargedA1FromTauMinusFirst = true;
265 bool isChargedA1FromTauPlusFirst = true;
266
267 bool isEtaPPGFromTauMinusFirst = true;
268 bool isEtaPPGFromTauPlusFirst = true;
269
270 bool isOmegaPizGamFromTauMinusFirst = true;
271 bool isOmegaPizGamFromTauPlusFirst = true;
272
273 bool isEtaPizPizPizFromTauMinusFirst = true;
274 bool isEtaPizPizPizFromTauPlusFirst = true;
275
278
279 bool isOmegaPimPipFromTauMinusFirst = true;
280 bool isOmegaPimPipFromTauPlusFirst = true;
281
284
285 // Loop of MCParticles
286 for (int i = 0; i < MCParticles.getEntries(); i++) {
287
288 MCParticle& p = *MCParticles[i];
289
290 int pdgid = p.getPDG();
291
292 if (pdgid == -Const::Klong.getPDGCode()) pdgid = -pdgid; // Strange feature in TauolaBelle2
293
294 // Special treatment for photons
295 bool accept_photon = false;
296
297 if (!p.hasStatus(MCParticle::c_PrimaryParticle))
298 continue; // only consider particles coming from generator, e.g. discard particles added by Geant4
299 if (p.isInitial()) continue; // pick e- e+, but not from the incoming beams
300
301 // Check IsLeptonicDecay first
302 if (abs(pdgid) == 12 || abs(pdgid) == 14) { // (anti-)nu_e or (anti-)nu_mu
303 int leptonicdecay = 0;
304 const MCParticle* mother = p.getMother(); // tau- or tau+
305 const vector<MCParticle*> daughters = mother->getDaughters();
306 for (MCParticle* d : daughters) {
307 int dauid = abs(d->getPDG());
308 if (dauid == 11 || dauid == 12 || dauid == 13 || dauid == 14 || dauid == 16) {
309 leptonicdecay++;
310 }
311 }
312 if (leptonicdecay == 3) {
313 if (mother->getPDG() == 15) TauMinusIsLeptonicDecay = true;
314 if (mother->getPDG() == -15) TauPlusIsLeptonicDecay = true;
315 }
316 }
317
318 else if (pdgid == Const::electron.getPDGCode() && elecFirst) {
319 elecFirst = false;
320 const MCParticle* mother = p.getMother();
321 if (not mother) continue; // In some low multiplicity generators there may be no mother
322 const vector<MCParticle*> daughters = mother->getDaughters();
323 int nElMinus = 0;
324 int nElPlus = 0;
325 stringstream elec_ss;
326 for (MCParticle* d : daughters) {
327 if (!d->hasStatus(MCParticle::c_PrimaryParticle)) continue;
328 elec_ss << d->getPDG() << " ";
329 if (d->getPDG() == Const::electron.getPDGCode()) nElMinus++;
330 if (d->getPDG() == -Const::electron.getPDGCode()) nElPlus++;
331 }
332 if (nElMinus == 1 && nElPlus == 1) { // use this information in getRecursiveMotherCharge
333 B2DEBUG(19, "Mother of elec pair is = " << mother->getPDG() << " which has daughters : " << elec_ss.str());
334 }
335 }
336
337 else if (pdgid == Const::muon.getPDGCode() && muonFirst) {
338 muonFirst = false;
339 const MCParticle* mother = p.getMother();
340 if (not mother) continue; // In some low multiplicity generators there may be no mother
341 const vector<MCParticle*> daughters = mother->getDaughters();
342 int nMuMinus = 0;
343 int nMuPlus = 0;
344 stringstream muon_ss;
345 for (MCParticle* d : daughters) {
346 if (!d->hasStatus(MCParticle::c_PrimaryParticle)) continue;
347 muon_ss << d->getPDG() << " ";
348 if (d->getPDG() == Const::muon.getPDGCode()) nMuMinus++;
349 if (d->getPDG() == -Const::muon.getPDGCode()) nMuPlus++;
350 }
351 if (nMuMinus == 1 && nMuPlus == 1) { // use this information in getRecursiveMotherCharge
352 B2DEBUG(19, "Mother of muon pair is = " << mother->getPDG() << " which has daughters : " << muon_ss.str());
353 }
354 }
355
356 // Photons from PHOTOS are radiative photons
357 else if (pdgid == Const::photon.getPDGCode() && p.hasStatus(MCParticle::c_IsPHOTOSPhoton)) {
359 if (chg < 0) vec_radgam_taum.push_back(i);
360 if (chg > 0) vec_radgam_taup.push_back(i);
361 }
362
363 // Photons from PHOTOS do not define tau decay mode
364 else if (pdgid == Const::photon.getPDGCode() && !p.hasStatus(MCParticle::c_IsPHOTOSPhoton)) {
365 const MCParticle* mother = p.getMother();
366 if (not mother) continue; // In some low multiplicity generators there may be no mother
367 int mothid = abs(mother->getPDG());
368
369 // check if the gamma comes from final state charged particles {e, mu, pi, K, p, b_1}
370 bool isRadiationfromFinalStateChargedParticle = false;
371 if (mothid == 11 ||
372 mothid == 13 ||
373 mothid == 211 ||
374 mothid == 321 ||
375 mothid == 2212 ||
376 mothid == 10213) {
377 isRadiationfromFinalStateChargedParticle = true;
378 }
379
380 // check if the gamma from ChargedRho
381 bool isRadiationFromChargedRho = false;
382 if (mothid == 213) {
383 int chg = getRecursiveMotherCharge(mother);
384 if (chg < 0 && isChargedRhoFromTauMinusFirst) {
385 isChargedRhoFromTauMinusFirst = false;
386 isRadiationFromChargedRho = true;
387 }
388 if (chg > 0 && isChargedRhoFromTauPlusFirst) {
389 isChargedRhoFromTauPlusFirst = false;
390 isRadiationFromChargedRho = true;
391 }
392 }
393
394 // check if the gamma from ChargedA1
395 bool isRadiationFromChargedA1 = false;
396 if (mothid == 20213) {
397 int chg = getRecursiveMotherCharge(mother);
398 if (chg < 0 && isChargedA1FromTauMinusFirst) {
399 isChargedA1FromTauMinusFirst = false;
400 isRadiationFromChargedA1 = true;
401 }
402 if (chg > 0 && isChargedA1FromTauPlusFirst) {
403 isChargedA1FromTauPlusFirst = false;
404 isRadiationFromChargedA1 = true;
405 }
406 }
407
408 // check if the gamma comes from intermediate W+- boson
409 bool isRadiationfromIntermediateWBoson = false;
410 if (mothid == 24) isRadiationfromIntermediateWBoson = true;
411
412 // check if it is a tau- -> pi- omega nu, omega -> pi0 gamma decay
413 // Note: TauolaBelle2 generator treats this a coherent production
414 // e.g. includes omega in the form factor but not as an explicit final state particle
415 bool isPiPizGam = false;
416 if (isRadiationfromIntermediateWBoson) {
417 const vector<MCParticle*> daughters = mother->getDaughters();
418 int nPiSisters = 0;
419 int nPizSisters = 0;
420 int nTotSisters = 0;
421 int nOtherSisters = 0;
422 for (MCParticle* d : daughters) {
423 if (!d->hasStatus(MCParticle::c_PrimaryParticle)) continue;
424 nTotSisters++;
425 if (abs(d->getPDG()) == Const::pion.getPDGCode()) {
426 nPiSisters++;
427 } else if (abs(d->getPDG()) == Const::pi0.getPDGCode()) {
428 nPizSisters++;
429 } else if (abs(d->getPDG()) != Const::photon.getPDGCode()) {
430 nOtherSisters++;
431 }
432 }
433 // allow final state radiation from the tau lepton, but ignore information on number of photons for decay mode classifiction
434 if (nTotSisters >= 3 && nPiSisters == 1 && nPizSisters == 1 && nOtherSisters == 0) {
435 int chg = getRecursiveMotherCharge(mother);
436 if (chg < 0 && isPiPizGamTauMinusFirst) {
437 isPiPizGamTauMinusFirst = false;
438 isPiPizGam = true;
439 }
440 if (chg > 0 && isPiPizGamTauPlusFirst) {
441 isPiPizGamTauPlusFirst = false;
442 isPiPizGam = true;
443 }
444 }
445 }
446
447 // check if the gamma comes from tau
448 bool isRadiationfromTau = false;
449 if (mothid == 15) isRadiationfromTau = true;
450
451 // Photons from LeptonicTauDecays are radiative photons not added by PHOTOS
452 if (isRadiationfromTau) {
454 if (chg < 0 && TauMinusIsLeptonicDecay) vec_radgam_taum.push_back(i);
455 if (chg > 0 && TauPlusIsLeptonicDecay) vec_radgam_taup.push_back(i);
456 }
457
458 // check if the gamma comes from 2 body LFV decays of tau, e.g. tau- -> e-/mu- gamma with arbitrary number of extra photon radiations from PHOTOS/FSR
459 bool isLFVTau2BodyDecay = false;
460 if (isRadiationfromTau) {
461 bool hasNeutrinoAsSister = false;
462 int numChargedSister = 0;
463 int numNeutralNonNeutrinoNonPhotonSister = 0;
464 const vector<MCParticle*> daughters = mother->getDaughters();
465 for (MCParticle* d : daughters) {
466 if (!d->hasStatus(MCParticle::c_PrimaryParticle)) continue;
467 hasNeutrinoAsSister = find(begin(Neutrinos), end(Neutrinos), abs(d->getPDG())) != end(Neutrinos);
468 if (hasNeutrinoAsSister) break;
469 }
470 if (!hasNeutrinoAsSister) {
471 for (MCParticle* d : daughters) {
472 if (!d->hasStatus(MCParticle::c_PrimaryParticle)) continue;
473 bool isChargedFinalState = find(begin(finalStatePDGs), end(finalStatePDGs), abs(d->getPDG())) != end(finalStatePDGs);
474 if (isChargedFinalState) {
475 numChargedSister++;
476 } else if (d->getPDG() != Const::photon.getPDGCode()) {
477 numNeutralNonNeutrinoNonPhotonSister++;
478 }
479 }
480 if (numChargedSister == 1 && numNeutralNonNeutrinoNonPhotonSister == 0) {
481 if (mother->getPDG() == 15 && isLFVTauMinus2BodyDecayFirst) {
482 isLFVTauMinus2BodyDecayFirst = false;
483 isLFVTau2BodyDecay = true;
484 }
485 if (mother->getPDG() == -15 && isLFVTauPlus2BodyDecayFirst) {
486 isLFVTauPlus2BodyDecayFirst = false;
487 isLFVTau2BodyDecay = true;
488 }
489 }
490 }
491 B2DEBUG(19, "hasNeutrinoAsSister = " << hasNeutrinoAsSister
492 << " numChargedSister = " << numChargedSister
493 << " numNeutralNonNeutrinoNonPhotonSister = " << numNeutralNonNeutrinoNonPhotonSister
494 << " isLFVTau2BodyDecay = " << isLFVTau2BodyDecay);
495 }
496
497 bool isPi0GG = false;
498 bool isEtaGG = false;
499 bool isEtpGG = false;
500 bool isPi0GEE = false;
501 bool isEtaPPG = false;
502 bool isOmPizG = false;
503 if (mothid == 111 || mothid == 221 || mothid == 331 || mothid == 223) {
504 const vector<MCParticle*> daughters = mother->getDaughters();
505 int numberofTotalDaughters = 0;
506 int numberOfPhotonDaughters = 0;
507 int numberOfElectronDaughters = 0;
508 int numberOfPionDaughters = 0;
509 int numberOfPizDaughters = 0;
510 for (MCParticle* d : daughters) {
511 if (!d->hasStatus(MCParticle::c_PrimaryParticle)) continue;
512 numberofTotalDaughters ++;
513 if (abs(d->getPDG()) == Const::photon.getPDGCode()) numberOfPhotonDaughters++;
514 if (abs(d->getPDG()) == Const::electron.getPDGCode()) numberOfElectronDaughters++;
515 if (abs(d->getPDG()) == Const::pion.getPDGCode()) numberOfPionDaughters++;
516 if (abs(d->getPDG()) == Const::pi0.getPDGCode()) numberOfPizDaughters++;
517 }
518 if (numberofTotalDaughters == 2 && numberOfPhotonDaughters == 2) {
519 if (mothid == Const::pi0.getPDGCode()) isPi0GG = true;
520 if (mothid == 221) isEtaGG = true;
521 if (mothid == 331) isEtpGG = true;
522 }
523 if (numberofTotalDaughters >= 3 && numberOfPhotonDaughters >= 1 && numberOfElectronDaughters == 2 && numberOfPionDaughters == 0
524 && numberOfPizDaughters == 0) {
525 if (mothid == Const::pi0.getPDGCode()) isPi0GEE = true;
526 }
527 if (numberofTotalDaughters >= 3 && numberOfPhotonDaughters >= 1 && numberOfPizDaughters == 0 && numberOfPionDaughters == 2) {
528 if (mothid == 221) {
529 int chg = getRecursiveMotherCharge(mother);
530 if (chg < 0 && isEtaPPGFromTauMinusFirst) {
531 isEtaPPGFromTauMinusFirst = false;
532 isEtaPPG = true;
533 }
534 if (chg > 0 && isEtaPPGFromTauPlusFirst) {
535 isEtaPPGFromTauPlusFirst = false;
536 isEtaPPG = true;
537 }
538 }
539 }
540 if (numberofTotalDaughters >= 2 && numberOfPhotonDaughters >= 1 && numberOfPizDaughters == 1 && numberOfPionDaughters == 0) {
541 if (mothid == 223) {
542 int chg = getRecursiveMotherCharge(mother);
543 if (chg < 0 && isOmegaPizGamFromTauMinusFirst) {
544 isOmegaPizGamFromTauMinusFirst = false;
545 isOmPizG = true;
546 }
547 if (chg > 0 && isOmegaPizGamFromTauPlusFirst) {
548 isOmegaPizGamFromTauPlusFirst = false;
549 isOmPizG = true;
550 }
551 }
552 }
553 }
554
555 B2DEBUG(19, "isRadiationfromFinalStateChargedParticle = " << isRadiationfromFinalStateChargedParticle);
556 B2DEBUG(19, "isRadiationFromChargedRho = " << isRadiationFromChargedRho);
557 B2DEBUG(19, "isRadiationFromChargedA1 = " << isRadiationFromChargedA1);
558 B2DEBUG(19, "isRadiationfromIntermediateWBoson = " << isRadiationfromIntermediateWBoson << " isPiPizGam = " << isPiPizGam);
559 B2DEBUG(19, "isRadiationfromTau = " << isRadiationfromTau << " isLFVTau2BodyDecay = " << isLFVTau2BodyDecay);
560 B2DEBUG(19, "isPi0GG = " << isPi0GG << " isEtaGG = " << isEtaGG << " isEtpGG = " << isEtpGG << " isPi0GEE = " << isPi0GEE);
561 B2DEBUG(19, "isEtaPPG = " << isEtaPPG << " isOmPizG = " << isOmPizG);
562
563 // accept photons if (isRadiationfromFinalStateChargedParticle is false) or
564 // if (isRadiationfromIntermediateWBoson is false) or
565 // if (isRadiationfromTau is true) {gamma is from 2 body LFV decays of tau} or
566 // if the radiation is coming from any other decay [except pi0 -> gamma gamma, eta-> gamma gamma, eta' -> gamma gamma]
567 if (isRadiationfromFinalStateChargedParticle) {
568 } else if (isRadiationFromChargedRho) {
569 accept_photon = true;
570 } else if (isRadiationFromChargedA1) {
571 accept_photon = true;
572 } else if (isRadiationfromIntermediateWBoson) {
573 if (isPiPizGam) {
574 accept_photon = true;
575 }
576 } else if (isRadiationfromTau) { // accept one photon from tau -> (charged particle) + gamma [no neutrinos]
577 if (isLFVTau2BodyDecay) {
578 accept_photon = true;
579 }
580 } else if (isPi0GG) {
581 } else if (isEtaGG) {
582 } else if (isEtpGG) {
583 } else if (isPi0GEE) {
584 } else if (isEtaPPG) {
585 accept_photon = true;
586 } else if (isOmPizG) {
587 accept_photon = true;
588 }
589 }
590
591 // Without further analysis, it is NOT possible to separate
592 // tau- -> pi- 2pi0 eta (-> pi- pi+ pi0) nu decays [Mode 39] from
593 // tau- -> 2pi- pi+ eta (-> pi0 pi0 pi0) nu decays [Mode 42]
594
595 else if (pdgid == Const::pi0.getPDGCode() && (isEtaPizPizPizFromTauMinusFirst || isEtaPizPizPizFromTauPlusFirst)) {
596 const MCParticle* mother = p.getMother();
597 // In some low multiplicity generators there may be no mother
598 if (mother and (mother->getPDG() == 221)) { // eta -> pi0 pi0 pi0
599 const vector<MCParticle*> daughters = mother->getDaughters();
600 int nPizSisters = 0;
601 for (MCParticle* d : daughters) {
602 if (!d->hasStatus(MCParticle::c_PrimaryParticle)) continue;
603 if (d->getPDG() == Const::pi0.getPDGCode()) nPizSisters++;
604 }
605 B2DEBUG(19, "nPizSisters = " << nPizSisters);
606 if (nPizSisters == 3) {
607 int chg = getRecursiveMotherCharge(mother);
608 if (chg < 0 && isEtaPizPizPizFromTauMinusFirst) {
609 isEtaPizPizPizFromTauMinusFirst = false;
611 }
612 if (chg > 0 && isEtaPizPizPizFromTauPlusFirst) {
613 isEtaPizPizPizFromTauPlusFirst = false;
615 }
616 }
617 }
618 }
619
620 // Without further analysis, it is NOT possible to separate
621 // tau- -> pi- 2pi0 omega (-> pi- pi+) nu decays [Mode 49] from
622 // tau- -> 2pi- pi+ 2pi0 nu decays [Mode 66]
623 // Note: TauolaBelle2 treats Mode 66 is coherent production,
624 // e.g. includes omega in the form factor but not as an explicit final state particle.
625 // Note2: omega is explicitly included in following mode:
626 // tau- -> pi- pi0 omega (-> pi- pi+ pi0) nu decays [Mode 130]
627 // which is where Mode 49 is mapped to if there is no omega->pi-pi+ decay
628
629 // Same confusion can also happen for
630 // tau- -> pi- pi0 omega (-> pi- pi+) nu decays [Mode 131]
631 // tau- -> pi- omega (-> pi- pi+ pi0) nu decays [Mode 236]
632
633 else if (pdgid == -Const::pion.getPDGCode() && (isOmegaPimPipFromTauMinusFirst || isOmegaPimPipFromTauPlusFirst)) {
634 const MCParticle* mother = p.getMother();
635 // In some low multiplicity generators there may be no mother
636 if (mother and (mother->getPDG() == 223)) { // omega -> pi- pi+
637 const vector<MCParticle*> daughters = mother->getDaughters();
638 int nOmegaDaughters = 0;
639 int nPimSisters = 0;
640 int nPipSisters = 0;
641 int nPizSisters = 0;
642 for (MCParticle* d : daughters) {
643 if (!d->hasStatus(MCParticle::c_PrimaryParticle)) continue;
644 nOmegaDaughters++;
645 if (d->getPDG() == -Const::pion.getPDGCode()) nPimSisters++;
646 if (d->getPDG() == Const::pion.getPDGCode()) nPipSisters++;
647 if (d->getPDG() == Const::pi0.getPDGCode()) nPizSisters++;
648 }
649 B2DEBUG(19,
650 "nOmegaDaughters = " << nOmegaDaughters << " "
651 "nPimSisters = " << nPimSisters << " "
652 "nPipSisters = " << nPipSisters << " "
653 "nPizSisters = " << nPizSisters);
654 if (nOmegaDaughters >= 2 && nPimSisters == 1 && nPipSisters == 1 && nPizSisters == 0) { // allow omega->pi-pi+gama
655 int chg = getRecursiveMotherCharge(mother);
656 if (chg < 0 && isOmegaPimPipFromTauMinusFirst) {
657 isOmegaPimPipFromTauMinusFirst = false;
659 }
660 if (chg > 0 && isOmegaPimPipFromTauPlusFirst) {
661 isOmegaPimPipFromTauPlusFirst = false;
663 }
664 }
665 }
666 }
667 B2DEBUG(19,
668 "isEtaPizPizPizFromTauMinusFirst = " << isEtaPizPizPizFromTauMinusFirst << " "
669 "m_isEtaPizPizPizFromTauMinus = " << m_isEtaPizPizPizFromTauMinus << " "
670 "isEtaPizPizPizFromTauPlusFirst = " << isEtaPizPizPizFromTauPlusFirst << " "
671 "m_isEtaPizPizPizFromTauPlus = " << m_isEtaPizPizPizFromTauPlus
672 );
673 B2DEBUG(19,
674 "isOmegaPimPipFromTauMinusFirst = " << isOmegaPimPipFromTauMinusFirst << " "
675 "m_isOmegaPimPipFromTauMinus = " << m_isOmegaPimPipFromTauMinus << " "
676 "isOmegaPimPipFromTauPlusFirst = " << isOmegaPimPipFromTauPlusFirst << " "
677 "m_isOmegaPimPipFromTauPlus = " << m_isEtaPizPizPizFromTauPlus
678 );
679
680 // Fill up all the vector of particles
681 map<int, std::vector<int>>::iterator ite ;
682 for (ite = map_vec.begin(); ite != map_vec.end(); ++ite) {
683 if (pdgid == ite->first) {
684 if (pdgid == Const::photon.getPDGCode()) {
685 if (accept_photon) {
686 B2DEBUG(19, "Photon accepted");
687 ite-> second.push_back(i);
688 }
689 } else {
690 ite-> second.push_back(i);
691 }
692 break;
693 }
694 }
695
696 } // End of loop over MCParticles
697
698 vec_dau_tauminus.clear();
699 vec_dau_tauplus.clear();
700
701 map<int, std::vector<int>>::iterator itr ;
702 for (itr = map_vec.begin(); itr != map_vec.end(); ++itr) {
703 for (unsigned int i = 0; i < itr-> second.size(); i++) {
704 int ii = itr-> second[i];
706 if (chg < 0) vec_dau_tauminus.push_back(ii);
707 if (chg > 0) vec_dau_tauplus.push_back(ii);
708 }
709 }
710
712 std::string pdgname;
713
714 //make decay string for tau-
716 for (unsigned iorder = 0; iorder < 46; ++iorder) {
717 int ii = OrderedList[iorder];
718 //
719 for (unsigned int i = 0; i < vec_dau_tauminus.size(); i++) {
721 int pdg = p->getPDG();
722 if (pdg == -Const::Klong.getPDGCode()) pdg = -pdg; // Strange Feature in TauolaBelle2
723 if (pdg != ii) continue;
724 m_tauminusdecaymode.append(".");
725 if (pdg == 94144) {
726 pdgname = "alpha";
727 } else {
728 pdgname = databasePDG->GetParticle(pdg)->GetName();
729 }
730 m_tauminusdecaymode.append(pdgname);
731 }
732 }
733 //
735
736 //make decay string for tau+
738 for (unsigned iorder = 0; iorder < 46; ++iorder) {
739 int ii = OrderedList[iorder];
740 //
741 for (unsigned int i = 0; i < vec_dau_tauplus.size(); i++) {
743 int pdg = p->getPDG();
744 if (pdg == -Const::Klong.getPDGCode()) pdg = -pdg; // Strange Feature in TauolaBelle2
745 if (pdg != ii) continue;
746 m_tauplusdecaymode.append(".");
747 if (pdg == 94144) {
748 pdgname = "alpha";
749 } else {
750 pdgname = databasePDG->GetParticle(pdg)->GetName();
751 }
752 m_tauplusdecaymode.append(pdgname);
753 }
754 }
755 //
757
758}
759
760//
761int TauDecayModeModule::TauolaBelle2DecayMode(const std::string& state, int chg)
762{
763 std::map<std::string, int> mode_decay = (chg < 0) ? mode_decay_minus : mode_decay_plus;
764 map<std::string, int>::iterator itr ;
765 for (itr = mode_decay.begin(); itr != mode_decay.end(); ++itr) {
766 if (state == itr-> first) {
767 int mode = itr-> second;
768 if (mode == 39) {
769 if (chg < 0 && m_isEtaPizPizPizFromTauMinus) mode = 42;
770 if (chg > 0 && m_isEtaPizPizPizFromTauPlus) mode = 42;
771 }
772 if (mode == 49) {
773 if (chg < 0 && !m_isOmegaPimPipFromTauMinus) mode = 130;
774 if (chg > 0 && !m_isOmegaPimPipFromTauPlus) mode = 130;
775 }
776 if (mode == 131) {
777 if (chg < 0 && !m_isOmegaPimPipFromTauMinus) mode = 236;
778 if (chg > 0 && !m_isOmegaPimPipFromTauPlus) mode = 236;
779 }
780 if (mode == 247) {
781 if (chg < 0 && !m_isEtaPizPizPizFromTauMinus) mode = 15;
782 if (chg > 0 && !m_isEtaPizPizPizFromTauPlus) mode = 15;
783 }
784 return mode;
785 }
786 }
787 return -1;
788}
789
790//
792{
793 const MCParticle* mother = p->getMother();
794 if (mother == nullptr) {
795 return 0;
796 } else if (abs(p->getPDG()) == Const::electron.getPDGCode() && mother->getPDG() == Const::pi0.getPDGCode()) { // pi0 -> e-e+ gamma
797 return 0;
798 } else if (abs(p->getPDG()) == Const::electron.getPDGCode() && mother->getPDG() == 221) { // eta -> e-e+ gamma
799 return 0;
800 } else if (abs(p->getPDG()) == Const::electron.getPDGCode() && mother->getPDG() == 113) { // rho0 -> e-e+
801 return 0;
802 } else if (abs(p->getPDG()) == Const::electron.getPDGCode() && mother->getPDG() == 223) { // omega -> e- e+
803 return 0;
804 } else if (abs(p->getPDG()) == Const::electron.getPDGCode() && mother->getPDG() == 333) { // phi -> e- e+
805 return 0;
806 } else if (abs(p->getPDG()) == Const::muon.getPDGCode() && mother->getPDG() == 221) { // eta -> mu-mu+ gamma
807 return 0;
808 } else if (abs(p->getPDG()) == Const::muon.getPDGCode() && mother->getPDG() == 113) { // rho0 -> mu-mu+
809 return 0;
810 } else if (abs(p->getPDG()) == Const::muon.getPDGCode() && mother->getPDG() == 333) { // phi -> mu-mu+
811 return 0;
812 } else if (mother->getPDG() == 15) {
813 return -1;
814 } else if (mother->getPDG() == -15) {
815 return 1;
816 } else {
817 return getRecursiveMotherCharge(mother);
818 }
819}
820
821//
823{
824 numOfTauPlus = 0;
825 numOfTauMinus = 0;
826 idOfTauPlus = 0;
827 idOfTauMinus = 0;
828 for (int i = 0; i < MCParticles.getEntries(); i++) {
829 MCParticle& p = *MCParticles[i];
830
831 if (p.getStatus() == 1 && p.getPDG() == 15) {
833 idOfTauMinus = p.getIndex();
834 }
835 if (p.getStatus() == 1 && p.getPDG() == -15) {
836 numOfTauPlus++;
837 idOfTauPlus = p.getIndex();
838 }
839 }
840 if (numOfTauPlus == 1 && numOfTauMinus == 1) {
841 tauPair = true;
842 } else tauPair = false;
843}
844
845//
847{
848 int ret = 0;
849 const vector<MCParticle*> daughters = p.getDaughters();
850 if (daughters.empty()) return ret;
851 for (MCParticle* d : daughters) {
852 if (!d->hasStatus(MCParticle::c_PrimaryParticle)) continue;
853 // TODO: Improve how to identify a final state particle.
854 bool isChargedFinalState = find(begin(finalStatePDGs),
855 end(finalStatePDGs),
856 abs(d->getPDG())) != end(finalStatePDGs);
857 if (isChargedFinalState) ret++;
858 else ret += getProngOfDecay(*d);
859 }
860 return ret;
861}
862
863// Energy of the radiative photon in tau rest frame
864double TauDecayModeModule::getEgstar(const std::vector<int>& vec_radgam, const MCParticle& p)
865{
866 double egstar = -1.;
867 ROOT::Math::PxPyPzEVector p4_tau = p.get4Vector();
868 B2DEBUG(19, "p4_tau: " << p4_tau << " " << p4_tau.P());
869 ROOT::Math::Boost boost_to_mother_rest_frame(p4_tau.BoostToCM());
870 for (auto i : vec_radgam) {
871 ROOT::Math::PxPyPzEVector p4_gamma = MCParticles[i]->get4Vector();
872 B2DEBUG(19, "p4_gamma: " << p4_gamma << " " << p4_gamma.P());
873 ROOT::Math::PxPyPzEVector p4_gamma_rest = boost_to_mother_rest_frame * p4_gamma;
874 B2DEBUG(19, "p4_gamma_rest: " << p4_gamma_rest << " " << p4_gamma_rest.P());
875 double energy_rest = p4_gamma_rest.E();
876 if (energy_rest > egstar) egstar = energy_rest;
877 }
878 B2DEBUG(19, "egstar: " << egstar);
879 return egstar;
880}
int getPDGCode() const
PDG code.
Definition: Const.h:473
static const ParticleType pi0
neutral pion particle
Definition: Const.h:674
static const ChargedStable muon
muon particle
Definition: Const.h:660
static const ChargedStable pion
charged pion particle
Definition: Const.h:661
static const ParticleType Klong
K^0_L particle.
Definition: Const.h:678
static const ParticleType photon
photon particle
Definition: Const.h:673
static const ChargedStable electron
electron particle
Definition: Const.h:659
Replacement for TDatabasePDG that is filled from EvtGen's evt.pdl.
static EvtGenDatabasePDG * Instance()
Instance method that loads the EvtGen table.
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
@ c_IsPHOTOSPhoton
bit 8: Particle is an radiative photon from PHOTOS
Definition: MCParticle.h:63
@ c_PrimaryParticle
bit 0: Particle is primary particle.
Definition: MCParticle.h:47
std::vector< Belle2::MCParticle * > getDaughters() const
Get vector of all daughter particles, empty vector if none.
Definition: MCParticle.cc:52
int getPDG() const
Return PDG code of particle.
Definition: MCParticle.h:101
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 getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
std::vector< int > vec_numu
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_em
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_omega
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_k0s
Variable name of the vector where particles identified in the event are stored.
Int_t m_mprong
Prong of the decay channel of tau-.
std::vector< int > vec_b1p
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_f1
Variable name of the vector where particles identified in the event are stored.
int numOfTauPlus
Number of tau+ in the event.
Int_t m_pprong
Prong of the decay channel of tau+.
StoreObjPtr< EventMetaData > m_event_metadata
event number
void IdentifyTauPair()
Identifies if the event is a generated tau pair.
std::vector< int > vec_apro
Variable name of the vector where particles identified in the event are stored.
double getEgstar(const std::vector< int > &vec_radgam, const MCParticle &mc)
Energy of the radiative photon in tau rest frame.
std::vector< int > vec_pi0
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_alpha
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_radgam_taum
Variable name of the vector where particles identified in the event are stored.
StoreArray< MCParticle > MCParticles
StoreArray of MCParticles.
std::vector< int > vec_anue
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_nue
Variable name of the vector where particles identified in the event are stored.
virtual void initialize() override
Initializes the module.
std::vector< int > vec_a0p_980
Variable name of the vector where particles identified in the event are stored.
std::string m_file_plus
Alternative mapping for tau+.
std::vector< int > vec_a0m_1450
Variable name of the vector where particles identified in the event are stored.
virtual void event() override
Method is called for each event.
bool m_isEtaPizPizPizFromTauMinus
Flag for eta->pi0pi0pi0 decays from tau-.
double m_pegstar
Energy of radiative photon from tau+.
std::vector< int > vec_lmb_br
Variable name of the vector where particles identified in the event are stored.
Int_t m_mmode
ID of the decay channel of tau-.
void AnalyzeTauPairEvent()
Analyze a generated tau pair event.
bool m_isOmegaPimPipFromTauMinus
Flag for omega->pi-pi+ decays from tau-.
int getRecursiveMotherCharge(const MCParticle *mc)
Identifies particles coming from tau decays.
std::vector< int > vec_phi
Variable name of the vector where particles identified in the event are stored.
static constexpr int Neutrinos[3]
PDG codes of neutrinos in final state particles in generation: {nu_e, nu_mu, mu_tau}.
int m_taum_no
number of tau- unclassified events
std::string m_tauminusdecaymode
Variable name for the decay mode of the tau-.
std::vector< int > vec_a1p
Variable name of the vector where particles identified in the event are stored.
bool m_isOmegaPimPipFromTauPlus
Flag for omega->pi-pi+ decays from tau+.
bool tauPair
Boolean variable used to identify tau event.
int TauolaBelle2DecayMode(const std::string &s, int chg)
Classifies the decays of the event and assigns a decay mode.
int idOfTauMinus
Index of the generated tau-.
std::vector< int > vec_lambda
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_anut
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_f0
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_mum
Variable name of the vector where particles identified in the event are stored.
Int_t m_pmode
ID of the decay channel of tau+.
static constexpr int OrderedList[46]
PDG codes of ORDERED particles.
int numOfTauMinus
Number of tau- in the event.
std::vector< int > vec_nut
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_kstar0_br
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_radgam_taup
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_a00_1450
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_kstar0
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_a0m_980
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_a00_980
Variable name of the vector where particles identified in the event are stored.
int getProngOfDecay(const MCParticle &mc)
Identifies the number of charged final state particles in the decay.
std::vector< int > vec_a1m
Variable name of the vector where particles identified in the event are stored.
int idOfTauPlus
Index of the generated tau+.
StoreObjPtr< TauPairDecay > m_tauDecay
pointer to tau pair decay objects
std::vector< int > vec_rhop
Variable name of the vector where particles identified in the event are stored.
std::string m_printmode
Parameter passed by the user to indicated the informationt to be printed.
std::vector< int > vec_pro
Variable name of the vector where particles identified in the event are stored.
bool m_isEtaPizPizPizFromTauPlus
Flag for eta->pi0pi0pi0 decays from tau+.
std::string m_tauplusdecaymode
Variable name for the decay mode of the tau+.
std::vector< int > vec_pim
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_mup
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_pip
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_kstarp
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_kstarm
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_etapr
Variable name of the vector where particles identified in the event are stored.
double m_megstar
Energy of radiative photon from tau-.
std::vector< int > vec_ep
Variable name of the vector where particles identified in the event are stored.
TauDecayModeModule()
Constructor: Sets the description, the properties and the parameters of the module.
std::vector< int > vec_k0l
Variable name of the vector where particles identified in the event are stored.
static constexpr int finalStatePDGs[5]
PDG codes accepted as charged final state particles in generation: {e, mu, pi, K, p}.
std::vector< int > vec_eta
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_km
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_anumu
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_dau_tauplus
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_rhom
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_gam
Variable name of the vector where particles identified in the event are stored.
std::string m_file_minus
Alternative mapping for tau-.
int m_taup_no
number of tau+ unclassified events
std::vector< int > vec_dau_tauminus
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_kp
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_b1m
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_rho0
Variable name of the vector where particles identified in the event are stored.
std::map< std::string, int > mode_decay_minus
Mapping for tau- decays.
std::map< std::string, int > mode_decay_plus
Mapping for tau+ decays.
std::vector< int > vec_a0p_1450
Variable name of the vector where particles identified in the event are stored.
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.