BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
BesEmcHit.hh
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2// BOOST --- BESIII Object_Oreiented Simulation Tool //
3//---------------------------------------------------------------------------//
4//Descpirtion: EMC detector
5//Author: Fu Chengdong
6//Created: Sep 4, 2003
7//Modified: He Miao, Jul 18th, 2006
8//Comment:
9//---------------------------------------------------------------------------//
10//
11#ifndef BesEmcHit_h
12#define BesEmcHit_h 1
13
14#include "G4VHit.hh"
15#include "G4THitsCollection.hh"
16#include "G4Allocator.hh"
17#include "G4ThreeVector.hh"
19#include <map>
20
21//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
22
23class BesEmcHit : public G4VHit
24{
25 public:
26
27 BesEmcHit();
28 ~BesEmcHit();
29 BesEmcHit(const BesEmcHit&);
30 const BesEmcHit& operator=(const BesEmcHit&);
31 int operator==(const BesEmcHit&) const;
32
33 inline void* operator new(size_t);
34 inline void operator delete(void*);
35
36 void Draw();
37 void Print(G4int);
38 void Print();
39
40 public:
41
42 void AddCrystal(G4double de, G4double dl) {TotalEdepCrystal += de; TotalTrackLengthCrystal += dl;};
43
44 void SetEdepCrystal(G4double de) {EdepCrystal=de;};
45 void SetEdepCasing(G4double de) {EdepCasing=de;};
46 void SetTrakCrystal(G4double dl){TrackLengthCrystal=dl;};
47 void SetPosCrystal(G4ThreeVector position){PositionCrystal=position;};
48 void SetTimeCrystal(G4double t){TimeCrystal=t;};
49 void SetNumCrystal(G4int id,G4int numTheta,G4int numPhi){PartId=id;NumTheta=numTheta;NumPhi=numPhi;};
50 void SetTrackIndex(G4int index) { trackIndex = index;}
51 void SetG4Index(G4int index) { g4Index = index;}
52 void SetMomentum(G4ThreeVector momen) {momentum = momen;}
53
54 G4double GetTotalEdepCrystal() { return TotalEdepCrystal; };
55 G4double GetTotalTrakCrystal() { return TotalTrackLengthCrystal; };
56 G4double GetEdepCrystal() { return EdepCrystal; };
57 G4double GetEdepCasing() { return EdepCasing; };
58 G4double GetTrakCrystal() { return TrackLengthCrystal; };
59 G4ThreeVector GetPosCrystal() { return PositionCrystal;};
60 G4double GetTimeCrystal() {return TimeCrystal;};
61 G4int GetPartId() {return PartId;};
62 G4int GetNumThetaCrystal() {return NumTheta;};
63 G4int GetNumPhiCrystal() {return NumPhi;};
64 G4int GetTrackIndex() {return trackIndex;}
65 G4int GetG4Index() {return g4Index;}
66 G4ThreeVector GetMomentum() {return momentum;}
67
68 private:
69
70 G4double TotalEdepCrystal, TotalTrackLengthCrystal;
71 G4double EdepCrystal,TrackLengthCrystal;
72 G4double EdepCasing;
73 G4ThreeVector PositionCrystal;
74 G4double TimeCrystal;
75 G4int PartId,NumTheta,NumPhi;
76 G4int trackIndex;
77 G4int g4Index;
78 G4ThreeVector momentum;
79};
80
81//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
82
83typedef G4THitsCollection<BesEmcHit> BesEmcHitsCollection;
84
85extern G4Allocator<BesEmcHit> BesEmcHitAllocator;
86
87//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
88
89inline void* BesEmcHit::operator new(size_t)
90{
91 void* aHit;
92 aHit = (void*) BesEmcHitAllocator.MallocSingle();
93 return aHit;
94}
95
96//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
97
98inline void BesEmcHit::operator delete(void* aHit)
99{
100 BesEmcHitAllocator.FreeSingle((BesEmcHit*) aHit);
101}
102
103//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104
105class BesEmcTruthHit : public G4VHit
106{
107 public:
108
110 virtual ~BesEmcTruthHit();
111
114
115 G4int operator==(const BesEmcTruthHit&) const;
116 inline void* operator new(size_t);
117 inline void operator delete(void*);
118
119 void Print();
120
121 public:
122
123 inline void SetIdentify(Identifier id) { m_identify=id; }
124 inline void SetTrackIndex(G4int index) { m_trackIndex=index; }
125 inline void SetG4TrackId(G4int trackId) { m_g4TrackId=trackId; }
126 inline void SetHitEmc(G4int is) { m_hitEmc=is; }
127 inline void SetPDGCode(G4int code) {m_PDGCode=code;}
128 inline void SetPDGCharge(G4double charge) {m_PDGCharge = charge;}
129 inline void SetParticleName(G4String name) {m_particleName=name;}
130 inline void SetEDep(G4double de) { m_edep=de; }
131 inline void SetTime(G4double time) { m_time=time; }
132 inline void SetMomentum(G4ThreeVector p) { m_momentum=p; }
133 inline void SetPosition(G4ThreeVector pos) { m_position=pos; }
134
135 Identifier GetIdentify() const { return m_identify; }
136 G4int GetTrackIndex() const { return m_trackIndex; }
137 G4int GetG4TrackId() const { return m_g4TrackId; }
138 G4int GetHitEmc() const { return m_hitEmc; }
139 G4int GetPDGCode() const {return m_PDGCode;}
140 G4double GetPDGCharge() const {return m_PDGCharge;}
141 G4String GetParticleName() const {return m_particleName;}
142 G4double GetEDep() const { return m_edep; }
143 G4double GetTime() const { return m_time; }
144 G4ThreeVector GetMomentum() const { return m_momentum; }
145 G4ThreeVector GetPosition() const { return m_position; }
146
147 std::map<Identifier,G4double>::const_iterator Begin() const;
148 std::map<Identifier,G4double>::const_iterator End() const;
149 std::map<Identifier,G4double>::const_iterator Find(Identifier) const;
150
151 G4double GetEHit(Identifier);
152 void AddEHit(Identifier,G4double);
153 void Insert(Identifier,G4double);
154 G4int Size() const;
155
156 private:
157
158 //hit crystal id
159 Identifier m_identify;
160 //track index
161 G4int m_trackIndex;
162 //G4 Track Id
163 G4int m_g4TrackId;
164 //whether hit Emc
165 G4int m_hitEmc;
166 //particle ID
167 G4int m_PDGCode;
168 //particle charge;
169 G4double m_PDGCharge;
170 //particle name
171 G4String m_particleName;
172 //total energy deposits
173 G4double m_edep;
174 G4double m_time;
175 G4ThreeVector m_momentum;
176 G4ThreeVector m_position;
177 std::map<Identifier,G4double> m_hitMap;
178
179};
180
181typedef G4THitsCollection<BesEmcTruthHit> BesEmcTruthHitsCollection;
182
183extern G4Allocator<BesEmcTruthHit> BesEmcTruthHitAllocator;
184
185//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
186
187inline void* BesEmcTruthHit::operator new(size_t)
188{
189 void* aHit;
190 aHit = (void*) BesEmcTruthHitAllocator.MallocSingle();
191 return aHit;
192}
193
194inline void BesEmcTruthHit::operator delete(void* aHit)
195{
196 BesEmcTruthHitAllocator.FreeSingle((BesEmcTruthHit*) aHit);
197}
198
199#endif
G4Allocator< BesEmcTruthHit > BesEmcTruthHitAllocator
Definition: BesEmcHit.cc:17
G4THitsCollection< BesEmcTruthHit > BesEmcTruthHitsCollection
Definition: BesEmcHit.hh:181
G4Allocator< BesEmcHit > BesEmcHitAllocator
Definition: BesEmcHit.cc:16
G4THitsCollection< BesEmcHit > BesEmcHitsCollection
Definition: BesEmcHit.hh:83
Double_t time
void SetNumCrystal(G4int id, G4int numTheta, G4int numPhi)
Definition: BesEmcHit.hh:49
G4double GetTotalEdepCrystal()
Definition: BesEmcHit.hh:54
G4double GetTimeCrystal()
Definition: BesEmcHit.hh:60
void SetEdepCrystal(G4double de)
Definition: BesEmcHit.hh:44
void SetEdepCasing(G4double de)
Definition: BesEmcHit.hh:45
G4int GetG4Index()
Definition: BesEmcHit.hh:65
void Draw()
Definition: BesEmcHit.cc:88
G4int GetNumPhiCrystal()
Definition: BesEmcHit.hh:63
void SetMomentum(G4ThreeVector momen)
Definition: BesEmcHit.hh:52
G4ThreeVector GetPosCrystal()
Definition: BesEmcHit.hh:59
~BesEmcHit()
Definition: BesEmcHit.cc:40
G4double GetEdepCrystal()
Definition: BesEmcHit.hh:56
G4int GetTrackIndex()
Definition: BesEmcHit.hh:64
G4ThreeVector GetMomentum()
Definition: BesEmcHit.hh:66
void SetPosCrystal(G4ThreeVector position)
Definition: BesEmcHit.hh:47
int operator==(const BesEmcHit &) const
Definition: BesEmcHit.cc:81
G4int GetNumThetaCrystal()
Definition: BesEmcHit.hh:62
G4double GetTotalTrakCrystal()
Definition: BesEmcHit.hh:55
void AddCrystal(G4double de, G4double dl)
Definition: BesEmcHit.hh:42
void SetTimeCrystal(G4double t)
Definition: BesEmcHit.hh:48
void Print()
Definition: BesEmcHit.cc:107
void SetTrakCrystal(G4double dl)
Definition: BesEmcHit.hh:46
void SetG4Index(G4int index)
Definition: BesEmcHit.hh:51
const BesEmcHit & operator=(const BesEmcHit &)
Definition: BesEmcHit.cc:63
G4int GetPartId()
Definition: BesEmcHit.hh:61
G4double GetTrakCrystal()
Definition: BesEmcHit.hh:58
G4double GetEdepCasing()
Definition: BesEmcHit.hh:57
void SetTrackIndex(G4int index)
Definition: BesEmcHit.hh:50
void SetIdentify(Identifier id)
Definition: BesEmcHit.hh:123
G4int GetTrackIndex() const
Definition: BesEmcHit.hh:136
void SetHitEmc(G4int is)
Definition: BesEmcHit.hh:126
G4int GetHitEmc() const
Definition: BesEmcHit.hh:138
void SetMomentum(G4ThreeVector p)
Definition: BesEmcHit.hh:132
void SetPosition(G4ThreeVector pos)
Definition: BesEmcHit.hh:133
G4ThreeVector GetPosition() const
Definition: BesEmcHit.hh:145
void AddEHit(Identifier, G4double)
Definition: BesEmcHit.cc:197
void SetPDGCode(G4int code)
Definition: BesEmcHit.hh:127
G4double GetTime() const
Definition: BesEmcHit.hh:143
void SetTrackIndex(G4int index)
Definition: BesEmcHit.hh:124
std::map< Identifier, G4double >::const_iterator End() const
Definition: BesEmcHit.cc:182
std::map< Identifier, G4double >::const_iterator Find(Identifier) const
Definition: BesEmcHit.cc:187
const BesEmcTruthHit & operator=(const BesEmcTruthHit &)
Definition: BesEmcHit.cc:137
void Insert(Identifier, G4double)
Definition: BesEmcHit.cc:202
G4double GetPDGCharge() const
Definition: BesEmcHit.hh:140
G4int operator==(const BesEmcTruthHit &) const
void SetG4TrackId(G4int trackId)
Definition: BesEmcHit.hh:125
G4double GetEDep() const
Definition: BesEmcHit.hh:142
G4int GetG4TrackId() const
Definition: BesEmcHit.hh:137
void SetEDep(G4double de)
Definition: BesEmcHit.hh:130
G4double GetEHit(Identifier)
Definition: BesEmcHit.cc:192
G4String GetParticleName() const
Definition: BesEmcHit.hh:141
std::map< Identifier, G4double >::const_iterator Begin() const
Definition: BesEmcHit.cc:177
G4int GetPDGCode() const
Definition: BesEmcHit.hh:139
G4ThreeVector GetMomentum() const
Definition: BesEmcHit.hh:144
void SetParticleName(G4String name)
Definition: BesEmcHit.hh:129
virtual ~BesEmcTruthHit()
Definition: BesEmcHit.cc:128
void SetTime(G4double time)
Definition: BesEmcHit.hh:131
G4int Size() const
Definition: BesEmcHit.cc:207
void SetPDGCharge(G4double charge)
Definition: BesEmcHit.hh:128
Identifier GetIdentify() const
Definition: BesEmcHit.hh:135
int t()
Definition: t.c:1