CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/DQMServices/Components/src/DQMDcsInfoClient.cc

Go to the documentation of this file.
00001 
00002 /*
00003  * \file DQMDcsInfoClient.cc
00004  * \author Andreas Meyer
00005  * Last Update:
00006  * $Date: 2012/08/02 07:59:10 $
00007  * $Revision: 1.8 $
00008  * $Author: rovere $
00009  *
00010 */
00011 
00012 #include "DQMServices/Components/src/DQMDcsInfoClient.h"
00013 #include "FWCore/Framework/interface/LuminosityBlock.h"
00014 
00015 // -----------------------------
00016 //  constructors and destructor
00017 // -----------------------------
00018 
00019 DQMDcsInfoClient::DQMDcsInfoClient( const edm::ParameterSet& ps ) {
00020 
00021   parameters_ = ps;
00022 
00023   dbe_ = edm::Service<DQMStore>().operator->();
00024 
00025   subsystemname_ = parameters_.getUntrackedParameter<std::string>("subSystemFolder", "Info") ;
00026   dcsinfofolder_ = parameters_.getUntrackedParameter<std::string>("dcsInfoFolder", "DcsInfo") ;
00027 
00028 }
00029 
00030 
00031 DQMDcsInfoClient::~DQMDcsInfoClient() {
00032 
00033 }
00034 
00035 void 
00036 DQMDcsInfoClient::beginRun(const edm::Run& r, const edm::EventSetup& c) 
00037 {
00038   // Fetch GlobalTag information and fill the string/ME.
00039   dbe_->cd();  
00040   dbe_->setCurrentFolder(subsystemname_ +"/CMSSWInfo/");
00041   const edm::ParameterSet &globalTagPSet = edm::getProcessParameterSet()
00042                                            .getParameterSet("PoolDBESSource@GlobalTag");
00043 
00044   dbe_->bookString("globalTag_Harvesting", globalTagPSet.getParameter<std::string>("globaltag"));
00045 
00046   DCS.clear();
00047   DCS.resize(10);  // start with 10 LS, resize later
00048   processedLS_.clear();
00049 }
00050 
00051 void 
00052 DQMDcsInfoClient::analyze(const edm::Event& e, const edm::EventSetup& c)
00053 {
00054   return;
00055 }
00056 
00057 void 
00058 DQMDcsInfoClient::endLuminosityBlock(const edm::LuminosityBlock& l, const edm::EventSetup& c)
00059 {
00060   if (!dbe_) return;
00061 
00062   unsigned int nlumi = l.id().luminosityBlock() ;
00063   processedLS_.insert(nlumi);
00064   // cout << " in lumi section " << nlumi << endl;
00065 
00066   if (nlumi+1 > DCS.size()) 
00067      DCS.resize(nlumi+1);
00068   // cout << "DCS size: " << DCS.size() << endl;     
00069 
00070   MonitorElement* DCSbyLS_ = 
00071             dbe_->get(subsystemname_ + "/" + dcsinfofolder_ + "/DCSbyLS" ); 
00072 
00073   if ( DCSbyLS_ ) 
00074   {
00075     if ( TH1F * h1 = DCSbyLS_->getTH1F()) 
00076     {
00077       int word = 0;
00078       for (int i = 0; i < 25 ; i++) 
00079       {
00080 
00081         if ( h1->GetBinContent(i+1) != 0 ) 
00082            word |= (0x0 << i); // set to 0 because HV was off (!)
00083         else 
00084            word |= (0x1 << i); // set to 1 because HV was on (!)
00085       }
00086       DCS[nlumi] = word;
00087     }
00088   }
00089   return; 
00090 }
00091 
00092 void 
00093 DQMDcsInfoClient::endRun(const edm::Run& r, const edm::EventSetup& c) 
00094 {
00095 
00096   // book 
00097   dbe_->cd();  
00098   dbe_->setCurrentFolder(subsystemname_ +"/EventInfo/");
00099 
00100   unsigned int nlsmax = DCS.size();
00101   reportSummary_=dbe_->bookFloat("reportSummary");
00102   reportSummary_->Fill(1.);
00103   
00104   reportSummaryMap_ = dbe_->get(subsystemname_ +"/EventInfo/reportSummaryMap");
00105   if (reportSummaryMap_) dbe_->removeElement(reportSummaryMap_->getName());
00106 
00107   reportSummaryMap_ = dbe_->book2D("reportSummaryMap",
00108                      "HV and GT vs Lumi", nlsmax, 1., nlsmax+1, 25, 0., 25.);
00109   unsigned int lastProcessedLS = *(--processedLS_.end());
00110   meProcessedLS_ = dbe_->book1D("ProcessedLS",
00111                                 "Processed Lumisections",
00112                                 lastProcessedLS+1,
00113                                 0.,lastProcessedLS+1);
00114   reportSummaryMap_->setBinLabel(1," CSC+",2);   
00115   reportSummaryMap_->setBinLabel(2," CSC-",2);   
00116   reportSummaryMap_->setBinLabel(3," DT0",2);    
00117   reportSummaryMap_->setBinLabel(4," DT+",2);    
00118   reportSummaryMap_->setBinLabel(5," DT-",2);    
00119   reportSummaryMap_->setBinLabel(6," EB+",2);    
00120   reportSummaryMap_->setBinLabel(7," EB-",2);    
00121   reportSummaryMap_->setBinLabel(8," EE+",2);    
00122   reportSummaryMap_->setBinLabel(9," EE-",2);    
00123   reportSummaryMap_->setBinLabel(10,"ES+",2);    
00124   reportSummaryMap_->setBinLabel(11,"ES-",2);   
00125   reportSummaryMap_->setBinLabel(12,"HBHEa",2); 
00126   reportSummaryMap_->setBinLabel(13,"HBHEb",2); 
00127   reportSummaryMap_->setBinLabel(14,"HBHEc",2); 
00128   reportSummaryMap_->setBinLabel(15,"HF",2);    
00129   reportSummaryMap_->setBinLabel(16,"HO",2);    
00130   reportSummaryMap_->setBinLabel(17,"BPIX",2);  
00131   reportSummaryMap_->setBinLabel(18,"FPIX",2);  
00132   reportSummaryMap_->setBinLabel(19,"RPC",2);   
00133   reportSummaryMap_->setBinLabel(20,"TIBTID",2);
00134   reportSummaryMap_->setBinLabel(21,"TOB",2);   
00135   reportSummaryMap_->setBinLabel(22,"TECp",2);  
00136   reportSummaryMap_->setBinLabel(23,"TECm",2);  
00137   reportSummaryMap_->setBinLabel(24,"CASTOR",2);
00138   reportSummaryMap_->setBinLabel(25,"PhysDecl",2);
00139   reportSummaryMap_->setAxisTitle("Luminosity Section");
00140 
00141   // fill
00142   for (unsigned int i = 0 ; i < DCS.size() ; i++ )
00143   {
00144     for ( int j = 0 ; j < 25 ; j++ ) 
00145     {
00146       if (DCS[i] & (0x1 << j))
00147         reportSummaryMap_->setBinContent(i,j+1,1.);
00148       else
00149         reportSummaryMap_->setBinContent(i,j+1,0.);
00150     }
00151   }
00152 
00153   std::set<unsigned int>::iterator it,ite;
00154   it  = processedLS_.begin();
00155   ite = processedLS_.end();
00156   unsigned int lastAccessed = 0;
00157   
00158   for (; it!=ite; it++)
00159   {
00160     while (lastAccessed < (*it))
00161     {
00162       //      std::cout << "Filling " << lastAccessed << " with -1" << std::endl; 
00163       meProcessedLS_->Fill(lastAccessed, -1.);
00164       lastAccessed++;
00165     }
00166     //    std::cout << "Filling " << *it << " with 1" << std::endl; 
00167     meProcessedLS_->Fill(*it);
00168     lastAccessed = (*it)+1;
00169   }
00170   
00171 }