29 simParticleToken_ = consumes<SimParticles>(
pset.getParameter<
edm::InputTag>(
"simTrack"));
30 simHitAssocToken_ = consumes<SimHitAssoc>(
pset.getParameter<
edm::InputTag>(
"simHitAssoc"));
31 muonToken_ = consumes<reco::MuonCollection>(
pset.getParameter<
edm::InputTag>(
"muon"));
38 h_.bookHistograms(booker, subDir_);
42 h_simParticleType = booker.
book1D(
"SimHitPType",
"SimHit particle type", 11, 0, 11);
43 h_simParticleType->
getTH1()->SetMinimum(0);
44 if (TH1 *
h = h_simParticleType->getTH1()) {
45 h->GetXaxis()->SetBinLabel(1,
"#mu^{-}");
46 h->GetXaxis()->SetBinLabel(2,
"#mu^{+}");
47 h->GetXaxis()->SetBinLabel(3,
"e^{-}");
48 h->GetXaxis()->SetBinLabel(4,
"e^{+}");
49 h->GetXaxis()->SetBinLabel(5,
"#pi^{+}");
50 h->GetXaxis()->SetBinLabel(6,
"#pi^{-}");
51 h->GetXaxis()->SetBinLabel(7,
"K^{+}");
52 h->GetXaxis()->SetBinLabel(8,
"K^{-}");
53 h->GetXaxis()->SetBinLabel(9,
"p^{+}");
54 h->GetXaxis()->SetBinLabel(10,
"p^{-}");
55 h->GetXaxis()->SetBinLabel(11,
"Other");
60 h_nRPCHitPerSimMuon = booker.
book1D(
"NRPCHitPerSimMuon",
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
61 h_nRPCHitPerSimMuonBarrel =
62 booker.
book1D(
"NRPCHitPerSimMuonBarrel",
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
63 h_nRPCHitPerSimMuonOverlap =
64 booker.
book1D(
"NRPCHitPerSimMuonOverlap",
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
65 h_nRPCHitPerSimMuonEndcap =
66 booker.
book1D(
"NRPCHitPerSimMuonEndcap",
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
68 h_nRPCHitPerRecoMuon = booker.
book1D(
"NRPCHitPerRecoMuon",
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
69 h_nRPCHitPerRecoMuonBarrel =
70 booker.
book1D(
"NRPCHitPerRecoMuonBarrel",
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
71 h_nRPCHitPerRecoMuonOverlap =
72 booker.
book1D(
"NRPCHitPerRecoMuonOverlap",
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
73 h_nRPCHitPerRecoMuonEndcap =
74 booker.
book1D(
"NRPCHitPerRecoMuonEndcap",
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
76 h_nRPCHitPerSimMuon->
getTH1()->SetMinimum(0);
77 h_nRPCHitPerSimMuonBarrel->getTH1()->SetMinimum(0);
78 h_nRPCHitPerSimMuonOverlap->getTH1()->SetMinimum(0);
79 h_nRPCHitPerSimMuonEndcap->getTH1()->SetMinimum(0);
81 h_nRPCHitPerRecoMuon->getTH1()->SetMinimum(0);
82 h_nRPCHitPerRecoMuonBarrel->getTH1()->SetMinimum(0);
83 h_nRPCHitPerRecoMuonOverlap->getTH1()->SetMinimum(0);
84 h_nRPCHitPerRecoMuonEndcap->getTH1()->SetMinimum(0);
86 float ptBins[] = {0, 1, 2, 5, 10, 20, 30, 50, 100, 200, 300, 500};
89 booker.
book1D(
"SimMuonBarrel_pt",
"SimMuon RPCHit in Barrel p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
91 booker.
book1D(
"SimMuonOverlap_pt",
"SimMuon RPCHit in Overlap p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
93 booker.
book1D(
"SimMuonEndcap_pt",
"SimMuon RPCHit in Endcap p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
95 booker.
book1D(
"SimMuonNoRPC_pt",
"SimMuon without RPCHit p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
96 h_simMuonBarrel_eta = booker.
book1D(
"SimMuonBarrel_eta",
"SimMuon RPCHit in Barrel #eta;#eta", 50, -2.5, 2.5);
97 h_simMuonOverlap_eta = booker.
book1D(
"SimMuonOverlap_eta",
"SimMuon RPCHit in Overlap #eta;#eta", 50, -2.5, 2.5);
98 h_simMuonEndcap_eta = booker.
book1D(
"SimMuonEndcap_eta",
"SimMuon RPCHit in Endcap #eta;#eta", 50, -2.5, 2.5);
99 h_simMuonNoRPC_eta = booker.
book1D(
"SimMuonNoRPC_eta",
"SimMuon without RPCHit #eta;#eta", 50, -2.5, 2.5);
100 h_simMuonBarrel_phi =
102 h_simMuonOverlap_phi =
104 h_simMuonEndcap_phi =
109 h_recoMuonBarrel_pt =
110 booker.
book1D(
"RecoMuonBarrel_pt",
"RecoMuon RPCHit in Barrel p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
111 h_recoMuonOverlap_pt =
112 booker.
book1D(
"RecoMuonOverlap_pt",
"RecoMuon RPCHit in Overlap p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
113 h_recoMuonEndcap_pt =
114 booker.
book1D(
"RecoMuonEndcap_pt",
"RecoMuon RPCHit in Endcap p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
116 booker.
book1D(
"RecoMuonNoRPC_pt",
"RecoMuon without RPCHit p_{T};p_{T} [GeV/c^{2}]",
nPtBins,
ptBins);
117 h_recoMuonBarrel_eta = booker.
book1D(
"RecoMuonBarrel_eta",
"RecoMuon RPCHit in Barrel #eta;#eta", 50, -2.5, 2.5);
118 h_recoMuonOverlap_eta = booker.
book1D(
"RecoMuonOverlap_eta",
"RecoMuon RPCHit in Overlap #eta;#eta", 50, -2.5, 2.5);
119 h_recoMuonEndcap_eta = booker.
book1D(
"RecoMuonEndcap_eta",
"RecoMuon RPCHit in Endcap #eta;#eta", 50, -2.5, 2.5);
120 h_recoMuonNoRPC_eta = booker.
book1D(
"RecoMuonNoRPC_eta",
"RecoMuon without RPCHit #eta;#eta", 50, -2.5, 2.5);
121 h_recoMuonBarrel_phi =
123 h_recoMuonOverlap_phi =
125 h_recoMuonEndcap_phi =
127 h_recoMuonNoRPC_phi =
130 h_simMuonBarrel_pt->
getTH1()->SetMinimum(0);
131 h_simMuonOverlap_pt->getTH1()->SetMinimum(0);
132 h_simMuonEndcap_pt->getTH1()->SetMinimum(0);
133 h_simMuonNoRPC_pt->getTH1()->SetMinimum(0);
134 h_simMuonBarrel_eta->getTH1()->SetMinimum(0);
135 h_simMuonOverlap_eta->getTH1()->SetMinimum(0);
136 h_simMuonEndcap_eta->getTH1()->SetMinimum(0);
137 h_simMuonNoRPC_eta->getTH1()->SetMinimum(0);
138 h_simMuonBarrel_phi->getTH1()->SetMinimum(0);
139 h_simMuonOverlap_phi->getTH1()->SetMinimum(0);
140 h_simMuonEndcap_phi->getTH1()->SetMinimum(0);
141 h_simMuonNoRPC_phi->getTH1()->SetMinimum(0);
143 h_recoMuonBarrel_pt->getTH1()->SetMinimum(0);
144 h_recoMuonOverlap_pt->getTH1()->SetMinimum(0);
145 h_recoMuonEndcap_pt->getTH1()->SetMinimum(0);
146 h_recoMuonNoRPC_pt->getTH1()->SetMinimum(0);
147 h_recoMuonBarrel_eta->getTH1()->SetMinimum(0);
148 h_recoMuonOverlap_eta->getTH1()->SetMinimum(0);
149 h_recoMuonEndcap_eta->getTH1()->SetMinimum(0);
150 h_recoMuonNoRPC_eta->getTH1()->SetMinimum(0);
151 h_recoMuonBarrel_phi->getTH1()->SetMinimum(0);
152 h_recoMuonOverlap_phi->getTH1()->SetMinimum(0);
153 h_recoMuonEndcap_phi->getTH1()->SetMinimum(0);
154 h_recoMuonNoRPC_phi->getTH1()->SetMinimum(0);
158 h_eventCount = booker.
book1D(
"EventCount",
"Event count", 3, 1, 4);
159 h_eventCount->
getTH1()->SetMinimum(0);
161 TH1 *
h = h_eventCount->getTH1();
162 h->GetXaxis()->SetBinLabel(1,
"eventBegin");
163 h->GetXaxis()->SetBinLabel(2,
"eventEnd");
164 h->GetXaxis()->SetBinLabel(3,
"run");
166 h_eventCount->Fill(3);
168 h_refPunchOccupancyBarrel_wheel =
169 booker.
book1D(
"RefPunchOccupancyBarrel_wheel",
"RefPunchthrough occupancy", 5, -2.5, 2.5);
170 h_refPunchOccupancyEndcap_disk =
171 booker.
book1D(
"RefPunchOccupancyEndcap_disk",
"RefPunchthrough occupancy", 9, -4.5, 4.5);
172 h_refPunchOccupancyBarrel_station =
173 booker.
book1D(
"RefPunchOccupancyBarrel_station",
"RefPunchthrough occupancy", 4, 0.5, 4.5);
174 h_recPunchOccupancyBarrel_wheel =
175 booker.
book1D(
"RecPunchOccupancyBarrel_wheel",
"Punchthrough recHit occupancy", 5, -2.5, 2.5);
176 h_recPunchOccupancyEndcap_disk =
177 booker.
book1D(
"RecPunchOccupancyEndcap_disk",
"Punchthrough recHit occupancy", 9, -4.5, 4.5);
178 h_recPunchOccupancyBarrel_station =
179 booker.
book1D(
"RecPunchOccupancyBarrel_station",
"Punchthrough recHit occupancy", 4, 0.5, 4.5);
181 h_refPunchOccupancyBarrel_wheel->
getTH1()->SetMinimum(0);
182 h_refPunchOccupancyEndcap_disk->getTH1()->SetMinimum(0);
183 h_refPunchOccupancyBarrel_station->getTH1()->SetMinimum(0);
184 h_recPunchOccupancyBarrel_wheel->getTH1()->SetMinimum(0);
185 h_recPunchOccupancyEndcap_disk->getTH1()->SetMinimum(0);
186 h_recPunchOccupancyBarrel_station->getTH1()->SetMinimum(0);
188 h_refPunchOccupancyBarrel_wheel_station =
189 booker.
book2D(
"RefPunchOccupancyBarrel_wheel_station",
"RefPunchthrough occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
190 h_refPunchOccupancyEndcap_disk_ring =
191 booker.
book2D(
"RefPunchOccupancyEndcap_disk_ring",
"RefPunchthrough occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
192 h_recPunchOccupancyBarrel_wheel_station = booker.
book2D(
193 "RecPunchOccupancyBarrel_wheel_station",
"Punchthrough recHit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
194 h_recPunchOccupancyEndcap_disk_ring =
195 booker.
book2D(
"RecPunchOccupancyEndcap_disk_ring",
"Punchthrough recHit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
197 h_refPunchOccupancyBarrel_wheel_station->
getTH2F()->SetOption(
"COLZ");
198 h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetOption(
"COLZ");
199 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetOption(
"COLZ");
200 h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetOption(
"COLZ");
202 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
203 h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetContour(10);
204 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
205 h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetContour(10);
207 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetStats(
false);
208 h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetStats(
false);
209 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetStats(
false);
210 h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetStats(
false);
212 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
213 h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetMinimum(0);
214 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
215 h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetMinimum(0);
217 for (
int i = 1;
i <= 5; ++
i) {
218 TString binLabel = Form(
"Wheel %d",
i - 3);
219 h_refPunchOccupancyBarrel_wheel->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
220 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
221 h_recPunchOccupancyBarrel_wheel->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
222 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
225 for (
int i = 1;
i <= 9; ++
i) {
226 TString binLabel = Form(
"Disk %d",
i - 5);
227 h_refPunchOccupancyEndcap_disk->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
228 h_refPunchOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
229 h_recPunchOccupancyEndcap_disk->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
230 h_recPunchOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
233 for (
int i = 1;
i <= 4; ++
i) {
234 TString binLabel = Form(
"Station %d",
i);
235 h_refPunchOccupancyBarrel_station->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
236 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
237 h_recPunchOccupancyBarrel_station->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
238 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
241 for (
int i = 1;
i <= 4; ++
i) {
242 TString binLabel = Form(
"Ring %d",
i);
243 h_refPunchOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
244 h_recPunchOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
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., 1e5);
317 "RollAreaEndcap_detId",
"Roll area;roll index;Area", nRPCRollEndcap, 0., 1. * nRPCRollEndcap, 0., 1e5);
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);
363 if (!
event.getByToken(simHitToken_, simHitHandle)) {
364 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find simHit collection\n";
370 if (!
event.getByToken(recHitToken_, recHitHandle)) {
371 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find recHit collection\n";
377 if (!
event.getByToken(simParticleToken_, simParticleHandle)) {
378 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle collection\n";
384 if (!
event.getByToken(simHitAssocToken_, simHitsTPAssoc)) {
385 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle to SimHit association map\n";
391 if (!
event.getByToken(muonToken_, muonHandle)) {
392 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find muon collection\n";
396 typedef edm::PSimHitContainer::const_iterator SimHitIter;
398 typedef std::vector<TrackPSimHitRef> SimHitRefs;
401 SimHitRefs muonSimHits, pthrSimHits;
403 for (
int i = 0,
n = simParticleHandle->size();
i <
n; ++
i) {
405 if (simParticle->pt() < 1.0
or simParticle->p() < 2.5)
409 SimHitRefs simHitsFromParticle;
410 auto range = std::equal_range(simHitsTPAssoc->begin(),
411 simHitsTPAssoc->end(),
414 for (
auto simParticleToHit =
range.first; simParticleToHit !=
range.second; ++simParticleToHit) {
415 auto simHit = simParticleToHit->second;
420 simHitsFromParticle.push_back(simParticleToHit->second);
422 const int nRPCHit = simHitsFromParticle.size();
423 const bool hasRPCHit = nRPCHit > 0;
425 if (
abs(simParticle->pdgId()) == 13) {
426 muonSimHits.insert(muonSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
429 int nRPCHitBarrel = 0;
430 int nRPCHitEndcap = 0;
431 for (
const auto &
simHit : simHitsFromParticle) {
432 const RPCDetId rpcDetId = static_cast<const RPCDetId>(
simHit->detUnitId());
433 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->
roll(rpcDetId));
437 if (rpcDetId.
region() == 0)
444 h_nRPCHitPerSimMuon->Fill(nRPCHit);
445 if (nRPCHitBarrel and nRPCHitEndcap) {
446 h_nRPCHitPerSimMuonOverlap->Fill(nRPCHit);
447 h_simMuonOverlap_pt->Fill(simParticle->pt());
448 h_simMuonOverlap_eta->Fill(simParticle->eta());
449 h_simMuonOverlap_phi->Fill(simParticle->phi());
450 }
else if (nRPCHitBarrel) {
451 h_nRPCHitPerSimMuonBarrel->Fill(nRPCHit);
452 h_simMuonBarrel_pt->Fill(simParticle->pt());
453 h_simMuonBarrel_eta->Fill(simParticle->eta());
454 h_simMuonBarrel_phi->Fill(simParticle->phi());
455 }
else if (nRPCHitEndcap) {
456 h_nRPCHitPerSimMuonEndcap->Fill(nRPCHit);
457 h_simMuonEndcap_pt->Fill(simParticle->pt());
458 h_simMuonEndcap_eta->Fill(simParticle->eta());
459 h_simMuonEndcap_phi->Fill(simParticle->phi());
461 h_simMuonNoRPC_pt->Fill(simParticle->pt());
462 h_simMuonNoRPC_eta->Fill(simParticle->eta());
463 h_simMuonNoRPC_phi->Fill(simParticle->phi());
466 pthrSimHits.insert(pthrSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
470 switch (simParticle->pdgId()) {
472 h_simParticleType->Fill(0);
475 h_simParticleType->Fill(1);
478 h_simParticleType->Fill(2);
481 h_simParticleType->Fill(3);
484 h_simParticleType->Fill(4);
487 h_simParticleType->Fill(5);
490 h_simParticleType->Fill(6);
493 h_simParticleType->Fill(7);
496 h_simParticleType->Fill(8);
499 h_simParticleType->Fill(9);
502 h_simParticleType->Fill(10);
509 int nRefHitBarrel = 0, nRefHitEndcap = 0;
510 for (
const auto &
simHit : muonSimHits) {
511 const RPCDetId detId = static_cast<const RPCDetId>(
simHit->detUnitId());
512 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->
roll(detId));
514 const int region = roll->id().region();
515 const int ring = roll->id().ring();
517 const int station = roll->id().station();
523 h_.refHitOccupancyBarrel_wheel->Fill(
ring);
524 h_.refHitOccupancyBarrel_station->Fill(
station);
525 h_.refHitOccupancyBarrel_wheel_station->Fill(
ring,
station);
527 h_refOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[
simHit->detUnitId()]);
533 h_refOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[
simHit->detUnitId()]);
539 for (
const auto &
simHit : pthrSimHits) {
540 const RPCDetId detId = static_cast<const RPCDetId>(
simHit->detUnitId());
541 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->
roll(detId()));
543 const int region = roll->id().region();
544 const int ring = roll->id().ring();
546 const int station = roll->id().station();
552 h_refPunchOccupancyBarrel_wheel->Fill(
ring);
553 h_refPunchOccupancyBarrel_station->Fill(
station);
554 h_refPunchOccupancyBarrel_wheel_station->Fill(
ring,
station);
556 h_refOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[
simHit->detUnitId()]);
562 h_refOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[
simHit->detUnitId()]);
565 h_.nRefHitBarrel->Fill(nRefHitBarrel);
566 h_.nRefHitEndcap->Fill(nRefHitEndcap);
569 int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
570 int nRecHitBarrel = 0, nRecHitEndcap = 0;
571 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
572 const RPCDetId detId = static_cast<const RPCDetId>(recHitIter->rpcId());
573 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->
roll(detId()));
577 const int region = roll->id().region();
578 const int ring = roll->id().ring();
580 const int station = roll->id().station();
584 const double time = recHitIter->timeError() >= 0 ? recHitIter->time() : recHitIter->BunchX() * 25;
586 h_.clusterSize->Fill(recHitIter->clusterSize());
590 sumClusterSizeBarrel += recHitIter->clusterSize();
591 h_.clusterSizeBarrel->Fill(recHitIter->clusterSize());
592 h_.recHitOccupancyBarrel_wheel->Fill(
ring);
593 h_.recHitOccupancyBarrel_station->Fill(
station);
594 h_.recHitOccupancyBarrel_wheel_station->Fill(
ring,
station);
596 h_.timeBarrel->Fill(
time);
599 sumClusterSizeEndcap += recHitIter->clusterSize();
600 h_.clusterSizeEndcap->Fill(recHitIter->clusterSize());
604 h_.timeEndcap->Fill(
time);
607 if (roll->isIRPC()) {
608 h_.timeIRPC->Fill(
time);
610 h_.timeCRPC->Fill(
time);
613 const double nRecHit = nRecHitBarrel + nRecHitEndcap;
614 h_.nRecHitBarrel->Fill(nRecHitBarrel);
615 h_.nRecHitEndcap->Fill(nRecHitEndcap);
617 const int sumClusterSize = sumClusterSizeBarrel + sumClusterSizeEndcap;
618 h_.avgClusterSize->Fill(
double(sumClusterSize) / nRecHit);
620 if (nRecHitBarrel > 0) {
621 h_.avgClusterSizeBarrel->Fill(
double(sumClusterSizeBarrel) / nRecHitBarrel);
623 if (nRecHitEndcap > 0) {
624 h_.avgClusterSizeEndcap->Fill(
double(sumClusterSizeEndcap) / nRecHitEndcap);
629 typedef std::map<TrackPSimHitRef, RecHitIter> SimToRecHitMap;
630 SimToRecHitMap simToRecHitMap;
632 for (
const auto &
simHit : muonSimHits) {
633 const RPCDetId simDetId = static_cast<const RPCDetId>(
simHit->detUnitId());
637 const double simX =
simHit->localPosition().x();
639 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
640 const RPCDetId recDetId = static_cast<const RPCDetId>(recHitIter->rpcId());
641 const RPCRoll *recRoll = dynamic_cast<const RPCRoll *>(rpcGeom->
roll(recDetId));
645 if (simDetId != recDetId)
648 const double recX = recHitIter->localPosition().x();
649 const double newDx = fabs(recX - simX);
652 SimToRecHitMap::const_iterator prevSimToReco = simToRecHitMap.find(
simHit);
653 if (prevSimToReco == simToRecHitMap.end()) {
654 simToRecHitMap.insert(std::make_pair(
simHit, recHitIter));
656 const double oldDx = fabs(prevSimToReco->second->localPosition().x() - simX);
659 simToRecHitMap[
simHit] = recHitIter;
667 int nMatchHitBarrel = 0, nMatchHitEndcap = 0;
668 for (
const auto &
match : simToRecHitMap) {
670 RecHitIter recHitIter =
match.second;
672 const RPCDetId detId = static_cast<const RPCDetId>(
simHit->detUnitId());
673 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->
roll(detId));
675 const int region = roll->id().region();
676 const int ring = roll->id().ring();
678 const int station = roll->id().station();
682 const double simX =
simHit->localPosition().x();
683 const double recX = recHitIter->localPosition().x();
684 const double errX =
sqrt(recHitIter->localPositionError().xx());
685 const double dX = recX - simX;
686 const double pull =
errX == 0 ? -999 : dX /
errX;
693 h_.resBarrel->Fill(dX);
694 h_.pullBarrel->Fill(pull);
695 h_.matchOccupancyBarrel_wheel->Fill(
ring);
696 h_.matchOccupancyBarrel_station->Fill(
station);
697 h_.matchOccupancyBarrel_wheel_station->Fill(
ring,
station);
699 h_.res_wheel_res->Fill(
ring, dX);
700 h_.res_station_res->Fill(
station, dX);
701 h_.pull_wheel_pull->Fill(
ring, pull);
702 h_.pull_station_pull->Fill(
station, pull);
704 h_matchOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[detId.
rawId()]);
707 h_.resEndcap->Fill(dX);
708 h_.pullEndcap->Fill(pull);
713 h_.res_ring_res->Fill(
ring, dX);
715 h_.pull_ring_pull->Fill(
ring, pull);
717 h_matchOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[detId.
rawId()]);
720 h_.nMatchHitBarrel->Fill(nMatchHitBarrel);
721 h_.nMatchHitEndcap->Fill(nMatchHitEndcap);
724 for (reco::MuonCollection::const_iterator
muon = muonHandle->begin();
muon != muonHandle->end(); ++
muon) {
725 if (!
muon->isGlobalMuon())
728 int nRPCHitBarrel = 0;
729 int nRPCHitEndcap = 0;
733 if (!(*recHit)->isValid())
735 const DetId detId = (*recHit)->geographicalId();
738 const RPCDetId rpcDetId = static_cast<const RPCDetId>(detId);
740 if (rpcDetId.
region() == 0)
746 const int nRPCHit = nRPCHitBarrel + nRPCHitEndcap;
747 h_nRPCHitPerRecoMuon->Fill(nRPCHit);
748 if (nRPCHitBarrel and nRPCHitEndcap) {
749 h_nRPCHitPerRecoMuonOverlap->Fill(nRPCHit);
750 h_recoMuonOverlap_pt->Fill(
muon->pt());
751 h_recoMuonOverlap_eta->Fill(
muon->eta());
752 h_recoMuonOverlap_phi->Fill(
muon->phi());
753 }
else if (nRPCHitBarrel) {
754 h_nRPCHitPerRecoMuonBarrel->Fill(nRPCHit);
755 h_recoMuonBarrel_pt->Fill(
muon->pt());
756 h_recoMuonBarrel_eta->Fill(
muon->eta());
757 h_recoMuonBarrel_phi->Fill(
muon->phi());
758 }
else if (nRPCHitEndcap) {
759 h_nRPCHitPerRecoMuonEndcap->Fill(nRPCHit);
760 h_recoMuonEndcap_pt->Fill(
muon->pt());
761 h_recoMuonEndcap_eta->Fill(
muon->eta());
762 h_recoMuonEndcap_phi->Fill(
muon->phi());
764 h_recoMuonNoRPC_pt->Fill(
muon->pt());
765 h_recoMuonNoRPC_eta->Fill(
muon->eta());
766 h_recoMuonNoRPC_phi->Fill(
muon->phi());
771 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
772 const RPCDetId detId = static_cast<const RPCDetId>(recHitIter->rpcId());
773 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->
roll(detId));
775 const int region = roll->id().region();
776 const int ring = roll->id().ring();
778 const int station = roll->id().station();
783 for (
const auto &
match : simToRecHitMap) {
784 if (recHitIter ==
match.second) {
791 int nPunchMatched = 0;
793 for (
const auto &
simHit : pthrSimHits) {
794 const int absSimHitPType =
abs(
simHit->particleType());
795 if (absSimHitPType == 13)
798 const RPCDetId simDetId = static_cast<const RPCDetId>(
simHit->detUnitId());
799 if (simDetId == detId)
803 if (nPunchMatched > 0) {
805 h_recPunchOccupancyBarrel_wheel->Fill(
ring);
806 h_recPunchOccupancyBarrel_station->Fill(
station);
807 h_recPunchOccupancyBarrel_wheel_station->Fill(
ring,
station);
817 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
818 const RPCDetId recDetId = static_cast<const RPCDetId>(recHitIter->rpcId());
819 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->
roll(recDetId));
821 const int region = roll->id().region();
828 const double recX = recHitIter->localPosition().x();
829 const double recErrX =
sqrt(recHitIter->localPositionError().xx());
832 for (SimHitIter simHitIter = simHitHandle->begin(); simHitIter != simHitHandle->end(); ++simHitIter) {
833 const RPCDetId simDetId = static_cast<const RPCDetId>(simHitIter->detUnitId());
834 const RPCRoll *simRoll = dynamic_cast<const RPCRoll *>(rpcGeom->
roll(simDetId));
838 if (simDetId != recDetId)
841 const double simX = simHitIter->localPosition().x();
842 const double dX = fabs(recX - simX);
844 if (dX / recErrX < 5) {
852 h_noiseOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[recDetId.
rawId()]);
854 h_noiseOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[recDetId.
rawId()]);
859 h_eventCount->Fill(2);