46 virtual void endJob()
override;
63 double zMassMin_, zMassMax_, ptmin_, etamax_, isomax_;
125 zMassMin_(pset.getUntrackedParameter<double>(
"zMassMin")),
126 zMassMax_(pset.getUntrackedParameter<double>(
"zMassMax")),
127 ptmin_(pset.getUntrackedParameter<double>(
"ptmin")),
128 etamax_(pset.getUntrackedParameter<double>(
"etamax")),
129 isomax_(pset.getUntrackedParameter<double>(
"isomax")),
130 nbinsPt_(pset.getUntrackedParameter<unsigned int>(
"nbinsPt")),
131 nbinsEta_(pset.getUntrackedParameter<unsigned int>(
"nbinsEta")) {
137 "StandAlone #eta for Z -> #mu + standalone",
140 "Global muon overlapped to standAlone #eta for Z -> #mu + sa",
143 "StandAlone p_{t} for Z -> #mu + standalone",
146 "Global muon overlapped to standAlone p_{t} for Z -> #mu + sa",
152 h_etaTrack_ = standaloneEffDir.make<TH1D>(
"TrackMuonEta",
153 "Track #eta for Z -> #mu + track",
156 "Global muon overlapped to track #eta for Z -> #mu + tk",
158 h_ptTrack_ = standaloneEffDir.make<TH1D>(
"TrackMuonPt",
159 "Track p_{t} for Z -> #mu + track",
162 "Global muon overlapped to track p_{t} for Z -> #mu + tk",
175 h_nZMCfound_ = genParticleDir.make<TH1D>(
"NumberOfgeneratedZeta",
"n. of generated Z per event",4,-.5,3.5);
176 h_ZetaGen_ = genParticleDir.make<TH1D>(
"generatedZeta",
"#eta of generated Z",100,-5.,5.);
177 h_ZptGen_ = genParticleDir.make<TH1D>(
"generatedZpt",
"pt of generated Z",100,0.,200.);
178 h_ZmassGen_ = genParticleDir.make<TH1D>(
"generatedZmass",
"mass of generated Z",100,0.,200.);
179 h_muetaGen_ = genParticleDir.make<TH1D>(
"generatedMuonEta",
"#eta of generated muons from Z decay",100,-5.,5.);
180 h_muptGen_ = genParticleDir.make<TH1D>(
"generatedMuonpt",
"pt of generated muons from Z decay",100,0.,200.);
181 h_dimuonEtaGen_ = genParticleDir.make<TH1D>(
"generatedDimuonEta",
"#eta of generated dimuon",100,-5.,5.);
182 h_dimuonPtGen_ = genParticleDir.make<TH1D>(
"generatedDimuonPt",
"pt of generated dimuon",100,0.,200.);
183 h_dimuonMassGen_ = genParticleDir.make<TH1D>(
"generatedDimuonMass",
"mass of generated dimuon",100,0.,200.);
184 h_ZetaGenPassed_ = genParticleDir.make<TH1D>(
"generatedZeta_passed",
"#eta of generated Z after cuts",100,-5.,5.);
185 h_ZptGenPassed_ = genParticleDir.make<TH1D>(
"generatedZpt_passed",
"pt of generated Z after cuts",100,0.,200.);
186 h_ZmassGenPassed_ = genParticleDir.make<TH1D>(
"generatedZmass_passed",
"mass of generated Z after cuts",100,0.,200.);
187 h_muetaGenPassed_ = genParticleDir.make<TH1D>(
"generatedMuonEta_passed",
"#eta of generated muons from Z decay after cuts",100,-5.,5.);
188 h_muptGenPassed_ = genParticleDir.make<TH1D>(
"generatedMuonpt_passed",
"pt of generated muons from Z decay after cuts",100,0.,200.);
189 h_dimuonEtaGenPassed_ = genParticleDir.make<TH1D>(
"generatedDimuonEta_passed",
"#eta of generated dimuon after cuts",100,-5.,5.);
190 h_dimuonPtGenPassed_ = genParticleDir.make<TH1D>(
"generatedDimuonPt_passed",
"pt of generated dimuon after cuts",100,0.,200.);
191 h_dimuonMassGenPassed_ = genParticleDir.make<TH1D>(
"generatedDimuonMass_passed",
"mass of generated dimuon after cuts",100,0.,200.);
251 cout <<
"********* zMuMu size : " << zMuMu->size() << endl;
252 cout <<
"********* zMuStandAlone size : " << zMuStandAlone->size() << endl;
253 cout <<
"********* zMuTrack size : " << zMuTrack->size() << endl;
254 cout <<
"********* muons size : " << muons->size()<< endl;
255 cout <<
"********* standAlone size : " << standAlone->size()<< endl;
256 cout <<
"********* tracks size : " << tracks->size()<< endl;
257 cout <<
"********* generated size : " << genParticles->size()<< endl;
264 int ngen = genParticles->size();
265 bool ZMuMuMatchedfound =
false;
266 bool ZMuMuMatchedSelectedfound =
false;
267 bool ZMuStaMatchedfound =
false;
269 int ZMuTrackMatchedfound = 0;
270 int ZMuTrackMatchedSelected_exclusivefound = 0;
272 double dimuonMassGen = 0;
274 for (
int i=0;
i<ngen;
i++) {
275 const Candidate &genCand = (*genParticles)[
i];
279 if((genCand.
pdgId() == 23)&&(genCand.
status() == 3)) {
287 bool checkpt =
false;
288 bool checketa =
false;
289 bool checkmass =
false;
290 float mupluspt, muminuspt, mupluseta, muminuseta;
300 pZ = muplusp4 + muminusp4;
301 double dimuon_pt =
sqrt(pZ.x()*pZ.x()+pZ.y()*pZ.y());
302 double tan_theta_half =
tan(atan(dimuon_pt/pZ.z())/2.);
303 double dimuon_eta = 0.;
304 if (tan_theta_half>0) dimuon_eta = -
log(
tan(tan_theta_half));
305 if (tan_theta_half<=0) dimuon_eta =
log(
tan(-tan_theta_half));
307 dimuonMassGen = pZ.mass();
327 if (mupluspt >
ptmin_ && muminuspt >
ptmin_) checkpt =
true;
330 if (checkpt && checketa && checkmass) {
343 if (zMuMu->size() > 0 ) {
346 else if (zMuStandAlone->size() > 0 ) {
363 if (zMuMu->size() > 0 ) {
369 for(
unsigned int i = 0;
i < zMuMu->size(); ++
i) {
381 if (isMatched) ZMuMuMatchedfound =
true;
389 const double globalMuonIsolation0 = (*muonIso)[dau0];
390 const double globalMuonIsolation1 = (*muonIso)[dau1];
391 if((globalMuonIsolation0 <
isomax_) && (globalMuonIsolation1 <
isomax_)) {
392 ZMuMuMatchedSelectedfound =
true;
414 for(
unsigned int j = 0;
j < muons->size() ; ++
j) {
424 if (zMuStandAlone->size() > 0) {
430 for(
unsigned int i = 0;
i < zMuStandAlone->size(); ++
i) {
431 const Candidate & zMuStaCand = (*zMuStandAlone)[
i];
434 GenParticleRef zMuStaMatch = (*zMuStandAloneMatchMap)[zMuStaCandRef];
437 ZMuStaMatchedfound =
true;
450 standAloneMuonCandRef_ = dau1;
451 globalMuonCandRef_ = dau0;
454 standAloneMuonCandRef_ = dau0;
455 globalMuonCandRef_ = dau1;
461 if((globalMuonIsolation <
isomax_) && (standAloneMuonIsolation <
isomax_)) {
475 if (zMuTrack->size() > 0) {
480 for(
unsigned int i = 0;
i < zMuTrack->size(); ++
i) {
481 const Candidate & zMuTrkCand = (*zMuTrack)[
i];
492 ZMuTrackMatchedfound++;
501 (isMatched) && !ZMuMuMatchedfound && !ZMuStaMatchedfound ) {
504 const double globalMuonIsolation = (*muonIso)[dau0];
505 const double trackMuonIsolation = (*trackIso)[dau1];
506 if((globalMuonIsolation <
isomax_) && (trackMuonIsolation <
isomax_)) {
508 ZMuTrackMatchedSelected_exclusivefound++;
518 if (!ZMuMuMatchedfound && !ZMuStaMatchedfound && ZMuTrackMatchedfound == 0)
noMCmatching++;
531 int partId0 = dauGen0->
pdgId();
532 int partId1 = dauGen1->
pdgId();
533 int partId2 = dauGen2->
pdgId();
534 bool muplusFound=
false;
535 bool muminusFound=
false;
537 if (partId0==13 || partId1==13 || partId2==13) muminusFound=
true;
538 if (partId0==-13 || partId1==-13 || partId2==-13) muplusFound=
true;
539 if (partId0==23 || partId1==23 || partId2==23) ZFound=
true;
540 return muplusFound*muminusFound*ZFound;
545 int partId0 = dauGen0->
pdgId();
546 int partId1 = dauGen1->
pdgId();
547 int partId2 = dauGen2->
pdgId();
549 if (partId0 == ipart) {
552 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
553 ptpart = dauMuGen->
pt();
557 if (partId1 == ipart) {
560 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
561 ptpart = dauMuGen->
pt();
565 if (partId2 == ipart) {
569 ptpart = dauMuGen->
pt();
578 int partId0 = dauGen0->
pdgId();
579 int partId1 = dauGen1->
pdgId();
580 int partId2 = dauGen2->
pdgId();
582 if (partId0 == ipart) {
585 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
586 etapart = dauMuGen->
eta();
590 if (partId1 == ipart) {
593 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
594 etapart = dauMuGen->
eta();
598 if (partId2 == ipart) {
602 etapart = dauMuGen->
eta();
611 int partId0 = dauGen0->
pdgId();
612 int partId1 = dauGen1->
pdgId();
613 int partId2 = dauGen2->
pdgId();
615 if (partId0 == ipart) {
618 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
619 phipart = dauMuGen->
phi();
623 if (partId1 == ipart) {
626 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
627 phipart = dauMuGen->
phi();
631 if (partId2 == ipart) {
635 phipart = dauMuGen->
phi();
644 int partId0 = dauGen0->
pdgId();
645 int partId1 = dauGen1->
pdgId();
646 int partId2 = dauGen2->
pdgId();
648 if (partId0 == ipart) {
651 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
652 p4part = dauMuGen->
p4();
656 if (partId1 == ipart) {
659 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
660 p4part = dauMuGen->
p4();
664 if (partId2 == ipart) {
668 p4part = dauMuGen->
p4();
690 cout <<
"------------------------------------ Counters for MC acceptance --------------------------------" << endl;
698 cout <<
"---------------------------- Counter for MC truth efficiency calculation--------------------- " << endl;
702 cout <<
"-------------------------------------------------------------------------------------- " << endl;
715 cout <<
"numberOfMatchedSelectedZMuSta = " << numberOfMatchedSelectedZMuSta_ << endl;
719 cout <<
"numberOfMatchedSelectedZMuTrack exclusive = " << numberOfMatchedSelectedZMuTrack_exclusive << endl;
720 cout <<
" ----------------------------- Efficiency --------------------------------- " << endl;
721 cout <<
"Efficiency StandAlone = " << myStaEff <<
" +/- " << myErrStaEff << endl;
722 cout <<
"Efficiency Track = " << myTrackEff <<
" +/- " << myErrTrackEff << endl;
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
EDGetTokenT< GenParticleMatch > zMuMuMatchMapToken_
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
bool isNonnull() const
Checks for non-null.
TH1D * h_ptMuonOverlappedToTrack_
int n_zMuMufound_genZsele
TH1D * h_dimuonPtGenPassed_
ZMuMuEfficiency(const edm::ParameterSet &pset)
virtual float mass() const =0
mass
bool check_ifZmumu(const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
EDGetTokenT< CandidateView > zMuStandAloneToken_
int numberOfMatchedSelectedZMuSta_
virtual float eta() const =0
momentum pseudorapidity
#define DEFINE_FWK_MODULE(type)
TH1D * h_etaMuonOverlappedToStandAlone_
virtual int status() const =0
status word
int ZMuTrackselected_exclusive_1match
int numberOfMatchedZMuTrack_exclusive
virtual float phi() const =0
momentum azimuthal angle
TH1D * h_dimuonEtaGenPassed_
EDGetTokenT< CandidateView > zMuTrackToken_
int numberOfMatchedZMuTrack_matchedSelectedZMuMu
reco::CandidateBaseRef standAloneMuonCandRef_
int numberOfOverlappedStandAlone_
TH1D * h_DELTA_ZMuMuMassReco_dimuonMassGen_
int numberOfMatchedZMuTrack_matchedZMuMu
int ZMuTrack_ZMuMu_1match
EDGetTokenT< CandidateView > tracksToken_
virtual size_type numberOfDaughters() const =0
number of daughters
virtual float pt() const =0
transverse momentum
EDGetTokenT< GenParticleCollection > genParticlesToken_
edm::ValueMap< float > IsolationCollection
float getParticlePt(const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
int n_zMuTrkfound_genZsele
int numberOfMatchedZMuMu_
virtual void endJob() override
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
int ZMuTrackselected_exclusive_morematch
int numberOfMatchedSelectedZMuTrack_exclusive
int ZMuTrack_ZMuMu_2match
bool isMatched(TrackingRecHit const &hit)
int numberOfMatchedZMuSta_
float getParticleEta(const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
T * make(const Args &...args) const
make new ROOT object
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
reco::CandidateBaseRef trackMuonCandRef_
EDGetTokenT< CandidateView > zMuMuToken_
float getParticlePhi(const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
TH1D * h_DELTA_ZMuStaMassReco_dimuonMassGen_
virtual int pdgId() const =0
PDG identifier.
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup) override
int numberOfEventsWithZMuMufound
int ZMuTrack_exclusive_1match
int numberOfMatchedZMuTrack_notOverlapped
Particle::LorentzVector getParticleP4(const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
int numberOfMatchedSelectedZMuMu_
TH1D * h_dimuonMassGenPassed_
TH1D * h_ptMuonOverlappedToStandAlone_
EDGetTokenT< CandidateView > standAloneToken_
TH1D * h_DELTA_ZMuTrackMassReco_dimuonMassGen_
EDGetTokenT< IsolationCollection > standAloneIsoToken_
EDGetTokenT< GenParticleMatch > zMuTrackMatchMapToken_
int numberOfEventsWithZMuStafound
TH1D * h_etaMuonOverlappedToTrack_
int numberOfOverlappedTracks_
int ZMuTrack_exclusive_morematch
int n_zMuStafound_genZsele
EDGetTokenT< GenParticleMatch > muonMatchMapToken_
EDGetTokenT< IsolationCollection > trackIsoToken_
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
EDGetTokenT< CandidateView > muonsToken_
int ZMuTrack_ZMuMu_morematch
EDGetTokenT< IsolationCollection > muonIsoToken_
tuple zMuMu
zMuMu vector of PSet is common to all categories except zMuTrk category
math::PtEtaPhiELorentzVectorF LorentzVector
EDGetTokenT< GenParticleMatch > zMuStandAloneMatchMapToken_
reco::CandidateBaseRef globalMuonCandRef_
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
virtual bool isGlobalMuon() const =0
virtual const CandidateBaseRef & masterClone() const =0