Definition at line 21 of file ZMuMuEfficiency.cc.
ZMuMuEfficiency::ZMuMuEfficiency | ( | const edm::ParameterSet & | pset | ) |
Definition at line 66 of file ZMuMuEfficiency.cc.
References etamax_, h_etaMuonOverlappedToStandAlone_, h_etaMuonOverlappedToTrack_, h_etaStandAlone_, h_etaTrack_, h_ptMuonOverlappedToStandAlone_, h_ptMuonOverlappedToTrack_, h_ptStandAlone_, h_ptTrack_, TFileDirectory::make(), nbinsEta_, nbinsPt_, numberOfMatchedZMuSta_, numberOfMatchedZMuTrack_, numberOfOverlappedStandAlone_, numberOfOverlappedTracks_, and ptmin_.
00066 : 00067 zMuTrack_(pset.getParameter<InputTag>("zMuTrack")), 00068 zMuTrackMatchMap_(pset.getParameter<InputTag>("zMuTrackMatchMap")), 00069 zMuStandAlone_(pset.getParameter<InputTag>("zMuStandAlone")), 00070 zMuStandAloneMatchMap_(pset.getParameter<InputTag>("zMuStandAloneMatchMap")), 00071 muons_(pset.getParameter<InputTag>("muons")), 00072 muonMatchMap_(pset.getParameter<InputTag>("muonMatchMap")), 00073 muonIso_(pset.getParameter<InputTag>("muonIso")), 00074 tracks_(pset.getParameter<InputTag>("tracks")), 00075 trackIso_(pset.getParameter<InputTag>("trackIso")), 00076 standAlone_(pset.getParameter<InputTag>("standAlone")), 00077 standAloneIso_(pset.getParameter<InputTag>("standAloneIso")), 00078 zMassMin_(pset.getUntrackedParameter<double>("zMassMin")), 00079 zMassMax_(pset.getUntrackedParameter<double>("zMassMax")), 00080 ptmin_(pset.getUntrackedParameter<double>("ptmin")), 00081 etamax_(pset.getUntrackedParameter<double>("etamax")), 00082 isomax_(pset.getUntrackedParameter<double>("isomax")), 00083 nbinsPt_(pset.getUntrackedParameter<size_t>("nbinsPt")), 00084 nbinsEta_(pset.getUntrackedParameter<size_t>("nbinsEta")) { 00085 Service<TFileService> fs; 00086 TFileDirectory trackEffDir = fs->mkdir("TrackEfficiency"); 00087 h_etaStandAlone_ = trackEffDir.make<TH1D>("StandAloneMuonEta", 00088 "StandAlone #eta for Z -> #mu + standalone", 00089 nbinsEta_, -etamax_, etamax_); 00090 h_etaMuonOverlappedToStandAlone_ = trackEffDir.make<TH1D>("MuonOverlappedToStandAloneEta", 00091 "Global muon overlapped to standAlone #eta for Z -> #mu + sa", 00092 nbinsEta_, -etamax_, etamax_); 00093 h_ptStandAlone_ = trackEffDir.make<TH1D>("StandAloneMuonPt", 00094 "StandAlone p_{t} for Z -> #mu + standalone", 00095 nbinsPt_, ptmin_, 200); 00096 h_ptMuonOverlappedToStandAlone_ = trackEffDir.make<TH1D>("MuonOverlappedToStandAlonePt", 00097 "Global muon overlapped to standAlone p_{t} for Z -> #mu + sa", 00098 nbinsPt_, ptmin_, 200); 00099 00100 00101 TFileDirectory standaloneEffDir = fs->mkdir("StandaloneEfficiency"); 00102 h_etaTrack_ = standaloneEffDir.make<TH1D>("TrackMuonEta", 00103 "Track #eta for Z -> #mu + track", 00104 nbinsEta_, -etamax_, etamax_); 00105 h_etaMuonOverlappedToTrack_ = standaloneEffDir.make<TH1D>("MuonOverlappedToTrackEta", 00106 "Global muon overlapped to track #eta for Z -> #mu + tk", 00107 nbinsEta_, -etamax_, etamax_); 00108 h_ptTrack_ = standaloneEffDir.make<TH1D>("TrackMuonPt", 00109 "Track p_{t} for Z -> #mu + track", 00110 nbinsPt_, ptmin_, 200); 00111 h_ptMuonOverlappedToTrack_ = standaloneEffDir.make<TH1D>("MuonOverlappedToTrackPt", 00112 "Global muon overlapped to track p_{t} for Z -> #mu + tk", 00113 nbinsPt_, ptmin_, 200); 00114 00115 numberOfMatchedZMuSta_ = 0; 00116 numberOfMatchedZMuTrack_ = 0; 00117 numberOfOverlappedStandAlone_ = 0; 00118 numberOfOverlappedTracks_ = 0; 00119 }
void ZMuMuEfficiency::analyze | ( | const edm::Event & | event, | |
const edm::EventSetup & | setup | |||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 121 of file ZMuMuEfficiency.cc.
References edm::RefToBase< T >::castTo(), reco::Candidate::daughter(), etamax_, globalMuonCandRef_, h_etaMuonOverlappedToStandAlone_, h_etaMuonOverlappedToTrack_, h_etaStandAlone_, h_etaTrack_, h_ptMuonOverlappedToStandAlone_, h_ptMuonOverlappedToTrack_, h_ptStandAlone_, h_ptTrack_, i, edm::Ref< C, T, F >::id(), isomax_, j, reco::Particle::mass(), reco::Candidate::masterClone(), muonIso_, muonMatchMap_, muons_cfi::muons, muons_, numberOfMatchedZMuSta_, numberOfMatchedZMuTrack_, numberOfOverlappedStandAlone_, numberOfOverlappedTracks_, overlap_, ptmin_, standAlone_, standAloneIso_, standAloneMuonCandRef_, trackIso_, trackMuonCandRef_, tracks, tracks_, zMassMax_, zMassMin_, zMuStandAlone_, zMuStandAloneMatchMap_, zMuTrack_, and zMuTrackMatchMap_.
00121 { 00122 Handle<CandidateCollection> zMuTrack; 00123 Handle<CandMatchMap> zMuTrackMatchMap; //Map of Z made by Mu + Track 00124 Handle<CandidateCollection> zMuStandAlone; 00125 Handle<CandMatchMap> zMuStandAloneMatchMap; //Map of Z made by Mu + StandAlone 00126 Handle<CandidateCollection> muons; //Collection of Muons 00127 Handle<CandMatchMap> muonMatchMap; 00128 Handle<IsolationCollection> muonIso; 00129 Handle<CandidateCollection> tracks; //Collection of Tracks 00130 Handle<IsolationCollection> trackIso; 00131 Handle<CandidateCollection> standAlone; //Collection of StandAlone 00132 Handle<IsolationCollection> standAloneIso; 00133 00134 event.getByLabel(zMuTrack_, zMuTrack); 00135 event.getByLabel(zMuStandAlone_, zMuStandAlone); 00136 event.getByLabel(muons_, muons); 00137 event.getByLabel(tracks_, tracks); 00138 event.getByLabel(standAlone_, standAlone); 00139 00140 //TRACK 00141 if (zMuStandAlone->size() > 0) { 00142 event.getByLabel(zMuStandAloneMatchMap_, zMuStandAloneMatchMap); 00143 event.getByLabel(muonIso_, muonIso); 00144 event.getByLabel(standAloneIso_, standAloneIso); 00145 event.getByLabel(muonMatchMap_, muonMatchMap); 00146 for(size_t i = 0; i < zMuStandAlone->size(); ++i) { //loop on candidates 00147 const Candidate & zMuStaCand = (*zMuStandAlone)[i]; //the candidate 00148 CandidateRef zMuStaCandRef(zMuStandAlone,i); 00149 bool isMatched = false; 00150 CandMatchMap::const_iterator zMuStaMapIt = zMuStandAloneMatchMap->find(zMuStaCandRef); 00151 if(zMuStaMapIt != zMuStandAloneMatchMap->end()) isMatched = true; 00152 CandidateRef dau0 = zMuStaCand.daughter(0)->masterClone().castTo<CandidateRef>(); 00153 CandidateRef dau1 = zMuStaCand.daughter(1)->masterClone().castTo<CandidateRef>(); 00154 00155 // Cuts 00156 if((dau0->pt() > ptmin_) && (dau1->pt() > ptmin_) && 00157 (fabs(dau0->eta()) < etamax_) && (fabs(dau1->eta()) < etamax_) && 00158 (zMuStaCand.mass() > zMassMin_) && (zMuStaCand.mass() < zMassMax_) && 00159 (isMatched)) { 00160 CandidateRef standAloneCandRef(standAlone,0); 00161 if(dau0.id() == standAloneCandRef.id()) { 00162 standAloneMuonCandRef_ = dau0; 00163 globalMuonCandRef_ = dau1; 00164 } 00165 if(dau1.id()== standAloneCandRef.id()) { 00166 standAloneMuonCandRef_ = dau1; 00167 globalMuonCandRef_ = dau0; 00168 } 00169 //The Z daughters are already matched! 00170 const double globalMuonIsolation = (*muonIso)[globalMuonCandRef_]; 00171 const double standAloneMuonIsolation = (*standAloneIso)[standAloneMuonCandRef_]; 00172 00173 if((globalMuonIsolation < isomax_) && (standAloneMuonIsolation < isomax_)) { 00174 numberOfMatchedZMuSta_++; 00175 h_etaStandAlone_->Fill(standAloneMuonCandRef_->eta()); //Denominator eta for measuring track efficiency 00176 h_ptStandAlone_->Fill(standAloneMuonCandRef_->pt()); //Denominator pt for measuring track eff 00177 00178 for(size_t j = 0; j < muons->size() ; ++j) { 00179 const Candidate & muCand = (*muons)[j]; 00180 CandidateRef muCandRef(muons, j); 00181 CandMatchMap::const_iterator muonMapIt = muonMatchMap->find(muCandRef); 00182 if((muonMapIt != muonMatchMap->end()) && (overlap_(*standAloneMuonCandRef_, muCand))) { 00183 h_etaMuonOverlappedToStandAlone_->Fill(standAloneMuonCandRef_->eta()); //Numerator eta 00184 h_ptMuonOverlappedToStandAlone_->Fill(standAloneMuonCandRef_->pt()); //Numerator pt 00185 numberOfOverlappedTracks_++; 00186 } 00187 } 00188 } 00189 } 00190 } 00191 } //end loop on Candidate 00192 00193 //STANDALONE 00194 if (zMuTrack->size() > 0) { 00195 event.getByLabel(zMuTrackMatchMap_, zMuTrackMatchMap); 00196 event.getByLabel(muonIso_, muonIso); 00197 event.getByLabel(trackIso_, trackIso); 00198 event.getByLabel(muonMatchMap_, muonMatchMap); 00199 for(size_t i = 0; i < zMuTrack->size(); ++i) { //loop on candidates 00200 const Candidate & zMuTrkCand = (*zMuTrack)[i]; //the candidate 00201 CandidateRef zMuTrkCandRef(zMuTrack,i); 00202 bool isMatched = false; 00203 CandMatchMap::const_iterator zMuTrkMapIt = zMuTrackMatchMap->find(zMuTrkCandRef); 00204 if(zMuTrkMapIt != zMuTrackMatchMap->end()) isMatched = true; 00205 CandidateRef dau0 = zMuTrkCand.daughter(0)->masterClone().castTo<CandidateRef>(); 00206 CandidateRef dau1 = zMuTrkCand.daughter(1)->masterClone().castTo<CandidateRef>(); 00207 00208 // Cuts 00209 if ((dau0->pt() > ptmin_) && (dau1->pt() > ptmin_) && 00210 (fabs(dau0->eta()) < etamax_) && (fabs(dau1->eta())< etamax_) && 00211 (zMuTrkCand.mass() > zMassMin_) && (zMuTrkCand.mass() < zMassMax_) && 00212 (isMatched)) { 00213 CandidateRef trackCandRef(tracks,0); 00214 if(dau0.id() == trackCandRef.id()) { 00215 trackMuonCandRef_ = dau0; 00216 globalMuonCandRef_ = dau1; 00217 } 00218 if(dau1.id() == trackCandRef.id()) { 00219 trackMuonCandRef_ = dau1; 00220 globalMuonCandRef_ = dau0; 00221 } 00222 //The Z daughters are already matched! 00223 const double globalMuonIsolation = (*muonIso)[globalMuonCandRef_]; 00224 const double trackMuonIsolation = (*trackIso)[trackMuonCandRef_]; 00225 00226 if((globalMuonIsolation < isomax_) && (trackMuonIsolation < isomax_)) { 00227 numberOfMatchedZMuTrack_++; 00228 h_etaTrack_->Fill(trackMuonCandRef_->eta()); //Denominator eta Sta 00229 h_ptTrack_->Fill(trackMuonCandRef_->pt()); //Denominator pt Sta 00230 00231 for(size_t j = 0; j < muons->size() ; ++j) { 00232 const Candidate & muCand = (*muons)[j]; 00233 CandidateRef muCandRef(muons, j); 00234 CandMatchMap::const_iterator muonMapIt = muonMatchMap->find(muCandRef); 00235 if((muonMapIt != muonMatchMap->end()) && (overlap_(*trackMuonCandRef_, muCand))) { 00236 h_etaMuonOverlappedToTrack_->Fill(trackMuonCandRef_->eta()); //Numerator sta eta 00237 h_ptMuonOverlappedToTrack_->Fill(trackMuonCandRef_->pt()); //Numerator sta pt 00238 numberOfOverlappedStandAlone_++; 00239 } 00240 } 00241 } 00242 } 00243 } 00244 } //end loop on Candidate 00245 }
Reimplemented from edm::EDAnalyzer.
Definition at line 248 of file ZMuMuEfficiency.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), numberOfMatchedZMuSta_, numberOfMatchedZMuTrack_, numberOfOverlappedStandAlone_, numberOfOverlappedTracks_, and funct::sqrt().
00248 { 00249 double efficiencySTA =(double)numberOfOverlappedStandAlone_/(double)numberOfMatchedZMuTrack_; 00250 double errorEff_STA = sqrt( efficiencySTA*(1 - efficiencySTA)/(double)numberOfMatchedZMuTrack_); 00251 00252 double efficiencyTRACK =(double)numberOfOverlappedTracks_/(double)numberOfMatchedZMuSta_; 00253 double errorEff_TRACK = sqrt( efficiencyTRACK*(1 - efficiencyTRACK)/(double)numberOfMatchedZMuSta_); 00254 00255 cout << "------------------------------------ Efficiency ----------------------------- " << endl; 00256 cout << "numberOfOverlappedStandAlone = " << numberOfOverlappedStandAlone_ << endl; 00257 cout << "numberOfMatchedZMuTrack = " << numberOfMatchedZMuTrack_ << endl; 00258 cout << "numberOfOverlappedTracks = " << numberOfOverlappedTracks_ << endl; 00259 cout << "numberOfMatchedZMuSta = " << numberOfMatchedZMuSta_ << endl; 00260 cout << "Efficiency StandAlone = " << efficiencySTA << " +/- " << errorEff_STA << endl; 00261 cout << "Efficiency Track = " << efficiencyTRACK << " +/- " << errorEff_TRACK << endl; 00262 }
double ZMuMuEfficiency::etamax_ [private] |
TH1D * ZMuMuEfficiency::h_etaMuonOverlappedToStandAlone_ [private] |
TH1D * ZMuMuEfficiency::h_etaMuonOverlappedToTrack_ [private] |
TH1D* ZMuMuEfficiency::h_etaStandAlone_ [private] |
TH1D* ZMuMuEfficiency::h_etaTrack_ [private] |
TH1D * ZMuMuEfficiency::h_ptMuonOverlappedToStandAlone_ [private] |
TH1D * ZMuMuEfficiency::h_ptMuonOverlappedToTrack_ [private] |
TH1D* ZMuMuEfficiency::h_ptStandAlone_ [private] |
TH1D* ZMuMuEfficiency::h_ptTrack_ [private] |
double ZMuMuEfficiency::isomax_ [private] |
edm::InputTag ZMuMuEfficiency::muonIso_ [private] |
edm::InputTag ZMuMuEfficiency::muonMatchMap_ [private] |
edm::InputTag ZMuMuEfficiency::muons_ [private] |
size_t ZMuMuEfficiency::nbinsEta_ [private] |
size_t ZMuMuEfficiency::nbinsPt_ [private] |
int ZMuMuEfficiency::numberOfMatchedZMuSta_ [private] |
Definition at line 46 of file ZMuMuEfficiency.cc.
Referenced by analyze(), endJob(), and ZMuMuEfficiency().
int ZMuMuEfficiency::numberOfMatchedZMuTrack_ [private] |
Definition at line 46 of file ZMuMuEfficiency.cc.
Referenced by analyze(), endJob(), and ZMuMuEfficiency().
Definition at line 47 of file ZMuMuEfficiency.cc.
Referenced by analyze(), endJob(), and ZMuMuEfficiency().
Definition at line 47 of file ZMuMuEfficiency.cc.
Referenced by analyze(), endJob(), and ZMuMuEfficiency().
OverlapChecker ZMuMuEfficiency::overlap_ [private] |
double ZMuMuEfficiency::ptmin_ [private] |
edm::InputTag ZMuMuEfficiency::standAlone_ [private] |
edm::InputTag ZMuMuEfficiency::standAloneIso_ [private] |
edm::InputTag ZMuMuEfficiency::trackIso_ [private] |
edm::InputTag ZMuMuEfficiency::tracks_ [private] |
double ZMuMuEfficiency::zMassMax_ [private] |
double ZMuMuEfficiency::zMassMin_ [private] |
edm::InputTag ZMuMuEfficiency::zMuStandAlone_ [private] |
edm::InputTag ZMuMuEfficiency::zMuTrack_ [private] |