13 #include <fmt/format.h> 19 muonRPCEvents_(nullptr),
20 NumberOfRecHitMuon_(nullptr),
21 NumberOfMuon_(nullptr),
23 numberOfInnerRings_(0) {
27 muPtCut_ =
pset.getUntrackedParameter<
double>(
"MuonPtCut", 3.0);
28 muEtaCut_ =
pset.getUntrackedParameter<
double>(
"MuonEtaCut", 1.9);
45 edm::LogInfo(
"rpcmonitordigi") <<
"[RPCMonitorDigi]: Begin Run ";
49 std::set<int> disk_set;
53 edm::LogInfo(
"rpcmonitordigi") <<
"[RPCMonitorDigi]: Booking histograms per roll. ";
54 for (
auto ich : rpcGeo.dets()) {
58 const auto& roles = ch->
rolls();
61 for (
auto roll : roles) {
66 disk_set.insert(rpcId.
station());
77 const RPCDetId& rpcId = roles[0]->id();
83 disk_set.insert(rpcId.
station());
115 edm::LogInfo(
"rpcmonitordigi") <<
"[RPCMonitorDigi]: Beginning analyzing event " <<
counter;
121 std::map<RPCDetId, std::vector<RPCRecHit> > rechitMuon;
124 int numRPCRecHit = 0;
127 int nStaMuons = muonCands->
size();
129 for (
int i = 0;
i < nStaMuons;
i++) {
139 std::vector<TrackingRecHitRef> rpcTrackRecHits;
142 if (!(*it)->isValid())
144 int muSubDetId = (*it)->geographicalId().subdetId();
149 int detId = (
int)rpcRecHit->
rpcId();
150 if (rechitMuon.find(detId) == rechitMuon.end() || rechitMuon[detId].empty()) {
151 std::vector<RPCRecHit> myVect(1, *rpcRecHit);
152 rechitMuon[detId] = myVect;
154 rechitMuon[detId].push_back(*rpcRecHit);
179 edm::LogError(
"rpcmonitordigi") <<
"[RPCMonitorDigi]: Muons - Product not valid for event" <<
counter;
185 std::map<RPCDetId, std::vector<RPCRecHit> > rechitNoise;
189 for (
auto rpcRecHitIter = rpcHits->begin(); rpcRecHitIter != rpcHits->end(); rpcRecHitIter++) {
190 const RPCRecHit& rpcRecHit = (*rpcRecHitIter);
192 if (rechitNoise.find(detId) == rechitNoise.end() || rechitNoise[detId].empty()) {
193 std::vector<RPCRecHit> myVect(1, rpcRecHit);
194 rechitNoise[detId] = myVect;
196 rechitNoise[detId].push_back(rpcRecHit);
200 edm::LogError(
"rpcmonitordigi") <<
"[RPCMonitorDigi]: RPCRecHits - Product not valid for event" <<
counter;
213 edm::LogInfo(
"rpcmonitordigi") <<
"[RPCMonitorDigi]: Performing DQM source operations for ";
215 if (recHitMap.empty())
218 std::map<std::string, std::map<std::string, MonitorElement*> > meRollCollection;
219 std::map<std::string, MonitorElement*> meWheelDisk;
220 std::map<std::string, MonitorElement*> meRegion;
221 std::map<std::string, MonitorElement*> meSectorRing;
234 edm::LogWarning(
"rpcmonitordigi") <<
"[RPCMonitorDigi]: RecHit type not valid.";
238 int totalNumberOfRecHits[3] = {0, 0, 0};
241 for (
std::map<
RPCDetId, std::vector<RPCRecHit> >::const_iterator detIdIter = recHitMap.begin();
242 detIdIter != recHitMap.end();
244 RPCDetId detId = (*detIdIter).first;
254 int wheelOrDiskNumber;
259 int roll = detId.
roll();
261 wheelOrDiskType =
"Wheel";
262 wheelOrDiskNumber = (
int)detId.
ring();
266 if (detId.
layer() == 1) {
274 if (detId.
layer() == 1) {
276 if (
abs(wheelOrDiskNumber) == 2 && roll == 3) {
282 if (
abs(wheelOrDiskNumber) != 2 && roll == 3) {
298 wheelOrDiskType =
"Disk";
303 std::vector<RPCRecHit>
recHits = (*detIdIter).second;
304 const int numberOfRecHits =
recHits.size();
305 totalNumberOfRecHits[
region + 1] += numberOfRecHits;
310 std::map<std::string, MonitorElement*> meMap = meRollCollection[nameRoll];
314 for (std::vector<RPCRecHit>::const_iterator recHitIter =
recHits.begin(); recHitIter !=
recHits.end();
320 int clusterSize = (
int)
recHit.clusterSize();
321 numDigi += clusterSize;
322 int firstStrip =
recHit.firstClusterStrip();
323 int lastStrip = clusterSize + firstStrip - 1;
327 tmpName =
"Occupancy_" + nameRoll;
328 if (meMap[tmpName]) {
329 for (
int s = firstStrip;
s <= lastStrip;
s++) {
331 meMap[tmpName]->Fill(
s);
333 const int nstrips = meMap[tmpName]->getNbinsX() / totalRolls;
334 meMap[tmpName]->Fill(
s + nstrips * (roll - 1));
339 tmpName =
"BXDistribution_" + nameRoll;
341 meMap[tmpName]->Fill(
bx);
345 tmpName =
fmt::format(
"Occupancy_{}_{}_Sector_{}", wheelOrDiskType, wheelOrDiskNumber,
sector);
346 if (meSectorRing[tmpName]) {
347 for (
int s = firstStrip;
s <= lastStrip;
s++) {
348 meSectorRing[tmpName]->Fill(
s,
nr);
352 tmpName =
fmt::format(
"ClusterSize_{}_{}_Sector_{}", wheelOrDiskType, wheelOrDiskNumber,
sector);
353 if (meSectorRing[tmpName]) {
354 if (clusterSize >= meSectorRing[tmpName]->getNbinsX())
355 meSectorRing[tmpName]->Fill(meSectorRing[tmpName]->getNbinsX(),
nr);
357 meSectorRing[tmpName]->Fill(clusterSize,
nr);
360 tmpName =
fmt::format(
"Occupancy_{}_{}_Ring_{}", wheelOrDiskType, wheelOrDiskNumber,
ring);
362 tmpName +=
"_CH01-CH18";
363 }
else if (geoServ.
segment() >= 19) {
364 tmpName +=
"_CH19-CH36";
367 if (meSectorRing[tmpName]) {
368 for (
int s = firstStrip;
s <= lastStrip;
s++) {
369 meSectorRing[tmpName]->Fill(
s + 32 * (detId.
roll() - 1), geoServ.
segment());
373 tmpName =
fmt::format(
"ClusterSize_{}_{}_Ring_{}", wheelOrDiskType, wheelOrDiskNumber,
ring);
375 tmpName +=
"_CH01-CH09";
377 tmpName +=
"_CH10-CH18";
379 tmpName +=
"_CH19-CH27";
381 tmpName +=
"_CH28-CH36";
384 if (meSectorRing[tmpName]) {
385 if (clusterSize >= meSectorRing[tmpName]->getNbinsX())
386 meSectorRing[tmpName]->
Fill(meSectorRing[tmpName]->getNbinsX(),
387 3 * (geoServ.
segment() - 1) + (3 - detId.
roll()) + 1);
389 meSectorRing[tmpName]->Fill(clusterSize, 3 * (geoServ.
segment() - 1) + (3 - detId.
roll()) + 1);
394 tmpName =
fmt::format(
"1DOccupancy_Wheel_{}", wheelOrDiskNumber);
395 if (meWheelDisk[tmpName])
396 meWheelDisk[tmpName]->Fill(
sector, clusterSize);
398 tmpName =
fmt::format(
"Occupancy_Roll_vs_Sector_{}_{}", wheelOrDiskType, wheelOrDiskNumber);
399 if (meWheelDisk[tmpName])
400 meWheelDisk[tmpName]->Fill(
sector,
nr, clusterSize);
404 if ((meWheelDisk[tmpName])) {
405 if (wheelOrDiskNumber > 0) {
406 meWheelDisk[tmpName]->Fill(wheelOrDiskNumber +
numberOfDisks_, clusterSize);
408 meWheelDisk[tmpName]->Fill(wheelOrDiskNumber +
numberOfDisks_ + 1, clusterSize);
412 tmpName =
fmt::format(
"Occupancy_Ring_vs_Segment_{}_{}", wheelOrDiskType, wheelOrDiskNumber);
413 if (meWheelDisk[tmpName])
414 meWheelDisk[tmpName]->Fill(geoServ.
segment(), (
ring - 1) * 3 - detId.
roll() + 1, clusterSize);
417 tmpName =
fmt::format(
"BxDistribution_{}_{}", wheelOrDiskType, wheelOrDiskNumber);
418 if (meWheelDisk[tmpName])
419 meWheelDisk[tmpName]->Fill(
bx);
423 tmpName =
"BXWithData_" + nameRoll;
425 meMap[tmpName]->Fill(bxSet.size());
427 tmpName =
"NumberOfClusters_" + nameRoll;
429 meMap[tmpName]->Fill(numberOfRecHits);
432 if (meRegion[tmpName])
433 meRegion[tmpName]->Fill(numDigi);
436 if (meRegion[
"Occupancy_for_Barrel"])
437 meRegion[
"Occupancy_for_Barrel"]->Fill(
sector, wheelOrDiskNumber, numDigi);
443 if (meRegion[
"Occupancy_for_Endcap"]) {
444 meRegion[
"Occupancy_for_Endcap"]->Fill(xbin,
ring, numDigi);
448 tmpName =
"Multiplicity_" + nameRoll;
450 meMap[tmpName]->Fill(numDigi);
454 for (
int i = 0;
i < 3;
i++) {
456 if (meRegion[tmpName])
457 meRegion[tmpName]->Fill(totalNumberOfRecHits[
i]);
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
std::map< std::string, std::map< std::string, MonitorElement * > > meMuonCollection
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
std::string globalFolder_
double pt() const final
transverse momentum
virtual void setCurrentFolder(std::string const &fullpath)
std::map< std::string, MonitorElement * > wheelDiskNoiseCollection
std::map< std::string, MonitorElement * > sectorRingMuonCollection
MonitorElement * muonRPCEvents_
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
RPCMonitorDigi(const edm::ParameterSet &)
Log< level::Error, false > LogError
void analyze(const edm::Event &, const edm::EventSetup &) override
static std::string rollName(const RPCDetId &detId)
void bookSectorRingME(DQMStore::IBooker &, const std::string &, std::map< std::string, MonitorElement *> &)
Booking of MonitoringElement at Sector/Ring level.
RPCDetId rpcId() const
Return the rpcId.
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Abs< T >::type abs(const T &t)
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
static const std::array< std::string, 3 > regionNames_
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeomToken_
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
MonitorElement * NumberOfRecHitMuon_
static std::string name(const RPCDetId &detId, const bool useRoll)
virtual TrackingRecHit * clone() const =0
std::map< std::string, MonitorElement * > regionMuonCollection
Log< level::Info, false > LogInfo
int detId2RollNr(const RPCDetId &_id)
std::map< std::string, MonitorElement * > sectorRingNoiseCollection
void bookWheelDiskME(DQMStore::IBooker &, const std::string &, std::map< std::string, MonitorElement *> &)
Booking of MonitoringElemnt at Wheel/Disk level.
static std::string chamberName(const RPCDetId &detId)
edm::EDGetTokenT< RPCRecHitCollection > rpcRecHitLabel_
edm::EDGetTokenT< DcsStatusCollection > scalersRawToDigiLabel_
std::map< std::string, std::map< std::string, MonitorElement * > > meNoiseCollection
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
void bookRegionME(DQMStore::IBooker &, const std::string &, std::map< std::string, MonitorElement *> &)
Booking of MonitoringElemnt at region (Barrel/Endcap) level.
void performSourceOperation(std::map< RPCDetId, std::vector< RPCRecHit > > &, std::string)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::map< std::string, MonitorElement * > wheelDiskMuonCollection
std::map< std::string, MonitorElement * > regionNoiseCollection
MonitorElement * noiseRPCEvents_
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
MonitorElement * NumberOfMuon_
bool isGlobalMuon() const override
std::string subsystemFolder_
void bookRollME(DQMStore::IBooker &, const RPCDetId &, const RPCGeometry *rpcGeo, const std::string &, std::map< std::string, MonitorElement *> &)
Booking of MonitoringElement for one RPCDetId (= roll)
edm::EDGetTokenT< reco::CandidateView > muonLabel_
double eta() const final
momentum pseudorapidity