45 using namespace isodeposit;
59 virtual void endJob()
override;
73 double etamin_, etamax_,
ptmin_, massMin_, massMax_, isoMax_;
75 double ptThreshold_, etEcalThreshold_, etHcalThreshold_ ,dRVetoTrk_, dRTrk_, dREcal_ , dRHcal_, alpha_, beta_;
83 TH1D *h_trackProbe_eta, *
h_trackProbe_pt, *h_staProbe_eta, *h_staProbe_pt, *h_ProbeOk_eta, *h_ProbeOk_pt;
102 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) {
116 vetosTrk.push_back(
new ConeVeto( dir, dRVetoTrk ));
120 vetosEcal.push_back(
new ConeVeto( dir, 0.));
124 vetosHcal.push_back(
new ConeVeto( dir, 0. ));
127 double isovalueTrk = (trkIso->
sumWithin(dRTrk,vetosTrk));
128 double isovalueEcal = (ecalIso->
sumWithin(dREcal,vetosEcal));
129 double isovalueHcal = (hcalIso->
sumWithin(dRHcal,vetosHcal));
132 double iso = alpha*( ((1+
beta)/2*isovalueEcal) + ((1-
beta)/2*isovalueHcal) ) + ((1-alpha)*isovalueTrk) ;
133 if(relativeIsolation) iso /= t->pt();
138 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) {
140 if(mu != 0)
return isolation(mu, ptThreshold, etEcalThreshold, etHcalThreshold ,dRVetoTrk, dRTrk, dREcal , dRHcal, alpha, beta, relativeIsolation);
142 if(trk != 0)
return isolation(trk, ptThreshold, etEcalThreshold, etHcalThreshold ,dRVetoTrk, dRTrk, dREcal ,
143 dRHcal, alpha, beta, relativeIsolation);
145 <<
"Candidate daughter #0 is neither pat::Muons nor pat::GenericParticle\n";
177 bothMuons_(pset.getParameter<bool>(
"bothMuons")),
178 etamin_(pset.getUntrackedParameter<double>(
"etamin")),
179 etamax_(pset.getUntrackedParameter<double>(
"etamax")),
180 ptmin_(pset.getUntrackedParameter<double>(
"ptmin")),
181 massMin_(pset.getUntrackedParameter<double>(
"zMassMin")),
182 massMax_(pset.getUntrackedParameter<double>(
"zMassMax")),
183 isoMax_(pset.getUntrackedParameter<double>(
"isomax")),
184 ptThreshold_(pset.getUntrackedParameter<double>(
"ptThreshold")),
185 etEcalThreshold_(pset.getUntrackedParameter<double>(
"etEcalThreshold")),
186 etHcalThreshold_(pset.getUntrackedParameter<double>(
"etHcalThreshold")),
187 dRVetoTrk_(pset.getUntrackedParameter<double>(
"deltaRVetoTrk")),
188 dRTrk_(pset.getUntrackedParameter<double>(
"deltaRTrk")),
189 dREcal_(pset.getUntrackedParameter<double>(
"deltaREcal")),
190 dRHcal_(pset.getUntrackedParameter<double>(
"deltaRHcal")),
191 alpha_(pset.getUntrackedParameter<double>(
"alpha")),
192 beta_(pset.getUntrackedParameter<double>(
"beta")),
193 relativeIsolation_(pset.getUntrackedParameter<bool>(
"relativeIsolation")),
194 hltPath_(pset.getUntrackedParameter<
std::
string >(
"hltPath")) {
198 double etaRange[8] = {-2.5,-2.,-1.2,-0.8,0.8,1.2,2.,2.5};
199 double ptRange[4] = {20.,40.,60.,100.};
253 bool zMuMu_found =
false;
256 if (zMuMu->
size() > 0 ) {
258 for(
unsigned int i = 0;
i < zMuMu->
size(); ++
i) {
269 double iso0 =
candidateIsolation(lep0,
ptThreshold_,
etEcalThreshold_,
etHcalThreshold_,
dRVetoTrk_,
dRTrk_,
dREcal_ ,
dRHcal_,
alpha_,
beta_,
relativeIsolation_);
270 double iso1 =
candidateIsolation(lep1,
ptThreshold_,
etEcalThreshold_,
etHcalThreshold_,
dRVetoTrk_,
dRTrk_,
dREcal_ ,
dRHcal_,
alpha_,
beta_,
relativeIsolation_);
284 bool trig0found =
false;
285 bool trig1found =
false;
286 if( mu0HLTMatches.size()>0 )
288 if( mu1HLTMatches.size()>0 )
330 bool zMuSta_found =
false;
331 if (!zMuMu_found && zMuStandAlone->
size() > 0 ) {
333 for(
unsigned int i = 0;
i < zMuStandAlone->
size(); ++
i) {
334 const Candidate & zMuStandAloneCand = (*zMuStandAlone)[
i];
336 GenParticleRef zMuStandAloneMatch = (*zMuStandAloneMatchMap)[zMuStandAloneCandRef];
345 double iso0 =
candidateIsolation(lep0,
ptThreshold_,
etEcalThreshold_,
etHcalThreshold_,
dRVetoTrk_,
dRTrk_,
dREcal_ ,
dRHcal_,
alpha_,
beta_,
relativeIsolation_);
346 double iso1 =
candidateIsolation(lep1,
ptThreshold_,
etEcalThreshold_,
etHcalThreshold_,
dRVetoTrk_,
dRTrk_,
dREcal_ ,
dRHcal_,
alpha_,
beta_,
relativeIsolation_);
348 double pt0 = zMuStandAloneCand.
daughter(0)->
pt();
350 double eta0 = zMuStandAloneCand.
daughter(0)->
eta();
351 double eta1 = zMuStandAloneCand.
daughter(1)->
eta();
352 double mass = zMuStandAloneCand.
mass();
358 bool trig0found =
false;
359 if( mu0HLTMatches.size()>0 )
378 if (!zMuMu_found && !zMuSta_found && zMuTrack->
size() > 0 ) {
380 for(
unsigned int i = 0;
i < zMuTrack->
size(); ++
i) {
381 const Candidate & zMuTrackCand = (*zMuTrack)[
i];
389 double iso0 =
candidateIsolation(lep0,
ptThreshold_,
etEcalThreshold_,
etHcalThreshold_,
dRVetoTrk_,
dRTrk_,
dREcal_ ,
dRHcal_,
alpha_,
beta_,
relativeIsolation_);
390 double iso1 =
candidateIsolation(lep1,
ptThreshold_,
etEcalThreshold_,
etHcalThreshold_,
dRVetoTrk_,
dRTrk_,
dREcal_ ,
dRHcal_,
alpha_,
beta_,
relativeIsolation_);
403 bool trig0found =
false;
404 if( mu0HLTMatches.size()>0 )
407 GenParticleRef zMuTrackMatch = (*zMuTrackMatchMap)[zMuTrackCandRef];
425 int partId0 = dauGen0->
pdgId();
426 int partId1 = dauGen1->
pdgId();
427 int partId2 = dauGen2->
pdgId();
428 bool muplusFound=
false;
429 bool muminusFound=
false;
431 if (partId0==13 || partId1==13 || partId2==13) muminusFound=
true;
432 if (partId0==-13 || partId1==-13 || partId2==-13) muplusFound=
true;
433 if (partId0==23 || partId1==23 || partId2==23) ZFound=
true;
434 return muplusFound*muminusFound*ZFound;
439 int partId0 = dauGen0->
pdgId();
440 int partId1 = dauGen1->
pdgId();
441 int partId2 = dauGen2->
pdgId();
443 if (partId0 == ipart) {
446 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
447 ptpart = dauMuGen->
pt();
451 if (partId1 == ipart) {
454 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
455 ptpart = dauMuGen->
pt();
459 if (partId2 == ipart) {
463 ptpart = dauMuGen->
pt();
472 int partId0 = dauGen0->
pdgId();
473 int partId1 = dauGen1->
pdgId();
474 int partId2 = dauGen2->
pdgId();
476 if (partId0 == ipart) {
479 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
480 etapart = dauMuGen->
eta();
484 if (partId1 == ipart) {
487 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
488 etapart = dauMuGen->
eta();
492 if (partId2 == ipart) {
496 etapart = dauMuGen->
eta();
505 int partId0 = dauGen0->
pdgId();
506 int partId1 = dauGen1->
pdgId();
507 int partId2 = dauGen2->
pdgId();
509 if (partId0 == ipart) {
512 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
513 phipart = dauMuGen->
phi();
517 if (partId1 == ipart) {
520 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
521 phipart = dauMuGen->
phi();
525 if (partId2 == ipart) {
529 phipart = dauMuGen->
phi();
538 int partId0 = dauGen0->
pdgId();
539 int partId1 = dauGen1->
pdgId();
540 int partId2 = dauGen2->
pdgId();
542 if (partId0 == ipart) {
545 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
546 p4part = dauMuGen->
p4();
550 if (partId1 == ipart) {
553 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
554 p4part = dauMuGen->
p4();
558 if (partId2 == ipart) {
562 p4part = dauMuGen->
p4();
583 double err_effHLT_afterIso=
sqrt( effHLT_afterIso * (1 - effHLT_afterIso)/nGLB_afterIso);
584 double err_effsta_afterIso =
sqrt(effSta_afterIso*(1-effSta_afterIso)/n1_afterIso);
585 double err_efftrk_afterIso =
sqrt(effTrk_afterIso*(1-effTrk_afterIso)/n2_afterIso);
588 cout <<
"------------------------------------ Counters --------------------------------" << endl;
594 cout <<
"number of events zMuMu with mu1 only triggered " << nMu1onlyTriggered << endl;
595 cout <<
"=========================================" << endl;
599 cout <<
"n. of ZMuSta MC matched and passing ALL cuts: " << nStaMuonsMatched_passedIso << endl;
600 cout <<
"n. of ZmuTrck MC matched and passing ALL cuts: " << nTracksMuonsMatched_passedIso << endl;
602 cout <<
"=================================================================================" << endl;
603 cout <<
"Iso efficiency: " << eff_Iso <<
" +/- " << err_effIso << endl;
604 cout <<
"HLT efficiency: " << effHLT_afterIso <<
" +/- " << err_effHLT_afterIso << endl;
605 cout <<
"eff StandAlone (after Isocut) : " << effSta_afterIso <<
"+/-" << err_effsta_afterIso << endl;
606 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)
def analyze(function, filename, filter=None)
int nGlobalMuonsMatched_passedIso
#define DEFINE_FWK_MODULE(type)
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) ...
def setup(process, global_tag, zero_tesla=False)
float getParticlePhi(const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
T * make(const Args &...args) const
make new ROOT object
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup) 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) ...
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
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
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
virtual void endJob() override
Particle::LorentzVector getParticleP4(const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)