EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4Showerv1.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4Showerv1.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4MAIN_PHG4SHOWERV1_H
4 #define G4MAIN_PHG4SHOWERV1_H
5 
6 #include "PHG4Shower.h"
7 
8 #include "PHG4HitDefs.h"
9 
10 #include <cstddef> // for size_t
11 #include <iostream>
12 #include <map>
13 #include <set>
14 
15 class PHG4Showerv1 : public PHG4Shower
16 {
17  public:
18  PHG4Showerv1();
19  ~PHG4Showerv1() override {}
20 
21  // PHObject virtual overloads
22 
23  void identify(std::ostream& os = std::cout) const override;
24  PHG4Shower* CloneMe() const override { return (new PHG4Showerv1(*this)); }
25  void Reset() override { *this = PHG4Showerv1(); }
26  int isValid() const override;
27 
28  // shower info
29 
30  int get_id() const override { return _id; }
31  void set_id(int id) override { _id = id; }
32 
33  int get_parent_particle_id() const override { return _parent_particle_id; }
34  void set_parent_particle_id(int parent_particle_id) override { _parent_particle_id = parent_particle_id; }
35 
36  int get_parent_shower_id() const override { return _parent_shower_id; }
37  void set_parent_shower_id(int parent_shower_id) override { _parent_shower_id = parent_shower_id; }
38 
39  float get_x() const override { return _pos[0]; }
40  void set_x(float x) override { _pos[0] = x; }
41 
42  float get_y() const override { return _pos[1]; }
43  void set_y(float y) override { _pos[1] = y; }
44 
45  float get_z() const override { return _pos[2]; }
46  void set_z(float z) override { _pos[2] = z; }
47 
48  float get_position(unsigned int coor) const override { return _pos[coor]; }
49  void set_position(unsigned int coor, float xi) override { _pos[coor] = xi; }
50 
51  float get_covar(unsigned int i, unsigned int j) const override;
52  void set_covar(unsigned int i, unsigned int j, float entry) override;
53 
54  unsigned int get_nhits(int volume) const override;
55  void set_nhits(int volume, unsigned int nhits) override { _nhits[volume] = nhits; }
56 
57  double get_edep() const override;
58  float get_edep(int volume) const override;
59  void set_edep(int volume, float edep) override { _edep[volume] = edep; }
60 
61  double get_eion() const override;
62  float get_eion(int volume) const override;
63  void set_eion(int volume, float eion) override { _eion[volume] = eion; }
64 
65  float get_light_yield(int volume) const override;
66  void set_light_yield(int volume, float light_yield) override { _light_yield[volume] = light_yield; }
67 
68  float get_eh_ratio(int volume) const override;
69  void set_eh_ratio(int volume, float eh_ratio) override { _eh_ratio[volume] = eh_ratio; }
70 
71  // container methods for ids
72  bool empty_g4particle_id() const override { return _g4particle_ids.empty(); }
73  size_t size_g4particle_id() const override { return _g4particle_ids.size(); }
74  void add_g4particle_id(int id) override { _g4particle_ids.insert(id); }
79  size_t remove_g4particle_id(int id) override { return _g4particle_ids.erase(id); }
80  void clear_g4particle_id() override { return _g4particle_ids.clear(); }
81  const ParticleIdSet& g4particle_ids() const override { return _g4particle_ids; }
82 
83  bool empty_g4vertex_id() const override { return _g4vertex_ids.empty(); }
84  size_t size_g4vertex_id() const override { return _g4vertex_ids.size(); }
85  void add_g4vertex_id(int id) override { _g4vertex_ids.insert(id); }
87  PHG4Shower::VertexIdConstIter begin_g4vertex_id() const override { return _g4vertex_ids.begin(); }
89  PHG4Shower::VertexIdConstIter end_g4vertex_id() const override { return _g4vertex_ids.end(); }
90  size_t remove_g4vertex_id(int id) override { return _g4vertex_ids.erase(id); }
91  void clear_g4vertex_id() override { return _g4vertex_ids.clear(); }
92  const VertexIdSet& g4vertex_ids() const override { return _g4vertex_ids; }
93 
94  bool empty_g4hit_id() const override { return _g4hit_ids.empty(); }
95  size_t size_g4hit_id() const override { return _g4hit_ids.size(); }
96  void add_g4hit_id(int volume, PHG4HitDefs::keytype id) override { _g4hit_ids[volume].insert(id); }
97  PHG4Shower::HitIdIter begin_g4hit_id() override { return _g4hit_ids.begin(); }
98  PHG4Shower::HitIdConstIter begin_g4hit_id() const override { return _g4hit_ids.begin(); }
99  PHG4Shower::HitIdIter find_g4hit_id(int volume) override { return _g4hit_ids.find(volume); }
100  PHG4Shower::HitIdConstIter find_g4hit_id(int volume) const override { return _g4hit_ids.find(volume); }
101  PHG4Shower::HitIdIter end_g4hit_id() override { return _g4hit_ids.end(); }
102  PHG4Shower::HitIdConstIter end_g4hit_id() const override { return _g4hit_ids.end(); }
103  size_t remove_g4hit_id(int volume, PHG4HitDefs::keytype id) override { return _g4hit_ids[volume].erase(id); }
104  size_t remove_g4hit_volume(int volume) override { return _g4hit_ids.erase(volume); }
105  void clear_g4hit_id() override { return _g4hit_ids.clear(); }
106  const HitIdMap& g4hit_ids() const override { return _g4hit_ids; }
107 
108  private:
109  unsigned int covar_index(unsigned int i, unsigned int j) const;
110 
111  int _id; //< unique identifier within container
112  int _parent_particle_id; //< association of shower to parent particle id
113  int _parent_shower_id; //< association of shower to parent shower id
114  float _pos[3]; //< mean position of the shower hits
115  float _covar[6]; //< covariance of shower hits
116  std::map<int, unsigned int> _nhits; //< number of hits in different volumes
117  std::map<int, float> _edep; //< energy deposit in different volumes
118  std::map<int, float> _eion; //< ionization energy in different volumes
119  std::map<int, float> _light_yield; //< light yield in different volumes
120  std::map<int, float> _eh_ratio; //< electron/hadron ratio of energy in different volumes
121 
122  // these containers are cleared during dst reduction, but are available in full dsts
123  ParticleIdSet _g4particle_ids; //< contained secondary particle ids
124  VertexIdSet _g4vertex_ids; //< contained secondary vertex ids
125  HitIdMap _g4hit_ids; //< contained hit ids
126 
128 };
129 
130 #endif