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;
189 std::vector<RPCRecHit>::const_iterator muonRecHitIter;
191 for (rpcRecHitIter = rpcHits->begin(); rpcRecHitIter != rpcHits->end() ; rpcRecHitIter++) {
194 if(rechitNoise.find(detId) == rechitNoise.end() || rechitNoise[detId].empty() ){
195 std::vector<RPCRecHit> myVect(1,rpcRecHit );
196 rechitNoise[detId]= myVect;
198 rechitNoise[detId].push_back(rpcRecHit);
202 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())
return;
220 std::map<std::string, std::map<std::string, MonitorElement*> > meRollCollection ;
221 std::map<std::string, MonitorElement*> meWheelDisk ;
222 std::map<std::string, MonitorElement*> meRegion ;
223 std::map<std::string, MonitorElement*> meSectorRing;
236 edm::LogWarning(
"rpcmonitordigi")<<
"[RPCMonitorDigi]: RecHit type not valid.";
240 int totalNumberOfRecHits[3] ={ 0, 0, 0};
241 std::stringstream os;
244 for (
std::map<
RPCDetId , std::vector<RPCRecHit> >::const_iterator detIdIter = recHitMap.begin(); detIdIter != recHitMap.end() ; detIdIter++){
246 RPCDetId detId = (*detIdIter).first;
259 int wheelOrDiskNumber;
262 int sector = detId.
sector();
265 int roll = detId.
roll();
267 wheelOrDiskType =
"Wheel";
268 wheelOrDiskNumber = (
int)detId.
ring();
272 if(detId.
layer() == 1){
279 if(roll == 3) roll =2;
280 }
else if(station == 2){
281 if(detId.
layer() == 1){
283 if(
abs(wheelOrDiskNumber) ==2 && roll == 3) {
289 if(
abs(wheelOrDiskNumber) !=2 && roll == 3){
294 }
else if (station == 3){
297 if(roll == 3) roll =2;
301 if(roll == 3) roll =2;
305 wheelOrDiskType =
"Disk";
306 wheelOrDiskNumber = region*(
int)detId.
station();
310 std::vector<RPCRecHit> recHits = (*detIdIter).second;
311 int numberOfRecHits = recHits.size();
312 totalNumberOfRecHits[region + 1 ] += numberOfRecHits;
314 std::set<int> bxSet ;
317 std::map<std::string, MonitorElement*> meMap = meRollCollection[nameRoll];
320 for(std::vector<RPCRecHit>::const_iterator recHitIter = recHits.begin(); recHitIter != recHits.end(); recHitIter++){
326 numDigi += clusterSize ;
328 int lastStrip = clusterSize + firstStrip - 1;
333 os<<
"Occupancy_"<<nameRoll;
334 if(meMap[os.str()]) {
335 for(
int s=firstStrip;
s<= lastStrip;
s++){
338 int nstrips = meMap[os.str()]->getNbinsX()/totalRolls;
339 meMap[os.str()]->Fill(
s + nstrips*(roll-1)); }
344 os<<
"BXDistribution_"<<nameRoll;
345 if(meMap[os.str()]) meMap[os.str()]->Fill(bx);
349 os<<
"ClusterSize_"<<nameRoll;
350 if(meMap[os.str()]) meMap[os.str()]->Fill(clusterSize);
358 os<<
"Occupancy_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber<<
"_Sector_"<<sector;
359 if( meSectorRing[os.str()]){
360 for(
int s=firstStrip;
s<= lastStrip;
s++){
361 meSectorRing[os.str()]->Fill(
s, nr);
367 os<<
"Occupancy_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber<<
"_Ring_"<<ring<<
"_CH01-CH18";
368 }
else if (geoServ.
segment() > 18 ){
369 os<<
"Occupancy_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber<<
"_Ring_"<<ring<<
"_CH19-CH36";
372 if( meSectorRing[os.str()]){
373 for(
int s=firstStrip;
s<= lastStrip;
s++){
374 meSectorRing[os.str()]->Fill(
s + 32*(detId.
roll()-1), geoServ.
segment());
381 os<<
"1DOccupancy_Wheel_"<<wheelOrDiskNumber;
382 if( meWheelDisk[os.str()]) meWheelDisk[os.str()]->Fill(sector, clusterSize);
385 os<<
"Occupancy_Roll_vs_Sector_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber;
386 if (meWheelDisk[os.str()]) meWheelDisk[os.str()]->Fill(sector, nr, clusterSize);
390 os<<
"1DOccupancy_Ring_"<<
ring;
391 if ((meWheelDisk[os.str()])){
392 if (wheelOrDiskNumber > 0 ) {meWheelDisk[os.str()]->Fill(wheelOrDiskNumber +
numberOfDisks_, clusterSize);}
393 else {meWheelDisk[os.str()]->Fill(wheelOrDiskNumber +
numberOfDisks_+1, clusterSize);}
397 os<<
"Occupancy_Ring_vs_Segment_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber;
398 if (meWheelDisk[os.str()]) meWheelDisk[os.str()]->Fill( geoServ.
segment(), (ring-1)*3-detId.
roll()+1,clusterSize );
402 os<<
"BxDistribution_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber;
403 if(meWheelDisk[os.str()]) meWheelDisk[os.str()]->Fill(bx);
407 os<<
"ClusterSize_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber<<
"_Layer"<<layer;
408 if(meWheelDisk[os.str()]) meWheelDisk[os.str()] ->
Fill(clusterSize);
412 os<<
"ClusterSize_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber<<
"_Ring"<<
ring;
413 if(meWheelDisk[os.str()]) meWheelDisk[os.str()] ->
Fill(clusterSize);
421 if(meRegion[os.str()]) meRegion[os.str()] ->
Fill(clusterSize);
430 if(meRegion[os.str()]) meRegion[os.str()] ->
Fill(clusterSize);
436 os<<
"BXWithData_"<<nameRoll;
437 if(meMap[os.str()]) meMap[os.str()]->Fill(bxSet.size());
440 os<<
"NumberOfClusters_"<<nameRoll;
441 if(meMap[os.str()]) meMap[os.str()]->Fill( numberOfRecHits);
445 if(meRegion[os.str()]) meRegion[os.str()]->Fill(numDigi);
449 os<<
"Occupancy_for_Barrel";
450 if(meRegion[os.str()]) meRegion[os.str()]->Fill(sector, wheelOrDiskNumber, numDigi);
452 os<<
"Occupancy_for_Endcap";
454 if (region==-1) {xbin = wheelOrDiskNumber+ numberOfDisks_+1;}
455 if(meRegion[os.str()]) {meRegion[os.str()]->Fill(xbin,ring,numDigi);}
459 os<<
"Multiplicity_"<<nameRoll;
460 if(meMap[os.str()]) meMap[os.str()]->Fill(numDigi);
464 for(
int i = 0;
i< 3;
i++ ){
467 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()
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)
void setCurrentFolder(const std::string &fullpath)
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_
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
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.