Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TowerInfov2.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TowerInfov2.h
1 #ifndef TOWERINFOV2_H
2 #define TOWERINFOV2_H
3 
4 #include "TowerInfo.h"
5 #include "TowerInfov1.h"
6 
7 class TowerInfov2 : public TowerInfov1
8 {
9  public:
11 
12  ~TowerInfov2() override {}
13 
14  void Reset() override;
15  void Clear(Option_t* = "") override;
16  void set_time(short t) override { TowerInfov1::set_time(t * 1000); }
17  short get_time() override { return TowerInfov1::get_time() / 1000; }
18 
19  void set_time_float(float t) override { TowerInfov1::set_time(t * 1000); }
20  float get_time_float() override { return TowerInfov1::get_time() / 1000.; }
21 
22  void set_chi2(float chi2) override { _chi2 = chi2; }
23  float get_chi2() override { return _chi2; }
24  void set_pedestal(float pedestal) override { _pedestal = pedestal; }
25  float get_pedestal() override { return _pedestal; }
26 
27  void set_isHot(bool isHot) override { set_status_bit(0, isHot); }
28  bool get_isHot() const override { return get_status_bit(0); }
29 
30  void set_isBadTime(bool isBadTime) override { set_status_bit(1, isBadTime); }
31  bool get_isBadTime() const override { return get_status_bit(1); }
32 
33  void set_isBadChi2(bool isBadChi2) override { set_status_bit(2, isBadChi2); }
34  bool get_isBadChi2() const override { return get_status_bit(2); }
35 
36  void set_isNotInstr(bool isNotInstr) override { set_status_bit(3, isNotInstr); }
37  bool get_isNotInstr() const override { return get_status_bit(3); }
38 
39  void set_isNoCalib(bool isNoCalib) override { set_status_bit(4, isNoCalib); }
40  bool get_isNoCalib() const override { return get_status_bit(4); }
41 
42  bool get_isGood() const override { return !((bool) _status); }
43 
44  uint8_t get_status() const override { return _status; }
45 
46  void set_status(uint8_t status) override { _status = status; }
47 
48  void copy_tower(TowerInfo* tower) override;
49 
50  private:
51  float _chi2 = 0;
52  float _pedestal = 0;
53  uint8_t _status = 0;
54 
55  void set_status_bit(int bit, bool value)
56  {
57  if (bit < 0 || bit > 7)
58  {
59  return;
60  }
61  _status &= ~((uint8_t) 1 << bit);
62  _status |= (uint8_t) value << bit;
63  }
64 
65  bool get_status_bit(int bit) const
66  {
67  if (bit < 0 || bit > 7)
68  {
69  return false; // default behavior
70  }
71  return (_status & ((uint8_t) 1 << bit)) != 0;
72  }
73 
75  // Inherit other methods and properties from TowerInfov1
76 };
77 
78 #endif