CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/DQM/SiStripMonitorSummary/src/SiStripClassToMonitorCondData.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     SiStripMonitorSummary
00004 // Class  :     SiStripClassToMonitorCondData
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/SiStripClassToMonitorCondData.h"
00028 
00029 #include "DQM/SiStripMonitorSummary/interface/SiStripPedestalsDQM.h" 
00030 #include "DQM/SiStripMonitorSummary/interface/SiStripNoisesDQM.h" 
00031 #include "DQM/SiStripMonitorSummary/interface/SiStripQualityDQM.h" 
00032 #include "DQM/SiStripMonitorSummary/interface/SiStripApvGainsDQM.h" 
00033 #include "DQM/SiStripMonitorSummary/interface/SiStripLorentzAngleDQM.h" 
00034 #include "DQM/SiStripMonitorSummary/interface/SiStripCablingDQM.h"
00035 #include "DQM/SiStripMonitorSummary/interface/SiStripThresholdDQM.h"
00036 
00037 #include "CondFormats/SiStripObjects/interface/SiStripPedestals.h"
00038 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
00039 #include "CondFormats/SiStripObjects/interface/SiStripApvGain.h"
00040 #include "CondFormats/SiStripObjects/interface/SiStripLorentzAngle.h"
00041 
00042 #include "CondFormats/DataRecord/interface/SiStripPedestalsRcd.h"
00043 #include "CondFormats/DataRecord/interface/SiStripApvGainRcd.h"
00044 #include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
00045 
00046 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
00047 #include "CalibTracker/Records/interface/SiStripQualityRcd.h"
00048 
00049 #include "TH1F.h"
00050 #include "TH2F.h"
00051 #include "TProfile.h"
00052 
00053 // std
00054 #include <cstdlib>
00055 #include <string>
00056 //#include <cmath>
00057 //#include <numeric>
00058 #include <algorithm>
00059 
00060 
00061 //
00062 // ----- Constructor
00063 //
00064 SiStripClassToMonitorCondData::SiStripClassToMonitorCondData(edm::ParameterSet const& iConfig):conf_(iConfig){
00065   
00066   monitorPedestals_      = iConfig.getParameter<bool>("MonitorSiStripPedestal");
00067   monitorNoises_         = iConfig.getParameter<bool>("MonitorSiStripNoise");
00068   monitorQuality_        = iConfig.getParameter<bool>("MonitorSiStripQuality");
00069   monitorApvGains_       = iConfig.getParameter<bool>("MonitorSiStripApvGain");
00070   monitorLorentzAngle_   = iConfig.getParameter<bool>("MonitorSiStripLorentzAngle");
00071   monitorLowThreshold_   = iConfig.getParameter<bool>("MonitorSiStripLowThreshold");
00072   monitorHighThreshold_  = iConfig.getParameter<bool>("MonitorSiStripHighThreshold");
00073   monitorCabling_        = iConfig.getParameter<bool>("MonitorSiStripCabling"); 
00074    
00075 }
00076 // -----
00077 
00078 
00079 
00080 //
00081 // ----- Destructor
00082 // 
00083 SiStripClassToMonitorCondData::~SiStripClassToMonitorCondData(){
00084   
00085   if(monitorPedestals_)    { delete pedestalsDQM_;}
00086   if(monitorNoises_)       { delete noisesDQM_;   }
00087   if(monitorQuality_)      { delete qualityDQM_;  }
00088   if(monitorApvGains_)     { delete apvgainsDQM_; }
00089   if(monitorLorentzAngle_) { delete lorentzangleDQM_; }
00090   if(monitorLowThreshold_) { delete lowthresholdDQM_ ;}
00091   if(monitorHighThreshold_){ delete highthresholdDQM_;}
00092   if(monitorCabling_)      { delete cablingDQM_;}
00093 
00094 }
00095 // -----
00096 
00097 
00098 
00099 
00100 //
00101 // ----- beginRun
00102 //    
00103 void SiStripClassToMonitorCondData::beginRun(edm::EventSetup const& eSetup) {
00104   
00105   if(monitorPedestals_){
00106     pedestalsDQM_ = new SiStripPedestalsDQM(eSetup,
00107                                             conf_.getParameter<edm::ParameterSet>("SiStripPedestalsDQM_PSet"),
00108                                             conf_.getParameter<edm::ParameterSet>("FillConditions_PSet"));
00109   }
00110   
00111   
00112   if(monitorNoises_){
00113     noisesDQM_ = new SiStripNoisesDQM(eSetup,
00114                                       conf_.getParameter<edm::ParameterSet>("SiStripNoisesDQM_PSet"),
00115                                       conf_.getParameter<edm::ParameterSet>("FillConditions_PSet"));
00116   }
00117  
00118   
00119   if(monitorQuality_){
00120     qualityDQM_ = new SiStripQualityDQM(eSetup,
00121                                         conf_.getParameter<edm::ParameterSet>("SiStripQualityDQM_PSet"),
00122                                         conf_.getParameter<edm::ParameterSet>("FillConditions_PSet"));
00123   } 
00124   
00125  
00126   if(monitorApvGains_){
00127     apvgainsDQM_ = new SiStripApvGainsDQM(eSetup,
00128                                           conf_.getParameter<edm::ParameterSet>("SiStripApvGainsDQM_PSet"),
00129                                           conf_.getParameter<edm::ParameterSet>("FillConditions_PSet"));
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   
00138   if(monitorLowThreshold_){
00139     lowthresholdDQM_ = new SiStripThresholdDQM(eSetup,
00140                                                conf_.getParameter<edm::ParameterSet>("SiStripLowThresholdDQM_PSet"),
00141                                                conf_.getParameter<edm::ParameterSet>("FillConditions_PSet"));
00142   }
00143 
00144   if(monitorHighThreshold_){
00145     highthresholdDQM_ = new SiStripThresholdDQM(eSetup,
00146                                                 conf_.getParameter<edm::ParameterSet>("SiStripHighThresholdDQM_PSet"),
00147                                                 conf_.getParameter<edm::ParameterSet>("FillConditions_PSet"));
00148   }
00149 
00150   if(monitorCabling_){
00151     cablingDQM_ = new SiStripCablingDQM(eSetup,
00152                                         conf_.getParameter<edm::ParameterSet>("SiStripCablingDQM_PSet"),
00153                                         conf_.getParameter<edm::ParameterSet>("FillConditions_PSet"));
00154   }
00155 } // beginRun
00156 // -----
00157 
00158 
00159 
00160 //
00161 // ----- beginJob
00162 //
00163 void SiStripClassToMonitorCondData::beginJob(void){} //beginJob
00164 
00165 
00166 //
00167 // ----- getModuleMEsOnDemand
00168 //
00169 void SiStripClassToMonitorCondData::getModMEsOnDemand(edm::EventSetup const& eSetup, uint32_t requestedDetId){
00170 
00171   if(monitorPedestals_)      { pedestalsDQM_     ->analysisOnDemand(eSetup,requestedDetId);}
00172   if(monitorNoises_)         { noisesDQM_        ->analysisOnDemand(eSetup,requestedDetId);}    
00173   if(monitorQuality_)        { qualityDQM_       ->analysisOnDemand(eSetup,requestedDetId);
00174                               qualityDQM_       ->fillGrandSummaryMEs()                  ;}//fillGrand. for SiStripquality
00175   if(monitorApvGains_)       { apvgainsDQM_      ->analysisOnDemand(eSetup,requestedDetId);} 
00176   if(monitorLorentzAngle_)   { lorentzangleDQM_  ->analysisOnDemand(eSetup,requestedDetId);} 
00177   if(monitorCabling_)        { cablingDQM_       ->analysisOnDemand(eSetup,requestedDetId);}   
00178   if(monitorLowThreshold_)   { lowthresholdDQM_  ->analysisOnDemand(eSetup,requestedDetId);}
00179   if(monitorHighThreshold_)  { highthresholdDQM_ ->analysisOnDemand(eSetup,requestedDetId);}
00180 }
00181 // -----
00182 
00183 //
00184 // ----- getlayerMEsOnDemand
00185 //
00186 void SiStripClassToMonitorCondData::getLayerMEsOnDemand(edm::EventSetup const& eSetup, std::string requestedSubDetector, 
00187                                                         uint32_t requestedSide, 
00188                                                         uint32_t requestedLayer){
00189  
00190   if(monitorPedestals_)      { pedestalsDQM_     ->analysisOnDemand(eSetup,requestedSubDetector, requestedSide,requestedLayer);}
00191   if(monitorNoises_)         { noisesDQM_        ->analysisOnDemand(eSetup,requestedSubDetector, requestedSide,requestedLayer);}    
00192   if(monitorQuality_)        { qualityDQM_       ->analysisOnDemand(eSetup,requestedSubDetector, requestedSide,requestedLayer);
00193   qualityDQM_       ->fillGrandSummaryMEs();}
00194   if(monitorApvGains_)       { apvgainsDQM_      ->analysisOnDemand(eSetup,requestedSubDetector, requestedSide,requestedLayer);} 
00195   if(monitorLorentzAngle_)   { lorentzangleDQM_  ->analysisOnDemand(eSetup,requestedSubDetector, requestedSide,requestedLayer);} 
00196   if(monitorCabling_)        { cablingDQM_       ->analysisOnDemand(eSetup,requestedSubDetector, requestedSide,requestedLayer);}
00197   if(monitorLowThreshold_)   { lowthresholdDQM_  ->analysisOnDemand(eSetup,requestedSubDetector, requestedSide,requestedLayer);}
00198   if(monitorHighThreshold_)  { highthresholdDQM_ ->analysisOnDemand(eSetup,requestedSubDetector, requestedSide,requestedLayer);}
00199   
00200 }
00201 
00202 //
00203 // ----- Analyze
00204 //
00205 void SiStripClassToMonitorCondData::analyseCondData(edm::EventSetup const& eSetup){
00206 
00207   if(monitorPedestals_)      { pedestalsDQM_     ->analysis(eSetup);}
00208   if(monitorNoises_)         { noisesDQM_        ->analysis(eSetup);}    
00209   if(monitorQuality_)        { qualityDQM_       ->analysis(eSetup); qualityDQM_->fillGrandSummaryMEs();}//fillGrand. for SiStripquality
00210   if(monitorApvGains_)       { apvgainsDQM_      ->analysis(eSetup);} 
00211   if(monitorLorentzAngle_)   { lorentzangleDQM_  ->analysis(eSetup);} 
00212   if(monitorCabling_)        { cablingDQM_       ->analysis(eSetup);}   
00213   if(monitorLowThreshold_)   { lowthresholdDQM_  ->analysis(eSetup);} 
00214   if(monitorHighThreshold_)  { highthresholdDQM_ ->analysis(eSetup);} 
00215    
00216 } // analyze
00217 // -----
00218 
00219 
00220 
00221 //
00222 // ----- endRun
00223 //    
00224 void SiStripClassToMonitorCondData::endRun(edm::EventSetup const& eSetup) {
00225   
00226   bool outputMEsInRootFile     = conf_.getParameter<bool>("OutputMEsInRootFile");
00227   std::string outputFileName  = conf_.getParameter<std::string>("OutputFileName");
00228 
00229   DQMStore* dqmStore_=edm::Service<DQMStore>().operator->();
00230   
00231   if (outputMEsInRootFile) { 
00232     dqmStore_->showDirStructure();
00233     dqmStore_->save(outputFileName);
00234   } 
00235  
00236 } // endRun
00237 // -----
00238 
00239 
00240 //
00241 // ----- endJob
00242 //
00243 void SiStripClassToMonitorCondData::endJob(void){} //endJob
00244 
00245 
00246