Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // Package:     HLTExoticaValidator
0004 // Class:       HLTExoticaValidator
0005 //
0006 
0007 //
0008 // Jordi Duarte Campderros (based on the Jason Slaunwhite
0009 // and Jeff Klukas coded from the HLTriggerOffline/Muon package
0010 //
0011 //
0012 //
0013 
0014 // system include files
0015 
0016 #include "HLTriggerOffline/Exotica/interface/HLTExoticaValidator.h"
0017 #include "HLTriggerOffline/Exotica/src/EVTColContainer.cc"
0018 
0019 //////// Class Methods ///////////////////////////////////////////////////////
0020 
0021 // Constructor
0022 HLTExoticaValidator::HLTExoticaValidator(const edm::ParameterSet &pset)
0023     : _pset(pset), _analysisnames(pset.getParameter<std::vector<std::string>>("analyses")), _collections(nullptr) {
0024   LogDebug("ExoticaValidation") << "In HLTExoticaValidator::constructor()";
0025 
0026   // Prepare the event collections to be used.
0027   _collections = new EVTColContainer;
0028 
0029   // Create a new subanalysis for each of the analysis names.
0030   // Notice that the constructor takes the full parameter set,
0031   // the analysis name and the consumesCollector() separately.
0032   for (size_t i = 0; i < _analysisnames.size(); ++i) {
0033     HLTExoticaSubAnalysis analyzer(_pset, _analysisnames.at(i), consumesCollector());
0034     _analyzers.push_back(analyzer);
0035   }
0036 }
0037 
0038 HLTExoticaValidator::~HLTExoticaValidator() {
0039   if (_collections != nullptr) {
0040     delete _collections;
0041     _collections = nullptr;
0042   }
0043 }
0044 
0045 // 2014-02-03 -- Thiago
0046 // Due to the fact that the DQM has to be thread safe now, we have to do things
0047 // differently: 1) Implement the bookHistograms method in this class 2) Split
0048 // beginRun() into bookHistograms() and dqmBeginRun() 3) Call
0049 // subAnalysisBookHistos() for each subAnalysis from inside bookHistograms()
0050 // *** IMPORTANT *** notice that now dqmBeginRun() runs before bookHistograms()!
0051 void HLTExoticaValidator::dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) {
0052   LogDebug("ExoticaValidation") << "In HLTExoticaValidator::dqmBeginRun()";
0053 
0054   // Call the Plotter beginRun (which stores the triggers paths..:)
0055   for (std::vector<HLTExoticaSubAnalysis>::iterator iter = _analyzers.begin(); iter != _analyzers.end(); ++iter) {
0056     iter->beginRun(iRun, iSetup);
0057   }
0058 }
0059 
0060 void HLTExoticaValidator::bookHistograms(DQMStore::IBooker &iBooker,
0061                                          const edm::Run &iRun,
0062                                          const edm::EventSetup &iSetup) {
0063   LogDebug("ExoticaValidation") << "In HLTExoticaValidator::bookHistograms()";
0064 
0065   // Loop over all sub-analyses and book histograms for all of them.
0066   // For this to work, I think we have to pass the iBooker to each of them.
0067   // I don't think we have any guarantee that this loop is executed
0068   // sequentially, but the booking with iBooker itself has such a guarantee.
0069   for (std::vector<HLTExoticaSubAnalysis>::iterator iter = _analyzers.begin(); iter != _analyzers.end(); ++iter) {
0070     iter->subAnalysisBookHistos(iBooker, iRun, iSetup);
0071   }
0072 }
0073 
0074 void HLTExoticaValidator::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) {
0075   LogDebug("ExoticaValidation") << "In HLTExoticaValidator::analyze()";
0076 
0077   // static int eventNumber = 0;
0078   // eventNumber++;
0079   // LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::analyze,  "
0080   //                              << "Event: " << eventNumber;
0081 
0082   // Initialize the event collections
0083   this->_collections->reset();
0084 
0085   for (std::vector<HLTExoticaSubAnalysis>::iterator iter = _analyzers.begin(); iter != _analyzers.end(); ++iter) {
0086     iter->analyze(iEvent, iSetup, this->_collections);
0087   }
0088 }
0089 
0090 void HLTExoticaValidator::beginJob() { LogDebug("ExoticaValidation") << "In HLTExoticaValidator::beginJob()"; }
0091 
0092 void HLTExoticaValidator::dqmEndRun(const edm::Run &iRun, const edm::EventSetup &iSetup) {
0093   for (std::vector<HLTExoticaSubAnalysis>::iterator iter = _analyzers.begin(); iter != _analyzers.end(); ++iter) {
0094     iter->endRun();
0095   }
0096 }
0097 
0098 void HLTExoticaValidator::endJob() {}
0099 
0100 // define this as a plug-in
0101 // DEFINE_FWK_MODULE(HLTExoticaValidator);