ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4Cell.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4Cell.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4DETECTORS_PHG4CELL_H
4 #define G4DETECTORS_PHG4CELL_H
5 
6 #include "PHG4CellDefs.h"
7 
8 #include <g4main/PHG4HitDefs.h> // for keytype
9 
10 #include <phool/PHObject.h>
11 
12 #include <cmath>
13 #include <climits>
14 #include <iostream> // for ostream, cout, operator<<, endl, bas...
15 #include <map>
16 #include <string> // for string
17 #include <utility> // for pair, make_pair
18 
19 class PHG4Cell: public PHObject
20 {
21  public:
22  typedef std::map<PHG4HitDefs::keytype, float> EdepMap;
23  typedef EdepMap::iterator EdepIterator;
24  typedef EdepMap::const_iterator EdepConstIterator;
25  typedef std::pair<EdepIterator, EdepIterator> EdepRange;
26  typedef std::pair<EdepConstIterator, EdepConstIterator> EdepConstRange;
27 
28  typedef std::map<int, float> ShowerEdepMap;
29  typedef ShowerEdepMap::iterator ShowerEdepIterator;
30  typedef ShowerEdepMap::const_iterator ShowerEdepConstIterator;
31  typedef std::pair<ShowerEdepIterator, ShowerEdepIterator> ShowerEdepRange;
32  typedef std::pair<ShowerEdepConstIterator, ShowerEdepConstIterator> ShowerEdepConstRange;
33 
34  ~PHG4Cell() override {}
35 
36 // from PHObject
37  void identify(std::ostream& os = std::cout) const override;
38  void CopyFrom(const PHObject *phobj) override;
39  void Reset() override;
40 
41  friend std::ostream &operator<<(std::ostream & stream, const PHG4Cell * cell);
42 
43  // all methods connected to the cell id (encoding/decoding
44  virtual void set_cellid(const PHG4CellDefs::keytype) {return;}
45 
46  virtual PHG4CellDefs::keytype get_cellid() const {return ~0x0;}
47  virtual bool has_binning(const PHG4CellDefs::CellBinning) const {return false;}
48 
49  // this adds hits to the g4 hit list map
50  virtual void add_edep(const PHG4HitDefs::keytype /*g4hitid*/, const float /*edep*/) {return;}
51  virtual void add_edep(const PHG4HitDefs::keytype /*g4hitid*/, const float /*edep*/, const float /*light_yield*/) {return;}
52  virtual void add_edep(const PHG4HitDefs::keytype /*g4hitid*/, const int /*tbin*/, const float /*edep*/) {return;}
53  // this adds showers to the shower map
54  virtual void add_shower_edep(const int /*g4showerid*/, const float /*edep*/) {return;}
55 
56  virtual EdepConstRange get_g4hits();
57 
59 
60  virtual short int get_detid() const {return -1;}
61  // for backward compatibility, layers and detector ids are identical
62  short int get_layer() const {return get_detid();}
63 
64  virtual void add_edep(const float) {return;}
65  virtual double get_edep() const {return NAN;}
66 
67  virtual void add_eion(const float) {return;}
68  virtual double get_eion() const {return NAN;}
69 
70  virtual void add_light_yield(const float){return;}
71  virtual float get_light_yield() const {return NAN;}
72 
73  // get/set methodes - PLEASE add those ALPHABETICALLY
74 
75  virtual void set_chip_index(const int) {return;}
76  virtual int get_chip_index() const {return ~0x0;}
77 
78  virtual void set_half_stave_index(const int) {return;}
79  virtual int get_half_stave_index() const {return ~0x0;}
80 
81  virtual void set_ladder_phi_index(const int) {return;}
82  virtual int get_ladder_phi_index() const {return ~0x0;}
83 
84  virtual void set_ladder_z_index(const int) {return;}
85  virtual int get_ladder_z_index() const {return ~0x0;}
86 
87  virtual void set_module_index(const int) {return;}
88  virtual int get_module_index() const {return ~0x0;}
89 
90  virtual void set_phibin(const int) {return;}
91  virtual int get_phibin() const {return ~0x0;}
92 
93  virtual void set_pixel_index(const int) {return;}
94  virtual int get_pixel_index() const {return ~0x0;}
95 
96  virtual void set_stave_index(const int) {return;}
97  virtual int get_stave_index() const {return ~0x0;}
98 
99 // virtual tpctod* get_train_of_digits() {return 0;}
100 
101  virtual void set_zbin(const int) {return;}
102  virtual int get_zbin() const {return ~0x0;}
103 
104 
105  virtual void print() const {std::cout<<"virtual PHG4Cell"<<std::endl;}
106 
110  enum PROPERTY
111  {//
112  // first various coordinates 1-20
123  //-- summed energy: - 20-30 --
125  prop_edep = 21,
127  prop_eion = 22,
128 
131 
133  prop_MAX_NUMBER = UCHAR_MAX
134  };
135 
137  {//
138  type_int = 1,
142  };
143 
144  virtual bool has_property(const PROPERTY /*prop_id*/) const {return false;}
145  virtual float get_property_float(const PROPERTY /*prop_id*/) const {return NAN;}
146  virtual int get_property_int(const PROPERTY /*prop_id*/) const {return INT_MIN;}
147  virtual unsigned int get_property_uint(const PROPERTY /*prop_id*/) const {return UINT_MAX;}
148  virtual void set_property(const PROPERTY /*prop_id*/, const float /*value*/) {return;}
149  virtual void set_property(const PROPERTY /*prop_id*/, const int /*value*/) {return;}
150  virtual void set_property(const PROPERTY /*prop_id*/, const unsigned int /*value*/) {return;}
151  static std::pair<const std::string,PROPERTY_TYPE> get_property_info(PROPERTY prop_id);
152  static bool check_property(const PROPERTY prop_id, const PROPERTY_TYPE prop_type);
153  static std::string get_property_type(const PROPERTY_TYPE prop_type);
154 
155  protected:
156  PHG4Cell() {}
157  virtual unsigned int get_property_nocheck(const PROPERTY /*prop_id*/) const {return UINT_MAX;}
158  virtual void set_property_nocheck(const PROPERTY /*prop_id*/,const unsigned int) {return;}
159  ClassDefOverride(PHG4Cell,2)
160 };
161 
162 
163 #endif