CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

RPCMonitorDigi Class Reference

#include <RPCMonitorDigi.h>

Inheritance diagram for RPCMonitorDigi:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
void beginRun (const edm::Run &r, const edm::EventSetup &c)
std::map< std::string,
MonitorElement * > 
bookDetUnitME (RPCDetId &, const edm::EventSetup &)
 Booking of MonitoringElemnt for one RPCDetId (= roll)
std::map< std::string,
MonitorElement * > 
bookRegionRing (int region, int ring)
 Booking of MonitoringElemnt at Wheel/Disk level.
virtual void endJob (void)
 RPCMonitorDigi (const edm::ParameterSet &)
 Data Format.
 ~RPCMonitorDigi ()

Private Member Functions

void makeDcsInfo (const edm::Event &)
int stripsInRoll (RPCDetId &, const edm::EventSetup &)

Private Attributes

MonitorElementBarrelNumberOfDigis
MonitorElementBarrelOccupancy
MonitorElementClusterSize_for_Barrel
MonitorElementClusterSize_for_BarrelandEndcaps
MonitorElementClusterSize_for_EndcapNegative
MonitorElementClusterSize_for_EndcapPositive
int counter
DQMStoredbe
 DQM store.
bool dcs_
std::string digiLabel
bool dqmexpert
bool dqmshifter
bool dqmsuperexpert
MonitorElementEndcapNegativeOccupancy
MonitorElementEndcapPositiveOccupancy
std::string globalFolder_
std::string GlobalHistogramsFolder
std::map< uint32_t, std::map
< std::string, MonitorElement * > > 
meCollection
bool mergeRuns_
std::map< std::pair< int, int >
, std::map< std::string,
MonitorElement * > > 
meWheelDisk
std::string muonNoise_
std::string nameInLog
MonitorElementNumberOfClusters_for_Barrel
MonitorElementNumberOfClusters_for_EndcapNegative
MonitorElementNumberOfClusters_for_EndcapPositive
MonitorElementNumberOfDigis_for_Barrel
MonitorElementNumberOfDigis_for_EndcapNegative
MonitorElementNumberOfDigis_for_EndcapPositive
std::string RootFileName
std::string RPCDataLabel
edm::InputTag RPCDigiLabel_
MonitorElementRPCEvents
edm::ESHandle< RPCGeometryrpcGeo
edm::InputTag RPCRecHitLabel_
MonitorElementSameBxDigisMeBarrel_
MonitorElementSameBxDigisMeEndcapNegative_
MonitorElementSameBxDigisMeEndcapPositive_
bool saveRootFile

Detailed Description

Definition at line 23 of file RPCMonitorDigi.h.


Constructor & Destructor Documentation

RPCMonitorDigi::RPCMonitorDigi ( const edm::ParameterSet pset) [explicit]

Data Format.

Geometry Log messages

Definition at line 24 of file RPCMonitorDigi.cc.

References dqmexpert, dqmshifter, dqmsuperexpert, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), globalFolder_, mergeRuns_, muonNoise_, nameInLog, RootFileName, RPCDigiLabel_, RPCRecHitLabel_, and saveRootFile.

                                                           :counter(0){

  nameInLog = pset.getUntrackedParameter<std::string>("moduleLogName", "rpcmonitordigi");

  saveRootFile  = pset.getUntrackedParameter<bool>("DigiDQMSaveRootFile", false); 
  mergeRuns_  = pset.getUntrackedParameter<bool>("MergeDifferentRuns", false); 
  // saveRootFileEventsInterval  = pset.getUntrackedParameter<int>("DigiEventsInterval", 10000);
  RootFileName  = pset.getUntrackedParameter<std::string>("RootFileNameDigi", "RPCMonitor.root"); 

  globalFolder_ = pset.getUntrackedParameter<std::string>("RPCGlobalFolder", "RPC/RecHits/SummaryHistograms");
  muonNoise_ = pset.getUntrackedParameter<std::string>("DataType", "Noise");

  dqmshifter = pset.getUntrackedParameter<bool>("dqmshifter", false);
  dqmexpert = pset.getUntrackedParameter<bool>("dqmexpert", false);
  dqmsuperexpert = pset.getUntrackedParameter<bool>("dqmsuperexpert", false);

  RPCRecHitLabel_ = pset.getParameter<edm::InputTag>("RecHitLabel");
  RPCDigiLabel_ =pset.getParameter<edm::InputTag>("DigiLabel");
}
RPCMonitorDigi::~RPCMonitorDigi ( )

Definition at line 44 of file RPCMonitorDigi.cc.

{}

Member Function Documentation

void RPCMonitorDigi::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Digis

end loop on RPCRecHits for given roll

end loop on RPC Digi Collection

must be fixed!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Implements edm::EDAnalyzer.

Definition at line 152 of file RPCMonitorDigi.cc.

References BarrelOccupancy, ClusterSize_for_Barrel, ClusterSize_for_BarrelandEndcaps, ClusterSize_for_EndcapNegative, ClusterSize_for_EndcapPositive, counter, dcs_, rpcdqm::utils::detId2RollNr(), dqmexpert, dqmsuperexpert, EndcapNegativeOccupancy, EndcapPositiveOccupancy, error, MonitorElement::Fill(), spr::find(), edm::Event::getByLabel(), ExpressReco_HICollisions_FallBack::id, getHLTprescales::index, makeDcsInfo(), meCollection, meWheelDisk, VarParsing::mult, RPCGeomServ::name(), nameInLog, NumberOfClusters_for_Barrel, NumberOfClusters_for_EndcapNegative, NumberOfClusters_for_EndcapPositive, NumberOfDigis_for_Barrel, NumberOfDigis_for_EndcapNegative, NumberOfDigis_for_EndcapPositive, point, RPCDetId::region(), RPCDetId::ring(), relativeConstraints::ring, RPCDetId::roll(), RPCDigiLabel_, RPCEvents, rpcGeo, RPCRecHitLabel_, SameBxDigisMeBarrel_, RPCDetId::sector(), RPCGeomServ::segment(), RPCDetId::station(), strip(), GeomDet::surface(), Surface::toGlobal(), and ExpressReco_HICollisions_FallBack::x.

                                                                               {
  
  this->makeDcsInfo(iEvent);
  if( !dcs_) return;//if RPC not ON there's no need to continue

  counter++;

  edm::LogInfo (nameInLog) <<"[RPCMonitorDigi]: Beginning analyzing event " << counter;  

  edm::Handle<RPCDigiCollection> rpcdigis;
  iEvent.getByLabel(RPCDigiLabel_, rpcdigis);

  //RecHits
  edm::Handle<RPCRecHitCollection> rpcHits;
  iEvent.getByLabel(RPCRecHitLabel_,rpcHits);

  std::map<int,int> bxMap;
 
  if(rpcdigis->begin()!=rpcdigis->end())  RPCEvents -> Fill(1);

  //Loop on digi collection
  for( RPCDigiCollection::DigiRangeIterator collectionItr=rpcdigis->begin(); collectionItr!=rpcdigis->end(); ++collectionItr){
  
    RPCDetId detId=(*collectionItr).first; 
    uint32_t id=detId(); 

    const GeomDet* gdet=rpcGeo->idToDet(detId);
    const BoundPlane & surface = gdet->surface();
    
    //get roll name
    RPCGeomServ RPCname(detId);
    std::string nameRoll = RPCname.name();
    //string YLabel = RPCname.shortname(); // to be removed later!!!
    std::stringstream os;

    //get roll number
    rpcdqm::utils prova;
    int nr = prova.detId2RollNr(detId);
    
    //get MEs corresponding to present detId  
    std::map<std::string, MonitorElement*> meMap=meCollection[id]; 
    if(meMap.size()==0) continue; 

    int region=detId.region();
    int ring;
    std::string ringType;
    if(region == 0) {
      ringType = "Wheel";  
      ring = detId.ring();
    }else{
      ringType =  "Disk";
      ring = region*detId.station();
    }
   
    //get wheel/disk MEs
    std::pair<int,int> regionRing(region,ring);
    std::map<std::string, MonitorElement*> meRingMap=meWheelDisk[regionRing];
    if(meRingMap.size()==0) continue;

    std::vector<std::pair <int,int> > duplicatedDigi;  
    std::vector<int> bxs;     

    //get the RecHits associated to the roll
    typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits;
    rangeRecHits recHitCollection =  rpcHits->get(detId);
 
    int numberOfDigi= 0;

    RPCDigiCollection::const_iterator digiItr; 
    //loop on digis of given roll
    for (digiItr =(*collectionItr ).second.first;digiItr != (*collectionItr ).second.second; ++digiItr){
      int strip= (*digiItr).strip();
      int bx=(*digiItr).bx();
    
      //remove duplicated digis
      std::vector<std::pair <int,int> >::const_iterator itrDuplDigi = find(duplicatedDigi.begin(),duplicatedDigi.end(),std::make_pair(strip, bx));
      if(itrDuplDigi!=duplicatedDigi.end() && duplicatedDigi.size()!=0) continue;
    
      duplicatedDigi.push_back(std::make_pair(strip, bx));
      ++numberOfDigi;
  
      //bunch crossing
      std::vector<int>::const_iterator existingBX = find(bxs.begin(),bxs.end(),bx);
      if(existingBX==bxs.end())bxs.push_back(bx);
   
      //adding new histo C.Carrillo & A. Cimmino
      std::map<int,int>::const_iterator bxItr = bxMap.find((*digiItr).bx());
      if (bxItr == bxMap.end()|| bxMap.size()==0 )bxMap[(*digiItr).bx()]=1;
      else bxMap[(*digiItr).bx()]++;
   
      //sector based histograms for dqm shifter
      os.str("");
      os<<"1DOccupancy_"<<ringType<<"_"<<ring;
      std::string meId = os.str();
      if( meRingMap[meId]){
        meRingMap[meId]->Fill(detId.sector());
        // label
      }

      os.str("");
      os<<"BxDistribution_"<<ringType<<"_"<<ring<<"_Sector_"<<detId.sector();
      if(meMap[os.str()])
        meMap[os.str()]->Fill(bx);
   
      os.str("");
      os<<"BxDistribution_"<<ringType<<"_"<<ring;
      if(meRingMap[os.str()])
        meRingMap[os.str()]->Fill(bx);
   
      if(detId.region()==0)
        BarrelOccupancy -> Fill(detId.sector(), ring);
      else if(detId.region()==1)
        EndcapPositiveOccupancy -> Fill(detId.sector(), ring);
      else if(detId.region()==-1)
        EndcapNegativeOccupancy -> Fill(detId.sector(),( -1 * ring) );//for RE- ring is negative 

      os.str("");
      os<<"Occupancy_"<<ringType<<"_"<<ring<<"_Sector_"<<detId.sector();
      if(meMap[os.str()]){ 
        if(detId.region() ==0)  meMap[os.str()]->Fill(strip, nr);
        else    meMap[os.str()]->Fill(strip + 32*(detId.roll()-1),  RPCname.segment()+ ((detId.ring() -2)*6));
      }

      os.str("");
      os<<"Occupancy_"<<nameRoll;
      if(meMap[os.str()]) meMap[os.str()]->Fill(strip);
      
      os.str("");
      os<<"Occupancy_Roll_vs_Sector_"<<ringType<<"_"<<ring;       
      if (meRingMap[os.str()]) {
        meRingMap[os.str()]->Fill(detId.sector(), nr, 1);
      }
 
      os.str("");
      os<<"Occupancy_Ring_vs_Segment_"<<ringType<<"_"<<ring;   
       if (meRingMap[os.str()]) {
        meRingMap[os.str()]->Fill( RPCname.segment(), (detId.ring()-1)*3-detId.roll()+1, 1);
      }
    
      if(dqmexpert){    
        os.str("");
        os<<"BXN_"<<nameRoll;
        if(meMap[os.str()]) meMap[os.str()]->Fill(bx);
        }
  
      if (dqmsuperexpert) {     
        os.str("");
        os<<"BXN_vs_strip_"<<nameRoll;
        if(meMap[os.str()]) meMap[os.str()]->Fill(strip,bx);
      }
    }  //end loop of digis of given roll
  
    if (dqmexpert){
      os.str("");
      os<<"BXWithData_"<<nameRoll;
      if(meMap[os.str()]) meMap[os.str()]->Fill(bxs.size());
    }
 
    os.str("");
    os<<"BXWithData_"<<ringType<<"_"<<ring<<"_Sector_"<<detId.sector();
    if(meMap[os.str()])
      meMap[os.str()]->Fill(bxs.size());

    if(numberOfDigi>50) numberOfDigi=50; //overflow
    
    os.str("");
    os<<"Multiplicity_"<<nameRoll;
    if(meMap[os.str()])   meMap[os.str()]->Fill(numberOfDigi);   
    
    if(detId.region()==0) NumberOfDigis_for_Barrel -> Fill(numberOfDigi);
    else  if(detId.region()==1) NumberOfDigis_for_EndcapPositive -> Fill(numberOfDigi);
    else  if(detId.region()==-1)  NumberOfDigis_for_EndcapNegative -> Fill(numberOfDigi);
                                
    // Fill RecHit MEs   
    if(recHitCollection.first!=recHitCollection.second ){   
 
      RPCRecHitCollection::const_iterator it;
      int numberOfHits=0;    
      int numbOfClusters=0;
      //loop RPCRecHits for given roll
      for (it = recHitCollection.first; it != recHitCollection.second ; it++) {
        numbOfClusters++; 
        RPCDetId detIdRecHits=it->rpcId();
        LocalError error=it->localPositionError();//plot of errors/roll => should be gaussian   
        LocalPoint point=it->localPosition();     //plot of coordinates/roll =>should be flat
        GlobalPoint globalHitPoint=surface.toGlobal(point); 
 
        int mult=it->clusterSize();               //cluster size plot => should be within 1-3   
        int firstStrip=it->firstClusterStrip();    //plot first Strip => should be flat

        ClusterSize_for_BarrelandEndcaps -> Fill(mult);
 
        if(detId.region() ==  0) {
          ClusterSize_for_Barrel -> Fill(mult);
        } else if (detId.region() ==  -1) {
          if(mult<=10) ClusterSize_for_EndcapNegative -> Fill(mult);
          else ClusterSize_for_EndcapNegative -> Fill(11);         
        } else if (detId.region() ==  1) {
          if(mult<=10) ClusterSize_for_EndcapPositive -> Fill(mult);
          else ClusterSize_for_EndcapPositive -> Fill(11);
        } 

        //Cluster Size by Wheels and sector
        os.str("");
        os<<"ClusterSize_"<<ringType<<"_"<<ring;
        if(meRingMap[os.str()])
          meRingMap[os.str()] -> Fill(mult); 

        if (dqmsuperexpert) {
          int centralStrip=firstStrip;
          if(mult%2) {
            centralStrip+= mult/2;
          }else{        
            float x = gRandom->Uniform(2);
            centralStrip+=(x<1)? (mult/2)-1 : (mult/2);
          }

          os.str("");
          os<<"ClusterSize_vs_Strip_"<<nameRoll;
          if(meMap[os.str()])
            for(int index=0; index<mult; ++index)
              meMap[os.str()]->Fill(firstStrip+index,mult);
        }

        if(dqmexpert) {
          os.str("");
          os<<"ClusterSize_"<<nameRoll;
          if(meMap[os.str()])
            meMap[os.str()]->Fill(mult);
        }
        numberOfHits++;
      }
      
      if(dqmexpert) {    
        if(numberOfHits>20) numberOfHits=20;
        os.str("");
        os<<"NumberOfClusters_"<<nameRoll;
        if(meMap[os.str()])
          meMap[os.str()]->Fill(numbOfClusters);
        

        os.str("");
        os<<"RecHitCounter_"<<nameRoll;
        if(meMap[os.str()])
          meMap[os.str()]->Fill(numberOfHits);
      }
      
      if(detId.region()==0)
        NumberOfClusters_for_Barrel -> Fill(numbOfClusters);
      else if (detId.region()==1)
        NumberOfClusters_for_EndcapPositive -> Fill(numbOfClusters);
      else if(detId.region()==-1)
        NumberOfClusters_for_EndcapNegative -> Fill(numbOfClusters);      

    }
  }

  //adding new histo C.Carrillo & A. Cimmino
  for (std::map<int, int>::const_iterator myItr= bxMap.begin(); 
       myItr!=bxMap.end(); myItr++){
    SameBxDigisMeBarrel_ ->Fill((*myItr).second);
  } 
}
void RPCMonitorDigi::beginJob ( void  ) [virtual]

get hold of back-end interface

Reimplemented from edm::EDAnalyzer.

Definition at line 47 of file RPCMonitorDigi.cc.

References BarrelOccupancy, DQMStore::book1D(), ClusterSize_for_Barrel, ClusterSize_for_BarrelandEndcaps, ClusterSize_for_EndcapNegative, ClusterSize_for_EndcapPositive, dbe, dcs_, EndcapNegativeOccupancy, EndcapPositiveOccupancy, globalFolder_, i, nameInLog, NumberOfClusters_for_Barrel, NumberOfClusters_for_EndcapNegative, NumberOfClusters_for_EndcapPositive, NumberOfDigis_for_Barrel, NumberOfDigis_for_EndcapNegative, NumberOfDigis_for_EndcapPositive, cmsCodeRules::cppFunctionSkipper::operator, RPCEvents, SameBxDigisMeBarrel_, SameBxDigisMeEndcapNegative_, SameBxDigisMeEndcapPositive_, and DQMStore::setCurrentFolder().

                             {
  edm::LogInfo (nameInLog) <<"[RPCMonitorDigi]: Begin job" ;
  
  dbe = edm::Service<DQMStore>().operator->();

  dbe->setCurrentFolder(globalFolder_);  

  ClusterSize_for_Barrel = dbe->book1D("ClusterSize_for_Barrel", "ClusterSize for Barrel", 20, 0.5, 20.5);
  ClusterSize_for_EndcapPositive = dbe->book1D("ClusterSize_for_EndcapPositive", "ClusterSize for PositiveEndcap",  20, 0.5, 20.5);
  ClusterSize_for_EndcapNegative = dbe->book1D("ClusterSize_for_EndcapNegative", "ClusterSize for NegativeEndcap", 20, 0.5, 20.5);

  ClusterSize_for_BarrelandEndcaps = dbe->book1D("ClusterSize_for_BarrelandEndcap", "ClusterSize for Barrel&Endcaps", 20, 0.5, 20.5);

  NumberOfClusters_for_Barrel = dbe -> book1D("NumberOfClusters_for_Barrel", "NumberOfClusters for Barrel", 20, 0.5, 20.5);
  NumberOfClusters_for_EndcapPositive = dbe -> book1D("NumberOfClusters_for_EndcapPositive", "NumberOfClusters for Endcap Positive", 20, 0.5, 20.5);
  NumberOfClusters_for_EndcapNegative = dbe -> book1D("NumberOfClusters_for_EndcapNegative", "NumberOfClusters for Endcap Negative", 20, 0.5, 20.5);
  
  NumberOfDigis_for_Barrel = dbe -> book1D("NumberOfDigi_for_Barrel", "Number Of Digis in Barrel", 50, 0.5, 50.5);
  NumberOfDigis_for_EndcapPositive = dbe -> book1D("NumberOfDigi_for_EndcapPositive", "Number Of Digis in EndCapPositive", 50, 0.5, 50.5);
  NumberOfDigis_for_EndcapNegative= dbe -> book1D("NumberOfDigi_for_EndcapNegative", "Number Of Digis in EndCapNegative", 50, 0.5, 50.5);
  
  SameBxDigisMeBarrel_ = dbe->book1D("SameBXDigis_Barrel", "Digis with same bx", 20, 0.5, 20.5);  
  SameBxDigisMeEndcapPositive_ = dbe->book1D("SameBXDigis_EndcapPositive", "Digis with same bx", 20, 0.5, 20.5);  
  SameBxDigisMeEndcapNegative_ = dbe->book1D("SameBXDigis_EndcapNegative", "Digis with same bx", 20, 0.5, 20.5);  

  BarrelOccupancy = dbe -> book2D("Occupancy_for_Barrel", "Barrel Occupancy Wheel vs Sector", 12, 0.5, 12.5, 5, -2.5, 2.5);
  EndcapPositiveOccupancy = dbe -> book2D("Occupancy_for_EndcapPositive", "Endcap Positive Occupancy Disk vs Sector", 6, 0.5, 6.5, 4, 0.5, 4.5);
  EndcapNegativeOccupancy = dbe -> book2D("Occupancy_for_EndcapNegative", "Endcap Negative Occupancy Disk vs Sector", 6, 0.5, 6.5, 4, 0.5, 4.5);

  dbe->setCurrentFolder(globalFolder_);   
  RPCEvents = dbe -> book1D("RPCEvents", "RPC Events Barrel+EndCap", 1, 0.5, 1.5);
 
  std::stringstream binLabel;
  for (int i = 1; i<13; i++){
    binLabel.str("");
    binLabel<<"Sec"<<i;
    BarrelOccupancy -> setBinLabel(i, binLabel.str(), 1);
    if(i<6){
      binLabel.str("");
      binLabel<<"Wheel"<<i-3;
      BarrelOccupancy -> setBinLabel(i, binLabel.str(), 2);
    }    
    if(i<7) {
      binLabel.str("");
      binLabel<<"Sec"<<i;
      EndcapPositiveOccupancy -> setBinLabel(i, binLabel.str(), 1);
      EndcapNegativeOccupancy -> setBinLabel(i, binLabel.str(), 1);
    }
      if(i<5){
      binLabel.str("");
      binLabel<<"Disk+"<<i ;                                 ;
      EndcapPositiveOccupancy -> setBinLabel(i, binLabel.str(), 2);
      binLabel.str("");
      binLabel<<"Disk-"<<i  ;  
      EndcapNegativeOccupancy -> setBinLabel(i, binLabel.str(), 2);
    }
  }
  dcs_ = true;

}
void RPCMonitorDigi::beginRun ( const edm::Run r,
const edm::EventSetup c 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 109 of file RPCMonitorDigi.cc.

References bookDetUnitME(), bookRegionRing(), edm::EventSetup::get(), meCollection, meWheelDisk, RPCGeomServ::name(), nameInLog, csvReporter::r, RPCDetId::region(), RPCDetId::ring(), relativeConstraints::ring, RPCChamber::rolls(), rpcGeo, and RPCDetId::station().

                                                                         {

  edm::LogInfo (nameInLog) <<"Begin Run " ;
  
  iSetup.get<MuonGeometryRecord>().get(rpcGeo);

  //loop on geometry to book all MEs
  for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){
    if(dynamic_cast< RPCChamber* >( *it ) != 0 ){
      RPCChamber* ch = dynamic_cast< RPCChamber* >( *it ); 
      std::vector< const RPCRoll*> roles = (ch->rolls());
      for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++r){
        RPCDetId rpcId = (*r)->id();
        int region=rpcId.region();
        
        //booking all histograms
        RPCGeomServ rpcsrv(rpcId);
        std::string nameRoll = rpcsrv.name();
        //std::cout<<"Booking for "<<nameRoll<<std::endl;
        meCollection[(uint32_t)rpcId]=bookDetUnitME(rpcId,iSetup );
 
        int ring;
        if(rpcId.region() == 0) 
          ring = rpcId.ring();
        else 
          ring = rpcId.region()*rpcId.station();
        
        //book wheel/disk histos
        std::pair<int,int> regionRing(region,ring);
        std::map<std::pair<int,int>, std::map<std::string,MonitorElement*> >::iterator meRingItr = meWheelDisk.find(regionRing);
        if (meRingItr == meWheelDisk.end() || (meWheelDisk.size()==0))  meWheelDisk[regionRing]=bookRegionRing(region,ring);
      }
    }
  }//end loop on geometry to book all MEs
}
std::map< std::string, MonitorElement * > RPCMonitorDigi::bookDetUnitME ( RPCDetId detId,
const edm::EventSetup iSetup 
)

Booking of MonitoringElemnt for one RPCDetId (= roll)

Name components common to current RPCDetId

RPCRecHits

Definition at line 9 of file RPCBookDetUnitME.cc.

References DQMStore::book1D(), DQMStore::book2D(), rpcdqm::CLUSTERSIZE, dbe, dqmexpert, dqmsuperexpert, RPCBookFolderStructure::folderStructure(), DQMStore::get(), i, rpcdqm::utils::labelYAxisRoll(), rpcdqm::MULTIPLICITY, RPCGeomServ::name(), rpcdqm::OCCUPANCY, evf::evtn::offset(), csvReporter::r, RPCDetId::region(), RPCDetId::ring(), relativeConstraints::ring, RPCDetId::sector(), MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), RPCDetId::station(), stripsInRoll(), and DQMStore::tag().

Referenced by beginRun().

                                                                                                               {
  std::map<std::string, MonitorElement*> meMap;  

  std::string ringType;
  int ring;
  if(detId.region() == 0) {
    ringType = "Wheel";  
    ring = detId.ring();
  }else if (detId.region() == -1){  
    ringType =  "Disk";
    ring = detId.region()*detId.station();
  }else {
    ringType =  "Disk";
    ring = detId.station();
  }

  RPCBookFolderStructure *  folderStr = new RPCBookFolderStructure();
  std::string folder = "RPC/RecHits/" +  folderStr->folderStructure(detId);

  dbe->setCurrentFolder(folder);
  
  //get number of strips in current roll
  int nstrips = this->stripsInRoll(detId, iSetup);
  if (nstrips == 0 ) nstrips = 1;

  RPCGeomServ RPCname(detId);
  std::string nameRoll = RPCname.name();

  

  
  std::stringstream os;
  os.str("");
  os<<"Occupancy_"<<nameRoll;
  meMap[os.str()] = dbe->book1D(os.str(), os.str(), nstrips, 0.5, nstrips+0.5);
  dbe->tag( meMap[os.str()],  rpcdqm::OCCUPANCY);

  //cout<<meMap[os.str()]->flags()<<endl;


  if (dqmexpert) {    
    os.str("");
    os<<"BXN_"<<nameRoll;
    meMap[os.str()] = dbe->book1D(os.str(), os.str(), 21, -10.5, 10.5);

    os.str("");
    os<<"ClusterSize_"<<nameRoll;
    meMap[os.str()] = dbe->book1D(os.str(), os.str(), 20, 0.5, 20.5);
   dbe->tag( meMap[os.str()],  rpcdqm::CLUSTERSIZE);
   //os.str("");
//     os<<"NumberOfClusters_"<<nameRoll;
//     meMap[os.str()] = dbe->book1D(os.str(), os.str(), 10, 0.5, 10.5);

    os.str("");
    os<<"Multiplicity_"<<nameRoll;
    meMap[os.str()] = dbe->book1D(os.str(), os.str(), 50, 0.5, 50.5);
    dbe->tag( meMap[os.str()],  rpcdqm::MULTIPLICITY);

    os.str("");
    os<<"BXWithData_"<<nameRoll;
    meMap[os.str()] = dbe->book1D(os.str(), os.str(), 10, 0.5, 10.5);


    os.str("");
    os<<"NumberOfClusters_"<<nameRoll;
    meMap[os.str()] = dbe->book1D(os.str(), os.str(),20,0.5,20.5);
  }
  
  if (dqmsuperexpert) {    
    os.str("");
    os<<"BXN_vs_strip_"<<nameRoll;
    meMap[os.str()] = dbe->book2D(os.str(), os.str(),  nstrips , 0.5, nstrips+0.5 , 21, -10.5, 10.5);
     
    os.str("");
    os<<"ClusterSize_vs_Strip_"<<nameRoll;
    meMap[os.str()] = dbe->book2D(os.str(), os.str(),nstrips, 0.5, nstrips+0.5,11, 0.5, 11.5);
    
  }

  MonitorElement * myMe;

  os.str("");
  if(detId.region()==0)
    os<<"RPC/RecHits/Barrel/Wheel_"<<ring<<"/SummaryBySectors/";
  else if (detId.region()==1)
    os<<"RPC/RecHits/Endcap+/Disk_"<<ring<<"/SummaryBySectors/";
  else 
    os<<"RPC/RecHits/Endcap-/Disk_"<<ring<<"/SummaryBySectors/";
  std::string WheelSummary = os.str();
  dbe->setCurrentFolder(WheelSummary);
  
  os.str("");
  os<<"Occupancy_"<<ringType<<"_"<<ring<<"_Sector_"<<detId.sector();
  myMe = dbe->get(WheelSummary+"/"+os.str());
  
  rpcdqm::utils rpcUtils;
  //check if ME for this sector have already been booked
  if(myMe)  meMap[os.str()]=myMe;
  else {
    if(detId.region()==0) {
      if (detId.sector()==9 || detId.sector()==11)
        meMap[os.str()] = dbe->book2D(os.str(), os.str(), 96, 0.5,96.5, 15, 0.5, 15.5);
      else  if (detId.sector()==4) 
        meMap[os.str()] = dbe->book2D(os.str(), os.str(),  96, 0.5, 96.5, 21, 0.5, 21.5);
      else
        meMap[os.str()] = dbe->book2D(os.str(), os.str(), 96, 0.5,  96.5, 17, 0.5, 17.5);

      meMap[os.str()]->setAxisTitle("strip", 1);
      rpcUtils.labelYAxisRoll( meMap[os.str()], 0, ring);

    }else{//Endcap
      float fBin = ((detId.sector()-1)*6)+ 0.5;
      float lBin = fBin+12;
      meMap[os.str()] = dbe->book2D(os.str(), os.str(), 96, 0.5, 96.5, 12,fBin, lBin);
      meMap[os.str()]->setAxisTitle("strip", 1);
      std::stringstream yLabel;
      for(int r = 2; r<= 3; r ++) {
        int offset = 0;
        if (r ==3) offset =6;
        for (int i = 1 ; i<=6; i++) {
          yLabel.str("");
          yLabel<<"R"<<r<<"_C"<<(((detId.sector()-1)*6) +i);
          meMap[os.str()]->setBinLabel(i+offset, yLabel.str(), 2);
          
        }
      }
      for(int i = 1; i <= 96 ; i++) {
        if (i ==1) meMap[os.str()]->setBinLabel(i, "1", 1);
        else if (i==16) meMap[os.str()]->setBinLabel(i, "RollA", 1);
        else if (i==32) meMap[os.str()]->setBinLabel(i, "32", 1);
        else if (i==33) meMap[os.str()]->setBinLabel(i, "1", 1);
        else if (i==48) meMap[os.str()]->setBinLabel(i, "RollB", 1);
        else if (i==64) meMap[os.str()]->setBinLabel(i, "32", 1);
        else if (i==65) meMap[os.str()]->setBinLabel(i, "1", 1);
        else if (i==80) meMap[os.str()]->setBinLabel(i, "RollC", 1);
        else if (i==96) meMap[os.str()]->setBinLabel(i, "32", 1);
        else  meMap[os.str()]->setBinLabel(i, "", 1);
      }
    } 
  }
  
  os.str("");
  os<<"BxDistribution_"<<ringType<<"_"<<ring<<"_Sector_"<<detId.sector();
  myMe = dbe->get(WheelSummary+"/"+os.str());
  if(myMe)  meMap[os.str()]=myMe;
  else meMap[os.str()] = dbe->book1D(os.str(), os.str(), 11, -5.5, 5.5);

  os.str("");
  os<<"BXWithData_"<<ringType<<"_"<<ring<<"_Sector_"<<detId.sector();
  myMe = dbe->get(WheelSummary+"/"+os.str());
  if(myMe)  meMap[os.str()]=myMe;
  else  meMap[os.str()] = dbe->book1D(os.str(), os.str(), 10, 0.5, 10.5);

  return meMap;
}
std::map< std::string, MonitorElement * > RPCMonitorDigi::bookRegionRing ( int  region,
int  ring 
)

Booking of MonitoringElemnt at Wheel/Disk level.

Definition at line 169 of file RPCBookDetUnitME.cc.

References DQMStore::book1D(), DQMStore::book2D(), dbe, globalFolder_, i, label, rpcdqm::utils::labelXAxisSector(), rpcdqm::utils::labelXAxisSegment(), rpcdqm::utils::labelYAxisRing(), rpcdqm::utils::labelYAxisRoll(), relativeConstraints::ring, and DQMStore::setCurrentFolder().

Referenced by beginRun().

                                                                                      {  
  std::map<std::string, MonitorElement*> meMap;  
  std::string ringType = (region ==  0)?"Wheel":"Disk";

  dbe->setCurrentFolder(globalFolder_);
  std::stringstream os, label;

  rpcdqm::utils rpcUtils;

  // os<<"OccupancyXY_"<<ringType<<"_"<<ring;
  //   //  meMap[os.str()] = dbe->book2D(os.str(), os.str(),63, -800, 800, 63, -800, 800);
  //     meMap[os.str()] = dbe->book2D(os.str(), os.str(),1000, -800, 800, 1000, -800, 800);
  
  os.str("");
  os<<"ClusterSize_"<<ringType<<"_"<<ring;
  meMap[os.str()] = dbe->book1D(os.str(), os.str(),20, 0.5, 20.5);

  os.str("");
  os<<"1DOccupancy_"<<ringType<<"_"<<ring;
  if (region!=0)  meMap[os.str()] = dbe->book1D(os.str(), os.str(), 6, 0.5, 6.5);
  else meMap[os.str()] = dbe->book1D(os.str(), os.str(), 12, 0.5, 12.5);
  int sect=7;
  if(region==0) sect=13;
  for(int i=1; i<sect; i++) {
    label.str("");
    label<<"Sec"<<i;
    //cout<<label.str()<<endl;
    meMap[os.str()] ->setBinLabel(i, label.str(), 1); // to be corrected !!!!
  }
  
  if(region==0) {
    
    os.str("");
    os<<"Occupancy_Roll_vs_Sector_"<<ringType<<"_"<<ring;                                   
    meMap[os.str()] = dbe->book2D(os.str(), os.str(), 12, 0.5,12.5, 21, 0.5, 21.5);
    rpcUtils.labelXAxisSector(meMap[os.str()]);
    rpcUtils.labelYAxisRoll( meMap[os.str()], 0, ring);


  }else{
    
    os.str("");
    os<<"Occupancy_Ring_vs_Segment_"<<ringType<<"_"<<ring;                                  
    meMap[os.str()] = dbe->book2D(os.str(), os.str(), 36, 0.5,36.5, 6, 0.5, 6.5);
 
    rpcUtils.labelXAxisSegment(meMap[os.str()]);
    rpcUtils.labelYAxisRing(meMap[os.str()], 2);

  }
    
    os.str("");
    os<<"BxDistribution_"<<ringType<<"_"<<ring;
    meMap[os.str()] = dbe->book1D(os.str(), os.str(), 11, -5.5, 5.5);
    
  
  return meMap; 
}
void RPCMonitorDigi::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 145 of file RPCMonitorDigi.cc.

References dbe, RootFileName, DQMStore::save(), and saveRootFile.

void RPCMonitorDigi::makeDcsInfo ( const edm::Event e) [private]

Definition at line 418 of file RPCMonitorDigi.cc.

References dcs_, edm::Event::getByLabel(), edm::HandleBase::isValid(), and DcsStatus::RPC.

Referenced by analyze().

                                                   {

  edm::Handle<DcsStatusCollection> dcsStatus;

  if ( ! e.getByLabel("scalersRawToDigi", dcsStatus) ){
    dcs_ = true;
    return;
  }
  
  if ( ! dcsStatus.isValid() ) 
  {
    edm::LogWarning("RPCDcsInfo") << "scalersRawToDigi not found" ;
    dcs_ = true; // info not available: set to true
    return;
  }
    

  for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin(); 
                            dcsStatusItr != dcsStatus->end(); ++dcsStatusItr)   {

      if (!dcsStatusItr->ready(DcsStatus::RPC)) dcs_=false;
      
  }
      
  return ;
}
int RPCMonitorDigi::stripsInRoll ( RPCDetId id,
const edm::EventSetup iSetup 
) [private]

Definition at line 228 of file RPCBookDetUnitME.cc.

References edm::EventSetup::get(), and RPCRoll::nstrips().

Referenced by bookDetUnitME().

                                                                             {
  edm::ESHandle<RPCGeometry> rpcgeo;
  iSetup.get<MuonGeometryRecord>().get(rpcgeo);

  const RPCRoll * rpcRoll = rpcgeo->roll(id);

  if (rpcRoll)
    return  rpcRoll->nstrips();
  else 
    return 1;
}

Member Data Documentation

Definition at line 62 of file RPCMonitorDigi.h.

Definition at line 63 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginJob().

Definition at line 57 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginJob().

Definition at line 61 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginJob().

Definition at line 59 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginJob().

Definition at line 58 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginJob().

int RPCMonitorDigi::counter [private]

Definition at line 44 of file RPCMonitorDigi.h.

Referenced by analyze().

DQM store.

Definition at line 46 of file RPCMonitorDigi.h.

Referenced by beginJob(), bookDetUnitME(), bookRegionRing(), and endJob().

bool RPCMonitorDigi::dcs_ [private]

Definition at line 47 of file RPCMonitorDigi.h.

Referenced by analyze(), beginJob(), and makeDcsInfo().

std::string RPCMonitorDigi::digiLabel [private]

Definition at line 76 of file RPCMonitorDigi.h.

bool RPCMonitorDigi::dqmexpert [private]

Definition at line 87 of file RPCMonitorDigi.h.

Referenced by analyze(), bookDetUnitME(), and RPCMonitorDigi().

Definition at line 86 of file RPCMonitorDigi.h.

Referenced by RPCMonitorDigi().

Definition at line 88 of file RPCMonitorDigi.h.

Referenced by analyze(), bookDetUnitME(), and RPCMonitorDigi().

Definition at line 65 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginJob().

Definition at line 64 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginJob().

std::string RPCMonitorDigi::globalFolder_ [private]

Definition at line 80 of file RPCMonitorDigi.h.

Referenced by beginJob(), bookRegionRing(), and RPCMonitorDigi().

Definition at line 89 of file RPCMonitorDigi.h.

std::map<uint32_t, std::map<std::string, MonitorElement*> > RPCMonitorDigi::meCollection [private]

Definition at line 72 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginRun().

Definition at line 78 of file RPCMonitorDigi.h.

Referenced by RPCMonitorDigi().

std::map<std::pair<int,int>, std::map<std::string, MonitorElement*> > RPCMonitorDigi::meWheelDisk [private]

Definition at line 73 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginRun().

std::string RPCMonitorDigi::muonNoise_ [private]

Definition at line 79 of file RPCMonitorDigi.h.

Referenced by RPCMonitorDigi().

std::string RPCMonitorDigi::nameInLog [private]

Definition at line 82 of file RPCMonitorDigi.h.

Referenced by analyze(), beginJob(), beginRun(), and RPCMonitorDigi().

Definition at line 53 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginJob().

Definition at line 55 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginJob().

Definition at line 54 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginJob().

Definition at line 49 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginJob().

Definition at line 51 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginJob().

Definition at line 50 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginJob().

std::string RPCMonitorDigi::RootFileName [private]

Definition at line 85 of file RPCMonitorDigi.h.

Referenced by endJob(), and RPCMonitorDigi().

std::string RPCMonitorDigi::RPCDataLabel [private]

Definition at line 75 of file RPCMonitorDigi.h.

Definition at line 95 of file RPCMonitorDigi.h.

Referenced by analyze(), and RPCMonitorDigi().

Definition at line 66 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginJob().

Definition at line 91 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginRun().

Definition at line 94 of file RPCMonitorDigi.h.

Referenced by analyze(), and RPCMonitorDigi().

Definition at line 68 of file RPCMonitorDigi.h.

Referenced by analyze(), and beginJob().

Definition at line 70 of file RPCMonitorDigi.h.

Referenced by beginJob().

Definition at line 69 of file RPCMonitorDigi.h.

Referenced by beginJob().

Definition at line 83 of file RPCMonitorDigi.h.

Referenced by endJob(), and RPCMonitorDigi().