ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4Shower.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4Shower.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4MAIN_PHG4SHOWER_H
4 #define G4MAIN_PHG4SHOWER_H
5 
6 #include "PHG4HitDefs.h"
7 
8 #include <phool/PHObject.h>
9 
10 #include <cmath> // for NAN def
11 #include <iostream>
12 #include <map>
13 #include <set>
14 
15 class PHG4Shower : public PHObject
16 {
17  public:
18  typedef std::set<int> ParticleIdSet;
19  typedef ParticleIdSet::iterator ParticleIdIter;
20  typedef ParticleIdSet::const_iterator ParticleIdConstIter;
21 
22  typedef std::set<int> VertexIdSet;
23  typedef VertexIdSet::iterator VertexIdIter;
24  typedef VertexIdSet::const_iterator VertexIdConstIter;
25 
26  typedef std::map<int, std::set<PHG4HitDefs::keytype> > HitIdMap;
27  typedef HitIdMap::iterator HitIdIter;
28  typedef HitIdMap::const_iterator HitIdConstIter;
29 
30  ~PHG4Shower() override {}
31 
32  // PHObject virtual overloads
33 
34  void identify(std::ostream& os = std::cout) const override { os << "PHG4Shower base class" << std::endl; }
35  PHG4Shower* CloneMe() const override { return nullptr; }
36  void Reset() override {}
37  int isValid() const override { return 0; }
38 
39  // shower info
40 
41  virtual int get_id() const { return 0; }
42  virtual void set_id(int /*id*/) {}
43 
44  virtual int get_parent_particle_id() const { return 0; }
45  virtual void set_parent_particle_id(int /*parent_particle_id*/) {}
46 
47  virtual int get_parent_shower_id() const { return 0; }
48  virtual void set_parent_shower_id(int /*parent_shower_id*/) {}
49 
50  virtual float get_x() const { return NAN; }
51  virtual void set_x(float) {}
52 
53  virtual float get_y() const { return NAN; }
54  virtual void set_y(float) {}
55 
56  virtual float get_z() const { return NAN; }
57  virtual void set_z(float) {}
58 
59  virtual float get_position(unsigned int /*coor*/) const { return NAN; }
60  virtual void set_position(unsigned int /*coor*/, float /*xi*/) {}
61 
62  virtual float get_covar(unsigned int /*i*/, unsigned int /*j*/) const { return NAN; }
63  virtual void set_covar(unsigned int /*i*/, unsigned int /*j*/, float /*entry*/) {}
64 
65  virtual unsigned int get_nhits(int /*volume*/) const { return 0; }
66  virtual void set_nhits(int /*volume*/, unsigned int /*nhits*/) {}
67 
68  virtual double get_edep() const { return NAN; }
69  virtual float get_edep(int /*volume*/) const { return NAN; }
70  virtual void set_edep(int /*volume*/, float /*edep*/) {}
71 
72  virtual double get_eion() const { return NAN; }
73  virtual float get_eion(int /*volume*/) const { return NAN; }
74  virtual void set_eion(int /*volume*/, float /*eion*/) {}
75 
76  virtual float get_light_yield(int /*volume*/) const { return NAN; }
77  virtual void set_light_yield(int /*volume*/, float /*light_yield*/) {}
78 
79  virtual float get_eh_ratio(int /*volume*/) const { return NAN; }
80  virtual void set_eh_ratio(int /*volume*/, float /*eh_ratio*/) {}
81 
82  virtual bool empty_g4particle_id() const { return true; }
83  virtual size_t size_g4particle_id() const { return 0; }
84  virtual void add_g4particle_id(int /*id*/) {}
88  virtual ParticleIdConstIter end_g4particle_id() const;
89  virtual size_t remove_g4particle_id(int /*id*/) { return 0; }
90  virtual void clear_g4particle_id() {}
91  virtual const ParticleIdSet& g4particle_ids() const = 0;
92 
93  virtual bool empty_g4vertex_id() const { return true; }
94  virtual size_t size_g4vertex_id() const { return 0; }
95  virtual void add_g4vertex_id(int /*id*/) {}
97  virtual VertexIdConstIter begin_g4vertex_id() const;
98  virtual VertexIdIter end_g4vertex_id();
99  virtual VertexIdConstIter end_g4vertex_id() const;
100  virtual size_t remove_g4vertex_id(int /*id*/) { return 0; }
101  virtual void clear_g4vertex_id() {}
102  virtual const VertexIdSet& g4vertex_ids() const = 0;
103 
104  virtual bool empty_g4hit_id() const { return true; }
105  virtual size_t size_g4hit_id() const { return 0; }
106  virtual void add_g4hit_id(int /*volume*/, PHG4HitDefs::keytype /*id*/) {}
107  virtual HitIdIter begin_g4hit_id();
108  virtual HitIdConstIter begin_g4hit_id() const;
109  virtual HitIdIter find_g4hit_id(int /*volume*/);
110  virtual HitIdConstIter find_g4hit_id(int /*volume*/) const;
111  virtual HitIdIter end_g4hit_id();
112  virtual HitIdConstIter end_g4hit_id() const;
113  virtual size_t remove_g4hit_id(int /*volume*/, PHG4HitDefs::keytype /*id*/) { return 0; }
114  virtual size_t remove_g4hit_volume(int /*volume*/) { return 0; }
115  virtual void clear_g4hit_id() {}
116  virtual const HitIdMap& g4hit_ids() const = 0;
117 
118  protected:
120 
121  private:
123 };
124 
125 
130 
131 inline bool operator==(const PHG4Shower& lhs, const PHG4Shower& rhs)
132 {
133  return lhs.get_id() == rhs.get_id() &&
136  lhs.get_x() == rhs.get_x() &&
137  lhs.get_y() == rhs.get_y() &&
138  lhs.get_z() == rhs.get_z() &&
139  lhs.g4particle_ids() == rhs.g4particle_ids() &&
140  lhs.g4vertex_ids() == rhs.g4vertex_ids() &&
141  lhs.g4hit_ids() == rhs.g4hit_ids();
142 }
143 
144 inline bool operator!=(const PHG4Shower& lhs, const PHG4Shower& rhs) { return !(lhs == rhs); }
146 
147 #endif