27 #include "CLHEP/Vector/LorentzVector.h"
87 ATH_MSG_INFO(
" >>> xAODBSignalFilter::FilterEvent <<< ");
96 ATH_MSG_ERROR(
" ==>> 'B_PDGCode = 0'! Please define the PDGid of the B-meson/hadron signal!");
98 return StatusCode::FAILURE;
103 if (
evtStore()->
retrieve(xTruthParticleContainer,
"TruthGen").isFailure()) {
104 ATH_MSG_ERROR(
"No TruthParticle collection with name " <<
"TruthGen" <<
" found in StoreGate!");
105 return StatusCode::FAILURE;
108 bool acceptEvent =
true;
109 unsigned int nPart = xTruthParticleContainer->
size();
112 bool LVL1Passed =
false;
120 for (
unsigned int iPart = 0; iPart < nPart; ++iPart) {
135 bool LVL2Passed =
false;
139 for (
unsigned int iPart = 0; iPart < nPart; ++iPart) {
144 if (
part != LVL1Muon)
179 for (
unsigned int iPart = 0; iPart < nPart; ++iPart) {
190 bool SignalPassedCuts =
false;
191 if (LVL1Passed && LVL2Passed)
194 for (
unsigned int iPart = 0; iPart < nPart; ++iPart) {
196 const int particleID =
part->pdgId();
198 bool motherIsB =
false;
199 bool newBChain =
false;
209 for(
size_t thisParent_id=0; thisParent_id <
part->prodVtx()->nIncomingParticles(); thisParent_id++)
211 auto parent =
part->prodVtx()->incomingParticle(thisParent_id);
212 int parentID =
parent->pdgId();
233 const HepPDT::ParticleData *HadronData =
particleData(particleID);
234 std::string HadronName =
"unknown particle";
237 HadronName = HadronData->name();
239 HadronName =
"anti - " + HadronName;
242 ATH_MSG_DEBUG(
" ------------------------------------------ ");
243 ATH_MSG_DEBUG(
" *** xAODBSignalFilter.cxx: B-signal found *** ");
244 ATH_MSG_DEBUG(
" ------------------------------------------ ");
253 ATH_MSG_DEBUG(
" *** KINEMATIC CUTS ON PARTICLES ACTIVATED *** ");
260 bool isSignal =
false;
261 bool havePassedCuts =
true;
262 TLorentzVector CandPart1, CandPart2, total_4mom;
264 FindAllChildren(
part,
"",
false, isSignal, havePassedCuts, CandPart1, CandPart2,
false, total_4mom);
272 SignalPassedCuts = (isSignal && havePassedCuts);
278 if (SignalPassedCuts)
280 bool accept_mass =
false;
281 bool accept_total_mass =
false;
283 ATH_MSG_DEBUG(
" *** INVARIANT MASS CUTS ON PARTICLES ACTIVATED! *** ");
288 double invMass = (CandPart1 + CandPart2).M();
289 double invMass_total = total_4mom.M();
303 ATH_MSG_DEBUG(
" ==>> Event has NOT passed the mass filter!");
306 SignalPassedCuts = SignalPassedCuts && accept_mass;
310 ATH_MSG_DEBUG(
" -- Total invariant mass of the final-state particles = " << invMass_total <<
" MeV");
313 ATH_MSG_DEBUG(
" ==>> Event has passed the total mass filter!");
315 accept_total_mass =
true;
319 ATH_MSG_DEBUG(
" ==>> Event has NOT passed the total mass filter!");
322 SignalPassedCuts = SignalPassedCuts && accept_total_mass;
328 ATH_MSG_DEBUG(
" *** INVARIANT MASS CUTS ON PARTICLES NOT APPLIED (since the event is not a signal that passed cuts)! *** ");
334 ATH_MSG_DEBUG(
" *** INVARIANT MASS CUTS ON PARTICLES NOT ACTIVATED *** ");
340 SignalPassedCuts =
true;
342 ATH_MSG_DEBUG(
" *** KINEMATIC CUTS ON PARTICLES NOT ACTIVATED ==>> ACCEPT ALL EVENTS! *** ");
346 if (SignalPassedCuts)
350 if (SignalPassedCuts)
352 ATH_MSG_DEBUG(
" -->> All signal children have passed cuts on particles!");
356 ATH_MSG_DEBUG(
" -->> Signal children have NOT passed cuts on particles!");
367 if ((!LVL1Passed) || (!LVL2Passed))
375 acceptEvent = acceptEvent && SignalPassedCuts;
382 setFilterPassed(
false);
390 setFilterPassed(
true);
398 return StatusCode::SUCCESS;
403 return ((myPT >= testPT) && (std::abs(myEta) <= testEta));
409 int pID = child->
pdgId();
410 double myPT = child->
pt();
411 double myEta = child->
eta();
422 int pID = child->
pdgId();
423 double myPT = child->
pt();
424 double myEta = child->
eta();
435 bool fromFinalB,
bool &foundSignal,
bool &passedAllCuts,
436 TLorentzVector &p1, TLorentzVector &p2,
bool fromSelectedB, TLorentzVector &total_4mom)
const
438 int pID = mother->
pdgId();
442 bool hasChildGoodParent = fromFinalB && (fromSelectedB ||
m_B_pdgid == 0);
444 if (fromFinalB && hasChildGoodParent)
449 passedAllCuts = passedAllCuts && passedCut;
451 passedAllCuts = passedAllCuts && passedCut;
453 passedAllCuts = passedAllCuts && passedCut;
455 passedAllCuts = passedAllCuts && passedCut;
457 passedAllCuts = passedAllCuts && passedCut;
462 p1.SetPxPyPzE(mother->
px(), mother->
py(), mother->
pz(), mother->
e());
465 total_4mom = total_4mom + p1;
470 p2.SetPxPyPzE(mother->
px(), mother->
py(), mother->
pz(), mother->
e());
473 total_4mom = total_4mom + p2;
477 TLorentzVector current_4p;
478 current_4p.SetPxPyPzE(mother->
px(), mother->
py(), mother->
pz(), mother->
e());
479 total_4mom = total_4mom + current_4p;
489 ATH_MSG_DEBUG(
" Inconsistent entry in HepMC (status 2 particle not decayed), chain rejected!");
495 std::string childIDStr;
496 if (!(treeIDStr ==
""))
497 treeIDStr = treeIDStr +
".";
504 for(
size_t thisChild_id=0; thisChild_id < mother->
decayVtx()->nOutgoingParticles(); thisChild_id++)
507 pID = child->
pdgId();
514 for(
size_t thisChild_id=0; thisChild_id < mother->
decayVtx()->nOutgoingParticles(); thisChild_id++)
518 std::stringstream childCntSS;
519 childCntSS << childCnt;
520 childIDStr = treeIDStr + childCntSS.str();
522 FindAllChildren(child, childIDStr, fromFinalB, foundSignal, passedAllCuts, p1, p2, (pID ==
m_B_pdgid) || fromSelectedB, total_4mom);
534 int pID = child->
pdgId();
535 double myPT = child->
pt();
536 double myEta = child->
eta();
547 if (std::abs(pID) == 11)
553 ATH_MSG_DEBUG(
" ==>> Found an electron which passed the pT and eta cuts!");
563 ATH_MSG_DEBUG(
" ==>> The electron has NOT passed the pT and eta cuts!");
570 if (std::abs(pID) == 13)
576 ATH_MSG_DEBUG(
" ==>> Found a muon which passed the pT and eta cuts!");
586 ATH_MSG_DEBUG(
" ==>> The muon has NOT passed the pT and eta cuts!");
599 ATH_MSG_DEBUG(
" ==>> Found a charged hadron which passed the pT and eta cuts!");
609 ATH_MSG_DEBUG(
" ==>> The charged hadron has NOT passed the pT and eta cuts!");
616 if (std::abs(pID) == 22)
622 ATH_MSG_DEBUG(
" ==>> Found a gamma which passed the pT and eta cuts!");
632 ATH_MSG_DEBUG(
" ==>> The gamma has NOT passed the pT and eta cuts!");
639 if (std::abs(pID) == 311)
645 ATH_MSG_DEBUG(
" ==>> Found a K0 which passed the pT and eta cuts!");
655 ATH_MSG_DEBUG(
" ==>> The K0 has NOT passed the pT and eta cuts!");
665 const std::string &treeIDStr,
const bool fromFinalB)
const
667 int pID = child->
pdgId();
669 const HepPDT::ParticleData *pData =
particleData(std::abs(pID));
670 std::string pName =
"unknown particle";
673 pName = pData->name();
675 pName =
"anti - " + pName;
678 <<
"Child (" << pName
679 <<
") " << child <<
" , from final B = " << fromFinalB);
687 ATH_MSG_ALWAYS(
" I===============================================================================================");
689 ATH_MSG_ALWAYS(
" I===============================================================================================");
693 ATH_MSG_ALWAYS(
" I Muon pT cut " <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
"I" <<
'\t'
695 ATH_MSG_ALWAYS(
" I Muon pseudo-rapidity cut" <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
"I" <<
'\t'
697 ATH_MSG_ALWAYS(
" I No of events containing at least " <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
"I");
698 ATH_MSG_ALWAYS(
" I one particle satisfying these cuts " <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
"I" <<
'\t'
703 ATH_MSG_ALWAYS(
" I Muon pT cut " <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
"I" <<
'\t'
705 ATH_MSG_ALWAYS(
" I Muon pseudo-rapidity cut " <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
"I" <<
'\t'
712 ATH_MSG_ALWAYS(
" I Electron pseudo-rapidity cut " <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
"I"
717 ATH_MSG_ALWAYS(
" I No of events containing at least one muon satisfying LVL1 cut" <<
'\t' <<
"I");
718 ATH_MSG_ALWAYS(
" I and at least one separate particle passing these LVL2 cuts " <<
'\t' <<
'\t' <<
"I" <<
'\t'
722 ATH_MSG_ALWAYS(
" I Total no of input events " <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
"I" <<
'\t'
724 ATH_MSG_ALWAYS(
" I No of events rejected by trigger " <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
"I" <<
'\t'
726 ATH_MSG_ALWAYS(
" I No of events rejected in total " <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
'\t' <<
"I" <<
'\t'
729 ATH_MSG_ALWAYS(
" I To obtain correct cross section, multiply BX in PythiaB report by " <<
'\t' <<
'\t' <<
"I" <<
'\t'
732 ATH_MSG_ALWAYS(
" I To obtain correct cross section, multiply BX in PythiaB report by " <<
'\t' <<
'\t' <<
"I" <<
'\t'
737 ATH_MSG_ALWAYS(
" I=========================================== End of report =====================================");
739 return StatusCode::SUCCESS;