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),
24  _analysisnames(pset.getParameter<std::vector<std::string> >("analyses")),
25  _collections(nullptr)
26 {
27 
28  LogDebug("ExoticaValidation") << "In HLTExoticaValidator::constructor()";
29 
30  // Prepare the event collections to be used.
32 
33  // Create a new subanalysis for each of the analysis names.
34  // Notice that the constructor takes the full parameter set,
35  // the analysis name and the consumesCollector() separately.
36  for (size_t i = 0; i < _analysisnames.size() ; ++i) {
38  _analyzers.push_back(analyzer);
39  }
40 
41 }
42 
44 {
45  if (_collections != nullptr) {
46  delete _collections;
47  _collections = nullptr;
48  }
49 }
50 
51 
52 // 2014-02-03 -- Thiago
53 // Due to the fact that the DQM has to be thread safe now, we have to do things differently:
54 // 1) Implement the bookHistograms method in this class
55 // 2) Split beginRun() into bookHistograms() and dqmBeginRun()
56 // 3) Call subAnalysisBookHistos() for each subAnalysis from inside bookHistograms()
57 // *** IMPORTANT *** notice that now dqmBeginRun() runs before bookHistograms()!
58 void HLTExoticaValidator::dqmBeginRun(const edm::Run & iRun, const edm::EventSetup & iSetup)
59 {
60  LogDebug("ExoticaValidation") << "In HLTExoticaValidator::dqmBeginRun()";
61 
62  // Call the Plotter beginRun (which stores the triggers paths..:)
63  for (std::vector<HLTExoticaSubAnalysis>::iterator iter = _analyzers.begin();
64  iter != _analyzers.end(); ++iter) {
65  iter->beginRun(iRun, iSetup);
66  }
67 }
68 
70 {
71 
72  LogDebug("ExoticaValidation") << "In HLTExoticaValidator::bookHistograms()";
73 
74  // Loop over all sub-analyses and book histograms for all of them.
75  // For this to work, I think we have to pass the iBooker to each of them.
76  // I don't think we have any guarantee that this loop is executed sequentially,
77  // but the booking with iBooker itself has such a guarantee.
78  for (std::vector<HLTExoticaSubAnalysis>::iterator iter = _analyzers.begin();
79  iter != _analyzers.end(); ++iter) {
80  iter->subAnalysisBookHistos(iBooker, iRun, iSetup);
81  }
82 }
83 
84 
86 {
87  LogDebug("ExoticaValidation") << "In HLTExoticaValidator::analyze()";
88 
89  //static int eventNumber = 0;
90  //eventNumber++;
91  //LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::analyze, "
92  // << "Event: " << eventNumber;
93 
94  // Initialize the event collections
95  this->_collections->reset();
96 
97  for (std::vector<HLTExoticaSubAnalysis>::iterator iter = _analyzers.begin();
98  iter != _analyzers.end(); ++iter) {
99  iter->analyze(iEvent, iSetup, this->_collections);
100  }
101 }
102 
103 
104 
106 {
107  LogDebug("ExoticaValidation") << "In HLTExoticaValidator::beginJob()";
108 }
109 
110 void HLTExoticaValidator::endRun(const edm::Run & iRun, const edm::EventSetup& iSetup)
111 {
112  for (std::vector<HLTExoticaSubAnalysis>::iterator iter = _analyzers.begin();
113  iter != _analyzers.end(); ++iter) {
114  iter->endRun();
115  }
116 }
117 
118 
120 {
121 }
122 
123 //define this as a plug-in
124 //DEFINE_FWK_MODULE(HLTExoticaValidator);
#define LogDebug(id)
std::vector< HLTExoticaSubAnalysis > _analyzers
The instances of the class which do the real work.
HLTExoticaValidator(const edm::ParameterSet &)
Constructor and destructor.
void endRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
container with all the objects needed
edm::ParameterSet _pset
Copy (to be modified) of the input ParameterSet from configuration file.
#define nullptr
int iEvent
Definition: GenABIO.cc:230
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:43