41 h_.bookHistograms(booker, subDir_);
45 h_simParticleType = booker.
book1D(
"SimHitPType",
"SimHit particle type", 11, 0, 11);
46 h_simParticleType->
getTH1()->SetMinimum(0);
47 if ( TH1*
h = h_simParticleType->getTH1() )
49 h->GetXaxis()->SetBinLabel(1 ,
"#mu^{-}");
50 h->GetXaxis()->SetBinLabel(2 ,
"#mu^{+}");
51 h->GetXaxis()->SetBinLabel(3 ,
"e^{-}" );
52 h->GetXaxis()->SetBinLabel(4 ,
"e^{+}" );
53 h->GetXaxis()->SetBinLabel(5 ,
"#pi^{+}");
54 h->GetXaxis()->SetBinLabel(6 ,
"#pi^{-}");
55 h->GetXaxis()->SetBinLabel(7 ,
"K^{+}" );
56 h->GetXaxis()->SetBinLabel(8 ,
"K^{-}" );
57 h->GetXaxis()->SetBinLabel(9 ,
"p^{+}" );
58 h->GetXaxis()->SetBinLabel(10,
"p^{-}" );
59 h->GetXaxis()->SetBinLabel(11,
"Other" );
64 h_nRPCHitPerSimMuon = booker.
book1D(
"NRPCHitPerSimMuon" ,
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
65 h_nRPCHitPerSimMuonBarrel = booker.
book1D(
"NRPCHitPerSimMuonBarrel" ,
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
66 h_nRPCHitPerSimMuonOverlap = booker.
book1D(
"NRPCHitPerSimMuonOverlap",
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
67 h_nRPCHitPerSimMuonEndcap = 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 = booker.
book1D(
"NRPCHitPerRecoMuonBarrel" ,
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
71 h_nRPCHitPerRecoMuonOverlap = booker.
book1D(
"NRPCHitPerRecoMuonOverlap",
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
72 h_nRPCHitPerRecoMuonEndcap = booker.
book1D(
"NRPCHitPerRecoMuonEndcap" ,
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
74 h_nRPCHitPerSimMuon ->
getTH1()->SetMinimum(0);
75 h_nRPCHitPerSimMuonBarrel ->getTH1()->SetMinimum(0);
76 h_nRPCHitPerSimMuonOverlap ->getTH1()->SetMinimum(0);
77 h_nRPCHitPerSimMuonEndcap ->getTH1()->SetMinimum(0);
79 h_nRPCHitPerRecoMuon ->getTH1()->SetMinimum(0);
80 h_nRPCHitPerRecoMuonBarrel ->getTH1()->SetMinimum(0);
81 h_nRPCHitPerRecoMuonOverlap->getTH1()->SetMinimum(0);
82 h_nRPCHitPerRecoMuonEndcap ->getTH1()->SetMinimum(0);
84 float ptBins[] = {0, 1, 2, 5, 10, 20, 30, 50, 100, 200, 300, 500};
85 const int nPtBins =
sizeof(ptBins)/
sizeof(
float)-1;
86 h_simMuonBarrel_pt = booker.
book1D(
"SimMuonBarrel_pt" ,
"SimMuon RPCHit in Barrel p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
87 h_simMuonOverlap_pt = booker.
book1D(
"SimMuonOverlap_pt" ,
"SimMuon RPCHit in Overlap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
88 h_simMuonEndcap_pt = booker.
book1D(
"SimMuonEndcap_pt" ,
"SimMuon RPCHit in Endcap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
89 h_simMuonNoRPC_pt = booker.
book1D(
"SimMuonNoRPC_pt" ,
"SimMuon without RPCHit p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
90 h_simMuonBarrel_eta = booker.
book1D(
"SimMuonBarrel_eta" ,
"SimMuon RPCHit in Barrel #eta;#eta", 50, -2.5, 2.5);
91 h_simMuonOverlap_eta = booker.
book1D(
"SimMuonOverlap_eta",
"SimMuon RPCHit in Overlap #eta;#eta", 50, -2.5, 2.5);
92 h_simMuonEndcap_eta = booker.
book1D(
"SimMuonEndcap_eta" ,
"SimMuon RPCHit in Endcap #eta;#eta", 50, -2.5, 2.5);
93 h_simMuonNoRPC_eta = booker.
book1D(
"SimMuonNoRPC_eta",
"SimMuon without RPCHit #eta;#eta", 50, -2.5, 2.5);
94 h_simMuonBarrel_phi = booker.
book1D(
"SimMuonBarrel_phi" ,
"SimMuon RPCHit in Barrel #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
95 h_simMuonOverlap_phi = booker.
book1D(
"SimMuonOverlap_phi",
"SimMuon RPCHit in Overlap #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
96 h_simMuonEndcap_phi = booker.
book1D(
"SimMuonEndcap_phi" ,
"SimMuon RPCHit in Endcap #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
97 h_simMuonNoRPC_phi = booker.
book1D(
"SimMuonNoRPC_phi",
"SimMuon without RPCHit #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
99 h_recoMuonBarrel_pt = booker.
book1D(
"RecoMuonBarrel_pt" ,
"RecoMuon RPCHit in Barrel p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
100 h_recoMuonOverlap_pt = booker.
book1D(
"RecoMuonOverlap_pt" ,
"RecoMuon RPCHit in Overlap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
101 h_recoMuonEndcap_pt = booker.
book1D(
"RecoMuonEndcap_pt" ,
"RecoMuon RPCHit in Endcap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
102 h_recoMuonNoRPC_pt = booker.
book1D(
"RecoMuonNoRPC_pt" ,
"RecoMuon without RPCHit p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
103 h_recoMuonBarrel_eta = booker.
book1D(
"RecoMuonBarrel_eta" ,
"RecoMuon RPCHit in Barrel #eta;#eta", 50, -2.5, 2.5);
104 h_recoMuonOverlap_eta = booker.
book1D(
"RecoMuonOverlap_eta",
"RecoMuon RPCHit in Overlap #eta;#eta", 50, -2.5, 2.5);
105 h_recoMuonEndcap_eta = booker.
book1D(
"RecoMuonEndcap_eta" ,
"RecoMuon RPCHit in Endcap #eta;#eta", 50, -2.5, 2.5);
106 h_recoMuonNoRPC_eta = booker.
book1D(
"RecoMuonNoRPC_eta",
"RecoMuon without RPCHit #eta;#eta", 50, -2.5, 2.5);
107 h_recoMuonBarrel_phi = booker.
book1D(
"RecoMuonBarrel_phi" ,
"RecoMuon RPCHit in Barrel #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
108 h_recoMuonOverlap_phi = booker.
book1D(
"RecoMuonOverlap_phi",
"RecoMuon RPCHit in Overlap #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
109 h_recoMuonEndcap_phi = booker.
book1D(
"RecoMuonEndcap_phi" ,
"RecoMuon RPCHit in Endcap #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
110 h_recoMuonNoRPC_phi = booker.
book1D(
"RecoMuonNoRPC_phi",
"RecoMuon without RPCHit #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
112 h_simMuonBarrel_pt ->
getTH1()->SetMinimum(0);
113 h_simMuonOverlap_pt ->getTH1()->SetMinimum(0);
114 h_simMuonEndcap_pt ->getTH1()->SetMinimum(0);
115 h_simMuonNoRPC_pt ->getTH1()->SetMinimum(0);
116 h_simMuonBarrel_eta ->getTH1()->SetMinimum(0);
117 h_simMuonOverlap_eta ->getTH1()->SetMinimum(0);
118 h_simMuonEndcap_eta ->getTH1()->SetMinimum(0);
119 h_simMuonNoRPC_eta ->getTH1()->SetMinimum(0);
120 h_simMuonBarrel_phi ->getTH1()->SetMinimum(0);
121 h_simMuonOverlap_phi ->getTH1()->SetMinimum(0);
122 h_simMuonEndcap_phi ->getTH1()->SetMinimum(0);
123 h_simMuonNoRPC_phi ->getTH1()->SetMinimum(0);
125 h_recoMuonBarrel_pt ->getTH1()->SetMinimum(0);
126 h_recoMuonOverlap_pt ->getTH1()->SetMinimum(0);
127 h_recoMuonEndcap_pt ->getTH1()->SetMinimum(0);
128 h_recoMuonNoRPC_pt ->getTH1()->SetMinimum(0);
129 h_recoMuonBarrel_eta ->getTH1()->SetMinimum(0);
130 h_recoMuonOverlap_eta->getTH1()->SetMinimum(0);
131 h_recoMuonEndcap_eta ->getTH1()->SetMinimum(0);
132 h_recoMuonNoRPC_eta ->getTH1()->SetMinimum(0);
133 h_recoMuonBarrel_phi ->getTH1()->SetMinimum(0);
134 h_recoMuonOverlap_phi->getTH1()->SetMinimum(0);
135 h_recoMuonEndcap_phi ->getTH1()->SetMinimum(0);
136 h_recoMuonNoRPC_phi ->getTH1()->SetMinimum(0);
140 h_eventCount = booker.
book1D(
"EventCount",
"Event count", 3, 1, 4);
141 h_eventCount->
getTH1()->SetMinimum(0);
144 TH1*
h = h_eventCount->getTH1();
145 h->GetXaxis()->SetBinLabel(1,
"eventBegin");
146 h->GetXaxis()->SetBinLabel(2,
"eventEnd");
147 h->GetXaxis()->SetBinLabel(3,
"run");
149 h_eventCount->Fill(3);
151 h_refPunchOccupancyBarrel_wheel = booker.
book1D(
"RefPunchOccupancyBarrel_wheel" ,
"RefPunchthrough occupancy", 5, -2.5, 2.5);
152 h_refPunchOccupancyEndcap_disk = booker.
book1D(
"RefPunchOccupancyEndcap_disk" ,
"RefPunchthrough occupancy", 9, -4.5, 4.5);
153 h_refPunchOccupancyBarrel_station = booker.
book1D(
"RefPunchOccupancyBarrel_station",
"RefPunchthrough occupancy", 4, 0.5, 4.5);
154 h_recPunchOccupancyBarrel_wheel = booker.
book1D(
"RecPunchOccupancyBarrel_wheel" ,
"Punchthrough recHit occupancy", 5, -2.5, 2.5);
155 h_recPunchOccupancyEndcap_disk = booker.
book1D(
"RecPunchOccupancyEndcap_disk" ,
"Punchthrough recHit occupancy", 9, -4.5, 4.5);
156 h_recPunchOccupancyBarrel_station = booker.
book1D(
"RecPunchOccupancyBarrel_station",
"Punchthrough recHit occupancy", 4, 0.5, 4.5);
158 h_refPunchOccupancyBarrel_wheel ->
getTH1()->SetMinimum(0);
159 h_refPunchOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
160 h_refPunchOccupancyBarrel_station ->getTH1()->SetMinimum(0);
161 h_recPunchOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
162 h_recPunchOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
163 h_recPunchOccupancyBarrel_station ->getTH1()->SetMinimum(0);
165 h_refPunchOccupancyBarrel_wheel_station = booker.
book2D(
"RefPunchOccupancyBarrel_wheel_station",
"RefPunchthrough occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
166 h_refPunchOccupancyEndcap_disk_ring = booker.
book2D(
"RefPunchOccupancyEndcap_disk_ring" ,
"RefPunchthrough occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
167 h_recPunchOccupancyBarrel_wheel_station = booker.
book2D(
"RecPunchOccupancyBarrel_wheel_station",
"Punchthrough recHit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
168 h_recPunchOccupancyEndcap_disk_ring = booker.
book2D(
"RecPunchOccupancyEndcap_disk_ring" ,
"Punchthrough recHit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
170 h_refPunchOccupancyBarrel_wheel_station->
getTH2F()->SetOption(
"COLZ");
171 h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->SetOption(
"COLZ");
172 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetOption(
"COLZ");
173 h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->SetOption(
"COLZ");
175 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
176 h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
177 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
178 h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
180 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetStats(0);
181 h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->SetStats(0);
182 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetStats(0);
183 h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->SetStats(0);
185 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
186 h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
187 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
188 h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
190 for (
int i=1;
i<=5; ++
i )
192 TString binLabel = Form(
"Wheel %d",
i-3);
193 h_refPunchOccupancyBarrel_wheel->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
194 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
195 h_recPunchOccupancyBarrel_wheel->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
196 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
199 for (
int i=1;
i<=9; ++
i )
201 TString binLabel = Form(
"Disk %d",
i-5);
202 h_refPunchOccupancyEndcap_disk ->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
203 h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
204 h_recPunchOccupancyEndcap_disk ->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
205 h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
208 for (
int i=1;
i<=4; ++
i )
210 TString binLabel = Form(
"Station %d",
i);
211 h_refPunchOccupancyBarrel_station ->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
212 h_refPunchOccupancyBarrel_wheel_station ->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
213 h_recPunchOccupancyBarrel_station ->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
214 h_recPunchOccupancyBarrel_wheel_station ->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
217 for (
int i=1;
i<=4; ++
i )
219 TString binLabel = Form(
"Ring %d",
i);
220 h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
221 h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
228 int nRPCRollBarrel = 0, nRPCRollEndcap = 0;
231 for (
auto det : rpcDets )
233 auto rpcCh =
dynamic_cast<const RPCChamber*
>(det);
234 if ( !rpcCh )
continue;
236 std::vector<const RPCRoll*> rolls = rpcCh->
rolls();
237 for (
auto roll : rolls )
239 if ( !roll )
continue;
242 const int rawId = roll->geographicalId().rawId();
245 if ( roll->isBarrel() )
247 detIdToIndexMapBarrel_[rawId] = nRPCRollBarrel;
253 detIdToIndexMapEndcap_[rawId] = nRPCRollEndcap;
261 h_matchOccupancyBarrel_detId = booker.
book1D(
"MatchOccupancyBarrel_detId",
"Matched hit occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel);
262 h_matchOccupancyEndcap_detId = booker.
book1D(
"MatchOccupancyEndcap_detId",
"Matched hit occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap);
263 h_refOccupancyBarrel_detId = booker.
book1D(
"RefOccupancyBarrel_detId",
"Reference hit occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel);
264 h_refOccupancyEndcap_detId = booker.
book1D(
"RefOccupancyEndcap_detId",
"Reference hit occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap);
265 h_noiseOccupancyBarrel_detId = booker.
book1D(
"NoiseOccupancyBarrel_detId",
"Noise occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel);
266 h_noiseOccupancyEndcap_detId = booker.
book1D(
"NoiseOccupancyEndcap_detId",
"Noise occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap);
268 h_matchOccupancyBarrel_detId->
getTH1()->SetMinimum(0);
269 h_matchOccupancyEndcap_detId->getTH1()->SetMinimum(0);
270 h_refOccupancyBarrel_detId ->getTH1()->SetMinimum(0);
271 h_refOccupancyEndcap_detId ->getTH1()->SetMinimum(0);
272 h_noiseOccupancyBarrel_detId->getTH1()->SetMinimum(0);
273 h_noiseOccupancyEndcap_detId->getTH1()->SetMinimum(0);
275 h_rollAreaBarrel_detId = booker.
bookProfile(
"RollAreaBarrel_detId",
"Roll area;roll index;Area", nRPCRollBarrel, 0., 1.*nRPCRollBarrel, 0., 1e5);
276 h_rollAreaEndcap_detId = booker.
bookProfile(
"RollAreaEndcap_detId",
"Roll area;roll index;Area", nRPCRollEndcap, 0., 1.*nRPCRollEndcap, 0., 1e5);
278 for (
auto detIdToIndex : detIdToIndexMapBarrel_ )
280 const int rawId = detIdToIndex.first;
281 const int index = detIdToIndex.second;
284 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(rpcDetId));
292 h_rollAreaBarrel_detId->Fill(index, area);
295 for (
auto detIdToIndex : detIdToIndexMapEndcap_ )
297 const int rawId = detIdToIndex.first;
298 const int index = detIdToIndex.second;
301 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(rpcDetId));
309 h_rollAreaEndcap_detId->Fill(index, area);
316 h_eventCount->Fill(1);
324 if ( !event.
getByToken(simHitToken_, simHitHandle) )
326 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find simHit collection\n";
332 if ( !event.
getByToken(recHitToken_, recHitHandle) )
334 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find recHit collection\n";
340 if ( !event.
getByToken(simParticleToken_, simParticleHandle) )
342 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle collection\n";
348 if ( !event.
getByToken(simHitAssocToken_, simHitsTPAssoc) )
350 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle to SimHit association map\n";
356 if ( !event.
getByToken(muonToken_, muonHandle) )
358 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find muon collection\n";
362 typedef edm::PSimHitContainer::const_iterator SimHitIter;
364 typedef std::vector<TrackPSimHitRef> SimHitRefs;
367 SimHitRefs muonSimHits, pthrSimHits;
369 for (
int i=0,
n=simParticleHandle->size();
i<
n; ++
i )
372 if ( simParticle->pt() < 1.0
or simParticle->p() < 2.5 )
continue;
375 SimHitRefs simHitsFromParticle;
376 auto range = std::equal_range(simHitsTPAssoc->begin(), simHitsTPAssoc->end(),
379 for (
auto simParticleToHit = range.first; simParticleToHit != range.second; ++simParticleToHit )
381 auto simHit = simParticleToHit->second;
382 const DetId detId(simHit->detUnitId());
385 simHitsFromParticle.push_back(simParticleToHit->second);
387 const int nRPCHit = simHitsFromParticle.size();
388 const bool hasRPCHit = nRPCHit > 0;
390 if (
abs(simParticle->pdgId()) == 13 )
392 muonSimHits.insert(muonSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
395 int nRPCHitBarrel = 0;
396 int nRPCHitEndcap = 0;
397 for (
auto simHit : simHitsFromParticle )
400 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(rpcDetId));
401 if ( !roll )
continue;
403 if ( rpcDetId.
region() == 0 ) ++nRPCHitBarrel;
404 else ++nRPCHitEndcap;
408 h_nRPCHitPerSimMuon->Fill(nRPCHit);
409 if ( nRPCHitBarrel and nRPCHitEndcap )
411 h_nRPCHitPerSimMuonOverlap->Fill(nRPCHit);
412 h_simMuonOverlap_pt->Fill(simParticle->pt());
413 h_simMuonOverlap_eta->Fill(simParticle->eta());
414 h_simMuonOverlap_phi->Fill(simParticle->phi());
416 else if ( nRPCHitBarrel )
418 h_nRPCHitPerSimMuonBarrel->Fill(nRPCHit);
419 h_simMuonBarrel_pt->Fill(simParticle->pt());
420 h_simMuonBarrel_eta->Fill(simParticle->eta());
421 h_simMuonBarrel_phi->Fill(simParticle->phi());
423 else if ( nRPCHitEndcap )
425 h_nRPCHitPerSimMuonEndcap->Fill(nRPCHit);
426 h_simMuonEndcap_pt->Fill(simParticle->pt());
427 h_simMuonEndcap_eta->Fill(simParticle->eta());
428 h_simMuonEndcap_phi->Fill(simParticle->phi());
432 h_simMuonNoRPC_pt->Fill(simParticle->pt());
433 h_simMuonNoRPC_eta->Fill(simParticle->eta());
434 h_simMuonNoRPC_phi->Fill(simParticle->phi());
439 pthrSimHits.insert(pthrSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
444 switch ( simParticle->pdgId() )
446 case 13: h_simParticleType->Fill( 0);
break;
447 case -13: h_simParticleType->Fill( 1);
break;
448 case 11: h_simParticleType->Fill( 2);
break;
449 case -11: h_simParticleType->Fill( 3);
break;
450 case 211: h_simParticleType->Fill( 4);
break;
451 case -211: h_simParticleType->Fill( 5);
break;
452 case 321: h_simParticleType->Fill( 6);
break;
453 case -321: h_simParticleType->Fill( 7);
break;
454 case 2212: h_simParticleType->Fill( 8);
break;
455 case -2212: h_simParticleType->Fill( 9);
break;
456 default: h_simParticleType->Fill(10);
break;
462 int nRefHitBarrel = 0, nRefHitEndcap = 0;
463 for (
auto simHit : muonSimHits )
466 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
478 h_.refHitOccupancyBarrel_wheel->Fill(ring);
479 h_.refHitOccupancyBarrel_station->Fill(station);
480 h_.refHitOccupancyBarrel_wheel_station->Fill(ring, station);
482 h_refOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[simHit->detUnitId()]);
487 h_.refHitOccupancyEndcap_disk->Fill(region*station);
488 h_.refHitOccupancyEndcap_disk_ring->Fill(region*station, ring);
490 h_refOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[simHit->detUnitId()]);
495 for (
auto simHit : pthrSimHits )
498 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId()));
510 h_refPunchOccupancyBarrel_wheel->Fill(ring);
511 h_refPunchOccupancyBarrel_station->Fill(station);
512 h_refPunchOccupancyBarrel_wheel_station->Fill(ring, station);
514 h_refOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[simHit->detUnitId()]);
519 h_refPunchOccupancyEndcap_disk->Fill(region*station);
520 h_refPunchOccupancyEndcap_disk_ring->Fill(region*station, ring);
522 h_refOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[simHit->detUnitId()]);
525 h_.nRefHitBarrel->Fill(nRefHitBarrel);
526 h_.nRefHitEndcap->Fill(nRefHitEndcap);
529 int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
530 int nRecHitBarrel = 0, nRecHitEndcap = 0;
531 for ( RecHitIter recHitIter = recHitHandle->begin();
532 recHitIter != recHitHandle->end(); ++recHitIter )
535 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId()));
536 if ( !roll )
continue;
545 h_.clusterSize->Fill(recHitIter->clusterSize());
550 sumClusterSizeBarrel += recHitIter->clusterSize();
551 h_.clusterSizeBarrel->Fill(recHitIter->clusterSize());
552 h_.recHitOccupancyBarrel_wheel->Fill(ring);
553 h_.recHitOccupancyBarrel_station->Fill(station);
554 h_.recHitOccupancyBarrel_wheel_station->Fill(ring, station);
559 sumClusterSizeEndcap += recHitIter->clusterSize();
560 h_.clusterSizeEndcap->Fill(recHitIter->clusterSize());
561 h_.recHitOccupancyEndcap_disk->Fill(region*station);
562 h_.recHitOccupancyEndcap_disk_ring->Fill(region*station, ring);
566 const double nRecHit = nRecHitBarrel+nRecHitEndcap;
567 h_.nRecHitBarrel->Fill(nRecHitBarrel);
568 h_.nRecHitEndcap->Fill(nRecHitEndcap);
571 const int sumClusterSize = sumClusterSizeBarrel+sumClusterSizeEndcap;
572 h_.avgClusterSize->Fill(
double(sumClusterSize)/nRecHit);
574 if ( nRecHitBarrel > 0 )
576 h_.avgClusterSizeBarrel->Fill(
double(sumClusterSizeBarrel)/nRecHitBarrel);
578 if ( nRecHitEndcap > 0 )
580 h_.avgClusterSizeEndcap->Fill(
double(sumClusterSizeEndcap)/nRecHitEndcap);
585 typedef std::map<TrackPSimHitRef, RecHitIter> SimToRecHitMap;
586 SimToRecHitMap simToRecHitMap;
588 for (
auto simHit : muonSimHits )
593 const double simX = simHit->localPosition().x();
595 for ( RecHitIter recHitIter = recHitHandle->begin();
596 recHitIter != recHitHandle->end(); ++recHitIter )
599 const RPCRoll* recRoll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(recDetId));
600 if ( !recRoll )
continue;
602 if ( simDetId != recDetId )
continue;
604 const double recX = recHitIter->localPosition().x();
605 const double newDx = fabs(recX - simX);
608 SimToRecHitMap::const_iterator prevSimToReco = simToRecHitMap.find(simHit);
609 if ( prevSimToReco == simToRecHitMap.end() )
611 simToRecHitMap.insert(std::make_pair(simHit, recHitIter));
615 const double oldDx = fabs(prevSimToReco->second->localPosition().x() - simX);
619 simToRecHitMap[simHit] = recHitIter;
627 int nMatchHitBarrel = 0, nMatchHitEndcap = 0;
628 for (
auto match : simToRecHitMap )
631 RecHitIter recHitIter =
match.second;
634 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
643 const double simX = simHit->localPosition().x();
644 const double recX = recHitIter->localPosition().x();
645 const double errX =
sqrt(recHitIter->localPositionError().xx());
646 const double dX = recX - simX;
647 const double pull = errX == 0 ? -999 : dX/errX;
655 h_.resBarrel->Fill(dX);
656 h_.pullBarrel->Fill(pull);
657 h_.matchOccupancyBarrel_wheel->Fill(ring);
658 h_.matchOccupancyBarrel_station->Fill(station);
659 h_.matchOccupancyBarrel_wheel_station->Fill(ring, station);
661 h_.res_wheel_res->Fill(ring, dX);
662 h_.res_station_res->Fill(station, dX);
663 h_.pull_wheel_pull->Fill(ring, pull);
664 h_.pull_station_pull->Fill(station, pull);
666 h_matchOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[detId.
rawId()]);
671 h_.resEndcap->Fill(dX);
672 h_.pullEndcap->Fill(pull);
673 h_.matchOccupancyEndcap_disk->Fill(region*station);
674 h_.matchOccupancyEndcap_disk_ring->Fill(region*station, ring);
676 h_.res_disk_res->Fill(region*station, dX);
677 h_.res_ring_res->Fill(ring, dX);
678 h_.pull_disk_pull->Fill(region*station, pull);
679 h_.pull_ring_pull->Fill(ring, pull);
681 h_matchOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[detId.
rawId()]);
685 h_.nMatchHitBarrel->Fill(nMatchHitBarrel);
686 h_.nMatchHitEndcap->Fill(nMatchHitEndcap);
689 for ( reco::MuonCollection::const_iterator
muon = muonHandle->begin();
692 if ( !
muon->isGlobalMuon() )
continue;
694 int nRPCHitBarrel = 0;
695 int nRPCHitEndcap = 0;
699 recHit != glbTrack->recHitsEnd(); ++recHit )
701 if ( !(*recHit)->isValid() )
continue;
702 const DetId detId = (*recHit)->geographicalId();
706 if ( rpcDetId.
region() == 0 ) ++nRPCHitBarrel;
707 else ++nRPCHitEndcap;
710 const int nRPCHit = nRPCHitBarrel + nRPCHitEndcap;
711 h_nRPCHitPerRecoMuon->Fill(nRPCHit);
712 if ( nRPCHitBarrel and nRPCHitEndcap )
714 h_nRPCHitPerRecoMuonOverlap->Fill(nRPCHit);
715 h_recoMuonOverlap_pt->Fill(
muon->pt());
716 h_recoMuonOverlap_eta->Fill(
muon->eta());
717 h_recoMuonOverlap_phi->Fill(
muon->phi());
719 else if ( nRPCHitBarrel )
721 h_nRPCHitPerRecoMuonBarrel->Fill(nRPCHit);
722 h_recoMuonBarrel_pt->Fill(
muon->pt());
723 h_recoMuonBarrel_eta->Fill(
muon->eta());
724 h_recoMuonBarrel_phi->Fill(
muon->phi());
726 else if ( nRPCHitEndcap )
728 h_nRPCHitPerRecoMuonEndcap->Fill(nRPCHit);
729 h_recoMuonEndcap_pt->Fill(
muon->pt());
730 h_recoMuonEndcap_eta->Fill(
muon->eta());
731 h_recoMuonEndcap_phi->Fill(
muon->phi());
735 h_recoMuonNoRPC_pt->Fill(
muon->pt());
736 h_recoMuonNoRPC_eta->Fill(
muon->eta());
737 h_recoMuonNoRPC_phi->Fill(
muon->phi());
742 for ( RecHitIter recHitIter = recHitHandle->begin();
743 recHitIter != recHitHandle->end(); ++recHitIter )
746 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
755 bool matched =
false;
756 for (
auto match : simToRecHitMap )
758 if ( recHitIter ==
match.second )
770 h_.umOccupancyBarrel_wheel->Fill(ring);
771 h_.umOccupancyBarrel_station->Fill(station);
772 h_.umOccupancyBarrel_wheel_station->Fill(ring, station);
776 h_.umOccupancyEndcap_disk->Fill(region*station);
777 h_.umOccupancyEndcap_disk_ring->Fill(region*station, ring);
781 int nPunchMatched = 0;
783 for (
auto simHit : pthrSimHits )
785 const int absSimHitPType =
abs(simHit->particleType());
786 if ( absSimHitPType == 13 )
continue;
789 if ( simDetId == detId ) ++nPunchMatched;
792 if ( nPunchMatched > 0 )
796 h_recPunchOccupancyBarrel_wheel->Fill(ring);
797 h_recPunchOccupancyBarrel_station->Fill(station);
798 h_recPunchOccupancyBarrel_wheel_station->Fill(ring, station);
802 h_recPunchOccupancyEndcap_disk->Fill(region*station);
803 h_recPunchOccupancyEndcap_disk_ring->Fill(region*station, ring);
810 for ( RecHitIter recHitIter = recHitHandle->begin();
811 recHitIter != recHitHandle->end(); ++recHitIter )
814 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(recDetId));
823 const double recX = recHitIter->localPosition().x();
824 const double recErrX =
sqrt(recHitIter->localPositionError().xx());
826 bool matched =
false;
827 for ( SimHitIter simHitIter = simHitHandle->begin();
828 simHitIter != simHitHandle->end(); ++simHitIter )
830 const RPCDetId simDetId =
static_cast<const RPCDetId>(simHitIter->detUnitId());
831 const RPCRoll* simRoll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(simDetId));
832 if ( !simRoll )
continue;
834 if ( simDetId != recDetId )
continue;
836 const double simX = simHitIter->localPosition().x();
837 const double dX = fabs(recX-simX);
839 if ( dX/recErrX < 5 )
850 h_noiseOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[recDetId.
rawId()]);
854 h_noiseOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[recDetId.
rawId()]);
859 h_eventCount->Fill(2);
T getParameter(std::string const &) const
virtual int nstrips() const =0
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
RPCRecHitValid(const edm::ParameterSet &pset)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
static bool simHitTPAssociationListGreater(SimHitTPPair i, SimHitTPPair j)
MonitorElement * bookProfile(Args &&...args)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
const StripTopology & specificTopology() const
uint32_t rawId() const
get the raw id
virtual float stripLength() const =0
MonitorElement * book1D(Args &&...args)
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Abs< T >::type abs(const T &t)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
virtual float pitch() const =0
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
edm::Ref< edm::PSimHitContainer > TrackPSimHitRef
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
TH2F * getTH2F(void) const
Detector det() const
get the detector field from this detid
std::vector< GeomDet const * > DetContainer
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.