CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/DQM/SiStripMonitorSummary/src/SiStripMonitorCondData.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     SiStripMonitorSummary
00004 // Class  :     SiStripMonitorCondData
00005 // 
00006 // Original Author:  Evelyne Delmeire
00007 //
00008 
00009 
00010 #include "FWCore/Framework/interface/ESHandle.h"
00011 #include "FWCore/ServiceRegistry/interface/Service.h"
00012 #include "FWCore/Framework/interface/Event.h"
00013 #include "FWCore/Framework/interface/EventSetup.h"
00014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00016 
00017 #include "DataFormats/Common/interface/Handle.h"
00018 #include "DataFormats/SiStripDetId/interface/SiStripSubStructure.h"
00019 
00020 #include "DQM/SiStripCommon/interface/SiStripFolderOrganizer.h"
00021 #include "DQM/SiStripCommon/interface/SiStripHistoId.h"
00022 #include "DQM/SiStripCommon/interface/ExtractTObject.h"
00023 #include "DQMServices/Core/interface/DQMStore.h"
00024 #include "DQMServices/Core/interface/MonitorElement.h"
00025 
00026 
00027 #include "DQM/SiStripMonitorSummary/interface/SiStripMonitorCondData.h"
00028 
00029 #include "DQM/SiStripMonitorSummary/interface/SiStripPedestalsDQM.h" 
00030 #include "DQM/SiStripMonitorSummary/interface/SiStripNoisesDQM.h" 
00031 #include "DQM/SiStripMonitorSummary/interface/SiStripThresholdDQM.h" 
00032 #include "DQM/SiStripMonitorSummary/interface/SiStripQualityDQM.h" 
00033 #include "DQM/SiStripMonitorSummary/interface/SiStripApvGainsDQM.h" 
00034 #include "DQM/SiStripMonitorSummary/interface/SiStripLorentzAngleDQM.h"
00035 #include "DQM/SiStripMonitorSummary/interface/SiStripCablingDQM.h"
00036 
00037 #include "TH1F.h"
00038 #include "TH2F.h"
00039 #include "TProfile.h"
00040 
00041 // std
00042 #include <cstdlib>
00043 #include <string>
00044 #include <cmath>
00045 #include <numeric>
00046 #include <algorithm>
00047 
00048 
00049 //
00050 // ----- Constructor
00051 //
00052 SiStripMonitorCondData::SiStripMonitorCondData(edm::ParameterSet const& iConfig):conf_(iConfig){
00053   
00054   monitorPedestals_      = iConfig.getParameter<bool>("MonitorSiStripPedestal");
00055   monitorNoises_         = iConfig.getParameter<bool>("MonitorSiStripNoise");
00056   monitorLowThreshold_   = iConfig.getParameter<bool>("MonitorSiStripLowThreshold");
00057   monitorHighThreshold_  = iConfig.getParameter<bool>("MonitorSiStripHighThreshold");
00058   monitorQuality_        = iConfig.getParameter<bool>("MonitorSiStripQuality");
00059   monitorApvGains_       = iConfig.getParameter<bool>("MonitorSiStripApvGain");
00060   monitorLorentzAngle_   = iConfig.getParameter<bool>("MonitorSiStripLorentzAngle");
00061   monitorCabling_        = iConfig.getParameter<bool>("MonitorSiStripCabling");
00062   
00063 }
00064 // -----
00065 
00066 
00067 
00068 //
00069 // ----- Destructor
00070 // 
00071 SiStripMonitorCondData::~SiStripMonitorCondData(){
00072 
00073   if(monitorPedestals_)   { delete pedestalsDQM_   ;}
00074   if(monitorNoises_)      { delete noisesDQM_      ;}
00075   if(monitorLowThreshold_) { delete lowthresholdDQM_ ;}
00076   if(monitorHighThreshold_){ delete highthresholdDQM_;}
00077   if(monitorQuality_)     { delete qualityDQM_     ;}
00078   if(monitorApvGains_)    { delete apvgainsDQM_    ;}
00079   if(monitorLorentzAngle_){ delete lorentzangleDQM_;}
00080   if(monitorCabling_)     { delete cablingDQM_;}
00081 
00082 }
00083 // -----
00084 
00085 
00086 
00087 //
00088 // ----- beginRun
00089 //    
00090 void SiStripMonitorCondData::beginRun(edm::Run const& run, edm::EventSetup const& eSetup) {
00091 
00092   if(monitorPedestals_){
00093     pedestalsDQM_ = new SiStripPedestalsDQM(eSetup,
00094                                            conf_.getParameter<edm::ParameterSet>("SiStripPedestalsDQM_PSet"),
00095                                            conf_.getParameter<edm::ParameterSet>("FillConditions_PSet"));
00096   }
00097   
00098   
00099   if(monitorNoises_){
00100     noisesDQM_ = new SiStripNoisesDQM(eSetup,
00101                                      conf_.getParameter<edm::ParameterSet>("SiStripNoisesDQM_PSet"),
00102                                      conf_.getParameter<edm::ParameterSet>("FillConditions_PSet"));
00103   }
00104   
00105   
00106   if(monitorLowThreshold_){
00107     lowthresholdDQM_ = new SiStripThresholdDQM(eSetup,
00108                                            conf_.getParameter<edm::ParameterSet>("SiStripLowThresholdDQM_PSet"),
00109                                            conf_.getParameter<edm::ParameterSet>("FillConditions_PSet"));
00110   }
00111 
00112   if(monitorHighThreshold_){
00113     highthresholdDQM_ = new SiStripThresholdDQM(eSetup,
00114                                            conf_.getParameter<edm::ParameterSet>("SiStripHighThresholdDQM_PSet"),
00115                                            conf_.getParameter<edm::ParameterSet>("FillConditions_PSet"));
00116   }
00117 
00118   if(monitorQuality_){
00119     qualityDQM_ = new SiStripQualityDQM(eSetup,
00120                                        conf_.getParameter<edm::ParameterSet>("SiStripQualityDQM_PSet"),
00121                                        conf_.getParameter<edm::ParameterSet>("FillConditions_PSet"));
00122   } 
00123   
00124  
00125   if(monitorApvGains_){
00126     apvgainsDQM_ = new SiStripApvGainsDQM(eSetup,
00127                                          conf_.getParameter<edm::ParameterSet>("SiStripApvGainsDQM_PSet"),
00128                                          conf_.getParameter<edm::ParameterSet>("FillConditions_PSet"));
00129   }
00130   
00131   
00132   if(monitorLorentzAngle_){
00133     lorentzangleDQM_ = new SiStripLorentzAngleDQM(eSetup,
00134                                                  conf_.getParameter<edm::ParameterSet>("SiStripLorentzAngleDQM_PSet"),
00135                                                  conf_.getParameter<edm::ParameterSet>("FillConditions_PSet"));
00136   }
00137   if(monitorCabling_){
00138     cablingDQM_ = new SiStripCablingDQM(eSetup,
00139                                         conf_.getParameter<edm::ParameterSet>("SiStripCablingDQM_PSet"),
00140                                         conf_.getParameter<edm::ParameterSet>("FillConditions_PSet"));
00141   }
00142 } // beginRun
00143 // -----
00144 
00145 
00146 
00147 //
00148 // ----- beginJob
00149 //
00150 void SiStripMonitorCondData::beginJob(void){} //beginJob
00151 // -----
00152 
00153 
00154 
00155 //
00156 // ----- Analyze
00157 //
00158 void SiStripMonitorCondData::analyze(edm::Event const& iEvent, edm::EventSetup const& eSetup){
00159  
00160   if(monitorPedestals_)      { pedestalsDQM_     ->analysis(eSetup);}
00161   if(monitorNoises_)         { noisesDQM_        ->analysis(eSetup);}    
00162   if(monitorLowThreshold_)   { lowthresholdDQM_  ->analysis(eSetup);}    
00163   if(monitorHighThreshold_)  { highthresholdDQM_ ->analysis(eSetup);}    
00164   if(monitorApvGains_)       { apvgainsDQM_      ->analysis(eSetup);}    
00165   if(monitorLorentzAngle_)   { lorentzangleDQM_  ->analysis(eSetup);}
00166   if(monitorQuality_)        { qualityDQM_->analysis(eSetup);qualityDQM_->fillGrandSummaryMEs();}//fillGrand. for SiStripquality
00167   if(monitorCabling_)        { cablingDQM_       ->analysis(eSetup);}
00168 } // analyze
00169 // -----
00170 
00171 
00172 
00173 //
00174 // ----- endRun
00175 //    
00176 void SiStripMonitorCondData::endRun(edm::Run const& run, edm::EventSetup const& eSetup) {
00177   if(monitorPedestals_)      { pedestalsDQM_     ->end();}
00178   if(monitorNoises_)         { noisesDQM_        ->end();}    
00179   if(monitorLowThreshold_)   { lowthresholdDQM_  ->end();}    
00180   if(monitorHighThreshold_)  { highthresholdDQM_ ->end();}    
00181   if(monitorApvGains_)       { apvgainsDQM_      ->end();}    
00182   if(monitorLorentzAngle_)   { lorentzangleDQM_  ->end();}
00183   if(monitorQuality_)        { qualityDQM_       ->end();}
00184   if(monitorCabling_)        { cablingDQM_       ->end();}
00185  
00186   bool outputMEsInRootFile     = conf_.getParameter<bool>("OutputMEsInRootFile");
00187   std::string outputFileName  = conf_.getParameter<std::string>("OutputFileName");
00188 
00189   DQMStore* dqmStore_=edm::Service<DQMStore>().operator->();
00190   
00191   if (outputMEsInRootFile) { 
00192     dqmStore_->showDirStructure();
00193     dqmStore_->save(outputFileName);
00194   } 
00195 
00196   
00197 } // endRun
00198 // -----
00199 
00200 
00201 //
00202 // ----- endJob
00203 //
00204 void SiStripMonitorCondData::endJob(void){} 
00205 //endJob
00206 // -----
00207 
00208 
00209 #include "FWCore/Framework/interface/MakerMacros.h"
00210   DEFINE_FWK_MODULE(SiStripMonitorCondData);
00211 
00212