File indexing completed on 2025-12-16 09:21:58
0001
0002
0003 #ifndef G4MAIN_PHG4HITV1_H
0004 #define G4MAIN_PHG4HITV1_H
0005
0006 #include "PHG4Hit.h"
0007 #include "PHG4HitDefs.h"
0008
0009 #include <cstdint>
0010 #include <iostream>
0011 #include <limits>
0012 #include <map>
0013
0014 class PHG4Hitv1 : public PHG4Hit
0015 {
0016 public:
0017 PHG4Hitv1() = default;
0018 explicit PHG4Hitv1(const PHG4Hit* g4hit);
0019 ~PHG4Hitv1() override = default;
0020 void identify(std::ostream& os = std::cout) const override;
0021 void Reset() override;
0022
0023
0024 float get_x(const int i) const override { return x[i]; }
0025 float get_y(const int i) const override { return y[i]; }
0026 float get_z(const int i) const override { return z[i]; }
0027 float get_t(const int i) const override { return t[i]; }
0028 float get_edep() const override { return edep; }
0029 PHG4HitDefs::keytype get_hit_id() const override { return hitid; }
0030 int get_detid() const override;
0031 int get_shower_id() const override { return showerid; }
0032 int get_trkid() const override { return trackid; }
0033
0034 void set_x(const int i, const float f) override { x[i] = f; }
0035 void set_y(const int i, const float f) override { y[i] = f; }
0036 void set_z(const int i, const float f) override { z[i] = f; }
0037 void set_t(const int i, const float f) override { t[i] = f; }
0038 void set_edep(const float f) override { edep = f; }
0039 void set_hit_id(const PHG4HitDefs::keytype i) override { hitid = i; }
0040 void set_shower_id(const int i) override { showerid = i; }
0041 void set_trkid(const int i) override { trackid = i; }
0042
0043 void print() const override;
0044
0045 bool has_property(const PROPERTY prop_id) const override;
0046 float get_property_float(const PROPERTY prop_id) const override;
0047 int get_property_int(const PROPERTY prop_id) const override;
0048 unsigned int get_property_uint(const PROPERTY prop_id) const override;
0049 void set_property(const PROPERTY prop_id, const float value) override;
0050 void set_property(const PROPERTY prop_id, const int value) override;
0051 void set_property(const PROPERTY prop_id, const unsigned int value) override;
0052
0053 float get_px(const int i) const override;
0054 float get_py(const int i) const override;
0055 float get_pz(const int i) const override;
0056 float get_local_x(const int i) const override;
0057 float get_local_y(const int i) const override;
0058 float get_local_z(const int i) const override;
0059 float get_eion() const override { return get_property_float(prop_eion); }
0060 float get_light_yield() const override { return get_property_float(prop_light_yield); }
0061 float get_raw_light_yield() const override { return get_property_float(prop_raw_light_yield); }
0062 float get_path_length() const override { return get_property_float(prop_path_length); }
0063 unsigned int get_layer() const override { return get_property_uint(prop_layer); }
0064 int get_scint_id() const override { return get_property_int(prop_scint_id); }
0065 int get_row() const override { return get_property_int(prop_row); }
0066 int get_sector() const override { return get_property_int(prop_sector); }
0067 int get_strip_z_index() const override { return get_property_int(prop_strip_z_index); }
0068 int get_strip_y_index() const override { return get_property_int(prop_strip_y_index); }
0069 int get_ladder_z_index() const override { return get_property_int(prop_ladder_z_index); }
0070 int get_ladder_phi_index() const override { return get_property_int(prop_ladder_phi_index); }
0071 int get_index_i() const override { return get_property_int(prop_index_i); }
0072 int get_index_j() const override { return get_property_int(prop_index_j); }
0073 int get_index_k() const override { return get_property_int(prop_index_k); }
0074 int get_index_l() const override { return get_property_int(prop_index_l); }
0075 int get_hit_type() const override { return get_property_int(prop_hit_type); }
0076
0077 void set_px(const int i, const float f) override;
0078 void set_py(const int i, const float f) override;
0079 void set_pz(const int i, const float f) override;
0080 void set_local_x(const int i, const float f) override;
0081 void set_local_y(const int i, const float f) override;
0082 void set_local_z(const int i, const float f) override;
0083 void set_eion(const float f) override { set_property(prop_eion, f); }
0084 void set_light_yield(const float f) override { set_property(prop_light_yield, f); }
0085 void set_raw_light_yield(const float f) override { set_property(prop_raw_light_yield, f); }
0086 void set_path_length(const float f) override { set_property(prop_path_length, f); }
0087 void set_layer(const unsigned int i) override { set_property(prop_layer, i); }
0088 void set_scint_id(const int i) override { set_property(prop_scint_id, i); }
0089 void set_row(const int i) override { set_property(prop_row, i); }
0090 void set_sector(const int i) override { set_property(prop_sector, i); }
0091 void set_strip_z_index(const int i) override { set_property(prop_strip_z_index, i); }
0092 void set_strip_y_index(const int i) override { set_property(prop_strip_y_index, i); }
0093 void set_ladder_z_index(const int i) override { set_property(prop_ladder_z_index, i); }
0094 void set_ladder_phi_index(const int i) override { set_property(prop_ladder_phi_index, i); }
0095 void set_index_i(const int i) override { set_property(prop_index_i, i); }
0096 void set_index_j(const int i) override { set_property(prop_index_j, i); }
0097 void set_index_k(const int i) override { set_property(prop_index_k, i); }
0098 void set_index_l(const int i) override { set_property(prop_index_l, i); }
0099 void set_hit_type(const int i) override { set_property(prop_hit_type, i); }
0100
0101 protected:
0102 unsigned int get_property_nocheck(const PROPERTY prop_id) const override;
0103 void set_property_nocheck(const PROPERTY prop_id, const unsigned int ui) override { prop_map[prop_id] = ui; }
0104
0105
0106 float x[2] = {std::numeric_limits<float>::quiet_NaN(), std::numeric_limits<float>::quiet_NaN()};
0107 float y[2] = {std::numeric_limits<float>::quiet_NaN(), std::numeric_limits<float>::quiet_NaN()};
0108 float z[2] = {std::numeric_limits<float>::quiet_NaN(), std::numeric_limits<float>::quiet_NaN()};
0109 float t[2] = {std::numeric_limits<float>::quiet_NaN(), std::numeric_limits<float>::quiet_NaN()};
0110 PHG4HitDefs::keytype hitid = std::numeric_limits<PHG4HitDefs::keytype>::max();
0111 int trackid = std::numeric_limits<int>::min();
0112 int showerid = std::numeric_limits<int>::min();
0113 float edep = std::numeric_limits<float>::quiet_NaN();
0114
0115
0116 typedef uint8_t prop_id_t;
0117 typedef uint32_t prop_storage_t;
0118 typedef std::map<prop_id_t, prop_storage_t> prop_map_t;
0119
0120
0121 union u_property
0122 {
0123 float fdata;
0124 int32_t idata;
0125 uint32_t uidata;
0126
0127 u_property(int32_t in)
0128 : idata(in)
0129 {
0130 }
0131 u_property(uint32_t in)
0132 : uidata(in)
0133 {
0134 }
0135 u_property(float in)
0136 : fdata(in)
0137 {
0138 }
0139 u_property()
0140 : uidata(0)
0141 {
0142 }
0143
0144 prop_storage_t get_storage() const { return uidata; }
0145 };
0146
0147
0148 prop_map_t prop_map;
0149
0150 ClassDefOverride(PHG4Hitv1, 2)
0151 };
0152
0153 #endif