22 numberOfInnerRings_(0){
51 edm::LogInfo (
"rpcmonitordigi") <<
"[RPCMonitorDigi]: Begin Run " ;
53 std::set<int> disk_set, ring_set;
58 edm::LogInfo (
"rpcmonitordigi") <<
"[RPCMonitorDigi]: Booking histograms per roll. " ;
59 for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->
dets().begin();it<rpcGeo->
dets().end();it++){
60 if(dynamic_cast< const RPCChamber* >( *it ) != 0 ){
62 std::vector< const RPCRoll*> roles = (ch->
rolls());
64 for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++
r){
69 disk_set.insert(rpcId.
station());
70 ring_set.insert(rpcId.
ring());
86 disk_set.insert(rpcId.
station());
87 ring_set.insert(rpcId.
ring());
124 edm::LogInfo (
"rpcmonitordigi") <<
"[RPCMonitorDigi]: Beginning analyzing event " <<
counter;
130 std::map<RPCDetId , std::vector<RPCRecHit> > rechitMuon;
133 int numRPCRecHit = 0 ;
137 int nStaMuons = muonCands->
size();
139 for(
int i = 0;
i < nStaMuons;
i++ ) {
148 std::vector<TrackingRecHitRef > rpcTrackRecHits;
151 if (!(*it)->isValid ())
continue;
152 int muSubDetId = (*it)->geographicalId().subdetId();
157 int detId = (
int)rpcRecHit->
rpcId();
158 if(rechitMuon.find(detId) == rechitMuon.end() || rechitMuon[detId].size() == 0){
159 std::vector<RPCRecHit> myVect(1,*rpcRecHit );
160 rechitMuon[detId]= myVect;
162 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;
195 std::vector<RPCRecHit>::const_iterator muonRecHitIter;
197 for (rpcRecHitIter = rpcHits->begin(); rpcRecHitIter != rpcHits->end() ; rpcRecHitIter++) {
200 if(rechitNoise.find(detId) == rechitNoise.end() || rechitNoise[detId].size() == 0){
201 std::vector<RPCRecHit> myVect(1,rpcRecHit );
202 rechitNoise[detId]= myVect;
204 rechitNoise[detId].push_back(rpcRecHit);
208 edm::LogError (
"rpcmonitordigi") <<
"[RPCMonitorDigi]: RPCRecHits - Product not valid for event" <<
counter;
222 edm::LogInfo (
"rpcmonitordigi") <<
"[RPCMonitorDigi]: Performing DQM source operations for ";
224 if(recHitMap.size()==0) {
return;}
226 std::map<std::string, std::map<std::string, MonitorElement*> > meRollCollection ;
227 std::map<std::string, MonitorElement*> meWheelDisk ;
228 std::map<std::string, MonitorElement*> meRegion ;
229 std::map<std::string, MonitorElement*> meSectorRing;
242 edm::LogWarning(
"rpcmonitordigi")<<
"[RPCMonitorDigi]: RecHit type not valid.";
246 int totalNumberOfRecHits[3] ={ 0, 0, 0};
247 std::stringstream os;
250 for (
std::map<
RPCDetId , std::vector<RPCRecHit> >::const_iterator detIdIter = recHitMap.begin(); detIdIter != recHitMap.end() ; detIdIter++){
252 RPCDetId detId = (*detIdIter).first;
266 int wheelOrDiskNumber;
269 int sector = detId.
sector();
272 int roll = detId.
roll();
274 wheelOrDiskType =
"Wheel";
275 wheelOrDiskNumber = (
int)detId.
ring();
279 if(detId.
layer() == 1){
286 if(roll == 3) roll =2;
287 }
else if(station == 2){
288 if(detId.
layer() == 1){
290 if(
abs(wheelOrDiskNumber) ==2 && roll == 3) {
296 if(
abs(wheelOrDiskNumber) !=2 && roll == 3){
301 }
else if (station == 3){
304 if(roll == 3) roll =2;
308 if(roll == 3) roll =2;
312 wheelOrDiskType =
"Disk";
313 wheelOrDiskNumber = region*(
int)detId.
station();
317 std::vector<RPCRecHit> recHits = (*detIdIter).second;
318 int numberOfRecHits = recHits.size();
319 totalNumberOfRecHits[region + 1 ] += numberOfRecHits;
321 std::set<int> bxSet ;
324 std::map<std::string, MonitorElement*> meMap = meRollCollection[nameRoll];
327 for(std::vector<RPCRecHit>::const_iterator recHitIter = recHits.begin(); recHitIter != recHits.end(); recHitIter++){
333 numDigi += clusterSize ;
335 int lastStrip = clusterSize + firstStrip - 1;
340 os<<
"Occupancy_"<<nameRoll;
341 if(meMap[os.str()]) {
342 for(
int s=firstStrip;
s<= lastStrip;
s++){
345 int nstrips = meMap[os.str()]->getNbinsX()/totalRolls;
346 meMap[os.str()]->Fill(
s + nstrips*(roll-1)); }
351 os<<
"BXDistribution_"<<nameRoll;
352 if(meMap[os.str()]) meMap[os.str()]->Fill(bx);
356 os<<
"ClusterSize_"<<nameRoll;
357 if(meMap[os.str()]) meMap[os.str()]->Fill(clusterSize);
365 os<<
"Occupancy_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber<<
"_Sector_"<<sector;
366 if( meSectorRing[os.str()]){
367 for(
int s=firstStrip;
s<= lastStrip;
s++){
368 meSectorRing[os.str()]->Fill(
s, nr);
374 os<<
"Occupancy_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber<<
"_Ring_"<<ring<<
"_CH01-CH18";
375 }
else if (geoServ.
segment() > 18 ){
376 os<<
"Occupancy_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber<<
"_Ring_"<<ring<<
"_CH19-CH36";
379 if( meSectorRing[os.str()]){
380 for(
int s=firstStrip;
s<= lastStrip;
s++){
381 meSectorRing[os.str()]->Fill(
s + 32*(detId.
roll()-1), geoServ.
segment());
388 os<<
"1DOccupancy_Wheel_"<<wheelOrDiskNumber;
389 if( meWheelDisk[os.str()]) meWheelDisk[os.str()]->Fill(sector, clusterSize);
392 os<<
"Occupancy_Roll_vs_Sector_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber;
393 if (meWheelDisk[os.str()]) meWheelDisk[os.str()]->Fill(sector, nr, clusterSize);
397 os<<
"1DOccupancy_Ring_"<<
ring;
398 if ((meWheelDisk[os.str()])){
399 if (wheelOrDiskNumber > 0 ) {meWheelDisk[os.str()]->Fill(wheelOrDiskNumber +
numberOfDisks_, clusterSize);}
400 else {meWheelDisk[os.str()]->Fill(wheelOrDiskNumber +
numberOfDisks_+1, clusterSize);}
404 os<<
"Occupancy_Ring_vs_Segment_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber;
405 if (meWheelDisk[os.str()]) meWheelDisk[os.str()]->Fill( geoServ.
segment(), (ring-1)*3-detId.
roll()+1,clusterSize );
409 os<<
"BxDistribution_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber;
410 if(meWheelDisk[os.str()]) meWheelDisk[os.str()]->Fill(bx);
414 os<<
"ClusterSize_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber<<
"_Layer"<<layer;
415 if(meWheelDisk[os.str()]) meWheelDisk[os.str()] ->
Fill(clusterSize);
419 os<<
"ClusterSize_"<<wheelOrDiskType<<
"_"<<wheelOrDiskNumber<<
"_Ring"<<
ring;
420 if(meWheelDisk[os.str()]) meWheelDisk[os.str()] ->
Fill(clusterSize);
428 if(meRegion[os.str()]) meRegion[os.str()] ->
Fill(clusterSize);
437 if(meRegion[os.str()]) meRegion[os.str()] ->
Fill(clusterSize);
443 os<<
"BXWithData_"<<nameRoll;
444 if(meMap[os.str()]) meMap[os.str()]->Fill(bxSet.size());
447 os<<
"NumberOfClusters_"<<nameRoll;
448 if(meMap[os.str()]) meMap[os.str()]->Fill( numberOfRecHits);
452 if(meRegion[os.str()]) meRegion[os.str()]->Fill(numDigi);
456 os<<
"Occupancy_for_Barrel";
457 if(meRegion[os.str()]) meRegion[os.str()]->Fill(sector, wheelOrDiskNumber, numDigi);
459 os<<
"Occupancy_for_Endcap";
461 if (region==-1) {xbin = wheelOrDiskNumber+ numberOfDisks_+1;}
462 if(meRegion[os.str()]) {meRegion[os.str()]->Fill(xbin,ring,numDigi);}
466 os<<
"Multiplicity_"<<nameRoll;
467 if(meMap[os.str()]) meMap[os.str()]->Fill(numDigi);
471 for(
int i = 0;
i< 3;
i++ ){
474 if(meRegion[os.str()]) meRegion[os.str()]->Fill( totalNumberOfRecHits[
i]);
virtual std::string chambername()
T getParameter(std::string const &) const
virtual double pt() const final
transverse momentum
std::map< std::string, MonitorElement * > regionMuonCollection
std::map< std::string, MonitorElement * > sectorRingNoiseCollection
int firstClusterStrip() const
T getUntrackedParameter(std::string const &, T const &) const
std::string globalFolder_
virtual double eta() const final
momentum pseudorapidity
std::map< std::string, MonitorElement * > wheelDiskMuonCollection
std::map< std::string, MonitorElement * > regionNoiseCollection
bool isGlobalMuon() const
def setup(process, global_tag, zero_tesla=False)
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 &)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
std::map< std::string, MonitorElement * > wheelDiskNoiseCollection
static const std::string regionNames_[3]
Geometry.
RPCDetId rpcId() const
Return the rpcId.
virtual std::string name()
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
void bookRollME(DQMStore::IBooker &, RPCDetId &, const edm::EventSetup &, const std::string &, std::map< std::string, MonitorElement * > &)
Booking of MonitoringElement for one RPCDetId (= roll)
virtual TrackingRecHit * clone() const =0
MonitorElement * book1D(Args &&...args)
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Abs< T >::type abs(const T &t)
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)
virtual 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_
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.