38 virtual void endJob();
48 double zMassMin_, zMassMax_, ptmin_, etamax_, isomax_;
105 zMuMu_(pset.getParameter<
InputTag>(
"zMuMu")),
106 zMuMuMatchMap_(pset.getParameter<
InputTag>(
"zMuMuMatchMap")),
107 zMuTrack_(pset.getParameter<
InputTag>(
"zMuTrack")),
108 zMuTrackMatchMap_(pset.getParameter<
InputTag>(
"zMuTrackMatchMap")),
109 zMuStandAlone_(pset.getParameter<
InputTag>(
"zMuStandAlone")),
110 zMuStandAloneMatchMap_(pset.getParameter<
InputTag>(
"zMuStandAloneMatchMap")),
111 muons_(pset.getParameter<
InputTag>(
"muons")),
112 muonMatchMap_(pset.getParameter<
InputTag>(
"muonMatchMap")),
113 muonIso_(pset.getParameter<
InputTag>(
"muonIso")),
115 trackIso_(pset.getParameter<
InputTag>(
"trackIso")),
116 standAlone_(pset.getParameter<
InputTag>(
"standAlone")),
117 standAloneIso_(pset.getParameter<
InputTag>(
"standAloneIso")),
118 genParticles_(pset.getParameter<
InputTag>(
"genParticles" ) ),
120 zMassMin_(pset.getUntrackedParameter<double>(
"zMassMin")),
121 zMassMax_(pset.getUntrackedParameter<double>(
"zMassMax")),
122 ptmin_(pset.getUntrackedParameter<double>(
"ptmin")),
123 etamax_(pset.getUntrackedParameter<double>(
"etamax")),
124 isomax_(pset.getUntrackedParameter<double>(
"isomax")),
125 nbinsPt_(pset.getUntrackedParameter<unsigned int>(
"nbinsPt")),
126 nbinsEta_(pset.getUntrackedParameter<unsigned int>(
"nbinsEta")) {
132 "StandAlone #eta for Z -> #mu + standalone",
135 "Global muon overlapped to standAlone #eta for Z -> #mu + sa",
138 "StandAlone p_{t} for Z -> #mu + standalone",
141 "Global muon overlapped to standAlone p_{t} for Z -> #mu + sa",
147 h_etaTrack_ = standaloneEffDir.make<TH1D>(
"TrackMuonEta",
148 "Track #eta for Z -> #mu + track",
151 "Global muon overlapped to track #eta for Z -> #mu + tk",
153 h_ptTrack_ = standaloneEffDir.make<TH1D>(
"TrackMuonPt",
154 "Track p_{t} for Z -> #mu + track",
157 "Global muon overlapped to track p_{t} for Z -> #mu + tk",
170 h_nZMCfound_ = genParticleDir.make<TH1D>(
"NumberOfgeneratedZeta",
"n. of generated Z per event",4,-.5,3.5);
171 h_ZetaGen_ = genParticleDir.make<TH1D>(
"generatedZeta",
"#eta of generated Z",100,-5.,5.);
172 h_ZptGen_ = genParticleDir.make<TH1D>(
"generatedZpt",
"pt of generated Z",100,0.,200.);
173 h_ZmassGen_ = genParticleDir.make<TH1D>(
"generatedZmass",
"mass of generated Z",100,0.,200.);
174 h_muetaGen_ = genParticleDir.make<TH1D>(
"generatedMuonEta",
"#eta of generated muons from Z decay",100,-5.,5.);
175 h_muptGen_ = genParticleDir.make<TH1D>(
"generatedMuonpt",
"pt of generated muons from Z decay",100,0.,200.);
176 h_dimuonEtaGen_ = genParticleDir.make<TH1D>(
"generatedDimuonEta",
"#eta of generated dimuon",100,-5.,5.);
177 h_dimuonPtGen_ = genParticleDir.make<TH1D>(
"generatedDimuonPt",
"pt of generated dimuon",100,0.,200.);
178 h_dimuonMassGen_ = genParticleDir.make<TH1D>(
"generatedDimuonMass",
"mass of generated dimuon",100,0.,200.);
179 h_ZetaGenPassed_ = genParticleDir.make<TH1D>(
"generatedZeta_passed",
"#eta of generated Z after cuts",100,-5.,5.);
180 h_ZptGenPassed_ = genParticleDir.make<TH1D>(
"generatedZpt_passed",
"pt of generated Z after cuts",100,0.,200.);
181 h_ZmassGenPassed_ = genParticleDir.make<TH1D>(
"generatedZmass_passed",
"mass of generated Z after cuts",100,0.,200.);
182 h_muetaGenPassed_ = genParticleDir.make<TH1D>(
"generatedMuonEta_passed",
"#eta of generated muons from Z decay after cuts",100,-5.,5.);
183 h_muptGenPassed_ = genParticleDir.make<TH1D>(
"generatedMuonpt_passed",
"pt of generated muons from Z decay after cuts",100,0.,200.);
184 h_dimuonEtaGenPassed_ = genParticleDir.make<TH1D>(
"generatedDimuonEta_passed",
"#eta of generated dimuon after cuts",100,-5.,5.);
185 h_dimuonPtGenPassed_ = genParticleDir.make<TH1D>(
"generatedDimuonPt_passed",
"pt of generated dimuon after cuts",100,0.,200.);
186 h_dimuonMassGenPassed_ = genParticleDir.make<TH1D>(
"generatedDimuonMass_passed",
"mass of generated dimuon after cuts",100,0.,200.);
238 event.getByLabel(
zMuMu_, zMuMu);
241 event.getByLabel(
muons_, muons);
242 event.getByLabel(
tracks_, tracks);
246 cout <<
"********* zMuMu size : " << zMuMu->size() << endl;
247 cout <<
"********* zMuStandAlone size : " << zMuStandAlone->size() << endl;
248 cout <<
"********* zMuTrack size : " << zMuTrack->size() << endl;
249 cout <<
"********* muons size : " << muons->size()<< endl;
250 cout <<
"********* standAlone size : " << standAlone->size()<< endl;
251 cout <<
"********* tracks size : " << tracks->size()<< endl;
252 cout <<
"********* generated size : " << genParticles->size()<< endl;
259 int ngen = genParticles->size();
260 bool ZMuMuMatchedfound =
false;
261 bool ZMuMuMatchedSelectedfound =
false;
262 bool ZMuStaMatchedfound =
false;
264 int ZMuTrackMatchedfound = 0;
265 int ZMuTrackMatchedSelected_exclusivefound = 0;
267 double dimuonMassGen = 0;
269 for (
int i=0;
i<ngen;
i++) {
270 const Candidate &genCand = (*genParticles)[
i];
274 if((genCand.
pdgId() == 23)&&(genCand.
status() == 3)) {
282 bool checkpt =
false;
283 bool checketa =
false;
284 bool checkmass =
false;
285 float mupluspt, muminuspt, mupluseta, muminuseta;
295 pZ = muplusp4 + muminusp4;
296 double dimuon_pt =
sqrt(pZ.x()*pZ.x()+pZ.y()*pZ.y());
297 double tan_theta_half =
tan(atan(dimuon_pt/pZ.z())/2.);
298 double dimuon_eta = 0.;
299 if (tan_theta_half>0) dimuon_eta = -
log(
tan(tan_theta_half));
300 if (tan_theta_half<=0) dimuon_eta =
log(
tan(-tan_theta_half));
302 dimuonMassGen = pZ.mass();
322 if (mupluspt >
ptmin_ && muminuspt >
ptmin_) checkpt =
true;
325 if (checkpt && checketa && checkmass) {
338 if (zMuMu->size() > 0 ) {
341 else if (zMuStandAlone->size() > 0 ) {
358 if (zMuMu->size() > 0 ) {
361 event.getByLabel(
muonIso_, muonIso);
364 for(
unsigned int i = 0;
i < zMuMu->size(); ++
i) {
376 if (isMatched) ZMuMuMatchedfound =
true;
384 const double globalMuonIsolation0 = (*muonIso)[dau0];
385 const double globalMuonIsolation1 = (*muonIso)[dau1];
386 if((globalMuonIsolation0 <
isomax_) && (globalMuonIsolation1 <
isomax_)) {
387 ZMuMuMatchedSelectedfound =
true;
409 for(
unsigned int j = 0;
j < muons->size() ; ++
j) {
419 if (zMuStandAlone->size() > 0) {
422 event.getByLabel(
muonIso_, muonIso);
425 for(
unsigned int i = 0;
i < zMuStandAlone->size(); ++
i) {
426 const Candidate & zMuStaCand = (*zMuStandAlone)[
i];
429 GenParticleRef zMuStaMatch = (*zMuStandAloneMatchMap)[zMuStaCandRef];
432 ZMuStaMatchedfound =
true;
445 standAloneMuonCandRef_ = dau1;
446 globalMuonCandRef_ = dau0;
449 standAloneMuonCandRef_ = dau0;
450 globalMuonCandRef_ = dau1;
456 if((globalMuonIsolation <
isomax_) && (standAloneMuonIsolation <
isomax_)) {
470 if (zMuTrack->size() > 0) {
472 event.getByLabel(
muonIso_, muonIso);
475 for(
unsigned int i = 0;
i < zMuTrack->size(); ++
i) {
476 const Candidate & zMuTrkCand = (*zMuTrack)[
i];
487 ZMuTrackMatchedfound++;
496 (isMatched) && !ZMuMuMatchedfound && !ZMuStaMatchedfound ) {
499 const double globalMuonIsolation = (*muonIso)[dau0];
500 const double trackMuonIsolation = (*trackIso)[dau1];
501 if((globalMuonIsolation <
isomax_) && (trackMuonIsolation <
isomax_)) {
503 ZMuTrackMatchedSelected_exclusivefound++;
513 if (!ZMuMuMatchedfound && !ZMuStaMatchedfound && ZMuTrackMatchedfound == 0)
noMCmatching++;
526 int partId0 = dauGen0->
pdgId();
527 int partId1 = dauGen1->
pdgId();
528 int partId2 = dauGen2->
pdgId();
529 bool muplusFound=
false;
530 bool muminusFound=
false;
532 if (partId0==13 || partId1==13 || partId2==13) muminusFound=
true;
533 if (partId0==-13 || partId1==-13 || partId2==-13) muplusFound=
true;
534 if (partId0==23 || partId1==23 || partId2==23) ZFound=
true;
535 return muplusFound*muminusFound*ZFound;
540 int partId0 = dauGen0->
pdgId();
541 int partId1 = dauGen1->
pdgId();
542 int partId2 = dauGen2->
pdgId();
544 if (partId0 == ipart) {
547 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
548 ptpart = dauMuGen->
pt();
552 if (partId1 == ipart) {
555 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
556 ptpart = dauMuGen->
pt();
560 if (partId2 == ipart) {
564 ptpart = dauMuGen->
pt();
573 int partId0 = dauGen0->
pdgId();
574 int partId1 = dauGen1->
pdgId();
575 int partId2 = dauGen2->
pdgId();
577 if (partId0 == ipart) {
580 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
581 etapart = dauMuGen->
eta();
585 if (partId1 == ipart) {
588 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
589 etapart = dauMuGen->
eta();
593 if (partId2 == ipart) {
597 etapart = dauMuGen->
eta();
606 int partId0 = dauGen0->
pdgId();
607 int partId1 = dauGen1->
pdgId();
608 int partId2 = dauGen2->
pdgId();
610 if (partId0 == ipart) {
613 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
614 phipart = dauMuGen->
phi();
618 if (partId1 == ipart) {
621 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
622 phipart = dauMuGen->
phi();
626 if (partId2 == ipart) {
630 phipart = dauMuGen->
phi();
639 int partId0 = dauGen0->
pdgId();
640 int partId1 = dauGen1->
pdgId();
641 int partId2 = dauGen2->
pdgId();
643 if (partId0 == ipart) {
646 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
647 p4part = dauMuGen->
p4();
651 if (partId1 == ipart) {
654 if(dauMuGen->
pdgId() == ipart && dauMuGen->
status() ==1) {
655 p4part = dauMuGen->
p4();
659 if (partId2 == ipart) {
663 p4part = dauMuGen->
p4();
685 cout <<
"------------------------------------ Counters for MC acceptance --------------------------------" << endl;
693 cout <<
"---------------------------- Counter for MC truth efficiency calculation--------------------- " << endl;
697 cout <<
"-------------------------------------------------------------------------------------- " << endl;
710 cout <<
"numberOfMatchedSelectedZMuSta = " << numberOfMatchedSelectedZMuSta_ << endl;
714 cout <<
"numberOfMatchedSelectedZMuTrack exclusive = " << numberOfMatchedSelectedZMuTrack_exclusive << endl;
715 cout <<
" ----------------------------- Efficiency --------------------------------- " << endl;
716 cout <<
"Efficiency StandAlone = " << myStaEff <<
" +/- " << myErrStaEff << endl;
717 cout <<
"Efficiency Track = " << myTrackEff <<
" +/- " << myErrTrackEff << endl;
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
TH1D * h_ptMuonOverlappedToTrack_
int n_zMuMufound_genZsele
TH1D * h_dimuonPtGenPassed_
ZMuMuEfficiency(const edm::ParameterSet &pset)
bool check_ifZmumu(const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
int numberOfMatchedSelectedZMuSta_
virtual double pt() const =0
transverse momentum
#define DEFINE_FWK_MODULE(type)
TH1D * h_etaMuonOverlappedToStandAlone_
virtual double mass() const =0
mass
virtual int status() const =0
status word
edm::InputTag zMuTrackMatchMap_
int ZMuTrackselected_exclusive_1match
edm::InputTag genParticles_
int numberOfMatchedZMuTrack_exclusive
TH1D * h_dimuonEtaGenPassed_
int numberOfMatchedZMuTrack_matchedSelectedZMuMu
reco::CandidateBaseRef standAloneMuonCandRef_
int numberOfOverlappedStandAlone_
TH1D * h_DELTA_ZMuMuMassReco_dimuonMassGen_
int numberOfMatchedZMuTrack_matchedZMuMu
int ZMuTrack_ZMuMu_1match
bool isNonnull() const
Checks for non-null.
virtual size_type numberOfDaughters() const =0
number of daughters
edm::ValueMap< float > IsolationCollection
float getParticlePt(const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
edm::InputTag muonMatchMap_
int n_zMuTrkfound_genZsele
edm::InputTag zMuMuMatchMap_
int numberOfMatchedZMuMu_
edm::InputTag standAlone_
Tan< T >::type tan(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)
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_
float getParticlePhi(const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
edm::InputTag zMuStandAlone_
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
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_
edm::InputTag zMuStandAloneMatchMap_
TH1D * h_DELTA_ZMuTrackMassReco_dimuonMassGen_
T * make() const
make new ROOT object
int numberOfEventsWithZMuStafound
const reco::PFCandidateRefVector & tracks_
TH1D * h_etaMuonOverlappedToTrack_
int numberOfOverlappedTracks_
int ZMuTrack_exclusive_morematch
int n_zMuStafound_genZsele
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
int ZMuTrack_ZMuMu_morematch
edm::InputTag standAloneIso_
tuple zMuMu
zMuMu vector of PSet is common to all categories except zMuTrk category
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity
reco::CandidateBaseRef globalMuonCandRef_
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
virtual bool isGlobalMuon() const =0
virtual const CandidateBaseRef & masterClone() const =0