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