CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HLTrigReport.h
Go to the documentation of this file.
1 #ifndef HLTrigReport_h
2 #define HLTrigReport_h
3 
15 #include <string>
16 #include <vector>
17 
26 
27 //
28 // class declaration
29 //
30 
31 namespace hltrigreport {
32  struct Accumulate {
33  Accumulate();
34  Accumulate(size_t numHLNames,
35  std::vector<std::vector<unsigned int>> const& hlIndex,
36  std::vector<std::vector<unsigned int>> const& dsIndex);
37 
38  unsigned int nEvents_; // number of events processed
39  unsigned int nWasRun_; // # where at least one HLT was run
40  unsigned int nAccept_; // # of accepted events
41  unsigned int nErrors_; // # where at least one HLT had error
42 
43  std::vector<unsigned int> hlWasRun_; // # where HLT[i] was run
44  std::vector<unsigned int> hltL1s_; // # of events after L1 seed
45  std::vector<unsigned int> hltPre_; // # of events after HLT prescale
46  std::vector<unsigned int> hlAccept_; // # of events accepted by HLT[i]
47  std::vector<unsigned int> hlAccTot_; // # of events accepted by HLT[0] OR ... OR HLT[i]
48  std::vector<unsigned int> hlErrors_; // # of events with error in HLT[i]
49 
50  std::vector<std::vector<unsigned int>>
51  hlAccTotDS_; // hlAccTotDS_[ds][p] stores the # of accepted events by the 0-th to p-th paths in the ds-th dataset
52  std::vector<unsigned int> hlAllTotDS_; // hlAllTotDS_[ds] stores the # of accepted events in the ds-th dataset
53  std::vector<std::vector<unsigned int>>
54  dsAccTotS_; // dsAccTotS_[s][ds] stores the # of accepted events by the 0-th to ds-th dataset in the s-th stream
55  std::vector<unsigned int> dsAllTotS_; // dsAllTotS_[s] stores the # of accepted events in the s-th stream
56 
57  void accumulate(Accumulate const&);
58  void reset();
59  };
60 
61 } // namespace hltrigreport
62 
64  : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::LuminosityBlockCache<hltrigreport::Accumulate>> {
65 private:
66  enum ReportEvery { NEVER = 0, EVERY_EVENT = 1, EVERY_LUMI = 2, EVERY_RUN = 3, EVERY_JOB = 4 };
67 
68 public:
70 
71  explicit HLTrigReport(const edm::ParameterSet&);
72  ~HLTrigReport() override;
73  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
74 
75  static ReportEvery decode(const std::string& value);
76 
77  void beginJob() override;
78  void endJob() override;
79 
80  void beginRun(edm::Run const&, edm::EventSetup const&) override;
81  void endRun(edm::Run const&, edm::EventSetup const&) override;
82 
83  std::shared_ptr<Accumulate> globalBeginLuminosityBlock(edm::LuminosityBlock const&,
84  edm::EventSetup const&) const override;
86 
87  void analyze(const edm::Event&, const edm::EventSetup&) override;
88 
89  // names and event counts
90  const std::vector<std::string>& streamNames() const;
91  const std::vector<std::string>& datasetNames() const;
92 
93 private:
94  void reset(); // reset all counters
95 
97  if (useLumiCache()) {
98  return *luminosityBlockCache(index);
99  }
100  return accumulate_;
101  }
103  bool readAfterLumi() const {
105  }
106 
107  void updateConfigCache();
108 
109  void dumpReport(hltrigreport::Accumulate const& accumulate, std::string const& header = std::string()) const;
110  void updateService(Accumulate const& accumulate) const;
111 
112  const edm::InputTag hlTriggerResults_; // Input tag for TriggerResults
114  bool configured_; // is HLTConfigProvider configured ?
115 
116  std::vector<std::string> hlNames_; // name of each HLT algorithm
117 
118  std::vector<std::vector<unsigned int>>
119  hlIndex_; // hlIndex_[ds][p] stores the hlNames_ index of the p-th path of the ds-th dataset
120 
121  std::vector<int> posL1s_; // pos # of last L1 seed
122  std::vector<int> posPre_; // pos # of last HLT prescale
123 
124  std::vector<std::string> datasetNames_; // list of dataset names
125  std::vector<std::vector<std::string>> datasetContents_; // list of path names for each dataset
126  bool isCustomDatasets_; // true if the user overwrote the dataset definitions of the provenance with the CustomDatasets parameter
127  std::vector<std::vector<unsigned int>>
128  dsIndex_; // dsIndex_[s][ds] stores the datasetNames_ index of the ds-th dataset of the s-th stream
129  std::vector<std::string> streamNames_; // list of stream names
130  std::vector<std::vector<std::string>> streamContents_; // list of dataset names for each stream
131  bool isCustomStreams_; // true if the user overwrote the stream definitions of the provenance with the CustomSterams parameter
132  std::string refPath_; // name of the reference path for rate calculation
133  unsigned int refIndex_; // index of the reference path for rate calculation
134  const double refRate_; // rate of the reference path, the rate of all other paths will be normalized to this
135 
136  const ReportEvery reportBy_; // dump report for every never/event/lumi/run/job
137  const ReportEvery resetBy_; // reset counters every never/event/lumi/run/job
138  const ReportEvery serviceBy_; // call to service every never/event/lumi/run/job
139  HLTConfigProvider hltConfig_; // to get configuration for L1s/Pre
140 
142 };
143 
144 #endif //HLTrigReport_h
std::vector< std::vector< std::string > > datasetContents_
Definition: HLTrigReport.h:125
bool isCustomStreams_
Definition: HLTrigReport.h:131
std::vector< unsigned int > hlAllTotDS_
Definition: HLTrigReport.h:52
bool isCustomDatasets_
Definition: HLTrigReport.h:126
hltrigreport::Accumulate & chooseAccumulate(edm::LuminosityBlockIndex index)
Definition: HLTrigReport.h:96
std::vector< std::string > hlNames_
Definition: HLTrigReport.h:116
const ReportEvery resetBy_
Definition: HLTrigReport.h:137
const ReportEvery reportBy_
Definition: HLTrigReport.h:136
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::vector< unsigned int > hlAccTot_
Definition: HLTrigReport.h:47
void dumpReport(hltrigreport::Accumulate const &accumulate, std::string const &header=std::string()) const
std::vector< std::vector< unsigned int > > hlAccTotDS_
Definition: HLTrigReport.h:51
const std::vector< std::string > & datasetNames() const
std::vector< std::string > datasetNames_
Definition: HLTrigReport.h:124
static ReportEvery decode(const std::string &value)
Definition: HLTrigReport.cc:24
void beginRun(edm::Run const &, edm::EventSetup const &) override
void updateConfigCache()
std::vector< int > posL1s_
Definition: HLTrigReport.h:121
std::vector< int > posPre_
Definition: HLTrigReport.h:122
void endRun(edm::Run const &, edm::EventSetup const &) override
std::vector< std::string > streamNames_
Definition: HLTrigReport.h:129
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void updateService(Accumulate const &accumulate) const
unsigned int refIndex_
Definition: HLTrigReport.h:133
const edm::EDGetTokenT< edm::TriggerResults > hlTriggerResultsToken_
Definition: HLTrigReport.h:113
std::string refPath_
Definition: HLTrigReport.h:132
hltrigreport::Accumulate accumulate_
Definition: HLTrigReport.h:141
HLTConfigProvider hltConfig_
Definition: HLTrigReport.h:139
std::vector< std::vector< std::string > > streamContents_
Definition: HLTrigReport.h:130
std::shared_ptr< Accumulate > globalBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const override
bool readAfterLumi() const
Definition: HLTrigReport.h:103
void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
std::vector< std::vector< unsigned int > > dsAccTotS_
Definition: HLTrigReport.h:54
const double refRate_
Definition: HLTrigReport.h:134
~HLTrigReport() override
void beginJob() override
HLTrigReport(const edm::ParameterSet &)
std::vector< std::vector< unsigned int > > hlIndex_
Definition: HLTrigReport.h:119
void accumulate(Accumulate const &)
Definition: HLTrigReport.cc:87
std::vector< unsigned int > dsAllTotS_
Definition: HLTrigReport.h:55
std::vector< unsigned int > hlWasRun_
Definition: HLTrigReport.h:43
void endJob() override
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< unsigned int > hlAccept_
Definition: HLTrigReport.h:46
const edm::InputTag hlTriggerResults_
Definition: HLTrigReport.h:112
const std::vector< std::string > & streamNames() const
const ReportEvery serviceBy_
Definition: HLTrigReport.h:138
hltrigreport::Accumulate Accumulate
Definition: HLTrigReport.h:69
std::vector< std::vector< unsigned int > > dsIndex_
Definition: HLTrigReport.h:128
std::vector< unsigned int > hltPre_
Definition: HLTrigReport.h:45
Definition: Run.h:45
bool useLumiCache() const
Definition: HLTrigReport.h:102
std::vector< unsigned int > hlErrors_
Definition: HLTrigReport.h:48
std::vector< unsigned int > hltL1s_
Definition: HLTrigReport.h:44