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>
129 vetosTrk.push_back(
new ConeVeto(dir, dRVetoTrk));
133 vetosEcal.push_back(
new ConeVeto(dir, 0.));
137 vetosHcal.push_back(
new ConeVeto(dir, 0.));
140 double isovalueTrk = (trkIso->
sumWithin(dRTrk, vetosTrk));
141 double isovalueEcal = (ecalIso->
sumWithin(dREcal, vetosEcal));
142 double isovalueHcal = (hcalIso->
sumWithin(dRHcal, vetosHcal));
145 alpha * (((1 +
beta) / 2 * isovalueEcal) + ((1 -
beta) / 2 * isovalueHcal)) + ((1 - alpha) * isovalueTrk);
146 if (relativeIsolation)
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) {
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;
707 cout <<
"number of events zMuMu with mu1 only triggered " << nMu1onlyTriggered << endl;
708 cout <<
"=========================================" << endl;
712 cout <<
"n. of ZMuSta MC matched and passing ALL cuts: " << nStaMuonsMatched_passedIso << endl;
713 cout <<
"n. of ZmuTrck MC matched and passing ALL cuts: " << nTracksMuonsMatched_passedIso << 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;
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
ZMuMu_MCanalyzer(const edm::ParameterSet &pset)
bool isNonnull() const
Checks for non-null.
double candidateIsolation(const reco::Candidate *c, double ptThreshold, double etEcalThreshold, double etHcalThreshold, double dRVetoTrk, double dRTrk, double dREcal, double dRHcal, double alpha, double beta, bool relativeIsolation)
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
int nGlobalMuonsMatched_passedIso
EDGetTokenT< CandidateView > zMuStandAloneToken_
EDGetTokenT< CandidateView > zMuMuToken_
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
float getParticlePhi(const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
T * make(const Args &...args) const
make new ROOT object
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
double sumWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
bool check_ifZmumu(const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
RefToBase< value_type > refAt(size_type i) const
virtual int status() const =0
status word
Analysis-level Generic Particle class (e.g. for hadron or muon not fully reconstructed) ...
#define DEFINE_FWK_MODULE(type)
EDGetTokenT< CandidateView > muonsToken_
EDGetTokenT< GenParticleMatch > zMuTrackMatchMapToken_
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
virtual int pdgId() const =0
PDG identifier.
int nTracksMuonsMatched_passedIso
reco::CandidateBaseRef trackMuonCandRef_
Abs< T >::type abs(const T &t)
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
EDGetTokenT< GenParticleCollection > genParticlesToken_
int nGlobalMuonsMatched_passed
int n2GlobalMuonsMatched_passedIso2Trg
virtual const CandidateBaseRef & masterClone() const =0
zMuMu
zMuMu vector of PSet is common to all categories except zMuTrk category
virtual double eta() const =0
momentum pseudorapidity
int nStaMuonsMatched_passedIso
ValueMap< float > IsolationCollection
virtual double pt() const =0
transverse momentum
virtual double mass() const =0
mass
EDGetTokenT< GenParticleMatch > zMuMuMatchMapToken_
int n2GlobalMuonsMatched_passedIso
float getParticleEta(const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
EDGetTokenT< CandidateView > zMuTrackToken_
lep1
print 'MRbb(1b)',event.mr_bb
alpha
zGenParticlesMatch = cms.InputTag(""),
EDGetTokenT< CandidateView > tracksToken_
isodeposit::AbsVetos AbsVetos
virtual size_type numberOfDaughters() const =0
number of daughters
virtual double phi() const =0
momentum azimuthal angle
Analysis-level muon class.
double isolation(const T *t, double ptThreshold, double etEcalThreshold, double etHcalThreshold, double dRVetoTrk, double dRTrk, double dREcal, double dRHcal, double alpha, double beta, bool relativeIsolation)
EDGetTokenT< GenParticleMatch > zMuStandAloneMatchMapToken_
float getParticlePt(const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
math::PtEtaPhiELorentzVectorF LorentzVector
Particle::LorentzVector getParticleP4(const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)