BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
BesTofConstruction.cc
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2// BOOST --- BESIII Object_Oriented Simulation Tool //
3//---------------------------------------------------------------------------//
4//Description: Geometry Construction for barrel and endcap Tof
5//Author: Dengzy
6//Created: Mar, 2004
7//Modified: Way of reading txt file in dat/ is changed.
8//The material for BC404 and BC408 has been exchanged. The original
9//one is opposite. (Liu Yong @ Dec 2008)
10//$Id: BesTofConstruction.cc
11//
12
13#include "GaudiKernel/MsgStream.h"
14#include "GaudiKernel/Bootstrap.h"
15#include "GaudiKernel/PropertyMgr.h"
16#include "GaudiKernel/IJobOptionsSvc.h"
17#include "GaudiKernel/ISvcLocator.h"
18#include "GaudiKernel/IDataProviderSvc.h"
19
20#include "BesTofConstruction.hh"
21#include "BesTofGeoParameter.hh"
22#include "PartProduce.hh"
23#include "BesTofSD.hh"
24#include "G4Geo/TofG4Geo.h"
25#include "G4Geo/MRPCG4Geo.h"
26#include "ReadBoostRoot.hh"
27
28#include "G4Material.hh"
29#include "G4Trap.hh"
30#include "G4Tubs.hh"
31#include "G4Box.hh"
32#include "G4Trd.hh"
33#include "G4Cons.hh"
34#include "G4UnionSolid.hh"
35#include "G4SubtractionSolid.hh"
36#include "G4IntersectionSolid.hh"
37
38#include "G4LogicalVolume.hh"
39#include "G4Transform3D.hh"
40#include "G4PVPlacement.hh"
41#include "G4AssemblyVolume.hh"
42#include "G4SDManager.hh"
43#include "G4UnitsTable.hh"
44#include "G4ios.hh"
45#include "G4Colour.hh"
46#include "G4VisAttributes.hh"
47#include "G4UnionSolid.hh"
48#include "G4UserLimits.hh"
49#include "G4SystemOfUnits.hh"
50
51
52BesTofConstruction::BesTofConstruction() //Constructor, set variables (G4logical or G4physical volumes) declared in BesTofConstruction.hh
53{
54 PropertyMgr m_propMgr1;
55 m_propMgr1.declareProperty("UserLimits", m_userLimits = 0.03);
56 m_propMgr1.declareProperty("IonE", m_ionE = 20);
57 IJobOptionsSvc* jobSvc1;
58 Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc1);
59 jobSvc1->setMyProperties("BesTofConstruction", &m_propMgr1);
60
61 cout<<"BesTofConstruction Property:"<<endl
62 <<" UserLimits= "<<m_userLimits
63 <<" IonE= "<<m_ionE
64 <<endl;
65
66 logicalTof = 0;
67 physicalTof = 0;
68
69 logicalBrTof = 0;
70 logicalEcTofWest=0;
71 logicalEcTofEast=0;
72
73 logicalScinBr1 = 0;
74 logicalScinBr2 = 0;
75 physicalScinBr1 = 0;
76 physicalScinBr2 = 0;
77
78 logicalAlBr1 = 0;
79 logicalAlBr2 = 0;
80 physicalAlBr1 = 0;
81 physicalAlBr2 = 0;
82
83 logicalPVFBr1 = 0;
84 logicalPVFBr2 = 0;
85 physicalPVFBr1 = 0;
86 physicalPVFBr2 = 0;
87
88 logicalBucketBr1= 0;
89 logicalBucketBr2= 0;
90
91 physicalBucket1Br1 = 0;
92 physicalBucket2Br1 = 0;
93 physicalBucket1Br2 = 0;
94 physicalBucket2Br2 = 0;
95
96 logicalScinEcWest = 0;
97 logicalScinEcEast = 0;
98 physicalScinEcWest = 0;
99 physicalScinEcEast = 0;
100
101 logicalAlEcWest = 0;
102 logicalAlEcEast = 0;
103 physicalAlEcWest = 0;
104 physicalAlEcEast = 0;
105
106 logicalPVFEcWest = 0;
107 logicalPVFEcEast = 0;
108 physicalPVFEcWest = 0;
109 physicalPVFEcEast = 0;
110
111 logicalBucketEc = 0;
112 physicalBucketEc = 0;
113
114 BC404 = 0;
115 BC408 = 0;
116 PVF = 0;
117 PMTmaterial = 0;
118
119 //MRPC
120 logical_gasLayer=0;
121}
122
124{}
125
126void BesTofConstruction::Construct(G4LogicalVolume* logicalBes)
127{
128 DefineMaterial(); //This function just defines my material, used for the TOF
129
130 if ( ReadBoostRoot::GetTof() == 2 )
131 {
132 TofG4Geo* aTofG4Geo = new TofG4Geo();
133 logicalTof = aTofG4Geo->GetTopVolume();
134 if (!logicalTof)
135 G4cout<<"BesTofConstruction::Construct(), logicalTof not found"<<G4endl;
136 else
137 {
138 //produce the logical Tof
139 physicalTof = new G4PVPlacement(0,G4ThreeVector(0,0,0),
140 logicalTof,"physicalTof",logicalBes,false,0); // Class representing a single volume positioned within and relative to a mother volume.
141
142 //for visual attributes
143 logicalScinBr1 = FindLogicalVolume("logicalScinBr1");
144 logicalScinBr2 = FindLogicalVolume("logicalScinBr2");
145
146 logicalAlBr1 = FindLogicalVolume("logicalAlBr1");
147 logicalAlBr2 = FindLogicalVolume("logicalAlBr2");
148 logicalPVFBr1 = FindLogicalVolume("logicalPVFBr1");
149 logicalPVFBr2 = FindLogicalVolume("logicalPVFBr2");
150 logicalBucketBr1 = FindLogicalVolume("logicalBucketBr1");
151 logicalBucketBr2 = FindLogicalVolume("logicalBucketBr2");
152
153 logicalScinEcWest = FindLogicalVolume("logicalScinEcWest");
154 logicalScinEcEast = FindLogicalVolume("logicalScinEcEast");
155 logicalBucketEc = FindLogicalVolume("logicalBucketEc");
156 }
157 //m_sxp.Finalize();
158 delete aTofG4Geo;
159 } //close (ReadBoostRoot::GetTof() == 2)
160
161 else if(ReadBoostRoot::GetTof() == 3 ) //start TOF with MRPC Endcaps
162 {
163 //This part intialize a function where the Parameter of the TOF are saved!
165
166 //Get the coordinates of the TOF
167 G4double r1=380; //Newly changed from 399 for MRPC to avoid overlap
168 G4double r2=tofPara->GetBucketPosR()+0.5*tofPara->GetBucketDEc()+1; //=474
169 G4double r3=810;
170 G4double r4=925;
171 G4double a1=1382+tofPara->GetBucketLEc()+1; //1463
172 G4double a2=1381; // Changed from 1382 to avoid overlapping with EMC
173 //to make the center of tub6 is tofPara.GetzPosEastEc()=1356
174 G4double a3=1330;
175 G4cout<<"Tof Volume: "<<r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<a1<<" "<<a2<<" "<<a3<<G4endl;
176
177 //Tof: produce a cylinder with inner radius r1 and outer radius r2, z height: 2a1, starting angle 0 untill 360
178 G4Tubs* tub1 = new G4Tubs("tub1",r1,r2,a1,0,360);
179 G4Tubs* tub2 = new G4Tubs("tub2",r2-4,r4,a2,0,360);
180 G4Tubs* tub3 = new G4Tubs("tub3",0,r3,a3,0,360);
181 G4UnionSolid* tub4 = new G4UnionSolid("tub4",tub1,tub2,0,G4ThreeVector(0,0,0) ); //Vereinigt tub 1 und 2 in tub4
182 G4SubtractionSolid* solidTof = new G4SubtractionSolid("solidTof",tub4,tub3,0, G4ThreeVector(0,0,0) ); //Subtracts tub4 - tub3
183 logicalTof = new G4LogicalVolume(solidTof, G4Material::GetMaterial("Air"),"logicalTof"); //book logical Tof VOlume
184 physicalTof = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalTof,"physicalTof",logicalBes,false,0);
185
186 //Logical + Physical volumes for the barrel
187 G4Tubs* tub5 = new G4Tubs("tub5",r3,r4,a3,0,360);
188 logicalBrTof = new G4LogicalVolume(tub5, G4Material::GetMaterial("Air"),"logicalBrTof"); //book logical Barrel TOF
189 G4VPhysicalVolume* physicalBrTof = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalBrTof,"physicalBrTof",logicalTof,false,0);
190
191
192 //Logical + Physical volumes for the endcaps
193 G4Tubs* tub6 = new G4Tubs("tub6",r1,r4,(a2-a3)/2,0,360); //ring: dz/2=2.55cm, xy=52.6 cm
194 G4Tubs* tub7 = new G4Tubs("tub7",r1,r2,(a1-a2)/2,0,360); //ring: dz/2=0.1cm, xy=7.5 cm
195 G4UnionSolid* tub8 = new G4UnionSolid("tub8",tub6,tub7,0,G4ThreeVector(0,0,(a3-a1)/2)); //Unify both tubes,translate z-axes -6.15 cm to the originally one
196 logicalEcTofWest = new G4LogicalVolume(tub8, G4Material::GetMaterial("Air"),"logicalEcTofWest");
197 G4VPhysicalVolume* physicalEcTofWest = new G4PVPlacement(0,G4ThreeVector(0,0,tofPara->GetzPosWestEc()),logicalEcTofWest,"physicalEcTofWest",logicalTof,false,0);
198
199 G4UnionSolid* tub9 = new G4UnionSolid("tub9",tub6,tub7,0,G4ThreeVector(0,0,(a1-a3)/2) ); //Unify both tubes,translate z-axes +6.15 cm to the originally one
200 logicalEcTofEast = new G4LogicalVolume(tub9, G4Material::GetMaterial("Air"),"logicalEcTofEast");
201 G4VPhysicalVolume* physicalEcTofEast = new G4PVPlacement(0,G4ThreeVector(0,0,tofPara->GetzPosEastEc()),logicalEcTofEast,"physicalEcTofEast",logicalTof,false,0);
202
203
204 //Functions which construct the different parts of the TOF -->See below
205 //Construct Tape
206 //put these lines before ConstructBr1Tof();
207 //so in BesTofSD.cc, no need to change the tofid caculation method
208 G4Tubs* tubTape = new G4Tubs("tubTape",866, 866.3, 1150, 0, 360);
209 G4LogicalVolume* logicalTape = new G4LogicalVolume(tubTape,G4Material::GetMaterial("tape"),"logicalTape");
210 G4VPhysicalVolume* physicalTape = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalTape,"physicalTape",logicalBrTof,false,0);
211 logicalTape->SetVisAttributes(G4VisAttributes::Invisible);
212
216 }
217
218 else if (ReadBoostRoot::GetTof() == 4 ) //start TOF with MRPC Endcaps GDML Construction
219 {
220 MRPCG4Geo* aTofG4Geo = new MRPCG4Geo();
221 logicalTof = aTofG4Geo->GetTopVolume();
222 if (!logicalTof)
223 G4cout<<"BesTofConstruction::Construct(), logicalTof not found"<<G4endl;
224 else
225 {
226 physicalTof = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalTof,"physicalTof",logicalBes,false,0);
227
228 logicalScinBr1 = FindLogicalVolume("logicalScinBr1");
229 logicalScinBr2 = FindLogicalVolume("logicalScinBr2");
230
231 logicalAlBr1 = FindLogicalVolume("logicalAlBr1");
232 logicalAlBr2 = FindLogicalVolume("logicalAlBr2");
233 logicalPVFBr1 = FindLogicalVolume("logicalPVFBr1");
234 logicalPVFBr2 = FindLogicalVolume("logicalPVFBr2");
235 logicalBucketBr1 = FindLogicalVolume("logicalBucketBr1");
236 logicalBucketBr2 = FindLogicalVolume("logicalBucketBr2");
237
238 logical_gasLayer=FindLogicalVolume("logical_gasLayer");
239 }
240 delete aTofG4Geo;
241 } //close else if(==4)
242
243 else
244 {
245 //-----------------logicalTof added here
247
248 //Get the coordinates of the TOF
249 G4double r1=tofPara->GetEcR1()-1; //=399
250 G4double r2=tofPara->GetBucketPosR()+0.5*tofPara->GetBucketDEc()+1; //=474
251 G4double r3=810;;
252 G4double r4=925;
253 G4double a1=1382+tofPara->GetBucketLEc()+1; //1463
254 G4double a2=1381; // Changed from 1382 to avoid overlapping with EMC
255 //to make the center of tub6 is tofPara.GetzPosEastEc()=1356
256 G4double a3=1330;
257 G4cout<<"Tof Volume: "<<r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<a1<<" "<<a2<<" "<<a3<<G4endl;
258
259 G4Tubs* tub1 = new G4Tubs("tub1",r1,r2,a1,0,360); //Just produce a cylinder with inner radius r1 and outer radius r2, z height: 2a1, starting angle 0 untill 360
260 G4Tubs* tub2 = new G4Tubs("tub2",r2-4,r4,a2,0,360);
261 G4Tubs* tub3 = new G4Tubs("tub3",0,r3,a3,0,360);
262 G4UnionSolid* tub4 = new G4UnionSolid("tub4",tub1,tub2,0,G4ThreeVector(0,0,0) ); //Vereinigt tub 1 und 2 in tub4
263 G4SubtractionSolid* solidTof = new G4SubtractionSolid("solidTof",tub4,tub3,0, G4ThreeVector(0,0,0) ); //Subtracts tub4 - tub3
264 logicalTof = new G4LogicalVolume(solidTof, G4Material::GetMaterial("Air"),"logicalTof"); //book logical Tof VOlume
265 physicalTof = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalTof,"physicalTof",logicalBes,false,0);
266
267 G4Tubs* tub5 = new G4Tubs("tub5",r3,r4,a3,0,360);
268 logicalBrTof = new G4LogicalVolume(tub5, G4Material::GetMaterial("Air"),"logicalBrTof"); //book logical Barrel TOF
269 G4VPhysicalVolume* physicalBrTof = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalBrTof,"physicalBrTof",logicalTof,false,0);
270
271 //Logical + Physical volumes for the endcaps
272 G4Tubs* tub6 = new G4Tubs("tub6",r1,r4,(a2-a3)/2,0,360);//r1=39.9cm, r4=92.5cm, zlength=2.55 cm
273 G4Tubs* tub7 = new G4Tubs("tub7",r1,r2,(a1-a2)/2,0,360);//r1=39.9cm, r2=47.4cm, zlength=4.05 cm
274 G4UnionSolid* tub8 = new G4UnionSolid("tub8",tub6,tub7,0,G4ThreeVector(0,0,(a3-a1)/2) );// -6.65cm
275 logicalEcTofWest = new G4LogicalVolume(tub8, G4Material::GetMaterial("Air"),"logicalEcTofWest");
276 G4VPhysicalVolume* physicalEcTofWest = new G4PVPlacement(0,G4ThreeVector(0,0,tofPara->GetzPosWestEc()),logicalEcTofWest,"physicalEcTofWest",logicalTof,false,0);
277
278 G4UnionSolid* tub9 = new G4UnionSolid("tub9",tub6,tub7,0,G4ThreeVector(0,0,(a1-a3)/2) );
279 logicalEcTofEast = new G4LogicalVolume(tub9, G4Material::GetMaterial("Air"),"logicalEcTofEast");
280 G4VPhysicalVolume* physicalEcTofEast = new G4PVPlacement(0,G4ThreeVector(0,0,tofPara->GetzPosEastEc()),logicalEcTofEast,"physicalEcTofEast",logicalTof,false,0);
281
282
283 //Construct Tape
284 //put these lines before ConstructBr1Tof();
285 //so in BesTofSD.cc, no need to change the tofid caculation method
286 G4Tubs* tubTape = new G4Tubs("tubTape",866, 866.3, 1150, 0, 360);
287 G4LogicalVolume* logicalTape = new G4LogicalVolume(tubTape,G4Material::GetMaterial("tape"),"logicalTape");
288 G4VPhysicalVolume* physicalTape = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalTape,"physicalTape",logicalBrTof,false,0);
289 logicalTape->SetVisAttributes(G4VisAttributes::Invisible);
290
291 //Functions which construct the different parts of the TOF -->See below
295 }
296
297
298 //sensitive detector
299 G4SDManager* SDman = G4SDManager::GetSDMpointer();
300 BesTofSD* tofSD = new BesTofSD("BesTofSD");
301 SDman->AddNewDetector(tofSD);
302
303 if (logicalScinBr1) logicalScinBr1->SetSensitiveDetector(tofSD);
304 if (logicalScinBr2) logicalScinBr2->SetSensitiveDetector(tofSD);
305 if (logicalScinEcWest) logicalScinEcWest->SetSensitiveDetector(tofSD);
306 if (logicalScinEcEast) logicalScinEcEast->SetSensitiveDetector(tofSD);
307 if(logical_gasLayer)
308 {
309 logical_gasLayer->SetSensitiveDetector(tofSD);
310 G4cout<<"!!! Find logical_gasLayer !!!"<<G4endl;
311
312 //For limits smaller than 0.02 one has to use the PAI-Model for ionisation!
313 logical_gasLayer->SetUserLimits (new G4UserLimits(m_userLimits*mm));
314 //logical_gasLayer->SetUserLimits (new G4UserLimits(0.03*mm));
315 }
316
317
318 G4VisAttributes* visBrTof = new G4VisAttributes(G4Colour(1.,0.,0.));
319 G4VisAttributes* visEcTof = new G4VisAttributes(G4Colour(0.,1.,0.));
320
321 if (logicalTof)
322 logicalTof->SetVisAttributes(G4VisAttributes::Invisible);
323 if (logicalBrTof)
324 logicalBrTof->SetVisAttributes(G4VisAttributes::Invisible);
325 //logicalBrTof->SetVisAttributes(visBrTof);
326 if (logicalEcTofWest)
327 logicalEcTofWest->SetVisAttributes(G4VisAttributes::Invisible);
328 //logicalEcTofWest->SetVisAttributes(visEcTof);
329 if (logicalEcTofEast)
330 logicalEcTofEast->SetVisAttributes(G4VisAttributes::Invisible);
331 //logicalEcTofEast->SetVisAttributes(visEcTof);
332
333
334 if (logicalScinBr1)
335 logicalScinBr1->SetVisAttributes(G4VisAttributes::Invisible);
336 if (logicalScinBr2)
337 logicalScinBr2->SetVisAttributes(G4VisAttributes::Invisible);
338
339 if (logicalAlBr1)
340 logicalAlBr1->SetVisAttributes(G4VisAttributes::Invisible);
341 if (logicalAlBr2)
342 logicalAlBr2->SetVisAttributes(G4VisAttributes::Invisible);
343
344 if (logicalPVFBr1)
345 logicalPVFBr1->SetVisAttributes(G4VisAttributes::Invisible);
346 if (logicalPVFBr2)
347 logicalPVFBr2->SetVisAttributes(G4VisAttributes::Invisible);
348
349 G4VisAttributes* visAttBrBuck = new G4VisAttributes(G4Colour(1.,1.,0.));
350 if (logicalBucketBr1)
351 logicalBucketBr1->SetVisAttributes(visAttBrBuck);
352 //logicalBucketBr1->SetVisAttributes(G4VisAttributes::Invisible);
353 if (logicalBucketBr2)
354 logicalBucketBr2->SetVisAttributes(visAttBrBuck);
355 //logicalBucketBr2->SetVisAttributes(G4VisAttributes::Invisible);
356
357 G4VisAttributes* visAttEcTof = new G4VisAttributes(G4Colour(0.,1.,1.));
358 if (logicalScinEcWest)
359 logicalScinEcWest->SetVisAttributes(visAttEcTof);
360 //logicalScinEc->SetVisAttributes(G4VisAttributes::Invisible);
361 if (logicalScinEcEast)
362 logicalScinEcEast->SetVisAttributes(visAttEcTof);
363
364 G4VisAttributes* visAttEcBuck = new G4VisAttributes(G4Colour(1.,1.,0.));
365 if (logicalBucketEc)
366 logicalBucketEc->SetVisAttributes(visAttEcBuck);
367 //logicalBucketEc->SetVisAttributes(G4VisAttributes::Invisible);
368
369 if (logicalAlEcWest)
370 logicalAlEcWest->SetVisAttributes(G4VisAttributes::Invisible);
371 if (logicalAlEcEast)
372 logicalAlEcEast->SetVisAttributes(G4VisAttributes::Invisible);
373 if (logicalPVFEcWest)
374 logicalPVFEcWest->SetVisAttributes(G4VisAttributes::Invisible);
375 if (logicalPVFEcEast)
376 logicalPVFEcEast->SetVisAttributes(G4VisAttributes::Invisible);
377}
378
380{
382
383 //Get barrel tof layer1 geometry data
384 G4int nScinBr=tofPara->GetnScinBr(); //number of barrel scintillators
385 G4double br1L=tofPara->GetBr1L();
386 G4double br1TrapW1=tofPara->GetBr1TrapW1();
387 G4double br1TrapW2=tofPara->GetBr1TrapW2();
388 G4double br1TrapH=tofPara->GetBr1TrapH();
389 G4double br1R1=tofPara->GetBr1R1();
390 G4double AlThickness=tofPara->GetAlThickness();
391 G4double PVFThickness=tofPara->GetPVFThickness();
392 //barrel PMT bucket geometry data
393 G4double bucketDBr=tofPara->GetBucketDBr(); //diameter of barrel PMT bucket
394 G4double bucketLBr=tofPara->GetBucketLBr(); //length of barrel PMT bucket
395
396 //computer from the original data
397 G4double angleBr=360./nScinBr*deg;
398 G4double scinTrapdx1,scinTrapdx2,scinTrapdx3,scinTrapdx4;
399 scinTrapdx1=scinTrapdx3=br1TrapW1/2.;
400 scinTrapdx2=scinTrapdx4=br1TrapW2/2.;
401 G4double scinTrapdy1,scinTrapdy2;
402 scinTrapdy1=scinTrapdy2=0.5*br1TrapH;
403 G4double scinTrapdz=br1L/2.;
404 G4double scinPosR=br1R1+scinTrapdy1;
405 G4double theta = atan((br1TrapW2/2.-br1TrapW1/2.)/br1TrapH);
406 G4double delta13 = AlThickness*(1/cos(theta)-tan(theta));
407 G4double delta24 = AlThickness*(1/cos(theta)+tan(theta));
408 G4double delta13P = (PVFThickness+AlThickness)*(1/cos(theta)-tan(theta));
409 G4double delta24P = (PVFThickness+AlThickness)*(1/cos(theta)+tan(theta));
410
411 //construct barrel tof scintillator
412 G4Trap* solidScinBr1=new G4Trap("solidScinBr1",scinTrapdz,0*deg,0*deg,
413 scinTrapdy1,scinTrapdx1,scinTrapdx2,0*deg,
414 scinTrapdy2,scinTrapdx3,scinTrapdx4,0*deg);
415 logicalScinBr1 = new G4LogicalVolume(solidScinBr1,BC408,"logicalScinBr1");
416
417 //construct barrel Al film and PVF film
418 G4Trap* solidAlBr1 = new G4Trap("solidAlBr1", scinTrapdz+0.001,0*deg,0*deg,
419 scinTrapdy1+AlThickness, scinTrapdx1+delta13, scinTrapdx2+delta24 ,0*deg,
420 scinTrapdy2+AlThickness, scinTrapdx3+delta13, scinTrapdx4+delta24 ,0*deg);
421
422 logicalAlBr1 = new G4LogicalVolume(solidAlBr1,G4Material::GetMaterial("Aluminium"),"logicalAlBr1");
423 G4Trap* solidPVFBr1 = new G4Trap("solidPVFBr1",scinTrapdz+0.002,0*deg,0*deg,
424 scinTrapdy1+AlThickness+PVFThickness,scinTrapdx1+delta13P, scinTrapdx2+delta24P,0*deg,
425 scinTrapdy2+AlThickness+PVFThickness,scinTrapdx3+delta13P, scinTrapdx4+delta24P,0*deg);
426
427 logicalPVFBr1 = new G4LogicalVolume(solidPVFBr1,PVF,"logicalPVFBr1");
428 //put daughter in mother logical volume
429 physicalAlBr1 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalAlBr1, "physicalAlBr1",logicalPVFBr1, false,0);
430 physicalScinBr1 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalScinBr1, "physicalScinBr1",logicalAlBr1, false, 0);
431
432 //construct barrel PMT bucket (bucket=Behaelter)
433 G4Tubs* solidBucketBr1= new G4Tubs("solidBucketBr1",0,bucketDBr/2.,
434 bucketLBr/2., 0, 360.*deg);
435 logicalBucketBr1=new G4LogicalVolume(solidBucketBr1,PMTmaterial,"logicalBucketBr1");
436
437
438 //Rotate the crystalls:
439 G4RotationMatrix trapRot;
440 trapRot.rotateZ(0.5*angleBr-90.*deg);
441 // /| y
442 //------- / | |
443 //\ / | | rotate->(0.5*angleBr-90.*deg): |
444 // \ / ->>>> | | -----x
445 // --- \ |
446 // \|
447 G4ThreeVector pos(0,0,0);
448 G4double x,y;
449 for (int i=0;i<nScinBr;i++)
450 {
451 ostringstream osnamePVFBr1;
452 osnamePVFBr1 << "physicalPVFBr1_"<<i;
453 ostringstream osnameBucket1Br1;
454 osnameBucket1Br1 << "physicalBucket1Br1_"<<i;
455 ostringstream osnameBucket2Br1;
456 osnameBucket2Br1 << "physicalBucket2Br1_"<<i;
457
458 //scintillator and casing
459 x=scinPosR*cos((i+0.5)*angleBr); //+0.5: start from phi=0
460 y=scinPosR*sin((i+0.5)*angleBr);
461 pos.setX(x);
462 pos.setY(y);
463 pos.setZ(0);
464
465 //to make code consistent with gdml
466 double a, b, c;
467 getXYZ(trapRot, a, b ,c); //Function is defined below
468 G4RotationMatrix trapRotTemp;
469 trapRotTemp.rotateZ(c);
470 G4Transform3D transform(trapRotTemp,pos);
471
472 //G4PVPlacement: Class representing a single volume positioned within and relative to a mother volume.
473 //G4Transform3D transform(trapRot,pos);
474 physicalPVFBr1 = new G4PVPlacement(transform,logicalPVFBr1,osnamePVFBr1.str(), logicalBrTof,false,i);
475 //bucket --> Two PMT, one on each side
476 pos.setZ(-(bucketLBr+br1L)/2.-0.01);
477 physicalBucket1Br1 = new G4PVPlacement(0,pos,logicalBucketBr1,osnameBucket1Br1.str(),logicalBrTof,false,0);
478 pos.setZ((bucketLBr+br1L)/2.+0.01);
479 physicalBucket2Br1 = new G4PVPlacement(0,pos,logicalBucketBr1,osnameBucket2Br1.str(),logicalBrTof,false,0);
480
481 //rotate for next scintillator
482 trapRot.rotateZ(angleBr);
483 }
484}
485
487{
489
490 //barrel tof layer2 geometry data
491 G4int nScinBr=tofPara->GetnScinBr(); //number of barrel scintillators
492 G4double br2L=tofPara->GetBr2L();
493 G4double br2TrapW1=tofPara->GetBr2TrapW1();
494 G4double br2TrapW2=tofPara->GetBr2TrapW2();
495 G4double br2TrapH=tofPara->GetBr2TrapH();
496 G4double br2R1=tofPara->GetBr2R1();
497 G4double AlThickness=tofPara->GetAlThickness();
498 G4double PVFThickness=tofPara->GetPVFThickness();
499 //barrel PMT bucket geometry data
500 G4double bucketDBr=tofPara->GetBucketDBr(); //diameter of barrel PMT bucket
501 G4double bucketLBr=tofPara->GetBucketLBr(); //length of barrel PMT bucket
502
503 //computer from the original data
504 G4double angleBr=360./nScinBr*deg;
505 G4double scinTrapdx1,scinTrapdx2,scinTrapdx3,scinTrapdx4;
506 scinTrapdx1=scinTrapdx3=br2TrapW1/2.;
507 scinTrapdx2=scinTrapdx4=br2TrapW2/2.;
508 G4double scinTrapdy1,scinTrapdy2;
509 scinTrapdy1=scinTrapdy2=0.5*br2TrapH;
510 G4double scinTrapdz=br2L/2.;
511 G4double scinPosR=br2R1+scinTrapdy1;
512 G4double theta = atan((br2TrapW2/2.-br2TrapW1/2.)/br2TrapH);
513 G4double delta13 = AlThickness*(1/cos(theta)-tan(theta));
514 G4double delta24 = AlThickness*(1/cos(theta)+tan(theta));
515 G4double delta13P = (PVFThickness+AlThickness)*(1/cos(theta)-tan(theta));
516 G4double delta24P = (PVFThickness+AlThickness)*(1/cos(theta)+tan(theta));
517
518 //construct barrel tof scintillator
519 G4Trap* solidScinBr2=new G4Trap("solidScinBr2",scinTrapdz,0*deg,0*deg,
520 scinTrapdy1,scinTrapdx1,scinTrapdx2,0*deg,
521 scinTrapdy2,scinTrapdx3,scinTrapdx4,0*deg);
522 logicalScinBr2 = new G4LogicalVolume(solidScinBr2,BC408,"logicalScinBr2");
523
524 //construct barrel Al film and PVF film
525 G4Trap* solidAlBr2 = new G4Trap("solidAlBr2", scinTrapdz+0.001,0*deg,0*deg,
526 scinTrapdy1+AlThickness, scinTrapdx1+delta13, scinTrapdx2+delta24 ,0*deg,
527 scinTrapdy2+AlThickness, scinTrapdx3+delta13, scinTrapdx4+delta24 ,0*deg);
528
529 logicalAlBr2 = new G4LogicalVolume(solidAlBr2,G4Material::GetMaterial("Aluminium"),"logicalAlBr2");
530 G4Trap* solidPVFBr2 = new G4Trap("solidPVFBr2",scinTrapdz+0.002,0*deg,0*deg,
531 scinTrapdy1+AlThickness+PVFThickness,scinTrapdx1+delta13P, scinTrapdx2+delta24P,0*deg,
532 scinTrapdy2+AlThickness+PVFThickness,scinTrapdx3+delta13P, scinTrapdx4+delta24P,0*deg);
533
534 logicalPVFBr2 = new G4LogicalVolume(solidPVFBr2,PVF,"logicalPVFBr2");
535 //put daughter in mother logical volume
536 physicalAlBr2 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalAlBr2, "physicalAlBr2",logicalPVFBr2, false,0);
537 physicalScinBr2 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalScinBr2, "physicalScinBr2",logicalAlBr2, false, 0);
538
539 //construct barrel PMT bucket
540 G4Tubs* solidBucketBr2= new G4Tubs("solidBucketBr2",0,bucketDBr/2.,
541 bucketLBr/2., 0, 360.*deg);
542 logicalBucketBr2=new G4LogicalVolume(solidBucketBr2,PMTmaterial,"logicalBucketBr2");
543
544 G4RotationMatrix trapRot;
545 trapRot.rotateZ(-90.*deg);
546 // /| y
547 //------- / | |
548 //\ / | | rotate->(-90.*deg): |
549 // \ / ->>>> | | -----x
550 // --- \ |
551 // \|
552 G4ThreeVector pos(0,0,0);
553 G4double x,y;
554 for (int i=0;i<nScinBr;i++)
555 {
556 ostringstream osnamePVFBr2;
557 osnamePVFBr2 << "physicalPVFBr2_"<<i;
558 ostringstream osnameBucket1Br2;
559 osnameBucket1Br2 << "physicalBucket1Br2_"<<i;
560 ostringstream osnameBucket2Br2;
561 osnameBucket2Br2 << "physicalBucket2Br2_"<<i;
562
563 //scintillator and casing
564 x=scinPosR*cos(i*angleBr); //+0.5: start from phi=0
565 y=scinPosR*sin(i*angleBr);
566 pos.setX(x);
567 pos.setY(y);
568 pos.setZ(0);
569 //to make code consistent with gdml
570 double a, b, c;
571 getXYZ(trapRot, a, b ,c);
572 G4RotationMatrix trapRotTemp;
573 trapRotTemp.rotateZ(c);
574 G4Transform3D transform(trapRotTemp,pos);
575 //G4Transform3D transform(trapRot,pos);
576 physicalPVFBr2 = new G4PVPlacement(transform,logicalPVFBr2,osnamePVFBr2.str(), logicalBrTof,false,i);
577 //bucket
578 pos.setZ(-(bucketLBr+br2L)/2.-0.01);
579 physicalBucket1Br2 = new G4PVPlacement(0,pos,logicalBucketBr2,osnameBucket1Br2.str(),logicalBrTof,false,0);
580 pos.setZ((bucketLBr+br2L)/2.+0.01);
581 physicalBucket2Br2 = new G4PVPlacement(0,pos,logicalBucketBr2,osnameBucket2Br2.str(),logicalBrTof,false,0);
582
583 //rotate for next scintillator
584 trapRot.rotateZ(angleBr);
585 }
586
587}
588
590{
592
593 //Get all interesting parameters for the TOF construction
594 //endcap geometry data
595 G4int nScinEc = tofPara->GetnScinEc(); //number of endcap scintillators
596 G4double ecL = tofPara->GetEcL();
597 G4double ecTrapW1 = tofPara->GetEcTrapW1();
598 G4double ecTrapW2 = tofPara->GetEcTrapW2();
599 G4double ecTrapH = tofPara->GetEcTrapH();
600 G4double ecTrapH1 = tofPara->GetEcTrapH1();
601 G4double zPosEastEc = tofPara->GetzPosEastEc(); //z position of east endcap
602 G4double zPosWestEc = tofPara->GetzPosWestEc(); //z position of west endcap
603 G4double ecR1 = tofPara->GetEcR1();
604 //G4double ecR2 = tofPara.GetEcR2();
605
606 //endcap PMT bucket geometry data
607 G4double bucketDEc = tofPara->GetBucketDEc(); //diameter of endcap PMT bucket
608 G4double bucketLEc = tofPara->GetBucketLEc(); //length of endcap PMT bucket
609 G4double bucketPosR = tofPara->GetBucketPosR(); //R of bucket center
610
611 G4double AlThickness=tofPara->GetAlThickness();
612 G4double PVFThickness=tofPara->GetPVFThickness();
613
614 G4double angleEc=360./nScinEc*deg;
615 G4double ecTrapW3 = ecTrapW1 + (ecTrapW2-ecTrapW1)*ecTrapH1/ecTrapH;
616 G4double ecTrapH2 = ecTrapH-ecTrapH1;
617 G4double pdz = ecL/2;
618 G4double ptheta = atan(ecTrapH1/(2*ecL));
619 G4double pdy1 = ecTrapH2/2;
620 G4double pdx1 = ecTrapW3/2;
621 G4double pdx2 = ecTrapW2/2;
622 G4double pdy2 = ecTrapH/2;
623 G4double pdx3 = ecTrapW1/2;
624 G4double pdx4 = ecTrapW2/2;
625
626 //because of removing a heighth of H1,
627 //plus initial center position ecR=ecR1+ecTrapH/2 with ecTrapH1/4
628 G4double ecR = ecR1+ecTrapH/2+ecTrapH1/4;
629
630 //construct endcap scintillator
631 G4Trap* solidScinEc=new G4Trap("solidScinEc",pdz,ptheta, 270*deg,
632 pdy1,pdx1,pdx2,0*deg,pdy2,pdx3,pdx4,0*deg);
633
634 logicalScinEcWest=new G4LogicalVolume(solidScinEc,BC404,"logicalScinEcWest");
635 logicalScinEcEast=new G4LogicalVolume(solidScinEc,BC404,"logicalScinEcEast");
636
637 //construct endcap PMT bucket
638 G4Tubs* solidBucketEc = new G4Tubs("solidBucketEc", 0, bucketDEc/2.,
639 bucketLEc/2., 0, 360.*deg);
640 logicalBucketEc = new G4LogicalVolume(solidBucketEc, PMTmaterial, "logicalBucketEc");
641
642 //construct Al and PVF film
643 G4double pthetaAl = atan(ecTrapH1/(2*(ecL+AlThickness*2)));
644 G4double theta1 = atan((ecTrapW2/2.-ecTrapW3/2.)/ecTrapH2);
645 G4double theta2 = atan((ecTrapW2/2.-ecTrapW1/2.)/ecTrapH);
646
647 G4double delta1 = AlThickness*(1/cos(theta1)-tan(theta1));
648 G4double delta2 = AlThickness*(1/cos(theta1)+tan(theta1));
649 G4double delta3 = AlThickness*(1/cos(theta2)-tan(theta2));
650 G4double delta4 = AlThickness*(1/cos(theta2)+tan(theta2));
651
652 G4double thick = AlThickness+PVFThickness;
653 G4double pthetaPVF = atan(ecTrapH1/(2*(ecL+thick*2)));
654 G4double delta1P = thick*(1/cos(theta1)-tan(theta1));
655 G4double delta2P = thick*(1/cos(theta1)+tan(theta1));
656 G4double delta3P = thick*(1/cos(theta2)-tan(theta2));
657 G4double delta4P = thick*(1/cos(theta2)+tan(theta2));
658
659 G4Trap* solidAlEc= new G4Trap("solidAlEc",pdz+AlThickness,pthetaAl,270*deg,pdy1+AlThickness,pdx1+delta1,pdx2+delta2,0*deg,pdy2+AlThickness,pdx3+delta3,pdx4+delta4,0*deg);
660
661 logicalAlEcWest = new G4LogicalVolume(solidAlEc,G4Material::GetMaterial("Aluminium"),"logicalAlEcWest");
662 logicalAlEcEast = new G4LogicalVolume(solidAlEc,G4Material::GetMaterial("Aluminium"),"logicalAlEcEast");
663
664 G4Trap* solidPVFEc = new G4Trap("solidPVFEc",pdz+thick,pthetaPVF,270*deg,
665 pdy1+thick,pdx1+delta1P,pdx2+delta2P,0*deg,
666 pdy2+thick,pdx3+delta3P,pdx4+delta4P,0*deg);
667
668 logicalPVFEcWest = new G4LogicalVolume(solidPVFEc,PVF,"logicalPVFEcWest");
669 logicalPVFEcEast = new G4LogicalVolume(solidPVFEc,PVF,"logicalPVFEcEast");
670
671 //put scintilator in Al, then put Al in PVF
672 physicalAlEcWest = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalAlEcWest, "physicalAlEcWest",logicalPVFEcWest, false,0);
673 physicalScinEcWest = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalScinEcWest, "physicalScinEcWest",logicalAlEcWest, false, 0);
674
675
676 //put scintilator in Al, then put Al in PVF
677 physicalAlEcEast = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalAlEcEast, "physicalAlEcEast",logicalPVFEcEast, false,0);
678 physicalScinEcEast = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalScinEcEast, "physicalScinEcEast",logicalAlEcEast, false, 0);
679
680 //zPosWestEc<0, zPosEastEc>0, direction of axis z: west--->east
681 //construct west endcap first
682 //when no rotation, the first tub is start from phi=90
683 //after rotation, the first tub is start from 0, rotate angle = 0.5*angleEc
684 G4ThreeVector posW(0,0,0);
685 G4ThreeVector posE(0,0,0);
686 G4RotationMatrix trapRot;
687 trapRot.rotateY(180.*deg);
688 trapRot.rotateZ(0.5*angleEc-90*deg);
689 for (int i=0;i<nScinEc;i++)
690 {
691 ostringstream osnamePVFEc;
692 osnamePVFEc << "physicalPVFEcWest_"<<i;
693 ostringstream osnameBucketEc;
694 osnameBucketEc << "physicalBucketEcWest_"<<i;
695
696 posW.setX( ecR*cos((0.5+i)*angleEc) );
697 posW.setY( ecR*sin((0.5+i)*angleEc) );
698 //posW.setZ( zPosWestEc );
699 posW.setZ(0);
700
701 //to make code consistent with gdml
702 double a, b, c;
703 getXYZ(trapRot, a, b ,c);
704 G4RotationMatrix trapRotTemp;
705 trapRotTemp.rotateX(a);
706 trapRotTemp.rotateY(b);
707 trapRotTemp.rotateZ(c);
708 G4Transform3D transform(trapRotTemp,posW);
709 //G4Transform3D transform(trapRot,posW);
710 physicalPVFEcWest = new G4PVPlacement(transform,logicalPVFEcWest,osnamePVFEc.str(), logicalEcTofWest,false,i);
711 posW.setX( bucketPosR*cos((0.5+i)*angleEc) );
712 posW.setY( bucketPosR*sin((0.5+i)*angleEc) );
713 //posW.setZ( zPosWestEc-ecL/2-thick-bucketLEc/2-0.01 );
714 posW.setZ(-ecL/2-thick-bucketLEc/2-0.01 );
715 physicalBucketEc = new G4PVPlacement(0,posW,logicalBucketEc,osnameBucketEc.str(),logicalEcTofWest,false,0);
716 trapRot.rotateZ(angleEc); //pay attention: not i*angleEc
717 }
718 //to make east scintillator start from phi=0
719 // _ _
720 // _ - _ -
721 // - - - - ====> - - - - ====> - - - -
722 // ~ - _
723 //
724 trapRot.rotateZ(-angleEc);
725 trapRot.rotateX(180.*deg); //make east bucket point to the center
726 for (int i=0;i<nScinEc;i++)
727 {
728 ostringstream osnamePVFEc;
729 osnamePVFEc << "physicalPVFEcEast_"<<i;
730 ostringstream osnameBucketEc;
731 osnameBucketEc << "physicalBucketEcEast_"<<i;
732
733 posE.setX( ecR*cos((0.5+i)*angleEc) );
734 posE.setY( ecR*sin((0.5+i)*angleEc) );
735 //posE.setZ( zPosEastEc );
736 posE.setZ(0);
737
738 //to make code consistent with gdml
739 double a, b, c;
740 getXYZ(trapRot, a, b ,c);
741 G4RotationMatrix trapRotTemp;
742 trapRotTemp.rotateX(a);
743 trapRotTemp.rotateY(b);
744 trapRotTemp.rotateZ(c);
745 G4Transform3D transform(trapRotTemp,posE);
746 //G4Transform3D transform(trapRot,posE);
747 physicalPVFEcEast = new G4PVPlacement(transform,logicalPVFEcEast,osnamePVFEc.str(), logicalEcTofEast,false,i);
748 posE.setX( bucketPosR*cos((0.5+i)*angleEc) );
749 posE.setY( bucketPosR*sin((0.5+i)*angleEc) );
750 //posE.setZ( zPosEastEc+ecL/2+thick+bucketLEc/2+0.01 );
751 posE.setZ(ecL/2+thick+bucketLEc/2+0.01 );
752 physicalBucketEc = new G4PVPlacement(0,posE,logicalBucketEc,osnameBucketEc.str(),logicalEcTofEast,false,0);
753 trapRot.rotateZ(angleEc); //pay attention: not i*angleEc
754 }
755}
756
757
758//This function construct the TOF_Endcap_MRPC
760{
761 //I construct my detector in the Geant4 coordinate system. It will be rotated into the BES coordinatesystem later!
762 // |z ___________
763 // | /y \ /
764 // | / \ /
765 // |/______x \_____/
766
767
768 G4double smallL = 0.01*mm;
769 G4RotationMatrix rot_dummy(0*deg,0*deg,0*deg);
770 IniParam_mrpc();
771 PartProduce* partProduce = new PartProduce();
772 partProduce->IniParam();
773 bool checkOverlap = false;
774
775 //Get the parts and place them in the container
776 //container
777 std::ostringstream name;
778 //Create 4 containers and gasContainers
779 //0: top module, closer to IP, longer bottom cover;
780 //1: same to [0], with gas sensitive detector overturned;
781 //2: bottom module, next to EMC, shorter bottom cover;
782 //3: same to [2], with gas sensitive detector overturned
783 G4LogicalVolume* logical_container[4];
784 G4LogicalVolume* logical_gasContainer[4];
785 for(int kk=0; kk<4; kk++)
786 {
787 name.str("");
788 name<<"logical_container_m"<<kk;
789 logical_container[kk] = partProduce->lg_container((int)kk/2, name.str());
790
791 name.str("");
792 name<<"logical_gasContainer_m"<<kk;
793 logical_gasContainer[kk] = partProduce->lg_gasContainer(name.str());
794 }
795
796
797 //The parts that compose the container
798 G4LogicalVolume* logical_containerFrame = partProduce->lg_containerFrame("logical_containerFrame");
799 G4LogicalVolume* logical_upCover = partProduce->lg_upCover("logical_upCover");
800 G4LogicalVolume* logical_lowCover1 = partProduce->lg_lowCover1("logical_lowCover1");
801 G4LogicalVolume* logical_lowCover2 = partProduce->lg_lowCover2("logical_lowCover2");
802 G4LogicalVolume* logical_upFEE = partProduce->lg_upFEE("logical_upFEE");
803 G4LogicalVolume* logical_sideFEE = partProduce->lg_sideFEE("logical_sideFEE");
804 G4LogicalVolume* logical_castingDie = partProduce->lg_castingDie("logical_castingDie");
805 G4LogicalVolume* logical_bareChamber = partProduce->lg_bareChamber("logical_bareChamber");
806 G4LogicalVolume* logical_bracket = partProduce->lg_bracket("logical_bracket");
807 G4LogicalVolume* logical_sideStopBlock = partProduce->lg_sideStopBlock("logical_sideStopBlock");
808 G4LogicalVolume* logical_upStopBlock = partProduce->lg_upStopBlock("logical_upStopBlock");
809
810
811 //Place the parts in the container
812 for(int kk=0; kk<4; kk++)
813 {
814 //container frame
815 name.str("");
816 name<<"physical_containerFrame_m"<<kk;
817 new G4PVPlacement(0, G4ThreeVector(0,0,0), logical_containerFrame, name.str(), logical_container[kk], false, 0, checkOverlap);
818
819 //top cover
820 G4ThreeVector translation_upCover(0, (containerOut_y+upCover_y)/2+smallL, (upCover_z-containerOut_z)/2-upCover_posz);
821 name.str("");
822 name<<"physical_upCover_m"<<kk;
823 new G4PVPlacement(0, translation_upCover, logical_upCover, name.str(), logical_container[kk], false, 0, checkOverlap);
824
825 //bottom cover
826 name.str("");
827 name<<"physical_lowCover_m"<<kk;
828 if(kk<2)
829 {
830 G4ThreeVector translation_lowCover(0, -1*(containerOut_y+upCover_y)/2, (lowCover1_z-containerOut_z)/2-lowCover1_posz);
831 new G4PVPlacement(0, translation_lowCover, logical_lowCover1, name.str(), logical_container[kk], false, 0, checkOverlap);
832 }
833 else
834 {
835 G4ThreeVector translation_lowCover(0, -1*(containerOut_y+upCover_y)/2, (lowCover2_z-containerOut_z)/2-lowCover2_posz);
836 new G4PVPlacement(0, translation_lowCover, logical_lowCover2, name.str(), logical_container[kk], false, 0, checkOverlap);
837 }
838
839 //FEE on the top cover
840 G4ThreeVector translation_upFEE(0, containerOut_y/2+upCover_y+upFEE_y/2+smallL, upCover_z-upFEE_posz-upFEE_z/2-upCover_posz-containerOut_z/2);
841 name.str("");
842 name<<"physical_upFEE_m"<<kk;
843 new G4PVPlacement(0, translation_upFEE, logical_upFEE, name.str(), logical_container[kk], false, 0, checkOverlap);
844
845 //FEE at the side
846 double angle_containerFrameSide = atan((containerOut_xup-containerOut_xdown)/2/containerOut_z) *rad;
847 double l_containerFrameSide = containerOut_z/cos(angle_containerFrameSide);
848 double x_sideFEE = (l_containerFrameSide/2-sideFEE_posl)*sin(angle_containerFrameSide)+(containerOut_xup+containerOut_xdown)/4+sideFEE_x/2*cos(angle_containerFrameSide);
849 double z_sideFEE = (l_containerFrameSide/2-sideFEE_posl)*cos(angle_containerFrameSide)-sideFEE_x/2*sin(angle_containerFrameSide);
850 G4ThreeVector translation_sideFEE_left(-x_sideFEE, 0, z_sideFEE);
851 G4RotationMatrix rot_sideFEE_left;
852 rot_sideFEE_left.rotateY(-angle_containerFrameSide);
853 G4Transform3D transform_sideFEE_left(rot_sideFEE_left, translation_sideFEE_left);
854 name.str("");
855 name<<"physical_sideFEE_left_m"<<kk;
856 new G4PVPlacement(transform_sideFEE_left, logical_sideFEE, name.str(), logical_container[kk], false, 0, checkOverlap);
857
858 G4ThreeVector translation_sideFEE_right(x_sideFEE, 0, z_sideFEE);
859 G4RotationMatrix rot_sideFEE_right;
860 rot_sideFEE_right.rotateZ(180*deg);
861 rot_sideFEE_right.rotateY(angle_containerFrameSide);
862 G4Transform3D transform_sideFEE_right(rot_sideFEE_right, translation_sideFEE_right);
863 name.str("");
864 name<<"physical_sideFEE_right_m"<<kk;
865 new G4PVPlacement(transform_sideFEE_right, logical_sideFEE, name.str(), logical_container[kk], false, 0, checkOverlap);
866
867 //casting die
868 G4RotationMatrix rot_castingDie;
869 rot_castingDie.rotateX(-90*deg);
870 G4ThreeVector translation_castingDie_1(0, containerOut_y/2+upCover_y+castingDie_z/2+smallL, -containerOut_z/2+upCover_posz+castingDie_posz1);
871 G4Transform3D transform_castingDie_1(rot_castingDie, translation_castingDie_1);
872 name.str("");
873 name<<"physical_castingDie_1_m"<<kk;
874 new G4PVPlacement(transform_castingDie_1, logical_castingDie, name.str(), logical_container[kk], false, 0, checkOverlap);
875
876 G4ThreeVector translation_castingDie_2(0, containerOut_y/2+upCover_y+castingDie_z/2+smallL, -containerOut_z/2+upCover_posz+castingDie_posz2);
877 G4Transform3D transform_castingDie_2(rot_castingDie, translation_castingDie_2);
878 name.str("");
879 name<<"physical_castingDie_2_m"<<kk;
880 new G4PVPlacement(transform_castingDie_2, logical_castingDie, name.str(), logical_container[kk], false, 0, checkOverlap);
881
882 //gas container
883 G4ThreeVector translation_gasContainer(0, 0, (container_lowBorder-container_thickness)/2);
884 name.str("");
885 name<<"physical_gasContainer_m"<<kk;
886 new G4PVPlacement(0, translation_gasContainer, logical_gasContainer[kk], name.str(), logical_container[kk], false, 0, checkOverlap);
887 }
888
889
890 //Fill in the inside of the container
891 //1mm from the bottom cover in design. Considering the modules's position are not real, change this number to make the bare chamber in the right place
892 double l_chamber = honeyComb_y*2+tape_mrpc_y*2+pcbBoard_y0*2+pcbBoard_y1+mylar_y*4+glass0_y*4+glass1_y*10+gasLayer_y*12;
893 double y_chamber;
894 double z_chamber = (containerIn_z-pcbBoard_z)/2-smallL;
895 for(int kk=0; kk<4; kk++)
896 {
897 if(kk<2) y_chamber = -(containerIn_y-l_chamber)/2+chamber_in_posy;
898 else y_chamber = -(containerIn_y-l_chamber)/2+chamber_out_posy;
899 G4Transform3D transform_bareChamber;
900 if(kk==0 || kk==2)
901 {
902 transform_bareChamber = G4Transform3D(rot_dummy, G4ThreeVector(0,y_chamber,z_chamber));
903 }
904 else
905 {
906 G4RotationMatrix rot_bareChamber;
907 rot_bareChamber.rotateZ(180*deg);
908 transform_bareChamber = G4Transform3D(rot_bareChamber, G4ThreeVector(0,y_chamber,z_chamber));
909 }
910 new G4PVPlacement(transform_bareChamber, logical_bareChamber, "physical_bareChamber", logical_gasContainer[kk], false, 0, checkOverlap);
911
912 //lower bracket
913 G4double z_bracket = -(containerIn_z-bracket_z)/2+smallL;
914 new G4PVPlacement(0, G4ThreeVector(-bracket_posx, 0, z_bracket), logical_bracket, "physical_bracket_0", logical_gasContainer[kk], false, 0, checkOverlap);
915 new G4PVPlacement(0, G4ThreeVector(bracket_posx, 0, z_bracket), logical_bracket, "physical_bracket_1", logical_gasContainer[kk], false, 0, checkOverlap);
916
917 //side stop block
918 G4Transform3D transform_sideStopBlock;
919 G4double angle_gasContainerSide = (atan((containerIn_xup-containerIn_xdown)/2/(containerIn_z))) *rad;
920 G4double x_sideStopBlock = (containerIn_xup+containerIn_xdown)/4+sideStopBlock_posz0*tan(angle_gasContainerSide)-sideStopBlock_x/2*cos(angle_gasContainerSide);
921 G4double z_sideStopBlock = sideStopBlock_posz0+sideStopBlock_x/2*sin(angle_gasContainerSide);
922
923 G4RotationMatrix rot_sideStopBlock;
924 rot_sideStopBlock.rotateY(angle_gasContainerSide);
925 rot_sideStopBlock.rotateZ(180*deg);
926 transform_sideStopBlock = G4Transform3D(rot_sideStopBlock, G4ThreeVector(-x_sideStopBlock, 0, z_sideStopBlock));
927 new G4PVPlacement(transform_sideStopBlock, logical_sideStopBlock, "physical_sideStopBlock_0", logical_gasContainer[kk], false, 0, checkOverlap);
928
929 rot_sideStopBlock = G4RotationMatrix(0,0,0);
930 rot_sideStopBlock.rotateY(angle_gasContainerSide);
931 transform_sideStopBlock = G4Transform3D(rot_sideStopBlock, G4ThreeVector(x_sideStopBlock, 0, z_sideStopBlock));
932 new G4PVPlacement(transform_sideStopBlock, logical_sideStopBlock, "physical_sideStopBlock_1", logical_gasContainer[kk], false, 0, checkOverlap);
933
934 x_sideStopBlock = (containerIn_xup+containerIn_xdown)/4+sideStopBlock_posz1*tan(angle_gasContainerSide)-sideStopBlock_x/2*cos(angle_gasContainerSide);
935 z_sideStopBlock = sideStopBlock_posz1+sideStopBlock_x/2*sin(angle_gasContainerSide);
936 rot_sideStopBlock = G4RotationMatrix(0,0,0);
937 rot_sideStopBlock.rotateY(angle_gasContainerSide);
938 rot_sideStopBlock.rotateZ(180*deg);
939 transform_sideStopBlock = G4Transform3D(rot_sideStopBlock, G4ThreeVector(-x_sideStopBlock, 0, z_sideStopBlock));
940 new G4PVPlacement(transform_sideStopBlock, logical_sideStopBlock, "physical_sideStopBlock_2", logical_gasContainer[kk], false, 0, checkOverlap);
941
942 rot_sideStopBlock = G4RotationMatrix(0,0,0);
943 rot_sideStopBlock.rotateY(angle_gasContainerSide);
944 transform_sideStopBlock = G4Transform3D(rot_sideStopBlock, G4ThreeVector(x_sideStopBlock, 0, z_sideStopBlock));
945 new G4PVPlacement(transform_sideStopBlock, logical_sideStopBlock, "physical_sideStopBlock_3", logical_gasContainer[kk], false, 0, checkOverlap);
946 }
947
948 //stop block
949 //upper stop block
950 G4double x_upStopBlock = containerIn_xup/4;
951 G4double y_upStopBlock = pcbBoard_y1/2.+mylar_y+glass0_y+glass1_y*2.5+gasLayer_y*3;
952 G4double z_upStopBlock = (pcbBoard_z-upStopBlock_z)/2-smallL;
953 new G4PVPlacement(0, G4ThreeVector(-x_upStopBlock, -y_upStopBlock, z_upStopBlock ), logical_upStopBlock, "physical_upStopBlock_0", logical_bareChamber, false,0, checkOverlap);
954 new G4PVPlacement(0, G4ThreeVector(-x_upStopBlock, y_upStopBlock, z_upStopBlock ), logical_upStopBlock, "physical_upStopBlock_1", logical_bareChamber, false,0, checkOverlap);
955 new G4PVPlacement(0, G4ThreeVector(x_upStopBlock, -y_upStopBlock, z_upStopBlock ), logical_upStopBlock, "physical_upStopBlock_2", logical_bareChamber, false,0, checkOverlap);
956 new G4PVPlacement(0, G4ThreeVector(x_upStopBlock, y_upStopBlock, z_upStopBlock ), logical_upStopBlock, "physical_upStopBlock_3", logical_bareChamber, false,0, checkOverlap);
957
958
959 //honeyComb
960 G4LogicalVolume* logical_honeyComb = partProduce->lg_honeyComb("logical_honeyComb");
961 G4double y_honeyComb = (honeyComb_y+pcbBoard_y1)/2+tape_mrpc_y+pcbBoard_y0+mylar_y*2+glass0_y*2+glass1_y*5+gasLayer_y*6;
962 G4double z_honeyComb = (pcbBoard_z-honeyComb_z)/2-honeyComb_posz;
963 new G4PVPlacement(0,G4ThreeVector(0,y_honeyComb,z_honeyComb), logical_honeyComb,"physical_honeyComb_0",logical_bareChamber,false,0, checkOverlap);
964 new G4PVPlacement(0,G4ThreeVector(0,-1*y_honeyComb,z_honeyComb), logical_honeyComb,"physical_honeyComb_1",logical_bareChamber,false,1, checkOverlap);
965
966 //tape_mrpc
967 G4LogicalVolume* logical_tape_mrpc = partProduce->lg_tape_mrpc("logical_tape_mrpc");
968 G4double y_tape_mrpc = (tape_mrpc_y+pcbBoard_y1)/2+pcbBoard_y0+mylar_y*2+glass0_y*2+glass1_y*5+gasLayer_y*6;
969 G4double z_tape_mrpc = (pcbBoard_z-tape_mrpc_z)/2-tape_mrpc_posz;
970 new G4PVPlacement(0,G4ThreeVector(0,y_tape_mrpc,z_tape_mrpc), logical_tape_mrpc,"physical_tape_mrpc_0",logical_bareChamber,false,0, checkOverlap);
971 new G4PVPlacement(0,G4ThreeVector(0,-1*y_tape_mrpc,z_tape_mrpc), logical_tape_mrpc,"physical_tape_mrpc_1",logical_bareChamber,false,1, checkOverlap);
972
973 //pcbBoard
974 G4LogicalVolume* logical_pcbBoard0 = partProduce->lg_pcbBoard(0, "logical_pcbBoard0");
975 G4double y_pcbBoard = (pcbBoard_y0+pcbBoard_y1)/2+mylar_y*2+glass0_y*2+glass1_y*5+gasLayer_y*6;
976 new G4PVPlacement(0,G4ThreeVector(0,y_pcbBoard,0),logical_pcbBoard0,"physical_pcbBoard0_0",logical_bareChamber,false,0, checkOverlap);
977 //Notice!!! I rotate 180 deg in order to make the strips near the PCB surface,
978 //but keep in mind that this will make the readout strips not mirror symmetry, but Z axial symmetry
979 G4RotationMatrix* rot_pcbBoard = new G4RotationMatrix();
980 rot_pcbBoard->rotateZ(180*degree);
981 new G4PVPlacement(rot_pcbBoard,G4ThreeVector(0,-1*y_pcbBoard,0),logical_pcbBoard0,"physical_pcbBoard0_1",logical_bareChamber,false,1, checkOverlap);
982
983 G4LogicalVolume* logical_pcbBoard1 = partProduce->lg_pcbBoard(1, "logical_pcbBoard1");
984 new G4PVPlacement(0,G4ThreeVector(0,0,0),logical_pcbBoard1,"physical_pcbBoard1",logical_bareChamber,false,0, checkOverlap);
985
986 //readout strip
987 G4AssemblyVolume* logical_strip = partProduce->lg_strip("logical_strip");
988 G4double z_strip = (pcbBoard_z-12*strip_z-11*strip_gap)/2-strip_posz;
989 G4Transform3D transform_strip(rot_dummy, G4ThreeVector(0, pcbBoard_y0/2.-strip_y/2-smallL, z_strip));
990 logical_strip->MakeImprint(logical_pcbBoard0, transform_strip);
991 transform_strip = G4Transform3D(rot_dummy, G4ThreeVector(0,0,z_strip));
992 logical_strip->MakeImprint(logical_pcbBoard1, transform_strip);
993
994 //mylar
995 G4LogicalVolume* logical_mylar = partProduce->lg_mylar("logical_mylar");
996 G4double y_mylar = (mylar_y+pcbBoard_y1)/2+mylar_y+glass0_y*2+glass1_y*5+gasLayer_y*6;
997 G4double z_mylar = (pcbBoard_z-mylar_z)/2-mylar_posz;
998 new G4PVPlacement(0,G4ThreeVector(0,y_mylar,z_mylar),logical_mylar,"physical_mylar_0",logical_bareChamber,false,0, checkOverlap);
999 new G4PVPlacement(0,G4ThreeVector(0,-y_mylar,z_mylar),logical_mylar,"physical_mylar_3",logical_bareChamber,false,3, checkOverlap);
1000
1001 y_mylar = (mylar_y+pcbBoard_y1)/2;
1002 new G4PVPlacement(0,G4ThreeVector(0,y_mylar,z_mylar),logical_mylar,"physical_mylar_1",logical_bareChamber,false,1, checkOverlap);
1003 new G4PVPlacement(0,G4ThreeVector(0,-y_mylar,z_mylar),logical_mylar,"physical_mylar_2",logical_bareChamber,false,2, checkOverlap);
1004
1005 //glass
1006 G4LogicalVolume* logical_glass0 = partProduce->lg_glass(0, "logical_glass0");
1007 G4double y_glass = (glass0_y+pcbBoard_y1)/2.+mylar_y+glass0_y+glass1_y*5+gasLayer_y*6;
1008 G4double z_glass = (pcbBoard_z-glass0_z)/2.-glass0_posz;
1009 new G4PVPlacement(0, G4ThreeVector(0, y_glass, z_glass), logical_glass0, "physical_glass0_0", logical_bareChamber, false, 0, checkOverlap);
1010 new G4PVPlacement(0, G4ThreeVector(0, -y_glass, z_glass), logical_glass0, "physical_glass0_3", logical_bareChamber, false, 3, checkOverlap);
1011 y_glass = pcbBoard_y1/2.+mylar_y+glass0_y/2.;
1012 new G4PVPlacement(0, G4ThreeVector(0, y_glass, z_glass), logical_glass0, "physical_glass0_1", logical_bareChamber, false, 1, checkOverlap);
1013 new G4PVPlacement(0, G4ThreeVector(0, -y_glass, z_glass), logical_glass0, "physical_glass0_2", logical_bareChamber, false, 2, checkOverlap);
1014
1015 G4LogicalVolume* logical_glass1 = partProduce->lg_glass(1, "logical_glass1");
1016 z_glass = (pcbBoard_z-glass1_z)/2.-glass1_posz;
1017 for(G4int i=0; i<5; i++)
1018 {
1019 y_glass = pcbBoard_y1/2.+mylar_y+glass0_y+glass1_y*(4.5-i)+gasLayer_y*(5-i);
1020 name.str("");
1021 name<<"physical_glass1_"<<i;
1022 new G4PVPlacement(0, G4ThreeVector(0, y_glass, z_glass), logical_glass1, name.str(), logical_bareChamber, false, i, checkOverlap);
1023 name.str("");
1024 name<<"physical_glass1_"<<9-i;
1025 new G4PVPlacement(0, G4ThreeVector(0, -y_glass, z_glass), logical_glass1, name.str(), logical_bareChamber, false, 9-i, checkOverlap);
1026 }
1027
1028 //gas
1029 logical_gasLayer = partProduce->lg_gasLayer("logical_gasLayer");
1030 G4double y_gasLayer;
1031 G4double z_gasLayer = (pcbBoard_z-gasLayer_z)/2.-gasLayer_posz;
1032 G4VPhysicalVolume* physical_gasLayer[12];
1033 for(G4int i=0; i<6; i++) //y->larger, gasNp->larger
1034 {
1035 y_gasLayer = pcbBoard_y1/2.+mylar_y+glass0_y+glass1_y*(5-i)+gasLayer_y*(5.5-i);
1036 name.str("");
1037 name<<"physical_gasLayer_"<<11-i;
1038 physical_gasLayer[i] = new G4PVPlacement(0, G4ThreeVector(0, -y_gasLayer, z_gasLayer), logical_gasLayer, name.str(), logical_bareChamber, false, 11-i, checkOverlap);
1039 }
1040 for(G4int i=6; i<12; i++)
1041 {
1042 y_gasLayer = pcbBoard_y1/2.+mylar_y+glass0_y+glass1_y*(i-6)+gasLayer_y*(-5.5+i);
1043 name.str("");
1044 name<<"physical_gasLayer_"<<11-i;
1045 physical_gasLayer[i] = new G4PVPlacement(0, G4ThreeVector(0, y_gasLayer, z_gasLayer), logical_gasLayer, name.str(), logical_bareChamber, false, 11-i, checkOverlap);
1046 }
1047
1048
1049 //arrange the 72 modules in the endcap, it's assumed to form two semicircles with a gap of about 2mm
1050
1051 // Z: East; y: Up; x: North
1052 // /y |z y y|/|
1053 // |z/ ___________ rotateX | / rotateZ /| |
1054 // |/_____x \ / ___|_/_ ||_|____x
1055 // \ / ->>>> / |/__\___x ->>>> | |
1056 // small end \_____/ bigger end /_________\ \ |
1057 // \|
1058
1059 const G4int n_module = 36;
1060 G4double angle = 360.0*deg/n_module;
1061 G4double z_layerIn = endcap_length/2-containerOut_y/2-lowCover1_y-layer_posz;
1062 G4double z_layerOut = endcap_length/2-containerOut_y/2-lowCover2_y-layer_posz;
1063 //Adjusting parameters
1064 //rOffset_east: along R direction
1065 //angle_east: along phi direction
1066 //angleOffset_east: along self asymmetric axis
1067 rOffset_east = tofPara->GetVec("rOffset_east");
1068 angle_east = tofPara->GetVec("angle_east");
1069 angleOffset_east = tofPara->GetVec("angleOffset_east");
1070 rOffset_west = tofPara->GetVec("rOffset_west");
1071 angle_west = tofPara->GetVec("angle_west");
1072 angleOffset_west = tofPara->GetVec("angleOffset_west");
1073
1074
1075 //arrange east endcap
1076 for(int i=0; i<n_module; i++)
1077 {
1078 G4double angle_module = startAngle_east+angle_east[i]+i*angle;
1079 G4double r_module = endcap_r+rOffset_east[i];
1080
1081 G4RotationMatrix rot_layerIn_east;
1082 rot_layerIn_east.rotateX(90.*deg);
1083 rot_layerIn_east.rotateZ(90.*deg);
1084 rot_layerIn_east.rotateZ(angle_module+angleOffset_east[i]);
1085
1086 G4ThreeVector translation_layerIn_east = G4ThreeVector(r_module*cos(angle_module), r_module*sin(angle_module), -z_layerIn);
1087 G4Transform3D transform_layerIn_east = G4Transform3D(rot_layerIn_east, translation_layerIn_east);
1088
1089
1090 G4RotationMatrix rot_layerOut_east;
1091 rot_layerOut_east.rotateZ(180.*deg);
1092 rot_layerOut_east.rotateX(90.*deg);
1093 rot_layerOut_east.rotateZ(90.*deg);
1094 rot_layerOut_east.rotateZ(angle_module+angleOffset_east[i]);
1095
1096 G4ThreeVector translation_layerOut_east = G4ThreeVector(r_module*cos(angle_module), r_module*sin(angle_module), z_layerOut);
1097 G4Transform3D transform_layerOut_east = G4Transform3D(rot_layerOut_east, translation_layerOut_east);
1098
1099 name.str("");
1100 name<<"physical_mrpc_east_"<<i;
1101 if(i%2==0)
1102 {
1103 new G4PVPlacement(transform_layerOut_east, logical_container[3], name.str(), logicalEcTofEast, false, i, checkOverlap);
1104 }
1105 else
1106 {
1107 new G4PVPlacement(transform_layerIn_east, logical_container[0], name.str(), logicalEcTofEast, false, i, checkOverlap);
1108 }
1109 }
1110
1111 //arrange west endcap
1112 for(int i=0; i<n_module; i++)
1113 {
1114 G4double angle_module = startAngle_west+angle_west[i]+i*angle;
1115 G4double r_module = endcap_r+rOffset_west[i];
1116
1117 G4RotationMatrix rot_layerIn_west;
1118 rot_layerIn_west.rotateZ(180.*deg);
1119 rot_layerIn_west.rotateX(90.*deg);
1120 rot_layerIn_west.rotateZ(90.*deg);
1121 rot_layerIn_west.rotateZ(angle_module+angleOffset_west[i]);
1122
1123 G4ThreeVector translation_layerIn_west = G4ThreeVector(r_module*cos(angle_module), r_module*sin(angle_module), z_layerIn);
1124 G4Transform3D transform_layerIn_west = G4Transform3D(rot_layerIn_west, translation_layerIn_west);
1125
1126
1127 G4RotationMatrix rot_layerOut_west;
1128 rot_layerOut_west.rotateX(90.*deg);
1129 rot_layerOut_west.rotateZ(90.*deg);
1130 rot_layerOut_west.rotateZ(angle_module+angleOffset_west[i]);
1131
1132 G4ThreeVector translation_layerOut_west = G4ThreeVector(r_module*cos(angle_module), r_module*sin(angle_module), -z_layerOut);
1133 G4Transform3D transform_layerOut_west = G4Transform3D(rot_layerOut_west, translation_layerOut_west);
1134
1135 name.str("");
1136 name<<"physical_mrpc_west_"<<i;
1137 if(i%2==0)
1138 {
1139 new G4PVPlacement(transform_layerOut_west, logical_container[2], name.str(), logicalEcTofWest, false, i, checkOverlap);
1140 }
1141 else
1142 {
1143 new G4PVPlacement(transform_layerIn_west, logical_container[1], name.str(), logicalEcTofWest, false, i, checkOverlap);
1144 }
1145 }
1146}
1147
1148
1149
1150void BesTofConstruction::DefineMaterial() //This fucntion just "build" my materials
1151{
1152 G4double a,z,density,fraction;
1153 G4int nel, natoms, ncomponents;
1154 G4String name, symbol;
1155
1156
1157 G4Element* H=G4Element::GetElement("Hydrogen");
1158 if (!H)
1159 H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a=1.01*g/mole);
1160
1161 G4Element* C=G4Element::GetElement("Carbon");
1162 if (!C)
1163 C = new G4Element(name="Carbon" ,symbol="C" , z= 6., a=12.01*g/mole);
1164
1165 G4Element* F=G4Element::GetElement("Fluorin");
1166 if (!F)
1167 F = new G4Element(name="Fluorin", symbol="F", z=9., a=18.01*g/mole);
1168
1169 G4Element* O=G4Element::GetElement("Oxygen");
1170 if (!O)
1171 O = new G4Element(name="Oxygen",symbol="O",z= 8., a= 16.00*g/mole);
1172
1173 G4Element* N=G4Element::GetElement("Nitrogen");
1174 if (!N)
1175 N = new G4Element(name="Nitrogen",symbol="N",z= 7., a= 14.01*g/mole);
1176
1177 G4Element* S=G4Element::GetElement("Sulfur");
1178 if(!S)
1179 S = new G4Element(name="Sulfur",symbol="S",z= 16., a= 32.06*g/mole);
1180
1181
1182 BC404 = new G4Material("BC404",density=1.032*g/cm3,nel=2);
1183 BC404->AddElement(C,10);
1184 BC404->AddElement(H,11);
1185
1186 BC408 = new G4Material("BC408",density=1.032*g/cm3,nel=2);
1187 BC408->AddElement(C,1000);
1188 BC408->AddElement(H,1104);
1189
1190 PVF = new G4Material("PVF",density=1.45*g/cm3,nel=3);
1191 PVF->AddElement(C,2);
1192 PVF->AddElement(H,3);
1193 PVF->AddElement(F,1);
1194
1195 //PMT mixed material
1196 G4Material* Cu = G4Material::GetMaterial("Copper");
1197 G4Material* Al = G4Material::GetMaterial("Aluminium");
1198
1199 //vacuum
1200 //G4Material* Vacuum = new G4Material("Galactic", z=1., a=1.01*g/mole,
1201 //density= universe_mean_density, kStateGas, 3.e-18*pascal, 2.73*kelvin);
1202
1203 density = 1.4618815*g/cm3;
1204 PMTmaterial = new G4Material(name="PMTmaterial", density, 4);
1205 PMTmaterial->AddMaterial(Al, 0.4495);
1206 PMTmaterial->AddMaterial(Cu,0.35);
1207 PMTmaterial->AddMaterial(G4Material::GetMaterial("SiO2"),0.2);
1208 PMTmaterial->AddMaterial(G4Material::GetMaterial("Air"),0.0005);
1209 //PMTmaterial->AddMaterial(Vacuum,0.1);
1210 G4cout<<PMTmaterial;
1211
1212 density = 1.002*g/cm3;
1213 G4Material* tape = new G4Material(name="tape",density,nel=2);
1214 tape->AddElement(C,2);
1215 tape->AddElement(H,5);
1216
1217
1218 //MRPC material
1219 //The stop block in the gas container
1220 G4Material* Nylon = new G4Material("Nylon", density=1.15*g/cm3, ncomponents=4);
1221 Nylon->AddElement(C, natoms=2);
1222 Nylon->AddElement(H, natoms=3);
1223 Nylon->AddElement(O, natoms=1);
1224 Nylon->AddElement(N, natoms=1);
1225 G4cout<<Nylon<<G4endl;
1226
1227 //The core of honeyComb is thought to be cellulose
1228 G4Material* honeycombCore = new G4Material("honeycombCore", density=0.024*g/cm3, ncomponents=3);
1229 honeycombCore->AddElement(C,natoms=6);
1230 honeycombCore->AddElement(H,natoms=10);
1231 honeycombCore->AddElement(O,natoms=5);
1232 G4cout<<honeycombCore<<G4endl;
1233
1234 //The honeyComb surface and the PCB board are thought to be composed of SiO2(60%) and epoxy resins(40%)
1235 G4Material* epoxy = new G4Material("epoxy", density=1.2*g/cm3, ncomponents=3);
1236 epoxy->AddElement(C,natoms=11);
1237 epoxy->AddElement(H,natoms=12);
1238 epoxy->AddElement(O,natoms=3);
1239 G4cout<<epoxy<<G4endl;
1240
1241 G4Material* insulationBoard = new G4Material("insulationBoard", density=1.85*g/cm3, 2);
1242 insulationBoard->AddMaterial(G4Material::GetMaterial("SiO2"), 0.6);
1243 insulationBoard->AddMaterial(epoxy, 0.4);
1244 G4cout<<insulationBoard<<G4endl;
1245
1246 //Mylar and tape are thought to be PET
1247 G4Material* PET = new G4Material("PET", density= 1.39*g/cm3, ncomponents=3);
1248 PET->AddElement(C,natoms=10);
1249 PET->AddElement(H,natoms=8);
1250 PET->AddElement(O,natoms=4);
1251 G4cout<<PET<<G4endl;
1252
1253 //MRPC gas: 90% r134a, 5% isobutan, 5% SF6
1254 G4Material* FreonR134A = new G4Material("FreonR134A", density =4.241*mg/cm3,ncomponents=3);
1255 FreonR134A->AddElement(C,natoms=2);
1256 FreonR134A->AddElement(H,natoms=2);
1257 FreonR134A->AddElement(F,natoms=4);
1258 G4cout<<FreonR134A<<G4endl;
1259
1260 G4Material* SF6 = new G4Material("SF6", density =6.14*mg/cm3,ncomponents=2);
1261 SF6->AddElement(S,natoms=1);
1262 SF6->AddElement(F,natoms=6);
1263 G4cout<<SF6<<G4endl;
1264
1265 G4Material* Isobutan = new G4Material("Isobutan", density =2.487*mg/cm3,ncomponents=2);
1266 Isobutan->AddElement(C, natoms=4);
1267 Isobutan->AddElement(H, natoms=10);
1268 G4cout<<Isobutan<<G4endl;
1269
1270 G4Material* MRPCGas = new G4Material(name="MRPCGas", density=4.17*mg/cm3,ncomponents=3);
1271 MRPCGas->AddMaterial(FreonR134A, fraction= 89.69*perCent);
1272 MRPCGas->AddMaterial(SF6, fraction=7.34*perCent);
1273 MRPCGas->AddMaterial(Isobutan, fraction=2.97*perCent);
1274
1275 //This setting is to produce ion pairs, default is 0
1276 if(0.0 == MRPCGas->GetIonisation()->GetMeanEnergyPerIonPair())
1277 {
1278 //MRPCGas->GetIonisation()->SetMeanEnergyPerIonPair(20*eV);
1279 MRPCGas->GetIonisation()->SetMeanEnergyPerIonPair(m_ionE*eV);
1280 }
1281 G4cout<<MRPCGas<<G4endl;
1282}
1283
1284void BesTofConstruction::getXYZ( const G4RotationMatrix r, double& a, double& b, double& c) const
1285{
1286 double cosb = sqrt( r.xx()*r.xx() + r.yx()*r.yx() );
1287
1288 if (cosb > 16*FLT_EPSILON)
1289 {
1290 a = atan2( r.zy(), r.zz() );
1291 b = atan2( -r.zx(), cosb );
1292 c = atan2( r.yx(), r.xx() );
1293 }
1294 else
1295 {
1296 a = atan2( -r.yz(), r.yy() );
1297 b = atan2( -r.zx(), cosb );
1298 c = 0.;
1299 }
1300 //std::cout.precision(20);
1301 //std::cout<<"in getXYZ :( "<<r.xx()<<" "<<r.xy()<<" "<<r.xz()<<std::endl;
1302 //std::cout<<" "<<r.yx()<<" "<<r.yy()<<" "<<r.yz()<<std::endl;
1303 //std::cout<<" "<<r.zx()<<" "<<r.zy()<<" "<<r.zz()<<std::endl;
1304 //std::cout<<"details: cosb="<<cosb<<" a="<<a<<" b="<<b<<" c="<<c<<" min="<<16*FLT_EPSILON<<std::endl;
1305
1306
1307 G4RotationMatrix temp;
1308 temp.rotateZ((c/deg)*deg);
1309 //std::cout.precision(20);
1310 //std::cout<<"in detail temp2:( "<<temp.xx()<<" "<<temp.xy()<<" "<<temp.xz()<<std::endl;
1311 //std::cout<<" "<<temp.yx()<<" "<<temp.yy()<<" "<<temp.yz()<<std::endl;
1312 //std::cout<<" "<<temp.zx()<<" "<<temp.zy()<<" "<<temp.zz()<<std::endl;
1313}
1314
1315
1316void BesTofConstruction::IniParam_mrpc()
1317{
1319
1320 //All the values are in units of mm or deg
1321 containerOut_xdown = tofPara->Get("containerOut_xdown");
1322 containerOut_xup = tofPara->Get("containerOut_xup");
1323 containerOut_y = tofPara->Get("containerOut_y");
1324 containerOut_z = tofPara->Get("containerOut_z");
1325 container_thickness = tofPara->Get("container_thickness");
1326 container_lowBorder = tofPara->Get("container_lowBorder");
1327
1328 containerIn_xdown = tofPara->Get("containerIn_xdown");
1329 containerIn_xup = tofPara->Get("containerIn_xup");
1330 containerIn_y = tofPara->Get("containerIn_y");
1331 containerIn_z = tofPara->Get("containerIn_z");
1332
1333 upCover_xdown = tofPara->Get("upCover_xdown");
1334 upCover_xup = tofPara->Get("upCover_xup");
1335 upCover_y = tofPara->Get("upCover_y");
1336 upCover_z = tofPara->Get("upCover_z");
1337 upCover_posz = tofPara->Get("upCover_posz");
1338
1339 lowCover1_xdown = tofPara->Get("lowCover1_xdown");
1340 lowCover1_xup = tofPara->Get("lowCover1_xup");
1341 lowCover1_y = tofPara->Get("lowCover1_y");
1342 lowCover1_z = tofPara->Get("lowCover1_z");
1343 lowCover1_addx = tofPara->Get("lowCover1_addx");
1344 lowCover1_addz = tofPara->Get("lowCover1_addz");
1345 lowCover1_posz = tofPara->Get("lowCover1_posz");
1346
1347 lowCover2_xdown = tofPara->Get("lowCover2_xdown");
1348 lowCover2_xup = tofPara->Get("lowCover2_xup");
1349 lowCover2_y = tofPara->Get("lowCover2_y");
1350 lowCover2_z = tofPara->Get("lowCover2_z");
1351 lowCover2_posz = tofPara->Get("lowCover2_posz");
1352
1353 upFEE_xdown = tofPara->Get("upFEE_xdown");
1354 upFEE_xup = tofPara->Get("upFEE_xup");
1355 upFEE_y = tofPara->Get("upFEE_y");
1356 upFEE_z = tofPara->Get("upFEE_z");
1357 FEE_thickness = tofPara->Get("FEE_thickness");
1358 upFEE_posz = tofPara->Get("upFEE_posz");
1359
1360 upFEE_pcb_xdown = tofPara->Get("upFEE_pcb_xdown");
1361 upFEE_pcb_xup = tofPara->Get("upFEE_pcb_xup");
1362 upFEE_pcb_y = tofPara->Get("upFEE_pcb_y");
1363 upFEE_pcb_z = tofPara->Get("upFEE_pcb_z");
1364
1365 sideFEE_x = tofPara->Get("sideFEE_x");
1366 sideFEE_y = tofPara->Get("sideFEE_y");
1367 sideFEE_z = tofPara->Get("sideFEE_z");
1368 sideFEE_posl = tofPara->Get("sideFEE_posl");
1369
1370 sideFEE_pcb_x = tofPara->Get("sideFEE_pcb_x");
1371 sideFEE_pcb_y = tofPara->Get("sideFEE_pcb_y");
1372 sideFEE_pcb_z = tofPara->Get("sideFEE_pcb_z");
1373
1374 castingDie_x = tofPara->Get("castingDie_x");
1375 castingDie_y = tofPara->Get("castingDie_y");
1376 castingDie_z = tofPara->Get("castingDie_z");
1377 castingDie_addr = tofPara->Get("castingDie_addr");
1378 castingDie_subtractx = tofPara->Get("castingDie_subtractx");
1379 castingDie_subtract_posz = tofPara->Get("castingDie_subtract_posz");
1380 castingDie_posz1 = tofPara->Get("castingDie_posz1");
1381 castingDie_posz2 = tofPara->Get("castingDie_posz2");
1382
1383 chamber_in_posy = tofPara->Get("chamber_in_posy");
1384 chamber_out_posy = tofPara->Get("chamber_out_posy");
1385
1386 bracket_x = tofPara->Get("bracket_x");
1387 bracket_y = tofPara->Get("bracket_y");
1388 bracket_z = tofPara->Get("bracket_z");
1389 bracket_r = tofPara->Get("bracket_r");
1390 bracket_posx = tofPara->Get("bracket_posx");
1391
1392 upStopBlock_x = tofPara->Get("upStopBlock_x");
1393 upStopBlock_y = tofPara->Get("upStopBlock_y");
1394 upStopBlock_z = tofPara->Get("upStopBlock_z");
1395 upStopBlock_subtractr = tofPara->Get("upStopBlock_subtractr");
1396 upStopBlock_subtractposz = tofPara->Get("upStopBlock_subtractposz");
1397
1398 sideStopBlock_x = tofPara->Get("sideStopBlock_x");
1399 sideStopBlock_y = tofPara->Get("sideStopBlock_y");
1400 sideStopBlock_z = tofPara->Get("sideStopBlock_z");
1401 sideStopBlock_thickness = tofPara->Get("sideStopBlock_thickness");
1402 sideStopBlock_posz0 = tofPara->Get("sideStopBlock_posz0");
1403 sideStopBlock_posz1 = tofPara->Get("sideStopBlock_posz1");
1404
1405
1406 honeyComb_xdown = tofPara->Get("honeyComb_xdown");
1407 honeyComb_xup = tofPara->Get("honeyComb_xup");
1408 honeyComb_y = tofPara->Get("honeyComb_y");
1409 honeyComb_z = tofPara->Get("honeyComb_z");
1410 honeyComb_surface_y = tofPara->Get("honeyComb_surface_y");
1411 honeyComb_posz = tofPara->Get("honeyComb_posz");
1412
1413 tape_mrpc_xdown = tofPara->Get("tape_mrpc_xdown");
1414 tape_mrpc_xup = tofPara->Get("tape_mrpc_xup");
1415 tape_mrpc_y = tofPara->Get("tape_mrpc_y");
1416 tape_mrpc_z = tofPara->Get("tape_mrpc_z");
1417 tape_mrpc_posz = tofPara->Get("tape_mrpc_posz");
1418
1419 pcbBoard_xdown = tofPara->Get("pcbBoard_xdown");
1420 pcbBoard_xup = tofPara->Get("pcbBoard_xup");
1421 pcbBoard_y0 = tofPara->Get("pcbBoard_y0");
1422 pcbBoard_y1 = tofPara->Get("pcbBoard_y1");
1423 pcbBoard_z = tofPara->Get("pcbBoard_z");
1424
1425 strip_x[0] = tofPara->Get("strip_x[0]");
1426 strip_x[1] = tofPara->Get("strip_x[1]");
1427 strip_x[2] = tofPara->Get("strip_x[2]");
1428 strip_x[3] = tofPara->Get("strip_x[3]");
1429 strip_x[4] = tofPara->Get("strip_x[4]");
1430 strip_x[5] = tofPara->Get("strip_x[5]");
1431 strip_x[6] = tofPara->Get("strip_x[6]");
1432 strip_x[7] = tofPara->Get("strip_x[7]");
1433 strip_x[8] = tofPara->Get("strip_x[8]");
1434 strip_x[9] = tofPara->Get("strip_x[9]");
1435 strip_x[10] = tofPara->Get("strip_x[10]");
1436 strip_x[11] = tofPara->Get("strip_x[11]");
1437 strip_y = tofPara->Get("strip_y");
1438 strip_z = tofPara->Get("strip_z");
1439 strip_gap = tofPara->Get("strip_gap");
1440 strip_posz = tofPara->Get("strip_posz");
1441
1442 mylar_xdown = tofPara->Get("mylar_xdown");
1443 mylar_xup = tofPara->Get("mylar_xup");
1444 mylar_y = tofPara->Get("mylar_y");
1445 mylar_z = tofPara->Get("mylar_z");
1446 mylar_posz = tofPara->Get("mylar_posz");
1447
1448 glass0_xdown = tofPara->Get("glass0_xdown");
1449 glass0_xup = tofPara->Get("glass0_xup");
1450 glass0_y = tofPara->Get("glass0_y");
1451 glass0_z = tofPara->Get("glass0_z");
1452 glass0_posz = tofPara->Get("glass0_posz");
1453
1454 glass1_xdown = tofPara->Get("glass1_xdown");
1455 glass1_xup = tofPara->Get("glass1_xup");
1456 glass1_y = tofPara->Get("glass1_y");
1457 glass1_z = tofPara->Get("glass1_z");
1458 glass1_posz = tofPara->Get("glass1_posz");
1459
1460 gasLayer_xdown = tofPara->Get("gasLayer_xdown");
1461 gasLayer_xup = tofPara->Get("gasLayer_xup");
1462 gasLayer_y = tofPara->Get("gasLayer_y");
1463 gasLayer_z = tofPara->Get("gasLayer_z");
1464 gasLayer_posz = tofPara->Get("gasLayer_posz");
1465
1466 endcap_r = tofPara->Get("endcap_r");
1467 endcap_length = tofPara->Get("endcap_length");
1468 layer_posz = tofPara->Get("layer_posz");
1469 startAngle_east = tofPara->Get("startAngle_east");
1470 startAngle_west = tofPara->Get("startAngle_west");
1471}
double tan(const BesAngle a)
Definition: BesAngle.h:216
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
Double_t x[10]
G4double smallL
Definition: PartProduce.cc:19
G4RotationMatrix rot_dummy(0 *deg, 0 *deg, 0 *deg)
bool checkOverlap
Definition: PartProduce.cc:21
***************************************************************************************Pseudo Class RRes *****************************************************************************************Parameters and physical constants **Maarten sept ************************************************************************DOUBLE PRECISION xsmu **************************************************************************PARTICLE DATA all others are from PDG *Only resonances with known widths into electron pairs are sept ************************************************************************C Declarations C
Definition: RRes.h:29
@ theta2
Definition: TrkKalDeriv.h:24
@ theta1
Definition: TrkKalDeriv.h:24
G4LogicalVolume * FindLogicalVolume(const G4String &vn)
void getXYZ(const G4RotationMatrix r, double &a, double &b, double &c) const
void Construct(G4LogicalVolume *logicalBes)
double Get(std::string key)
static BesTofGeoParameter * GetInstance()
VEC GetVec(std::string key)
G4LogicalVolume * lg_sideFEE(string name="")
Definition: PartProduce.cc:390
void IniParam()
Definition: PartProduce.cc:34
G4LogicalVolume * lg_mylar(string name="")
Definition: PartProduce.cc:732
G4LogicalVolume * lg_lowCover1(string name="")
Definition: PartProduce.cc:270
G4LogicalVolume * lg_glass(G4int flag, string name="")
Definition: PartProduce.cc:747
G4LogicalVolume * lg_container(int flag, string name="")
Definition: PartProduce.cc:485
G4LogicalVolume * lg_gasContainer(string name="")
Definition: PartProduce.cc:589
G4LogicalVolume * lg_sideStopBlock(string name="")
Definition: PartProduce.cc:848
G4AssemblyVolume * lg_strip(string name="")
Definition: PartProduce.cc:700
G4LogicalVolume * lg_honeyComb(string name="")
Definition: PartProduce.cc:627
G4LogicalVolume * lg_containerFrame(string name="")
Definition: PartProduce.cc:204
G4LogicalVolume * lg_lowCover2(string name="")
Definition: PartProduce.cc:285
G4LogicalVolume * lg_pcbBoard(G4int flag, string name="")
Definition: PartProduce.cc:680
G4LogicalVolume * lg_bracket(string name="")
Definition: PartProduce.cc:796
G4LogicalVolume * lg_bareChamber(string name="")
Definition: PartProduce.cc:605
G4LogicalVolume * lg_upStopBlock(string name="")
Definition: PartProduce.cc:820
G4LogicalVolume * lg_tape_mrpc(string name="")
Definition: PartProduce.cc:664
G4LogicalVolume * lg_gasLayer(string name="")
Definition: PartProduce.cc:781
G4LogicalVolume * lg_castingDie(string name="")
Definition: PartProduce.cc:460
G4LogicalVolume * lg_upFEE(string name="")
Definition: PartProduce.cc:321
G4LogicalVolume * lg_upCover(string name="")
Definition: PartProduce.cc:255
static G4int GetTof()
G4LogicalVolume * GetTopVolume()
Get the top(world) volume;.
double y[1000]
IMPLICIT REAL *A H
Definition: myXsection.h:1
const double b
Definition: slope.cxx:9
const float rad
Definition: vector3.h:134