CMS 3D CMS Logo

HLTScalersClient.h
Go to the documentation of this file.
1 // -*-c++-*-
2 //
3 // Client class for HLT Scalers module.
4 //
5 
6 // Revision 1.13 2010/03/17 20:56:18 wittich
7 // Check for good updates based on mergeCount values
8 // add code for rates normalized per FU
9 //
10 // Revision 1.12 2010/03/16 22:19:19 wittich
11 // updates for per-LS normalization for variable
12 // number of FU's sending information back to the clients.
13 //
14 // Revision 1.11 2010/02/15 17:10:45 wittich
15 // Allow for longer length runs (2400 ls)
16 // this is only in the client
17 //
18 // Revision 1.10 2010/02/11 23:55:18 wittich
19 // - adapt to shorter Lumi Section length
20 // - fix bug in how history of counts was filled
21 //
22 // Revision 1.9 2010/02/11 00:11:09 wmtan
23 // Adapt to moved framework header
24 //
25 // Revision 1.8 2010/02/02 11:44:20 wittich
26 // more diagnostics for online scalers
27 //
28 // Revision 1.7 2009/12/15 20:41:16 wittich
29 // better hlt scalers client
30 //
31 // Revision 1.6 2009/11/22 14:17:46 puigh
32 // fix compilation warning
33 //
34 // Revision 1.5 2009/11/22 13:32:38 puigh
35 // clean beginJob
36 //
37 
38 #ifndef HLTSCALERSCLIENT_H
39 #define HLTSCALERSCLIENT_H
40 #include <deque>
41 #include <fstream>
42 #include <utility>
43 #include <vector>
44 
47 
49 
51 //#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
52 
53 #define MAX_PATHS 200
54 #define MAX_LUMI_SEG_HLT 2400
55 
57 private:
58  std::ofstream textfile_;
59 
60 public:
63  // typedef std::pair<int,double> CountLS_t;
64  // //typedef std::deque<CountLS_t> CountLSFifo_t;
65  // typedef std::map<int,double> CountLSFifo_t;
66 
67  // helper data structures - slightly modified stl objects
68  class CountLS_t : public std::pair<int, double> {
69  public:
70  CountLS_t(int ls, double cnt) : std::pair<int, double>(ls, cnt){};
71  bool operator==(int ls) const { return ls == this->first; }
72  bool operator<(CountLS_t &rhs) { return this->first < rhs.first; };
73  };
74 
75  class CountLSFifo_t : public std::deque<CountLS_t> {
76  private:
77  unsigned int targetSize_;
79 
80  public:
81  // default constructor
82  CountLSFifo_t(unsigned int sz = 3) : std::deque<CountLS_t>(), targetSize_(sz) {}
83  unsigned int targetSize() const { return targetSize_; };
84  double getCount(int ls) {
85  CountLSFifo_t::iterator p = std::find(this->begin(), this->end(), ls);
86  if (p != end())
87  return p->second;
88  else
89  return -1;
90  }
91 
92  void update(const CountLS_t &T) {
93  // do we already have data for this LS?
94  CountLSFifo_t::iterator p = std::find(this->begin(), this->end(), T.first);
95  if (p != this->end()) { // we already have data for this LS
96  p->second = T.second;
97  } else { // new data
98  this->push_back(T);
99  }
100  trim_();
101  }
102 
103  private:
104  void trim_() {
105  if (this->size() > targetSize_) {
106  std::sort(begin(), end());
107  while (size() > targetSize_) {
108  pop_front();
109  }
110  }
111  }
112  };
113 
114 public:
117 
119  ~HLTScalersClient() override {
120  if (debug_) {
121  textfile_.close();
122  }
123  };
124 
126  void beginJob(void) override;
127 
129  void beginRun(const edm::Run &run, const edm::EventSetup &c) override;
130 
132  void endRun(const edm::Run &run, const edm::EventSetup &c) override;
133 
136  void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override;
137 
138  // unused
139  void analyze(const edm::Event &e, const edm::EventSetup &c) override;
140 
141 private:
143 
144  int nev_; // Number of events processed
145  int nLumi_; // number of lumi blocks
147 
150  std::vector<MonitorElement *> rateHistories_;
151  std::vector<MonitorElement *> countHistories_;
152 
153  std::vector<MonitorElement *> hltCurrentRate_;
154  MonitorElement *hltRate_; // global rate - any accept
155  MonitorElement *hltCount_; // globalCounts
156  // MonitorElement *hltCountN_; // globalCounts normalized
159 
160  // Normalized
161  MonitorElement *hltNormRate_; // global rate - any accept
163  std::vector<MonitorElement *> rateNormHistories_;
164  std::vector<MonitorElement *> hltCurrentNormRate_;
165 
168  unsigned int kRateIntegWindow_;
170  // HLTConfigProvider hltConfig_;
171  std::deque<int> ignores_;
172  std::pair<double, double> getSlope_(const CountLSFifo_t &points);
173 
174 private:
175  bool debug_;
176  int maxFU_;
177  std::vector<CountLSFifo_t> recentPathCountsPerLS_;
179 
180  std::vector<CountLSFifo_t> recentNormedPathCountsPerLS_;
182 };
183 
184 #endif // HLTSCALERSCLIENT_H
HLTScalersClient::beginRun
void beginRun(const edm::Run &run, const edm::EventSetup &c) override
BeginRun.
Definition: HLTScalersClient.cc:116
HLTScalersClient::folderName_
std::string folderName_
Definition: HLTScalersClient.h:167
HLTScalersClient::beginJob
void beginJob(void) override
BeginJob.
Definition: HLTScalersClient.cc:106
HLT_2018_cff.points
points
Definition: HLT_2018_cff.py:20125
HLTScalersClient::processName_
std::string processName_
Definition: HLTScalersClient.h:169
HLTScalersClient::CountLSFifo_t::targetSize
unsigned int targetSize() const
Definition: HLTScalersClient.h:83
eostools.ls
def ls(path, rec=False)
Definition: eostools.py:349
HLTScalersClient::recentOverallCountsPerLS_
CountLSFifo_t recentOverallCountsPerLS_
Definition: HLTScalersClient.h:178
HLTScalersClient::CountLSFifo_t::update
void update(const CountLS_t &T)
Definition: HLTScalersClient.h:92
HLTScalersClient::currentRate_
MonitorElement * currentRate_
Definition: HLTScalersClient.h:148
HLTScalersClient::dbe_
DQMStore * dbe_
Definition: HLTScalersClient.h:142
HLTScalersClient::kRateIntegWindow_
unsigned int kRateIntegWindow_
Definition: HLTScalersClient.h:168
HLTScalersClient::countHistories_
std::vector< MonitorElement * > countHistories_
Definition: HLTScalersClient.h:151
HLTScalersClient::~HLTScalersClient
~HLTScalersClient() override
Destructor.
Definition: HLTScalersClient.h:119
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
HLTScalersClient::hltCurrentRate_
std::vector< MonitorElement * > hltCurrentRate_
Definition: HLTScalersClient.h:153
HLTScalersClient::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: HLTScalersClient.cc:518
HLTScalersClient::CountLSFifo_t::getCount
double getCount(int ls)
Definition: HLTScalersClient.h:84
edm::Run
Definition: Run.h:45
HLTScalersClient::maxFU_
int maxFU_
Definition: HLTScalersClient.h:176
HLTScalersClient::recentPathCountsPerLS_
std::vector< CountLSFifo_t > recentPathCountsPerLS_
Definition: HLTScalersClient.h:177
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HLTScalersClient::rateNormHistories_
std::vector< MonitorElement * > rateNormHistories_
Definition: HLTScalersClient.h:163
HLTScalersClient::rateHistories_
std::vector< MonitorElement * > rateHistories_
Definition: HLTScalersClient.h:150
HLTScalersClient::currentRun_
int currentRun_
Definition: HLTScalersClient.h:146
HLTScalersClient::hltCount_
MonitorElement * hltCount_
Definition: HLTScalersClient.h:155
HLTScalersClient::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: HLTScalersClient.h:62
HLTScalersClient::getSlope_
std::pair< double, double > getSlope_(const CountLSFifo_t &points)
Definition: HLTScalersClient.cc:525
DQMStore.h
HLTScalersClient::recentNormedOverallCountsPerLS_
CountLSFifo_t recentNormedOverallCountsPerLS_
Definition: HLTScalersClient.h:181
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
EDAnalyzer.h
HLTScalersClient::CountLS_t
Definition: HLTScalersClient.h:68
HLTScalersClient::CountLSFifo_t
Definition: HLTScalersClient.h:75
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
dqmdumpme.first
first
Definition: dqmdumpme.py:55
end
#define end
Definition: vmac.h:39
edm::EDAnalyzer
Definition: EDAnalyzer.h:29
HLTScalersClient::HLTScalersClient
HLTScalersClient(const edm::ParameterSet &ps)
Constructors.
Definition: HLTScalersClient.cc:61
HLTScalersClient::first_
bool first_
Definition: HLTScalersClient.h:166
HLTScalersClient::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: HLTScalersClient.h:61
HLTScalersClient::hltNormRate_
MonitorElement * hltNormRate_
Definition: HLTScalersClient.h:161
HLTScalersClient::missingPathNames_
bool missingPathNames_
Definition: HLTScalersClient.h:166
HLTScalersClient::CountLSFifo_t::targetSize_
unsigned int targetSize_
Definition: HLTScalersClient.h:77
HLTScalersClient::CountLSFifo_t::CountLSFifo_t
CountLSFifo_t(unsigned int sz=3)
Definition: HLTScalersClient.h:82
dqm::legacy::DQMStore
Definition: DQMStore.h:727
HLTScalersClient::nev_
int nev_
Definition: HLTScalersClient.h:144
HLTScalersClient::textfile_
std::ofstream textfile_
Definition: HLTScalersClient.h:58
HLTScalersClient::CountLS_t::operator<
bool operator<(CountLS_t &rhs)
Definition: HLTScalersClient.h:72
HLTScalersClient
Definition: HLTScalersClient.h:56
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLTScalersClient::updates_
MonitorElement * updates_
Definition: HLTScalersClient.h:157
edm::ParameterSet
Definition: ParameterSet.h:36
HLTScalersClient::CountLS_t::operator==
bool operator==(int ls) const
Definition: HLTScalersClient.h:71
HLTScalersClient::endLuminosityBlock
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
Definition: HLTScalersClient.cc:131
createfilelist.int
int
Definition: createfilelist.py:10
HLTScalersClient::currentNormRate_
MonitorElement * currentNormRate_
Definition: HLTScalersClient.h:162
edm::EventSetup
Definition: EventSetup.h:57
HLTScalersClient::recentNormedPathCountsPerLS_
std::vector< CountLSFifo_t > recentNormedPathCountsPerLS_
Definition: HLTScalersClient.h:180
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
HLTScalersClient::CountLSFifo_t::trim_
void trim_()
Definition: HLTScalersClient.h:104
InputTag.h
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
HLTScalersClient::nLumi_
int nLumi_
Definition: HLTScalersClient.h:145
Frameworkfwd.h
T
long double T
Definition: Basic3DVectorLD.h:48
HLTScalersClient::CountLSFifo_t::accumulate_
bool accumulate_
Definition: HLTScalersClient.h:78
HLTScalersClient::hltCurrentNormRate_
std::vector< MonitorElement * > hltCurrentNormRate_
Definition: HLTScalersClient.h:164
HLTScalersClient::currentLumiBlockNumber_
int currentLumiBlockNumber_
Definition: HLTScalersClient.h:149
edm::Event
Definition: Event.h:73
HLTScalersClient::hltRate_
MonitorElement * hltRate_
Definition: HLTScalersClient.h:154
HLTScalersClient::ignores_
std::deque< int > ignores_
Definition: HLTScalersClient.h:171
begin
#define begin
Definition: vmac.h:32
HLTScalersClient::CountLS_t::CountLS_t
CountLS_t(int ls, double cnt)
Definition: HLTScalersClient.h:70
HLTScalersClient::mergeCount_
MonitorElement * mergeCount_
Definition: HLTScalersClient.h:158
HLTScalersClient::endRun
void endRun(const edm::Run &run, const edm::EventSetup &c) override
EndRun.
Definition: HLTScalersClient.cc:124
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
HLTScalersClient::debug_
bool debug_
Definition: HLTScalersClient.h:175
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37