CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Axis.h
Go to the documentation of this file.
1 #ifndef Axis_h
2 #define Axis_h
3 
4 /*
5  * file: Axis.h
6  * Author Viktor Khristenko
7  *
8  * Description:
9  * Base Axis Class
10  */
11 
15 
16 #include <string>
17 #include <vector>
18 
19 namespace hcaldqm
20 {
21  using namespace hcaldqm::constants;
22  class Container;
23  class Container1D;
24  class Container2D;
25  class ContainerProf1D;
26  class ContainerProf2D;
27  class ContainerSingle2D;
28  class ContainerSingle1D;
30  namespace axis
31  {
32  enum AxisType
33  {
34  fXaxis = 0,
35  fYaxis = 1,
36  fZaxis = 2,
38  };
39  enum AxisQType
40  {
41  fValue = 0,
43  fFlag = 2,
45  };
46 
47  /*
48  * Base Class for Axis
49  */
50  class Axis
51  {
52  public:
53  friend class hcaldqm::Container;
54  friend class hcaldqm::Container1D;
55  friend class hcaldqm::Container2D;
61 
62  public:
63  Axis();
65  int n, double min, double max, bool log=false);
66  virtual ~Axis() {}
67  virtual Axis* makeCopy()
68  {return new Axis(_title, _type, _qtype, _nbins,
69  _min, _max, _log);}
70 
71  // getters of Value to put
72  virtual int get(HcalDetId const&) {return 0;}
73  virtual int get(HcalElectronicsId const&) {return 0;}
74  virtual int get(HcalTrigTowerDetId const&) {return 0;}
75  virtual inline int get(int x) {return x;}
76  virtual inline double get(double x) {return x;}
77 
78  // getters of the Bin
79  virtual int getBin(HcalDetId const&) {return 1;}
80  virtual int getBin(HcalElectronicsId const&) {return 1;}
81  virtual int getBin(HcalTrigTowerDetId const&) {return 1;}
82  virtual int getBin(int) {return 1;}
83 
84  // load labels
85  virtual void loadLabels(std::vector<std::string> const&) {}
86 
87  public:
88  AxisQType getType() {return _qtype;}
89  void setLog(TObject* o)
90  {
91  if (_log)
92  o->SetBit(BIT(BIT_OFFSET+_type));
93  }
94  virtual void setBitAxisLS(TObject *o)
95  {
96  return;
97  }
98  virtual void setBitAxisFlag(TObject *o)
99  {
100  return;
101  }
102  protected:
103 
104  // some member variables should be public
105  int _nbins;
106  double _min;
107  double _max;
109  std::vector<std::string> _labels;
110 
113  bool _log;
114  };
115  }
116 }
117 
118 #endif
type
Definition: HCALResponse.h:21
virtual void setBitAxisFlag(TObject *o)
Definition: Axis.h:98
AxisQType _qtype
Definition: Axis.h:112
virtual int getBin(HcalTrigTowerDetId const &)
Definition: Axis.h:81
virtual int getBin(HcalDetId const &)
Definition: Axis.h:79
AxisType _type
Definition: Axis.h:111
T x() const
Cartesian x coordinate.
std::string _title
Definition: Axis.h:108
virtual int getBin(int)
Definition: Axis.h:82
virtual void loadLabels(std::vector< std::string > const &)
Definition: Axis.h:85
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< std::string > _labels
Definition: Axis.h:109
AxisQType getType()
Definition: Axis.h:88
virtual ~Axis()
Definition: Axis.h:66
virtual int getBin(HcalElectronicsId const &)
Definition: Axis.h:80
void setLog(TObject *o)
Definition: Axis.h:89
virtual void setBitAxisLS(TObject *o)
Definition: Axis.h:94
int const BIT_OFFSET
Definition: Constants.h:180
virtual Axis * makeCopy()
Definition: Axis.h:67
Readout chain identification for Hcal.