File indexing completed on 2025-08-05 08:18:10
0001
0002
0003 #ifndef G4MAIN_PHG4SHOWER_H
0004 #define G4MAIN_PHG4SHOWER_H
0005
0006 #include "PHG4HitDefs.h"
0007
0008 #include <phool/PHObject.h>
0009
0010 #include <cmath> // for NAN def
0011 #include <iostream>
0012 #include <map>
0013 #include <set>
0014
0015 class PHG4Shower : public PHObject
0016 {
0017 public:
0018 typedef std::set<int> ParticleIdSet;
0019 typedef ParticleIdSet::iterator ParticleIdIter;
0020 typedef ParticleIdSet::const_iterator ParticleIdConstIter;
0021
0022 typedef std::set<int> VertexIdSet;
0023 typedef VertexIdSet::iterator VertexIdIter;
0024 typedef VertexIdSet::const_iterator VertexIdConstIter;
0025
0026 typedef std::map<int, std::set<PHG4HitDefs::keytype> > HitIdMap;
0027 typedef HitIdMap::iterator HitIdIter;
0028 typedef HitIdMap::const_iterator HitIdConstIter;
0029
0030 ~PHG4Shower() override {}
0031
0032
0033
0034 void identify(std::ostream& os = std::cout) const override { os << "PHG4Shower base class" << std::endl; }
0035 PHG4Shower* CloneMe() const override { return nullptr; }
0036 void Reset() override {}
0037 int isValid() const override { return 0; }
0038
0039
0040
0041 virtual int get_id() const { return 0; }
0042 virtual void set_id(int ) {}
0043
0044 virtual int get_parent_particle_id() const { return 0; }
0045 virtual void set_parent_particle_id(int ) {}
0046
0047 virtual int get_parent_shower_id() const { return 0; }
0048 virtual void set_parent_shower_id(int ) {}
0049
0050 virtual float get_x() const { return NAN; }
0051 virtual void set_x(float) {}
0052
0053 virtual float get_y() const { return NAN; }
0054 virtual void set_y(float) {}
0055
0056 virtual float get_z() const { return NAN; }
0057 virtual void set_z(float) {}
0058
0059 virtual float get_position(unsigned int ) const { return NAN; }
0060 virtual void set_position(unsigned int , float ) {}
0061
0062 virtual float get_covar(unsigned int , unsigned int ) const { return NAN; }
0063 virtual void set_covar(unsigned int , unsigned int , float ) {}
0064
0065 virtual unsigned int get_nhits(int ) const { return 0; }
0066 virtual void set_nhits(int , unsigned int ) {}
0067
0068 virtual double get_edep() const { return NAN; }
0069 virtual float get_edep(int ) const { return NAN; }
0070 virtual void set_edep(int , float ) {}
0071
0072 virtual double get_eion() const { return NAN; }
0073 virtual float get_eion(int ) const { return NAN; }
0074 virtual void set_eion(int , float ) {}
0075
0076 virtual float get_light_yield(int ) const { return NAN; }
0077 virtual void set_light_yield(int , float ) {}
0078
0079 virtual float get_eh_ratio(int ) const { return NAN; }
0080 virtual void set_eh_ratio(int , float ) {}
0081
0082 virtual bool empty_g4particle_id() const { return true; }
0083 virtual size_t size_g4particle_id() const { return 0; }
0084 virtual void add_g4particle_id(int ) {}
0085 virtual ParticleIdIter begin_g4particle_id();
0086 virtual ParticleIdConstIter begin_g4particle_id() const;
0087 virtual ParticleIdIter end_g4particle_id();
0088 virtual ParticleIdConstIter end_g4particle_id() const;
0089 virtual size_t remove_g4particle_id(int ) { return 0; }
0090 virtual void clear_g4particle_id() {}
0091 virtual const ParticleIdSet& g4particle_ids() const = 0;
0092
0093 virtual bool empty_g4vertex_id() const { return true; }
0094 virtual size_t size_g4vertex_id() const { return 0; }
0095 virtual void add_g4vertex_id(int ) {}
0096 virtual VertexIdIter begin_g4vertex_id();
0097 virtual VertexIdConstIter begin_g4vertex_id() const;
0098 virtual VertexIdIter end_g4vertex_id();
0099 virtual VertexIdConstIter end_g4vertex_id() const;
0100 virtual size_t remove_g4vertex_id(int ) { return 0; }
0101 virtual void clear_g4vertex_id() {}
0102 virtual const VertexIdSet& g4vertex_ids() const = 0;
0103
0104 virtual bool empty_g4hit_id() const { return true; }
0105 virtual size_t size_g4hit_id() const { return 0; }
0106 virtual void add_g4hit_id(int , PHG4HitDefs::keytype ) {}
0107 virtual HitIdIter begin_g4hit_id();
0108 virtual HitIdConstIter begin_g4hit_id() const;
0109 virtual HitIdIter find_g4hit_id(int );
0110 virtual HitIdConstIter find_g4hit_id(int ) const;
0111 virtual HitIdIter end_g4hit_id();
0112 virtual HitIdConstIter end_g4hit_id() const;
0113 virtual size_t remove_g4hit_id(int , PHG4HitDefs::keytype ) { return 0; }
0114 virtual size_t remove_g4hit_volume(int ) { return 0; }
0115 virtual void clear_g4hit_id() {}
0116 virtual const HitIdMap& g4hit_ids() const = 0;
0117
0118 protected:
0119 PHG4Shower() {}
0120
0121 private:
0122 ClassDefOverride(PHG4Shower, 1);
0123 };
0124
0125
0126
0127
0128
0129
0130 inline bool operator==(const PHG4Shower& lhs, const PHG4Shower& rhs)
0131 {
0132 return lhs.get_id() == rhs.get_id() &&
0133 lhs.get_parent_particle_id() == rhs.get_parent_particle_id() &&
0134 lhs.get_parent_shower_id() == rhs.get_parent_shower_id() &&
0135 lhs.get_x() == rhs.get_x() &&
0136 lhs.get_y() == rhs.get_y() &&
0137 lhs.get_z() == rhs.get_z() &&
0138 lhs.g4particle_ids() == rhs.g4particle_ids() &&
0139 lhs.g4vertex_ids() == rhs.g4vertex_ids() &&
0140 lhs.g4hit_ids() == rhs.g4hit_ids();
0141 }
0142
0143 inline bool operator!=(const PHG4Shower& lhs, const PHG4Shower& rhs) { return !(lhs == rhs); }
0144
0145
0146 #endif