27 simParticleToken_ = consumes<SimParticles>(
pset.getParameter<
edm::InputTag>(
"simTrack"));
28 simHitAssocToken_ = consumes<SimHitAssoc>(
pset.getParameter<
edm::InputTag>(
"simHitAssoc"));
29 muonToken_ = consumes<reco::MuonCollection>(
pset.getParameter<
edm::InputTag>(
"muon"));
34 rpcGeomTokenInRun_ = esConsumes<edm::Transition::BeginRun>();
39 h_.bookHistograms(booker, subDir_);
43 h_simParticleType = booker.
book1D(
"SimHitPType",
"SimHit particle type", 11, 0, 11);
44 h_simParticleType->
getTH1()->SetMinimum(0);
45 if (TH1 *
h = h_simParticleType->getTH1()) {
46 h->GetXaxis()->SetBinLabel(1,
"#mu^{-}");
47 h->GetXaxis()->SetBinLabel(2,
"#mu^{+}");
48 h->GetXaxis()->SetBinLabel(3,
"e^{-}");
49 h->GetXaxis()->SetBinLabel(4,
"e^{+}");
50 h->GetXaxis()->SetBinLabel(5,
"#pi^{+}");
51 h->GetXaxis()->SetBinLabel(6,
"#pi^{-}");
52 h->GetXaxis()->SetBinLabel(7,
"K^{+}");
53 h->GetXaxis()->SetBinLabel(8,
"K^{-}");
54 h->GetXaxis()->SetBinLabel(9,
"p^{+}");
55 h->GetXaxis()->SetBinLabel(10,
"p^{-}");
56 h->GetXaxis()->SetBinLabel(11,
"Other");
61 h_nRPCHitPerSimMuon = booker.
book1D(
"NRPCHitPerSimMuon",
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
62 h_nRPCHitPerSimMuonBarrel =
63 booker.
book1D(
"NRPCHitPerSimMuonBarrel",
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
64 h_nRPCHitPerSimMuonOverlap =
65 booker.
book1D(
"NRPCHitPerSimMuonOverlap",
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
66 h_nRPCHitPerSimMuonEndcap =
67 booker.
book1D(
"NRPCHitPerSimMuonEndcap",
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
69 h_nRPCHitPerRecoMuon = booker.
book1D(
"NRPCHitPerRecoMuon",
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
70 h_nRPCHitPerRecoMuonBarrel =
71 booker.
book1D(
"NRPCHitPerRecoMuonBarrel",
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
72 h_nRPCHitPerRecoMuonOverlap =
73 booker.
book1D(
"NRPCHitPerRecoMuonOverlap",
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
74 h_nRPCHitPerRecoMuonEndcap =
75 booker.
book1D(
"NRPCHitPerRecoMuonEndcap",
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
77 h_nRPCHitPerSimMuon->
getTH1()->SetMinimum(0);
78 h_nRPCHitPerSimMuonBarrel->getTH1()->SetMinimum(0);
79 h_nRPCHitPerSimMuonOverlap->getTH1()->SetMinimum(0);
80 h_nRPCHitPerSimMuonEndcap->getTH1()->SetMinimum(0);
82 h_nRPCHitPerRecoMuon->getTH1()->SetMinimum(0);
83 h_nRPCHitPerRecoMuonBarrel->getTH1()->SetMinimum(0);
84 h_nRPCHitPerRecoMuonOverlap->getTH1()->SetMinimum(0);
85 h_nRPCHitPerRecoMuonEndcap->getTH1()->SetMinimum(0);
87 float ptBins[] = {0, 1, 2, 5, 10, 20, 30, 50, 100, 200, 300, 500};
90 booker.
book1D(
"SimMuonBarrel_pt",
"SimMuon RPCHit in Barrel p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
92 booker.
book1D(
"SimMuonOverlap_pt",
"SimMuon RPCHit in Overlap p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
94 booker.
book1D(
"SimMuonEndcap_pt",
"SimMuon RPCHit in Endcap p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
96 booker.
book1D(
"SimMuonNoRPC_pt",
"SimMuon without RPCHit p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
97 h_simMuonBarrel_eta = booker.
book1D(
"SimMuonBarrel_eta",
"SimMuon RPCHit in Barrel #eta;#eta", 50, -2.5, 2.5);
98 h_simMuonOverlap_eta = booker.
book1D(
"SimMuonOverlap_eta",
"SimMuon RPCHit in Overlap #eta;#eta", 50, -2.5, 2.5);
99 h_simMuonEndcap_eta = booker.
book1D(
"SimMuonEndcap_eta",
"SimMuon RPCHit in Endcap #eta;#eta", 50, -2.5, 2.5);
100 h_simMuonNoRPC_eta = booker.
book1D(
"SimMuonNoRPC_eta",
"SimMuon without RPCHit #eta;#eta", 50, -2.5, 2.5);
101 h_simMuonBarrel_phi =
103 h_simMuonOverlap_phi =
105 h_simMuonEndcap_phi =
110 h_recoMuonBarrel_pt =
111 booker.
book1D(
"RecoMuonBarrel_pt",
"RecoMuon RPCHit in Barrel p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
112 h_recoMuonOverlap_pt =
113 booker.
book1D(
"RecoMuonOverlap_pt",
"RecoMuon RPCHit in Overlap p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
114 h_recoMuonEndcap_pt =
115 booker.
book1D(
"RecoMuonEndcap_pt",
"RecoMuon RPCHit in Endcap p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
117 booker.
book1D(
"RecoMuonNoRPC_pt",
"RecoMuon without RPCHit p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
118 h_recoMuonBarrel_eta = booker.
book1D(
"RecoMuonBarrel_eta",
"RecoMuon RPCHit in Barrel #eta;#eta", 50, -2.5, 2.5);
119 h_recoMuonOverlap_eta = booker.
book1D(
"RecoMuonOverlap_eta",
"RecoMuon RPCHit in Overlap #eta;#eta", 50, -2.5, 2.5);
120 h_recoMuonEndcap_eta = booker.
book1D(
"RecoMuonEndcap_eta",
"RecoMuon RPCHit in Endcap #eta;#eta", 50, -2.5, 2.5);
121 h_recoMuonNoRPC_eta = booker.
book1D(
"RecoMuonNoRPC_eta",
"RecoMuon without RPCHit #eta;#eta", 50, -2.5, 2.5);
122 h_recoMuonBarrel_phi =
124 h_recoMuonOverlap_phi =
126 h_recoMuonEndcap_phi =
128 h_recoMuonNoRPC_phi =
131 h_simMuonBarrel_pt->
getTH1()->SetMinimum(0);
132 h_simMuonOverlap_pt->getTH1()->SetMinimum(0);
133 h_simMuonEndcap_pt->getTH1()->SetMinimum(0);
134 h_simMuonNoRPC_pt->getTH1()->SetMinimum(0);
135 h_simMuonBarrel_eta->getTH1()->SetMinimum(0);
136 h_simMuonOverlap_eta->getTH1()->SetMinimum(0);
137 h_simMuonEndcap_eta->getTH1()->SetMinimum(0);
138 h_simMuonNoRPC_eta->getTH1()->SetMinimum(0);
139 h_simMuonBarrel_phi->getTH1()->SetMinimum(0);
140 h_simMuonOverlap_phi->getTH1()->SetMinimum(0);
141 h_simMuonEndcap_phi->getTH1()->SetMinimum(0);
142 h_simMuonNoRPC_phi->getTH1()->SetMinimum(0);
144 h_recoMuonBarrel_pt->getTH1()->SetMinimum(0);
145 h_recoMuonOverlap_pt->getTH1()->SetMinimum(0);
146 h_recoMuonEndcap_pt->getTH1()->SetMinimum(0);
147 h_recoMuonNoRPC_pt->getTH1()->SetMinimum(0);
148 h_recoMuonBarrel_eta->getTH1()->SetMinimum(0);
149 h_recoMuonOverlap_eta->getTH1()->SetMinimum(0);
150 h_recoMuonEndcap_eta->getTH1()->SetMinimum(0);
151 h_recoMuonNoRPC_eta->getTH1()->SetMinimum(0);
152 h_recoMuonBarrel_phi->getTH1()->SetMinimum(0);
153 h_recoMuonOverlap_phi->getTH1()->SetMinimum(0);
154 h_recoMuonEndcap_phi->getTH1()->SetMinimum(0);
155 h_recoMuonNoRPC_phi->getTH1()->SetMinimum(0);
159 h_eventCount = booker.
book1D(
"EventCount",
"Event count", 3, 1, 4);
160 h_eventCount->
getTH1()->SetMinimum(0);
162 TH1 *
h = h_eventCount->getTH1();
163 h->GetXaxis()->SetBinLabel(1,
"eventBegin");
164 h->GetXaxis()->SetBinLabel(2,
"eventEnd");
165 h->GetXaxis()->SetBinLabel(3,
"run");
167 h_eventCount->Fill(3);
169 h_refPunchOccupancyBarrel_wheel =
170 booker.
book1D(
"RefPunchOccupancyBarrel_wheel",
"RefPunchthrough occupancy", 5, -2.5, 2.5);
171 h_refPunchOccupancyEndcap_disk =
172 booker.
book1D(
"RefPunchOccupancyEndcap_disk",
"RefPunchthrough occupancy", 9, -4.5, 4.5);
173 h_refPunchOccupancyBarrel_station =
174 booker.
book1D(
"RefPunchOccupancyBarrel_station",
"RefPunchthrough occupancy", 4, 0.5, 4.5);
175 h_recPunchOccupancyBarrel_wheel =
176 booker.
book1D(
"RecPunchOccupancyBarrel_wheel",
"Punchthrough recHit occupancy", 5, -2.5, 2.5);
177 h_recPunchOccupancyEndcap_disk =
178 booker.
book1D(
"RecPunchOccupancyEndcap_disk",
"Punchthrough recHit occupancy", 9, -4.5, 4.5);
179 h_recPunchOccupancyBarrel_station =
180 booker.
book1D(
"RecPunchOccupancyBarrel_station",
"Punchthrough recHit occupancy", 4, 0.5, 4.5);
182 h_refPunchOccupancyBarrel_wheel->
getTH1()->SetMinimum(0);
183 h_refPunchOccupancyEndcap_disk->getTH1()->SetMinimum(0);
184 h_refPunchOccupancyBarrel_station->getTH1()->SetMinimum(0);
185 h_recPunchOccupancyBarrel_wheel->getTH1()->SetMinimum(0);
186 h_recPunchOccupancyEndcap_disk->getTH1()->SetMinimum(0);
187 h_recPunchOccupancyBarrel_station->getTH1()->SetMinimum(0);
189 h_refPunchOccupancyBarrel_wheel_station =
190 booker.
book2D(
"RefPunchOccupancyBarrel_wheel_station",
"RefPunchthrough occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
191 h_refPunchOccupancyEndcap_disk_ring =
192 booker.
book2D(
"RefPunchOccupancyEndcap_disk_ring",
"RefPunchthrough occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
193 h_recPunchOccupancyBarrel_wheel_station = booker.
book2D(
194 "RecPunchOccupancyBarrel_wheel_station",
"Punchthrough recHit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
195 h_recPunchOccupancyEndcap_disk_ring =
196 booker.
book2D(
"RecPunchOccupancyEndcap_disk_ring",
"Punchthrough recHit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
198 h_refPunchOccupancyBarrel_wheel_station->
getTH2F()->SetOption(
"COLZ");
199 h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetOption(
"COLZ");
200 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetOption(
"COLZ");
201 h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetOption(
"COLZ");
203 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
204 h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetContour(10);
205 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
206 h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetContour(10);
208 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetStats(
false);
209 h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetStats(
false);
210 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetStats(
false);
211 h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetStats(
false);
213 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
214 h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetMinimum(0);
215 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
216 h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetMinimum(0);
218 for (
int i = 1;
i <= 5; ++
i) {
219 TString binLabel = Form(
"Wheel %d",
i - 3);
220 h_refPunchOccupancyBarrel_wheel->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
221 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
222 h_recPunchOccupancyBarrel_wheel->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
223 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
226 for (
int i = 1;
i <= 9; ++
i) {
227 TString binLabel = Form(
"Disk %d",
i - 5);
228 h_refPunchOccupancyEndcap_disk->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
229 h_refPunchOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
230 h_recPunchOccupancyEndcap_disk->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
231 h_recPunchOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
234 for (
int i = 1;
i <= 4; ++
i) {
235 TString binLabel = Form(
"Station %d",
i);
236 h_refPunchOccupancyBarrel_station->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
237 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
238 h_recPunchOccupancyBarrel_station->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
239 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
242 for (
int i = 1;
i <= 4; ++
i) {
243 TString binLabel = Form(
"Ring %d",
i);
244 h_refPunchOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
245 h_recPunchOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
249 auto rpcGeom = eventSetup.
getHandle(rpcGeomTokenInRun_);
251 int nRPCRollBarrel = 0, nRPCRollEndcap = 0;
254 for (
auto det : rpcDets) {
255 auto rpcCh = dynamic_cast<const RPCChamber *>(det);
259 std::vector<const RPCRoll *> rolls = rpcCh->rolls();
260 for (
auto roll : rolls) {
265 const int rawId = roll->geographicalId().rawId();
269 if (roll->isBarrel()) {
270 detIdToIndexMapBarrel_[rawId] = nRPCRollBarrel;
274 detIdToIndexMapEndcap_[rawId] = nRPCRollEndcap;
282 h_matchOccupancyBarrel_detId = booker.
book1D(
"MatchOccupancyBarrel_detId",
283 "Matched hit occupancy;roll index (can be arbitrary)",
287 h_matchOccupancyEndcap_detId = booker.
book1D(
"MatchOccupancyEndcap_detId",
288 "Matched hit occupancy;roll index (can be arbitrary)",
292 h_refOccupancyBarrel_detId = booker.
book1D(
"RefOccupancyBarrel_detId",
293 "Reference hit occupancy;roll index (can be arbitrary)",
297 h_refOccupancyEndcap_detId = booker.
book1D(
"RefOccupancyEndcap_detId",
298 "Reference hit occupancy;roll index (can be arbitrary)",
302 h_noiseOccupancyBarrel_detId = booker.
book1D(
303 "NoiseOccupancyBarrel_detId",
"Noise occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel);
304 h_noiseOccupancyEndcap_detId = booker.
book1D(
305 "NoiseOccupancyEndcap_detId",
"Noise occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap);
307 h_matchOccupancyBarrel_detId->
getTH1()->SetMinimum(0);
308 h_matchOccupancyEndcap_detId->getTH1()->SetMinimum(0);
309 h_refOccupancyBarrel_detId->getTH1()->SetMinimum(0);
310 h_refOccupancyEndcap_detId->getTH1()->SetMinimum(0);
311 h_noiseOccupancyBarrel_detId->getTH1()->SetMinimum(0);
312 h_noiseOccupancyEndcap_detId->getTH1()->SetMinimum(0);
315 "RollAreaBarrel_detId",
"Roll area;roll index;Area", nRPCRollBarrel, 0., 1. * nRPCRollBarrel, 0., 1
e5);
317 "RollAreaEndcap_detId",
"Roll area;roll index;Area", nRPCRollEndcap, 0., 1. * nRPCRollEndcap, 0., 1
e5);
319 for (
auto detIdToIndex : detIdToIndexMapBarrel_) {
320 const int rawId = detIdToIndex.first;
321 const int index = detIdToIndex.second;
323 const RPCDetId rpcDetId = static_cast<const RPCDetId>(rawId);
324 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(rpcDetId));
331 const double area = topol.stripLength() * topol.nstrips() * topol.pitch();
333 h_rollAreaBarrel_detId->Fill(
index,
area);
336 for (
auto detIdToIndex : detIdToIndexMapEndcap_) {
337 const int rawId = detIdToIndex.first;
338 const int index = detIdToIndex.second;
340 const RPCDetId rpcDetId = static_cast<const RPCDetId>(rawId);
341 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(rpcDetId));
348 const double area = topol.stripLength() * topol.nstrips() * topol.pitch();
350 h_rollAreaEndcap_detId->Fill(
index,
area);
355 h_eventCount->Fill(1);
358 auto rpcGeom = eventSetup.
getHandle(rpcGeomToken_);
362 if (!
event.getByToken(simHitToken_, simHitHandle)) {
363 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find simHit collection\n";
369 if (!
event.getByToken(recHitToken_, recHitHandle)) {
370 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find recHit collection\n";
376 if (!
event.getByToken(simParticleToken_, simParticleHandle)) {
377 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle collection\n";
383 if (!
event.getByToken(simHitAssocToken_, simHitsTPAssoc)) {
384 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle to SimHit association map\n";
390 if (!
event.getByToken(muonToken_, muonHandle)) {
391 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find muon collection\n";
395 typedef edm::PSimHitContainer::const_iterator SimHitIter;
397 typedef std::vector<TrackPSimHitRef> SimHitRefs;
400 SimHitRefs muonSimHits, pthrSimHits;
402 for (
int i = 0,
n = simParticleHandle->size();
i <
n; ++
i) {
404 if (simParticle->pt() < 1.0
or simParticle->p() < 2.5)
408 SimHitRefs simHitsFromParticle;
409 auto range = std::equal_range(simHitsTPAssoc->begin(),
410 simHitsTPAssoc->end(),
413 for (
auto simParticleToHit =
range.first; simParticleToHit !=
range.second; ++simParticleToHit) {
414 auto simHit = simParticleToHit->second;
419 simHitsFromParticle.push_back(simParticleToHit->second);
421 const int nRPCHit = simHitsFromParticle.size();
422 const bool hasRPCHit = nRPCHit > 0;
424 if (
abs(simParticle->pdgId()) == 13) {
425 muonSimHits.insert(muonSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
428 int nRPCHitBarrel = 0;
429 int nRPCHitEndcap = 0;
430 for (
const auto &
simHit : simHitsFromParticle) {
431 const RPCDetId rpcDetId = static_cast<const RPCDetId>(
simHit->detUnitId());
432 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(rpcDetId));
436 if (rpcDetId.
region() == 0)
443 h_nRPCHitPerSimMuon->Fill(nRPCHit);
444 if (nRPCHitBarrel and nRPCHitEndcap) {
445 h_nRPCHitPerSimMuonOverlap->Fill(nRPCHit);
446 h_simMuonOverlap_pt->Fill(simParticle->pt());
447 h_simMuonOverlap_eta->Fill(simParticle->eta());
448 h_simMuonOverlap_phi->Fill(simParticle->phi());
449 }
else if (nRPCHitBarrel) {
450 h_nRPCHitPerSimMuonBarrel->Fill(nRPCHit);
451 h_simMuonBarrel_pt->Fill(simParticle->pt());
452 h_simMuonBarrel_eta->Fill(simParticle->eta());
453 h_simMuonBarrel_phi->Fill(simParticle->phi());
454 }
else if (nRPCHitEndcap) {
455 h_nRPCHitPerSimMuonEndcap->Fill(nRPCHit);
456 h_simMuonEndcap_pt->Fill(simParticle->pt());
457 h_simMuonEndcap_eta->Fill(simParticle->eta());
458 h_simMuonEndcap_phi->Fill(simParticle->phi());
460 h_simMuonNoRPC_pt->Fill(simParticle->pt());
461 h_simMuonNoRPC_eta->Fill(simParticle->eta());
462 h_simMuonNoRPC_phi->Fill(simParticle->phi());
465 pthrSimHits.insert(pthrSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
469 switch (simParticle->pdgId()) {
471 h_simParticleType->Fill(0);
474 h_simParticleType->Fill(1);
477 h_simParticleType->Fill(2);
480 h_simParticleType->Fill(3);
483 h_simParticleType->Fill(4);
486 h_simParticleType->Fill(5);
489 h_simParticleType->Fill(6);
492 h_simParticleType->Fill(7);
495 h_simParticleType->Fill(8);
498 h_simParticleType->Fill(9);
501 h_simParticleType->Fill(10);
508 int nRefHitBarrel = 0, nRefHitEndcap = 0;
509 for (
const auto &
simHit : muonSimHits) {
510 const RPCDetId detId = static_cast<const RPCDetId>(
simHit->detUnitId());
511 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(detId));
513 const int region = roll->id().region();
514 const int ring = roll->id().ring();
516 const int station = roll->id().station();
522 h_.refHitOccupancyBarrel_wheel->Fill(
ring);
523 h_.refHitOccupancyBarrel_station->Fill(
station);
524 h_.refHitOccupancyBarrel_wheel_station->Fill(
ring,
station);
526 h_refOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[
simHit->detUnitId()]);
532 h_refOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[
simHit->detUnitId()]);
538 for (
const auto &
simHit : pthrSimHits) {
539 const RPCDetId detId = static_cast<const RPCDetId>(
simHit->detUnitId());
540 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(detId()));
542 const int region = roll->id().region();
543 const int ring = roll->id().ring();
545 const int station = roll->id().station();
551 h_refPunchOccupancyBarrel_wheel->Fill(
ring);
552 h_refPunchOccupancyBarrel_station->Fill(
station);
553 h_refPunchOccupancyBarrel_wheel_station->Fill(
ring,
station);
555 h_refOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[
simHit->detUnitId()]);
561 h_refOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[
simHit->detUnitId()]);
564 h_.nRefHitBarrel->Fill(nRefHitBarrel);
565 h_.nRefHitEndcap->Fill(nRefHitEndcap);
568 int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
569 int nRecHitBarrel = 0, nRecHitEndcap = 0;
570 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
571 const RPCDetId detId = static_cast<const RPCDetId>(recHitIter->rpcId());
572 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(detId()));
576 const int region = roll->id().region();
577 const int ring = roll->id().ring();
579 const int station = roll->id().station();
583 const double time = recHitIter->timeError() >= 0 ? recHitIter->time() : recHitIter->BunchX() * 25;
585 h_.clusterSize->Fill(recHitIter->clusterSize());
589 sumClusterSizeBarrel += recHitIter->clusterSize();
590 h_.clusterSizeBarrel->Fill(recHitIter->clusterSize());
591 h_.recHitOccupancyBarrel_wheel->Fill(
ring);
592 h_.recHitOccupancyBarrel_station->Fill(
station);
593 h_.recHitOccupancyBarrel_wheel_station->Fill(
ring,
station);
595 h_.timeBarrel->Fill(
time);
598 sumClusterSizeEndcap += recHitIter->clusterSize();
599 h_.clusterSizeEndcap->Fill(recHitIter->clusterSize());
603 h_.timeEndcap->Fill(
time);
606 if (roll->isIRPC()) {
607 h_.timeIRPC->Fill(
time);
609 h_.timeCRPC->Fill(
time);
612 const double nRecHit = nRecHitBarrel + nRecHitEndcap;
613 h_.nRecHitBarrel->Fill(nRecHitBarrel);
614 h_.nRecHitEndcap->Fill(nRecHitEndcap);
616 const int sumClusterSize = sumClusterSizeBarrel + sumClusterSizeEndcap;
617 h_.avgClusterSize->Fill(
double(sumClusterSize) / nRecHit);
619 if (nRecHitBarrel > 0) {
620 h_.avgClusterSizeBarrel->Fill(
double(sumClusterSizeBarrel) / nRecHitBarrel);
622 if (nRecHitEndcap > 0) {
623 h_.avgClusterSizeEndcap->Fill(
double(sumClusterSizeEndcap) / nRecHitEndcap);
628 typedef std::map<TrackPSimHitRef, RecHitIter> SimToRecHitMap;
629 SimToRecHitMap simToRecHitMap;
631 for (
const auto &
simHit : muonSimHits) {
632 const RPCDetId simDetId = static_cast<const RPCDetId>(
simHit->detUnitId());
636 const double simX =
simHit->localPosition().x();
638 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
639 const RPCDetId recDetId = static_cast<const RPCDetId>(recHitIter->rpcId());
640 const RPCRoll *recRoll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(recDetId));
644 if (simDetId != recDetId)
647 const double recX = recHitIter->localPosition().x();
648 const double newDx = fabs(recX - simX);
651 SimToRecHitMap::const_iterator prevSimToReco = simToRecHitMap.find(
simHit);
652 if (prevSimToReco == simToRecHitMap.end()) {
653 simToRecHitMap.insert(std::make_pair(
simHit, recHitIter));
655 const double oldDx = fabs(prevSimToReco->second->localPosition().x() - simX);
658 simToRecHitMap[
simHit] = recHitIter;
666 int nMatchHitBarrel = 0, nMatchHitEndcap = 0;
667 for (
const auto &
match : simToRecHitMap) {
669 RecHitIter recHitIter =
match.second;
671 const RPCDetId detId = static_cast<const RPCDetId>(
simHit->detUnitId());
672 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(detId));
674 const int region = roll->id().region();
675 const int ring = roll->id().ring();
677 const int station = roll->id().station();
681 const double simX =
simHit->localPosition().x();
682 const double recX = recHitIter->localPosition().x();
683 const double errX =
sqrt(recHitIter->localPositionError().xx());
684 const double dX = recX - simX;
685 const double pull =
errX == 0 ? -999 : dX /
errX;
692 h_.resBarrel->Fill(dX);
693 h_.pullBarrel->Fill(pull);
694 h_.matchOccupancyBarrel_wheel->Fill(
ring);
695 h_.matchOccupancyBarrel_station->Fill(
station);
696 h_.matchOccupancyBarrel_wheel_station->Fill(
ring,
station);
698 h_.res_wheel_res->Fill(
ring, dX);
699 h_.res_station_res->Fill(
station, dX);
700 h_.pull_wheel_pull->Fill(
ring, pull);
701 h_.pull_station_pull->Fill(
station, pull);
703 h_matchOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[detId.
rawId()]);
706 h_.resEndcap->Fill(dX);
707 h_.pullEndcap->Fill(pull);
712 h_.res_ring_res->Fill(
ring, dX);
714 h_.pull_ring_pull->Fill(
ring, pull);
716 h_matchOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[detId.
rawId()]);
719 h_.nMatchHitBarrel->Fill(nMatchHitBarrel);
720 h_.nMatchHitEndcap->Fill(nMatchHitEndcap);
723 for (reco::MuonCollection::const_iterator
muon = muonHandle->begin();
muon != muonHandle->end(); ++
muon) {
724 if (!
muon->isGlobalMuon())
727 int nRPCHitBarrel = 0;
728 int nRPCHitEndcap = 0;
732 if (!(*recHit)->isValid())
734 const DetId detId = (*recHit)->geographicalId();
737 const RPCDetId rpcDetId = static_cast<const RPCDetId>(detId);
739 if (rpcDetId.
region() == 0)
745 const int nRPCHit = nRPCHitBarrel + nRPCHitEndcap;
746 h_nRPCHitPerRecoMuon->Fill(nRPCHit);
747 if (nRPCHitBarrel and nRPCHitEndcap) {
748 h_nRPCHitPerRecoMuonOverlap->Fill(nRPCHit);
749 h_recoMuonOverlap_pt->Fill(
muon->pt());
750 h_recoMuonOverlap_eta->Fill(
muon->eta());
751 h_recoMuonOverlap_phi->Fill(
muon->phi());
752 }
else if (nRPCHitBarrel) {
753 h_nRPCHitPerRecoMuonBarrel->Fill(nRPCHit);
754 h_recoMuonBarrel_pt->Fill(
muon->pt());
755 h_recoMuonBarrel_eta->Fill(
muon->eta());
756 h_recoMuonBarrel_phi->Fill(
muon->phi());
757 }
else if (nRPCHitEndcap) {
758 h_nRPCHitPerRecoMuonEndcap->Fill(nRPCHit);
759 h_recoMuonEndcap_pt->Fill(
muon->pt());
760 h_recoMuonEndcap_eta->Fill(
muon->eta());
761 h_recoMuonEndcap_phi->Fill(
muon->phi());
763 h_recoMuonNoRPC_pt->Fill(
muon->pt());
764 h_recoMuonNoRPC_eta->Fill(
muon->eta());
765 h_recoMuonNoRPC_phi->Fill(
muon->phi());
770 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
771 const RPCDetId detId = static_cast<const RPCDetId>(recHitIter->rpcId());
772 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(detId));
774 const int region = roll->id().region();
775 const int ring = roll->id().ring();
777 const int station = roll->id().station();
782 for (
const auto &
match : simToRecHitMap) {
783 if (recHitIter ==
match.second) {
790 int nPunchMatched = 0;
792 for (
const auto &
simHit : pthrSimHits) {
793 const int absSimHitPType =
abs(
simHit->particleType());
794 if (absSimHitPType == 13)
797 const RPCDetId simDetId = static_cast<const RPCDetId>(
simHit->detUnitId());
798 if (simDetId == detId)
802 if (nPunchMatched > 0) {
804 h_recPunchOccupancyBarrel_wheel->Fill(
ring);
805 h_recPunchOccupancyBarrel_station->Fill(
station);
806 h_recPunchOccupancyBarrel_wheel_station->Fill(
ring,
station);
816 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
817 const RPCDetId recDetId = static_cast<const RPCDetId>(recHitIter->rpcId());
818 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(recDetId));
820 const int region = roll->id().region();
827 const double recX = recHitIter->localPosition().x();
828 const double recErrX =
sqrt(recHitIter->localPositionError().xx());
831 for (SimHitIter simHitIter = simHitHandle->begin(); simHitIter != simHitHandle->end(); ++simHitIter) {
832 const RPCDetId simDetId = static_cast<const RPCDetId>(simHitIter->detUnitId());
833 const RPCRoll *simRoll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(simDetId));
837 if (simDetId != recDetId)
840 const double simX = simHitIter->localPosition().x();
841 const double dX = fabs(recX - simX);
843 if (dX / recErrX < 5) {
851 h_noiseOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[recDetId.
rawId()]);
853 h_noiseOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[recDetId.
rawId()]);
858 h_eventCount->Fill(2);