CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Member Functions | Private Attributes
HLTTauDQMOfflineSource Class Reference

#include <HLTTauDQMOfflineSource.h>

Inheritance diagram for HLTTauDQMOfflineSource:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Classes

struct  RefObject
 

Public Member Functions

 HLTTauDQMOfflineSource (const edm::ParameterSet &)
 
 ~HLTTauDQMOfflineSource () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void bookHistograms (DQMStore::IBooker &iBooker, const edm::Run &r, const edm::EventSetup &c) override
 
void dqmBeginRun (const edm::Run &r, const edm::EventSetup &c) override
 

Private Attributes

int counterEvt_
 
bool doRefAnalysis_
 
const std::string dqmBaseFolder_
 
const double highPtMax_
 
HLTConfigProvider HLTCP_
 
const double hltMatchDr_
 
std::string hltProcessName_
 
const double l1MatchDr_
 
std::unique_ptr< HLTTauDQML1Plotterl1Plotter_
 
const int nEtaBins_
 
const int nPhiBins_
 
const int nPtBins_
 
std::vector< HLTTauDQMPathPlotterpathPlotters_
 
const std::regex pathRegex_
 
std::unique_ptr< HLTTauDQMPathSummaryPlotterpathSummaryPlotter_
 
const int prescaleEvt_
 
const double ptMax_
 
std::vector< RefObjectrefObjects_
 
bool tagAndProbe_
 
std::vector< edm::ParameterSettagAndProbePaths
 
std::vector< std::unique_ptr< HLTTauDQMTagAndProbePlotter > > tagandprobePlotters_
 
edm::InputTag triggerEventSrc_
 
edm::EDGetTokenT< trigger::TriggerEventtriggerEventToken_
 
edm::InputTag triggerResultsSrc_
 
edm::EDGetTokenT< edm::TriggerResultstriggerResultsToken_
 

Detailed Description

Definition at line 29 of file HLTTauDQMOfflineSource.h.

Constructor & Destructor Documentation

HLTTauDQMOfflineSource::HLTTauDQMOfflineSource ( const edm::ParameterSet ps)

Definition at line 15 of file HLTTauDQMOfflineSource.cc.

References doRefAnalysis_, dqmBaseFolder_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), highPtMax_, hltMatchDr_, l1MatchDr_, l1Plotter_, nPhiBins_, pathSummaryPlotter_, muonDTDigis_cfi::pset, ptMax_, refObjects_, tagAndProbe_, tagAndProbePaths, HistogramManager_cfi::VPSet(), and ~HLTTauDQMOfflineSource().

15  :
16  hltProcessName_(ps.getUntrackedParameter<std::string>("HLTProcessName","HLT")),
17  triggerResultsSrc_(ps.getUntrackedParameter<edm::InputTag>("TriggerResultsSrc")),
18  triggerResultsToken_(consumes<edm::TriggerResults>(triggerResultsSrc_)),
20  triggerEventToken_(consumes<trigger::TriggerEvent>(triggerEventSrc_)),
22  nPtBins_(ps.getUntrackedParameter<int>("PtHistoBins", 20)),
23  nEtaBins_(ps.getUntrackedParameter<int>("EtaHistoBins",12)),
24  nPhiBins_(ps.getUntrackedParameter<int>("PhiHistoBins",18)),
25  ptMax_(ps.getUntrackedParameter<double>("PtHistoMax",200)),
26  highPtMax_(ps.getUntrackedParameter<double>("HighPtHistoMax",1000)),
27  l1MatchDr_(ps.getUntrackedParameter<double>("L1MatchDeltaR", 0.5)),
28  hltMatchDr_(ps.getUntrackedParameter<double>("HLTMatchDeltaR", 0.5)),
29  dqmBaseFolder_(ps.getUntrackedParameter<std::string>("DQMBaseFolder")),
30  counterEvt_(0),
31  prescaleEvt_(ps.getUntrackedParameter<int>("prescaleEvt", -1))
32 {
34  doRefAnalysis_ = matching.getUntrackedParameter<bool>("doMatching");
35 
36  if(ps.exists("L1Plotter") && !ps.exists("TagAndProbe")) {
37  l1Plotter_ = std::make_unique<HLTTauDQML1Plotter>(ps.getUntrackedParameter<edm::ParameterSet>("L1Plotter"), consumesCollector(),
39  }
40  if(ps.exists("PathSummaryPlotter")) {
41  pathSummaryPlotter_ = std::make_unique<HLTTauDQMPathSummaryPlotter>(ps.getUntrackedParameter<edm::ParameterSet>("PathSummaryPlotter"),
42  doRefAnalysis_, dqmBaseFolder_, hltMatchDr_);
43  }
44  tagAndProbe_ = false;
45  if(ps.exists("TagAndProbe")) {
46  tagAndProbePaths = ps.getUntrackedParameter<std::vector<edm::ParameterSet> >("TagAndProbe");
47  tagAndProbe_ = true;
48  }
49 
50  if(doRefAnalysis_) {
51  using VPSet = std::vector<edm::ParameterSet>;
52  VPSet matchObjects = matching.getUntrackedParameter<VPSet>("matchFilters");
53  for(const edm::ParameterSet& pset: matchObjects) {
54  refObjects_.push_back(RefObject{pset.getUntrackedParameter<int>("matchObjectID"),
55  consumes<LVColl>(pset.getUntrackedParameter<edm::InputTag>("FilterName"))});
56  }
57  }
58 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const std::string dqmBaseFolder_
edm::EDGetTokenT< trigger::TriggerEvent > triggerEventToken_
std::vector< RefObject > refObjects_
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< edm::ParameterSet > tagAndProbePaths
std::unique_ptr< HLTTauDQMPathSummaryPlotter > pathSummaryPlotter_
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
std::unique_ptr< HLTTauDQML1Plotter > l1Plotter_
HLTTauDQMOfflineSource::~HLTTauDQMOfflineSource ( )
overridedefault

Referenced by HLTTauDQMOfflineSource().

Member Function Documentation

void HLTTauDQMOfflineSource::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotected

Definition at line 163 of file HLTTauDQMOfflineSource.cc.

References counterEvt_, doRefAnalysis_, HLTTauDQMOfflineObjects::electrons, edm::Event::getByToken(), edm::HandleBase::isValid(), l1Plotter_, HLTTauDQMOfflineObjects::met, HLTTauDQMOfflineObjects::muons, pathPlotters_, pathSummaryPlotter_, prescaleEvt_, refObjects_, tagandprobePlotters_, HLTTauDQMOfflineObjects::taus, trackingPlots::tpPlotter, triggerEventSrc_, triggerEventToken_, triggerResultsSrc_, and triggerResultsToken_.

163  {
164  //Apply the prescaler
165  if (counterEvt_ > prescaleEvt_) {
166  //Do Analysis here
167  counterEvt_ = 0;
168 
169  edm::Handle<edm::TriggerResults> triggerResultsHandle;
170  iEvent.getByToken(triggerResultsToken_, triggerResultsHandle);
171  if(!triggerResultsHandle.isValid()) {
172  edm::LogWarning("HLTTauDQMOffline") << "Unable to read edm::TriggerResults with label " << triggerResultsSrc_;
173  return;
174  }
175 
176  edm::Handle<trigger::TriggerEvent> triggerEventHandle;
177  iEvent.getByToken(triggerEventToken_, triggerEventHandle);
178  if(!triggerEventHandle.isValid()) {
179  edm::LogWarning("HLTTauDQMOffline") << "Unable to read trigger::TriggerEvent with label " << triggerEventSrc_;
180  return;
181  }
182 
183  //Create match collections
185  if (doRefAnalysis_) {
186  for(RefObject& refObj: refObjects_) {
187  edm::Handle<LVColl> collHandle;
188  iEvent.getByToken(refObj.token, collHandle);
189  if(!collHandle.isValid())
190  continue;
191 
192  if(refObj.objID == 11) {
193  refC.electrons.insert(refC.electrons.end(), collHandle->begin(), collHandle->end());
194  }
195  else if(refObj.objID == 13) {
196  refC.muons.insert(refC.muons.end(), collHandle->begin(), collHandle->end());
197  }
198  else if(refObj.objID == 15) {
199  refC.taus.insert(refC.taus.end(), collHandle->begin(), collHandle->end());
200  }
201  else if(refObj.objID == 0) {
202  refC.met.insert(refC.met.end(), collHandle->begin(), collHandle->end());
203  }
204  }
205  }
206 
207  //Path Plotters
208  for(auto& pathPlotter: pathPlotters_) {
209  if(pathPlotter.isValid())
210  pathPlotter.analyze(*triggerResultsHandle, *triggerEventHandle, refC);
211  }
212 
213  if(pathSummaryPlotter_ && pathSummaryPlotter_->isValid()) {
214  pathSummaryPlotter_->analyze(*triggerResultsHandle, *triggerEventHandle, refC);
215  }
216 
217  //L1 Plotter
218  if(l1Plotter_ && l1Plotter_->isValid()) {
219  l1Plotter_->analyze(iEvent, iSetup, refC);
220  }
221 
222  //Tag and probe plotters
223  for(auto& tpPlotter: tagandprobePlotters_) {
224  if(tpPlotter->isValid())
225  tpPlotter->analyze(iEvent,*triggerResultsHandle, *triggerEventHandle, refC);
226  }
227 
228  } else {
229  counterEvt_++;
230  }
231 }
std::vector< LV > electrons
std::vector< LV > taus
edm::EDGetTokenT< trigger::TriggerEvent > triggerEventToken_
std::vector< RefObject > refObjects_
int iEvent
Definition: GenABIO.cc:230
std::vector< HLTTauDQMPathPlotter > pathPlotters_
bool isValid() const
Definition: HandleBase.h:74
std::vector< std::unique_ptr< HLTTauDQMTagAndProbePlotter > > tagandprobePlotters_
std::unique_ptr< HLTTauDQMPathSummaryPlotter > pathSummaryPlotter_
std::vector< LV > met
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
std::vector< LV > muons
std::unique_ptr< HLTTauDQML1Plotter > l1Plotter_
void HLTTauDQMOfflineSource::bookHistograms ( DQMStore::IBooker iBooker,
const edm::Run r,
const edm::EventSetup c 
)
overrideprotected

Definition at line 147 of file HLTTauDQMOfflineSource.cc.

References l1Plotter_, pathPlotters_, pathSummaryPlotter_, tagandprobePlotters_, and trackingPlots::tpPlotter.

147  {
148  if(l1Plotter_) {
149  l1Plotter_->bookHistograms(iBooker);
150  }
151  for(auto& pathPlotter: pathPlotters_) {
152  pathPlotter.bookHistograms(iBooker);
153  }
154  for(auto& tpPlotter: tagandprobePlotters_) {
155  tpPlotter->bookHistograms(iBooker,iRun,iSetup);
156  }
157  if(pathSummaryPlotter_) {
158  pathSummaryPlotter_->bookHistograms(iBooker);
159  }
160 }
std::vector< HLTTauDQMPathPlotter > pathPlotters_
std::vector< std::unique_ptr< HLTTauDQMTagAndProbePlotter > > tagandprobePlotters_
std::unique_ptr< HLTTauDQMPathSummaryPlotter > pathSummaryPlotter_
std::unique_ptr< HLTTauDQML1Plotter > l1Plotter_
void HLTTauDQMOfflineSource::dqmBeginRun ( const edm::Run r,
const edm::EventSetup c 
)
overrideprotected

Definition at line 63 of file HLTTauDQMOfflineSource.cc.

References edm::ParameterSet::addParameter(), doRefAnalysis_, dqmBaseFolder_, edm::ParameterSet::getParameter(), highPtMax_, HLTCP_, hltMatchDr_, hltProcessName_, mps_fire::i, HLTConfigProvider::init(), l1MatchDr_, LogDebug, HLTConfigProvider::moduleLabels(), nEtaBins_, nPhiBins_, nPtBins_, pathPlotters_, pathRegex_, pathSummaryPlotter_, ptMax_, AlCaHLTBitMon_QueryRunRegistry::string, tagAndProbe_, tagAndProbePaths, tagandprobePlotters_, and HLTConfigProvider::triggerNames().

63  {
64  //Evaluate configuration for every new trigger menu
65  bool hltMenuChanged = false;
66  if(HLTCP_.init(iRun, iSetup, hltProcessName_, hltMenuChanged)) {
67  LogDebug("HLTTauDQMOffline") << "dqmBeginRun(), hltMenuChanged " << hltMenuChanged;
68  if(hltMenuChanged) {
69  if(!tagAndProbe_) {
70  // Find all paths to monitor
71  std::vector<std::string> foundPaths;
72  std::smatch what;
73  LogDebug("HLTTauDQMOffline") << "Looking for paths with regex " << pathRegex_;
74  for(const std::string& pathName: HLTCP_.triggerNames()) {
75  if(std::regex_search(pathName, what, pathRegex_)) {
76  LogDebug("HLTTauDQMOffline") << "Found path " << pathName;
77  foundPaths.emplace_back(pathName);
78  }
79  }
80  std::sort(foundPaths.begin(), foundPaths.end());
81 
82  // Construct path plotters
83  std::vector<const HLTTauDQMPath *> pathObjects;
84  pathPlotters_.reserve(foundPaths.size());
85  pathObjects.reserve(foundPaths.size());
86  for(const std::string& pathName: foundPaths) {
88  if(pathPlotters_.back().isValid()) {
89  pathObjects.push_back(pathPlotters_.back().getPathObject());
90  }
91  }
92 
93  // Update paths to the summary plotter
95  pathSummaryPlotter_->setPathObjects(pathObjects);
96  }
97  }else{ // tag and probe
98  // Find all paths to monitor
99  std::vector<std::string> foundPaths;
100  std::smatch what;
101 
102  for(const edm::ParameterSet& tpset: tagAndProbePaths) {
103  std::vector<std::string> moduleLabels;
104  edm::ParameterSet denpset = tpset.getParameter<edm::ParameterSet>("denominator");
105  std::vector<std::string> denominators = denpset.getParameter<std::vector<std::string> >("hltPaths");
106  std::vector<std::string> updatedDenominators;
107  for(size_t i = 0; i < denominators.size(); ++i){
108  const std::regex denRegex_(denominators[i]);
109  for(const std::string& pathName: HLTCP_.triggerNames()) {
110  if(std::regex_search(pathName, what, denRegex_)) {
111  updatedDenominators.push_back(pathName);
112  moduleLabels = HLTCP_.moduleLabels(pathName);
113  }
114  }
115  }
116  denpset.addParameter<std::vector<std::string> >("hltPaths",updatedDenominators);
117 
118 
119 
120  edm::ParameterSet numpset = tpset.getParameter<edm::ParameterSet>("numerator");
121  std::vector<std::string> numerators = numpset.getParameter<std::vector<std::string> >("hltPaths");
122 
123  const std::regex numRegex_(numerators[0]);
124  for(const std::string& pathName: HLTCP_.triggerNames()) {
125  if(std::regex_search(pathName, what, numRegex_)) {
126 
127  edm::ParameterSet new_tpset = tpset;
128  new_tpset.addParameter<std::string>("name",pathName);
129  std::vector<std::string> updatedHltPaths;
130  updatedHltPaths.push_back(pathName);
131  numpset.addParameter<std::vector<std::string> >("hltPaths",updatedHltPaths);
132  new_tpset.addParameter<edm::ParameterSet>("numerator",numpset);
133  new_tpset.addParameter<edm::ParameterSet>("denominator",denpset);
134 
135  tagandprobePlotters_.emplace_back( new HLTTauDQMTagAndProbePlotter(new_tpset,moduleLabels,dqmBaseFolder_));
136  }
137  }
138  }
139  }
140  }
141  } else {
142  edm::LogWarning("HLTTauDQMOffline") << "HLT config extraction failure with process name '" << hltProcessName_ << "'";
143  }
144 }
#define LogDebug(id)
T getParameter(std::string const &) const
const std::string dqmBaseFolder_
const std::vector< std::string > & triggerNames() const
names of trigger paths
std::vector< edm::ParameterSet > tagAndProbePaths
std::vector< HLTTauDQMPathPlotter > pathPlotters_
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:143
std::vector< std::unique_ptr< HLTTauDQMTagAndProbePlotter > > tagandprobePlotters_
std::unique_ptr< HLTTauDQMPathSummaryPlotter > pathSummaryPlotter_
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor

Member Data Documentation

int HLTTauDQMOfflineSource::counterEvt_
private

Definition at line 65 of file HLTTauDQMOfflineSource.h.

Referenced by analyze().

bool HLTTauDQMOfflineSource::doRefAnalysis_
private

Definition at line 55 of file HLTTauDQMOfflineSource.h.

Referenced by analyze(), dqmBeginRun(), and HLTTauDQMOfflineSource().

const std::string HLTTauDQMOfflineSource::dqmBaseFolder_
private

Definition at line 50 of file HLTTauDQMOfflineSource.h.

Referenced by dqmBeginRun(), and HLTTauDQMOfflineSource().

const double HLTTauDQMOfflineSource::highPtMax_
private

Definition at line 49 of file HLTTauDQMOfflineSource.h.

Referenced by dqmBeginRun(), and HLTTauDQMOfflineSource().

HLTConfigProvider HLTTauDQMOfflineSource::HLTCP_
private

Definition at line 52 of file HLTTauDQMOfflineSource.h.

Referenced by dqmBeginRun().

const double HLTTauDQMOfflineSource::hltMatchDr_
private

Definition at line 49 of file HLTTauDQMOfflineSource.h.

Referenced by dqmBeginRun(), and HLTTauDQMOfflineSource().

std::string HLTTauDQMOfflineSource::hltProcessName_
private

Definition at line 40 of file HLTTauDQMOfflineSource.h.

Referenced by dqmBeginRun().

const double HLTTauDQMOfflineSource::l1MatchDr_
private

Definition at line 49 of file HLTTauDQMOfflineSource.h.

Referenced by dqmBeginRun(), and HLTTauDQMOfflineSource().

std::unique_ptr<HLTTauDQML1Plotter> HLTTauDQMOfflineSource::l1Plotter_
private

Definition at line 69 of file HLTTauDQMOfflineSource.h.

Referenced by analyze(), bookHistograms(), and HLTTauDQMOfflineSource().

const int HLTTauDQMOfflineSource::nEtaBins_
private

Definition at line 48 of file HLTTauDQMOfflineSource.h.

Referenced by dqmBeginRun().

const int HLTTauDQMOfflineSource::nPhiBins_
private

Definition at line 48 of file HLTTauDQMOfflineSource.h.

Referenced by dqmBeginRun(), and HLTTauDQMOfflineSource().

const int HLTTauDQMOfflineSource::nPtBins_
private

Definition at line 48 of file HLTTauDQMOfflineSource.h.

Referenced by dqmBeginRun().

std::vector<HLTTauDQMPathPlotter> HLTTauDQMOfflineSource::pathPlotters_
private

Definition at line 70 of file HLTTauDQMOfflineSource.h.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

const std::regex HLTTauDQMOfflineSource::pathRegex_
private

Definition at line 47 of file HLTTauDQMOfflineSource.h.

Referenced by dqmBeginRun().

std::unique_ptr<HLTTauDQMPathSummaryPlotter> HLTTauDQMOfflineSource::pathSummaryPlotter_
private
const int HLTTauDQMOfflineSource::prescaleEvt_
private

Definition at line 66 of file HLTTauDQMOfflineSource.h.

Referenced by analyze().

const double HLTTauDQMOfflineSource::ptMax_
private

Definition at line 49 of file HLTTauDQMOfflineSource.h.

Referenced by dqmBeginRun(), and HLTTauDQMOfflineSource().

std::vector<RefObject> HLTTauDQMOfflineSource::refObjects_
private

Definition at line 60 of file HLTTauDQMOfflineSource.h.

Referenced by analyze(), and HLTTauDQMOfflineSource().

bool HLTTauDQMOfflineSource::tagAndProbe_
private

Definition at line 61 of file HLTTauDQMOfflineSource.h.

Referenced by dqmBeginRun(), and HLTTauDQMOfflineSource().

std::vector<edm::ParameterSet> HLTTauDQMOfflineSource::tagAndProbePaths
private

Definition at line 62 of file HLTTauDQMOfflineSource.h.

Referenced by dqmBeginRun(), and HLTTauDQMOfflineSource().

std::vector<std::unique_ptr<HLTTauDQMTagAndProbePlotter> > HLTTauDQMOfflineSource::tagandprobePlotters_
private

Definition at line 72 of file HLTTauDQMOfflineSource.h.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

edm::InputTag HLTTauDQMOfflineSource::triggerEventSrc_
private

Definition at line 43 of file HLTTauDQMOfflineSource.h.

Referenced by analyze().

edm::EDGetTokenT<trigger::TriggerEvent> HLTTauDQMOfflineSource::triggerEventToken_
private

Definition at line 44 of file HLTTauDQMOfflineSource.h.

Referenced by analyze().

edm::InputTag HLTTauDQMOfflineSource::triggerResultsSrc_
private

Definition at line 41 of file HLTTauDQMOfflineSource.h.

Referenced by analyze().

edm::EDGetTokenT<edm::TriggerResults> HLTTauDQMOfflineSource::triggerResultsToken_
private

Definition at line 42 of file HLTTauDQMOfflineSource.h.

Referenced by analyze().