CMS 3D CMS Logo

HLTExoticaValidator.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HLTExoticaValidator
4 // Class: HLTExoticaValidator
5 //
6 
7 //
8 // Jordi Duarte Campderros (based on the Jason Slaunwhite
9 // and Jeff Klukas coded from the HLTriggerOffline/Muon package
10 //
11 //
12 //
13 
14 // system include files
15 
18 
20 
21 // Constructor
23  : _pset(pset), _analysisnames(pset.getParameter<std::vector<std::string>>("analyses")), _collections(nullptr) {
24  LogDebug("ExoticaValidation") << "In HLTExoticaValidator::constructor()";
25 
26  // Prepare the event collections to be used.
28 
29  // Create a new subanalysis for each of the analysis names.
30  // Notice that the constructor takes the full parameter set,
31  // the analysis name and the consumesCollector() separately.
32  for (size_t i = 0; i < _analysisnames.size(); ++i) {
34  _analyzers.push_back(analyzer);
35  }
36 }
37 
39  if (_collections != nullptr) {
40  delete _collections;
41  _collections = nullptr;
42  }
43 }
44 
45 // 2014-02-03 -- Thiago
46 // Due to the fact that the DQM has to be thread safe now, we have to do things
47 // differently: 1) Implement the bookHistograms method in this class 2) Split
48 // beginRun() into bookHistograms() and dqmBeginRun() 3) Call
49 // subAnalysisBookHistos() for each subAnalysis from inside bookHistograms()
50 // *** IMPORTANT *** notice that now dqmBeginRun() runs before bookHistograms()!
51 void HLTExoticaValidator::dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) {
52  LogDebug("ExoticaValidation") << "In HLTExoticaValidator::dqmBeginRun()";
53 
54  // Call the Plotter beginRun (which stores the triggers paths..:)
55  for (std::vector<HLTExoticaSubAnalysis>::iterator iter = _analyzers.begin(); iter != _analyzers.end(); ++iter) {
56  iter->beginRun(iRun, iSetup);
57  }
58 }
59 
61  const edm::Run &iRun,
62  const edm::EventSetup &iSetup) {
63  LogDebug("ExoticaValidation") << "In HLTExoticaValidator::bookHistograms()";
64 
65  // Loop over all sub-analyses and book histograms for all of them.
66  // For this to work, I think we have to pass the iBooker to each of them.
67  // I don't think we have any guarantee that this loop is executed
68  // sequentially, but the booking with iBooker itself has such a guarantee.
69  for (std::vector<HLTExoticaSubAnalysis>::iterator iter = _analyzers.begin(); iter != _analyzers.end(); ++iter) {
70  iter->subAnalysisBookHistos(iBooker, iRun, iSetup);
71  }
72 }
73 
75  LogDebug("ExoticaValidation") << "In HLTExoticaValidator::analyze()";
76 
77  // static int eventNumber = 0;
78  // eventNumber++;
79  // LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::analyze, "
80  // << "Event: " << eventNumber;
81 
82  // Initialize the event collections
83  this->_collections->reset();
84 
85  for (std::vector<HLTExoticaSubAnalysis>::iterator iter = _analyzers.begin(); iter != _analyzers.end(); ++iter) {
86  iter->analyze(iEvent, iSetup, this->_collections);
87  }
88 }
89 
90 void HLTExoticaValidator::beginJob() { LogDebug("ExoticaValidation") << "In HLTExoticaValidator::beginJob()"; }
91 
92 void HLTExoticaValidator::dqmEndRun(const edm::Run &iRun, const edm::EventSetup &iSetup) {
93  for (std::vector<HLTExoticaSubAnalysis>::iterator iter = _analyzers.begin(); iter != _analyzers.end(); ++iter) {
94  iter->endRun();
95  }
96 }
97 
99 
100 // define this as a plug-in
101 // DEFINE_FWK_MODULE(HLTExoticaValidator);
std::vector< HLTExoticaSubAnalysis > _analyzers
The instances of the class which do the real work.
HLTExoticaValidator(const edm::ParameterSet &)
Constructor and destructor.
void beginJob() override
container with all the objects needed
void dqmEndRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
edm::ParameterSet _pset
Copy (to be modified) of the input ParameterSet from configuration file.
int iEvent
Definition: GenABIO.cc:224
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::vector< std::string > _analysisnames
The names of the subanalyses.
void reset()
Reset: clear all collections.
void dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
Method called by the framework just before dqmBeginRun()
void bookHistograms(DQMStore::IBooker &iBooker, const edm::Run &iRun, const edm::EventSetup &iSetup) override
Method called by the framework to book histograms.
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
Method called for each event.
EVTColContainer * _collections
Centralized point of access to all collections used.
Definition: Run.h:45
#define LogDebug(id)