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