119 std::vector<std::pair<RefToBase<Track>,
double> > rvGlb;
121 if(glbsimToRecoCollection.find(tp) != glbsimToRecoCollection.end()){
122 rvGlb = glbsimToRecoCollection[tp];
123 if(rvGlb.size() != 0) {
124 rGlb = rvGlb.begin()->first;
128 std::vector<std::pair<RefToBase<Track>,
double> > rvSta;
130 if(stasimToRecoCollection.find(tp) != stasimToRecoCollection.end()){
131 rvSta = stasimToRecoCollection[tp];
132 if(rvSta.size() != 0) {
133 rSta = rvSta.begin()->first;
137 std::vector<std::pair<RefToBase<Track>,
double> > rvTk;
139 if(tksimToRecoCollection.find(tp) != tksimToRecoCollection.end()){
140 rvTk = tksimToRecoCollection[tp];
141 if(rvTk.size() != 0) {
142 rTk = rvTk.begin()->first;
146 if( rvSta.size() != 0 && rvTk.size() != 0 ){
151 for ( reco::MuonTrackLinksCollection::const_iterator
links = muHandle->begin();
links != muHandle->end(); ++
links ) {
175 for ( reco::MuonTrackLinksCollection::const_iterator
links = muHandle->begin();
links != muHandle->end(); ++
links ) {
180 std::vector<std::pair<TrackingParticleRef, double> > tp1;
182 if(glbrecoToSimCollection.find(glbRef) != glbrecoToSimCollection.end()){
183 tp1 = glbrecoToSimCollection[glbRef];
184 if(tp1.size() != 0) {
185 tp1r = tp1.begin()->first;
189 std::vector<std::pair<TrackingParticleRef, double> > tp2;
191 if(starecoToSimCollection.find(staRef) != starecoToSimCollection.end()){
192 tp2 = starecoToSimCollection[staRef];
193 if(tp2.size() != 0) {
194 tp2r = tp2.begin()->first;
198 std::vector<std::pair<TrackingParticleRef, double> > tp3;
200 if(tkrecoToSimCollection.find(tkRef) != tkrecoToSimCollection.end()){
201 tp3 = tkrecoToSimCollection[tkRef];
202 if(tp3.size() != 0) {
203 tp3r = tp3.begin()->first;
208 if(tp1.size() != 0) {
264 h_shouldMatch = ibooker.
book2D(
"h_shouldMatch",
"SIM associated to Tk and Sta",50,-2.5,2.5,100,0.,500.);
265 h_goodMatchSim = ibooker.
book2D(
"h_goodMatchSim",
"SIM associated to Glb Sta Tk",50,-2.5,2.5,100,0.,500.);
266 h_tkOnlySim = ibooker.
book2D(
"h_tkOnlySim",
"SIM associated to Glb Tk",50,-2.5,2.5,100,0.,500.);
267 h_staOnlySim = ibooker.
book2D(
"h_staOnlySim",
"SIM associated to Glb Sta",50,-2.5,2.5,100,0.,500.);
269 h_totReco = ibooker.
book2D(
"h_totReco",
"Total Glb Reconstructed",50,-2.5,2.5,100,0.,500.);
270 h_goodMatch = ibooker.
book2D(
"h_goodMatch",
"Sta and Tk from same SIM",50,-2.5,2.5,100, 0., 500.);
271 h_fakeMatch = ibooker.
book2D(
"h_fakeMatch",
"Sta and Tk not from same SIM",50,-2.5,2.5,100,0.,500.);
273 h_effic = ibooker.
book1D(
"h_effic",
"Efficiency vs #eta",50,-2.5,2.5);
274 h_efficPt = ibooker.
book1D(
"h_efficPt",
"Efficiency vs p_{T}",100,0.,100.);
276 h_fake = ibooker.
book1D(
"h_fake",
"Fake fraction vs #eta",50,-2.5,2.5);
277 h_fakePt = ibooker.
book1D(
"h_fakePt",
"Fake fraction vs p_{T}",100,0.,100.);
284 TH2F * h1 = recoTH2->
getTH2F();
285 TH1D*
reco = h1->ProjectionX();
288 TH1D*
sim = h2 ->ProjectionX();
291 TH1F *hEff = (TH1F*) reco->Clone();
295 hEff->SetName(
"tmp_"+TString(reco->GetName()));
298 int nBinsEta = hEff->GetNbinsX();
299 for(
int bin = 1;
bin <= nBinsEta;
bin++) {
300 float nSimHit = sim->GetBinContent(
bin);
301 float eff = hEff->GetBinContent(
bin);
303 if(nSimHit != 0 && eff <= 1) {
304 error =
sqrt(eff*(1-eff)/nSimHit);
306 hEff->SetBinError(
bin, error);
314 TH2F * h1 = recoTH2->
getTH2F();
315 TH1D*
reco = h1->ProjectionY();
318 TH1D*
sim = h2 ->ProjectionY();
321 TH1F *hEff = (TH1F*) reco->Clone();
325 hEff->SetName(
"tmp_"+TString(reco->GetName()));
328 int nBinsPt = hEff->GetNbinsX();
329 for(
int bin = 1;
bin <= nBinsPt;
bin++) {
330 float nSimHit = sim->GetBinContent(
bin);
331 float eff = hEff->GetBinContent(
bin);
333 if(nSimHit != 0 && eff <= 1) {
334 error =
sqrt(eff*(1-eff)/nSimHit);
336 hEff->SetBinError(
bin, error);
MonitorElement * h_goodMatchSim
T getUntrackedParameter(std::string const &, T const &) const
const TrackAssociatorBase * muAssociator_
MonitorElement * h_tkOnlySim
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * h_shouldMatch
std::vector< TrackingParticle > TrackingParticleCollection
~GlobalMuonMatchAnalyzer()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * h_fakePt
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::vector< MuonTrackLinks > MuonTrackLinksCollection
collection of MuonTrackLinks
MonitorElement * h_fakeMatch
double eta() const
pseudorapidity of momentum vector
edm::ParameterSet iConfig
MonitorElement * h_totReco
edm::EDGetTokenT< edm::View< reco::Track > > glbToken_
std::string tkAssociatorName_
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_
virtual reco::RecoToSimCollection associateRecoToSim(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
virtual reco::SimToRecoCollection associateSimToReco(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
MonitorElement * h_staOnlySim
std::string muAssociatorName_
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
GlobalMuonMatchAnalyzer(const edm::ParameterSet &)
T const * product() const
const TrackAssociatorBase * tkAssociator_
std::string subsystemname_
MonitorElement * h_efficPt
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
edm::EDGetTokenT< edm::View< reco::Track > > tpToken_
TH2F * getTH2F(void) const
MonitorElement * h_goodMatch
void computeEfficiencyEta(MonitorElement *, MonitorElement *recoTH2, MonitorElement *simTH2)
edm::EDGetTokenT< edm::View< reco::Track > > tkToken_