CMS 3D CMS Logo

Quantity.h
Go to the documentation of this file.
1 #ifndef Quantity_h
2 #define Quantity_h
3 
12 
13 namespace hcaldqm {
14  namespace quantity {
15  enum QuantityType {
21  fNone = 5,
23  };
24 
25  enum AxisType { fXAxis = 0, fYAxis = 1, fZAxis = 2, nAxisType = 3 };
26 
27  class Quantity {
28  public:
29  Quantity() : _name("Quantity"), _isLog(false), _showOverflow(false) {}
30  Quantity(std::string const &name, bool isLog) : _name(name), _isLog(isLog), _showOverflow(false) {}
31  virtual ~Quantity() {}
32 
33  virtual QuantityType type() { return fNone; }
34  virtual std::string name() { return _name; }
35  virtual bool isLog() { return _isLog; }
36  virtual void setAxisType(AxisType at) { _axistype = at; }
37  virtual Quantity *makeCopy() { return new Quantity(_name, _isLog); }
38 
39  virtual uint32_t getBin(HcalDetId const &) { return 1; }
40  virtual uint32_t getBin(HcalElectronicsId const &) { return 1; }
41  virtual uint32_t getBin(HcalTrigTowerDetId const &) { return 1; }
42  virtual uint32_t getBin(int) { return 1; }
43  virtual uint32_t getBin(double) { return 1; }
44 
45  virtual int getValue(HcalDetId const &) { return 0; }
46  virtual int getValue(HcalElectronicsId const &) { return 0; }
47  virtual int getValue(HcalTrigTowerDetId const &) { return 0; }
48  virtual int getValue(int x) { return x; }
49  virtual double getValue(double x) { return x; }
50 
51  virtual void setBits(TH1 *o) { setLog(o); }
52  virtual void setLog(TH1 *o) {
53  if (_isLog)
54  o->SetBit(BIT(constants::BIT_OFFSET + _axistype));
55  }
56 
57  virtual int nbins() { return 1; }
58  virtual int wofnbins() { return nbins() + 2; }
59  virtual double min() { return 0; }
60  virtual double max() { return 1; }
61  virtual bool isCoordinate() { return false; }
62  virtual std::vector<std::string> getLabels() { return std::vector<std::string>(); }
63 
64  virtual void setMax(double) {}
65  virtual void setMin(double) {}
66  virtual void setNbins(int) {}
67 
69 
70  protected:
72  bool _isLog;
75  };
76  } // namespace quantity
77 } // namespace hcaldqm
78 
79 #endif
virtual uint32_t getBin(int)
Definition: Quantity.h:42
virtual void setBits(TH1 *o)
Definition: Quantity.h:51
virtual std::string name()
Definition: Quantity.h:34
virtual void setAxisType(AxisType at)
Definition: Quantity.h:36
virtual void setMin(double)
Definition: Quantity.h:65
virtual double getValue(double x)
Definition: Quantity.h:49
virtual int wofnbins()
Definition: Quantity.h:58
virtual std::vector< std::string > getLabels()
Definition: Quantity.h:62
virtual double max()
Definition: Quantity.h:60
virtual void setMax(double)
Definition: Quantity.h:64
virtual uint32_t getBin(HcalTrigTowerDetId const &)
Definition: Quantity.h:41
virtual void setLog(TH1 *o)
Definition: Quantity.h:52
virtual int getValue(HcalDetId const &)
Definition: Quantity.h:45
virtual Quantity * makeCopy()
Definition: Quantity.h:37
virtual uint32_t getBin(HcalDetId const &)
Definition: Quantity.h:39
virtual int getValue(HcalElectronicsId const &)
Definition: Quantity.h:46
virtual uint32_t getBin(HcalElectronicsId const &)
Definition: Quantity.h:40
virtual uint32_t getBin(double)
Definition: Quantity.h:43
virtual void showOverflow(bool showOverflow)
Definition: Quantity.h:68
virtual double min()
Definition: Quantity.h:59
virtual bool isCoordinate()
Definition: Quantity.h:61
virtual void setNbins(int)
Definition: Quantity.h:66
virtual bool isLog()
Definition: Quantity.h:35
virtual int getValue(HcalTrigTowerDetId const &)
Definition: Quantity.h:47
Quantity(std::string const &name, bool isLog)
Definition: Quantity.h:30
virtual QuantityType type()
Definition: Quantity.h:33
int const BIT_OFFSET
Definition: Constants.h:277
virtual int getValue(int x)
Definition: Quantity.h:48
Readout chain identification for Hcal.