CMS 3D CMS Logo

CSCDQM_HistoDef.h
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: HistoDef.h
5  *
6  * Description: Histo Type Classes that are being used by EventProcessor
7  * to request histograms.
8  *
9  * Version: 1.0
10  * Created: 10/03/2008 11:54:31 AM
11  * Revision: none
12  * Compiler: gcc
13  *
14  * Author: Valdas Rapsevicius (VR), Valdas.Rapsevicius@cern.ch
15  * Company: CERN, CH
16  *
17  * =====================================================================================
18  */
19 
20 #ifndef CSCDQM_HistoDef_H
21 #define CSCDQM_HistoDef_H
22 
23 #include <string>
24 #include <iostream>
25 
26 #include "CSCDQM_Utility.h"
27 #include "CSCDQM_Logger.h"
28 
29 namespace cscdqm {
30 
33 
35  typedef unsigned int HistoId;
36 
38  typedef unsigned int HwId;
39 
40  namespace h {
42  const HistoName HISTO_SKIP = "0";
43  } // namespace h
44 
46  static const char PATH_FED[] = "FED_%03d";
47 
49  static const char PATH_DDU[] = "DDU_%02d";
50 
52  static const char PATH_CSC[] = "CSC_%03d_%02d";
53 
54  static const TPRegexp REGEXP_ONDEMAND("^.*%d.*$");
55 
56 #include "CSCDQM_HistoNames.icc"
57 
62  class HistoDef {
63  private:
66 
67  public:
73  HistoDef(const HistoId p_id) : id(p_id) {}
74 
78  virtual ~HistoDef() {}
79 
84  const HistoId getId() const { return id; }
85 
90  const HistoName& getHistoName() const { return h::names[id]; }
91 
98  virtual const std::string getName() const { return getHistoName(); }
99 
105  const std::string getFullPath() const {
107  if (!path.empty())
108  path.append("/");
109  path.append(getName());
110  return path;
111  }
112 
118  const bool operator==(const HistoDef& t) const {
119  if (getId() != t.getId())
120  return false;
121  if (getFEDId() != t.getFEDId())
122  return false;
123  if (getDDUId() != t.getDDUId())
124  return false;
125  if (getCrateId() != t.getCrateId())
126  return false;
127  if (getDMBId() != t.getDMBId())
128  return false;
129  if (getAddId() != t.getAddId())
130  return false;
131  return true;
132  }
133 
139  const HistoDef& operator=(const HistoDef& t) {
140  id = t.getId();
141  return *this;
142  }
143 
149  const bool operator<(const HistoDef& t) const {
150  if (getId() < t.getId())
151  return true;
152  if (getFEDId() < t.getFEDId())
153  return true;
154  if (getDDUId() < t.getDDUId())
155  return true;
156  if (getCrateId() < t.getCrateId())
157  return true;
158  if (getDMBId() < t.getDMBId())
159  return true;
160  if (getAddId() < t.getAddId())
161  return true;
162  return false;
163  }
164 
171  friend std::ostream& operator<<(std::ostream& out, const HistoDef& t) { return out << t.getFullPath(); }
172 
177  virtual const std::string getPath() const { return ""; }
178 
183  virtual const HwId getCrateId() const { return 0; }
184 
189  virtual const HwId getDMBId() const { return 0; }
190 
196  virtual const HwId getAddId() const { return 0; }
197 
202  virtual const HwId getFEDId() const { return 0; }
203 
208  virtual const HwId getDDUId() const { return 0; }
209 
215  virtual const std::string processTitle(const std::string& p_title) const { return p_title; }
216 
223  static const bool getHistoIdByName(const std::string& p_name, HistoId& p_id) {
224  for (HistoId i = 0; i < h::namesSize; i++) {
225  if (p_name == h::names[i]) {
226  p_id = i;
227  return true;
228  }
229  }
230  return false;
231  }
232 
238  static const std::string getHistoKeyById(const HistoId& p_id) { return h::keys[p_id]; }
239 
246  static const std::string processName(const HistoName& p_name, const HwId p_id) {
247  if (Utility::regexMatch(REGEXP_ONDEMAND, p_name)) {
248  return Form(p_name.c_str(), p_id);
249  }
250  return p_name;
251  }
252  };
253 
258  class EMUHistoDef : public HistoDef {
259  public:
265  EMUHistoDef(const HistoId p_id) : HistoDef(p_id) {}
266  };
267 
272  class FEDHistoDef : public HistoDef {
273  private:
275 
276  public:
283  FEDHistoDef(const HistoId p_id, const HwId p_fedId) : HistoDef(p_id), fedId(p_fedId) {}
284  const HwId getFEDId() const override { return fedId; }
285  const std::string getPath() const override { return getPath(fedId); }
286 
292  static const std::string getPath(const HwId p_fedId) { return Form(PATH_FED, p_fedId); }
293 
301  HistoDef* h1 = const_cast<FEDHistoDef*>(this);
302  const HistoDef* h2 = &t;
303  *h1 = *h2;
304  fedId = t.getFEDId();
305  return *this;
306  }
307 
308  const std::string processTitle(const std::string& p_title) const override {
309  return processName(p_title, getFEDId());
310  }
311  };
312 
317  class DDUHistoDef : public HistoDef {
318  private:
320 
321  public:
328  DDUHistoDef(const HistoId p_id, const HwId p_dduId) : HistoDef(p_id), dduId(p_dduId) {}
329  const HwId getDDUId() const override { return dduId; }
330  const std::string getPath() const override { return getPath(dduId); }
331 
337  static const std::string getPath(const HwId p_dduId) { return Form(PATH_DDU, p_dduId); }
338 
346  HistoDef* h1 = const_cast<DDUHistoDef*>(this);
347  const HistoDef* h2 = &t;
348  *h1 = *h2;
349  dduId = t.getDDUId();
350  return *this;
351  }
352 
353  const std::string processTitle(const std::string& p_title) const override {
354  return processName(p_title, getDDUId());
355  }
356  };
357 
362  class CSCHistoDef : public HistoDef {
363  private:
370 
371  public:
381  CSCHistoDef(const HistoId p_id, const HwId p_crateId, const HwId p_dmbId, const HwId p_addId = 0)
382  : HistoDef(p_id), crateId(p_crateId), dmbId(p_dmbId), addId(p_addId) {}
383 
384  const HwId getCrateId() const override { return crateId; }
385  const HwId getDMBId() const override { return dmbId; }
386  const HwId getAddId() const override { return addId; }
387  const std::string getName() const override { return processName(getHistoName(), getAddId()); }
388  const std::string getPath() const override { return getPath(crateId, dmbId); }
389 
396  static const std::string getPath(const HwId p_crateId, const HwId p_dmbId) {
397  return Form(PATH_CSC, p_crateId, p_dmbId);
398  }
399 
407  HistoDef* h1 = const_cast<CSCHistoDef*>(this);
408  const HistoDef* h2 = &t;
409  *h1 = *h2;
410  crateId = t.getCrateId();
411  dmbId = t.getDMBId();
412  addId = t.getAddId();
413  return *this;
414  }
415 
416  const std::string processTitle(const std::string& p_title) const override {
417  return processName(p_title, getAddId());
418  }
419  };
420 
425  class ParHistoDef : public HistoDef {
426  private:
431 
432  public:
438  ParHistoDef(const HistoName& p_name) : HistoDef(Utility::fastHash(p_name.c_str())), name(p_name) {}
439 
446 
447  const HistoName& getHistoName() const { return name; }
448  };
449 
450  static const std::type_info& EMUHistoDefT = typeid(cscdqm::EMUHistoDef);
451  static const std::type_info& FEDHistoDefT = typeid(cscdqm::FEDHistoDef);
452  static const std::type_info& DDUHistoDefT = typeid(cscdqm::DDUHistoDef);
453  static const std::type_info& CSCHistoDefT = typeid(cscdqm::CSCHistoDef);
454  static const std::type_info& ParHistoDefT = typeid(cscdqm::ParHistoDef);
455 
456 } // namespace cscdqm
457 
458 #endif
cscdqm::HistoDef::getFullPath
const std::string getFullPath() const
Get full path of the histogram. It is being constructed by appending path and histogam name.
Definition: CSCDQM_HistoDef.h:105
CSCDQM_Logger.h
cscdqm::ParHistoDef::name
HistoName name
Parameter name.
Definition: CSCDQM_HistoDef.h:430
cscdqm::HistoDef::operator<<
friend std::ostream & operator<<(std::ostream &out, const HistoDef &t)
Printing (<<) operator that prints hisotgram full path.
Definition: CSCDQM_HistoDef.h:171
cscdqm::EMUHistoDef::EMUHistoDef
EMUHistoDef(const HistoId p_id)
Constructor. It calls Base constructor inline.
Definition: CSCDQM_HistoDef.h:265
cscdqm::HistoDef::HistoDef
HistoDef(const HistoId p_id)
Base constructor.
Definition: CSCDQM_HistoDef.h:73
mps_fire.i
i
Definition: mps_fire.py:428
cscdqm::HistoDef
Abstract Base Histogram Definition.
Definition: CSCDQM_HistoDef.h:62
cscdqm::HistoDef::processName
static const std::string processName(const HistoName &p_name, const HwId p_id)
Process name by applying ID to d pattern (pattern is stored in REGEXP_ONDEMAND)
Definition: CSCDQM_HistoDef.h:246
cscdqm::DDUHistoDef::operator=
const DDUHistoDef & operator=(const DDUHistoDef &t)
Assignment (=) operator. Calls base assignment operator and assigns DDU-related data.
Definition: CSCDQM_HistoDef.h:345
cscdqm::PATH_FED
static const char PATH_FED[]
Definition: CSCDQM_HistoDef.h:46
cscdqm::HistoId
unsigned int HistoId
Definition: CSCDQM_HistoDef.h:35
cscdqm::CSCHistoDef::getCrateId
const HwId getCrateId() const override
Get CSC Crate ID.
Definition: CSCDQM_HistoDef.h:384
cscdqm::CSCHistoDef::getName
const std::string getName() const override
Get processed histogram name. It can include additional parameter in formated name....
Definition: CSCDQM_HistoDef.h:387
cscdqm::HistoDef::operator<
const bool operator<(const HistoDef &t) const
Less (<) operator.
Definition: CSCDQM_HistoDef.h:149
cscdqm::CSCHistoDef::operator=
const CSCHistoDef & operator=(const CSCHistoDef &t)
Assignment (=) operator. Calls base assignment operator and assigns CSC-related data.
Definition: CSCDQM_HistoDef.h:406
CSCDQM_Utility.h
cscdqm::Utility::regexMatch
static bool regexMatch(const std::string &expression, const std::string &message)
Match RegExp expression string against string message and return result.
Definition: CSCDQM_Utility.cc:166
cscdqm::FEDHistoDef::operator=
const FEDHistoDef & operator=(const FEDHistoDef &t)
Assignment (=) operator. Calls base assignment operator and assigns FEd-related data.
Definition: CSCDQM_HistoDef.h:300
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
cscdqm::CSCHistoDef
CSC Level Histogram Type.
Definition: CSCDQM_HistoDef.h:362
cscdqm::FEDHistoDef::fedId
HwId fedId
Definition: CSCDQM_HistoDef.h:274
cscdqm::CSCHistoDefT
static const std::type_info & CSCHistoDefT
Definition: CSCDQM_HistoDef.h:453
cscdqm::CSCHistoDef::getAddId
const HwId getAddId() const override
Get CSC Additional ID (used to store Layer, CLCT, ALCT and other identifiers.
Definition: CSCDQM_HistoDef.h:386
cscdqm::CSCHistoDef::getPath
const std::string getPath() const override
Get path part of the histogram (used only for DDUs and CSCs)
Definition: CSCDQM_HistoDef.h:388
cscdqm::ParHistoDef
Parameter Histogram Definition.
Definition: CSCDQM_HistoDef.h:425
cscdqm::PATH_DDU
static const char PATH_DDU[]
Definition: CSCDQM_HistoDef.h:49
cscdqm::HistoDef::getAddId
virtual const HwId getAddId() const
Get CSC Additional ID (used to store Layer, CLCT, ALCT and other identifiers.
Definition: CSCDQM_HistoDef.h:196
cscdqm::DDUHistoDef::getPath
const std::string getPath() const override
Get path part of the histogram (used only for DDUs and CSCs)
Definition: CSCDQM_HistoDef.h:330
cscdqm::h::HISTO_SKIP
const HistoName HISTO_SKIP
Definition: CSCDQM_HistoDef.h:42
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
cscdqm::HistoDef::operator==
const bool operator==(const HistoDef &t) const
Comparison (==) operator.
Definition: CSCDQM_HistoDef.h:118
cscdqm::HwId
unsigned int HwId
Definition: CSCDQM_HistoDef.h:38
cscdqm::CSCHistoDef::crateId
HwId crateId
Definition: CSCDQM_HistoDef.h:365
cscdqm::FEDHistoDef::getPath
static const std::string getPath(const HwId p_fedId)
Static FED path formatter.
Definition: CSCDQM_HistoDef.h:292
cscdqm::DDUHistoDefT
static const std::type_info & DDUHistoDefT
Definition: CSCDQM_HistoDef.h:452
cscdqm::DDUHistoDef::processTitle
const std::string processTitle(const std::string &p_title) const override
Process Title by Adding appropriate ID.
Definition: CSCDQM_HistoDef.h:353
h
cscdqm::HistoDef::getCrateId
virtual const HwId getCrateId() const
Get CSC Crate ID.
Definition: CSCDQM_HistoDef.h:183
cscdqm::CSCHistoDef::getPath
static const std::string getPath(const HwId p_crateId, const HwId p_dmbId)
Static CSC path formatter.
Definition: CSCDQM_HistoDef.h:396
cscdqm::EMUHistoDef
EMU Level Histogram Definition.
Definition: CSCDQM_HistoDef.h:258
cscdqm::DDUHistoDef::dduId
HwId dduId
Definition: CSCDQM_HistoDef.h:319
cscdqm::HistoDef::getDDUId
virtual const HwId getDDUId() const
Get DDU ID.
Definition: CSCDQM_HistoDef.h:208
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cscdqm::HistoDef::operator=
const HistoDef & operator=(const HistoDef &t)
Assignment (=) operator.
Definition: CSCDQM_HistoDef.h:139
cscdqm::HistoDef::processTitle
virtual const std::string processTitle(const std::string &p_title) const
Process Title by Adding appropriate ID.
Definition: CSCDQM_HistoDef.h:215
cscdqm::HistoDef::getHistoKeyById
static const std::string getHistoKeyById(const HistoId &p_id)
Get Histogram key name by id.
Definition: CSCDQM_HistoDef.h:238
cscdqm::Utility
General and CSCDQM Framework related utility routines.
Definition: CSCDQM_Utility.h:67
cscdqm::REGEXP_ONDEMAND
static const TPRegexp REGEXP_ONDEMAND("^.*%d.*$")
cscdqm::DDUHistoDef::getDDUId
const HwId getDDUId() const override
Get DDU ID.
Definition: CSCDQM_HistoDef.h:329
cscdqm
Definition: CSCDQM_DCSBase.h:29
cscdqm::ParHistoDef::ParHistoDef
ParHistoDef(const HistoName &p_name)
Constructor. It calls Base constructor inline.
Definition: CSCDQM_HistoDef.h:438
cscdqm::DDUHistoDef::DDUHistoDef
DDUHistoDef(const HistoId p_id, const HwId p_dduId)
Constructor. It calls Base constructor inline.
Definition: CSCDQM_HistoDef.h:328
cscdqm::ParHistoDef::getHistoName
const HistoName & getHistoName() const
Definition: CSCDQM_HistoDef.h:447
cscdqm::CSCHistoDef::processTitle
const std::string processTitle(const std::string &p_title) const override
Process Title by Adding appropriate ID.
Definition: CSCDQM_HistoDef.h:416
cscdqm::DDUHistoDef
DDU Level Histogram Definition.
Definition: CSCDQM_HistoDef.h:317
cscdqm::FEDHistoDef::processTitle
const std::string processTitle(const std::string &p_title) const override
Process Title by Adding appropriate ID.
Definition: CSCDQM_HistoDef.h:308
cscdqm::HistoDef::getId
const HistoId getId() const
Get Histogram ID.
Definition: CSCDQM_HistoDef.h:84
cscdqm::HistoName
std::string HistoName
Definition: CSCDQM_HistoDef.h:32
cscdqm::HistoDef::getName
virtual const std::string getName() const
Get processed histogram name. It can include additional parameter in formated name....
Definition: CSCDQM_HistoDef.h:98
cscdqm::PATH_CSC
static const char PATH_CSC[]
Definition: CSCDQM_HistoDef.h:52
cscdqm::HistoDef::~HistoDef
virtual ~HistoDef()
Base virtual destructor.
Definition: CSCDQM_HistoDef.h:78
cscdqm::ParHistoDefT
static const std::type_info & ParHistoDefT
Definition: CSCDQM_HistoDef.h:454
cscdqm::FEDHistoDef::FEDHistoDef
FEDHistoDef(const HistoId p_id, const HwId p_fedId)
Constructor. It calls Base constructor inline.
Definition: CSCDQM_HistoDef.h:283
cscdqm::FEDHistoDefT
static const std::type_info & FEDHistoDefT
Definition: CSCDQM_HistoDef.h:451
cscdqm::CSCHistoDef::addId
HwId addId
Definition: CSCDQM_HistoDef.h:369
cscdqm::HistoDef::getHistoName
const HistoName & getHistoName() const
Get raw histogram name.
Definition: CSCDQM_HistoDef.h:90
cscdqm::CSCHistoDef::dmbId
HwId dmbId
Definition: CSCDQM_HistoDef.h:367
cscdqm::HistoDef::getPath
virtual const std::string getPath() const
Get path part of the histogram (used only for DDUs and CSCs)
Definition: CSCDQM_HistoDef.h:177
cscdqm::HistoDef::getHistoIdByName
static const bool getHistoIdByName(const std::string &p_name, HistoId &p_id)
Get Histogram ID by name.
Definition: CSCDQM_HistoDef.h:223
cscdqm::FEDHistoDef
FED Level Histogram Definition.
Definition: CSCDQM_HistoDef.h:272
cscdqm::CSCHistoDef::getDMBId
const HwId getDMBId() const override
Get CSC DMB ID.
Definition: CSCDQM_HistoDef.h:385
cscdqm::FEDHistoDef::getPath
const std::string getPath() const override
Get path part of the histogram (used only for DDUs and CSCs)
Definition: CSCDQM_HistoDef.h:285
cscdqm::HistoDef::getFEDId
virtual const HwId getFEDId() const
Get FED ID.
Definition: CSCDQM_HistoDef.h:202
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
cscdqm::DDUHistoDef::getPath
static const std::string getPath(const HwId p_dduId)
Static DDU path formatter.
Definition: CSCDQM_HistoDef.h:337
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
cscdqm::FEDHistoDef::getFEDId
const HwId getFEDId() const override
Get FED ID.
Definition: CSCDQM_HistoDef.h:284
cscdqm::CSCHistoDef::CSCHistoDef
CSCHistoDef(const HistoId p_id, const HwId p_crateId, const HwId p_dmbId, const HwId p_addId=0)
Constructor. It calls Base constructor inline.
Definition: CSCDQM_HistoDef.h:381
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
cscdqm::EMUHistoDefT
static const std::type_info & EMUHistoDefT
Definition: CSCDQM_HistoDef.h:450
cscdqm::ParHistoDef::ParHistoDef
ParHistoDef(const HistoId p_id)
Constructor. It calls Base constructor inline.
Definition: CSCDQM_HistoDef.h:445
cscdqm::HistoDef::id
HistoId id
Definition: CSCDQM_HistoDef.h:65
cscdqm::HistoDef::getDMBId
virtual const HwId getDMBId() const
Get CSC DMB ID.
Definition: CSCDQM_HistoDef.h:189