Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:13:40

0001 #include "DQMOffline/Trigger/interface/HLTTauDQMPathSummaryPlotter.h"
0002 #include "DQMOffline/Trigger/interface/HLTTauDQMPath.h"
0003 
0004 HLTTauDQMPathSummaryPlotter::HLTTauDQMPathSummaryPlotter(const edm::ParameterSet& pset,
0005                                                          bool doRefAnalysis,
0006                                                          const std::string& dqmBaseFolder,
0007                                                          double hltMatchDr)
0008     : HLTTauDQMPlotter(pset, dqmBaseFolder), hltMatchDr_(hltMatchDr), doRefAnalysis_(doRefAnalysis) {}
0009 
0010 HLTTauDQMPathSummaryPlotter::~HLTTauDQMPathSummaryPlotter() = default;
0011 
0012 void HLTTauDQMPathSummaryPlotter::bookHistograms(HistoWrapper& iWrapper, DQMStore::IBooker& iBooker) {
0013   if (!isValid() || pathObjects_.empty())
0014     return;
0015 
0016   //Create the histograms
0017   iBooker.setCurrentFolder(triggerTag() + "/helpers");
0018 
0019   all_events = iWrapper.book1D(iBooker, "RefEvents", "All events", pathObjects_.size(), 0, pathObjects_.size(), kVital);
0020   accepted_events = iWrapper.book1D(iBooker,
0021                                     "PathTriggerBits",
0022                                     "Accepted Events per Path;;entries",
0023                                     pathObjects_.size(),
0024                                     0,
0025                                     pathObjects_.size(),
0026                                     kVital);
0027   for (size_t i = 0; i < pathObjects_.size(); ++i) {
0028     if (all_events)
0029       all_events->setBinLabel(i + 1, pathObjects_[i]->getPathName());
0030     if (accepted_events)
0031       accepted_events->setBinLabel(i + 1, pathObjects_[i]->getPathName());
0032   }
0033 
0034   iBooker.setCurrentFolder(triggerTag());
0035 }
0036 
0037 void HLTTauDQMPathSummaryPlotter::analyze(const edm::TriggerResults& triggerResults,
0038                                           const trigger::TriggerEvent& triggerEvent,
0039                                           const HLTTauDQMOfflineObjects& refCollection) {
0040   if (doRefAnalysis_) {
0041     std::vector<HLTTauDQMPath::Object> triggerObjs;
0042     std::vector<HLTTauDQMPath::Object> matchedTriggerObjs;
0043     HLTTauDQMOfflineObjects matchedOfflineObjs;
0044 
0045     for (size_t i = 0; i < pathObjects_.size(); ++i) {
0046       const HLTTauDQMPath* path = pathObjects_[i];
0047       const int lastFilter = path->filtersSize() - 1;
0048 
0049       if (path->goodOfflineEvent(lastFilter, refCollection)) {
0050         if (all_events)
0051           all_events->Fill(i + 0.5);
0052       }
0053       if (path->fired(triggerResults)) {
0054         triggerObjs.clear();
0055         matchedTriggerObjs.clear();
0056         matchedOfflineObjs.clear();
0057         path->getFilterObjects(triggerEvent, lastFilter, triggerObjs);
0058         if (path->offlineMatching(
0059                 lastFilter, triggerObjs, refCollection, hltMatchDr_, matchedTriggerObjs, matchedOfflineObjs)) {
0060           if (accepted_events)
0061             accepted_events->Fill(i + 0.5);
0062         }
0063       }
0064     }
0065   } else {
0066     for (size_t i = 0; i < pathObjects_.size(); ++i) {
0067       const HLTTauDQMPath* path = pathObjects_[i];
0068       if (all_events)
0069         all_events->Fill(i + 0.5);
0070       if (path->fired(triggerResults)) {
0071         if (accepted_events)
0072           accepted_events->Fill(i + 0.5);
0073       }
0074     }
0075   }
0076 }