EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4Hit.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4Hit.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4MAIN_PHG4HIT_H
4 #define G4MAIN_PHG4HIT_H
5 
6 #include "PHG4HitDefs.h"
7 
8 #include <phool/PHObject.h>
9 
10 #include <cmath>
11 #include <climits>
12 #include <iostream>
13 #include <string>
14 #include <utility>
15 
16 class PHG4Hit: public PHObject
17 {
18  public:
19  PHG4Hit() {}
20  ~PHG4Hit() override {}
21 
22  void identify(std::ostream& os = std::cout) const override;
23  void CopyFrom(const PHObject *phobj) override;
24  friend std::ostream &operator<<(std::ostream & stream, const PHG4Hit * hit);
25  void Reset() override;
26 
27  // The indices here represent the entry and exit points of the particle
28  virtual float get_x(const int) const {return NAN;}
29  virtual float get_y(const int) const {return NAN;}
30  virtual float get_z(const int) const {return NAN;}
31  virtual float get_px(const int) const {return NAN;}
32  virtual float get_py(const int) const {return NAN;}
33  virtual float get_pz(const int) const {return NAN;}
34  virtual float get_local_x(const int) const {return NAN;}
35  virtual float get_local_y(const int) const {return NAN;}
36  virtual float get_local_z(const int) const {return NAN;}
37  virtual float get_t(const int) const {return NAN;}
38  virtual float get_edep() const {return NAN;}
39  virtual float get_eion() const {return NAN;}
40  virtual float get_light_yield() const {return NAN;}
41  virtual float get_path_length() const {return NAN;}
42  virtual unsigned int get_layer() const {return UINT_MAX;}
43  virtual PHG4HitDefs::keytype get_hit_id() const {return ULONG_LONG_MAX;}
44  virtual int get_detid() const {return INT_MIN;}
45  virtual int get_shower_id() const {return INT_MIN;}
46  virtual int get_scint_id() const {return INT_MIN;}
47  virtual int get_row() const {return INT_MIN;}
48  virtual int get_trkid() const {return INT_MIN;}
49  virtual int get_strip_z_index() const {return INT_MIN;}
50  virtual int get_strip_y_index() const {return INT_MIN;}
51  virtual int get_ladder_z_index() const {return INT_MIN;}
52  virtual int get_ladder_phi_index() const {return INT_MIN;}
53  virtual int get_index_i() const {return INT_MIN;}
54  virtual int get_index_j() const {return INT_MIN;}
55  virtual int get_index_k() const {return INT_MIN;}
56  virtual int get_index_l() const {return INT_MIN;}
57  virtual int get_hit_type() const {return INT_MIN;}
58 
59  virtual void set_x(const int, const float) {return;}
60  virtual void set_y(const int, const float) {return;}
61  virtual void set_z(const int, const float) {return;}
62  virtual void set_px(const int, const float) {return;}
63  virtual void set_py(const int, const float) {return;}
64  virtual void set_pz(const int, const float) {return;}
65  virtual void set_local_x(const int, const float) {return;}
66  virtual void set_local_y(const int, const float) {return;}
67  virtual void set_local_z(const int, const float) {return;}
68  virtual void set_t(const int, const float) {return;}
69  virtual void set_edep(const float) {return;}
70  virtual void set_eion(const float) {return;}
71  virtual void set_light_yield(const float){return;}
72  virtual void set_path_length(const float){return;}
73  virtual void set_layer(const unsigned int) {return;}
74  virtual void set_hit_id(const PHG4HitDefs::keytype) {return;}
75  virtual void set_shower_id(const int) {return;}
76  virtual void set_scint_id(const int) {return;}
77  virtual void set_row(const int) {return;}
78  virtual void set_trkid(const int) {return;}
79  virtual void set_strip_z_index(const int) {return;}
80  virtual void set_strip_y_index(const int) {return;}
81  virtual void set_ladder_z_index(const int) {return;}
82  virtual void set_ladder_phi_index(const int) {return;}
83  virtual void set_index_i(const int) {return;}
84  virtual void set_index_j(const int) {return;}
85  virtual void set_index_k(const int) {return;}
86  virtual void set_index_l(const int) {return;}
87  virtual void set_hit_type(const int) {return;}
88 
89  virtual float get_avg_x() const;
90  virtual float get_avg_y() const;
91  virtual float get_avg_z() const;
92  virtual float get_avg_t() const;
93 
94  virtual void print() const {std::cout<<"PHG4Hit base class - print() not implemented"<<std::endl;}
95 
96 
100  enum PROPERTY
101  {//
102 
103  //-- hit properties: 1 - 10 --
106 
111 
112  //-- track properties: 10 - 20 --
113 
115  prop_px_0 = 10,
116  prop_px_1 = 11,
117  prop_py_0 = 12,
118  prop_py_1 = 13,
119  prop_pz_0 = 14,
120  prop_pz_1 = 15,
121 
124 
132 
133  //-- detector specific IDs: 100+ --
134 
136  prop_layer = 101,
140  prop_row = 103,
141 
147 
148  // MAPS stuff
153 
157 
163 
166 
170 
172  prop_MAX_NUMBER = UCHAR_MAX
173  };
174 
176  {//
177  type_int = 1,
181  };
182 
183  virtual bool has_property(const PROPERTY /*prop_id*/) const {return false;}
184  virtual float get_property_float(const PROPERTY /*prop_id*/) const {return NAN;}
185  virtual int get_property_int(const PROPERTY /*prop_id*/) const {return INT_MIN;}
186  virtual unsigned int get_property_uint(const PROPERTY /*prop_id*/) const {return UINT_MAX;}
187  virtual void set_property(const PROPERTY /*prop_id*/, const float /*value*/) {return;}
188  virtual void set_property(const PROPERTY /*prop_id*/, const int /*value*/) {return;}
189  virtual void set_property(const PROPERTY /*prop_id*/, const unsigned int /*value*/) {return;}
190  static std::pair<const std::string,PROPERTY_TYPE> get_property_info(PROPERTY prop_id);
191  static bool check_property(const PROPERTY prop_id, const PROPERTY_TYPE prop_type);
192  static std::string get_property_type(const PROPERTY_TYPE prop_type);
193 
194  protected:
195  virtual unsigned int get_property_nocheck(const PROPERTY /*prop_id*/) const {return UINT_MAX;}
196  virtual void set_property_nocheck(const PROPERTY /*prop_id*/,const unsigned int) {return;}
197  ClassDefOverride(PHG4Hit,1)
198 };
199 
200 
201 inline float PHG4Hit::get_avg_x() const { return 0.5*(get_x(0)+get_x(1)); }
202 inline float PHG4Hit::get_avg_y() const { return 0.5*(get_y(0)+get_y(1)); }
203 inline float PHG4Hit::get_avg_z() const { return 0.5*(get_z(0)+get_z(1)); }
204 inline float PHG4Hit::get_avg_t() const { return 0.5*(get_t(0)+get_t(1)); }
205 
206 
207 #endif