ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4Cellv1.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4Cellv1.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4DETECTORS_PHG4CELLV1_H
4 #define G4DETECTORS_PHG4CELLV1_H
5 
6 #include "PHG4Cell.h"
7 #include "PHG4CellDefs.h"
8 
9 #include <g4main/PHG4HitDefs.h> // for keytype
10 
11 #include <cstdint>
12 #include <iostream>
13 #include <map>
14 #include <type_traits> // for __decay_and_strip<>::__type
15 #include <utility> // for make_pair
16 
17 
18 class PHG4Cellv1: public PHG4Cell
19 {
20  public:
21  PHG4Cellv1();
22  PHG4Cellv1(const PHG4CellDefs::keytype g4cellid);
23  ~PHG4Cellv1() override;
24 
25  void identify(std::ostream& os = std::cout) const override;
26  void Reset() override;
27 
28  void set_cellid(const PHG4CellDefs::keytype i) override {cellid = i;}
29 
30  PHG4CellDefs::keytype get_cellid() const override {return cellid;}
31  bool has_binning(const PHG4CellDefs::CellBinning binning) const override;
32  short int get_detid() const override;
33 
34  void add_edep(const PHG4HitDefs::keytype g4hitid, const float edep) override;
35  void add_shower_edep(const int g4showerid, const float edep) override;
36 
38  return std::make_pair(hitedeps.begin(), hitedeps.end());
39  }
40 
42  return std::make_pair(showeredeps.begin(),showeredeps.end());
43  }
44 
45 
46  void add_edep(const float f) override {add_property(prop_edep,f);}
47  double get_edep() const override {return get_property_float(prop_edep);}
48 
49  void add_eion(const float f) override {add_property(prop_eion,f);}
50  double get_eion() const override {return get_property_float(prop_eion);}
51 
52  void add_light_yield(const float f) override {add_property(prop_light_yield,f);}
53  float get_light_yield() const override {return get_property_float(prop_light_yield);}
54 
55  void set_chip_index(const int i) override {set_property(prop_chip_index,i);}
56  int get_chip_index() const override {return get_property_int(prop_chip_index);}
57 
58  void set_half_stave_index(const int i) override {set_property(prop_half_stave_index,i);}
60 
61  void set_ladder_phi_index(const int i) override {set_property(prop_ladder_phi_index,i);}
63 
64  void set_ladder_z_index(const int i) override {set_property(prop_ladder_z_index,i);}
66 
67  void set_module_index(const int i) override {set_property(prop_module_index,i);}
68  int get_module_index() const override {return get_property_int(prop_module_index);}
69 
70  void set_phibin(const int i) override {set_property(prop_phibin,i);}
71  int get_phibin() const override {return get_property_int(prop_phibin);}
72 
73  void set_pixel_index(const int i) override {set_property(prop_pixel_index,i);}
74  int get_pixel_index() const override {return get_property_int(prop_pixel_index);}
75 
76  void set_stave_index(const int i) override {set_property(prop_stave_index,i);}
77  int get_stave_index() const override {return get_property_int(prop_stave_index);}
78 
79  void set_zbin(const int i) override {set_property(prop_zbin,i);}
80  int get_zbin() const override {return get_property_int(prop_zbin);}
81 
82  void print() const override;
83 
84  bool has_property(const PROPERTY prop_id) const override;
85  float get_property_float(const PROPERTY prop_id) const override;
86  int get_property_int(const PROPERTY prop_id) const override;
87  unsigned int get_property_uint(const PROPERTY prop_id) const override;
88  void add_property(const PROPERTY prop_id, const float value);
89  void add_property(const PROPERTY prop_id, const int value);
90  void add_property(const PROPERTY prop_id, const unsigned int value);
91  void set_property(const PROPERTY prop_id, const float value) override;
92  void set_property(const PROPERTY prop_id, const int value) override;
93  void set_property(const PROPERTY prop_id, const unsigned int value) override;
94 
95 
96  protected:
97  unsigned int get_property_nocheck(const PROPERTY prop_id) const override;
98  void set_property_nocheck(const PROPERTY prop_id,const unsigned int ui) override {prop_map[prop_id]=ui;}
99 
103 
105  typedef uint8_t prop_id_t;
106  typedef uint32_t prop_storage_t;
107  typedef std::map<prop_id_t, prop_storage_t> prop_map_t;
108 
110  union u_property{
111  float fdata;
112  int32_t idata;
113  uint32_t uidata;
114 
115  u_property(int32_t in): idata(in) {}
116  u_property(uint32_t in): uidata(in) {}
117  u_property(float in): fdata(in) {}
119 
121  };
122 
125 
126 
127  ClassDefOverride(PHG4Cellv1,3)
128 };
129 
130 #endif