Analysis Software
Documentation for sPHENIX simulation 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 <climits>
13 #include <cmath>
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  virtual void add_raw_light_yield(const float) { return; }
74  virtual float get_raw_light_yield() const { return NAN; }
75 
76  // get/set methodes - PLEASE add those ALPHABETICALLY
77 
78  virtual void set_chip_index(const int) { return; }
79  virtual int get_chip_index() const { return ~0x0; }
80 
81  virtual void set_half_stave_index(const int) { return; }
82  virtual int get_half_stave_index() const { return ~0x0; }
83 
84  virtual void set_ladder_phi_index(const int) { return; }
85  virtual int get_ladder_phi_index() const { return ~0x0; }
86 
87  virtual void set_ladder_z_index(const int) { return; }
88  virtual int get_ladder_z_index() const { return ~0x0; }
89 
90  virtual void set_module_index(const int) { return; }
91  virtual int get_module_index() const { return ~0x0; }
92 
93  virtual void set_phibin(const int) { return; }
94  virtual int get_phibin() const { return ~0x0; }
95 
96  virtual void set_pixel_index(const int) { return; }
97  virtual int get_pixel_index() const { return ~0x0; }
98 
99  virtual void set_stave_index(const int) { return; }
100  virtual int get_stave_index() const { return ~0x0; }
101 
102  // virtual tpctod* get_train_of_digits() {return 0;}
103 
104  virtual void set_zbin(const int) { return; }
105  virtual int get_zbin() const { return ~0x0; }
106 
107  virtual void print() const { std::cout << "virtual PHG4Cell" << std::endl; }
108 
112  enum PROPERTY
113  { //
114  // first various coordinates 1-20
125  //-- summed energy: - 20-30 --
127  prop_edep = 21,
129  prop_eion = 22,
130 
133 
136 
138  prop_MAX_NUMBER = UCHAR_MAX
139  };
140 
142  { //
143  type_int = 1,
147  };
148 
149  virtual bool has_property(const PROPERTY /*prop_id*/) const { return false; }
150  virtual float get_property_float(const PROPERTY /*prop_id*/) const { return NAN; }
151  virtual int get_property_int(const PROPERTY /*prop_id*/) const { return INT_MIN; }
152  virtual unsigned int get_property_uint(const PROPERTY /*prop_id*/) const { return UINT_MAX; }
153  virtual void set_property(const PROPERTY /*prop_id*/, const float /*value*/) { return; }
154  virtual void set_property(const PROPERTY /*prop_id*/, const int /*value*/) { return; }
155  virtual void set_property(const PROPERTY /*prop_id*/, const unsigned int /*value*/) { return; }
156  static std::pair<const std::string, PROPERTY_TYPE> get_property_info(PROPERTY prop_id);
157  static bool check_property(const PROPERTY prop_id, const PROPERTY_TYPE prop_type);
158  static std::string get_property_type(const PROPERTY_TYPE prop_type);
159 
160  protected:
161  PHG4Cell() {}
162  virtual unsigned int get_property_nocheck(const PROPERTY /*prop_id*/) const { return UINT_MAX; }
163  virtual void set_property_nocheck(const PROPERTY /*prop_id*/, const unsigned int) { return; }
164  ClassDefOverride(PHG4Cell, 2)
165 };
166 
167 #endif