155 map<int, std::vector<int>> map_vec;
157 11, -11, 12, -12, 13, -13, 14, -14,
158 16, -16, -211, 211, -321, 321, -2212, 2212,
159 111, 310, 130, 221, 223, 331, 333, -213,
160 213, 113, -323, 323, 313, -313, -20213, 20213,
161 -9000211, 9000211, 9000111, -10211, 10211, 10111, -10213, 10213,
162 20223, 9010221, 3122, -3122, 94144, 22
166 bool TauMinusIsLeptonicDecay =
false;
167 bool TauPlusIsLeptonicDecay =
false;
169 bool elecFirst =
true;
170 bool muonFirst =
true;
172 bool isPiPizGamTauMinusFirst =
true;
173 bool isPiPizGamTauPlusFirst =
true;
175 bool isPiGamTauMinusFirst =
true;
176 bool isPiGamTauPlusFirst =
true;
178 bool isLFVTauMinus2BodyDecayFirst =
true;
179 bool isLFVTauPlus2BodyDecayFirst =
true;
181 bool isChargedRhoFromTauMinusFirst =
true;
182 bool isChargedRhoFromTauPlusFirst =
true;
184 bool isChargedA1FromTauMinusFirst =
true;
185 bool isChargedA1FromTauPlusFirst =
true;
187 bool isEtaPPGFromTauMinusFirst =
true;
188 bool isEtaPPGFromTauPlusFirst =
true;
190 bool isOmegaPizGamFromTauMinusFirst =
true;
191 bool isOmegaPizGamFromTauPlusFirst =
true;
193 bool isEtaPizPizPizFromTauMinusFirst =
true;
194 bool isEtaPizPizPizFromTauPlusFirst =
true;
199 bool isOmegaPimPipFromTauMinusFirst =
true;
200 bool isOmegaPimPipFromTauPlusFirst =
true;
206 for (
int i = 0; i <
MCParticles.getEntries(); i++) {
210 int pdgid = p.getPDG();
212 if (pdgid == -
Const::Klong.getPDGCode()) pdgid = -pdgid;
215 bool accept_photon =
false;
219 if (p.isInitial())
continue;
222 if (abs(pdgid) == 12 || abs(pdgid) == 14) {
223 int leptonicdecay = 0;
225 const vector<MCParticle*> daughters = mother->
getDaughters();
227 int dauid = abs(d->getPDG());
228 if (dauid == 11 || dauid == 12 || dauid == 13 || dauid == 14 || dauid == 16) {
232 if (leptonicdecay == 3) {
233 if (mother->
getPDG() == 15) TauMinusIsLeptonicDecay =
true;
234 if (mother->
getPDG() == -15) TauPlusIsLeptonicDecay =
true;
241 if (not mother)
continue;
242 const vector<MCParticle*> daughters = mother->
getDaughters();
245 stringstream elec_ss;
248 elec_ss << d->getPDG() <<
" ";
252 if (nElMinus == 1 && nElPlus == 1) {
253 B2DEBUG(19,
"Mother of elec pair is = " << mother->
getPDG() <<
" which has daughters : " << elec_ss.str());
257 else if (pdgid ==
Const::muon.getPDGCode() && muonFirst) {
260 if (not mother)
continue;
261 const vector<MCParticle*> daughters = mother->
getDaughters();
264 stringstream muon_ss;
267 muon_ss << d->getPDG() <<
" ";
268 if (d->getPDG() ==
Const::muon.getPDGCode()) nMuMinus++;
269 if (d->getPDG() == -
Const::muon.getPDGCode()) nMuPlus++;
271 if (nMuMinus == 1 && nMuPlus == 1) {
272 B2DEBUG(19,
"Mother of muon pair is = " << mother->
getPDG() <<
" which has daughters : " << muon_ss.str());
286 if (not mother)
continue;
287 int mothid = abs(mother->
getPDG());
290 bool isRadiationfromFinalStateChargedParticle =
false;
297 isRadiationfromFinalStateChargedParticle =
true;
301 bool isRadiationFromChargedRho =
false;
304 if (chg < 0 && isChargedRhoFromTauMinusFirst) {
305 isChargedRhoFromTauMinusFirst =
false;
306 isRadiationFromChargedRho =
true;
308 if (chg > 0 && isChargedRhoFromTauPlusFirst) {
309 isChargedRhoFromTauPlusFirst =
false;
310 isRadiationFromChargedRho =
true;
315 bool isRadiationFromChargedA1 =
false;
316 if (mothid == 20213) {
318 if (chg < 0 && isChargedA1FromTauMinusFirst) {
319 isChargedA1FromTauMinusFirst =
false;
320 isRadiationFromChargedA1 =
true;
322 if (chg > 0 && isChargedA1FromTauPlusFirst) {
323 isChargedA1FromTauPlusFirst =
false;
324 isRadiationFromChargedA1 =
true;
329 bool isRadiationfromIntermediateWBoson =
false;
330 if (mothid == 24) isRadiationfromIntermediateWBoson =
true;
335 bool isPiPizGam =
false;
336 bool isPiGam =
false;
337 if (isRadiationfromIntermediateWBoson) {
338 const vector<MCParticle*> daughters = mother->
getDaughters();
342 int nOtherSisters = 0;
346 if (abs(d->getPDG()) ==
Const::pion.getPDGCode()) {
348 }
else if (abs(d->getPDG()) ==
Const::pi0.getPDGCode()) {
355 if (nTotSisters >= 3 && nPiSisters == 1 && nPizSisters == 1 && nOtherSisters == 0) {
357 if (chg < 0 && isPiPizGamTauMinusFirst) {
358 isPiPizGamTauMinusFirst =
false;
361 if (chg > 0 && isPiPizGamTauPlusFirst) {
362 isPiPizGamTauPlusFirst =
false;
365 }
else if (nTotSisters >= 2 && nPiSisters == 1 && nPizSisters == 0 && nOtherSisters == 0) {
367 if (chg < 0 && isPiGamTauMinusFirst) {
368 isPiGamTauMinusFirst =
false;
371 if (chg > 0 && isPiGamTauPlusFirst) {
372 isPiGamTauPlusFirst =
false;
379 bool isRadiationfromTau =
false;
380 if (mothid == 15) isRadiationfromTau =
true;
383 if (isRadiationfromTau) {
390 bool isLFVTau2BodyDecay =
false;
391 if (isRadiationfromTau) {
392 bool hasNeutrinoAsSister =
false;
393 int numChargedSister = 0;
394 int numNeutralNonNeutrinoNonPhotonSister = 0;
395 const vector<MCParticle*> daughters = mother->
getDaughters();
399 if (hasNeutrinoAsSister)
break;
401 if (!hasNeutrinoAsSister) {
405 if (isChargedFinalState) {
408 numNeutralNonNeutrinoNonPhotonSister++;
411 if (numChargedSister == 1 && numNeutralNonNeutrinoNonPhotonSister == 0) {
412 if (mother->
getPDG() == 15 && isLFVTauMinus2BodyDecayFirst) {
413 isLFVTauMinus2BodyDecayFirst =
false;
414 isLFVTau2BodyDecay =
true;
416 if (mother->
getPDG() == -15 && isLFVTauPlus2BodyDecayFirst) {
417 isLFVTauPlus2BodyDecayFirst =
false;
418 isLFVTau2BodyDecay =
true;
422 B2DEBUG(19,
"hasNeutrinoAsSister = " << hasNeutrinoAsSister
423 <<
" numChargedSister = " << numChargedSister
424 <<
" numNeutralNonNeutrinoNonPhotonSister = " << numNeutralNonNeutrinoNonPhotonSister
425 <<
" isLFVTau2BodyDecay = " << isLFVTau2BodyDecay);
428 bool isPi0GG =
false;
429 bool isEtaGG =
false;
430 bool isEtpGG =
false;
431 bool isPi0GEE =
false;
432 bool isEtaPPG =
false;
433 bool isOmPizG =
false;
434 if (mothid == 111 || mothid == 221 || mothid == 331 || mothid == 223) {
435 const vector<MCParticle*> daughters = mother->
getDaughters();
436 int numberofTotalDaughters = 0;
437 int numberOfPhotonDaughters = 0;
438 int numberOfElectronDaughters = 0;
439 int numberOfPionDaughters = 0;
440 int numberOfPizDaughters = 0;
443 numberofTotalDaughters ++;
444 if (abs(d->getPDG()) ==
Const::photon.getPDGCode()) numberOfPhotonDaughters++;
445 if (abs(d->getPDG()) ==
Const::electron.getPDGCode()) numberOfElectronDaughters++;
446 if (abs(d->getPDG()) ==
Const::pion.getPDGCode()) numberOfPionDaughters++;
447 if (abs(d->getPDG()) ==
Const::pi0.getPDGCode()) numberOfPizDaughters++;
449 if (numberofTotalDaughters == 2 && numberOfPhotonDaughters == 2) {
450 if (mothid ==
Const::pi0.getPDGCode()) isPi0GG =
true;
451 if (mothid == 221) isEtaGG =
true;
452 if (mothid == 331) isEtpGG =
true;
454 if (numberofTotalDaughters >= 3 && numberOfPhotonDaughters >= 1 && numberOfElectronDaughters == 2 && numberOfPionDaughters == 0
455 && numberOfPizDaughters == 0) {
456 if (mothid ==
Const::pi0.getPDGCode()) isPi0GEE =
true;
458 if (numberofTotalDaughters >= 3 && numberOfPhotonDaughters >= 1 && numberOfPizDaughters == 0 && numberOfPionDaughters == 2) {
461 if (chg < 0 && isEtaPPGFromTauMinusFirst) {
462 isEtaPPGFromTauMinusFirst =
false;
465 if (chg > 0 && isEtaPPGFromTauPlusFirst) {
466 isEtaPPGFromTauPlusFirst =
false;
471 if (numberofTotalDaughters >= 2 && numberOfPhotonDaughters >= 1 && numberOfPizDaughters == 1 && numberOfPionDaughters == 0) {
474 if (chg < 0 && isOmegaPizGamFromTauMinusFirst) {
475 isOmegaPizGamFromTauMinusFirst =
false;
478 if (chg > 0 && isOmegaPizGamFromTauPlusFirst) {
479 isOmegaPizGamFromTauPlusFirst =
false;
486 B2DEBUG(19,
"isRadiationfromFinalStateChargedParticle = " << isRadiationfromFinalStateChargedParticle);
487 B2DEBUG(19,
"isRadiationFromChargedRho = " << isRadiationFromChargedRho);
488 B2DEBUG(19,
"isRadiationFromChargedA1 = " << isRadiationFromChargedA1);
489 B2DEBUG(19,
"isRadiationfromIntermediateWBoson = " << isRadiationfromIntermediateWBoson <<
" isPiPizGam = " << isPiPizGam <<
490 " isPiGam = " << isPiGam);
491 B2DEBUG(19,
"isRadiationfromTau = " << isRadiationfromTau <<
" isLFVTau2BodyDecay = " << isLFVTau2BodyDecay);
492 B2DEBUG(19,
"isPi0GG = " << isPi0GG <<
" isEtaGG = " << isEtaGG <<
" isEtpGG = " << isEtpGG <<
" isPi0GEE = " << isPi0GEE);
493 B2DEBUG(19,
"isEtaPPG = " << isEtaPPG <<
" isOmPizG = " << isOmPizG);
499 if (isRadiationfromFinalStateChargedParticle) {
500 }
else if (isRadiationFromChargedRho) {
501 accept_photon =
true;
502 }
else if (isRadiationFromChargedA1) {
503 accept_photon =
true;
504 }
else if (isRadiationfromIntermediateWBoson) {
505 if (isPiPizGam || isPiGam) {
506 accept_photon =
true;
508 }
else if (isRadiationfromTau) {
509 if (isLFVTau2BodyDecay) {
510 accept_photon =
true;
512 }
else if (isPi0GG) {
513 }
else if (isEtaGG) {
514 }
else if (isEtpGG) {
515 }
else if (isPi0GEE) {
516 }
else if (isEtaPPG) {
517 accept_photon =
true;
518 }
else if (isOmPizG) {
519 accept_photon =
true;
527 else if (pdgid ==
Const::pi0.getPDGCode() && (isEtaPizPizPizFromTauMinusFirst || isEtaPizPizPizFromTauPlusFirst)) {
530 if (mother and (mother->
getPDG() == 221)) {
531 const vector<MCParticle*> daughters = mother->
getDaughters();
535 if (d->getPDG() ==
Const::pi0.getPDGCode()) nPizSisters++;
537 B2DEBUG(19,
"nPizSisters = " << nPizSisters);
538 if (nPizSisters == 3) {
540 if (chg < 0 && isEtaPizPizPizFromTauMinusFirst) {
541 isEtaPizPizPizFromTauMinusFirst =
false;
544 if (chg > 0 && isEtaPizPizPizFromTauPlusFirst) {
545 isEtaPizPizPizFromTauPlusFirst =
false;
565 else if (pdgid == -
Const::pion.getPDGCode() && (isOmegaPimPipFromTauMinusFirst || isOmegaPimPipFromTauPlusFirst)) {
568 if (mother and (mother->
getPDG() == 223)) {
569 const vector<MCParticle*> daughters = mother->
getDaughters();
570 int nOmegaDaughters = 0;
577 if (d->getPDG() == -
Const::pion.getPDGCode()) nPimSisters++;
578 if (d->getPDG() ==
Const::pion.getPDGCode()) nPipSisters++;
579 if (d->getPDG() ==
Const::pi0.getPDGCode()) nPizSisters++;
582 "nOmegaDaughters = " << nOmegaDaughters <<
" "
583 "nPimSisters = " << nPimSisters <<
" "
584 "nPipSisters = " << nPipSisters <<
" "
585 "nPizSisters = " << nPizSisters);
586 if (nOmegaDaughters >= 2 && nPimSisters == 1 && nPipSisters == 1 && nPizSisters == 0) {
588 if (chg < 0 && isOmegaPimPipFromTauMinusFirst) {
589 isOmegaPimPipFromTauMinusFirst =
false;
592 if (chg > 0 && isOmegaPimPipFromTauPlusFirst) {
593 isOmegaPimPipFromTauPlusFirst =
false;
600 "isEtaPizPizPizFromTauMinusFirst = " << isEtaPizPizPizFromTauMinusFirst <<
" "
602 "isEtaPizPizPizFromTauPlusFirst = " << isEtaPizPizPizFromTauPlusFirst <<
" "
606 "isOmegaPimPipFromTauMinusFirst = " << isOmegaPimPipFromTauMinusFirst <<
" "
608 "isOmegaPimPipFromTauPlusFirst = " << isOmegaPimPipFromTauPlusFirst <<
" "
613 map<int, std::vector<int>>::iterator ite ;
614 for (ite = map_vec.begin(); ite != map_vec.end(); ++ite) {
615 if (pdgid == ite->first) {
618 B2DEBUG(19,
"Photon accepted");
619 ite-> second.push_back(i);
622 ite-> second.push_back(i);
633 map<int, std::vector<int>>::iterator itr ;
634 for (itr = map_vec.begin(); itr != map_vec.end(); ++itr) {
635 for (
unsigned int i = 0; i < itr-> second.size(); i++) {
636 int ii = itr-> second[i];
648 for (
unsigned iorder = 0; iorder <
OrderedList.size(); ++iorder) {
653 int pdg = p->getPDG();
655 if (pdg != ii)
continue;
660 pdgname = databasePDG->GetParticle(pdg)->GetName();
670 for (
unsigned iorder = 0; iorder <
OrderedList.size(); ++iorder) {
675 int pdg = p->getPDG();
677 if (pdg != ii)
continue;
682 pdgname = databasePDG->GetParticle(pdg)->GetName();