110 std::vector<std::pair<RefToBase<Track>,
double> > rvGlb;
112 if (glbsimToRecoCollection.
find(tp) != glbsimToRecoCollection.
end()) {
113 rvGlb = glbsimToRecoCollection[tp];
114 if (!rvGlb.empty()) {
115 rGlb = rvGlb.begin()->first;
119 std::vector<std::pair<RefToBase<Track>,
double> > rvSta;
121 if (stasimToRecoCollection.
find(tp) != stasimToRecoCollection.
end()) {
122 rvSta = stasimToRecoCollection[tp];
123 if (!rvSta.empty()) {
124 rSta = rvSta.begin()->first;
128 std::vector<std::pair<RefToBase<Track>,
double> > rvTk;
130 if (tksimToRecoCollection.
find(tp) != tksimToRecoCollection.
end()) {
131 rvTk = tksimToRecoCollection[tp];
133 rTk = rvTk.begin()->first;
137 if (!rvSta.empty() && !rvTk.empty()) {
142 for (reco::MuonTrackLinksCollection::const_iterator
links = muHandle->begin();
links != muHandle->end(); ++
links) {
162 for (reco::MuonTrackLinksCollection::const_iterator
links = muHandle->begin();
links != muHandle->end(); ++
links) {
167 std::vector<std::pair<TrackingParticleRef, double> > tp1;
169 if (glbrecoToSimCollection.
find(glbRef) != glbrecoToSimCollection.
end()) {
170 tp1 = glbrecoToSimCollection[glbRef];
172 tp1r = tp1.begin()->first;
176 std::vector<std::pair<TrackingParticleRef, double> > tp2;
178 if (starecoToSimCollection.
find(staRef) != starecoToSimCollection.
end()) {
179 tp2 = starecoToSimCollection[staRef];
181 tp2r = tp2.begin()->first;
185 std::vector<std::pair<TrackingParticleRef, double> > tp3;
187 if (tkrecoToSimCollection.
find(tkRef) != tkrecoToSimCollection.
end()) {
188 tp3 = tkrecoToSimCollection[tkRef];
190 tp3r = tp3.begin()->first;
232 h_shouldMatch = ibooker.
book2D(
"h_shouldMatch",
"SIM associated to Tk and Sta", 50, -2.5, 2.5, 100, 0., 500.);
233 h_goodMatchSim = ibooker.
book2D(
"h_goodMatchSim",
"SIM associated to Glb Sta Tk", 50, -2.5, 2.5, 100, 0., 500.);
234 h_tkOnlySim = ibooker.
book2D(
"h_tkOnlySim",
"SIM associated to Glb Tk", 50, -2.5, 2.5, 100, 0., 500.);
235 h_staOnlySim = ibooker.
book2D(
"h_staOnlySim",
"SIM associated to Glb Sta", 50, -2.5, 2.5, 100, 0., 500.);
237 h_totReco = ibooker.
book2D(
"h_totReco",
"Total Glb Reconstructed", 50, -2.5, 2.5, 100, 0., 500.);
238 h_goodMatch = ibooker.
book2D(
"h_goodMatch",
"Sta and Tk from same SIM", 50, -2.5, 2.5, 100, 0., 500.);
239 h_fakeMatch = ibooker.
book2D(
"h_fakeMatch",
"Sta and Tk not from same SIM", 50, -2.5, 2.5, 100, 0., 500.);
241 h_effic = ibooker.
book1D(
"h_effic",
"Efficiency vs #eta", 50, -2.5, 2.5);
242 h_efficPt = ibooker.
book1D(
"h_efficPt",
"Efficiency vs p_{T}", 100, 0., 100.);
244 h_fake = ibooker.
book1D(
"h_fake",
"Fake fraction vs #eta", 50, -2.5, 2.5);
245 h_fakePt = ibooker.
book1D(
"h_fakePt",
"Fake fraction vs p_{T}", 100, 0., 100.);
252 TH1D *
reco = h1->ProjectionX();
255 TH1D *
sim = h2->ProjectionX();
257 TH1F *hEff = (TH1F *)reco->Clone();
261 hEff->SetName(
"tmp_" + TString(reco->GetName()));
266 float nSimHit = sim->GetBinContent(
bin);
267 float eff = hEff->GetBinContent(
bin);
269 if (nSimHit != 0 && eff <= 1) {
270 error =
sqrt(eff * (1 - eff) / nSimHit);
272 hEff->SetBinError(
bin, error);
282 TH1D *
reco = h1->ProjectionY();
285 TH1D *
sim = h2->ProjectionY();
287 TH1F *hEff = (TH1F *)reco->Clone();
291 hEff->SetName(
"tmp_" + TString(reco->GetName()));
294 int nBinsPt = hEff->GetNbinsX();
295 for (
int bin = 1;
bin <= nBinsPt;
bin++) {
296 float nSimHit = sim->GetBinContent(
bin);
297 float eff = hEff->GetBinContent(
bin);
299 if (nSimHit != 0 && eff <= 1) {
300 error =
sqrt(eff * (1 - eff) / nSimHit);
302 hEff->SetBinError(
bin, error);
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
MonitorElement * h_goodMatchSim
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * h_tkOnlySim
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
void setCurrentFolder(std::string const &fullpath)
MonitorElement * h_fakePt
const_iterator find(const key_type &k) const
find element with specified reference key
void dqmEndRun(const edm::Run &, const edm::EventSetup &) override
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_
void computeEfficiencyPt(MonitorElement *, MonitorElement *recoTH2, MonitorElement *simTH2)
double pt() const
track transverse momentum
edm::EDGetTokenT< edm::View< reco::Track > > staToken_
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
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
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
GlobalMuonMatchAnalyzer(const edm::ParameterSet &)
std::string subsystemname_
MonitorElement * h_efficPt
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
edm::EDGetTokenT< edm::View< reco::Track > > tpToken_
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
edm::InputTag tkAssociatorName_
MonitorElement * h_goodMatch
void computeEfficiencyEta(MonitorElement *, MonitorElement *recoTH2, MonitorElement *simTH2)
void save(std::string const &filename, std::string const &path="", std::string const &pattern="", std::string const &rewrite="", uint32_t run=0, uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, std::string const &fileupdate="RECREATE")
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > tkAssociatorToken_
edm::EDGetTokenT< edm::View< reco::Track > > tkToken_