20 muonRPCEvents_(nullptr),
21 NumberOfRecHitMuon_(nullptr),
22 NumberOfMuon_(nullptr),
24 numberOfInnerRings_(0) {
28 muPtCut_ =
pset.getUntrackedParameter<
double>(
"MuonPtCut", 3.0);
29 muEtaCut_ =
pset.getUntrackedParameter<
double>(
"MuonEtaCut", 1.9);
44 edm::LogInfo(
"rpcmonitordigi") <<
"[RPCMonitorDigi]: Begin Run ";
46 std::set<int> disk_set, ring_set;
52 edm::LogInfo(
"rpcmonitordigi") <<
"[RPCMonitorDigi]: Booking histograms per roll. ";
53 for (TrackingGeometry::DetContainer::const_iterator it = rpcGeo->
dets().begin(); it < rpcGeo->
dets().end(); it++) {
54 if (dynamic_cast<const RPCChamber*>(*it) !=
nullptr) {
55 const RPCChamber* ch = dynamic_cast<const RPCChamber*>(*it);
56 std::vector<const RPCRoll*> roles = (ch->
rolls());
58 for (std::vector<const RPCRoll*>::const_iterator
r = roles.begin();
r != roles.end(); ++
r) {
63 disk_set.insert(rpcId.
station());
64 ring_set.insert(rpcId.
ring());
82 disk_set.insert(rpcId.
station());
83 ring_set.insert(rpcId.
ring());
118 edm::LogInfo(
"rpcmonitordigi") <<
"[RPCMonitorDigi]: Beginning analyzing event " <<
counter;
124 std::map<RPCDetId, std::vector<RPCRecHit> > rechitMuon;
127 int numRPCRecHit = 0;
130 int nStaMuons = muonCands->
size();
132 for (
int i = 0;
i < nStaMuons;
i++) {
134 const reco::Muon* muCand = dynamic_cast<const reco::Muon*>(&goodMuon);
142 std::vector<TrackingRecHitRef> rpcTrackRecHits;
145 if (!(*it)->isValid())
147 int muSubDetId = (*it)->geographicalId().subdetId();
151 RPCRecHit* rpcRecHit = dynamic_cast<RPCRecHit*>(tkRecHit);
152 int detId = (
int)rpcRecHit->
rpcId();
153 if (rechitMuon.find(detId) == rechitMuon.end() || rechitMuon[detId].empty()) {
154 std::vector<RPCRecHit> myVect(1, *rpcRecHit);
155 rechitMuon[detId] = myVect;
157 rechitMuon[detId].push_back(*rpcRecHit);
182 edm::LogError(
"rpcmonitordigi") <<
"[RPCMonitorDigi]: Muons - Product not valid for event" <<
counter;
188 std::map<RPCDetId, std::vector<RPCRecHit> > rechitNoise;
192 for (
auto rpcRecHitIter = rpcHits->begin(); rpcRecHitIter != rpcHits->end(); rpcRecHitIter++) {
195 if (rechitNoise.find(detId) == rechitNoise.end() || rechitNoise[detId].empty()) {
196 std::vector<RPCRecHit> myVect(1, rpcRecHit);
197 rechitNoise[detId] = myVect;
199 rechitNoise[detId].push_back(rpcRecHit);
203 edm::LogError(
"rpcmonitordigi") <<
"[RPCMonitorDigi]: RPCRecHits - Product not valid for event" <<
counter;
216 edm::LogInfo(
"rpcmonitordigi") <<
"[RPCMonitorDigi]: Performing DQM source operations for ";
218 if (recHitMap.empty())
221 std::map<std::string, std::map<std::string, MonitorElement*> > meRollCollection;
222 std::map<std::string, MonitorElement*> meWheelDisk;
223 std::map<std::string, MonitorElement*> meRegion;
224 std::map<std::string, MonitorElement*> meSectorRing;
237 edm::LogWarning(
"rpcmonitordigi") <<
"[RPCMonitorDigi]: RecHit type not valid.";
241 int totalNumberOfRecHits[3] = {0, 0, 0};
242 std::stringstream os;
245 for (
std::map<
RPCDetId, std::vector<RPCRecHit> >::const_iterator detIdIter = recHitMap.begin();
246 detIdIter != recHitMap.end();
248 RPCDetId detId = (*detIdIter).first;
258 nameRoll = geoServ.
name();
263 int wheelOrDiskNumber;
266 int sector = detId.
sector();
269 int roll = detId.
roll();
271 wheelOrDiskType =
"Wheel";
272 wheelOrDiskNumber = (
int)detId.
ring();
276 if (detId.
layer() == 1) {
286 if (detId.
layer() == 1) {
288 if (
abs(wheelOrDiskNumber) == 2 && roll == 3) {
294 if (
abs(wheelOrDiskNumber) != 2 && roll == 3) {
312 wheelOrDiskType =
"Disk";
317 std::vector<RPCRecHit>
recHits = (*detIdIter).second;
318 int numberOfRecHits =
recHits.size();
319 totalNumberOfRecHits[
region + 1] += numberOfRecHits;
324 std::map<std::string, MonitorElement*> meMap = meRollCollection[nameRoll];
327 for (std::vector<RPCRecHit>::const_iterator recHitIter =
recHits.begin(); recHitIter !=
recHits.end();
333 int clusterSize = (
int)
recHit.clusterSize();
334 numDigi += clusterSize;
335 int firstStrip =
recHit.firstClusterStrip();
336 int lastStrip = clusterSize + firstStrip - 1;
341 os <<
"Occupancy_" << nameRoll;
342 if (meMap[os.str()]) {
343 for (
int s = firstStrip;
s <= lastStrip;
s++) {
345 meMap[os.str()]->Fill(
s);
347 int nstrips = meMap[os.str()]->getNbinsX() / totalRolls;
348 meMap[os.str()]->Fill(
s + nstrips * (roll - 1));
354 os <<
"BXDistribution_" << nameRoll;
356 meMap[os.str()]->Fill(
bx);
359 os <<
"ClusterSize_" << nameRoll;
361 meMap[os.str()]->Fill(clusterSize);
366 os <<
"Occupancy_" << wheelOrDiskType <<
"_" << wheelOrDiskNumber <<
"_Sector_" << sector;
367 if (meSectorRing[os.str()]) {
368 for (
int s = firstStrip;
s <= lastStrip;
s++) {
369 meSectorRing[os.str()]->Fill(
s,
nr);
375 os <<
"Occupancy_" << wheelOrDiskType <<
"_" << wheelOrDiskNumber <<
"_Ring_" <<
ring <<
"_CH01-CH18";
376 }
else if (geoServ.
segment() > 18) {
377 os <<
"Occupancy_" << wheelOrDiskType <<
"_" << wheelOrDiskNumber <<
"_Ring_" <<
ring <<
"_CH19-CH36";
380 if (meSectorRing[os.str()]) {
381 for (
int s = firstStrip;
s <= lastStrip;
s++) {
382 meSectorRing[os.str()]->Fill(
s + 32 * (detId.
roll() - 1), geoServ.
segment());
389 os <<
"1DOccupancy_Wheel_" << wheelOrDiskNumber;
390 if (meWheelDisk[os.str()])
391 meWheelDisk[os.str()]->Fill(sector, clusterSize);
394 os <<
"Occupancy_Roll_vs_Sector_" << wheelOrDiskType <<
"_" << wheelOrDiskNumber;
395 if (meWheelDisk[os.str()])
396 meWheelDisk[os.str()]->Fill(sector,
nr, clusterSize);
400 os <<
"1DOccupancy_Ring_" <<
ring;
401 if ((meWheelDisk[os.str()])) {
402 if (wheelOrDiskNumber > 0) {
403 meWheelDisk[os.str()]->Fill(wheelOrDiskNumber +
numberOfDisks_, clusterSize);
405 meWheelDisk[os.str()]->Fill(wheelOrDiskNumber +
numberOfDisks_ + 1, clusterSize);
410 os <<
"Occupancy_Ring_vs_Segment_" << wheelOrDiskType <<
"_" << wheelOrDiskNumber;
411 if (meWheelDisk[os.str()])
412 meWheelDisk[os.str()]->Fill(geoServ.
segment(), (
ring - 1) * 3 - detId.
roll() + 1, clusterSize);
416 os <<
"BxDistribution_" << wheelOrDiskType <<
"_" << wheelOrDiskNumber;
417 if (meWheelDisk[os.str()])
418 meWheelDisk[os.str()]->Fill(
bx);
421 os <<
"ClusterSize_" << wheelOrDiskType <<
"_" << wheelOrDiskNumber <<
"_Layer" << layer;
422 if (meWheelDisk[os.str()])
423 meWheelDisk[os.str()]->Fill(clusterSize);
426 os <<
"ClusterSize_" << wheelOrDiskType <<
"_" << wheelOrDiskNumber <<
"_Ring" <<
ring;
427 if (meWheelDisk[os.str()])
428 meWheelDisk[os.str()]->Fill(clusterSize);
434 if (meRegion[os.str()])
435 meRegion[os.str()]->Fill(clusterSize);
438 os <<
"ClusterSize_";
440 os <<
"Layer" << layer;
442 os <<
"Ring" <<
ring;
444 if (meRegion[os.str()])
445 meRegion[os.str()]->Fill(clusterSize);
450 os <<
"BXWithData_" << nameRoll;
452 meMap[os.str()]->Fill(bxSet.size());
455 os <<
"NumberOfClusters_" << nameRoll;
457 meMap[os.str()]->Fill(numberOfRecHits);
461 if (meRegion[os.str()])
462 meRegion[os.str()]->Fill(numDigi);
466 os <<
"Occupancy_for_Barrel";
467 if (meRegion[os.str()])
468 meRegion[os.str()]->Fill(sector, wheelOrDiskNumber, numDigi);
470 os <<
"Occupancy_for_Endcap";
475 if (meRegion[os.str()]) {
476 meRegion[os.str()]->Fill(xbin,
ring, numDigi);
481 os <<
"Multiplicity_" << nameRoll;
483 meMap[os.str()]->Fill(numDigi);
487 for (
int i = 0;
i < 3;
i++) {
490 if (meRegion[os.str()])
491 meRegion[os.str()]->Fill(totalNumberOfRecHits[
i]);