BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
KalFitReadGdml.cxx
Go to the documentation of this file.
1
2
3#include "G4Geo/MdcG4Geo.h"
4#include "G4Geo/BesG4Geo.h"
7#include "G4Material.hh"
8#include "G4Tubs.hh"
9#include "GDMLProcessor.hh"
10
11
13
14 int i(0);
15 double Z(0.),A(0.),Ionization(0.),Density(0.),Radlen(0.);
16
17 G4LogicalVolume *logicalMdc = 0;
18 MdcG4Geo* aMdcG4Geo = new MdcG4Geo();
19 logicalMdc = aMdcG4Geo->GetTopVolume();
20
21 /// mdcgas
22 G4Material* mdcMaterial = logicalMdc->GetMaterial();
23
24 for(i=0; i<mdcMaterial->GetElementVector()->size(); i++){
25 Z += (mdcMaterial->GetElement(i)->GetZ())*
26 (mdcMaterial->GetFractionVector()[i]);
27 A += (mdcMaterial->GetElement(i)->GetA())*
28 (mdcMaterial->GetFractionVector()[i]);
29 }
30 Ionization = mdcMaterial->GetIonisation()->GetMeanExcitationEnergy();
31 Density = mdcMaterial->GetDensity()/(g/cm3);
32 Radlen = mdcMaterial->GetRadlen();
33 std::cout<<"mdcgas: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
34 KalFitMaterial FitMdcMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
35 _BesKalmanFitMaterials.push_back(FitMdcMaterial);
36 KalFitTrack::mdcGasRadlen_ = Radlen/10.;
37
38 /// inner wall shield fiml1 Al by wangll 2012-09-07
39 G4LogicalVolume* innerWallFilm1Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("LogicalMdcInnerFilm1"));
40 G4Material* innerWallFilm1Material = innerWallFilm1Volume->GetMaterial();
41 G4Tubs* innerwallFilm1Tub = dynamic_cast<G4Tubs*>(innerWallFilm1Volume->GetSolid());
42
43 Z = 0.;
44 A = 0.;
45 for(i=0; i<innerWallFilm1Material->GetElementVector()->size(); i++){
46 Z += (innerWallFilm1Material->GetElement(i)->GetZ())*
47 (innerWallFilm1Material->GetFractionVector()[i]);
48 A += (innerWallFilm1Material->GetElement(i)->GetA())*
49 (innerWallFilm1Material->GetFractionVector()[i]);
50 }
51
52 Ionization = innerWallFilm1Material->GetIonisation()->GetMeanExcitationEnergy();
53 Density = innerWallFilm1Material->GetDensity()/(g/cm3);
54 Radlen = innerWallFilm1Material->GetRadlen();
55 std::cout<<"Mdc innerwall Film1, Al: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
56 KalFitMaterial FitInnerwallFilm1Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
57 _BesKalmanFitMaterials.push_back(FitInnerwallFilm1Material);
58
59
60 /// inner wall CarbonFiber by wll 2012-09-06
61 G4LogicalVolume* innerwallVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicalMdcSegment2"));
62 G4Material* innerwallMaterial = innerwallVolume->GetMaterial();
63 G4Tubs* innerwallTub = dynamic_cast<G4Tubs*>(innerwallVolume->GetSolid());
64
65 Z = 0.;
66 A = 0.;
67 for(i=0; i<innerwallMaterial->GetElementVector()->size(); i++){
68 Z += (innerwallMaterial->GetElement(i)->GetZ())*
69 (innerwallMaterial->GetFractionVector()[i]);
70 A += (innerwallMaterial->GetElement(i)->GetA())*
71 (innerwallMaterial->GetFractionVector()[i]);
72 }
73
74 Ionization = innerwallMaterial->GetIonisation()->GetMeanExcitationEnergy();
75 Density = innerwallMaterial->GetDensity()/(g/cm3);
76 Radlen = innerwallMaterial->GetRadlen();
77 std::cout<<"Mdc innerwall, Al: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
78 KalFitMaterial FitInnerwallMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
79 _BesKalmanFitMaterials.push_back(FitInnerwallMaterial);
80
81 /// inner wall shield film0 Al by wangll 2012-09-07
82 G4LogicalVolume* innerWallFilm0Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("LogicalMdcInnerFilm0"));
83 G4Material* innerWallFilm0Material = innerWallFilm0Volume->GetMaterial();
84 G4Tubs* innerwallFilm0Tub = dynamic_cast<G4Tubs*>(innerWallFilm0Volume->GetSolid());
85
86 Z = 0.;
87 A = 0.;
88 for(i=0; i<innerWallFilm0Material->GetElementVector()->size(); i++){
89 Z += (innerWallFilm0Material->GetElement(i)->GetZ())*
90 (innerWallFilm0Material->GetFractionVector()[i]);
91 A += (innerWallFilm0Material->GetElement(i)->GetA())*
92 (innerWallFilm0Material->GetFractionVector()[i]);
93 }
94
95 Ionization = innerWallFilm0Material->GetIonisation()->GetMeanExcitationEnergy();
96 Density = innerWallFilm0Material->GetDensity()/(g/cm3);
97 Radlen = innerWallFilm0Material->GetRadlen();
98 std::cout<<"Mdc innerwall Film0, Al: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
99 KalFitMaterial FitInnerwallFilm0Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
100 _BesKalmanFitMaterials.push_back(FitInnerwallFilm0Material);
101
102 ///////////////////////////////////////////////////////////////////////////////////////////////////
103 G4LogicalVolume *logicalBes = 0;
104 BesG4Geo* aBesG4Geo = new BesG4Geo();
105 logicalBes = aBesG4Geo->GetTopVolume();
106
107 /// air
108 G4LogicalVolume* logicalAirVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicalWorld"));
109 G4Material* airMaterial = logicalAirVolume->GetMaterial();
110 Z = 0.;
111 A = 0.;
112 for(i=0; i<airMaterial->GetElementVector()->size(); i++){
113 Z += (airMaterial->GetElement(i)->GetZ())*
114 (airMaterial->GetFractionVector()[i]);
115 A += (airMaterial->GetElement(i)->GetA())*
116 (airMaterial->GetFractionVector()[i]);
117 }
118
119 Ionization = airMaterial->GetIonisation()->GetMeanExcitationEnergy();
120 Density = airMaterial->GetDensity()/(g/cm3);
121 Radlen = airMaterial->GetRadlen();
122 std::cout<<"air: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
123 KalFitMaterial FitAirMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
124 _BesKalmanFitMaterials.push_back(FitAirMaterial);
125
126 /// outer beryllium pipe
127 G4LogicalVolume* logicalOuterBeVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicalouterBe"));
128 G4Material* outerBeMaterial = logicalOuterBeVolume->GetMaterial();
129
130 G4Tubs* outerBeTub = dynamic_cast<G4Tubs*>(logicalOuterBeVolume->GetSolid());
131 Z = 0.;
132 A = 0.;
133 for(i=0; i<outerBeMaterial->GetElementVector()->size(); i++){
134 Z += (outerBeMaterial->GetElement(i)->GetZ())*
135 (outerBeMaterial->GetFractionVector()[i]);
136 A += (outerBeMaterial->GetElement(i)->GetA())*
137 (outerBeMaterial->GetFractionVector()[i]);
138 }
139 Ionization = outerBeMaterial->GetIonisation()->GetMeanExcitationEnergy();
140 Density = outerBeMaterial->GetDensity()/(g/cm3);
141 Radlen = outerBeMaterial->GetRadlen();
142 std::cout<<"outer beryllium: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
143 KalFitMaterial FitOuterBeMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
144 _BesKalmanFitMaterials.push_back(FitOuterBeMaterial);
145
146
147 /// cooling oil
148 G4LogicalVolume* logicalOilLayerVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicaloilLayer"));
149 G4Material* oilLayerMaterial = logicalOilLayerVolume->GetMaterial();
150 G4Tubs* oilLayerTub = dynamic_cast<G4Tubs*>(logicalOilLayerVolume->GetSolid());
151
152 Z = 0.;
153 A = 0.;
154 for(i=0; i<oilLayerMaterial->GetElementVector()->size(); i++){
155 Z += (oilLayerMaterial->GetElement(i)->GetZ())*
156 (oilLayerMaterial->GetFractionVector()[i]);
157 A += (oilLayerMaterial->GetElement(i)->GetA())*
158 (oilLayerMaterial->GetFractionVector()[i]);
159 }
160 Ionization = oilLayerMaterial->GetIonisation()->GetMeanExcitationEnergy();
161 Density = oilLayerMaterial->GetDensity()/(g/cm3);
162 Radlen = oilLayerMaterial->GetRadlen();
163 std::cout<<"cooling oil: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
164 KalFitMaterial FitOilLayerMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
165 _BesKalmanFitMaterials.push_back(FitOilLayerMaterial);
166
167
168 /// inner beryllium pipe
169 G4LogicalVolume* logicalInnerBeVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicalinnerBe"));
170 G4Material* innerBeMaterial = logicalInnerBeVolume->GetMaterial();
171 G4Tubs* innerBeTub = dynamic_cast<G4Tubs*>(logicalInnerBeVolume->GetSolid());
172 Z = 0.;
173 A = 0.;
174 for(i=0; i<innerBeMaterial->GetElementVector()->size(); i++){
175 Z += (innerBeMaterial->GetElement(i)->GetZ())*
176 (innerBeMaterial->GetFractionVector()[i]);
177 A += (innerBeMaterial->GetElement(i)->GetA())*
178 (innerBeMaterial->GetFractionVector()[i]);
179 }
180
181 Ionization = innerBeMaterial->GetIonisation()->GetMeanExcitationEnergy();
182 Density = innerBeMaterial->GetDensity()/(g/cm3);
183 Radlen = innerBeMaterial->GetRadlen();
184 std::cout<<"inner beryllium: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
185 KalFitMaterial FitInnerBeMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
186 _BesKalmanFitMaterials.push_back(FitInnerBeMaterial);
187
188
189 /// gold
190 G4LogicalVolume* logicalGoldLayerVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicalgoldLayer"));
191 G4Material* goldLayerMaterial = logicalGoldLayerVolume->GetMaterial();
192 G4Tubs* goldLayerTub = dynamic_cast<G4Tubs*>(logicalGoldLayerVolume->GetSolid());
193
194 Z = 0.;
195 A = 0.;
196 for(i=0; i<goldLayerMaterial->GetElementVector()->size(); i++){
197 Z += (goldLayerMaterial->GetElement(i)->GetZ())*
198 (goldLayerMaterial->GetFractionVector()[i]);
199 A += (goldLayerMaterial->GetElement(i)->GetA())*
200 (goldLayerMaterial->GetFractionVector()[i]);
201 }
202 Ionization = goldLayerMaterial->GetIonisation()->GetMeanExcitationEnergy();
203 Density = goldLayerMaterial->GetDensity()/(g/cm3);
204 Radlen = goldLayerMaterial->GetRadlen();
205 std::cout<<"gold layer: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
206 KalFitMaterial FitGoldLayerMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
207 _BesKalmanFitMaterials.push_back(FitGoldLayerMaterial);
208
209
210 /// now construct the cylinders
211 double radius, thick, length , z0;
212
213 /// film1 of the innerwall of inner drift chamber
214 radius = innerwallFilm1Tub->GetInnerRadius()/(cm);
215 thick = innerwallFilm1Tub->GetOuterRadius()/(cm) - innerwallFilm1Tub->GetInnerRadius()/(cm);
216 length = 2.0*innerwallFilm1Tub->GetZHalfLength()/(cm);
217 z0 = 0.0;
218 std::cout<<"innerwallFilm1: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
219 KalFitCylinder innerwallFilm1Cylinder(&_BesKalmanFitMaterials[1], radius, thick, length , z0);
220 _BesKalmanFitWalls.push_back(innerwallFilm1Cylinder);
221
222
223 /// innerwall of inner drift chamber
224 radius = innerwallTub->GetInnerRadius()/(cm);
225 thick = innerwallTub->GetOuterRadius()/(cm) - innerwallTub->GetInnerRadius()/(cm);
226 length = 2.0*innerwallTub->GetZHalfLength()/(cm);
227 z0 = 0.0;
228 std::cout<<"innerwall: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
229 KalFitCylinder innerwallCylinder(&_BesKalmanFitMaterials[2], radius, thick, length , z0);
230 _BesKalmanFitWalls.push_back(innerwallCylinder);
231
232 /// film0 of the innerwall of inner drift chamber
233 radius = innerwallFilm0Tub->GetInnerRadius()/(cm);
234 thick = innerwallFilm0Tub->GetOuterRadius()/(cm) - innerwallFilm0Tub->GetInnerRadius()/(cm);
235 length = 2.0*innerwallFilm0Tub->GetZHalfLength()/(cm);
236 z0 = 0.0;
237 std::cout<<"innerwallFilm0: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
238 KalFitCylinder innerwallFilm0Cylinder(&_BesKalmanFitMaterials[3], radius, thick, length , z0);
239 _BesKalmanFitWalls.push_back(innerwallFilm0Cylinder);
240
241 /// outer air, be attention the calculation of the radius and thick of the air cylinder is special
242 radius = outerBeTub->GetOuterRadius()/(cm);
243 thick = innerwallTub->GetInnerRadius()/(cm) - outerBeTub->GetOuterRadius()/(cm);
244 length = 2.0*innerwallTub->GetZHalfLength()/(cm);
245 z0 = 0.0;
246 std::cout<<"outer air: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
247 KalFitCylinder outerAirCylinder(&_BesKalmanFitMaterials[4], radius, thick, length , z0);
248 _BesKalmanFitWalls.push_back(outerAirCylinder);
249
250 /// outer Beryllium layer
251 radius = outerBeTub->GetInnerRadius()/(cm);
252 thick = outerBeTub->GetOuterRadius()/(cm) - outerBeTub->GetInnerRadius()/(cm);
253 length = 2.0*outerBeTub->GetZHalfLength()/(cm);
254 z0 = 0.0;
255 std::cout<<"outer Be: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
256 KalFitCylinder outerBeCylinder(&_BesKalmanFitMaterials[5], radius, thick, length , z0);
257 _BesKalmanFitWalls.push_back(outerBeCylinder);
258
259 /// oil layer
260 radius = oilLayerTub->GetInnerRadius()/(cm);
261 thick = oilLayerTub->GetOuterRadius()/(cm) - oilLayerTub->GetInnerRadius()/(cm);
262 length = 2.0*oilLayerTub->GetZHalfLength()/(cm);
263 z0 = 0.0;
264 std::cout<<"oil layer: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
265 KalFitCylinder oilLayerCylinder(&_BesKalmanFitMaterials[6], radius, thick, length , z0);
266 _BesKalmanFitWalls.push_back(oilLayerCylinder);
267
268 /// inner Beryllium layer
269 radius = innerBeTub->GetInnerRadius()/(cm);
270 thick = innerBeTub->GetOuterRadius()/(cm) - innerBeTub->GetInnerRadius()/(cm);
271 length = 2.0*innerBeTub->GetZHalfLength()/(cm);
272 z0 = 0.0;
273 std::cout<<"inner Be: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
274 KalFitCylinder innerBeCylinder(&_BesKalmanFitMaterials[7], radius, thick, length , z0);
275 _BesKalmanFitWalls.push_back(innerBeCylinder);
276
277 /// gold layer
278 radius = goldLayerTub->GetInnerRadius()/(cm);
279 thick = goldLayerTub->GetOuterRadius()/(cm) - goldLayerTub->GetInnerRadius()/(cm);
280 length = 2.0*goldLayerTub->GetZHalfLength()/(cm);
281 z0 = 0.0;
282 std::cout<<"gold layer: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
283 KalFitCylinder goldLayerCylinder(&_BesKalmanFitMaterials[8], radius, thick, length , z0);
284 _BesKalmanFitWalls.push_back(goldLayerCylinder);
285}
286
287
288
289
void setBesFromGdml(void)
Cylinder is an Element whose shape is a cylinder.
static double mdcGasRadlen_
Definition: KalFitTrack.h:274
G4LogicalVolume * GetTopVolume()
Get the top(world) volume;.