122 std::vector<std::pair<RefToBase<Track>,
double> > rvGlb;
124 if(glbsimToRecoCollection.
find(tp) != glbsimToRecoCollection.
end()){
125 rvGlb = glbsimToRecoCollection[tp];
127 rGlb = rvGlb.begin()->first;
131 std::vector<std::pair<RefToBase<Track>,
double> > rvSta;
133 if(stasimToRecoCollection.
find(tp) != stasimToRecoCollection.
end()){
134 rvSta = stasimToRecoCollection[tp];
136 rSta = rvSta.begin()->first;
140 std::vector<std::pair<RefToBase<Track>,
double> > rvTk;
142 if(tksimToRecoCollection.
find(tp) != tksimToRecoCollection.
end()){
143 rvTk = tksimToRecoCollection[tp];
145 rTk = rvTk.begin()->first;
149 if( !rvSta.empty() && !rvTk.empty() ){
154 for ( reco::MuonTrackLinksCollection::const_iterator links = muHandle->begin(); links != muHandle->end(); ++links ) {
178 for ( reco::MuonTrackLinksCollection::const_iterator links = muHandle->begin(); links != muHandle->end(); ++links ) {
183 std::vector<std::pair<TrackingParticleRef, double> > tp1;
185 if(glbrecoToSimCollection.
find(glbRef) != glbrecoToSimCollection.
end()){
186 tp1 = glbrecoToSimCollection[glbRef];
188 tp1r = tp1.begin()->first;
192 std::vector<std::pair<TrackingParticleRef, double> > tp2;
194 if(starecoToSimCollection.
find(staRef) != starecoToSimCollection.
end()){
195 tp2 = starecoToSimCollection[staRef];
197 tp2r = tp2.begin()->first;
201 std::vector<std::pair<TrackingParticleRef, double> > tp3;
203 if(tkrecoToSimCollection.
find(tkRef) != tkrecoToSimCollection.
end()){
204 tp3 = tkrecoToSimCollection[tkRef];
206 tp3r = tp3.begin()->first;
253 h_shouldMatch = ibooker.
book2D(
"h_shouldMatch",
"SIM associated to Tk and Sta",50,-2.5,2.5,100,0.,500.);
254 h_goodMatchSim = ibooker.
book2D(
"h_goodMatchSim",
"SIM associated to Glb Sta Tk",50,-2.5,2.5,100,0.,500.);
255 h_tkOnlySim = ibooker.
book2D(
"h_tkOnlySim",
"SIM associated to Glb Tk",50,-2.5,2.5,100,0.,500.);
256 h_staOnlySim = ibooker.
book2D(
"h_staOnlySim",
"SIM associated to Glb Sta",50,-2.5,2.5,100,0.,500.);
258 h_totReco = ibooker.
book2D(
"h_totReco",
"Total Glb Reconstructed",50,-2.5,2.5,100,0.,500.);
259 h_goodMatch = ibooker.
book2D(
"h_goodMatch",
"Sta and Tk from same SIM",50,-2.5,2.5,100, 0., 500.);
260 h_fakeMatch = ibooker.
book2D(
"h_fakeMatch",
"Sta and Tk not from same SIM",50,-2.5,2.5,100,0.,500.);
262 h_effic = ibooker.
book1D(
"h_effic",
"Efficiency vs #eta",50,-2.5,2.5);
263 h_efficPt = ibooker.
book1D(
"h_efficPt",
"Efficiency vs p_{T}",100,0.,100.);
265 h_fake = ibooker.
book1D(
"h_fake",
"Fake fraction vs #eta",50,-2.5,2.5);
266 h_fakePt = ibooker.
book1D(
"h_fakePt",
"Fake fraction vs p_{T}",100,0.,100.);
273 TH2F * h1 = recoTH2->
getTH2F();
274 TH1D*
reco = h1->ProjectionX();
277 TH1D*
sim = h2 ->ProjectionX();
280 TH1F *hEff = (TH1F*) reco->Clone();
284 hEff->SetName(
"tmp_"+TString(reco->GetName()));
287 int nBinsEta = hEff->GetNbinsX();
288 for(
int bin = 1;
bin <= nBinsEta;
bin++) {
289 float nSimHit = sim->GetBinContent(
bin);
290 float eff = hEff->GetBinContent(
bin);
292 if(nSimHit != 0 && eff <= 1) {
293 error =
sqrt(eff*(1-eff)/nSimHit);
295 hEff->SetBinError(
bin, error);
303 TH2F * h1 = recoTH2->
getTH2F();
304 TH1D*
reco = h1->ProjectionY();
307 TH1D*
sim = h2 ->ProjectionY();
310 TH1F *hEff = (TH1F*) reco->Clone();
314 hEff->SetName(
"tmp_"+TString(reco->GetName()));
317 int nBinsPt = hEff->GetNbinsX();
318 for(
int bin = 1;
bin <= nBinsPt;
bin++) {
319 float nSimHit = sim->GetBinContent(
bin);
320 float eff = hEff->GetBinContent(
bin);
322 if(nSimHit != 0 && eff <= 1) {
323 error =
sqrt(eff*(1-eff)/nSimHit);
325 hEff->SetBinError(
bin, error);
MonitorElement * h_goodMatchSim
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * h_tkOnlySim
void setBinContent(int binx, double content)
set content of bin (1-D)
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > muAssociatorToken_
MonitorElement * h_shouldMatch
std::vector< TrackingParticle > TrackingParticleCollection
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * h_fakePt
const_iterator find(const key_type &k) const
find element with specified reference key
std::vector< MuonTrackLinks > MuonTrackLinksCollection
collection of MuonTrackLinks
MonitorElement * h_fakeMatch
double eta() const
pseudorapidity of momentum vector
edm::ParameterSet iConfig
void setCurrentFolder(std::string const &fullpath)
MonitorElement * h_totReco
edm::EDGetTokenT< edm::View< reco::Track > > glbToken_
void computeEfficiencyPt(MonitorElement *, MonitorElement *recoTH2, MonitorElement *simTH2)
double pt() const
track transverse momentum
MonitorElement * book1D(Args &&...args)
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
edm::EDGetTokenT< edm::View< reco::Track > > staToken_
bin
set the eta bin as selection string.
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * h_staOnlySim
~GlobalMuonMatchAnalyzer() override
edm::InputTag muAssociatorName_
T const * product() const
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * book2D(Args &&...args)
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
GlobalMuonMatchAnalyzer(const edm::ParameterSet &)
std::string subsystemname_
MonitorElement * h_efficPt
edm::EDGetTokenT< edm::View< reco::Track > > tpToken_
void endRun(const edm::Run &, const edm::EventSetup &) override
edm::InputTag tkAssociatorName_
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
MonitorElement * h_goodMatch
void computeEfficiencyEta(MonitorElement *, MonitorElement *recoTH2, MonitorElement *simTH2)
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > tkAssociatorToken_
edm::EDGetTokenT< edm::View< reco::Track > > tkToken_