46 h_.bookHistograms(dbe_, subDir_);
49 dbe_->setCurrentFolder(subDir_+
"/HitProperty");
50 h_simParticleType = dbe_->book1D(
"SimHitPType",
"SimHit particle type", 11, 0, 11);
51 h_simParticleType->getTH1()->SetMinimum(0);
52 if ( TH1*
h = h_simParticleType->getTH1() )
54 h->GetXaxis()->SetBinLabel(1 ,
"#mu^{-}");
55 h->GetXaxis()->SetBinLabel(2 ,
"#mu^{+}");
56 h->GetXaxis()->SetBinLabel(3 ,
"e^{-}" );
57 h->GetXaxis()->SetBinLabel(4 ,
"e^{+}" );
58 h->GetXaxis()->SetBinLabel(5 ,
"#pi^{+}");
59 h->GetXaxis()->SetBinLabel(6 ,
"#pi^{-}");
60 h->GetXaxis()->SetBinLabel(7 ,
"K^{+}" );
61 h->GetXaxis()->SetBinLabel(8 ,
"K^{-}" );
62 h->GetXaxis()->SetBinLabel(9 ,
"p^{+}" );
63 h->GetXaxis()->SetBinLabel(10,
"p^{-}" );
64 h->GetXaxis()->SetBinLabel(11,
"Other" );
67 dbe_->setCurrentFolder(subDir_+
"/Track");
69 h_nRPCHitPerSimMuon = dbe_->book1D(
"NRPCHitPerSimMuon" ,
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
70 h_nRPCHitPerSimMuonBarrel = dbe_->book1D(
"NRPCHitPerSimMuonBarrel" ,
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
71 h_nRPCHitPerSimMuonOverlap = dbe_->book1D(
"NRPCHitPerSimMuonOverlap",
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
72 h_nRPCHitPerSimMuonEndcap = dbe_->book1D(
"NRPCHitPerSimMuonEndcap" ,
"Number of RPC SimHit per SimMuon", 11, -0.5, 10.5);
74 h_nRPCHitPerRecoMuon = dbe_->book1D(
"NRPCHitPerRecoMuon" ,
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
75 h_nRPCHitPerRecoMuonBarrel = dbe_->book1D(
"NRPCHitPerRecoMuonBarrel" ,
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
76 h_nRPCHitPerRecoMuonOverlap = dbe_->book1D(
"NRPCHitPerRecoMuonOverlap",
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
77 h_nRPCHitPerRecoMuonEndcap = dbe_->book1D(
"NRPCHitPerRecoMuonEndcap" ,
"Number of RPC RecHit per RecoMuon", 11, -0.5, 10.5);
79 h_nRPCHitPerSimMuon ->getTH1()->SetMinimum(0);
80 h_nRPCHitPerSimMuonBarrel ->getTH1()->SetMinimum(0);
81 h_nRPCHitPerSimMuonOverlap ->getTH1()->SetMinimum(0);
82 h_nRPCHitPerSimMuonEndcap ->getTH1()->SetMinimum(0);
84 h_nRPCHitPerRecoMuon ->getTH1()->SetMinimum(0);
85 h_nRPCHitPerRecoMuonBarrel ->getTH1()->SetMinimum(0);
86 h_nRPCHitPerRecoMuonOverlap->getTH1()->SetMinimum(0);
87 h_nRPCHitPerRecoMuonEndcap ->getTH1()->SetMinimum(0);
89 float ptBins[] = {0, 1, 2, 5, 10, 20, 30, 50, 100, 200, 300, 500};
90 const int nPtBins =
sizeof(
ptBins)/
sizeof(
float)-1;
91 h_simMuonBarrel_pt = dbe_->book1D(
"SimMuonBarrel_pt" ,
"SimMuon RPCHit in Barrel p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
92 h_simMuonOverlap_pt = dbe_->book1D(
"SimMuonOverlap_pt" ,
"SimMuon RPCHit in Overlap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
93 h_simMuonEndcap_pt = dbe_->book1D(
"SimMuonEndcap_pt" ,
"SimMuon RPCHit in Endcap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
94 h_simMuonNoRPC_pt = dbe_->book1D(
"SimMuonNoRPC_pt" ,
"SimMuon without RPCHit p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
95 h_simMuonBarrel_eta = dbe_->book1D(
"SimMuonBarrel_eta" ,
"SimMuon RPCHit in Barrel #eta;#eta", 50, -2.5, 2.5);
96 h_simMuonOverlap_eta = dbe_->book1D(
"SimMuonOverlap_eta",
"SimMuon RPCHit in Overlap #eta;#eta", 50, -2.5, 2.5);
97 h_simMuonEndcap_eta = dbe_->book1D(
"SimMuonEndcap_eta" ,
"SimMuon RPCHit in Endcap #eta;#eta", 50, -2.5, 2.5);
98 h_simMuonNoRPC_eta = dbe_->book1D(
"SimMuonNoRPC_eta",
"SimMuon without RPCHit #eta;#eta", 50, -2.5, 2.5);
99 h_simMuonBarrel_phi = dbe_->book1D(
"SimMuonBarrel_phi" ,
"SimMuon RPCHit in Barrel #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
100 h_simMuonOverlap_phi = dbe_->book1D(
"SimMuonOverlap_phi",
"SimMuon RPCHit in Overlap #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
101 h_simMuonEndcap_phi = dbe_->book1D(
"SimMuonEndcap_phi" ,
"SimMuon RPCHit in Endcap #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
102 h_simMuonNoRPC_phi = dbe_->book1D(
"SimMuonNoRPC_phi",
"SimMuon without RPCHit #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
104 h_recoMuonBarrel_pt = dbe_->book1D(
"RecoMuonBarrel_pt" ,
"RecoMuon RPCHit in Barrel p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
105 h_recoMuonOverlap_pt = dbe_->book1D(
"RecoMuonOverlap_pt" ,
"RecoMuon RPCHit in Overlap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
106 h_recoMuonEndcap_pt = dbe_->book1D(
"RecoMuonEndcap_pt" ,
"RecoMuon RPCHit in Endcap p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
107 h_recoMuonNoRPC_pt = dbe_->book1D(
"RecoMuonNoRPC_pt" ,
"RecoMuon without RPCHit p_{T};p_{T} [GeV/c^{2}]", nPtBins, ptBins);
108 h_recoMuonBarrel_eta = dbe_->book1D(
"RecoMuonBarrel_eta" ,
"RecoMuon RPCHit in Barrel #eta;#eta", 50, -2.5, 2.5);
109 h_recoMuonOverlap_eta = dbe_->book1D(
"RecoMuonOverlap_eta",
"RecoMuon RPCHit in Overlap #eta;#eta", 50, -2.5, 2.5);
110 h_recoMuonEndcap_eta = dbe_->book1D(
"RecoMuonEndcap_eta" ,
"RecoMuon RPCHit in Endcap #eta;#eta", 50, -2.5, 2.5);
111 h_recoMuonNoRPC_eta = dbe_->book1D(
"RecoMuonNoRPC_eta",
"RecoMuon without RPCHit #eta;#eta", 50, -2.5, 2.5);
112 h_recoMuonBarrel_phi = dbe_->book1D(
"RecoMuonBarrel_phi" ,
"RecoMuon RPCHit in Barrel #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
113 h_recoMuonOverlap_phi = dbe_->book1D(
"RecoMuonOverlap_phi",
"RecoMuon RPCHit in Overlap #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
114 h_recoMuonEndcap_phi = dbe_->book1D(
"RecoMuonEndcap_phi" ,
"RecoMuon RPCHit in Endcap #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
115 h_recoMuonNoRPC_phi = dbe_->book1D(
"RecoMuonNoRPC_phi",
"RecoMuon without RPCHit #phi;#phi", 36, -
TMath::Pi(),
TMath::Pi());
117 h_simMuonBarrel_pt ->getTH1()->SetMinimum(0);
118 h_simMuonOverlap_pt ->getTH1()->SetMinimum(0);
119 h_simMuonEndcap_pt ->getTH1()->SetMinimum(0);
120 h_simMuonNoRPC_pt ->getTH1()->SetMinimum(0);
121 h_simMuonBarrel_eta ->getTH1()->SetMinimum(0);
122 h_simMuonOverlap_eta ->getTH1()->SetMinimum(0);
123 h_simMuonEndcap_eta ->getTH1()->SetMinimum(0);
124 h_simMuonNoRPC_eta ->getTH1()->SetMinimum(0);
125 h_simMuonBarrel_phi ->getTH1()->SetMinimum(0);
126 h_simMuonOverlap_phi ->getTH1()->SetMinimum(0);
127 h_simMuonEndcap_phi ->getTH1()->SetMinimum(0);
128 h_simMuonNoRPC_phi ->getTH1()->SetMinimum(0);
130 h_recoMuonBarrel_pt ->getTH1()->SetMinimum(0);
131 h_recoMuonOverlap_pt ->getTH1()->SetMinimum(0);
132 h_recoMuonEndcap_pt ->getTH1()->SetMinimum(0);
133 h_recoMuonNoRPC_pt ->getTH1()->SetMinimum(0);
134 h_recoMuonBarrel_eta ->getTH1()->SetMinimum(0);
135 h_recoMuonOverlap_eta->getTH1()->SetMinimum(0);
136 h_recoMuonEndcap_eta ->getTH1()->SetMinimum(0);
137 h_recoMuonNoRPC_eta ->getTH1()->SetMinimum(0);
138 h_recoMuonBarrel_phi ->getTH1()->SetMinimum(0);
139 h_recoMuonOverlap_phi->getTH1()->SetMinimum(0);
140 h_recoMuonEndcap_phi ->getTH1()->SetMinimum(0);
141 h_recoMuonNoRPC_phi ->getTH1()->SetMinimum(0);
143 dbe_->setCurrentFolder(subDir_+
"/Occupancy");
145 h_eventCount = dbe_->book1D(
"EventCount",
"Event count", 3, 1, 4);
146 h_eventCount->getTH1()->SetMinimum(0);
149 TH1*
h = h_eventCount->getTH1();
150 h->GetXaxis()->SetBinLabel(1,
"eventBegin");
151 h->GetXaxis()->SetBinLabel(2,
"eventEnd");
152 h->GetXaxis()->SetBinLabel(3,
"run");
155 h_refPunchOccupancyBarrel_wheel = dbe_->book1D(
"RefPunchOccupancyBarrel_wheel" ,
"RefPunchthrough occupancy", 5, -2.5, 2.5);
156 h_refPunchOccupancyEndcap_disk = dbe_->book1D(
"RefPunchOccupancyEndcap_disk" ,
"RefPunchthrough occupancy", 9, -4.5, 4.5);
157 h_refPunchOccupancyBarrel_station = dbe_->book1D(
"RefPunchOccupancyBarrel_station",
"RefPunchthrough occupancy", 4, 0.5, 4.5);
158 h_recPunchOccupancyBarrel_wheel = dbe_->book1D(
"RecPunchOccupancyBarrel_wheel" ,
"Punchthrough recHit occupancy", 5, -2.5, 2.5);
159 h_recPunchOccupancyEndcap_disk = dbe_->book1D(
"RecPunchOccupancyEndcap_disk" ,
"Punchthrough recHit occupancy", 9, -4.5, 4.5);
160 h_recPunchOccupancyBarrel_station = dbe_->book1D(
"RecPunchOccupancyBarrel_station",
"Punchthrough recHit occupancy", 4, 0.5, 4.5);
162 h_refPunchOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
163 h_refPunchOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
164 h_refPunchOccupancyBarrel_station ->getTH1()->SetMinimum(0);
165 h_recPunchOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
166 h_recPunchOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
167 h_recPunchOccupancyBarrel_station ->getTH1()->SetMinimum(0);
169 h_refPunchOccupancyBarrel_wheel_station = dbe_->book2D(
"RefPunchOccupancyBarrel_wheel_station",
"RefPunchthrough occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
170 h_refPunchOccupancyEndcap_disk_ring = dbe_->book2D(
"RefPunchOccupancyEndcap_disk_ring" ,
"RefPunchthrough occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
171 h_recPunchOccupancyBarrel_wheel_station = dbe_->book2D(
"RecPunchOccupancyBarrel_wheel_station",
"Punchthrough recHit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
172 h_recPunchOccupancyEndcap_disk_ring = dbe_->book2D(
"RecPunchOccupancyEndcap_disk_ring" ,
"Punchthrough recHit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
174 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetOption(
"COLZ");
175 h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->SetOption(
"COLZ");
176 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetOption(
"COLZ");
177 h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->SetOption(
"COLZ");
179 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
180 h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
181 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
182 h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
184 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetStats(0);
185 h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->SetStats(0);
186 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetStats(0);
187 h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->SetStats(0);
189 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
190 h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
191 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
192 h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
194 for (
int i=1;
i<=5; ++
i )
196 TString binLabel = Form(
"Wheel %d",
i-3);
197 h_refPunchOccupancyBarrel_wheel->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
198 h_refPunchOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
199 h_recPunchOccupancyBarrel_wheel->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
200 h_recPunchOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
203 for (
int i=1;
i<=9; ++
i )
205 TString binLabel = Form(
"Disk %d",
i-5);
206 h_refPunchOccupancyEndcap_disk ->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
207 h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
208 h_recPunchOccupancyEndcap_disk ->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
209 h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->GetXaxis()->SetBinLabel(
i, binLabel);
212 for (
int i=1;
i<=4; ++
i )
214 TString binLabel = Form(
"Station %d",
i);
215 h_refPunchOccupancyBarrel_station ->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
216 h_refPunchOccupancyBarrel_wheel_station ->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
217 h_recPunchOccupancyBarrel_station ->getTH1()->GetXaxis()->SetBinLabel(
i, binLabel);
218 h_recPunchOccupancyBarrel_wheel_station ->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
221 for (
int i=1;
i<=4; ++
i )
223 TString binLabel = Form(
"Ring %d",
i);
224 h_refPunchOccupancyEndcap_disk_ring ->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
225 h_recPunchOccupancyEndcap_disk_ring ->getTH2F()->GetYaxis()->SetBinLabel(
i, binLabel);
244 h_eventCount->Fill(3);
250 int nRPCRollBarrel = 0, nRPCRollEndcap = 0;
253 for (
auto det : rpcDets )
256 if ( !rpcCh )
continue;
258 std::vector<const RPCRoll*> rolls = rpcCh->
rolls();
259 for (
auto roll : rolls )
261 if ( !roll )
continue;
264 const int rawId = roll->geographicalId().rawId();
267 if ( roll->isBarrel() )
269 detIdToIndexMapBarrel_[rawId] = nRPCRollBarrel;
275 detIdToIndexMapEndcap_[rawId] = nRPCRollEndcap;
283 h_matchOccupancyBarrel_detId =
dbe_->
book1D(
"MatchOccupancyBarrel_detId",
"Matched hit occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel);
284 h_matchOccupancyEndcap_detId =
dbe_->
book1D(
"MatchOccupancyEndcap_detId",
"Matched hit occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap);
285 h_refOccupancyBarrel_detId =
dbe_->
book1D(
"RefOccupancyBarrel_detId",
"Reference hit occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel);
286 h_refOccupancyEndcap_detId =
dbe_->
book1D(
"RefOccupancyEndcap_detId",
"Reference hit occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap);
287 h_noiseOccupancyBarrel_detId =
dbe_->
book1D(
"NoiseOccupancyBarrel_detId",
"Noise occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel);
288 h_noiseOccupancyEndcap_detId =
dbe_->
book1D(
"NoiseOccupancyEndcap_detId",
"Noise occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap);
290 h_matchOccupancyBarrel_detId->
getTH1()->SetMinimum(0);
291 h_matchOccupancyEndcap_detId->getTH1()->SetMinimum(0);
292 h_refOccupancyBarrel_detId ->getTH1()->SetMinimum(0);
293 h_refOccupancyEndcap_detId ->getTH1()->SetMinimum(0);
294 h_noiseOccupancyBarrel_detId->getTH1()->SetMinimum(0);
295 h_noiseOccupancyEndcap_detId->getTH1()->SetMinimum(0);
297 h_rollAreaBarrel_detId =
dbe_->
bookProfile(
"RollAreaBarrel_detId",
"Roll area;roll index;Area", nRPCRollBarrel, 0., 1.*nRPCRollBarrel, 0., 1e5);
298 h_rollAreaEndcap_detId =
dbe_->
bookProfile(
"RollAreaEndcap_detId",
"Roll area;roll index;Area", nRPCRollEndcap, 0., 1.*nRPCRollEndcap, 0., 1e5);
300 for (
auto detIdToIndex : detIdToIndexMapBarrel_ )
302 const int rawId = detIdToIndex.first;
303 const int index = detIdToIndex.second;
306 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(rpcDetId));
314 h_rollAreaBarrel_detId->Fill(index, area);
317 for (
auto detIdToIndex : detIdToIndexMapEndcap_ )
319 const int rawId = detIdToIndex.first;
320 const int index = detIdToIndex.second;
323 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(rpcDetId));
331 h_rollAreaEndcap_detId->Fill(index, area);
344 h_eventCount->Fill(1);
352 if ( !event.
getByLabel(simHitLabel_, simHitHandle) )
354 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find simHit collection\n";
360 if ( !event.
getByLabel(recHitLabel_, recHitHandle) )
362 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find recHit collection\n";
368 if ( !event.
getByLabel(simParticleLabel_, simParticleHandle) )
370 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle collection\n";
374 typedef std::pair<TrackingParticleRef, TrackPSimHitRef> SimHitTPPair;
375 typedef std::vector<SimHitTPPair> SimHitTPAssociationList;
378 if ( !event.
getByLabel(simHitAssocLabel_, simHitsTPAssoc) )
380 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle to SimHit association map\n";
386 if ( !event.
getByLabel(muonLabel_, muonHandle) )
388 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find muon collection\n";
392 typedef edm::PSimHitContainer::const_iterator SimHitIter;
394 typedef std::vector<TrackPSimHitRef> SimHitRefs;
397 SimHitRefs muonSimHits, pthrSimHits;
399 for (
int i=0,
n=simParticleHandle->size();
i<
n; ++
i )
402 if ( simParticle->pt() < 1.0
or simParticle->p() < 2.5 )
continue;
405 SimHitRefs simHitsFromParticle;
406 auto range = std::equal_range(simHitsTPAssoc->begin(), simHitsTPAssoc->end(),
409 for (
auto simParticleToHit = range.first; simParticleToHit != range.second; ++simParticleToHit )
411 auto simHit = simParticleToHit->second;
412 const DetId detId(simHit->detUnitId());
415 simHitsFromParticle.push_back(simParticleToHit->second);
417 const int nRPCHit = simHitsFromParticle.size();
418 const bool hasRPCHit = nRPCHit > 0;
420 if (
abs(simParticle->pdgId()) == 13 )
422 muonSimHits.insert(muonSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
425 int nRPCHitBarrel = 0;
426 int nRPCHitEndcap = 0;
427 for (
auto simHit : simHitsFromParticle )
430 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(rpcDetId));
431 if ( !roll )
continue;
433 if ( rpcDetId.
region() == 0 ) ++nRPCHitBarrel;
434 else ++nRPCHitEndcap;
438 h_nRPCHitPerSimMuon->Fill(nRPCHit);
439 if ( nRPCHitBarrel and nRPCHitEndcap )
441 h_nRPCHitPerSimMuonOverlap->Fill(nRPCHit);
442 h_simMuonOverlap_pt->Fill(simParticle->pt());
443 h_simMuonOverlap_eta->Fill(simParticle->eta());
444 h_simMuonOverlap_phi->Fill(simParticle->phi());
446 else if ( nRPCHitBarrel )
448 h_nRPCHitPerSimMuonBarrel->Fill(nRPCHit);
449 h_simMuonBarrel_pt->Fill(simParticle->pt());
450 h_simMuonBarrel_eta->Fill(simParticle->eta());
451 h_simMuonBarrel_phi->Fill(simParticle->phi());
453 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());
462 h_simMuonNoRPC_pt->Fill(simParticle->pt());
463 h_simMuonNoRPC_eta->Fill(simParticle->eta());
464 h_simMuonNoRPC_phi->Fill(simParticle->phi());
469 pthrSimHits.insert(pthrSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
474 switch ( simParticle->pdgId() )
476 case 13: h_simParticleType->Fill( 0);
break;
477 case -13: h_simParticleType->Fill( 1);
break;
478 case 11: h_simParticleType->Fill( 2);
break;
479 case -11: h_simParticleType->Fill( 3);
break;
480 case 211: h_simParticleType->Fill( 4);
break;
481 case -211: h_simParticleType->Fill( 5);
break;
482 case 321: h_simParticleType->Fill( 6);
break;
483 case -321: h_simParticleType->Fill( 7);
break;
484 case 2212: h_simParticleType->Fill( 8);
break;
485 case -2212: h_simParticleType->Fill( 9);
break;
486 default: h_simParticleType->Fill(10);
break;
492 int nRefHitBarrel = 0, nRefHitEndcap = 0;
493 for (
auto simHit : muonSimHits )
496 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
498 const int region = roll->
id().
region();
508 h_.refHitOccupancyBarrel_wheel->Fill(ring);
509 h_.refHitOccupancyBarrel_station->Fill(station);
510 h_.refHitOccupancyBarrel_wheel_station->Fill(ring, station);
512 h_refOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[simHit->detUnitId()]);
517 h_.refHitOccupancyEndcap_disk->Fill(region*station);
518 h_.refHitOccupancyEndcap_disk_ring->Fill(region*station, ring);
520 h_refOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[simHit->detUnitId()]);
525 for (
auto simHit : pthrSimHits )
528 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId()));
530 const int region = roll->
id().
region();
540 h_refPunchOccupancyBarrel_wheel->Fill(ring);
541 h_refPunchOccupancyBarrel_station->Fill(station);
542 h_refPunchOccupancyBarrel_wheel_station->Fill(ring, station);
544 h_refOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[simHit->detUnitId()]);
549 h_refPunchOccupancyEndcap_disk->Fill(region*station);
550 h_refPunchOccupancyEndcap_disk_ring->Fill(region*station, ring);
552 h_refOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[simHit->detUnitId()]);
555 h_.nRefHitBarrel->Fill(nRefHitBarrel);
556 h_.nRefHitEndcap->Fill(nRefHitEndcap);
559 int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
560 int nRecHitBarrel = 0, nRecHitEndcap = 0;
561 for ( RecHitIter recHitIter = recHitHandle->begin();
562 recHitIter != recHitHandle->end(); ++recHitIter )
565 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId()));
566 if ( !roll )
continue;
568 const int region = roll->
id().
region();
575 h_.clusterSize->Fill(recHitIter->clusterSize());
580 sumClusterSizeBarrel += recHitIter->clusterSize();
581 h_.clusterSizeBarrel->Fill(recHitIter->clusterSize());
582 h_.recHitOccupancyBarrel_wheel->Fill(ring);
583 h_.recHitOccupancyBarrel_station->Fill(station);
584 h_.recHitOccupancyBarrel_wheel_station->Fill(ring, station);
589 sumClusterSizeEndcap += recHitIter->clusterSize();
590 h_.clusterSizeEndcap->Fill(recHitIter->clusterSize());
591 h_.recHitOccupancyEndcap_disk->Fill(region*station);
592 h_.recHitOccupancyEndcap_disk_ring->Fill(region*station, ring);
596 const double nRecHit = nRecHitBarrel+nRecHitEndcap;
597 h_.nRecHitBarrel->Fill(nRecHitBarrel);
598 h_.nRecHitEndcap->Fill(nRecHitEndcap);
601 const int sumClusterSize = sumClusterSizeBarrel+sumClusterSizeEndcap;
602 h_.avgClusterSize->Fill(
double(sumClusterSize)/nRecHit);
604 if ( nRecHitBarrel > 0 )
606 h_.avgClusterSizeBarrel->Fill(
double(sumClusterSizeBarrel)/nRecHitBarrel);
608 if ( nRecHitEndcap > 0 )
610 h_.avgClusterSizeEndcap->Fill(
double(sumClusterSizeEndcap)/nRecHitEndcap);
615 typedef std::map<TrackPSimHitRef, RecHitIter> SimToRecHitMap;
616 SimToRecHitMap simToRecHitMap;
618 for (
auto simHit : muonSimHits )
623 const double simX = simHit->localPosition().x();
625 for ( RecHitIter recHitIter = recHitHandle->begin();
626 recHitIter != recHitHandle->end(); ++recHitIter )
629 const RPCRoll* recRoll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(recDetId));
630 if ( !recRoll )
continue;
632 if ( simDetId != recDetId )
continue;
634 const double recX = recHitIter->localPosition().x();
635 const double newDx = fabs(recX - simX);
638 SimToRecHitMap::const_iterator prevSimToReco = simToRecHitMap.find(simHit);
639 if ( prevSimToReco == simToRecHitMap.end() )
641 simToRecHitMap.insert(std::make_pair(simHit, recHitIter));
645 const double oldDx = fabs(prevSimToReco->second->localPosition().x() - simX);
649 simToRecHitMap[simHit] = recHitIter;
657 int nMatchHitBarrel = 0, nMatchHitEndcap = 0;
658 for (
auto match : simToRecHitMap )
661 RecHitIter recHitIter =
match.second;
664 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
666 const int region = roll->
id().
region();
673 const double simX = simHit->localPosition().x();
674 const double recX = recHitIter->localPosition().x();
675 const double errX =
sqrt(recHitIter->localPositionError().xx());
676 const double dX = recX - simX;
677 const double pull = errX == 0 ? -999 : dX/errX;
685 h_.resBarrel->Fill(dX);
686 h_.pullBarrel->Fill(pull);
687 h_.matchOccupancyBarrel_wheel->Fill(ring);
688 h_.matchOccupancyBarrel_station->Fill(station);
689 h_.matchOccupancyBarrel_wheel_station->Fill(ring, station);
691 h_.res_wheel_res->Fill(ring, dX);
692 h_.res_station_res->Fill(station, dX);
693 h_.pull_wheel_pull->Fill(ring, pull);
694 h_.pull_station_pull->Fill(station, pull);
696 h_matchOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[detId.
rawId()]);
701 h_.resEndcap->Fill(dX);
702 h_.pullEndcap->Fill(pull);
703 h_.matchOccupancyEndcap_disk->Fill(region*station);
704 h_.matchOccupancyEndcap_disk_ring->Fill(region*station, ring);
706 h_.res_disk_res->Fill(region*station, dX);
707 h_.res_ring_res->Fill(ring, dX);
708 h_.pull_disk_pull->Fill(region*station, pull);
709 h_.pull_ring_pull->Fill(ring, pull);
711 h_matchOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[detId.
rawId()]);
715 h_.nMatchHitBarrel->Fill(nMatchHitBarrel);
716 h_.nMatchHitEndcap->Fill(nMatchHitEndcap);
722 if ( !
muon->isGlobalMuon() )
continue;
724 int nRPCHitBarrel = 0;
725 int nRPCHitEndcap = 0;
729 recHit != glbTrack->recHitsEnd(); ++recHit )
731 if ( !(*recHit)->isValid() )
continue;
732 const DetId detId = (*recHit)->geographicalId();
736 if ( rpcDetId.
region() == 0 ) ++nRPCHitBarrel;
737 else ++nRPCHitEndcap;
740 const int nRPCHit = nRPCHitBarrel + nRPCHitEndcap;
741 h_nRPCHitPerRecoMuon->Fill(nRPCHit);
742 if ( nRPCHitBarrel and nRPCHitEndcap )
744 h_nRPCHitPerRecoMuonOverlap->Fill(nRPCHit);
745 h_recoMuonOverlap_pt->Fill(
muon->pt());
746 h_recoMuonOverlap_eta->Fill(
muon->eta());
747 h_recoMuonOverlap_phi->Fill(
muon->phi());
749 else if ( nRPCHitBarrel )
751 h_nRPCHitPerRecoMuonBarrel->Fill(nRPCHit);
752 h_recoMuonBarrel_pt->Fill(
muon->pt());
753 h_recoMuonBarrel_eta->Fill(
muon->eta());
754 h_recoMuonBarrel_phi->Fill(
muon->phi());
756 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());
765 h_recoMuonNoRPC_pt->Fill(
muon->pt());
766 h_recoMuonNoRPC_eta->Fill(
muon->eta());
767 h_recoMuonNoRPC_phi->Fill(
muon->phi());
772 for ( RecHitIter recHitIter = recHitHandle->begin();
773 recHitIter != recHitHandle->end(); ++recHitIter )
776 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
778 const int region = roll->
id().
region();
785 bool matched =
false;
786 for (
auto match : simToRecHitMap )
788 if ( recHitIter ==
match.second )
800 h_.umOccupancyBarrel_wheel->Fill(ring);
801 h_.umOccupancyBarrel_station->Fill(station);
802 h_.umOccupancyBarrel_wheel_station->Fill(ring, station);
806 h_.umOccupancyEndcap_disk->Fill(region*station);
807 h_.umOccupancyEndcap_disk_ring->Fill(region*station, ring);
811 int nPunchMatched = 0;
813 for (
auto simHit : pthrSimHits )
815 const int absSimHitPType =
abs(simHit->particleType());
816 if ( absSimHitPType == 13 )
continue;
819 if ( simDetId == detId ) ++nPunchMatched;
822 if ( nPunchMatched > 0 )
826 h_recPunchOccupancyBarrel_wheel->Fill(ring);
827 h_recPunchOccupancyBarrel_station->Fill(station);
828 h_recPunchOccupancyBarrel_wheel_station->Fill(ring, station);
832 h_recPunchOccupancyEndcap_disk->Fill(region*station);
833 h_recPunchOccupancyEndcap_disk_ring->Fill(region*station, ring);
840 for ( RecHitIter recHitIter = recHitHandle->begin();
841 recHitIter != recHitHandle->end(); ++recHitIter )
844 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(recDetId));
846 const int region = roll->
id().
region();
853 const double recX = recHitIter->localPosition().x();
854 const double recErrX =
sqrt(recHitIter->localPositionError().xx());
856 bool matched =
false;
857 for ( SimHitIter simHitIter = simHitHandle->begin();
858 simHitIter != simHitHandle->end(); ++simHitIter )
860 const RPCDetId simDetId =
static_cast<const RPCDetId>(simHitIter->detUnitId());
861 const RPCRoll* simRoll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(simDetId));
862 if ( !simRoll )
continue;
864 if ( simDetId != recDetId )
continue;
866 const double simX = simHitIter->localPosition().x();
867 const double dX = fabs(recX-simX);
869 if ( dX/recErrX < 5 )
880 h_noiseOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[recDetId.
rawId()]);
884 h_noiseOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[recDetId.
rawId()]);
889 h_eventCount->Fill(2);
T getParameter(std::string const &) const
virtual int nstrips() const =0
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
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)
void endRun(const edm::Run &run, const edm::EventSetup &eventSetup)
#define DEFINE_FWK_MODULE(type)
std::vector< GeomDet * > DetContainer
const StripTopology & specificTopology() const
uint32_t rawId() const
get the raw id
C::const_iterator const_iterator
constant access iterator type
virtual float stripLength() const =0
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
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) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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.
Detector det() const
get the detector field from this detid
void setCurrentFolder(const std::string &fullpath)
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.