20 #include "GaudiKernel/MsgStream.h"
21 #include "GaudiKernel/ITHistSvc.h"
51 const std::string &
name,
63 m_muonSelectionTool(
"CP::MuonSelectionTool/MuonSelectionTool"),
64 m_isolationSelectionTool(
"CP::IsolationSelectionTool/IsolationSelectionTool"),
65 m_Jpsi_mm_trigger{
"CATEGORY_primary_bphys"},
66 m_Z_mm_trigger{
"CATEGORY_monitoring_muonIso",
"CATEGORY_monitoring_muonNonIso"},
67 m_Z_ee_trigger{
"CATEGORY_primary_single_ele"}
72 m_path =
"GLOBAL/DQTGlobalWZFinder";
98 m_livetime_lb =
nullptr;
99 m_lblength_lb =
nullptr;
101 m_Z_ee_trig_ps =
nullptr;
102 m_Z_mm_trig_ps =
nullptr;
134 std::string fullPathDQTGlobalWZFinder=
m_path;
137 const EventContext& ctx = Gaudi::Hive::currentContext();
139 if(! thisEventInfo.
isValid()) {
141 return StatusCode::FAILURE;
160 return (failure ? StatusCode::FAILURE : StatusCode::SUCCESS);
195 if (failure) {
return StatusCode::FAILURE;}
196 else {
return StatusCode::SUCCESS;}
209 std::string fullPathDQTGlobalWZFinder=
m_path;
215 failure = failure |
registerHist(fullPathDQTGlobalWZFinder,
m_W_pt_v_met_mu =
TH2F_LW::create(
"m_W_pt_v_met_mu",
"W#rightarrow#mu#nu #mu p_{T} vs met ",100,5*1000,200*1000, 100, 5*1000, 200*1000)).isFailure();
243 log << MSG::ERROR <<
"Error Booking histograms " <<
endmsg;
262 if(! thisEventInfo.
isValid()) {
264 return StatusCode::FAILURE;
270 Float_t evtWeight = 1;
278 Double_t phiMet = 0, metMet = 0;
282 missET = (*missETcont)[
"FinalClus"];
287 phiMet = missET->
phi();
288 metMet = missET->
met();
295 ATH_MSG_DEBUG(
" MET = " << metMet <<
" and met phi = " << phiMet);
303 return StatusCode::FAILURE;
314 return StatusCode::FAILURE;
319 std::vector<const xAOD::Electron*> goodelectrons;
320 std::vector<const xAOD::Muon*> goodmuonsZ;
321 std::vector<CLHEP::HepLorentzVector> goodmuonsJPsi;
322 std::vector<Int_t> goodmuonJPsicharge;
331 for (; vxItr != vxItrE; ++vxItr) {
365 bool passSel =
false;
366 if (!((*itr)->passSelection(passSel,
"LHLoose")))
ATH_MSG_WARNING(
"Electron ID WP Not Defined");
367 auto elTrk = (*itr)->trackParticle();
397 ((*itr)->caloCluster()->etaBE(2) < 2.47) &&
402 fabs((elTrk->z0()+elTrk->vz()-pVtx->
z())*
std::sin(elTrk->theta())) < 0.5*
mm &&
411 goodelectrons.push_back(*itr);
422 for (
const auto muonItr : *muons) {
423 Float_t minptCutJPsi(1.0*
GeV);
424 auto muTrk = (muonItr)->primaryTrackParticle();
449 ATH_MSG_DEBUG(
"Muon z0sinth: " << fabs((muTrk->z0()+muTrk->vz()-pVtx->
z())*
std::sin(muTrk->theta())) <<
" " << 0.5*
mm);
457 fabs((muTrk->z0()+muTrk->vz()-pVtx->
z())*
std::sin(muTrk->theta())) < 0.5*
mm &&
465 goodmuonsZ.push_back(muonItr);
467 if ( ((muonItr)->
pt() > minptCutJPsi) ) {
470 Float_t
px = (muonItr)->p4().Px();
471 Float_t
py = (muonItr)->p4().Py();
472 Float_t
pz = (muonItr)->p4().Pz();
473 Float_t
e = (muonItr)->p4().E();
476 CLHEP::HepLorentzVector thislepton;
477 thislepton.setPx(
px);
478 thislepton.setPy(
py);
479 thislepton.setPz(
pz);
481 goodmuonsJPsi.push_back(thislepton);
482 goodmuonJPsicharge.push_back(
charge);
494 if ((El_N + MuZ_N + MuJPsi_N) < 1)
return sc;
503 CLHEP::HepLorentzVector leadingMuJPsi;
504 CLHEP::HepLorentzVector subleadingMuJPsi;
506 leadingMuJPsi.setPerp(0);
507 subleadingMuJPsi.setPerp(0);
509 Int_t leadingMuJPsicharge = 0;
510 Int_t subleadingMuJPsicharge = 0;
514 for (UInt_t iEle = 0; iEle < goodelectrons.size(); iEle++) {
515 Float_t
pt = goodelectrons[iEle]->pt();
517 if (! leadingEle ||
pt > leadingEle->
pt()) {
518 subleadingEle = leadingEle;
519 leadingEle = goodelectrons[iEle];
521 else if (! subleadingEle ||
pt > subleadingEle->
pt()) {
522 subleadingEle = goodelectrons[iEle];
527 for (UInt_t iMu = 0; iMu < goodmuonsZ.size(); iMu++) {
528 Float_t
pt = goodmuonsZ[iMu]->pt();
529 if (! leadingMuZ ||
pt > leadingMuZ->
pt()) {
530 subleadingMuZ = leadingMuZ;
531 leadingMuZ = goodmuonsZ[iMu];
533 else if (! subleadingMuZ ||
pt > subleadingMuZ->
pt()) {
534 subleadingMuZ = goodmuonsZ[iMu];
539 for (UInt_t iMu = 0; iMu < goodmuonsJPsi.size(); iMu++) {
540 Float_t
pt = goodmuonsJPsi[iMu].perp();
541 if (
pt > leadingMuJPsi.perp()) {
542 subleadingMuJPsi = leadingMuJPsi;
543 subleadingMuJPsicharge = leadingMuJPsicharge;
544 leadingMuJPsi = goodmuonsJPsi[iMu];
545 leadingMuJPsicharge = goodmuonJPsicharge[iMu];
547 else if (
pt > subleadingMuJPsi.perp()) {
548 subleadingMuJPsi = goodmuonsJPsi[iMu];
549 subleadingMuJPsicharge = goodmuonJPsicharge[iMu];
562 bool isZee = (goodelectrons.size() > 1);
563 bool isZmumu = (goodmuonsZ.size() > 1);
564 bool isJPsimumu = (goodmuonsJPsi.size() > 1);
569 TLorentzVector Zee = (leadingEle->
p4() + subleadingEle->
p4());
570 Float_t
mass = Zee.M();
571 Int_t Zeecharge = leadingEle->
charge() + subleadingEle->
charge();
575 ATH_MSG_DEBUG(
"Found a Z to ee candidate! Mass = " <<
mass <<
", and charge = " << Zeecharge );
576 if (Zeecharge == 0) {
588 TLorentzVector Zmumu = leadingMuZ->
p4() + subleadingMuZ->
p4();
589 Float_t
mass = Zmumu.M();
590 Int_t Zmumucharge = leadingMuZ->
charge() + subleadingMuZ->
charge();
594 ATH_MSG_DEBUG(
"Found a Z to mumu candidate! Mass = " <<
mass <<
", and charge = " << Zmumucharge);
595 if (Zmumucharge == 0) {
609 CLHEP::HepLorentzVector JPsimumu = leadingMuJPsi + subleadingMuJPsi;
610 Float_t
mass = JPsimumu.m();
611 Int_t JPsimumucharge = leadingMuJPsicharge + subleadingMuJPsicharge;
614 if (JPsimumucharge == 0) {
662 ATH_MSG_DEBUG(
"Found a JPsi/Upsilon to mumu candidate! Mass = " <<
mass <<
", and charge = " << JPsimumucharge);
667 Float_t metx = metMet*
cos(phiMet);
668 Float_t mety = metMet*
sin(phiMet);
669 Float_t mtCut = 40*
GeV;
671 bool isWenu = ((goodelectrons.size() > 0) && (metMet >
m_metCut*
GeV) && !isZee);
672 bool isWmunu = ((goodmuonsZ.size() > 0) && (metMet >
m_metCut*
GeV) && !isZmumu);
677 Float_t
px = leadingEle->
p4().Px();
678 Float_t
py = leadingEle->
p4().Py();
679 Float_t
pz = leadingEle->
p4().Pz();
681 Float_t
et = leadingEle->
e()*leadingEle->
pt()/
p;
682 Float_t mt = sqrt(2*(
et*metMet-
px*metx-
py*mety));
688 ATH_MSG_DEBUG(
"Found a W to enu candidate! M_T = " << mt <<
", and MET = " << metMet <<
", and ele_pt = " << leadingEle->
pt());
694 Float_t
px = leadingMuZ->
p4().Px();
695 Float_t
py = leadingMuZ->
p4().Py();
696 Float_t
pz = leadingMuZ->
p4().Pz();
698 Float_t
et = leadingMuZ->
e()*leadingMuZ->
pt()/
p;
699 Float_t mt = sqrt(2*(
et*metMet-
px*metx-
py*mety));
705 ATH_MSG_DEBUG(
"Found a W to munu candidate! M_T = " << mt <<
", and MET = " << metMet <<
", and mu_pt = " << leadingMuZ->
pt());
713 return StatusCode::SUCCESS;
794 return StatusCode::SUCCESS;
805 return StatusCode::SUCCESS;