Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
// -*- C++ -*-
//
// Package:     SiStripMonitorSummary
// Class  :     SiStripMonitorCondDataOnDemandExample
//
// Original Author:  Evelyne Delmeire
//

#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/Run.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/Service.h"

#include "DQM/SiStripMonitorSummary/interface/SiStripClassToMonitorCondData.h"
#include "SiStripMonitorCondDataOnDemandExample.h"

#include "TH1F.h"
#include "TH2F.h"
#include "TProfile.h"

// std
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <numeric>
#include <string>

//
// ----- Constructor
//
SiStripMonitorCondDataOnDemandExample::SiStripMonitorCondDataOnDemandExample(edm::ParameterSet const &iConfig) {
  condDataMonitoring_ = std::make_unique<SiStripClassToMonitorCondData>(iConfig, consumesCollector());
}
// -----

//
// ----- beginRun
//
void SiStripMonitorCondDataOnDemandExample::beginRun(edm::Run const &run, edm::EventSetup const &eSetup) {
  eventCounter_ = 0;
  condDataMonitoring_->beginRun(run.run(), eSetup);
}  // beginRun
// -----

//
// ----- beginJob
//
void SiStripMonitorCondDataOnDemandExample::beginJob(void) {}  // beginJob

//
// ----- Analyze
//
void SiStripMonitorCondDataOnDemandExample::analyze(edm::Event const &iEvent, edm::EventSetup const &eSetup) {
  // eventCounter_++;

  // on demand type I : eventSetup and detId to be passed
  // output : ME's corresponding to that detId

  // if(eventCounter_==1){ condDataMonitoring_ ->
  // getModMEsOnDemand(eSetup,369125542);}

  // on demand type II : eventSetup, subdetector-type(TIB/TOB/TEC/TID),
  //                                 subdetector-side for TEC/TID (0 for TIB and
  //                                 TOB) layer_number (0=all layers)

  // if(eventCounter_==2){ condDataMonitoring_ ->
  // getLayerMEsOnDemand(eSetup,"TEC",0,1);} condDataMonitoring_ ->
  // getModMEsOnDemand(eSetup,369125542);
  condDataMonitoring_->getLayerMEsOnDemand(eSetup, "TEC", 2, 4);

}  // analyze
// -----

//
// ----- endRun
//
void SiStripMonitorCondDataOnDemandExample::endRun(edm::Run const &run, edm::EventSetup const &eSetup) {
  condDataMonitoring_->save();

}  // endRun
// -----

//
// ----- endJob
//
void SiStripMonitorCondDataOnDemandExample::endJob(void) {}  // endJob

#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(SiStripMonitorCondDataOnDemandExample);