00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef BesEmcHit_h
00012 #define BesEmcHit_h 1
00013
00014 #include "G4VHit.hh"
00015 #include "G4THitsCollection.hh"
00016 #include "G4Allocator.hh"
00017 #include "G4ThreeVector.hh"
00018 #include "Identifier/Identifier.h"
00019 #include <map>
00020
00021
00022
00023 class BesEmcHit : public G4VHit
00024 {
00025 public:
00026
00027 BesEmcHit();
00028 ~BesEmcHit();
00029 BesEmcHit(const BesEmcHit&);
00030 const BesEmcHit& operator=(const BesEmcHit&);
00031 int operator==(const BesEmcHit&) const;
00032
00033 inline void* operator new(size_t);
00034 inline void operator delete(void*);
00035
00036 void Draw();
00037 void Print(G4int);
00038 void Print();
00039
00040 public:
00041
00042 void AddCrystal(G4double de, G4double dl) {TotalEdepCrystal += de; TotalTrackLengthCrystal += dl;};
00043
00044 void SetEdepCrystal(G4double de) {EdepCrystal=de;};
00045 void SetEdepCasing(G4double de) {EdepCasing=de;};
00046 void SetTrakCrystal(G4double dl){TrackLengthCrystal=dl;};
00047 void SetPosCrystal(G4ThreeVector position){PositionCrystal=position;};
00048 void SetTimeCrystal(G4double t){TimeCrystal=t;};
00049 void SetNumCrystal(G4int id,G4int numTheta,G4int numPhi){PartId=id;NumTheta=numTheta;NumPhi=numPhi;};
00050 void SetTrackIndex(G4int index) { trackIndex = index;}
00051 void SetG4Index(G4int index) { g4Index = index;}
00052 void SetMomentum(G4ThreeVector momen) {momentum = momen;}
00053
00054 G4double GetTotalEdepCrystal() { return TotalEdepCrystal; };
00055 G4double GetTotalTrakCrystal() { return TotalTrackLengthCrystal; };
00056 G4double GetEdepCrystal() { return EdepCrystal; };
00057 G4double GetEdepCasing() { return EdepCasing; };
00058 G4double GetTrakCrystal() { return TrackLengthCrystal; };
00059 G4ThreeVector GetPosCrystal() { return PositionCrystal;};
00060 G4double GetTimeCrystal() {return TimeCrystal;};
00061 G4int GetPartId() {return PartId;};
00062 G4int GetNumThetaCrystal() {return NumTheta;};
00063 G4int GetNumPhiCrystal() {return NumPhi;};
00064 G4int GetTrackIndex() {return trackIndex;}
00065 G4int GetG4Index() {return g4Index;}
00066 G4ThreeVector GetMomentum() {return momentum;}
00067
00068 private:
00069
00070 G4double TotalEdepCrystal, TotalTrackLengthCrystal;
00071 G4double EdepCrystal,TrackLengthCrystal;
00072 G4double EdepCasing;
00073 G4ThreeVector PositionCrystal;
00074 G4double TimeCrystal;
00075 G4int PartId,NumTheta,NumPhi;
00076 G4int trackIndex;
00077 G4int g4Index;
00078 G4ThreeVector momentum;
00079 };
00080
00081
00082
00083 typedef G4THitsCollection<BesEmcHit> BesEmcHitsCollection;
00084
00085 extern G4Allocator<BesEmcHit> BesEmcHitAllocator;
00086
00087
00088
00089 inline void* BesEmcHit::operator new(size_t)
00090 {
00091 void* aHit;
00092 aHit = (void*) BesEmcHitAllocator.MallocSingle();
00093 return aHit;
00094 }
00095
00096
00097
00098 inline void BesEmcHit::operator delete(void* aHit)
00099 {
00100 BesEmcHitAllocator.FreeSingle((BesEmcHit*) aHit);
00101 }
00102
00103
00104
00105 class BesEmcTruthHit : public G4VHit
00106 {
00107 public:
00108
00109 BesEmcTruthHit();
00110 virtual ~BesEmcTruthHit();
00111
00112 BesEmcTruthHit(const BesEmcTruthHit&);
00113 const BesEmcTruthHit& operator=(const BesEmcTruthHit&);
00114
00115 G4int operator==(const BesEmcTruthHit&) const;
00116 inline void* operator new(size_t);
00117 inline void operator delete(void*);
00118
00119 void Print();
00120
00121 public:
00122
00123 inline void SetIdentify(Identifier id) { m_identify=id; }
00124 inline void SetTrackIndex(G4int index) { m_trackIndex=index; }
00125 inline void SetG4TrackId(G4int trackId) { m_g4TrackId=trackId; }
00126 inline void SetHitEmc(G4int is) { m_hitEmc=is; }
00127 inline void SetPDGCode(G4int code) {m_PDGCode=code;}
00128 inline void SetPDGCharge(G4double charge) {m_PDGCharge = charge;}
00129 inline void SetParticleName(G4String name) {m_particleName=name;}
00130 inline void SetEDep(G4double de) { m_edep=de; }
00131 inline void SetTime(G4double time) { m_time=time; }
00132 inline void SetMomentum(G4ThreeVector p) { m_momentum=p; }
00133 inline void SetPosition(G4ThreeVector pos) { m_position=pos; }
00134
00135 Identifier GetIdentify() const { return m_identify; }
00136 G4int GetTrackIndex() const { return m_trackIndex; }
00137 G4int GetG4TrackId() const { return m_g4TrackId; }
00138 G4int GetHitEmc() const { return m_hitEmc; }
00139 G4int GetPDGCode() const {return m_PDGCode;}
00140 G4double GetPDGCharge() const {return m_PDGCharge;}
00141 G4String GetParticleName() const {return m_particleName;}
00142 G4double GetEDep() const { return m_edep; }
00143 G4double GetTime() const { return m_time; }
00144 G4ThreeVector GetMomentum() const { return m_momentum; }
00145 G4ThreeVector GetPosition() const { return m_position; }
00146
00147 std::map<Identifier,G4double>::const_iterator Begin() const;
00148 std::map<Identifier,G4double>::const_iterator End() const;
00149 std::map<Identifier,G4double>::const_iterator Find(Identifier) const;
00150
00151 G4double GetEHit(Identifier);
00152 void AddEHit(Identifier,G4double);
00153 void Insert(Identifier,G4double);
00154 G4int Size() const;
00155
00156 private:
00157
00158
00159 Identifier m_identify;
00160
00161 G4int m_trackIndex;
00162
00163 G4int m_g4TrackId;
00164
00165 G4int m_hitEmc;
00166
00167 G4int m_PDGCode;
00168
00169 G4double m_PDGCharge;
00170
00171 G4String m_particleName;
00172
00173 G4double m_edep;
00174 G4double m_time;
00175 G4ThreeVector m_momentum;
00176 G4ThreeVector m_position;
00177 std::map<Identifier,G4double> m_hitMap;
00178
00179 };
00180
00181 typedef G4THitsCollection<BesEmcTruthHit> BesEmcTruthHitsCollection;
00182
00183 extern G4Allocator<BesEmcTruthHit> BesEmcTruthHitAllocator;
00184
00185
00186
00187 inline void* BesEmcTruthHit::operator new(size_t)
00188 {
00189 void* aHit;
00190 aHit = (void*) BesEmcTruthHitAllocator.MallocSingle();
00191 return aHit;
00192 }
00193
00194 inline void BesEmcTruthHit::operator delete(void* aHit)
00195 {
00196 BesEmcTruthHitAllocator.FreeSingle((BesEmcTruthHit*) aHit);
00197 }
00198
00199 #endif