BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
BesEmcHit.cc
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//Comment:
8//---------------------------------------------------------------------------//
9//
10#include "BesEmcHit.hh"
11
12#include "G4UnitsTable.hh"
13#include "G4ios.hh"
14#include <iomanip>
15
16G4Allocator<BesEmcHit> BesEmcHitAllocator;
17G4Allocator<BesEmcTruthHit> BesEmcTruthHitAllocator;
18
19using namespace std;
20
21//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
22
24{
25 TotalEdepCrystal = 0.; TotalTrackLengthCrystal = 0.;
26 EdepCrystal = 0.; TrackLengthCrystal = 0.;
27 EdepCasing = 0.;
28 PositionCrystal= G4ThreeVector(0,0,0);
29 TimeCrystal=0.;
30 PartId=0;
31 NumTheta=0;
32 NumPhi=0;
33 trackIndex=0;
34 g4Index=0;
35 momentum = G4ThreeVector(0,0,0);
36}
37
38//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
39
41{}
42
43//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44
46 : G4VHit()
47{
48 EdepCrystal = right.EdepCrystal;
49 TrackLengthCrystal = right.TrackLengthCrystal;
50 EdepCasing = right.EdepCasing;
51 PositionCrystal= right.PositionCrystal;
52 TimeCrystal = right.TimeCrystal;
53 PartId = right.PartId;
54 NumTheta = right.NumTheta;
55 NumPhi = right.NumPhi;
56 trackIndex = right.trackIndex;
57 g4Index = right.g4Index;
58 momentum = right.momentum;
59}
60
61//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62
64{
65 EdepCrystal = right.EdepCrystal;
66 TrackLengthCrystal = right.TrackLengthCrystal;
67 EdepCasing = right.EdepCasing;
68 PositionCrystal= right.PositionCrystal;
69 TimeCrystal = right.TimeCrystal;
70 PartId = right.PartId;
71 NumTheta = right.NumTheta;
72 NumPhi = right.NumPhi;
73 trackIndex = right.trackIndex;
74 g4Index = right.g4Index;
75 momentum = right.momentum;
76 return *this;
77}
78
79//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80
81int BesEmcHit::operator==(const BesEmcHit& right) const
82{
83 return (this==&right) ? 1 : 0;
84}
85
86//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
87
89{}
90
91//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
92
93void BesEmcHit::Print(G4int verboseLevel)
94{
95 if(verboseLevel>0)
96 G4cout << "Hit in crystal:" <<NumTheta<<","<<NumPhi<<G4endl
97 <<"Energy deposited:"<<G4BestUnit(EdepCrystal,"Energy") <<G4endl;
98 if(verboseLevel>1)
99 G4cout <<"Hit time :"<<G4BestUnit(TimeCrystal,"Time")<<G4endl
100 <<" position :"<<G4BestUnit(PositionCrystal,"Length")<<G4endl;
101 if(verboseLevel>2)
102 G4cout <<"Track length :"<<G4BestUnit(TrackLengthCrystal,"Length")<<G4endl;
103
104
105}
106
108{
109 G4cout<<"time: "<<TimeCrystal<<" edep: "<<EdepCrystal<<G4endl;
110}
111//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
112
114{
115 m_trackIndex = -1;
116 m_g4TrackId = -1;
117 m_hitEmc = -1;
118 m_PDGCode = 0;
119 m_PDGCharge = 0;
120 m_particleName = G4String();
121 m_edep = 0;
122 m_time = 0;
123 m_momentum = G4ThreeVector(0,0,0);
124 m_position = G4ThreeVector(0,0,0);
125 m_hitMap.clear();
126}
127
129{}
130
132 : G4VHit()
133{
134 *this = right;
135}
136
138{
139 m_hitMap.clear();
140 std::map<Identifier,G4double>::const_iterator iHitMap;
141 if(this!=&right) {
142 for(iHitMap=right.Begin();
143 iHitMap!=right.End();
144 iHitMap++) {
145 Insert(iHitMap->first,iHitMap->second);
146 }
147
148 m_identify = right.m_identify;
149 m_trackIndex = right.m_trackIndex;
150 m_g4TrackId = right.m_g4TrackId;
151 m_hitEmc = right.m_hitEmc;
152 m_PDGCode = right.m_PDGCode;
153 m_PDGCharge = right.m_PDGCharge;
154 m_particleName = right.m_particleName;
155 m_edep = right.m_edep;
156 m_time = right.m_time;
157 m_momentum = right.m_momentum;
158 m_position = right.m_position;
159 }
160
161 return *this;
162}
163
165{
166 G4cout<<"Id: "<<m_identify<<"\tTrack Index: "<<m_trackIndex<<"\tG4 Track Id: "<<m_g4TrackId
167 <<"\tHit Emc: "<<m_hitEmc<<"\tTotal Energy: "<<m_edep
168 <<"\nPDGCode: "<<m_PDGCode<<"\tCharge: "<<m_PDGCharge<<"\tParticle Name: "<<m_particleName
169 <<"\nGloble Time: "<<m_time<<"\tMomentum: "<<m_momentum.mag()<<"\tPosition: "<<m_position<<G4endl;
170
171 std::map<Identifier,G4double>::iterator iHitMap;
172 for(iHitMap=m_hitMap.begin();iHitMap!=m_hitMap.end();iHitMap++) {
173 G4cout<<iHitMap->first<<"\t"<<iHitMap->second<<G4endl;
174 }
175}
176
177std::map<Identifier,G4double>::const_iterator BesEmcTruthHit::Begin() const
178{
179 return m_hitMap.begin();
180}
181
182std::map<Identifier,G4double>::const_iterator BesEmcTruthHit::End() const
183{
184 return m_hitMap.end();
185}
186
187std::map<Identifier,G4double>::const_iterator BesEmcTruthHit::Find(Identifier id) const
188{
189 return m_hitMap.find(id);
190}
191
193{
194 return m_hitMap[id];
195}
196
198{
199 if(energy>0) m_hitMap[id]+=energy;
200}
201
203{
204 if(energy>0) m_hitMap[id]=energy;
205}
206
208{
209 return m_hitMap.size();
210}
G4Allocator< BesEmcTruthHit > BesEmcTruthHitAllocator
Definition: BesEmcHit.cc:17
G4Allocator< BesEmcHit > BesEmcHitAllocator
Definition: BesEmcHit.cc:16
************Class m_ypar INTEGER m_KeyWgt INTEGER m_KeyIHVP INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
Definition: KK2f.h:50
void Draw()
Definition: BesEmcHit.cc:88
~BesEmcHit()
Definition: BesEmcHit.cc:40
int operator==(const BesEmcHit &) const
Definition: BesEmcHit.cc:81
void Print()
Definition: BesEmcHit.cc:107
const BesEmcHit & operator=(const BesEmcHit &)
Definition: BesEmcHit.cc:63
void AddEHit(Identifier, G4double)
Definition: BesEmcHit.cc:197
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 GetEHit(Identifier)
Definition: BesEmcHit.cc:192
std::map< Identifier, G4double >::const_iterator Begin() const
Definition: BesEmcHit.cc:177
virtual ~BesEmcTruthHit()
Definition: BesEmcHit.cc:128
G4int Size() const
Definition: BesEmcHit.cc:207