CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/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: 2011/01/19 11:48:33 $
00007  * $Revision: 1.7 $
00008  * $Author: dutta $
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   DCS.clear();
00039   DCS.resize(10);  // start with 10 LS, resize later
00040   processedLS_.clear();
00041 }
00042 
00043 void 
00044 DQMDcsInfoClient::analyze(const edm::Event& e, const edm::EventSetup& c)
00045 {
00046   return;
00047 }
00048 
00049 void 
00050 DQMDcsInfoClient::endLuminosityBlock(const edm::LuminosityBlock& l, const edm::EventSetup& c)
00051 {
00052   if (!dbe_) return;
00053 
00054   unsigned int nlumi = l.id().luminosityBlock() ;
00055   processedLS_.insert(nlumi);
00056   // cout << " in lumi section " << nlumi << endl;
00057 
00058   if (nlumi+1 > DCS.size()) 
00059      DCS.resize(nlumi+1);
00060   // cout << "DCS size: " << DCS.size() << endl;     
00061 
00062   MonitorElement* DCSbyLS_ = 
00063             dbe_->get(subsystemname_ + "/" + dcsinfofolder_ + "/DCSbyLS" ); 
00064 
00065   if ( DCSbyLS_ ) 
00066   {
00067     if ( TH1F * h1 = DCSbyLS_->getTH1F()) 
00068     {
00069       int word = 0;
00070       for (int i = 0; i < 25 ; i++) 
00071       {
00072 
00073         if ( h1->GetBinContent(i+1) != 0 ) 
00074            word |= (0x0 << i); // set to 0 because HV was off (!)
00075         else 
00076            word |= (0x1 << i); // set to 1 because HV was on (!)
00077       }
00078       DCS[nlumi] = word;
00079     }
00080   }
00081   return; 
00082 }
00083 
00084 void 
00085 DQMDcsInfoClient::endRun(const edm::Run& r, const edm::EventSetup& c) 
00086 {
00087 
00088   // book 
00089   dbe_->cd();  
00090   dbe_->setCurrentFolder(subsystemname_ +"/EventInfo/");
00091 
00092   unsigned int nlsmax = DCS.size();
00093   reportSummary_=dbe_->bookFloat("reportSummary");
00094   reportSummary_->Fill(1.);
00095   
00096   reportSummaryMap_ = dbe_->get(subsystemname_ +"/EventInfo/reportSummaryMap");
00097   if (reportSummaryMap_) dbe_->removeElement(reportSummaryMap_->getName());
00098 
00099   reportSummaryMap_ = dbe_->book2D("reportSummaryMap",
00100                      "HV and GT vs Lumi", nlsmax, 1., nlsmax+1, 25, 0., 25.);
00101   unsigned int lastProcessedLS = *(--processedLS_.end());
00102   meProcessedLS_ = dbe_->book1D("ProcessedLS",
00103                                 "Processed Lumisections",
00104                                 lastProcessedLS+1,
00105                                 0.,lastProcessedLS+1);
00106   reportSummaryMap_->setBinLabel(1," CSC+",2);   
00107   reportSummaryMap_->setBinLabel(2," CSC-",2);   
00108   reportSummaryMap_->setBinLabel(3," DT0",2);    
00109   reportSummaryMap_->setBinLabel(4," DT+",2);    
00110   reportSummaryMap_->setBinLabel(5," DT-",2);    
00111   reportSummaryMap_->setBinLabel(6," EB+",2);    
00112   reportSummaryMap_->setBinLabel(7," EB-",2);    
00113   reportSummaryMap_->setBinLabel(8," EE+",2);    
00114   reportSummaryMap_->setBinLabel(9," EE-",2);    
00115   reportSummaryMap_->setBinLabel(10,"ES+",2);    
00116   reportSummaryMap_->setBinLabel(11,"ES-",2);   
00117   reportSummaryMap_->setBinLabel(12,"HBHEa",2); 
00118   reportSummaryMap_->setBinLabel(13,"HBHEb",2); 
00119   reportSummaryMap_->setBinLabel(14,"HBHEc",2); 
00120   reportSummaryMap_->setBinLabel(15,"HF",2);    
00121   reportSummaryMap_->setBinLabel(16,"HO",2);    
00122   reportSummaryMap_->setBinLabel(17,"BPIX",2);  
00123   reportSummaryMap_->setBinLabel(18,"FPIX",2);  
00124   reportSummaryMap_->setBinLabel(19,"RPC",2);   
00125   reportSummaryMap_->setBinLabel(20,"TIBTID",2);
00126   reportSummaryMap_->setBinLabel(21,"TOB",2);   
00127   reportSummaryMap_->setBinLabel(22,"TECp",2);  
00128   reportSummaryMap_->setBinLabel(23,"TECm",2);  
00129   reportSummaryMap_->setBinLabel(24,"CASTOR",2);
00130   reportSummaryMap_->setBinLabel(25,"PhysDecl",2);
00131   reportSummaryMap_->setAxisTitle("Luminosity Section");
00132 
00133   // fill
00134   for (unsigned int i = 0 ; i < DCS.size() ; i++ )
00135   {
00136     for ( int j = 0 ; j < 25 ; j++ ) 
00137     {
00138       if (DCS[i] & (0x1 << j))
00139         reportSummaryMap_->setBinContent(i,j+1,1.);
00140       else
00141         reportSummaryMap_->setBinContent(i,j+1,0.);
00142     }
00143   }
00144 
00145   std::set<unsigned int>::iterator it,ite;
00146   it  = processedLS_.begin();
00147   ite = processedLS_.end();
00148   unsigned int lastAccessed = 0;
00149   
00150   for (; it!=ite; it++)
00151   {
00152     while (lastAccessed < (*it))
00153     {
00154       //      std::cout << "Filling " << lastAccessed << " with -1" << std::endl; 
00155       meProcessedLS_->Fill(lastAccessed, -1.);
00156       lastAccessed++;
00157     }
00158     //    std::cout << "Filling " << *it << " with 1" << std::endl; 
00159     meProcessedLS_->Fill(*it);
00160     lastAccessed = (*it)+1;
00161   }
00162   
00163 }