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 {
15  namespace quantity
16  {
18  {
24  fNone = 5,
26  };
27 
28  enum AxisType
29  {
30  fXAxis = 0,
31  fYAxis = 1,
32  fZAxis = 2,
34  };
35 
36  class Quantity
37  {
38  public:
39  Quantity() : _name("Quantity"), _isLog(false)
40  {}
41  Quantity(std::string const& name, bool isLog) :
42  _name(name), _isLog(isLog)
43  {}
44  virtual ~Quantity() {}
45 
46  virtual QuantityType type() {return fNone;}
47  virtual std::string name() {return _name;}
48  virtual bool isLog() {return _isLog;}
49  virtual void setAxisType(AxisType at) {_axistype=at;}
50  virtual Quantity* makeCopy()
51  {return new Quantity(_name,_isLog);}
52 
53  virtual uint32_t getBin(HcalDetId const&) {return 1;}
54  virtual uint32_t getBin(HcalElectronicsId const&) {return 1;}
55  virtual uint32_t getBin(HcalTrigTowerDetId const&) {return 1;}
56  virtual uint32_t getBin(int) {return 1;}
57  virtual uint32_t getBin(double) {return 1;}
58 
59  virtual int getValue(HcalDetId const&) {return 0;}
60  virtual int getValue(HcalElectronicsId const&) {return 0;}
61  virtual int getValue(HcalTrigTowerDetId const&) {return 0;}
62  virtual int getValue(int x) {return x;}
63  virtual double getValue(double x) {return x;}
64 
65  virtual void setBits(TH1* o)
66  {setLog(o);}
67  virtual void setLog(TH1* o)
68  {
69  if (_isLog)
70  o->SetBit(BIT(BIT_OFFSET+_axistype));
71  }
72 
73  virtual int nbins() {return 1;}
74  virtual int wofnbins() {return nbins()+2;}
75  virtual double min() {return 0;}
76  virtual double max() {return 1;}
77  virtual bool isCoordinate() {return false;}
78  virtual std::vector<std::string> getLabels()
79  {return std::vector<std::string>();}
80 
81  virtual void setMax(double) {}
82  virtual void setMin(double) {}
83  virtual void setNbins(int) {}
84 
85  protected:
87  bool _isLog;
89  };
90  }
91 }
92 
93 #endif
virtual uint32_t getBin(int)
Definition: Quantity.h:56
virtual void setBits(TH1 *o)
Definition: Quantity.h:65
virtual std::string name()
Definition: Quantity.h:47
virtual void setAxisType(AxisType at)
Definition: Quantity.h:49
virtual void setMin(double)
Definition: Quantity.h:82
virtual double getValue(double x)
Definition: Quantity.h:63
virtual int wofnbins()
Definition: Quantity.h:74
virtual std::vector< std::string > getLabels()
Definition: Quantity.h:78
virtual double max()
Definition: Quantity.h:76
virtual void setMax(double)
Definition: Quantity.h:81
virtual uint32_t getBin(HcalTrigTowerDetId const &)
Definition: Quantity.h:55
virtual void setLog(TH1 *o)
Definition: Quantity.h:67
virtual int getValue(HcalDetId const &)
Definition: Quantity.h:59
virtual Quantity * makeCopy()
Definition: Quantity.h:50
virtual uint32_t getBin(HcalDetId const &)
Definition: Quantity.h:53
virtual int getValue(HcalElectronicsId const &)
Definition: Quantity.h:60
virtual uint32_t getBin(HcalElectronicsId const &)
Definition: Quantity.h:54
virtual uint32_t getBin(double)
Definition: Quantity.h:57
virtual double min()
Definition: Quantity.h:75
virtual bool isCoordinate()
Definition: Quantity.h:77
virtual void setNbins(int)
Definition: Quantity.h:83
virtual bool isLog()
Definition: Quantity.h:48
virtual int getValue(HcalTrigTowerDetId const &)
Definition: Quantity.h:61
Quantity(std::string const &name, bool isLog)
Definition: Quantity.h:41
virtual QuantityType type()
Definition: Quantity.h:46
int const BIT_OFFSET
Definition: Constants.h:313
virtual int getValue(int x)
Definition: Quantity.h:62
Readout chain identification for Hcal.