21 numberOfInnerRings_(0){
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 ){
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());
80 disk_set.insert(rpcId.
station());
81 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 ;
131 int nStaMuons = muonCands->
size();
133 for(
int i = 0;
i < nStaMuons;
i++ ) {
142 std::vector<TrackingRecHitRef > rpcTrackRecHits;
145 if (!(*it)->isValid ())
continue;
146 int muSubDetId = (*it)->geographicalId().subdetId();
151 int detId = (
int)rpcRecHit->
rpcId();
152 if(rechitMuon.find(detId) == rechitMuon.end() || rechitMuon[detId].empty() ){
153 std::vector<RPCRecHit> myVect(1,*rpcRecHit );
154 rechitMuon[detId]= myVect;
156 rechitMuon[detId].push_back(*rpcRecHit);
176 edm::LogError (
"rpcmonitordigi") <<
"[RPCMonitorDigi]: Muons - Product not valid for event" <<
counter;
182 std::map<RPCDetId , std::vector<RPCRecHit> > rechitNoise;
188 for (
auto rpcRecHitIter = rpcHits->begin(); rpcRecHitIter != rpcHits->end() ; rpcRecHitIter++) {
191 if(rechitNoise.find(detId) == rechitNoise.end() || rechitNoise[detId].empty() ){
192 std::vector<RPCRecHit> myVect(1,rpcRecHit );
193 rechitNoise[detId]= myVect;
195 rechitNoise[detId].push_back(rpcRecHit);
199 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())
return;
217 std::map<std::string, std::map<std::string, MonitorElement*> > meRollCollection ;
218 std::map<std::string, MonitorElement*> meWheelDisk ;
219 std::map<std::string, MonitorElement*> meRegion ;
220 std::map<std::string, MonitorElement*> meSectorRing;
233 edm::LogWarning(
"rpcmonitordigi")<<
"[RPCMonitorDigi]: RecHit type not valid.";
237 int totalNumberOfRecHits[3] ={ 0, 0, 0};
238 std::stringstream os;
241 for (
std::map<
RPCDetId , std::vector<RPCRecHit> >::const_iterator detIdIter = recHitMap.begin(); detIdIter != recHitMap.end() ; detIdIter++){
243 RPCDetId detId = (*detIdIter).first;
256 int wheelOrDiskNumber;
259 int sector = detId.
sector();
262 int roll = detId.
roll();
264 wheelOrDiskType =
"Wheel";
265 wheelOrDiskNumber = (
int)detId.
ring();
269 if(detId.
layer() == 1){
276 if(roll == 3) roll =2;
277 }
else if(station == 2){
278 if(detId.
layer() == 1){
280 if(
abs(wheelOrDiskNumber) ==2 && roll == 3) {
286 if(
abs(wheelOrDiskNumber) !=2 && roll == 3){
291 }
else if (station == 3){
294 if(roll == 3) roll =2;
298 if(roll == 3) roll =2;
302 wheelOrDiskType =
"Disk";
303 wheelOrDiskNumber = region*(
int)detId.
station();
307 std::vector<RPCRecHit> recHits = (*detIdIter).second;
308 int numberOfRecHits = recHits.size();
309 totalNumberOfRecHits[region + 1 ] += numberOfRecHits;
311 std::set<int> bxSet ;
314 std::map<std::string, MonitorElement*> meMap = meRollCollection[nameRoll];
317 for(std::vector<RPCRecHit>::const_iterator recHitIter = recHits.begin(); recHitIter != recHits.end(); recHitIter++){
323 numDigi += clusterSize ;
325 int lastStrip = clusterSize + firstStrip - 1;
330 os<<
"Occupancy_"<<nameRoll;
331 if(meMap[os.str()]) {
332 for(
int s=firstStrip;
s<= lastStrip;
s++){
335 int nstrips = meMap[os.str()]->getNbinsX()/totalRolls;
336 meMap[os.str()]->Fill(
s + nstrips*(roll-1)); }
341 os<<
"BXDistribution_"<<nameRoll;
342 if(meMap[os.str()]) meMap[os.str()]->Fill(bx);
346 os<<
"ClusterSize_"<<nameRoll;
347 if(meMap[os.str()]) meMap[os.str()]->Fill(clusterSize);
355 os<<
"Occupancy_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber<<
"_Sector_"<<sector;
356 if( meSectorRing[os.str()]){
357 for(
int s=firstStrip;
s<= lastStrip;
s++){
358 meSectorRing[os.str()]->Fill(
s, nr);
364 os<<
"Occupancy_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber<<
"_Ring_"<<ring<<
"_CH01-CH18";
365 }
else if (geoServ.
segment() > 18 ){
366 os<<
"Occupancy_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber<<
"_Ring_"<<ring<<
"_CH19-CH36";
369 if( meSectorRing[os.str()]){
370 for(
int s=firstStrip;
s<= lastStrip;
s++){
371 meSectorRing[os.str()]->Fill(
s + 32*(detId.
roll()-1), geoServ.
segment());
378 os<<
"1DOccupancy_Wheel_"<<wheelOrDiskNumber;
379 if( meWheelDisk[os.str()]) meWheelDisk[os.str()]->Fill(sector, clusterSize);
382 os<<
"Occupancy_Roll_vs_Sector_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber;
383 if (meWheelDisk[os.str()]) meWheelDisk[os.str()]->Fill(sector, nr, clusterSize);
387 os<<
"1DOccupancy_Ring_"<<
ring;
388 if ((meWheelDisk[os.str()])){
389 if (wheelOrDiskNumber > 0 ) {meWheelDisk[os.str()]->Fill(wheelOrDiskNumber +
numberOfDisks_, clusterSize);}
390 else {meWheelDisk[os.str()]->Fill(wheelOrDiskNumber +
numberOfDisks_+1, clusterSize);}
394 os<<
"Occupancy_Ring_vs_Segment_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber;
395 if (meWheelDisk[os.str()]) meWheelDisk[os.str()]->Fill( geoServ.
segment(), (ring-1)*3-detId.
roll()+1,clusterSize );
399 os<<
"BxDistribution_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber;
400 if(meWheelDisk[os.str()]) meWheelDisk[os.str()]->Fill(bx);
404 os<<
"ClusterSize_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber<<
"_Layer"<<layer;
405 if(meWheelDisk[os.str()]) meWheelDisk[os.str()] ->
Fill(clusterSize);
409 os<<
"ClusterSize_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber<<
"_Ring"<<
ring;
410 if(meWheelDisk[os.str()]) meWheelDisk[os.str()] ->
Fill(clusterSize);
418 if(meRegion[os.str()]) meRegion[os.str()] ->
Fill(clusterSize);
427 if(meRegion[os.str()]) meRegion[os.str()] ->
Fill(clusterSize);
433 os<<
"BXWithData_"<<nameRoll;
434 if(meMap[os.str()]) meMap[os.str()]->Fill(bxSet.size());
437 os<<
"NumberOfClusters_"<<nameRoll;
438 if(meMap[os.str()]) meMap[os.str()]->Fill( numberOfRecHits);
442 if(meRegion[os.str()]) meRegion[os.str()]->Fill(numDigi);
446 os<<
"Occupancy_for_Barrel";
447 if(meRegion[os.str()]) meRegion[os.str()]->Fill(sector, wheelOrDiskNumber, numDigi);
449 os<<
"Occupancy_for_Endcap";
451 if (region==-1) {xbin = wheelOrDiskNumber+ numberOfDisks_+1;}
452 if(meRegion[os.str()]) {meRegion[os.str()]->Fill(xbin,ring,numDigi);}
456 os<<
"Multiplicity_"<<nameRoll;
457 if(meMap[os.str()]) meMap[os.str()]->Fill(numDigi);
461 for(
int i = 0;
i< 3;
i++ ){
464 if(meRegion[os.str()]) meRegion[os.str()]->Fill( totalNumberOfRecHits[
i]);
virtual std::string chambername()
T getParameter(std::string const &) const
std::map< std::string, MonitorElement * > regionMuonCollection
std::map< std::string, MonitorElement * > sectorRingNoiseCollection
int firstClusterStrip() const
T getUntrackedParameter(std::string const &, T const &) const
double eta() const final
momentum pseudorapidity
std::string globalFolder_
std::map< std::string, MonitorElement * > wheelDiskMuonCollection
std::map< std::string, MonitorElement * > regionNoiseCollection
def setup(process, global_tag, zero_tesla=False)
double pt() const final
transverse momentum
std::map< std::string, std::map< std::string, MonitorElement * > > meNoiseCollection
MonitorElement * muonRPCEvents_
void bookSectorRingME(DQMStore::IBooker &, const std::string &, std::map< std::string, MonitorElement * > &)
Booking of MonitoringElement at Sector/Ring level.
RPCMonitorDigi(const edm::ParameterSet &)
void analyze(const edm::Event &, const edm::EventSetup &) override
std::map< std::string, MonitorElement * > wheelDiskNoiseCollection
RPCDetId rpcId() const
Return the rpcId.
virtual std::string name()
void setCurrentFolder(std::string const &fullpath)
bool isGlobalMuon() const override
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
virtual TrackingRecHit * clone() const =0
void bookRollME(DQMStore::IBooker &, const RPCDetId &, const RPCGeometry *rpcGeo, const std::string &, std::map< std::string, MonitorElement * > &)
Booking of MonitoringElement for one RPCDetId (= roll)
MonitorElement * book1D(Args &&...args)
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Abs< T >::type abs(const T &t)
static const std::array< std::string, 3 > regionNames_
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
MonitorElement * NumberOfRecHitMuon_
int detId2RollNr(const RPCDetId &_id)
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
edm::EDGetTokenT< RPCRecHitCollection > rpcRecHitLabel_
edm::EDGetTokenT< DcsStatusCollection > scalersRawToDigiLabel_
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
void performSourceOperation(std::map< RPCDetId, std::vector< RPCRecHit > > &, std::string)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void bookWheelDiskME(DQMStore::IBooker &, const std::string &, std::map< std::string, MonitorElement * > &)
Booking of MonitoringElemnt at Wheel/Disk level.
MonitorElement * noiseRPCEvents_
std::map< std::string, MonitorElement * > sectorRingMuonCollection
std::map< std::string, std::map< std::string, MonitorElement * > > meMuonCollection
void bookRegionME(DQMStore::IBooker &, const std::string &, std::map< std::string, MonitorElement * > &)
Booking of MonitoringElemnt at region (Barrel/Endcap) level.
MonitorElement * NumberOfMuon_
T const * product() const
std::string subsystemFolder_
edm::EDGetTokenT< reco::CandidateView > muonLabel_
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.