Analysis Software
Documentation for sPHENIX simulation 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 class PHG4Cellv1 : public PHG4Cell
18 {
19  public:
21  explicit PHG4Cellv1(const PHG4CellDefs::keytype g4cellid);
22  ~PHG4Cellv1() override;
23 
24  void identify(std::ostream& os = std::cout) const override;
25  void Reset() override;
26 
27  void set_cellid(const PHG4CellDefs::keytype i) override { cellid = i; }
28 
29  PHG4CellDefs::keytype get_cellid() const override { return cellid; }
30  bool has_binning(const PHG4CellDefs::CellBinning binning) const override;
31  short int get_detid() const override;
32 
33  using PHG4Cell::add_edep;
34 
35  void add_edep(const PHG4HitDefs::keytype g4hitid, const float edep) override;
36  void add_shower_edep(const int g4showerid, const float edep) override;
37 
39  {
40  return std::make_pair(hitedeps.begin(), hitedeps.end());
41  }
42 
44  {
45  return std::make_pair(showeredeps.begin(), showeredeps.end());
46  }
47 
48  void add_edep(const float f) override { add_property(prop_edep, f); }
49  double get_edep() const override { return get_property_float(prop_edep); }
50 
51  void add_eion(const float f) override { add_property(prop_eion, f); }
52  double get_eion() const override { return get_property_float(prop_eion); }
53 
54  void add_light_yield(const float f) override { add_property(prop_light_yield, f); }
55  float get_light_yield() const override { return get_property_float(prop_light_yield); }
56 
57  void add_raw_light_yield(const float f) override { add_property(prop_raw_light_yield, f); }
58  float get_raw_light_yield() const override { return get_property_float(prop_raw_light_yield); }
59 
60  void set_chip_index(const int i) override { set_property(prop_chip_index, i); }
61  int get_chip_index() const override { return get_property_int(prop_chip_index); }
62 
63  void set_half_stave_index(const int i) override { set_property(prop_half_stave_index, i); }
65 
66  void set_ladder_phi_index(const int i) override { set_property(prop_ladder_phi_index, i); }
68 
69  void set_ladder_z_index(const int i) override { set_property(prop_ladder_z_index, i); }
70  int get_ladder_z_index() const override { return get_property_int(prop_ladder_z_index); }
71 
72  void set_module_index(const int i) override { set_property(prop_module_index, i); }
73  int get_module_index() const override { return get_property_int(prop_module_index); }
74 
75  void set_phibin(const int i) override { set_property(prop_phibin, i); }
76  int get_phibin() const override { return get_property_int(prop_phibin); }
77 
78  void set_pixel_index(const int i) override { set_property(prop_pixel_index, i); }
79  int get_pixel_index() const override { return get_property_int(prop_pixel_index); }
80 
81  void set_stave_index(const int i) override { set_property(prop_stave_index, i); }
82  int get_stave_index() const override { return get_property_int(prop_stave_index); }
83 
84  void set_zbin(const int i) override { set_property(prop_zbin, i); }
85  int get_zbin() const override { return get_property_int(prop_zbin); }
86 
87  void print() const override;
88 
89  bool has_property(const PROPERTY prop_id) const override;
90  float get_property_float(const PROPERTY prop_id) const override;
91  int get_property_int(const PROPERTY prop_id) const override;
92  unsigned int get_property_uint(const PROPERTY prop_id) const override;
93  void add_property(const PROPERTY prop_id, const float value);
94  void add_property(const PROPERTY prop_id, const int value);
95  void add_property(const PROPERTY prop_id, const unsigned int value);
96  void set_property(const PROPERTY prop_id, const float value) override;
97  void set_property(const PROPERTY prop_id, const int value) override;
98  void set_property(const PROPERTY prop_id, const unsigned int value) override;
99 
100  protected:
101  unsigned int get_property_nocheck(const PROPERTY prop_id) const override;
102  void set_property_nocheck(const PROPERTY prop_id, const unsigned int ui) override { prop_map[prop_id] = ui; }
103 
107 
109  typedef uint8_t prop_id_t;
110  typedef uint32_t prop_storage_t;
111  typedef std::map<prop_id_t, prop_storage_t> prop_map_t;
112 
115  {
116  float fdata;
117  int32_t idata;
118  uint32_t uidata;
119 
120  u_property(int32_t in)
121  : idata(in)
122  {
123  }
124  u_property(uint32_t in)
125  : uidata(in)
126  {
127  }
128  u_property(float in)
129  : fdata(in)
130  {
131  }
133  : uidata(0)
134  {
135  }
136 
137  prop_storage_t get_storage() const { return uidata; }
138  };
139 
142 
143  ClassDefOverride(PHG4Cellv1, 3)
144 };
145 
146 #endif