File indexing completed on 2025-08-05 08:17:42
0001
0002
0003 #ifndef G4DETECTORS_PHG4CELL_H
0004 #define G4DETECTORS_PHG4CELL_H
0005
0006 #include "PHG4CellDefs.h"
0007
0008 #include <g4main/PHG4HitDefs.h> // for keytype
0009
0010 #include <phool/PHObject.h>
0011
0012 #include <climits>
0013 #include <cmath>
0014 #include <iostream> // for ostream, cout, operator<<, endl, bas...
0015 #include <map>
0016 #include <string> // for string
0017 #include <utility> // for pair, make_pair
0018
0019 class PHG4Cell : public PHObject
0020 {
0021 public:
0022 typedef std::map<PHG4HitDefs::keytype, float> EdepMap;
0023 typedef EdepMap::iterator EdepIterator;
0024 typedef EdepMap::const_iterator EdepConstIterator;
0025 typedef std::pair<EdepIterator, EdepIterator> EdepRange;
0026 typedef std::pair<EdepConstIterator, EdepConstIterator> EdepConstRange;
0027
0028 typedef std::map<int, float> ShowerEdepMap;
0029 typedef ShowerEdepMap::iterator ShowerEdepIterator;
0030 typedef ShowerEdepMap::const_iterator ShowerEdepConstIterator;
0031 typedef std::pair<ShowerEdepIterator, ShowerEdepIterator> ShowerEdepRange;
0032 typedef std::pair<ShowerEdepConstIterator, ShowerEdepConstIterator> ShowerEdepConstRange;
0033
0034 ~PHG4Cell() override {}
0035
0036
0037 void identify(std::ostream &os = std::cout) const override;
0038 void CopyFrom(const PHObject *phobj) override;
0039 void Reset() override;
0040
0041 friend std::ostream &operator<<(std::ostream &stream, const PHG4Cell *cell);
0042
0043
0044 virtual void set_cellid(const PHG4CellDefs::keytype) { return; }
0045
0046 virtual PHG4CellDefs::keytype get_cellid() const { return ~0x0; }
0047 virtual bool has_binning(const PHG4CellDefs::CellBinning) const { return false; }
0048
0049
0050 virtual void add_edep(const PHG4HitDefs::keytype , const float ) { return; }
0051 virtual void add_edep(const PHG4HitDefs::keytype , const float , const float ) { return; }
0052 virtual void add_edep(const PHG4HitDefs::keytype , const int , const float ) { return; }
0053
0054 virtual void add_shower_edep(const int , const float ) { return; }
0055
0056 virtual EdepConstRange get_g4hits();
0057
0058 virtual ShowerEdepConstRange get_g4showers();
0059
0060 virtual short int get_detid() const { return -1; }
0061
0062 short int get_layer() const { return get_detid(); }
0063
0064 virtual void add_edep(const float) { return; }
0065 virtual double get_edep() const { return NAN; }
0066
0067 virtual void add_eion(const float) { return; }
0068 virtual double get_eion() const { return NAN; }
0069
0070 virtual void add_light_yield(const float) { return; }
0071 virtual float get_light_yield() const { return NAN; }
0072
0073 virtual void add_raw_light_yield(const float) { return; }
0074 virtual float get_raw_light_yield() const { return NAN; }
0075
0076
0077
0078 virtual void set_chip_index(const int) { return; }
0079 virtual int get_chip_index() const { return ~0x0; }
0080
0081 virtual void set_half_stave_index(const int) { return; }
0082 virtual int get_half_stave_index() const { return ~0x0; }
0083
0084 virtual void set_ladder_phi_index(const int) { return; }
0085 virtual int get_ladder_phi_index() const { return ~0x0; }
0086
0087 virtual void set_ladder_z_index(const int) { return; }
0088 virtual int get_ladder_z_index() const { return ~0x0; }
0089
0090 virtual void set_module_index(const int) { return; }
0091 virtual int get_module_index() const { return ~0x0; }
0092
0093 virtual void set_phibin(const int) { return; }
0094 virtual int get_phibin() const { return ~0x0; }
0095
0096 virtual void set_pixel_index(const int) { return; }
0097 virtual int get_pixel_index() const { return ~0x0; }
0098
0099 virtual void set_stave_index(const int) { return; }
0100 virtual int get_stave_index() const { return ~0x0; }
0101
0102
0103
0104 virtual void set_zbin(const int) { return; }
0105 virtual int get_zbin() const { return ~0x0; }
0106
0107 virtual void print() const { std::cout << "virtual PHG4Cell" << std::endl; }
0108
0109
0110
0111
0112 enum PROPERTY
0113 {
0114
0115
0116 prop_stave_index = 1,
0117 prop_half_stave_index = 2,
0118 prop_module_index = 3,
0119 prop_chip_index = 4,
0120 prop_pixel_index = 5,
0121 prop_phibin = 6,
0122 prop_zbin = 7,
0123 prop_ladder_z_index = 8,
0124 prop_ladder_phi_index = 9,
0125
0126
0127 prop_edep = 21,
0128
0129 prop_eion = 22,
0130
0131
0132 prop_light_yield = 23,
0133
0134
0135 prop_raw_light_yield = 24,
0136
0137
0138 prop_MAX_NUMBER = UCHAR_MAX
0139 };
0140
0141 enum PROPERTY_TYPE
0142 {
0143 type_int = 1,
0144 type_uint = 2,
0145 type_float = 3,
0146 type_unknown = -1
0147 };
0148
0149 virtual bool has_property(const PROPERTY ) const { return false; }
0150 virtual float get_property_float(const PROPERTY ) const { return NAN; }
0151 virtual int get_property_int(const PROPERTY ) const { return INT_MIN; }
0152 virtual unsigned int get_property_uint(const PROPERTY ) const { return UINT_MAX; }
0153 virtual void set_property(const PROPERTY , const float ) { return; }
0154 virtual void set_property(const PROPERTY , const int ) { return; }
0155 virtual void set_property(const PROPERTY , const unsigned int ) { return; }
0156 static std::pair<const std::string, PROPERTY_TYPE> get_property_info(PROPERTY prop_id);
0157 static bool check_property(const PROPERTY prop_id, const PROPERTY_TYPE prop_type);
0158 static std::string get_property_type(const PROPERTY_TYPE prop_type);
0159
0160 protected:
0161 PHG4Cell() {}
0162 virtual unsigned int get_property_nocheck(const PROPERTY ) const { return UINT_MAX; }
0163 virtual void set_property_nocheck(const PROPERTY , const unsigned int) { return; }
0164 ClassDefOverride(PHG4Cell, 2)
0165 };
0166
0167 #endif