42 h_.bookHistograms(
dbe_, subDir_);
46 h_simParticleType =
dbe_->
book1D(
"SimHitPType",
"SimHit particle type", 11, 0, 11);
47 h_simParticleType->
getTH1()->SetMinimum(0);
48 if ( TH1*
h = h_simParticleType->getTH1() )
50 h->GetXaxis()->SetBinLabel(1 ,
"#mu^{-}");
51 h->GetXaxis()->SetBinLabel(2 ,
"#mu^{+}");
52 h->GetXaxis()->SetBinLabel(3 ,
"e^{-}" );
53 h->GetXaxis()->SetBinLabel(4 ,
"e^{+}" );
54 h->GetXaxis()->SetBinLabel(5 ,
"#pi^{+}");
55 h->GetXaxis()->SetBinLabel(6 ,
"#pi^{-}");
56 h->GetXaxis()->SetBinLabel(7 ,
"K^{+}" );
57 h->GetXaxis()->SetBinLabel(8 ,
"K^{-}" );
58 h->GetXaxis()->SetBinLabel(9 ,
"p^{+}" );
59 h->GetXaxis()->SetBinLabel(10,
"p^{-}" );
60 h->GetXaxis()->SetBinLabel(11,
"Other" );
65 h_nRPCHitPerSimMuon =
dbe_->
book1D(
"NRPCHitPerSimMuon" ,
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
66 h_nRPCHitPerSimMuonBarrel =
dbe_->
book1D(
"NRPCHitPerSimMuonBarrel" ,
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
67 h_nRPCHitPerSimMuonOverlap =
dbe_->
book1D(
"NRPCHitPerSimMuonOverlap",
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
68 h_nRPCHitPerSimMuonEndcap =
dbe_->
book1D(
"NRPCHitPerSimMuonEndcap" ,
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
70 h_nRPCHitPerRecoMuon =
dbe_->
book1D(
"NRPCHitPerRecoMuon" ,
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
71 h_nRPCHitPerRecoMuonBarrel =
dbe_->
book1D(
"NRPCHitPerRecoMuonBarrel" ,
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
72 h_nRPCHitPerRecoMuonOverlap =
dbe_->
book1D(
"NRPCHitPerRecoMuonOverlap",
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
73 h_nRPCHitPerRecoMuonEndcap =
dbe_->
book1D(
"NRPCHitPerRecoMuonEndcap" ,
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
75 h_nRPCHitPerSimMuon ->
getTH1()->SetMinimum(0);
76 h_nRPCHitPerSimMuonBarrel ->getTH1()->SetMinimum(0);
77 h_nRPCHitPerSimMuonOverlap ->getTH1()->SetMinimum(0);
78 h_nRPCHitPerSimMuonEndcap ->getTH1()->SetMinimum(0);
80 h_nRPCHitPerRecoMuon ->getTH1()->SetMinimum(0);
81 h_nRPCHitPerRecoMuonBarrel ->getTH1()->SetMinimum(0);
82 h_nRPCHitPerRecoMuonOverlap->getTH1()->SetMinimum(0);
83 h_nRPCHitPerRecoMuonEndcap ->getTH1()->SetMinimum(0);
85 float ptBins[] = {0, 1, 2, 5, 10, 20, 30, 50, 100, 200, 300, 500};
86 const int nPtBins =
sizeof(ptBins)/
sizeof(
float)-1;
87 h_simMuonBarrel_pt =
dbe_->
book1D(
"SimMuonBarrel_pt" ,
"SimMuon RPCHit in Barrel p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
88 h_simMuonOverlap_pt =
dbe_->
book1D(
"SimMuonOverlap_pt" ,
"SimMuon RPCHit in Overlap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
89 h_simMuonEndcap_pt =
dbe_->
book1D(
"SimMuonEndcap_pt" ,
"SimMuon RPCHit in Endcap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
90 h_simMuonNoRPC_pt =
dbe_->
book1D(
"SimMuonNoRPC_pt" ,
"SimMuon without RPCHit p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
91 h_simMuonBarrel_eta =
dbe_->
book1D(
"SimMuonBarrel_eta" ,
"SimMuon RPCHit in Barrel #eta;#eta", 50, -2.5, 2.5);
92 h_simMuonOverlap_eta =
dbe_->
book1D(
"SimMuonOverlap_eta",
"SimMuon RPCHit in Overlap #eta;#eta", 50, -2.5, 2.5);
93 h_simMuonEndcap_eta =
dbe_->
book1D(
"SimMuonEndcap_eta" ,
"SimMuon RPCHit in Endcap #eta;#eta", 50, -2.5, 2.5);
94 h_simMuonNoRPC_eta =
dbe_->
book1D(
"SimMuonNoRPC_eta",
"SimMuon without RPCHit #eta;#eta", 50, -2.5, 2.5);
100 h_recoMuonBarrel_pt =
dbe_->
book1D(
"RecoMuonBarrel_pt" ,
"RecoMuon RPCHit in Barrel p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
101 h_recoMuonOverlap_pt =
dbe_->
book1D(
"RecoMuonOverlap_pt" ,
"RecoMuon RPCHit in Overlap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
102 h_recoMuonEndcap_pt =
dbe_->
book1D(
"RecoMuonEndcap_pt" ,
"RecoMuon RPCHit in Endcap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
103 h_recoMuonNoRPC_pt =
dbe_->
book1D(
"RecoMuonNoRPC_pt" ,
"RecoMuon without RPCHit p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
104 h_recoMuonBarrel_eta =
dbe_->
book1D(
"RecoMuonBarrel_eta" ,
"RecoMuon RPCHit in Barrel #eta;#eta", 50, -2.5, 2.5);
105 h_recoMuonOverlap_eta =
dbe_->
book1D(
"RecoMuonOverlap_eta",
"RecoMuon RPCHit in Overlap #eta;#eta", 50, -2.5, 2.5);
106 h_recoMuonEndcap_eta =
dbe_->
book1D(
"RecoMuonEndcap_eta" ,
"RecoMuon RPCHit in Endcap #eta;#eta", 50, -2.5, 2.5);
107 h_recoMuonNoRPC_eta =
dbe_->
book1D(
"RecoMuonNoRPC_eta",
"RecoMuon without RPCHit #eta;#eta", 50, -2.5, 2.5);
113 h_simMuonBarrel_pt ->
getTH1()->SetMinimum(0);
114 h_simMuonOverlap_pt ->getTH1()->SetMinimum(0);
115 h_simMuonEndcap_pt ->getTH1()->SetMinimum(0);
116 h_simMuonNoRPC_pt ->getTH1()->SetMinimum(0);
117 h_simMuonBarrel_eta ->getTH1()->SetMinimum(0);
118 h_simMuonOverlap_eta ->getTH1()->SetMinimum(0);
119 h_simMuonEndcap_eta ->getTH1()->SetMinimum(0);
120 h_simMuonNoRPC_eta ->getTH1()->SetMinimum(0);
121 h_simMuonBarrel_phi ->getTH1()->SetMinimum(0);
122 h_simMuonOverlap_phi ->getTH1()->SetMinimum(0);
123 h_simMuonEndcap_phi ->getTH1()->SetMinimum(0);
124 h_simMuonNoRPC_phi ->getTH1()->SetMinimum(0);
126 h_recoMuonBarrel_pt ->getTH1()->SetMinimum(0);
127 h_recoMuonOverlap_pt ->getTH1()->SetMinimum(0);
128 h_recoMuonEndcap_pt ->getTH1()->SetMinimum(0);
129 h_recoMuonNoRPC_pt ->getTH1()->SetMinimum(0);
130 h_recoMuonBarrel_eta ->getTH1()->SetMinimum(0);
131 h_recoMuonOverlap_eta->getTH1()->SetMinimum(0);
132 h_recoMuonEndcap_eta ->getTH1()->SetMinimum(0);
133 h_recoMuonNoRPC_eta ->getTH1()->SetMinimum(0);
134 h_recoMuonBarrel_phi ->getTH1()->SetMinimum(0);
135 h_recoMuonOverlap_phi->getTH1()->SetMinimum(0);
136 h_recoMuonEndcap_phi ->getTH1()->SetMinimum(0);
137 h_recoMuonNoRPC_phi ->getTH1()->SetMinimum(0);
141 h_eventCount =
dbe_->
book1D(
"EventCount",
"Event count", 3, 1, 4);
142 h_eventCount->
getTH1()->SetMinimum(0);
145 TH1*
h = h_eventCount->getTH1();
146 h->GetXaxis()->SetBinLabel(1,
"eventBegin");
147 h->GetXaxis()->SetBinLabel(2,
"eventEnd");
148 h->GetXaxis()->SetBinLabel(3,
"run");
151 h_refPunchOccupancyBarrel_wheel =
dbe_->
book1D(
"RefPunchOccupancyBarrel_wheel" ,
"RefPunchthrough occupancy", 5, -2.5, 2.5);
152 h_refPunchOccupancyEndcap_disk =
dbe_->
book1D(
"RefPunchOccupancyEndcap_disk" ,
"RefPunchthrough occupancy", 9, -4.5, 4.5);
153 h_refPunchOccupancyBarrel_station =
dbe_->
book1D(
"RefPunchOccupancyBarrel_station",
"RefPunchthrough occupancy", 4, 0.5, 4.5);
154 h_recPunchOccupancyBarrel_wheel =
dbe_->
book1D(
"RecPunchOccupancyBarrel_wheel" ,
"Punchthrough recHit occupancy", 5, -2.5, 2.5);
155 h_recPunchOccupancyEndcap_disk =
dbe_->
book1D(
"RecPunchOccupancyEndcap_disk" ,
"Punchthrough recHit occupancy", 9, -4.5, 4.5);
156 h_recPunchOccupancyBarrel_station =
dbe_->
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 =
dbe_->
book2D(
"RefPunchOccupancyBarrel_wheel_station",
"RefPunchthrough occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
166 h_refPunchOccupancyEndcap_disk_ring =
dbe_->
book2D(
"RefPunchOccupancyEndcap_disk_ring" ,
"RefPunchthrough occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
167 h_recPunchOccupancyBarrel_wheel_station =
dbe_->
book2D(
"RecPunchOccupancyBarrel_wheel_station",
"Punchthrough recHit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
168 h_recPunchOccupancyEndcap_disk_ring =
dbe_->
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);
240 h_eventCount->Fill(3);
246 int nRPCRollBarrel = 0, nRPCRollEndcap = 0;
249 for (
auto det : rpcDets )
251 auto rpcCh =
dynamic_cast<const RPCChamber*
>(det);
252 if ( !rpcCh )
continue;
254 std::vector<const RPCRoll*> rolls = rpcCh->
rolls();
255 for (
auto roll : rolls )
257 if ( !roll )
continue;
260 const int rawId = roll->geographicalId().rawId();
263 if ( roll->isBarrel() )
265 detIdToIndexMapBarrel_[rawId] = nRPCRollBarrel;
271 detIdToIndexMapEndcap_[rawId] = nRPCRollEndcap;
279 h_matchOccupancyBarrel_detId =
dbe_->
book1D(
"MatchOccupancyBarrel_detId",
"Matched hit occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel);
280 h_matchOccupancyEndcap_detId =
dbe_->
book1D(
"MatchOccupancyEndcap_detId",
"Matched hit occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap);
281 h_refOccupancyBarrel_detId =
dbe_->
book1D(
"RefOccupancyBarrel_detId",
"Reference hit occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel);
282 h_refOccupancyEndcap_detId =
dbe_->
book1D(
"RefOccupancyEndcap_detId",
"Reference hit occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap);
283 h_noiseOccupancyBarrel_detId =
dbe_->
book1D(
"NoiseOccupancyBarrel_detId",
"Noise occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel);
284 h_noiseOccupancyEndcap_detId =
dbe_->
book1D(
"NoiseOccupancyEndcap_detId",
"Noise occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap);
286 h_matchOccupancyBarrel_detId->
getTH1()->SetMinimum(0);
287 h_matchOccupancyEndcap_detId->getTH1()->SetMinimum(0);
288 h_refOccupancyBarrel_detId ->getTH1()->SetMinimum(0);
289 h_refOccupancyEndcap_detId ->getTH1()->SetMinimum(0);
290 h_noiseOccupancyBarrel_detId->getTH1()->SetMinimum(0);
291 h_noiseOccupancyEndcap_detId->getTH1()->SetMinimum(0);
293 h_rollAreaBarrel_detId =
dbe_->
bookProfile(
"RollAreaBarrel_detId",
"Roll area;roll index;Area", nRPCRollBarrel, 0., 1.*nRPCRollBarrel, 0., 1e5);
294 h_rollAreaEndcap_detId =
dbe_->
bookProfile(
"RollAreaEndcap_detId",
"Roll area;roll index;Area", nRPCRollEndcap, 0., 1.*nRPCRollEndcap, 0., 1e5);
296 for (
auto detIdToIndex : detIdToIndexMapBarrel_ )
298 const int rawId = detIdToIndex.first;
299 const int index = detIdToIndex.second;
302 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(rpcDetId));
310 h_rollAreaBarrel_detId->Fill(index, area);
313 for (
auto detIdToIndex : detIdToIndexMapEndcap_ )
315 const int rawId = detIdToIndex.first;
316 const int index = detIdToIndex.second;
319 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(rpcDetId));
327 h_rollAreaEndcap_detId->Fill(index, area);
340 h_eventCount->Fill(1);
348 if ( !event.
getByToken(simHitToken_, simHitHandle) )
350 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find simHit collection\n";
356 if ( !event.
getByToken(recHitToken_, recHitHandle) )
358 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find recHit collection\n";
364 if ( !event.
getByToken(simParticleToken_, simParticleHandle) )
366 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle collection\n";
372 if ( !event.
getByToken(simHitAssocToken_, simHitsTPAssoc) )
374 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle to SimHit association map\n";
380 if ( !event.
getByToken(muonToken_, muonHandle) )
382 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find muon collection\n";
386 typedef edm::PSimHitContainer::const_iterator SimHitIter;
388 typedef std::vector<TrackPSimHitRef> SimHitRefs;
391 SimHitRefs muonSimHits, pthrSimHits;
393 for (
int i=0,
n=simParticleHandle->size();
i<
n; ++
i )
396 if ( simParticle->pt() < 1.0
or simParticle->p() < 2.5 )
continue;
399 SimHitRefs simHitsFromParticle;
400 auto range = std::equal_range(simHitsTPAssoc->begin(), simHitsTPAssoc->end(),
403 for (
auto simParticleToHit = range.first; simParticleToHit != range.second; ++simParticleToHit )
405 auto simHit = simParticleToHit->second;
406 const DetId detId(simHit->detUnitId());
409 simHitsFromParticle.push_back(simParticleToHit->second);
411 const int nRPCHit = simHitsFromParticle.size();
412 const bool hasRPCHit = nRPCHit > 0;
414 if (
abs(simParticle->pdgId()) == 13 )
416 muonSimHits.insert(muonSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
419 int nRPCHitBarrel = 0;
420 int nRPCHitEndcap = 0;
421 for (
auto simHit : simHitsFromParticle )
424 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(rpcDetId));
425 if ( !roll )
continue;
427 if ( rpcDetId.
region() == 0 ) ++nRPCHitBarrel;
428 else ++nRPCHitEndcap;
432 h_nRPCHitPerSimMuon->Fill(nRPCHit);
433 if ( nRPCHitBarrel and nRPCHitEndcap )
435 h_nRPCHitPerSimMuonOverlap->Fill(nRPCHit);
436 h_simMuonOverlap_pt->Fill(simParticle->pt());
437 h_simMuonOverlap_eta->Fill(simParticle->eta());
438 h_simMuonOverlap_phi->Fill(simParticle->phi());
440 else if ( nRPCHitBarrel )
442 h_nRPCHitPerSimMuonBarrel->Fill(nRPCHit);
443 h_simMuonBarrel_pt->Fill(simParticle->pt());
444 h_simMuonBarrel_eta->Fill(simParticle->eta());
445 h_simMuonBarrel_phi->Fill(simParticle->phi());
447 else if ( nRPCHitEndcap )
449 h_nRPCHitPerSimMuonEndcap->Fill(nRPCHit);
450 h_simMuonEndcap_pt->Fill(simParticle->pt());
451 h_simMuonEndcap_eta->Fill(simParticle->eta());
452 h_simMuonEndcap_phi->Fill(simParticle->phi());
456 h_simMuonNoRPC_pt->Fill(simParticle->pt());
457 h_simMuonNoRPC_eta->Fill(simParticle->eta());
458 h_simMuonNoRPC_phi->Fill(simParticle->phi());
463 pthrSimHits.insert(pthrSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
468 switch ( simParticle->pdgId() )
470 case 13: h_simParticleType->Fill( 0);
break;
471 case -13: h_simParticleType->Fill( 1);
break;
472 case 11: h_simParticleType->Fill( 2);
break;
473 case -11: h_simParticleType->Fill( 3);
break;
474 case 211: h_simParticleType->Fill( 4);
break;
475 case -211: h_simParticleType->Fill( 5);
break;
476 case 321: h_simParticleType->Fill( 6);
break;
477 case -321: h_simParticleType->Fill( 7);
break;
478 case 2212: h_simParticleType->Fill( 8);
break;
479 case -2212: h_simParticleType->Fill( 9);
break;
480 default: h_simParticleType->Fill(10);
break;
486 int nRefHitBarrel = 0, nRefHitEndcap = 0;
487 for (
auto simHit : muonSimHits )
490 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
492 const int region = roll->
id().
region();
502 h_.refHitOccupancyBarrel_wheel->Fill(ring);
503 h_.refHitOccupancyBarrel_station->Fill(station);
504 h_.refHitOccupancyBarrel_wheel_station->Fill(ring, station);
506 h_refOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[simHit->detUnitId()]);
511 h_.refHitOccupancyEndcap_disk->Fill(region*station);
512 h_.refHitOccupancyEndcap_disk_ring->Fill(region*station, ring);
514 h_refOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[simHit->detUnitId()]);
519 for (
auto simHit : pthrSimHits )
522 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId()));
524 const int region = roll->
id().
region();
534 h_refPunchOccupancyBarrel_wheel->Fill(ring);
535 h_refPunchOccupancyBarrel_station->Fill(station);
536 h_refPunchOccupancyBarrel_wheel_station->Fill(ring, station);
538 h_refOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[simHit->detUnitId()]);
543 h_refPunchOccupancyEndcap_disk->Fill(region*station);
544 h_refPunchOccupancyEndcap_disk_ring->Fill(region*station, ring);
546 h_refOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[simHit->detUnitId()]);
549 h_.nRefHitBarrel->Fill(nRefHitBarrel);
550 h_.nRefHitEndcap->Fill(nRefHitEndcap);
553 int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
554 int nRecHitBarrel = 0, nRecHitEndcap = 0;
555 for ( RecHitIter recHitIter = recHitHandle->begin();
556 recHitIter != recHitHandle->end(); ++recHitIter )
559 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId()));
560 if ( !roll )
continue;
562 const int region = roll->
id().
region();
569 h_.clusterSize->Fill(recHitIter->clusterSize());
574 sumClusterSizeBarrel += recHitIter->clusterSize();
575 h_.clusterSizeBarrel->Fill(recHitIter->clusterSize());
576 h_.recHitOccupancyBarrel_wheel->Fill(ring);
577 h_.recHitOccupancyBarrel_station->Fill(station);
578 h_.recHitOccupancyBarrel_wheel_station->Fill(ring, station);
583 sumClusterSizeEndcap += recHitIter->clusterSize();
584 h_.clusterSizeEndcap->Fill(recHitIter->clusterSize());
585 h_.recHitOccupancyEndcap_disk->Fill(region*station);
586 h_.recHitOccupancyEndcap_disk_ring->Fill(region*station, ring);
590 const double nRecHit = nRecHitBarrel+nRecHitEndcap;
591 h_.nRecHitBarrel->Fill(nRecHitBarrel);
592 h_.nRecHitEndcap->Fill(nRecHitEndcap);
595 const int sumClusterSize = sumClusterSizeBarrel+sumClusterSizeEndcap;
596 h_.avgClusterSize->Fill(
double(sumClusterSize)/nRecHit);
598 if ( nRecHitBarrel > 0 )
600 h_.avgClusterSizeBarrel->Fill(
double(sumClusterSizeBarrel)/nRecHitBarrel);
602 if ( nRecHitEndcap > 0 )
604 h_.avgClusterSizeEndcap->Fill(
double(sumClusterSizeEndcap)/nRecHitEndcap);
609 typedef std::map<TrackPSimHitRef, RecHitIter> SimToRecHitMap;
610 SimToRecHitMap simToRecHitMap;
612 for (
auto simHit : muonSimHits )
617 const double simX = simHit->localPosition().x();
619 for ( RecHitIter recHitIter = recHitHandle->begin();
620 recHitIter != recHitHandle->end(); ++recHitIter )
623 const RPCRoll* recRoll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(recDetId));
624 if ( !recRoll )
continue;
626 if ( simDetId != recDetId )
continue;
628 const double recX = recHitIter->localPosition().x();
629 const double newDx = fabs(recX - simX);
632 SimToRecHitMap::const_iterator prevSimToReco = simToRecHitMap.find(simHit);
633 if ( prevSimToReco == simToRecHitMap.end() )
635 simToRecHitMap.insert(std::make_pair(simHit, recHitIter));
639 const double oldDx = fabs(prevSimToReco->second->localPosition().x() - simX);
643 simToRecHitMap[simHit] = recHitIter;
651 int nMatchHitBarrel = 0, nMatchHitEndcap = 0;
652 for (
auto match : simToRecHitMap )
655 RecHitIter recHitIter =
match.second;
658 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
660 const int region = roll->
id().
region();
667 const double simX = simHit->localPosition().x();
668 const double recX = recHitIter->localPosition().x();
669 const double errX =
sqrt(recHitIter->localPositionError().xx());
670 const double dX = recX - simX;
671 const double pull = errX == 0 ? -999 : dX/errX;
679 h_.resBarrel->Fill(dX);
680 h_.pullBarrel->Fill(pull);
681 h_.matchOccupancyBarrel_wheel->Fill(ring);
682 h_.matchOccupancyBarrel_station->Fill(station);
683 h_.matchOccupancyBarrel_wheel_station->Fill(ring, station);
685 h_.res_wheel_res->Fill(ring, dX);
686 h_.res_station_res->Fill(station, dX);
687 h_.pull_wheel_pull->Fill(ring, pull);
688 h_.pull_station_pull->Fill(station, pull);
690 h_matchOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[detId.
rawId()]);
695 h_.resEndcap->Fill(dX);
696 h_.pullEndcap->Fill(pull);
697 h_.matchOccupancyEndcap_disk->Fill(region*station);
698 h_.matchOccupancyEndcap_disk_ring->Fill(region*station, ring);
700 h_.res_disk_res->Fill(region*station, dX);
701 h_.res_ring_res->Fill(ring, dX);
702 h_.pull_disk_pull->Fill(region*station, pull);
703 h_.pull_ring_pull->Fill(ring, pull);
705 h_matchOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[detId.
rawId()]);
709 h_.nMatchHitBarrel->Fill(nMatchHitBarrel);
710 h_.nMatchHitEndcap->Fill(nMatchHitEndcap);
713 for ( reco::MuonCollection::const_iterator
muon = muonHandle->begin();
716 if ( !
muon->isGlobalMuon() )
continue;
718 int nRPCHitBarrel = 0;
719 int nRPCHitEndcap = 0;
723 recHit != glbTrack->recHitsEnd(); ++recHit )
725 if ( !(*recHit)->isValid() )
continue;
726 const DetId detId = (*recHit)->geographicalId();
730 if ( rpcDetId.
region() == 0 ) ++nRPCHitBarrel;
731 else ++nRPCHitEndcap;
734 const int nRPCHit = nRPCHitBarrel + nRPCHitEndcap;
735 h_nRPCHitPerRecoMuon->Fill(nRPCHit);
736 if ( nRPCHitBarrel and nRPCHitEndcap )
738 h_nRPCHitPerRecoMuonOverlap->Fill(nRPCHit);
739 h_recoMuonOverlap_pt->Fill(
muon->pt());
740 h_recoMuonOverlap_eta->Fill(
muon->eta());
741 h_recoMuonOverlap_phi->Fill(
muon->phi());
743 else if ( nRPCHitBarrel )
745 h_nRPCHitPerRecoMuonBarrel->Fill(nRPCHit);
746 h_recoMuonBarrel_pt->Fill(
muon->pt());
747 h_recoMuonBarrel_eta->Fill(
muon->eta());
748 h_recoMuonBarrel_phi->Fill(
muon->phi());
750 else if ( nRPCHitEndcap )
752 h_nRPCHitPerRecoMuonEndcap->Fill(nRPCHit);
753 h_recoMuonEndcap_pt->Fill(
muon->pt());
754 h_recoMuonEndcap_eta->Fill(
muon->eta());
755 h_recoMuonEndcap_phi->Fill(
muon->phi());
759 h_recoMuonNoRPC_pt->Fill(
muon->pt());
760 h_recoMuonNoRPC_eta->Fill(
muon->eta());
761 h_recoMuonNoRPC_phi->Fill(
muon->phi());
766 for ( RecHitIter recHitIter = recHitHandle->begin();
767 recHitIter != recHitHandle->end(); ++recHitIter )
770 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
772 const int region = roll->
id().
region();
779 bool matched =
false;
780 for (
auto match : simToRecHitMap )
782 if ( recHitIter ==
match.second )
794 h_.umOccupancyBarrel_wheel->Fill(ring);
795 h_.umOccupancyBarrel_station->Fill(station);
796 h_.umOccupancyBarrel_wheel_station->Fill(ring, station);
800 h_.umOccupancyEndcap_disk->Fill(region*station);
801 h_.umOccupancyEndcap_disk_ring->Fill(region*station, ring);
805 int nPunchMatched = 0;
807 for (
auto simHit : pthrSimHits )
809 const int absSimHitPType =
abs(simHit->particleType());
810 if ( absSimHitPType == 13 )
continue;
813 if ( simDetId == detId ) ++nPunchMatched;
816 if ( nPunchMatched > 0 )
820 h_recPunchOccupancyBarrel_wheel->Fill(ring);
821 h_recPunchOccupancyBarrel_station->Fill(station);
822 h_recPunchOccupancyBarrel_wheel_station->Fill(ring, station);
826 h_recPunchOccupancyEndcap_disk->Fill(region*station);
827 h_recPunchOccupancyEndcap_disk_ring->Fill(region*station, ring);
834 for ( RecHitIter recHitIter = recHitHandle->begin();
835 recHitIter != recHitHandle->end(); ++recHitIter )
838 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(recDetId));
840 const int region = roll->
id().
region();
847 const double recX = recHitIter->localPosition().x();
848 const double recErrX =
sqrt(recHitIter->localPositionError().xx());
850 bool matched =
false;
851 for ( SimHitIter simHitIter = simHitHandle->begin();
852 simHitIter != simHitHandle->end(); ++simHitIter )
854 const RPCDetId simDetId =
static_cast<const RPCDetId>(simHitIter->detUnitId());
855 const RPCRoll* simRoll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(simDetId));
856 if ( !simRoll )
continue;
858 if ( simDetId != recDetId )
continue;
860 const double simX = simHitIter->localPosition().x();
861 const double dX = fabs(recX-simX);
863 if ( dX/recErrX < 5 )
874 h_noiseOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[recDetId.
rawId()]);
878 h_noiseOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[recDetId.
rawId()]);
883 h_eventCount->Fill(2);
T getParameter(std::string const &) const
virtual int nstrips() const =0
void beginRun(const edm::Run &run, const edm::EventSetup &eventSetup)
RPCRecHitValid(const edm::ParameterSet &pset)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
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)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void endRun(const edm::Run &run, const edm::EventSetup &eventSetup)
#define DEFINE_FWK_MODULE(type)
const StripTopology & specificTopology() const
uint32_t rawId() const
get the raw id
virtual float stripLength() const =0
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Abs< T >::type abs(const T &t)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
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) ...
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
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Detector det() const
get the detector field from this detid
std::vector< GeomDet const * > DetContainer
void setCurrentFolder(const std::string &fullpath)
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.