45 using namespace isodeposit;
63 void endJob()
override;
77 double etamin_, etamax_,
ptmin_, massMin_, massMax_, isoMax_;
79 double ptThreshold_, etEcalThreshold_, etHcalThreshold_, dRVetoTrk_, dRTrk_, dREcal_, dRHcal_, alpha_, beta_;
87 TH1D *h_trackProbe_eta, *
h_trackProbe_pt, *h_staProbe_eta, *h_staProbe_pt, *h_ProbeOk_eta, *h_ProbeOk_pt;
104 template <
typename T>
140 double isovalueTrk = (
trkIso->sumWithin(
dRTrk, vetosTrk));
145 alpha * (((1 +
beta) / 2 * isovalueEcal) + ((1 -
beta) / 2 * isovalueHcal)) + ((1 -
alpha) * isovalueTrk);
162 const pat::Muon*
mu = dynamic_cast<const pat::Muon*>(&*
c->masterClone());
189 <<
"Candidate daughter #0 is neither pat::Muons nor pat::GenericParticle\n";
218 bothMuons_(
pset.getParameter<
bool>(
"bothMuons")),
219 etamin_(
pset.getUntrackedParameter<double>(
"etamin")),
220 etamax_(
pset.getUntrackedParameter<double>(
"etamax")),
221 ptmin_(
pset.getUntrackedParameter<double>(
"ptmin")),
222 massMin_(
pset.getUntrackedParameter<double>(
"zMassMin")),
223 massMax_(
pset.getUntrackedParameter<double>(
"zMassMax")),
224 isoMax_(
pset.getUntrackedParameter<double>(
"isomax")),
225 ptThreshold_(
pset.getUntrackedParameter<double>(
"ptThreshold")),
226 etEcalThreshold_(
pset.getUntrackedParameter<double>(
"etEcalThreshold")),
227 etHcalThreshold_(
pset.getUntrackedParameter<double>(
"etHcalThreshold")),
228 dRVetoTrk_(
pset.getUntrackedParameter<double>(
"deltaRVetoTrk")),
229 dRTrk_(
pset.getUntrackedParameter<double>(
"deltaRTrk")),
230 dREcal_(
pset.getUntrackedParameter<double>(
"deltaREcal")),
231 dRHcal_(
pset.getUntrackedParameter<double>(
"deltaRHcal")),
232 alpha_(
pset.getUntrackedParameter<double>(
"alpha")),
233 beta_(
pset.getUntrackedParameter<double>(
"beta")),
234 relativeIsolation_(
pset.getUntrackedParameter<
bool>(
"relativeIsolation")),
235 hltPath_(
pset.getUntrackedParameter<
std::
string>(
"hltPath")) {
239 double etaRange[8] = {-2.5, -2., -1.2, -0.8, 0.8, 1.2, 2., 2.5};
240 double ptRange[4] = {20., 40., 60., 100.};
293 bool zMuMu_found =
false;
296 if (!
zMuMu->empty()) {
298 for (
unsigned int i = 0;
i <
zMuMu->size(); ++
i) {
306 const pat::Muon& muonDau1 = dynamic_cast<const pat::Muon&>(*
lep1->masterClone());
342 bool trig0found =
false;
343 bool trig1found =
false;
344 if (!mu0HLTMatches.empty())
346 if (!mu1HLTMatches.empty())
355 (trig0found || trig1found)) {
364 if (trig0found && trig1found)
366 if (trig0found && !trig1found)
368 if (trig1found && !trig0found)
395 bool zMuSta_found =
false;
396 if (!zMuMu_found && !zMuStandAlone->
empty()) {
398 for (
unsigned int i = 0;
i < zMuStandAlone->
size(); ++
i) {
399 const Candidate& zMuStandAloneCand = (*zMuStandAlone)[
i];
401 GenParticleRef zMuStandAloneMatch = (*zMuStandAloneMatchMap)[zMuStandAloneCandRef];
433 double pt0 = zMuStandAloneCand.
daughter(0)->
pt();
435 double eta0 = zMuStandAloneCand.
daughter(0)->
eta();
437 double mass = zMuStandAloneCand.
mass();
442 bool trig0found =
false;
443 if (!mu0HLTMatches.empty())
462 if (!zMuMu_found && !zMuSta_found && !zMuTrack->
empty()) {
464 for (
unsigned int i = 0;
i < zMuTrack->
size(); ++
i) {
465 const Candidate& zMuTrackCand = (*zMuTrack)[
i];
505 bool trig0found =
false;
506 if (!mu0HLTMatches.empty())
509 GenParticleRef zMuTrackMatch = (*zMuTrackMatchMap)[zMuTrackCandRef];
527 int partId0 = dauGen0->
pdgId();
528 int partId1 = dauGen1->
pdgId();
529 int partId2 = dauGen2->
pdgId();
530 bool muplusFound =
false;
531 bool muminusFound =
false;
533 if (partId0 == 13 || partId1 == 13 || partId2 == 13)
535 if (partId0 == -13 || partId1 == -13 || partId2 == -13)
537 if (partId0 == 23 || partId1 == 23 || partId2 == 23)
539 return (muplusFound && muminusFound && ZFound);
546 int partId0 = dauGen0->
pdgId();
547 int partId1 = dauGen1->
pdgId();
548 int partId2 = dauGen2->
pdgId();
550 if (partId0 == ipart) {
553 if (dauMuGen->
pdgId() == ipart && dauMuGen->
status() == 1) {
554 ptpart = dauMuGen->
pt();
558 if (partId1 == ipart) {
561 if (dauMuGen->
pdgId() == ipart && dauMuGen->
status() == 1) {
562 ptpart = dauMuGen->
pt();
566 if (partId2 == ipart) {
570 ptpart = dauMuGen->
pt();
581 int partId0 = dauGen0->
pdgId();
582 int partId1 = dauGen1->
pdgId();
583 int partId2 = dauGen2->
pdgId();
585 if (partId0 == ipart) {
588 if (dauMuGen->
pdgId() == ipart && dauMuGen->
status() == 1) {
589 etapart = dauMuGen->
eta();
593 if (partId1 == ipart) {
596 if (dauMuGen->
pdgId() == ipart && dauMuGen->
status() == 1) {
597 etapart = dauMuGen->
eta();
601 if (partId2 == ipart) {
605 etapart = dauMuGen->
eta();
616 int partId0 = dauGen0->
pdgId();
617 int partId1 = dauGen1->
pdgId();
618 int partId2 = dauGen2->
pdgId();
620 if (partId0 == ipart) {
623 if (dauMuGen->
pdgId() == ipart && dauMuGen->
status() == 1) {
624 phipart = dauMuGen->
phi();
628 if (partId1 == ipart) {
631 if (dauMuGen->
pdgId() == ipart && dauMuGen->
status() == 1) {
632 phipart = dauMuGen->
phi();
636 if (partId2 == ipart) {
640 phipart = dauMuGen->
phi();
651 int partId0 = dauGen0->
pdgId();
652 int partId1 = dauGen1->
pdgId();
653 int partId2 = dauGen2->
pdgId();
655 if (partId0 == ipart) {
658 if (dauMuGen->
pdgId() == ipart && dauMuGen->
status() == 1) {
659 p4part = dauMuGen->
p4();
663 if (partId1 == ipart) {
666 if (dauMuGen->
pdgId() == ipart && dauMuGen->
status() == 1) {
667 p4part = dauMuGen->
p4();
671 if (partId2 == ipart) {
675 p4part = dauMuGen->
p4();
691 double effSta_afterIso =
693 double effTrk_afterIso =
697 double err_effHLT_afterIso =
sqrt(effHLT_afterIso * (1 - effHLT_afterIso) / nGLB_afterIso);
698 double err_effsta_afterIso =
sqrt(effSta_afterIso * (1 - effSta_afterIso) / n1_afterIso);
699 double err_efftrk_afterIso =
sqrt(effTrk_afterIso * (1 - effTrk_afterIso) / n2_afterIso);
701 cout <<
"------------------------------------ Counters --------------------------------" << endl;
708 cout <<
"=========================================" << endl;
714 cout <<
"n. of Z -> 2 global muons MC matched and passing ALL cuts and both triggered: "
716 cout <<
"=================================================================================" << endl;
717 cout <<
"Iso efficiency: " << eff_Iso <<
" +/- " << err_effIso << endl;
718 cout <<
"HLT efficiency: " << effHLT_afterIso <<
" +/- " << err_effHLT_afterIso << endl;
719 cout <<
"eff StandAlone (after Isocut) : " << effSta_afterIso <<
"+/-" << err_effsta_afterIso << endl;
720 cout <<
"eff Tracker (after Isocut) : " << effTrk_afterIso <<
"+/-" << err_efftrk_afterIso << endl;