ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4Hitv1.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4Hitv1.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4MAIN_PHG4HITV1_H
4 #define G4MAIN_PHG4HITV1_H
5 
6 #include "PHG4Hit.h"
7 #include "PHG4HitDefs.h"
8 
9 #include <climits> // for INT_MIN, ULONG_LONG_MAX
10 #include <cmath>
11 #include <cstdint>
12 #include <iostream>
13 #include <map>
14 
15 class PHG4Hitv1 : public PHG4Hit
16 {
17  public:
18  PHG4Hitv1() = default;
19  explicit PHG4Hitv1(const PHG4Hit* g4hit);
20  ~PHG4Hitv1() override = default;
21  void identify(std::ostream& os = std::cout) const override;
22  void Reset() override;
23 
24  // The indices here represent the entry and exit points of the particle
25  float get_x(const int i) const override { return x[i]; }
26  float get_y(const int i) const override { return y[i]; }
27  float get_z(const int i) const override { return z[i]; }
28  float get_t(const int i) const override { return t[i]; }
29  float get_edep() const override { return edep; }
30  PHG4HitDefs::keytype get_hit_id() const override { return hitid; }
31  int get_detid() const override;
32  int get_shower_id() const override { return showerid; }
33  int get_trkid() const override { return trackid; }
34 
35  void set_x(const int i, const float f) override { x[i] = f; }
36  void set_y(const int i, const float f) override { y[i] = f; }
37  void set_z(const int i, const float f) override { z[i] = f; }
38  void set_t(const int i, const float f) override { t[i] = f; }
39  void set_edep(const float f) override { edep = f; }
40  void set_hit_id(const PHG4HitDefs::keytype i) override { hitid = i; }
41  void set_shower_id(const int i) override { showerid = i; }
42  void set_trkid(const int i) override { trackid = i; }
43 
44  void print() const override;
45 
46  bool has_property(const PROPERTY prop_id) const override;
47  float get_property_float(const PROPERTY prop_id) const override;
48  int get_property_int(const PROPERTY prop_id) const override;
49  unsigned int get_property_uint(const PROPERTY prop_id) const override;
50  void set_property(const PROPERTY prop_id, const float value) override;
51  void set_property(const PROPERTY prop_id, const int value) override;
52  void set_property(const PROPERTY prop_id, const unsigned int value) override;
53 
54  float get_px(const int i) const override;
55  float get_py(const int i) const override;
56  float get_pz(const int i) const override;
57  float get_local_x(const int i) const override;
58  float get_local_y(const int i) const override;
59  float get_local_z(const int i) const override;
60  float get_eion() const override { return get_property_float(prop_eion); }
61  float get_light_yield() const override { return get_property_float(prop_light_yield); }
62  float get_path_length() const override { return get_property_float(prop_path_length); }
63  unsigned int get_layer() const override { return get_property_uint(prop_layer); }
64  int get_scint_id() const override { return get_property_int(prop_scint_id); }
65  int get_row() const override { return get_property_int(prop_row); }
66  int get_strip_z_index() const override { return get_property_int(prop_strip_z_index); }
67  int get_strip_y_index() const override { return get_property_int(prop_strip_y_index); }
68  int get_ladder_z_index() const override { return get_property_int(prop_ladder_z_index); }
70  int get_index_i() const override { return get_property_int(prop_index_i); }
71  int get_index_j() const override { return get_property_int(prop_index_j); }
72  int get_index_k() const override { return get_property_int(prop_index_k); }
73  int get_index_l() const override { return get_property_int(prop_index_l); }
74  int get_hit_type() const override { return get_property_int(prop_hit_type); }
75 
76  void set_px(const int i, const float f) override;
77  void set_py(const int i, const float f) override;
78  void set_pz(const int i, const float f) override;
79  void set_local_x(const int i, const float f) override;
80  void set_local_y(const int i, const float f) override;
81  void set_local_z(const int i, const float f) override;
82  void set_eion(const float f) override { set_property(prop_eion, f); }
83  void set_light_yield(const float f) override { set_property(prop_light_yield, f); }
84  void set_path_length(const float f) override { set_property(prop_path_length, f); }
85  void set_layer(const unsigned int i) override { set_property(prop_layer, i); }
86  void set_scint_id(const int i) override { set_property(prop_scint_id, i); }
87  void set_row(const int i) override { set_property(prop_row, i); }
88  void set_strip_z_index(const int i) override { set_property(prop_strip_z_index, i); }
89  void set_strip_y_index(const int i) override { set_property(prop_strip_y_index, i); }
90  void set_ladder_z_index(const int i) override { set_property(prop_ladder_z_index, i); }
91  void set_ladder_phi_index(const int i) override { set_property(prop_ladder_phi_index, i); }
92  void set_index_i(const int i) override { set_property(prop_index_i, i); }
93  void set_index_j(const int i) override { set_property(prop_index_j, i); }
94  void set_index_k(const int i) override { set_property(prop_index_k, i); }
95  void set_index_l(const int i) override { set_property(prop_index_l, i); }
96  void set_hit_type(const int i) override { set_property(prop_hit_type, i); }
97 
98  protected:
99  unsigned int get_property_nocheck(const PROPERTY prop_id) const override;
100  void set_property_nocheck(const PROPERTY prop_id, const unsigned int ui) override { prop_map[prop_id] = ui; }
101  // Store both the entry and exit points of the particle
102  // Remember, particles do not always enter on the inner edge!
103  float x[2] = {NAN, NAN};
104  float y[2] = {NAN, NAN};
105  float z[2] = {NAN, NAN};
106  float t[2] = {NAN, NAN};
107  PHG4HitDefs::keytype hitid = ULONG_LONG_MAX;
110  float edep = NAN;
111 
113  typedef uint8_t prop_id_t;
114  typedef uint32_t prop_storage_t;
115  typedef std::map<prop_id_t, prop_storage_t> prop_map_t;
116 
118  union u_property {
119  float fdata;
120  int32_t idata;
121  uint32_t uidata;
122 
123  u_property(int32_t in)
124  : idata(in)
125  {
126  }
127  u_property(uint32_t in)
128  : uidata(in)
129  {
130  }
131  u_property(float in)
132  : fdata(in)
133  {
134  }
136  : uidata(0)
137  {
138  }
139 
140  prop_storage_t get_storage() const { return uidata; }
141  };
142 
145 
146  ClassDefOverride(PHG4Hitv1, 2)
147 };
148 
149 #endif