Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:08:53

0001 // -*- C++ -*-
0002 //
0003 // Package:     SiStripMonitorSummary
0004 // Class  :     SiStripMonitorCondDataOnDemandExample
0005 //
0006 // Original Author:  Evelyne Delmeire
0007 //
0008 
0009 #include "FWCore/Framework/interface/ESHandle.h"
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/Framework/interface/EventSetup.h"
0012 #include "FWCore/Framework/interface/Run.h"
0013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 #include "FWCore/ServiceRegistry/interface/Service.h"
0016 
0017 #include "DQM/SiStripMonitorSummary/interface/SiStripClassToMonitorCondData.h"
0018 #include "SiStripMonitorCondDataOnDemandExample.h"
0019 
0020 #include "TH1F.h"
0021 #include "TH2F.h"
0022 #include "TProfile.h"
0023 
0024 // std
0025 #include <algorithm>
0026 #include <cmath>
0027 #include <cstdlib>
0028 #include <numeric>
0029 #include <string>
0030 
0031 //
0032 // ----- Constructor
0033 //
0034 SiStripMonitorCondDataOnDemandExample::SiStripMonitorCondDataOnDemandExample(edm::ParameterSet const &iConfig) {
0035   condDataMonitoring_ = std::make_unique<SiStripClassToMonitorCondData>(iConfig, consumesCollector());
0036 }
0037 // -----
0038 
0039 //
0040 // ----- beginRun
0041 //
0042 void SiStripMonitorCondDataOnDemandExample::beginRun(edm::Run const &run, edm::EventSetup const &eSetup) {
0043   eventCounter_ = 0;
0044   condDataMonitoring_->beginRun(run.run(), eSetup);
0045 }  // beginRun
0046 // -----
0047 
0048 //
0049 // ----- beginJob
0050 //
0051 void SiStripMonitorCondDataOnDemandExample::beginJob(void) {}  // beginJob
0052 
0053 //
0054 // ----- Analyze
0055 //
0056 void SiStripMonitorCondDataOnDemandExample::analyze(edm::Event const &iEvent, edm::EventSetup const &eSetup) {
0057   // eventCounter_++;
0058 
0059   // on demand type I : eventSetup and detId to be passed
0060   // output : ME's corresponding to that detId
0061 
0062   // if(eventCounter_==1){ condDataMonitoring_ ->
0063   // getModMEsOnDemand(eSetup,369125542);}
0064 
0065   // on demand type II : eventSetup, subdetector-type(TIB/TOB/TEC/TID),
0066   //                                 subdetector-side for TEC/TID (0 for TIB and
0067   //                                 TOB) layer_number (0=all layers)
0068 
0069   // if(eventCounter_==2){ condDataMonitoring_ ->
0070   // getLayerMEsOnDemand(eSetup,"TEC",0,1);} condDataMonitoring_ ->
0071   // getModMEsOnDemand(eSetup,369125542);
0072   condDataMonitoring_->getLayerMEsOnDemand(eSetup, "TEC", 2, 4);
0073 
0074 }  // analyze
0075 // -----
0076 
0077 //
0078 // ----- endRun
0079 //
0080 void SiStripMonitorCondDataOnDemandExample::endRun(edm::Run const &run, edm::EventSetup const &eSetup) {
0081   condDataMonitoring_->save();
0082 
0083 }  // endRun
0084 // -----
0085 
0086 //
0087 // ----- endJob
0088 //
0089 void SiStripMonitorCondDataOnDemandExample::endJob(void) {}  // endJob
0090 
0091 #include "FWCore/Framework/interface/MakerMacros.h"
0092 DEFINE_FWK_MODULE(SiStripMonitorCondDataOnDemandExample);