CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/DQM/RPCMonitorClient/src/RPCDCSSummary.cc

Go to the documentation of this file.
00001 #include "DQM/RPCMonitorClient/interface/RPCDCSSummary.h"
00002 
00003 #include "FWCore/ServiceRegistry/interface/Service.h"
00004 #include "FWCore/Framework/interface/ESHandle.h"
00005 #include "FWCore/Framework/interface/EventSetup.h"
00006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00007 
00008 #include "DQMServices/Core/interface/DQMStore.h"
00009 #include "DQMServices/Core/interface/MonitorElement.h"
00010 //CondFormats
00011 #include "CondFormats/RunInfo/interface/RunInfo.h"
00012 #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
00013 
00014 
00015 RPCDCSSummary::RPCDCSSummary(const edm::ParameterSet& ps) {
00016 
00017  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 3);
00018 
00019  FEDRange_.first  = ps.getUntrackedParameter<unsigned int>("MinimumRPCFEDId", 790);
00020  FEDRange_.second = ps.getUntrackedParameter<unsigned int>("MaximumRPCFEDId", 792);
00021  
00022  NumberOfFeds_ =FEDRange_.second -  FEDRange_.first +1;
00023 }
00024 
00025 RPCDCSSummary::~RPCDCSSummary() {}
00026 
00027 void RPCDCSSummary::beginJob() {}
00028 
00029 void RPCDCSSummary::beginRun(const edm::Run& r, const edm::EventSetup& setup){
00030  edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("RunInfoRcd"));
00031 
00032  int defaultValue = 1;
00033 
00034  if(0 != setup.find( recordKey ) ) {
00035     defaultValue = -1;
00036     //get fed summary information
00037     edm::ESHandle<RunInfo> sumFED;
00038     setup.get<RunInfoRcd>().get(sumFED);    
00039     std::vector<int> FedsInIds= sumFED->m_fed_in;   
00040     unsigned int f = 0;
00041     bool flag = false;
00042     while(!flag && f < FedsInIds.size()) {
00043       int fedID=FedsInIds[f];
00044       //make sure fed id is in allowed range  
00045       if(fedID>=FEDRange_.first && fedID<=FEDRange_.second) {
00046         defaultValue = 1;
00047         flag = true;
00048       } 
00049       f++;
00050     }   
00051   }   
00052 
00053   // get the DQMStore
00054  theDbe = edm::Service<DQMStore>().operator->();
00055   
00056   theDbe->setCurrentFolder("RPC/EventInfo");
00057   // global fraction
00058   totalDCSFraction = theDbe->bookFloat("DCSSummary");  
00059   totalDCSFraction->Fill(defaultValue);
00060 
00061   DCSMap_ = theDbe->book2D( "DCSSummaryMap","RPC DCS Summary Map",15, -7.5, 7.5, 12, 0.5 ,12.5);
00062   
00063   //customize the 2d histo
00064   std::stringstream BinLabel;
00065   for (int i= 1 ; i<13; i++){
00066     BinLabel.str("");
00067     BinLabel<<"Sec"<<i;
00068     DCSMap_->setBinLabel(i,BinLabel.str(),2);
00069   } 
00070 
00071   for(int i = -2; i<=2; i++){
00072     BinLabel.str("");
00073     BinLabel<<"Wheel"<<i;
00074     DCSMap_->setBinLabel((i+8),BinLabel.str(),1);
00075   }
00076 
00077   for(int i = 1; i<=numberOfDisks_; i++){
00078     BinLabel.str("");
00079     BinLabel<<"Disk"<<i;
00080     DCSMap_->setBinLabel((i+11),BinLabel.str(),1);
00081     BinLabel.str("");
00082     BinLabel<<"Disk"<<-i;
00083     DCSMap_->setBinLabel((-i+5),BinLabel.str(),1);
00084   }
00085 
00086   //fill the histo with "1" --- just for the moment
00087   for(int i=1; i<=15; i++){
00088      for (int j=1; j<=12; j++ ){
00089        if(i==5 || i==11 || (j>6 && (i<6 || i>10)))    
00090          DCSMap_->setBinContent(i,j,-1);//bins that not correspond to subdetector parts
00091        else
00092          DCSMap_->setBinContent(i,j,defaultValue);
00093      }
00094    }
00095 
00096 
00097   if(numberOfDisks_ < 4){
00098     for (int j=1; j<=12; j++ ){
00099       DCSMap_->setBinContent(1,j,-1);//bins that not correspond to subdetector parts
00100       DCSMap_->setBinContent(15,j,-1);
00101     }
00102  }
00103 
00104   // book the ME
00105   theDbe->setCurrentFolder("RPC/EventInfo/DCSContents");
00106 
00107   int limit = numberOfDisks_;
00108   if(numberOfDisks_ < 2) limit = 2;
00109   
00110 
00111   for (int i = -1 * limit; i<= limit;i++ ){//loop on wheels and disks
00112     if (i>-3 && i<3){//wheels
00113       std::stringstream streams;
00114       streams << "RPC_Wheel" << i;
00115       dcsWheelFractions[i+2] = theDbe->bookFloat(streams.str());
00116       dcsWheelFractions[i+2]->Fill(defaultValue);
00117    }
00118     
00119     if (i == 0  || i > numberOfDisks_ || i< (-1 * numberOfDisks_))continue;
00120     
00121     int offset = numberOfDisks_;
00122     if (i>0) offset --; //used to skip case equale to zero
00123     std::stringstream streams;
00124     streams << "RPC_Disk" << i;
00125     dcsDiskFractions[i+2] = theDbe->bookFloat(streams.str());
00126     dcsDiskFractions[i+2]->Fill(defaultValue);
00127   }
00128 }
00129 
00130 
00131 
00132 void RPCDCSSummary::beginLuminosityBlock(const edm::LuminosityBlock& lumi, const  edm::EventSetup& setup) {
00133 }
00134 
00135 
00136 
00137 
00138 void RPCDCSSummary::endLuminosityBlock(const edm::LuminosityBlock&  lumi, const  edm::EventSetup& setup){}
00139 
00140 
00141 
00142 void RPCDCSSummary::endJob() {}
00143 
00144 
00145 
00146 void RPCDCSSummary::analyze(const edm::Event& event, const edm::EventSetup& setup){}
00147 
00148 
00149 
00150 
00151