CGEM BOSS 6.6.5.h
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 "BesTofConstruction.hh"
14#include "BesTofGeoParameter.hh"
15#include "BesTofSD.hh"
16#include "ReadBoostRoot.hh"
17#include "G4Material.hh"
18
19#include "G4Trap.hh"
20#include "G4Tubs.hh"
21#include "G4Box.hh"
22#include "G4Trd.hh"
23#include "G4Cons.hh"
24#include "G4UnionSolid.hh"
25#include "G4SubtractionSolid.hh"
26#include "G4IntersectionSolid.hh"
27
28#include "G4LogicalVolume.hh"
29#include "G4Transform3D.hh"
30#include "G4PVPlacement.hh"
31#include "G4AssemblyVolume.hh"
32#include "G4SDManager.hh"
33#include "G4UnitsTable.hh"
34#include "G4ios.hh"
35#include "G4Colour.hh"
36#include "G4VisAttributes.hh"
37#include "G4UnionSolid.hh"
38#include "G4Geo/TofG4Geo.h"
39#include "G4Geo/MRPCG4Geo.h"
40
41
42
43#include "G4UserLimits.hh"
44
45#include "G4Region.hh"
46#include "G4ProductionCuts.hh"
47
48
49BesTofConstruction::BesTofConstruction() //Constructor, set variables (G4logical or G4physical volumes) declared in BesTofConstruction.hh
50{
51
52
53 logicalTof = 0;
54 physicalTof = 0;
55
56 logicalBrTof = 0;
57 logicalEcTofWest=0;
58 logicalEcTofEast=0;
59
60 logicalScinBr1 = 0;
61 logicalScinBr2 = 0;
62 physicalScinBr1 = 0;
63 physicalScinBr2 = 0;
64
65 logicalAlBr1 = 0;
66 logicalAlBr2 = 0;
67 physicalAlBr1 = 0;
68 physicalAlBr2 = 0;
69
70 logicalPVFBr1 = 0;
71 logicalPVFBr2 = 0;
72 physicalPVFBr1 = 0;
73 physicalPVFBr2 = 0;
74
75 logicalBucketBr1= 0;
76 logicalBucketBr2= 0;
77
78 physicalBucket1Br1 = 0;
79 physicalBucket2Br1 = 0;
80 physicalBucket1Br2 = 0;
81 physicalBucket2Br2 = 0;
82
83 logicalScinEcWest = 0;
84 logicalScinEcEast = 0;
85 physicalScinEcWest = 0;
86 physicalScinEcEast = 0;
87
88 logicalAlEcWest = 0;
89 logicalAlEcEast = 0;
90 physicalAlEcWest = 0;
91 physicalAlEcEast = 0;
92
93 logicalPVFEcWest = 0;
94 logicalPVFEcEast = 0;
95 physicalPVFEcWest = 0;
96 physicalPVFEcEast = 0;
97
98 logicalBucketEc = 0;
99 physicalBucketEc = 0;
100
101 BC404 = 0;
102 BC408 = 0;
103 PVF = 0;
104 PMTmaterial = 0;
105///////
106//MRPC
107
108 logical_assembly_west_1=0;
109 logical_pcboard_west_1=0;
110 logical_sensitive_detector_west_1=0;
111 logical_electrodes_west_1=0;
112 logical_glass_layer_west_1=0;
113 logical_readoutstrips_012_west_1=0;
114 logical_honeycomb_west_1=0;
115 logical_gascontainer_3_west_1=0;
116 logical_gaslayer_tot_west_1=0;
117 logical_mylarlayer_west_1=0;
118
119
120 physical_gascontainer_3_west_1=0;
121 physical_pcboard_west_1=0;
122 physical_sensitive_detector_west_1=0;
123 physical_glass_layer_west_1=0;
124 physical_electrodes_west_1=0;
125 physical_readoutstrips_012_west_1=0;
126 physical_honeycomb_1_west_1=0;
127 physical_honeycomb_2_west_1=0;
128 physical_gaslayer_tot_west_1=0;
129 physical_mylarlayer_west_1=0;
130
131
132 logical_gascontainer_3_west_2=0;
133 logical_assembly_west_2=0;
134 logical_pcboard_west_2=0;
135 logical_sensitive_detector_west_2=0;
136 logical_electrodes_west_2=0;
137 logical_glass_layer_west_2=0;
138 logical_readoutstrips_012_west_2=0;
139 logical_honeycomb_west_2=0;
140 logical_gaslayer_tot_west_2=0;
141 logical_mylarlayer_west_2=0;
142
143
144
145 physical_gascontainer_3_west_2=0;
146 physical_pcboard_west_2=0;
147 physical_sensitive_detector_west_2=0;
148 physical_glass_layer_west_2=0;
149 physical_electrodes_west_2=0;
150 physical_readoutstrips_012_west_2=0;
151 physical_honeycomb_1_west_2=0;
152 physical_honeycomb_2_west_2=0;
153 physical_gaslayer_tot_west_2=0;
154 physical_mylarlayer_west_2=0;
155
156
157 logical_assembly_east_1=0;
158 logical_pcboard_east_1=0;
159 logical_sensitive_detector_east_1=0;
160 logical_electrodes_east_1=0;
161 logical_glass_layer_east_1=0;
162 logical_readoutstrips_012_east_1=0;
163 logical_honeycomb_east_1=0;
164 logical_gascontainer_3_east_1=0;
165 logical_gaslayer_tot_east_1=0;
166 logical_mylarlayer_east_1=0;
167
168
169
170 physical_gascontainer_3_east_1=0;
171 physical_pcboard_east_1=0;
172 physical_sensitive_detector_east_1=0;
173 physical_glass_layer_east_1=0;
174 physical_electrodes_east_1=0;
175 physical_readoutstrips_012_east_1=0;
176 physical_honeycomb_1_east_1=0;
177 physical_honeycomb_2_east_1=0;
178 physical_gaslayer_tot_east_1=0;
179 physical_mylarlayer_east_1=0;
180
181
182
183 logical_gascontainer_3_east_2=0;
184 logical_assembly_east_2=0;
185 logical_pcboard_east_2=0;
186 logical_sensitive_detector_east_2=0;
187 logical_electrodes_east_2=0;
188 logical_glass_layer_east_2=0;
189 logical_readoutstrips_012_east_2=0;
190 logical_honeycomb_east_2=0;
191 logical_gaslayer_tot_east_2=0;
192 logical_mylarlayer_east_2=0;
193
194
195 physical_gascontainer_3_east_2=0;
196 physical_pcboard_east_2=0;
197 physical_sensitive_detector_east_2=0;
198 physical_glass_layer_east_2=0;
199 physical_electrodes_east_2=0;
200 physical_readoutstrips_012_east_2=0;
201 physical_honeycomb_1_east_2=0;
202 physical_honeycomb_2_east_2=0;
203 physical_gaslayer_tot_east_2=0;
204 physical_mylarlayer_east_2=0;
205
206
207 physical_assembly_west_1=0;
208 physical_assembly_west_2=0;
209 physical_assembly_east_1=0;
210 physical_assembly_east_2=0;
211
212
213 //Materials
214 FreonR134A=0;
215 SF6=0;
216 Isobutan=0;
217 Mylar_1397=0;
218 Mylar_073=0;
219 MRPCGas=0;
220 Graphite =0;
221
222
223}
224
228
229void BesTofConstruction::Construct(G4LogicalVolume* logicalBes)
230{
231 DefineMaterial(); //This function just defines my material, used for the TOF
232
233
234 if ( ReadBoostRoot::GetTof() == 2 )
235 {
236 TofG4Geo* aTofG4Geo = new TofG4Geo();
237 logicalTof = aTofG4Geo->GetTopVolume();
238 if (!logicalTof)
239 G4cout<<"BesTofConstruction::Construct(), logicalTof not found"<<G4endl;
240 else
241 {
242 physicalTof = new G4PVPlacement(0,G4ThreeVector(0,0,0),
243 logicalTof,"physicalTof",logicalBes,false,0); // Class representing a single volume positioned within and relative to a mother volume.
244
245 //The command above produces the logical Tof
246
247 //for visual attributes
248 logicalScinBr1 = FindLogicalVolume("logicalScinBr1");
249 logicalScinBr2 = FindLogicalVolume("logicalScinBr2");
250
251 logicalAlBr1 = FindLogicalVolume("logicalAlBr1");
252 logicalAlBr2 = FindLogicalVolume("logicalAlBr2");
253 logicalPVFBr1 = FindLogicalVolume("logicalPVFBr1");
254 logicalPVFBr2 = FindLogicalVolume("logicalPVFBr2");
255 logicalBucketBr1 = FindLogicalVolume("logicalBucketBr1");
256 logicalBucketBr2 = FindLogicalVolume("logicalBucketBr2");
257
258 logicalScinEcWest = FindLogicalVolume("logicalScinEcWest");
259 logicalScinEcEast = FindLogicalVolume("logicalScinEcEast");
260 logicalBucketEc = FindLogicalVolume("logicalBucketEc");
261 }
262 //m_sxp.Finalize();
263 delete aTofG4Geo;
264 } //close (ReadBoostRoot::GetTof() == 2)
265
266 else if(ReadBoostRoot::GetTof() == 3 ) //start TOF with MRPC Endcaps
267 {
268
269 BesTofGeoParameter* tofPara = BesTofGeoParameter::GetInstance(); //This part intialize a function where the Parameter of the TOF are saved! A lot of the function used below can be found here!
270
271 //Get the coordinates of the TOF
272 G4double r1=tofPara->GetEcR1()-1; //=399
273 G4double r2=tofPara->GetBucketPosR()+0.5*tofPara->GetBucketDEc()+1; //=474
274 G4double r3=810;
275 G4double r4=925;
276 G4double a1=1382+tofPara->GetBucketLEc()+1; //1463
277 G4double a2=1381; // Changed from 1382 to avoid overlapping with EMC
278 //to make the center of tub6 is tofPara.GetzPosEastEc()=1356
279 G4double a3=1330;
280 G4cout<<"Tof Volume: "<<r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<a1<<" "<<a2<<" "<<a3<<G4endl;
281
282 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
283 G4Tubs* tub2 = new G4Tubs("tub2",r2-4,r4,a2,0,360);
284 G4Tubs* tub3 = new G4Tubs("tub3",0,r3,a3,0,360);
285 G4UnionSolid* tub4 = new G4UnionSolid("tub4",tub1,tub2,0,G4ThreeVector(0,0,0) ); //Vereinigt tub 1 und 2 in tub4
286 G4SubtractionSolid* solidTof = new G4SubtractionSolid("solidTof",tub4,tub3,0, G4ThreeVector(0,0,0) ); //Subtracts tub4 - tub3
287
288 logicalTof = new G4LogicalVolume(solidTof, G4Material::GetMaterial("Air"),"logicalTof"); //book logical Tof VOlume
289
290 G4Tubs* tub5 = new G4Tubs("tub5",r3,r4,a3,0,360);
291 logicalBrTof = new G4LogicalVolume(tub5, G4Material::GetMaterial("Air"),"logicalBrTof"); //book logical Barrel TOF
292
293 G4VPhysicalVolume* physicalBrTof = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalBrTof,"physicalBrTof",logicalTof,false,0); // Physical Volume represents spatial possition of volumes describing the detector -> The mothervolume of this one is logical TOF
294
295
296 //Logical + Physical volumes for the endcaps
297 G4Tubs* tub6 = new G4Tubs("tub6",r1,r4,(a2-a3)/2,0,360); //ring: dz/2=2.55cm, xy=52.6 cm
298 G4Tubs* tub7 = new G4Tubs("tub7",r1,r2,(a1-a2)/2,0,360); //ring: dz/2=0.1cm, xy=7.5 cm
299 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
300 logicalEcTofWest = new G4LogicalVolume(tub8, G4Material::GetMaterial("Air"),"logicalEcTofWest");
301 G4VPhysicalVolume* physicalEcTofWest = new G4PVPlacement(0,G4ThreeVector(0,0,tofPara->GetzPosWestEc()),logicalEcTofWest,"physicalEcTofWest",logicalTof,false,0);
302
303 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
304 logicalEcTofEast = new G4LogicalVolume(tub9, G4Material::GetMaterial("Air"),"logicalEcTofEast");
305 G4VPhysicalVolume* physicalEcTofEast = new G4PVPlacement(0,G4ThreeVector(0,0,tofPara->GetzPosEastEc()),logicalEcTofEast,"physicalEcTofEast",logicalTof,false,0);
306
307
308 //place logicalTof in logicbes
309 physicalTof = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalTof,"physicalTof",logicalBes,false,0);
310
311 //Functions which construct the different parts of the TOF -->See below
312
313
314
315
316 //Construct Tape
317 //put these lines before ConstructBr1Tof();
318 //so in BesTofSD.cc, no need to change the tofid caculation method
319 G4Tubs* tubTape = new G4Tubs("tubTape",866, 866.3, 1150, 0, 360);
320 G4LogicalVolume* logicalTape = new G4LogicalVolume(tubTape,G4Material::GetMaterial("tape"),"logicalTape");
321 G4VPhysicalVolume* physicalTape = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalTape,"physicalTape",logicalBrTof,false,0);
322 logicalTape->SetVisAttributes(G4VisAttributes::Invisible);
323
327
328 }
329 else if (ReadBoostRoot::GetTof() == 4 ) //start TOF with MRPC Endcaps GDML Construction
330 {
331
332
333 MRPCG4Geo* aTofG4Geo = new MRPCG4Geo();
334 logicalTof = aTofG4Geo->GetTopVolume();
335 if (!logicalTof)
336 G4cout<<"BesTofConstruction::Construct(), logicalTof not found"<<G4endl;
337 else
338 {
339 physicalTof = new G4PVPlacement(0,G4ThreeVector(0,0,0),
340 logicalTof,"physicalTof",logicalBes,false,0);
341
342
343
344
345 logicalScinBr1 = FindLogicalVolume("logicalScinBr1");
346 logicalScinBr2 = FindLogicalVolume("logicalScinBr2");
347
348 logicalAlBr1 = FindLogicalVolume("logicalAlBr1");
349 logicalAlBr2 = FindLogicalVolume("logicalAlBr2");
350 logicalPVFBr1 = FindLogicalVolume("logicalPVFBr1");
351 logicalPVFBr2 = FindLogicalVolume("logicalPVFBr2");
352 logicalBucketBr1 = FindLogicalVolume("logicalBucketBr1");
353 logicalBucketBr2 = FindLogicalVolume("logicalBucketBr2");
354
355 logical_sensitive_detector_east_1 =FindLogicalVolume("logical_sensitive_detector_east_1");
356 logical_sensitive_detector_east_2 =FindLogicalVolume("logical_sensitive_detector_east_2");
357 logical_sensitive_detector_west_1 =FindLogicalVolume("logical_sensitive_detector_west_1");
358 logical_sensitive_detector_west_2 =FindLogicalVolume("logical_sensitive_detector_west_2");
359
360
361
362 }
363
364 delete aTofG4Geo;
365 } //close else if(==4)
366 else
367 {
368 //-----------------logicalTof added here
369 BesTofGeoParameter* tofPara = BesTofGeoParameter::GetInstance(); //This part intialize a function where the Parameter of the TOF are saved! A lot of the function used below can be found here!
370
371 //Get the coordinates of the TOF
372 G4double r1=tofPara->GetEcR1()-1; //=399
373 G4double r2=tofPara->GetBucketPosR()+0.5*tofPara->GetBucketDEc()+1; //=474
374 G4double r3=810;;
375 G4double r4=925;
376 G4double a1=1382+tofPara->GetBucketLEc()+1; //1463
377 G4double a2=1381; // Changed from 1382 to avoid overlapping with EMC
378 //to make the center of tub6 is tofPara.GetzPosEastEc()=1356
379 G4double a3=1330;
380 G4cout<<"Tof Volume: "<<r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<a1<<" "<<a2<<" "<<a3<<G4endl;
381
382 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
383 G4Tubs* tub2 = new G4Tubs("tub2",r2-4,r4,a2,0,360);
384 G4Tubs* tub3 = new G4Tubs("tub3",0,r3,a3,0,360);
385 G4UnionSolid* tub4 = new G4UnionSolid("tub4",tub1,tub2,0,G4ThreeVector(0,0,0) ); //Vereinigt tub 1 und 2 in tub4
386 G4SubtractionSolid* solidTof = new G4SubtractionSolid("solidTof",tub4,tub3,0, G4ThreeVector(0,0,0) ); //Subtracts tub4 - tub3
387
388 logicalTof = new G4LogicalVolume(solidTof, G4Material::GetMaterial("Air"),"logicalTof"); //book logical Tof VOlume
389
390 G4Tubs* tub5 = new G4Tubs("tub5",r3,r4,a3,0,360);
391 logicalBrTof = new G4LogicalVolume(tub5, G4Material::GetMaterial("Air"),"logicalBrTof"); //book logical Barrel TOF
392
393 G4VPhysicalVolume* physicalBrTof = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalBrTof,"physicalBrTof",logicalTof,false,0);
394
395
396
397 //Logical + Physical volumes for the endcaps
398 G4Tubs* tub6 = new G4Tubs("tub6",r1,r4,(a2-a3)/2,0,360);//r1=39.9cm, r4=92.5cm, zlength=2.55 cm
399 G4Tubs* tub7 = new G4Tubs("tub7",r1,r2,(a1-a2)/2,0,360);//r1=39.9cm, r2=47.4cm, zlength=4.05 cm
400 G4UnionSolid* tub8 = new G4UnionSolid("tub8",tub6,tub7,0,G4ThreeVector(0,0,(a3-a1)/2) );// -6.65cm
401 logicalEcTofWest = new G4LogicalVolume(tub8, G4Material::GetMaterial("Air"),"logicalEcTofWest");
402 G4VPhysicalVolume* physicalEcTofWest = new G4PVPlacement(0,G4ThreeVector(0,0,tofPara->GetzPosWestEc()),logicalEcTofWest,"physicalEcTofWest",logicalTof,false,0);
403
404 G4UnionSolid* tub9 = new G4UnionSolid("tub9",tub6,tub7,0,G4ThreeVector(0,0,(a1-a3)/2) );
405 logicalEcTofEast = new G4LogicalVolume(tub9, G4Material::GetMaterial("Air"),"logicalEcTofEast");
406 G4VPhysicalVolume* physicalEcTofEast = new G4PVPlacement(0,G4ThreeVector(0,0,tofPara->GetzPosEastEc()),logicalEcTofEast,"physicalEcTofEast",logicalTof,false,0);
407
408
409 //place logicalTof in logicbes
410 physicalTof = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalTof,"physicalTof",logicalBes,false,0);
411
412
413
414
415 //Construct Tape
416 //put these lines before ConstructBr1Tof();
417 //so in BesTofSD.cc, no need to change the tofid caculation method
418 G4Tubs* tubTape = new G4Tubs("tubTape",866, 866.3, 1150, 0, 360);
419 G4LogicalVolume* logicalTape = new G4LogicalVolume(tubTape,G4Material::GetMaterial("tape"),"logicalTape");
420 G4VPhysicalVolume* physicalTape = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalTape,"physicalTape",logicalBrTof,false,0);
421 logicalTape->SetVisAttributes(G4VisAttributes::Invisible);
422
423 //Functions which construct the different parts of the TOF -->See below
427 }
428
429
430
431 //sensitive detector
432 G4SDManager* SDman = G4SDManager::GetSDMpointer();
433 BesTofSD* tofSD = new BesTofSD("BesTofSD");
434 SDman->AddNewDetector(tofSD);
435
436 if (logicalScinBr1)
437 logicalScinBr1->SetSensitiveDetector(tofSD);
438 if (logicalScinBr2)
439 logicalScinBr2->SetSensitiveDetector(tofSD);
440 if (logicalScinEcWest)
441 logicalScinEcWest->SetSensitiveDetector(tofSD);
442 if (logicalScinEcEast)
443 logicalScinEcEast->SetSensitiveDetector(tofSD);
444
445 if(logical_sensitive_detector_east_1)
446 {logical_sensitive_detector_east_1->SetSensitiveDetector(tofSD); std::cout << "Found logical_sensitive_detector_east_1" <<std::endl;}
447 if(logical_sensitive_detector_east_2)
448 {logical_sensitive_detector_east_2->SetSensitiveDetector(tofSD);std::cout << "Found logical_sensitive_detector_east_2" <<std::endl;}
449 if(logical_sensitive_detector_west_1)
450 {logical_sensitive_detector_west_1->SetSensitiveDetector(tofSD);std::cout << "Found logical_sensitive_detector_west_1" <<std::endl;}
451 if(logical_sensitive_detector_west_2)
452 {logical_sensitive_detector_west_2->SetSensitiveDetector(tofSD);std::cout << "Found logical_sensitive_detector_west_2" <<std::endl;}
453
454
455 //For limits smaller than 0.02 one has to use the PAI-Model for ionisation!
456 if(logical_sensitive_detector_west_1) logical_sensitive_detector_west_1->SetUserLimits (new G4UserLimits(0.03*mm));
457 if(logical_sensitive_detector_west_2) logical_sensitive_detector_west_2->SetUserLimits (new G4UserLimits(0.03*mm));
458 if(logical_sensitive_detector_east_1) logical_sensitive_detector_east_1->SetUserLimits (new G4UserLimits(0.03*mm));
459 if(logical_sensitive_detector_east_2) logical_sensitive_detector_east_2->SetUserLimits (new G4UserLimits(0.03*mm));
460
461
462
463
464 //visual attributes
465 G4VisAttributes* visAttmrpc = new G4VisAttributes(G4Colour(1.,1.,0.));
466 G4VisAttributes* visAttmrpc_2 = new G4VisAttributes(G4Colour(1.,0.,0.));
467
468 if(logical_gascontainer_3_west_1) logical_gascontainer_3_west_1->SetVisAttributes(G4VisAttributes::Invisible);
469 if(logical_assembly_west_1) logical_assembly_west_1->SetVisAttributes(visAttmrpc_2) ;
470 if(logical_pcboard_west_1) logical_pcboard_west_1->SetVisAttributes(G4VisAttributes::Invisible) ;
471 if(logical_sensitive_detector_west_1) logical_sensitive_detector_west_1->SetVisAttributes(visAttmrpc);
472 if(logical_electrodes_west_1) logical_electrodes_west_1->SetVisAttributes(G4VisAttributes::Invisible);
473 if(logical_glass_layer_west_1) logical_glass_layer_west_1->SetVisAttributes(G4VisAttributes::Invisible);
474 if(logical_readoutstrips_012_west_1) logical_readoutstrips_012_west_1->SetVisAttributes(G4VisAttributes::Invisible);
475 if(logical_honeycomb_west_1) logical_honeycomb_west_1->SetVisAttributes(G4VisAttributes::Invisible);
476
477 if(logical_gascontainer_3_west_2) logical_gascontainer_3_west_2->SetVisAttributes(G4VisAttributes::Invisible);
478 if(logical_assembly_west_2) logical_assembly_west_2->SetVisAttributes(visAttmrpc_2) ;
479 if(logical_pcboard_west_2) logical_pcboard_west_2->SetVisAttributes(G4VisAttributes::Invisible) ;
480 if(logical_sensitive_detector_west_2) logical_sensitive_detector_west_2->SetVisAttributes(visAttmrpc);
481 if(logical_electrodes_west_2) logical_electrodes_west_2->SetVisAttributes(G4VisAttributes::Invisible);
482 if(logical_glass_layer_west_2) logical_glass_layer_west_2->SetVisAttributes(G4VisAttributes::Invisible);
483 if(logical_readoutstrips_012_west_2) logical_readoutstrips_012_west_2->SetVisAttributes(G4VisAttributes::Invisible);
484 if(logical_honeycomb_west_2) logical_honeycomb_west_2->SetVisAttributes(G4VisAttributes::Invisible);
485
486 if(logical_gascontainer_3_east_1) logical_gascontainer_3_east_1->SetVisAttributes(G4VisAttributes::Invisible);
487 if(logical_assembly_east_1) logical_assembly_east_1->SetVisAttributes(visAttmrpc_2) ;
488 if(logical_pcboard_east_1) logical_pcboard_east_1->SetVisAttributes(G4VisAttributes::Invisible) ;
489 if(logical_sensitive_detector_east_1) logical_sensitive_detector_east_1->SetVisAttributes(visAttmrpc);
490 if(logical_electrodes_east_1) logical_electrodes_east_1->SetVisAttributes(G4VisAttributes::Invisible);
491 if(logical_glass_layer_east_1) logical_glass_layer_east_1->SetVisAttributes(G4VisAttributes::Invisible);
492 if(logical_readoutstrips_012_east_1) logical_readoutstrips_012_east_1->SetVisAttributes(G4VisAttributes::Invisible);
493 if(logical_honeycomb_east_1) logical_honeycomb_east_1->SetVisAttributes(G4VisAttributes::Invisible);
494
495 if(logical_gascontainer_3_east_2) logical_gascontainer_3_east_2->SetVisAttributes(G4VisAttributes::Invisible);
496 if(logical_assembly_east_2) logical_assembly_east_2->SetVisAttributes(visAttmrpc_2) ;
497 if(logical_pcboard_east_2) logical_pcboard_east_2->SetVisAttributes(G4VisAttributes::Invisible) ;
498 if(logical_sensitive_detector_east_2) logical_sensitive_detector_east_2->SetVisAttributes(visAttmrpc);
499 if(logical_electrodes_east_2) logical_electrodes_east_2->SetVisAttributes(G4VisAttributes::Invisible);
500 if(logical_glass_layer_east_2) logical_glass_layer_east_2->SetVisAttributes(G4VisAttributes::Invisible);
501 if(logical_readoutstrips_012_east_2) logical_readoutstrips_012_east_2->SetVisAttributes(G4VisAttributes::Invisible);
502 if(logical_honeycomb_east_2) logical_honeycomb_east_2->SetVisAttributes(G4VisAttributes::Invisible);
503
504
505
506
507
508
509
510 G4VisAttributes* visBrTof = new G4VisAttributes(G4Colour(1.,0.,0.));
511 G4VisAttributes* visEcTof = new G4VisAttributes(G4Colour(0.,1.,0.));
512
513
514 if (logicalTof)
515 logicalTof->SetVisAttributes(G4VisAttributes::Invisible);
516 if (logicalBrTof)
517 logicalBrTof->SetVisAttributes(G4VisAttributes::Invisible);
518 //logicalBrTof->SetVisAttributes(visBrTof);
519 if (logicalEcTofWest)
520 logicalEcTofWest->SetVisAttributes(G4VisAttributes::Invisible);
521 //logicalEcTofWest->SetVisAttributes(visEcTof);
522 if (logicalEcTofEast)
523 logicalEcTofEast->SetVisAttributes(G4VisAttributes::Invisible);
524 //logicalEcTofEast->SetVisAttributes(visEcTof);
525
526 G4VisAttributes* visAttBrTof = new G4VisAttributes(G4Colour(0,1,1));
527 if (logicalScinBr1)
528 logicalScinBr1->SetVisAttributes(G4VisAttributes::Invisible);
529 //logicalScinBr1->SetVisAttributes(G4VisAttributes::Invisible);
530 if (logicalScinBr2)
531 logicalScinBr2->SetVisAttributes(G4VisAttributes::Invisible);
532 //logicalScinBr2->SetVisAttributes(G4VisAttributes::Invisible);
533
534
535 if (logicalAlBr1)
536 logicalAlBr1->SetVisAttributes(G4VisAttributes::Invisible);
537 if (logicalAlBr2)
538 logicalAlBr2->SetVisAttributes(G4VisAttributes::Invisible);
539
540 if (logicalPVFBr1)
541 logicalPVFBr1->SetVisAttributes(G4VisAttributes::Invisible);
542 if (logicalPVFBr2)
543 logicalPVFBr2->SetVisAttributes(G4VisAttributes::Invisible);
544
545 G4VisAttributes* visAttBrBuck = new G4VisAttributes(G4Colour(1.,1.,0.));
546 if (logicalBucketBr1)
547 logicalBucketBr1->SetVisAttributes(visAttBrBuck);
548 //logicalBucketBr1->SetVisAttributes(G4VisAttributes::Invisible);
549 if (logicalBucketBr2)
550 logicalBucketBr2->SetVisAttributes(visAttBrBuck);
551 //logicalBucketBr2->SetVisAttributes(G4VisAttributes::Invisible);
552
553 G4VisAttributes* visAttEcTof = new G4VisAttributes(G4Colour(0.,1.,1.));
554 if (logicalScinEcWest)
555 logicalScinEcWest->SetVisAttributes(visAttEcTof);
556 //logicalScinEc->SetVisAttributes(G4VisAttributes::Invisible);
557 if (logicalScinEcEast)
558 logicalScinEcEast->SetVisAttributes(visAttEcTof);
559
560 G4VisAttributes* visAttEcBuck = new G4VisAttributes(G4Colour(1.,1.,0.));
561 if (logicalBucketEc)
562 logicalBucketEc->SetVisAttributes(visAttEcBuck);
563 //logicalBucketEc->SetVisAttributes(G4VisAttributes::Invisible);
564
565 if (logicalAlEcWest)
566 logicalAlEcWest->SetVisAttributes(G4VisAttributes::Invisible);
567 if (logicalAlEcEast)
568 logicalAlEcEast->SetVisAttributes(G4VisAttributes::Invisible);
569 if (logicalPVFEcWest)
570 logicalPVFEcWest->SetVisAttributes(G4VisAttributes::Invisible);
571 if (logicalPVFEcEast)
572 logicalPVFEcEast->SetVisAttributes(G4VisAttributes::Invisible);
573}
574
576{
578
579 //Get barrel tof layer1 geometry data
580 G4int nScinBr=tofPara->GetnScinBr(); //number of barrel scintillators
581 G4double br1L=tofPara->GetBr1L();
582 G4double br1TrapW1=tofPara->GetBr1TrapW1();
583 G4double br1TrapW2=tofPara->GetBr1TrapW2();
584 G4double br1TrapH=tofPara->GetBr1TrapH();
585 G4double br1R1=tofPara->GetBr1R1();
586 G4double AlThickness=tofPara->GetAlThickness();
587 G4double PVFThickness=tofPara->GetPVFThickness();
588 //barrel PMT bucket geometry data
589 G4double bucketDBr=tofPara->GetBucketDBr(); //diameter of barrel PMT bucket
590 G4double bucketLBr=tofPara->GetBucketLBr(); //length of barrel PMT bucket
591
592 //computer from the original data
593 G4double angleBr=360./nScinBr*deg;
594 G4double scinTrapdx1,scinTrapdx2,scinTrapdx3,scinTrapdx4;
595 scinTrapdx1=scinTrapdx3=br1TrapW1/2.;
596 scinTrapdx2=scinTrapdx4=br1TrapW2/2.;
597 G4double scinTrapdy1,scinTrapdy2;
598 scinTrapdy1=scinTrapdy2=0.5*br1TrapH;
599 G4double scinTrapdz=br1L/2.;
600 G4double scinPosR=br1R1+scinTrapdy1;
601 G4double theta = atan((br1TrapW2/2.-br1TrapW1/2.)/br1TrapH);
602 G4double delta13 = AlThickness*(1/cos(theta)-tan(theta));
603 G4double delta24 = AlThickness*(1/cos(theta)+tan(theta));
604 G4double delta13P = (PVFThickness+AlThickness)*(1/cos(theta)-tan(theta));
605 G4double delta24P = (PVFThickness+AlThickness)*(1/cos(theta)+tan(theta));
606
607 //construct barrel tof scintillator
608 G4Trap* solidScinBr1=new G4Trap("solidScinBr1",scinTrapdz,0*deg,0*deg,
609 scinTrapdy1,scinTrapdx1,scinTrapdx2,0*deg,
610 scinTrapdy2,scinTrapdx3,scinTrapdx4,0*deg);
611 logicalScinBr1 = new G4LogicalVolume(solidScinBr1,BC408,"logicalScinBr1");
612
613 //construct barrel Al film and PVF film
614 G4Trap* solidAlBr1 = new G4Trap("solidAlBr1", scinTrapdz+0.001,0*deg,0*deg,
615 scinTrapdy1+AlThickness, scinTrapdx1+delta13, scinTrapdx2+delta24 ,0*deg,
616 scinTrapdy2+AlThickness, scinTrapdx3+delta13, scinTrapdx4+delta24 ,0*deg);
617
618 logicalAlBr1 = new G4LogicalVolume(solidAlBr1,G4Material::GetMaterial("Aluminium"),"logicalAlBr1");
619 G4Trap* solidPVFBr1 = new G4Trap("solidPVFBr1",scinTrapdz+0.002,0*deg,0*deg,
620 scinTrapdy1+AlThickness+PVFThickness,scinTrapdx1+delta13P, scinTrapdx2+delta24P,0*deg,
621 scinTrapdy2+AlThickness+PVFThickness,scinTrapdx3+delta13P, scinTrapdx4+delta24P,0*deg);
622
623 logicalPVFBr1 = new G4LogicalVolume(solidPVFBr1,PVF,"logicalPVFBr1");
624 //put daughter in mother logical volume
625 physicalAlBr1 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalAlBr1, "physicalAlBr1",logicalPVFBr1, false,0);
626 physicalScinBr1 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalScinBr1, "physicalScinBr1",logicalAlBr1, false, 0);
627
628 //construct barrel PMT bucket (bucket=Behaelter)
629 G4Tubs* solidBucketBr1= new G4Tubs("solidBucketBr1",0,bucketDBr/2.,
630 bucketLBr/2., 0, 360.*deg);
631 logicalBucketBr1=new G4LogicalVolume(solidBucketBr1,PMTmaterial,"logicalBucketBr1");
632
633
634 //Rotate the crystalls:
635 G4RotationMatrix trapRot;
636 trapRot.rotateZ(0.5*angleBr-90.*deg);
637 // /| y
638 //------- / | |
639 //\ / | | rotate->(0.5*angleBr-90.*deg): |
640 // \ / ->>>> | | -----x
641 // --- \ |
642 // \|
643 G4ThreeVector pos(0,0,0);
644 G4double x,y;
645 for (int i=0;i<nScinBr;i++)
646 {
647 ostringstream osnamePVFBr1;
648 osnamePVFBr1 << "physicalPVFBr1_"<<i;
649 ostringstream osnameBucket1Br1;
650 osnameBucket1Br1 << "physicalBucket1Br1_"<<i;
651 ostringstream osnameBucket2Br1;
652 osnameBucket2Br1 << "physicalBucket2Br1_"<<i;
653
654 //scintillator and casing
655 x=scinPosR*cos((i+0.5)*angleBr); //+0.5: start from phi=0
656 y=scinPosR*sin((i+0.5)*angleBr);
657 pos.setX(x);
658 pos.setY(y);
659 pos.setZ(0);
660
661 //to make code consistent with gdml
662 double a, b, c;
663 getXYZ(trapRot, a, b ,c); //Function is defined below
664 G4RotationMatrix trapRotTemp;
665 trapRotTemp.rotateZ(c);
666 G4Transform3D transform(trapRotTemp,pos);
667
668 //G4PVPlacement: Class representing a single volume positioned within and relative to a mother volume.
669 //G4Transform3D transform(trapRot,pos);
670 physicalPVFBr1 = new G4PVPlacement(transform,logicalPVFBr1,osnamePVFBr1.str(), logicalBrTof,false,i);
671 //bucket --> Two PMT, one on each side
672 pos.setZ(-(bucketLBr+br1L)/2.-0.01);
673 physicalBucket1Br1 = new G4PVPlacement(0,pos,logicalBucketBr1,osnameBucket1Br1.str(),logicalBrTof,false,0);
674 pos.setZ((bucketLBr+br1L)/2.+0.01);
675 physicalBucket2Br1 = new G4PVPlacement(0,pos,logicalBucketBr1,osnameBucket2Br1.str(),logicalBrTof,false,0);
676
677 //rotate for next scintillator
678 trapRot.rotateZ(angleBr);
679 }
680}
681
683{
685
686 //barrel tof layer2 geometry data
687 G4int nScinBr=tofPara->GetnScinBr(); //number of barrel scintillators
688 G4double br2L=tofPara->GetBr2L();
689 G4double br2TrapW1=tofPara->GetBr2TrapW1();
690 G4double br2TrapW2=tofPara->GetBr2TrapW2();
691 G4double br2TrapH=tofPara->GetBr2TrapH();
692 G4double br2R1=tofPara->GetBr2R1();
693 G4double AlThickness=tofPara->GetAlThickness();
694 G4double PVFThickness=tofPara->GetPVFThickness();
695 //barrel PMT bucket geometry data
696 G4double bucketDBr=tofPara->GetBucketDBr(); //diameter of barrel PMT bucket
697 G4double bucketLBr=tofPara->GetBucketLBr(); //length of barrel PMT bucket
698
699 //computer from the original data
700 G4double angleBr=360./nScinBr*deg;
701 G4double scinTrapdx1,scinTrapdx2,scinTrapdx3,scinTrapdx4;
702 scinTrapdx1=scinTrapdx3=br2TrapW1/2.;
703 scinTrapdx2=scinTrapdx4=br2TrapW2/2.;
704 G4double scinTrapdy1,scinTrapdy2;
705 scinTrapdy1=scinTrapdy2=0.5*br2TrapH;
706 G4double scinTrapdz=br2L/2.;
707 G4double scinPosR=br2R1+scinTrapdy1;
708 G4double theta = atan((br2TrapW2/2.-br2TrapW1/2.)/br2TrapH);
709 G4double delta13 = AlThickness*(1/cos(theta)-tan(theta));
710 G4double delta24 = AlThickness*(1/cos(theta)+tan(theta));
711 G4double delta13P = (PVFThickness+AlThickness)*(1/cos(theta)-tan(theta));
712 G4double delta24P = (PVFThickness+AlThickness)*(1/cos(theta)+tan(theta));
713
714 //construct barrel tof scintillator
715 G4Trap* solidScinBr2=new G4Trap("solidScinBr2",scinTrapdz,0*deg,0*deg,
716 scinTrapdy1,scinTrapdx1,scinTrapdx2,0*deg,
717 scinTrapdy2,scinTrapdx3,scinTrapdx4,0*deg);
718 logicalScinBr2 = new G4LogicalVolume(solidScinBr2,BC408,"logicalScinBr2");
719
720 //construct barrel Al film and PVF film
721 G4Trap* solidAlBr2 = new G4Trap("solidAlBr2", scinTrapdz+0.001,0*deg,0*deg,
722 scinTrapdy1+AlThickness, scinTrapdx1+delta13, scinTrapdx2+delta24 ,0*deg,
723 scinTrapdy2+AlThickness, scinTrapdx3+delta13, scinTrapdx4+delta24 ,0*deg);
724
725 logicalAlBr2 = new G4LogicalVolume(solidAlBr2,G4Material::GetMaterial("Aluminium"),"logicalAlBr2");
726 G4Trap* solidPVFBr2 = new G4Trap("solidPVFBr2",scinTrapdz+0.002,0*deg,0*deg,
727 scinTrapdy1+AlThickness+PVFThickness,scinTrapdx1+delta13P, scinTrapdx2+delta24P,0*deg,
728 scinTrapdy2+AlThickness+PVFThickness,scinTrapdx3+delta13P, scinTrapdx4+delta24P,0*deg);
729
730 logicalPVFBr2 = new G4LogicalVolume(solidPVFBr2,PVF,"logicalPVFBr2");
731 //put daughter in mother logical volume
732 physicalAlBr2 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalAlBr2, "physicalAlBr2",logicalPVFBr2, false,0);
733 physicalScinBr2 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalScinBr2, "physicalScinBr2",logicalAlBr2, false, 0);
734
735 //construct barrel PMT bucket
736 G4Tubs* solidBucketBr2= new G4Tubs("solidBucketBr2",0,bucketDBr/2.,
737 bucketLBr/2., 0, 360.*deg);
738 logicalBucketBr2=new G4LogicalVolume(solidBucketBr2,PMTmaterial,"logicalBucketBr2");
739
740 G4RotationMatrix trapRot;
741 trapRot.rotateZ(-90.*deg);
742 // /| y
743 //------- / | |
744 //\ / | | rotate->(-90.*deg): |
745 // \ / ->>>> | | -----x
746 // --- \ |
747 // \|
748 G4ThreeVector pos(0,0,0);
749 G4double x,y;
750 for (int i=0;i<nScinBr;i++)
751 {
752 ostringstream osnamePVFBr2;
753 osnamePVFBr2 << "physicalPVFBr2_"<<i;
754 ostringstream osnameBucket1Br2;
755 osnameBucket1Br2 << "physicalBucket1Br2_"<<i;
756 ostringstream osnameBucket2Br2;
757 osnameBucket2Br2 << "physicalBucket2Br2_"<<i;
758
759 //scintillator and casing
760 x=scinPosR*cos(i*angleBr); //+0.5: start from phi=0
761 y=scinPosR*sin(i*angleBr);
762 pos.setX(x);
763 pos.setY(y);
764 pos.setZ(0);
765 //to make code consistent with gdml
766 double a, b, c;
767 getXYZ(trapRot, a, b ,c);
768 G4RotationMatrix trapRotTemp;
769 trapRotTemp.rotateZ(c);
770 G4Transform3D transform(trapRotTemp,pos);
771 //G4Transform3D transform(trapRot,pos);
772 physicalPVFBr2 = new G4PVPlacement(transform,logicalPVFBr2,osnamePVFBr2.str(), logicalBrTof,false,i);
773 //bucket
774 pos.setZ(-(bucketLBr+br2L)/2.-0.01);
775 physicalBucket1Br2 = new G4PVPlacement(0,pos,logicalBucketBr2,osnameBucket1Br2.str(),logicalBrTof,false,0);
776 pos.setZ((bucketLBr+br2L)/2.+0.01);
777 physicalBucket2Br2 = new G4PVPlacement(0,pos,logicalBucketBr2,osnameBucket2Br2.str(),logicalBrTof,false,0);
778
779 //rotate for next scintillator
780 trapRot.rotateZ(angleBr);
781 }
782
783}
784
786{
788
789 //Get all interesting parameters for the TOF construction
790 //endcap geometry data
791 G4int nScinEc = tofPara->GetnScinEc(); //number of endcap scintillators
792 G4double ecL = tofPara->GetEcL();
793 G4double ecTrapW1 = tofPara->GetEcTrapW1();
794 G4double ecTrapW2 = tofPara->GetEcTrapW2();
795 G4double ecTrapH = tofPara->GetEcTrapH();
796 G4double ecTrapH1 = tofPara->GetEcTrapH1();
797 G4double zPosEastEc = tofPara->GetzPosEastEc(); //z position of east endcap
798 G4double zPosWestEc = tofPara->GetzPosWestEc(); //z position of west endcap
799 G4double ecR1 = tofPara->GetEcR1();
800 //G4double ecR2 = tofPara.GetEcR2();
801
802 //endcap PMT bucket geometry data
803 G4double bucketDEc = tofPara->GetBucketDEc(); //diameter of endcap PMT bucket
804 G4double bucketLEc = tofPara->GetBucketLEc(); //length of endcap PMT bucket
805 G4double bucketPosR = tofPara->GetBucketPosR(); //R of bucket center
806
807 G4double AlThickness=tofPara->GetAlThickness();
808 G4double PVFThickness=tofPara->GetPVFThickness();
809
810 G4double angleEc=360./nScinEc*deg;
811 G4double ecTrapW3 = ecTrapW1 + (ecTrapW2-ecTrapW1)*ecTrapH1/ecTrapH;
812 G4double ecTrapH2 = ecTrapH-ecTrapH1;
813 G4double pdz = ecL/2;
814 G4double ptheta = atan(ecTrapH1/(2*ecL));
815 G4double pdy1 = ecTrapH2/2;
816 G4double pdx1 = ecTrapW3/2;
817 G4double pdx2 = ecTrapW2/2;
818 G4double pdy2 = ecTrapH/2;
819 G4double pdx3 = ecTrapW1/2;
820 G4double pdx4 = ecTrapW2/2;
821
822 //because of removing a heighth of H1,
823 //plus initial center position ecR=ecR1+ecTrapH/2 with ecTrapH1/4
824 G4double ecR = ecR1+ecTrapH/2+ecTrapH1/4;
825
826 //construct endcap scintillator
827 G4Trap* solidScinEc=new G4Trap("solidScinEc",pdz,ptheta, 270*deg,
828 pdy1,pdx1,pdx2,0*deg,pdy2,pdx3,pdx4,0*deg);
829
830 logicalScinEcWest=new G4LogicalVolume(solidScinEc,BC404,"logicalScinEcWest");
831 logicalScinEcEast=new G4LogicalVolume(solidScinEc,BC404,"logicalScinEcEast");
832
833 //construct endcap PMT bucket
834 G4Tubs* solidBucketEc = new G4Tubs("solidBucketEc", 0, bucketDEc/2.,
835 bucketLEc/2., 0, 360.*deg);
836 logicalBucketEc = new G4LogicalVolume(solidBucketEc, PMTmaterial, "logicalBucketEc");
837
838 //construct Al and PVF film
839 G4double pthetaAl = atan(ecTrapH1/(2*(ecL+AlThickness*2)));
840 G4double theta1 = atan((ecTrapW2/2.-ecTrapW3/2.)/ecTrapH2);
841 G4double theta2 = atan((ecTrapW2/2.-ecTrapW1/2.)/ecTrapH);
842
843 G4double delta1 = AlThickness*(1/cos(theta1)-tan(theta1));
844 G4double delta2 = AlThickness*(1/cos(theta1)+tan(theta1));
845 G4double delta3 = AlThickness*(1/cos(theta2)-tan(theta2));
846 G4double delta4 = AlThickness*(1/cos(theta2)+tan(theta2));
847
848 G4double thick = AlThickness+PVFThickness;
849 G4double pthetaPVF = atan(ecTrapH1/(2*(ecL+thick*2)));
850 G4double delta1P = thick*(1/cos(theta1)-tan(theta1));
851 G4double delta2P = thick*(1/cos(theta1)+tan(theta1));
852 G4double delta3P = thick*(1/cos(theta2)-tan(theta2));
853 G4double delta4P = thick*(1/cos(theta2)+tan(theta2));
854
855 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);
856
857 logicalAlEcWest = new G4LogicalVolume(solidAlEc,G4Material::GetMaterial("Aluminium"),"logicalAlEcWest");
858 logicalAlEcEast = new G4LogicalVolume(solidAlEc,G4Material::GetMaterial("Aluminium"),"logicalAlEcEast");
859
860 G4Trap* solidPVFEc = new G4Trap("solidPVFEc",pdz+thick,pthetaPVF,270*deg,
861 pdy1+thick,pdx1+delta1P,pdx2+delta2P,0*deg,
862 pdy2+thick,pdx3+delta3P,pdx4+delta4P,0*deg);
863
864 logicalPVFEcWest = new G4LogicalVolume(solidPVFEc,PVF,"logicalPVFEcWest");
865 logicalPVFEcEast = new G4LogicalVolume(solidPVFEc,PVF,"logicalPVFEcEast");
866
867 //put scintilator in Al, then put Al in PVF
868 physicalAlEcWest = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalAlEcWest, "physicalAlEcWest",logicalPVFEcWest, false,0);
869 physicalScinEcWest = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalScinEcWest, "physicalScinEcWest",logicalAlEcWest, false, 0);
870
871
872 //put scintilator in Al, then put Al in PVF
873 physicalAlEcEast = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalAlEcEast, "physicalAlEcEast",logicalPVFEcEast, false,0);
874 physicalScinEcEast = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalScinEcEast, "physicalScinEcEast",logicalAlEcEast, false, 0);
875
876 //zPosWestEc<0, zPosEastEc>0, direction of axis z: west--->east
877 //construct west endcap first
878 //when no rotation, the first tub is start from phi=90
879 //after rotation, the first tub is start from 0, rotate angle = 0.5*angleEc
880 G4ThreeVector posW(0,0,0);
881 G4ThreeVector posE(0,0,0);
882 G4RotationMatrix trapRot;
883 trapRot.rotateY(180.*deg);
884 trapRot.rotateZ(0.5*angleEc-90*deg);
885 for (int i=0;i<nScinEc;i++)
886 {
887 ostringstream osnamePVFEc;
888 osnamePVFEc << "physicalPVFEcWest_"<<i;
889 ostringstream osnameBucketEc;
890 osnameBucketEc << "physicalBucketEcWest_"<<i;
891
892 posW.setX( ecR*cos((0.5+i)*angleEc) );
893 posW.setY( ecR*sin((0.5+i)*angleEc) );
894 //posW.setZ( zPosWestEc );
895 posW.setZ(0);
896
897 //to make code consistent with gdml
898 double a, b, c;
899 getXYZ(trapRot, a, b ,c);
900 G4RotationMatrix trapRotTemp;
901 trapRotTemp.rotateX(a);
902 trapRotTemp.rotateY(b);
903 trapRotTemp.rotateZ(c);
904 G4Transform3D transform(trapRotTemp,posW);
905 //G4Transform3D transform(trapRot,posW);
906 physicalPVFEcWest = new G4PVPlacement(transform,logicalPVFEcWest,osnamePVFEc.str(), logicalEcTofWest,false,i);
907 posW.setX( bucketPosR*cos((0.5+i)*angleEc) );
908 posW.setY( bucketPosR*sin((0.5+i)*angleEc) );
909 //posW.setZ( zPosWestEc-ecL/2-thick-bucketLEc/2-0.01 );
910 posW.setZ(-ecL/2-thick-bucketLEc/2-0.01 );
911 physicalBucketEc = new G4PVPlacement(0,posW,logicalBucketEc,osnameBucketEc.str(),logicalEcTofWest,false,0);
912 trapRot.rotateZ(angleEc); //pay attention: not i*angleEc
913 }
914 //to make east scintillator start from phi=0
915 // _ _
916 // _ - _ -
917 // - - - - ====> - - - - ====> - - - -
918 // ~ - _
919 //
920 trapRot.rotateZ(-angleEc);
921 trapRot.rotateX(180.*deg); //make east bucket point to the center
922 for (int i=0;i<nScinEc;i++)
923 {
924 ostringstream osnamePVFEc;
925 osnamePVFEc << "physicalPVFEcEast_"<<i;
926 ostringstream osnameBucketEc;
927 osnameBucketEc << "physicalBucketEcEast_"<<i;
928
929 posE.setX( ecR*cos((0.5+i)*angleEc) );
930 posE.setY( ecR*sin((0.5+i)*angleEc) );
931 //posE.setZ( zPosEastEc );
932 posE.setZ(0);
933
934 //to make code consistent with gdml
935 double a, b, c;
936 getXYZ(trapRot, a, b ,c);
937 G4RotationMatrix trapRotTemp;
938 trapRotTemp.rotateX(a);
939 trapRotTemp.rotateY(b);
940 trapRotTemp.rotateZ(c);
941 G4Transform3D transform(trapRotTemp,posE);
942 //G4Transform3D transform(trapRot,posE);
943 physicalPVFEcEast = new G4PVPlacement(transform,logicalPVFEcEast,osnamePVFEc.str(), logicalEcTofEast,false,i);
944 posE.setX( bucketPosR*cos((0.5+i)*angleEc) );
945 posE.setY( bucketPosR*sin((0.5+i)*angleEc) );
946 //posE.setZ( zPosEastEc+ecL/2+thick+bucketLEc/2+0.01 );
947 posE.setZ(ecL/2+thick+bucketLEc/2+0.01 );
948 physicalBucketEc = new G4PVPlacement(0,posE,logicalBucketEc,osnameBucketEc.str(),logicalEcTofEast,false,0);
949 trapRot.rotateZ(angleEc); //pay attention: not i*angleEc
950 }
951}
952
953
954//This function construct the TOF_Endcap_MRPC
956{
957 //BesTofGeoParameter* tofPara = BesTofGeoParameter::GetInstance();
958 //Get all interesting parameters for the MRPC construction
959
960 //I construct my detector in the Geant4 coordinate system. It will be rotated into the BES coordinatesystem later!
961 // |z ___________
962 // |_____x \ /
963 // / \ /
964 // /y \_____/
965
966
967 //Construct the frame of the mrpc chamber as well as the chamber itself (do=down, up=up , le=left, ri=right, fr=front, ba=back, out=outsside in =inside)
968
969
970 G4RotationMatrix rot_dummy(0*deg,0*deg,0*deg);
971 G4ThreeVector transl_dummy(0*deg,0*deg,0*deg);
972 G4Transform3D transf_dummy(rot_dummy,transl_dummy);
973
974
975 G4double l_mrpc_xdo_out=133.62*mm;
976 G4double lmrpc_xup_out =200.97*mm;
977 G4double lmrpc_z_out= 395.5*mm;
978 G4double lmrpc_yfr_out_e =24.50*mm;
979 G4double lmrpc_yba_out_e =24.50*mm;
980
981 G4double l_mrpc_xdo_ins=115.25*mm;
982 G4double lmrpc_xup_ins=180.56*mm;
983 G4double lmrpc_yfr_ins=22.50*mm;
984 G4double lmrpc_yba_ins=22.50*mm;
985 G4double lmrpc_z_ins=383.14*mm;
986 G4double delta_frame_x =7*mm;
987 G4double delta_frame_y=3*mm;
988 G4double inner_angle=9.74*deg;
989
990 G4double ks_trafo =10.*mm - (lmrpc_z_out)/2. + lmrpc_z_ins/2.;
991
992 G4Trd* frame_tot_e = new G4Trd("frame_tot_e",l_mrpc_xdo_out/2.,lmrpc_xup_out/2.,lmrpc_yfr_out_e/2.,lmrpc_yba_out_e/2.,lmrpc_z_out/2.);
993
994 G4Box* bendingbox_e = new G4Box("bendingbox_e",lmrpc_xup_out/2,lmrpc_yfr_out_e/2,5*mm);
995 G4ThreeVector trans_bendingbox_e(0.,0.,(5.*mm+lmrpc_z_out/2.-0.05*mm));
996 G4Transform3D transf_bendingbox_e(rot_dummy,trans_bendingbox_e);
997
998
999 G4double ztransframein_e= 10.*mm - (lmrpc_z_out)/2. + lmrpc_z_ins/2.;
1000 G4ThreeVector trans_frame_in_e(0.,0.,ztransframein_e);
1001 G4Transform3D transf_frame_in_e(rot_dummy,trans_frame_in_e);
1002
1003 G4UnionSolid * frame_000_e =new G4UnionSolid("frame_000_e",frame_tot_e,bendingbox_e,transf_bendingbox_e);
1004
1005 //Define all parameters to produce the bending of the box
1006 G4double r_bending_in=838.0*mm;
1007 G4double bending_angle_start=(90.-45.)*deg; //90
1008 G4double bending_angle_end=360*deg; //180
1009 G4double rot_bend_x=90.*deg;//0
1010 G4double rot_bend_y=90.*deg;//90
1011 G4double rot_bend_z=0.*deg;//90
1012 G4double transl_bend_x=0*mm;
1013 G4double transl_bend_y=0*mm;
1014 G4double transl_bend_z=-634.56*mm;
1015
1016
1017 G4Cons* bending_e = new G4Cons("bending_e",r_bending_in,(r_bending_in+30.*mm),r_bending_in,(r_bending_in+30.*mm),(lmrpc_yfr_out_e/2.+4*mm),bending_angle_start,bending_angle_end);
1018
1019 G4RotationMatrix rot_mat_bending;
1020 rot_mat_bending.rotateX(rot_bend_x);
1021 rot_mat_bending.rotateY(rot_bend_y);
1022 rot_mat_bending.rotateZ(rot_bend_z);
1023 G4ThreeVector transl_bending(transl_bend_x,transl_bend_y,transl_bend_z);
1024 G4Transform3D transf_bend(rot_mat_bending,transl_bending);
1025
1026 G4SubtractionSolid* frame_003_e = new G4SubtractionSolid("frame_003_e",frame_000_e,bending_e,transf_bend);
1027
1028 G4Cons* borehole_m10 = new G4Cons("borehole_m10",0.*mm,5.*mm,0.*mm,5.*mm,6.*mm,0*deg,360*deg); //z-length is long enough,will penetrate the metall totally
1029 G4RotationMatrix rot_mat_boreholes_m10(0*deg,0*deg,0*deg);
1030 G4ThreeVector transl_gas_l(36.*mm,0.,-(lmrpc_z_out-10.*mm)/2.);
1031 G4ThreeVector transl_gas_r(-36.*mm,0.,-(lmrpc_z_out-10.*mm)/2.);
1032 G4ThreeVector transl_HV_l(13.*mm,0.,-(lmrpc_z_out-10.*mm)/2.);
1033 G4ThreeVector transl_HV_r(-13.*mm,0.,-(lmrpc_z_out-10.*mm)/2.);
1034 G4Transform3D transf_gas_l(rot_mat_boreholes_m10,transl_gas_l);
1035 G4Transform3D transf_gas_r(rot_mat_boreholes_m10,transl_gas_r);
1036 G4Transform3D transf_HV_l(rot_mat_boreholes_m10,transl_HV_l);
1037 G4Transform3D transf_HV_r(rot_mat_boreholes_m10,transl_HV_r);
1038
1039 G4SubtractionSolid* frame_004_e = new G4SubtractionSolid("frame_004_e",frame_003_e,borehole_m10,transf_gas_l);
1040 G4SubtractionSolid* frame_005_e = new G4SubtractionSolid("frame_005_e",frame_004_e,borehole_m10,transf_gas_r);
1041 G4SubtractionSolid* frame_006_e = new G4SubtractionSolid("frame_006_e",frame_005_e,borehole_m10,transf_HV_l);
1042 G4SubtractionSolid* frame_007_e = new G4SubtractionSolid("frame_007_e",frame_006_e,borehole_m10,transf_HV_r);
1043
1044
1045 G4double readout_conncetor_y=4.5*mm;
1046 G4double readout_conncetor_z=23.0*mm;
1047
1048 G4double rot_readout_con_x=0*deg;
1049 G4double rot_readout_con_y=+inner_angle/2;
1050 G4double rot_readout_con_z=0*deg;
1051 G4RotationMatrix rot_readout_con_r;
1052 rot_readout_con_r.rotateX(rot_readout_con_x);
1053 rot_readout_con_r.rotateY(rot_readout_con_y);
1054 rot_readout_con_r.rotateZ(rot_readout_con_z);
1055
1056 G4RotationMatrix rot_readout_con_l;
1057 rot_readout_con_l.rotateX(rot_readout_con_x);
1058 rot_readout_con_l.rotateY(-rot_readout_con_y);
1059 rot_readout_con_l.rotateZ(rot_readout_con_z);
1060
1061
1062 //Add readout connectors
1063 G4Box* readout_connector_e = new G4Box("readout_connector_e",2.*mm,readout_conncetor_y,readout_conncetor_z);
1064 //Position of the first readout_connector
1065 G4double transl_readout_con1_x=(((lmrpc_z_ins-(182.*mm+1.*mm)*cos(inner_angle/2))*tan(inner_angle/2))+l_mrpc_xdo_ins/2.+delta_frame_x/cos(inner_angle/2.)+delta_frame_y/2./cos(inner_angle/2.));
1066 G4double transl_readout_con1_y=-1.25*mm;
1067 G4double transl_readout_con1_z=lmrpc_z_ins/2.-183*mm*cos(inner_angle/2) + ks_trafo ; //-8.57*mm - (lmrpc_z_out)/2. + lmrpc_z_ins/2.;
1068 G4ThreeVector transl_readout_con1(transl_readout_con1_x,transl_readout_con1_y,transl_readout_con1_z);
1069 G4Transform3D transf_readout_con1(rot_readout_con_r,transl_readout_con1);
1070 //Position of the second readout_connector
1071 G4double transl_readout_con2_x=(lmrpc_z_ins-96.*mm*cos(inner_angle/2))*tan(inner_angle/2.)+l_mrpc_xdo_ins/2.+delta_frame_x/cos(inner_angle/2.)+delta_frame_y/2./cos(inner_angle/2.);
1072 G4double transl_readout_con2_y=-1.25*mm;
1073 G4double transl_readout_con2_z=lmrpc_z_ins/2.-96.*mm*cos(inner_angle/2) + ks_trafo;
1074 G4ThreeVector transl_readout_con2(transl_readout_con2_x,transl_readout_con2_y,transl_readout_con2_z);
1075 G4Transform3D transf_readout_con2(rot_readout_con_r,transl_readout_con2);
1076 //Position of the third readout_connector
1077 G4double transl_readout_con3_x=-((lmrpc_z_ins-183.*mm*cos(inner_angle/2))*tan(inner_angle/2)+l_mrpc_xdo_ins/2.+delta_frame_x/cos(inner_angle/2.)+delta_frame_y/cos(inner_angle/2.)/2.);
1078 G4double transl_readout_con3_y=-1.25*mm;
1079 G4double transl_readout_con3_z=lmrpc_z_ins/2.-183*mm*cos(inner_angle/2) + ks_trafo ;
1080 G4ThreeVector transl_readout_con3(transl_readout_con3_x,transl_readout_con3_y,transl_readout_con3_z);
1081 G4Transform3D transf_readout_con3(rot_readout_con_l,transl_readout_con3);
1082 //Position of the fourth readout_connector
1083 G4double transl_readout_con4_x=-((lmrpc_z_ins-96.*mm*cos(inner_angle/2))*tan(inner_angle/2)+l_mrpc_xdo_ins/2.+delta_frame_x/cos(inner_angle/2.)+delta_frame_y/cos(inner_angle/2.)/2.);
1084 G4double transl_readout_con4_y=-1.25*mm;
1085 G4double transl_readout_con4_z=lmrpc_z_ins/2.-96*mm*cos(inner_angle/2) + ks_trafo;
1086 G4ThreeVector transl_readout_con4(transl_readout_con4_x,transl_readout_con4_y,transl_readout_con4_z);
1087 G4Transform3D transf_readout_con4(rot_readout_con_l,transl_readout_con4);
1088
1089
1090 G4SubtractionSolid* frame_012_e = new G4SubtractionSolid("frame_012_e",frame_007_e,readout_connector_e,transf_readout_con1);
1091 G4SubtractionSolid* frame_013_e = new G4SubtractionSolid("frame_013_e",frame_012_e,readout_connector_e,transf_readout_con2);
1092 G4SubtractionSolid* frame_014_e = new G4SubtractionSolid("frame_014_e",frame_013_e,readout_connector_e,transf_readout_con3);
1093 G4SubtractionSolid* frame_015_e = new G4SubtractionSolid("frame_015_e",frame_014_e,readout_connector_e,transf_readout_con4);
1094
1095
1096 //Produce the interface of the readout_connector
1097 G4double interface_readout_x=1.5*mm;
1098 G4double interface_readout_y=20*mm;
1099 G4double interface_readout_z=160.00*mm;
1100 G4double interface_readout_connector_y=7*mm;
1101 G4double interface_readout_connector_z=44.00*mm;
1102
1103 G4double rot_interface_readout_x=0*deg;
1104 G4double rot_interface_readout_y=-inner_angle/2;
1105 G4double rot_interface_readout_z=0*deg;
1106 G4RotationMatrix rot_interface_readout_r;
1107 G4RotationMatrix rot_interface_readout_l;
1108 rot_interface_readout_r.rotateX(rot_interface_readout_x);
1109 rot_interface_readout_r.rotateY(rot_interface_readout_y);
1110 rot_interface_readout_r.rotateZ(rot_interface_readout_z);
1111 rot_interface_readout_l.rotateX(rot_interface_readout_x);
1112 rot_interface_readout_l.rotateY(-rot_interface_readout_y);
1113 rot_interface_readout_l.rotateZ(rot_interface_readout_z);
1114
1115
1116 G4Box* interface_readout_001= new G4Box("interface_readout_001",interface_readout_x/2.,interface_readout_y/2.,interface_readout_z/2.);
1117 G4Box* interface_readout_connector =new G4Box("interface_readout_connector",1.5,interface_readout_connector_y/2.,interface_readout_connector_z/2.);
1118
1119
1120 G4ThreeVector transl_interface_readout_connector_1(0*mm,-1.25*mm,-43.5*mm);
1121 G4ThreeVector transl_interface_readout_connector_2(0*mm,-1.25*mm,+43.5*mm);
1122 G4Transform3D transf_interface_readout_connector_1(rot_dummy,transl_interface_readout_connector_1);
1123 G4Transform3D transf_interface_readout_connector_2(rot_dummy,transl_interface_readout_connector_2);
1124
1125
1126 G4SubtractionSolid* interface_readout_002= new G4SubtractionSolid("interface_readout_002",interface_readout_001,interface_readout_connector,transf_interface_readout_connector_1);
1127 G4SubtractionSolid* interface_readout_006= new G4SubtractionSolid("interface_readout_006",interface_readout_002,interface_readout_connector,transf_interface_readout_connector_2);
1128
1129
1130 G4double readout_box_wallthickness= 0.80*mm;
1131
1132 G4double l_readoutbox_xdo_help=45.18*mm;
1133 G4double l_readoutbox_xup_help=86.63*mm;
1134 G4double l_readoutbox_z_help=233*mm;
1135 G4double angle_readoutbox=2*asin((l_readoutbox_xup_help-l_readoutbox_xdo_help)/(2*l_readoutbox_z_help))*180/pi*deg;
1136
1137 G4double l_readoutbox_xdo=l_readoutbox_xdo_help+2*1.5/cos(angle_readoutbox/2)*mm; //+1.5 for the mounting
1138 G4double l_readoutbox_xup=l_readoutbox_xup_help+2*1.5/cos(angle_readoutbox/2)*mm;
1139 G4double l_readoutbox_yfr=21*mm;
1140 G4double l_readoutbox_yba=21*mm;
1141 G4double l_readoutbox_z=l_readoutbox_z_help*cos(angle_readoutbox/2);
1142 //G4cout << G4endl << l_readoutbox_z << G4endl;
1143 //Parameter for the cut of the main inner part
1144 G4double l_cut_1_readoutbox_xdo= (43.71)*mm;
1145 G4double l_cut_1_readoutbox_xup= 85.08*mm;
1146 G4double l_cut_1_readoutbox_yfr= l_readoutbox_yfr;
1147 G4double l_cut_1_readoutbox_yba= l_readoutbox_yba;
1148 G4double l_cut_1_readoutbox_z=(l_readoutbox_z-2*readout_box_wallthickness);
1149
1150 //Parameter for the cut of the openings on the side
1151 G4double l_cut_2_readoutbox_xdo=(2*18.64*sin(angle_readoutbox/2)*mm+l_readoutbox_xdo+2.5*mm); //2.5 mm in order to cut enough
1152 G4double l_cut_2_readoutbox_xup=(2*180.14*sin(angle_readoutbox/2)*mm+l_readoutbox_xdo+2.5*mm); //2.5 mm in order to cut enough
1153 G4double l_cut_2_readoutbox_yfr=21*mm;
1154 G4double l_cut_2_readoutbox_yba=21*mm;
1155 G4double l_cut_2_readoutbox_z=161.5*cos(angle_readoutbox/2)*mm;
1156
1157 //Parameter for cuts above and below the openings
1158 G4double l_cut_3_readoutbox_xdo=50.27*mm;
1159 G4double l_cut_3_readoutbox_xup=(81.81+2*1.6)*mm;
1160 G4double l_cut_3_readoutbox_yfr=21*mm;
1161 G4double l_cut_3_readoutbox_yba=21*mm;
1162 G4double l_cut_3_readoutbox_z=195.20*cos(angle_readoutbox/2)*mm;
1163
1164
1165 G4Trd* readoutbox_tot = new G4Trd("readoutbox_tot",l_readoutbox_xdo/2,l_readoutbox_xup/2,l_readoutbox_yfr/2,l_readoutbox_yba/2,l_readoutbox_z/2);
1166
1167 G4Trd* readoutbox_cut_1 = new G4Trd("readoutbox_cut_1",l_cut_1_readoutbox_xdo/2,l_cut_1_readoutbox_xup/2,l_cut_1_readoutbox_yfr/2,l_cut_1_readoutbox_yba/2,l_cut_1_readoutbox_z/2);
1168 G4ThreeVector transl_readoutbox_cut_1(0*mm,readout_box_wallthickness,0*mm);
1169 G4Transform3D transf_readoutbox_cut_1(rot_dummy,transl_readoutbox_cut_1);
1170
1171
1172 G4Trd* readoutbox_cut_2 = new G4Trd("readoutbox_cut_2",l_cut_2_readoutbox_xdo/2,l_cut_2_readoutbox_xup/2,l_cut_2_readoutbox_yfr/2,l_cut_2_readoutbox_yba/2,l_cut_2_readoutbox_z/2);
1173 G4ThreeVector transl_readoutbox_cut_2(0*mm,readout_box_wallthickness,20.14*cos(angle_readoutbox/2)*mm-l_readoutbox_z/2+l_cut_2_readoutbox_z/2);//18.64-->20.14
1174 G4Transform3D transf_readoutbox_cut_2(rot_dummy,transl_readoutbox_cut_2);
1175
1176 //Cable conncection Readoutbox
1177 G4Cons* readoutbox_cablecon = new G4Cons("readoutbox_cablecon",0.*mm,6.5*mm,0.*mm,6.5*mm,1*mm,0*deg,360*deg);
1178 G4Box * readoutbox_abovecablecon = new G4Box("readoutbox_abovecablecon",6.5,5.26,1);
1179
1180 G4ThreeVector transl_readoutbox_cablecon(0*mm,0*mm,-l_readoutbox_z/2+readout_box_wallthickness/2);
1181 G4Transform3D transf_readoutbox_cablecon(rot_dummy,transl_readoutbox_cablecon);
1182
1183 G4ThreeVector transl_readoutbox_abovecablecon(0*mm,5.25*mm+0.005*mm,-l_readoutbox_z/2+readout_box_wallthickness/2);
1184 G4Transform3D transf_readoutbox_abovecablecon(rot_dummy,transl_readoutbox_abovecablecon);
1185
1186
1187 //Above and below opening
1188 G4Trd* readoutbox_cut_3 = new G4Trd("readoutbox_cut_3",l_cut_3_readoutbox_xdo/2,l_cut_3_readoutbox_xup/2,l_cut_3_readoutbox_yfr/2,l_cut_3_readoutbox_yba/2,l_cut_3_readoutbox_z/2);
1189 G4ThreeVector transl_readoutbox_cut_3(0*mm,readout_box_wallthickness,18.94*cos(angle_readoutbox/2)*mm-l_readoutbox_z/2+l_cut_3_readoutbox_z/2); //18.64-1.5+0.8=17.94
1190 G4Transform3D transf_readoutbox_cut_3(rot_dummy,transl_readoutbox_cut_3);
1191
1192
1193
1194 G4SubtractionSolid* readoutbox_001_e= new G4SubtractionSolid("readoutbox_001_e",readoutbox_tot,readoutbox_cut_1,transf_readoutbox_cut_1);
1195 G4SubtractionSolid* readoutbox_002_e= new G4SubtractionSolid("readoutbox_002_e",readoutbox_001_e,readoutbox_cut_2,transf_readoutbox_cut_2);
1196 G4SubtractionSolid* readoutbox_007_e= new G4SubtractionSolid("readoutbox_007_e",readoutbox_002_e,readoutbox_cablecon,transf_readoutbox_cablecon);
1197 G4SubtractionSolid* readoutbox_008_e= new G4SubtractionSolid("readoutbox_008_e",readoutbox_007_e,readoutbox_abovecablecon,transf_readoutbox_abovecablecon);
1198 G4SubtractionSolid* readoutbox_009_e= new G4SubtractionSolid("readoutbox_009_e",readoutbox_008_e,readoutbox_cut_3,transf_readoutbox_cut_3);
1199 //For the bottom part of the bracket I will add some materia.
1200 G4double bottom_bracket_x_e=15.0*mm ;
1201 G4double bottom_bracket_y_e=1.2*mm ; //To avoid overlapping surface!
1202 G4double bottom_bracket_z_e=18*mm ;
1203 G4Box* bottom_bracket= new G4Box("bottom_bracket",bottom_bracket_x_e/2,bottom_bracket_y_e/2,bottom_bracket_z_e/2);
1204
1205 G4ThreeVector transl_bottom_bracket_1((l_readoutbox_xdo/2-bottom_bracket_x_e/2),-(l_readoutbox_yfr/2 + bottom_bracket_y_e/2)+0.2*mm,-(l_readoutbox_z/2-bottom_bracket_z_e/2));
1206 G4Transform3D transf_bottom_bracket_1(rot_dummy,transl_bottom_bracket_1);
1207 G4UnionSolid* readoutbox_010_e = new G4UnionSolid("readoutbox_010_e",readoutbox_009_e,bottom_bracket,transf_bottom_bracket_1);
1208
1209 G4ThreeVector transl_bottom_bracket_2(-(l_readoutbox_xdo/2-bottom_bracket_x_e/2),-(l_readoutbox_yfr/2 + bottom_bracket_y_e/2)+0.2*mm,-(l_readoutbox_z/2-bottom_bracket_z_e/2));
1210 G4Transform3D transf_bottom_bracket_2(rot_dummy,transl_bottom_bracket_2);
1211 G4UnionSolid* readoutbox_011_e = new G4UnionSolid("readoutbox_011_e",readoutbox_010_e,bottom_bracket,transf_bottom_bracket_2);
1212
1213
1214 G4ThreeVector transl_bottom_bracket_3(-(l_readoutbox_xup/2-bottom_bracket_x_e/2-bottom_bracket_z_e*tan(angle_readoutbox/2)),-(l_readoutbox_yfr/2 + bottom_bracket_y_e/2)+0.2*mm,(l_readoutbox_z/2-bottom_bracket_z_e/2));
1215 G4Transform3D transf_bottom_bracket_3(rot_dummy,transl_bottom_bracket_3);
1216 G4UnionSolid* readoutbox_012_e = new G4UnionSolid("readoutbox_012_e",readoutbox_011_e,bottom_bracket,transf_bottom_bracket_3);
1217
1218 G4ThreeVector transl_bottom_bracket_4((l_readoutbox_xup/2-bottom_bracket_x_e/2-bottom_bracket_z_e*tan(angle_readoutbox/2)),-(l_readoutbox_yfr/2 + bottom_bracket_y_e/2)+0.2*mm,(l_readoutbox_z/2-bottom_bracket_z_e/2));
1219 G4Transform3D transf_bottom_bracket_4(rot_dummy,transl_bottom_bracket_4);
1220
1221
1222 G4UnionSolid* readoutbox_013_e = new G4UnionSolid("readoutbox_013_et",readoutbox_012_e,bottom_bracket,transf_bottom_bracket_4);
1223
1224
1225 //Build the link for two different chambers
1226
1227 double link_x_dotot = 60*mm;
1228 double link_z_mid =16.5*mm;
1229 double link_y=22.5*mm;
1230 double link_xangle=20.25*mm;
1231 double t_link_angle=10*deg;
1232
1233
1234 double link_x_trp1_do = (link_x_dotot+2*mm);
1235 double link_x_trp1_up = link_x_dotot-2*link_xangle*cos(t_link_angle);
1236 double link_z_trp1 = (link_x_trp1_do-link_x_trp1_up)/2*tan(t_link_angle);
1237
1238 double link_x_trp2_do = (link_x_dotot-2*link_xangle*tan(t_link_angle)+2*mm);
1239 double link_x_trp2_up = link_x_trp1_up -link_z_mid*tan(t_link_angle);
1240 double link_z_trp2 = (link_x_trp2_do-link_x_trp2_up)/2*tan(t_link_angle);
1241
1242
1243 G4Trd* link_up = new G4Trd("link_up",link_x_trp1_do/2,link_x_trp1_up/2,link_y/2,link_y/2,link_z_trp1/2);
1244 double transl_link_up_z=link_z_mid/2+link_xangle*sin(t_link_angle)/2;
1245
1246 G4Trd* link_do = new G4Trd("link_do",link_x_trp2_do/2,link_x_trp2_up/2,link_y/2+3*mm,link_y/2+3*mm,link_z_trp2/2);
1247 double transl_link_do_z=link_z_mid/2-link_xangle*sin(t_link_angle)/2;
1248 G4Box* t_box = new G4Box("link_box",(link_x_dotot)/2+10*mm,(link_y)/2+10*mm,(link_z_mid)/2);
1249
1250 G4ThreeVector transl_link_up(0,0,transl_link_up_z);
1251 G4Transform3D transf_link_up(rot_dummy,transl_link_up);
1252 G4ThreeVector transl_link_do(0,0,-transl_link_do_z);
1253 G4Transform3D transf_link_do(rot_dummy,transl_link_do);
1254
1255 G4UnionSolid* link_1= new G4UnionSolid("link_1",t_box,link_up,transf_link_up);
1256 G4SubtractionSolid* link_2 = new G4SubtractionSolid("link_2",link_1,link_do,transf_link_do);
1257 G4Trd* t_box_2 = new G4Trd("link_box_2",link_x_trp2_do/2,(30*mm*tan(10*deg)*2+link_x_trp2_do)/2,22.5*mm/2 ,22.5*mm/2,30*mm/2);
1258 G4ThreeVector transl_link_3(0,0,(15*mm-link_z_mid/2));
1259 G4Transform3D transf_link_3(rot_dummy,transl_link_3);
1260 G4IntersectionSolid * link_3 = new G4IntersectionSolid("link_3",link_2,t_box_2,transf_link_3);
1261
1262
1263
1264 //Unify readoutbox and connectors!
1265 G4double rot_interface_x_r_e=0*deg;
1266 G4double rot_interface_y_r_e=-angle_readoutbox/2;
1267 G4double rot_interface_z_r_e=0*deg;
1268 G4RotationMatrix rot_interface_r_e;
1269 rot_interface_r_e.rotateX(rot_interface_x_r_e);
1270 rot_interface_r_e.rotateY(rot_interface_y_r_e);
1271 rot_interface_r_e.rotateZ(rot_interface_z_r_e);
1272 G4RotationMatrix rot_interface_l_e;
1273 rot_interface_l_e.rotateX(rot_interface_x_r_e);
1274 rot_interface_l_e.rotateY(-rot_interface_y_r_e);
1275 rot_interface_l_e.rotateZ(rot_interface_z_r_e);
1276 G4ThreeVector transl_interface_r_e(-((20.14*cos(angle_readoutbox/2)*mm+l_cut_2_readoutbox_z/2)*tan(angle_readoutbox/2)+l_readoutbox_xdo/2-0.75*mm/cos(inner_angle/2))
1277 //0.75 are from thickness of interface and bracket (bracket -1.5 interface +0.75)
1278 ,readout_box_wallthickness,
1279 20.14*cos(angle_readoutbox/2)*mm-l_readoutbox_z/2+l_cut_2_readoutbox_z/2
1280 );
1281
1282 G4Transform3D transf_interface_r_e(rot_interface_r_e,transl_interface_r_e);
1283 G4ThreeVector transl_interface_l_e(((20.14*cos(angle_readoutbox/2)*mm+l_cut_2_readoutbox_z/2)*tan(angle_readoutbox/2)+l_readoutbox_xdo/2-0.75*mm/cos(inner_angle/2))
1284 //0.75 are from thickness of interface and bracket
1285 ,readout_box_wallthickness,
1286 20.14*cos(angle_readoutbox/2)*mm-l_readoutbox_z/2+l_cut_2_readoutbox_z/2
1287 );
1288 G4Transform3D transf_interface_l_e(rot_interface_l_e,transl_interface_l_e);
1289
1290 G4UnionSolid* assembly_01_e=new G4UnionSolid("assembly_01",readoutbox_013_e,interface_readout_006, transf_interface_r_e);
1291 G4UnionSolid* assembly_02_e=new G4UnionSolid("assembly_02",assembly_01_e,interface_readout_006, transf_interface_l_e);
1292
1293
1294
1295 //Unify redaoutbox and frame
1296 G4RotationMatrix rot_assembly_01_e;
1297 rot_assembly_01_e.rotateY((inner_angle+angle_readoutbox)/2);
1298 G4ThreeVector transl_assembly_01_e(((lmrpc_z_ins-123.5*mm*cos(inner_angle/2))*tan(inner_angle/2)+l_mrpc_xdo_ins/2.+delta_frame_x/cos(inner_angle/2.)+delta_frame_y/cos(inner_angle/2.)
1299 + l_readoutbox_xdo/2+l_readoutbox_z/2*tan(angle_readoutbox/2)),
1300 -readout_box_wallthickness,
1301 lmrpc_z_ins/2-123.5*mm*cos(inner_angle/2)+ks_trafo-(l_readoutbox_xdo/2+l_readoutbox_z/2*tan(angle_readoutbox/2))*tan((inner_angle+angle_readoutbox)/2));
1302
1303 G4Transform3D transf_assembly_01_e(rot_assembly_01_e,transl_assembly_01_e);
1304 G4UnionSolid* assembly_03_e =new G4UnionSolid("assembly_01_e",frame_015_e,assembly_02_e,transf_assembly_01_e);
1305
1306 double transl_link_up_z_2=link_z_mid/2+ (link_x_dotot+(link_x_dotot-2*link_xangle*cos(t_link_angle))/2)/2*tan(t_link_angle)/2;
1307
1308 G4RotationMatrix rot_link_002_e;
1309 rot_link_002_e.rotateY(-10*deg);
1310 G4ThreeVector transl_link_002_e(-55*mm-20.03*mm,0*mm,-lmrpc_z_out/2-transl_link_up_z_2/cos(10*deg));
1311 G4Transform3D transf_link_002_e(rot_link_002_e,transl_link_002_e);
1312 G4UnionSolid* assembly_04_e =new G4UnionSolid("assembly_04_e",assembly_03_e,link_3,transf_link_002_e);
1313 //Final aluminum part
1314
1315
1316
1317
1318
1319
1320 //Construct PCBoard:
1321 double l_pcboard_xdo=114.0*mm;
1322 double l_pcboard_xup=174.0*mm;
1323 double l_pcboard_y=12.94*mm; //19.27 - 6.26-0.07
1324 double l_pcboard_z=352*mm;
1325 double angle_pcboard = atan((l_pcboard_xup-l_pcboard_xdo)/2./l_pcboard_z)*180/pi*deg;
1326 G4Trd* pcboard = new G4Trd("pcboard",l_pcboard_xdo/2.,l_pcboard_xup/2.,l_pcboard_y/2.,l_pcboard_y/2.,l_pcboard_z/2.);
1327
1328
1329
1330 double gaslayer_x_do=l_pcboard_xdo;
1331 double gaslayer_x_up=l_pcboard_xup;
1332 double gaslayer_y =4.82*mm;
1333 double gaslayer_z =l_pcboard_z;
1334
1335 //Construct the gas layer
1336 G4ThreeVector transl_gas_layer(0*mm,gaslayer_y+1.5*mm,0*mm); //1.5mm inner pc_board
1337 G4Transform3D transf_gas_layer(rot_dummy,transl_gas_layer);
1338
1339 G4Trd * gas_layer = new G4Trd("gas_layer",gaslayer_x_do/2.,gaslayer_x_up/2.,gaslayer_y/2.,gaslayer_y/2.,gaslayer_z/2.);
1340 G4UnionSolid *gas_layer_tot = new G4UnionSolid("gas_layer_tot",gas_layer,gas_layer,transf_gas_layer);
1341
1342
1343 double glasslayer_inner_x_do=88.68*mm;
1344 double glasslayer_inner_x_up=147.32*mm;
1345 double glasslayer_inner_y=0.4*mm;
1346 double glasslayer_inner_z=344*mm;
1347
1348 double glasslayer_outer_x_do=98.17*mm;
1349 double glasslayer_outer_x_up=157.83*mm;
1350 double glasslayer_outer_y=0.55*mm;
1351 double glasslayer_outer_z=350*mm;
1352
1353 double sdlayer_x_do=glasslayer_inner_x_do;
1354 double sdlayer_x_up=glasslayer_inner_x_up;
1355 double sdlayer_y=0.22*mm;
1356 double sdlayer_z =glasslayer_inner_z;
1357
1358
1359 /////////////////////////////////////
1360 //Construct the sensitive detector //
1361 G4ThreeVector transl_sdlayer_tot2(0*mm,sdlayer_y+glasslayer_inner_y,0*mm);
1362 G4ThreeVector transl_sdlayer_tot3(0*mm,2*(sdlayer_y+glasslayer_inner_y),0*mm);
1363 G4ThreeVector transl_sdlayer_tot4(0*mm,3*(sdlayer_y+glasslayer_inner_y),0*mm);
1364 G4ThreeVector transl_sdlayer_tot5(0*mm,4*(sdlayer_y+glasslayer_inner_y),0*mm);
1365 G4ThreeVector transl_sdlayer_tot6(0*mm,5*(sdlayer_y+glasslayer_inner_y),0*mm);
1366 G4ThreeVector transl_sdlayer_tot7(0*mm,6*(sdlayer_y+glasslayer_inner_y)+3*mm-glasslayer_inner_y,0*mm); //3mm = 1.5mm Pcboardinner + 2*(Mylar+Electrode)+2*outer glass
1367 G4ThreeVector transl_sdlayer_tot8(0*mm,7*(sdlayer_y+glasslayer_inner_y)+3*mm-glasslayer_inner_y,0*mm);
1368 G4ThreeVector transl_sdlayer_tot9(0*mm,8*(sdlayer_y+glasslayer_inner_y)+3*mm-glasslayer_inner_y,0*mm);
1369 G4ThreeVector transl_sdlayer_tot10(0*mm,9*(sdlayer_y+glasslayer_inner_y)+3*mm-glasslayer_inner_y,0*mm);
1370 G4ThreeVector transl_sdlayer_tot11(0*mm,10*(sdlayer_y+glasslayer_inner_y)+3*mm-glasslayer_inner_y,0*mm);
1371 G4ThreeVector transl_sdlayer_tot12(0*mm,11*(sdlayer_y+glasslayer_inner_y)+3*mm-glasslayer_inner_y,0*mm);
1372
1373 G4Transform3D transf_sdlayer_tot2(rot_dummy,transl_sdlayer_tot2);
1374 G4Transform3D transf_sdlayer_tot3(rot_dummy,transl_sdlayer_tot3);
1375 G4Transform3D transf_sdlayer_tot4(rot_dummy,transl_sdlayer_tot4);
1376 G4Transform3D transf_sdlayer_tot5(rot_dummy,transl_sdlayer_tot5);
1377 G4Transform3D transf_sdlayer_tot6(rot_dummy,transl_sdlayer_tot6);
1378 G4Transform3D transf_sdlayer_tot7(rot_dummy,transl_sdlayer_tot7);
1379 G4Transform3D transf_sdlayer_tot8(rot_dummy,transl_sdlayer_tot8);
1380 G4Transform3D transf_sdlayer_tot9(rot_dummy,transl_sdlayer_tot9);
1381 G4Transform3D transf_sdlayer_tot10(rot_dummy,transl_sdlayer_tot10);
1382 G4Transform3D transf_sdlayer_tot11(rot_dummy,transl_sdlayer_tot11);
1383 G4Transform3D transf_sdlayer_tot12(rot_dummy,transl_sdlayer_tot12);
1384
1385 G4Trd * sdlayer = new G4Trd("sdlayer",sdlayer_x_do/2.,sdlayer_x_up/2.,sdlayer_y/2.,sdlayer_y/2.,sdlayer_z/2.);
1386 G4UnionSolid *sdlayer_tot2 = new G4UnionSolid("sdlayer_tot2",sdlayer,sdlayer,transf_sdlayer_tot2);
1387 G4UnionSolid *sdlayer_tot3 = new G4UnionSolid("sdlayer_tot3",sdlayer_tot2,sdlayer,transf_sdlayer_tot3);
1388 G4UnionSolid *sdlayer_tot4 = new G4UnionSolid("sdlayer_tot4",sdlayer_tot3,sdlayer,transf_sdlayer_tot4);
1389 G4UnionSolid *sdlayer_tot5 = new G4UnionSolid("sdlayer_tot5",sdlayer_tot4,sdlayer,transf_sdlayer_tot5);
1390 G4UnionSolid *sdlayer_tot6 = new G4UnionSolid("sdlayer_tot6",sdlayer_tot5,sdlayer,transf_sdlayer_tot6);
1391 G4UnionSolid *sdlayer_tot7 = new G4UnionSolid("sdlayer_tot7",sdlayer_tot6,sdlayer,transf_sdlayer_tot7);
1392 G4UnionSolid *sdlayer_tot8 = new G4UnionSolid("sdlayer_tot8",sdlayer_tot7,sdlayer,transf_sdlayer_tot8);
1393 G4UnionSolid *sdlayer_tot9 = new G4UnionSolid("sdlayer_tot9",sdlayer_tot8,sdlayer,transf_sdlayer_tot9);
1394 G4UnionSolid *sdlayer_tot10 = new G4UnionSolid("sdlayer_tot10",sdlayer_tot9,sdlayer,transf_sdlayer_tot10);
1395 G4UnionSolid *sdlayer_tot11 = new G4UnionSolid("sdlayer_tot11",sdlayer_tot10,sdlayer,transf_sdlayer_tot11);
1396 G4UnionSolid *sensitive_detector = new G4UnionSolid("sensitive_detector",sdlayer_tot11,sdlayer,transf_sdlayer_tot12);
1397
1398
1399
1400 //////////////////////////////////////////////////////////////////
1401 //Construct the glasslayer. Be carefull: the thickness is changing!
1402
1403 G4ThreeVector transl_glass_2(0*mm,(glasslayer_outer_y/2.+sdlayer_y+glasslayer_inner_y/2.),0*mm);
1404 G4ThreeVector transl_glass_3(0*mm,(glasslayer_outer_y/2.+sdlayer_y+glasslayer_inner_y/2.)+(sdlayer_y+glasslayer_inner_y),0*mm);
1405 G4ThreeVector transl_glass_4(0*mm,(glasslayer_outer_y/2.+sdlayer_y+glasslayer_inner_y/2.)+2*(sdlayer_y+glasslayer_inner_y),0*mm);
1406 G4ThreeVector transl_glass_5(0*mm,(glasslayer_outer_y/2.+sdlayer_y+glasslayer_inner_y/2.)+3*(sdlayer_y+glasslayer_inner_y),0*mm);
1407 G4ThreeVector transl_glass_6(0*mm,(glasslayer_outer_y/2.+sdlayer_y+glasslayer_inner_y/2.)+4*(sdlayer_y+glasslayer_inner_y),0*mm);
1408 G4ThreeVector transl_glass_7(0*mm,2*(glasslayer_outer_y/2.+sdlayer_y+glasslayer_inner_y/2.)+4*(sdlayer_y+glasslayer_inner_y),0*mm);
1409
1410 G4ThreeVector transl_glass_8(0*mm,2*(glasslayer_outer_y/2.+sdlayer_y+glasslayer_inner_y/2.)+4*(sdlayer_y+glasslayer_inner_y)+2.45*mm,0*mm); // 1.9 (Pcboard+electrodes+mylar)+0.55 glasslayer
1411 G4ThreeVector transl_glass_9(0*mm,3*(glasslayer_outer_y/2.+sdlayer_y+glasslayer_inner_y/2.)+4*(sdlayer_y+glasslayer_inner_y)+2.45*mm,0*mm);
1412 G4ThreeVector transl_glass_10(0*mm,3*(glasslayer_outer_y/2.+sdlayer_y+glasslayer_inner_y/2.)+5*(sdlayer_y+glasslayer_inner_y)+2.45*mm,0*mm);
1413 G4ThreeVector transl_glass_11(0*mm,3*(glasslayer_outer_y/2.+sdlayer_y+glasslayer_inner_y/2.)+6*(sdlayer_y+glasslayer_inner_y)+2.45*mm,0*mm);
1414 G4ThreeVector transl_glass_12(0*mm,3*(glasslayer_outer_y/2.+sdlayer_y+glasslayer_inner_y/2.)+7*(sdlayer_y+glasslayer_inner_y)+2.45*mm,0*mm);
1415 G4ThreeVector transl_glass_13(0*mm,3*(glasslayer_outer_y/2.+sdlayer_y+glasslayer_inner_y/2.)+8*(sdlayer_y+glasslayer_inner_y)+2.45*mm,0*mm);
1416 G4ThreeVector transl_glass_14(0*mm,4*(glasslayer_outer_y/2.+sdlayer_y+glasslayer_inner_y/2.)+8*(sdlayer_y+glasslayer_inner_y)+2.45*mm,0*mm);
1417
1418
1419 G4Transform3D transf_glass_2(rot_dummy,transl_glass_2);
1420 G4Transform3D transf_glass_3(rot_dummy,transl_glass_3);
1421 G4Transform3D transf_glass_4(rot_dummy,transl_glass_4);
1422 G4Transform3D transf_glass_5(rot_dummy,transl_glass_5);
1423 G4Transform3D transf_glass_6(rot_dummy,transl_glass_6);
1424 G4Transform3D transf_glass_7(rot_dummy,transl_glass_7);
1425 G4Transform3D transf_glass_8(rot_dummy,transl_glass_8);
1426 G4Transform3D transf_glass_9(rot_dummy,transl_glass_9);
1427 G4Transform3D transf_glass_10(rot_dummy,transl_glass_10);
1428 G4Transform3D transf_glass_11(rot_dummy,transl_glass_11);
1429 G4Transform3D transf_glass_12(rot_dummy,transl_glass_12);
1430 G4Transform3D transf_glass_13(rot_dummy,transl_glass_13);
1431 G4Transform3D transf_glass_14(rot_dummy,transl_glass_14);
1432
1433
1434 G4Trd * glass_outer = new G4Trd("glass_outer",glasslayer_outer_x_do/2.,glasslayer_outer_x_up/2. ,glasslayer_outer_y/2.,glasslayer_outer_y/2.,glasslayer_outer_z/2.);
1435 G4Trd * glass_inner = new G4Trd("glass_inner",glasslayer_inner_x_do/2.,glasslayer_inner_x_up/2. ,glasslayer_inner_y/2.,glasslayer_inner_y/2.,glasslayer_inner_z/2.);
1436
1437 G4UnionSolid * glass_2 = new G4UnionSolid("glass_2",glass_outer,glass_inner,transf_glass_2);
1438 G4UnionSolid * glass_3 = new G4UnionSolid("glass_3",glass_2,glass_inner,transf_glass_3);
1439 G4UnionSolid * glass_4 = new G4UnionSolid("glass_4",glass_3,glass_inner,transf_glass_4);
1440 G4UnionSolid * glass_5 = new G4UnionSolid("glass_5",glass_4,glass_inner,transf_glass_5);
1441 G4UnionSolid * glass_6 = new G4UnionSolid("glass_6",glass_5,glass_inner,transf_glass_6);
1442 G4UnionSolid * glass_7 = new G4UnionSolid("glass_7",glass_6,glass_outer,transf_glass_7);
1443 G4UnionSolid * glass_8 = new G4UnionSolid("glass_8",glass_7,glass_outer,transf_glass_8);
1444 G4UnionSolid * glass_9 = new G4UnionSolid("glass_9",glass_8,glass_inner,transf_glass_9);
1445 G4UnionSolid * glass_10 = new G4UnionSolid("glass_10",glass_9,glass_inner,transf_glass_10);
1446 G4UnionSolid * glass_11 = new G4UnionSolid("glass_11",glass_10,glass_inner,transf_glass_11);
1447 G4UnionSolid * glass_12 = new G4UnionSolid("glass_12",glass_11,glass_inner,transf_glass_12);
1448 G4UnionSolid * glass_13 = new G4UnionSolid("glass_13",glass_12,glass_inner,transf_glass_13);
1449 G4UnionSolid * glass_layer = new G4UnionSolid("glass_layer",glass_13,glass_outer,transf_glass_14);
1450
1451
1452
1453 ////////////////////////
1454 //Construct electrodes
1455 double electrode_x_do=93.51*mm;
1456 double electrode_x_up=152.49*mm;
1457 double electrode_y=0.13*mm;
1458 double electrode_z=346*mm;
1459
1460 G4ThreeVector transl_electrode_2(0*mm,4.55*mm,0*mm); //6*0.22+5*0.4+2*0.55+0.13 = 4.55
1461 G4ThreeVector transl_electrode_3(0*mm,6.32*mm,0*mm); // 4.55 + 1.5 + 2*0.07 + 0.13 =6.32
1462 G4ThreeVector transl_electrode_4(0*mm,10.87*mm,0*mm);
1463 G4Transform3D transf_electrode_2(rot_dummy,transl_electrode_2);
1464 G4Transform3D transf_electrode_3(rot_dummy,transl_electrode_3);
1465 G4Transform3D transf_electrode_4(rot_dummy,transl_electrode_4);
1466
1467 G4Trd * electrode = new G4Trd("gaslayer",electrode_x_do/2.,electrode_x_up/2.,electrode_y/2.,electrode_y/2.,electrode_z/2.);
1468 G4UnionSolid *electrode_2 = new G4UnionSolid("electrode_2",electrode,electrode,transf_electrode_2);
1469 G4UnionSolid *electrode_3 = new G4UnionSolid("electrode_3",electrode_2,electrode,transf_electrode_3);
1470 G4UnionSolid *electrodes = new G4UnionSolid("electrodes",electrode_3,electrode,transf_electrode_4);
1471
1472
1473 /////////////////////////
1474 //Construct Readoutstrips
1475
1476
1477 G4double readoutstrip_x[12]={88*mm,92*mm,98*mm,102*mm,108*mm,112*mm,118*mm,122*mm,128*mm,132*mm,138*mm,142*mm};
1478 G4double readoutstrip_y=0.035*mm;
1479 G4double readoutstrip_z=25*mm;
1480
1481 const G4int no_readoutstrips=12;
1482
1483 G4Box * readoutstrip[no_readoutstrips];
1484 G4UnionSolid * readoutstrip_unified[no_readoutstrips];
1485
1486
1487
1488
1489 for(G4int i=0; i<no_readoutstrips;i++)
1490 {
1491 std::ostringstream help;
1492 help << "strip_" << i;
1493 readoutstrip[i]= new G4Box(help.str(), readoutstrip_x[i]/2 , readoutstrip_y/2., readoutstrip_z/2.);
1494 G4ThreeVector transl_help_1(0*mm,6.4875*mm,0*mm);
1495 G4ThreeVector transl_help_2(0*mm,-6.4875*mm,0*mm);
1496 G4Transform3D transf_help_1(rot_dummy,transl_help_1);
1497 G4Transform3D transf_help_2(rot_dummy,transl_help_2);
1498 G4UnionSolid* strip_help = new G4UnionSolid("strip_help",readoutstrip[i],readoutstrip[i],transf_help_1);
1499 readoutstrip_unified[i] = new G4UnionSolid("strip_help_2",strip_help,readoutstrip[i],transf_help_2);
1500 }
1501
1502 G4ThreeVector transl_readoutsrips[no_readoutstrips-1];
1503 for(G4int i=0;i<(no_readoutstrips-1);i++)
1504 {
1505 transl_readoutsrips[i].set(0*mm,0*mm,(i+1)*29*mm);
1506 }
1507
1508
1509 G4Transform3D transf_readoutstrip_2(rot_dummy,transl_readoutsrips[0]);
1510 G4Transform3D transf_readoutstrip_3(rot_dummy,transl_readoutsrips[1]);
1511 G4Transform3D transf_readoutstrip_4(rot_dummy,transl_readoutsrips[2]);
1512 G4Transform3D transf_readoutstrip_5(rot_dummy,transl_readoutsrips[3]);
1513 G4Transform3D transf_readoutstrip_6(rot_dummy,transl_readoutsrips[4]);
1514 G4Transform3D transf_readoutstrip_7(rot_dummy,transl_readoutsrips[5]);
1515 G4Transform3D transf_readoutstrip_8(rot_dummy,transl_readoutsrips[6]);
1516 G4Transform3D transf_readoutstrip_9(rot_dummy,transl_readoutsrips[7]);
1517 G4Transform3D transf_readoutstrip_10(rot_dummy,transl_readoutsrips[8]);
1518 G4Transform3D transf_readoutstrip_11(rot_dummy,transl_readoutsrips[9]);
1519 G4Transform3D transf_readoutstrip_12(rot_dummy,transl_readoutsrips[10]);
1520
1521 G4UnionSolid * readoutstrips_001 =new G4UnionSolid("readoutstrips_001",readoutstrip_unified[0],readoutstrip_unified[1],transf_readoutstrip_2);
1522 G4UnionSolid * readoutstrips_002 =new G4UnionSolid("readoutstrips_002",readoutstrips_001,readoutstrip_unified[2],transf_readoutstrip_3);
1523 G4UnionSolid * readoutstrips_003 =new G4UnionSolid("readoutstrips_003",readoutstrips_002,readoutstrip_unified[3],transf_readoutstrip_4);
1524 G4UnionSolid * readoutstrips_004 =new G4UnionSolid("readoutstrips_004",readoutstrips_003,readoutstrip_unified[4],transf_readoutstrip_5);
1525 G4UnionSolid * readoutstrips_005 =new G4UnionSolid("readoutstrips_005",readoutstrips_004,readoutstrip_unified[5],transf_readoutstrip_6);
1526 G4UnionSolid * readoutstrips_006 =new G4UnionSolid("readoutstrips_006",readoutstrips_005,readoutstrip_unified[6],transf_readoutstrip_7);
1527 G4UnionSolid * readoutstrips_007 =new G4UnionSolid("readoutstrips_007",readoutstrips_006,readoutstrip_unified[7],transf_readoutstrip_8);
1528 G4UnionSolid * readoutstrips_008 =new G4UnionSolid("readoutstrips_008",readoutstrips_007,readoutstrip_unified[8],transf_readoutstrip_9);
1529 G4UnionSolid * readoutstrips_009 =new G4UnionSolid("readoutstrips_009",readoutstrips_008,readoutstrip_unified[9],transf_readoutstrip_10);
1530 G4UnionSolid * readoutstrips_010 =new G4UnionSolid("readoutstrips_010",readoutstrips_009,readoutstrip_unified[10],transf_readoutstrip_11);
1531 G4UnionSolid * readoutstrips_011 =new G4UnionSolid("readoutstrips_011",readoutstrips_010,readoutstrip_unified[11],transf_readoutstrip_12);
1532
1533 G4Box * readoutstrip_help = new G4Box("readoustrip_help",4/2*mm,(13.01+2)/2*mm,(344+2)/2*mm);
1534
1535 G4ThreeVector transl_readoutstrip_help(0*mm,0*mm,160*mm);
1536 G4Transform3D transf_readoutstrip_help(rot_dummy,transl_readoutstrip_help);
1537
1538 G4SubtractionSolid * readoutstrips_012 =new G4SubtractionSolid("readoutstrips_012",readoutstrips_011,readoutstrip_help,transf_readoutstrip_help);
1539
1540
1541 /////////////////////////
1542 //Construct Mylar-Layer
1543 G4double mylar_layer_x_do=103*mm;
1544 G4double mylar_layer_x_up=163*mm;
1545 G4double mylar_layer_y=0.07*mm;
1546 G4double mylar_layer_z=352*mm;
1547
1548
1549
1550 G4ThreeVector transl_mylarlayer_2(0*mm,4.75*mm,0*mm); //6*0.22+5*0.4+2*0.55+0.13 = 4.55
1551 G4ThreeVector transl_mylarlayer_3(0*mm,6.32*mm,0*mm); // 4.75 + 1.5 + 0.07 =6.32
1552 G4ThreeVector transl_mylarlayer_4(0*mm,11.07*mm,0*mm);
1553 G4Transform3D transf_mylarlayer_2(rot_dummy,transl_mylarlayer_2);
1554 G4Transform3D transf_mylarlayer_3(rot_dummy,transl_mylarlayer_3);
1555 G4Transform3D transf_mylarlayer_4(rot_dummy,transl_mylarlayer_4);
1556
1557 G4Trd * mylar_layer = new G4Trd("mylar_layer",mylar_layer_x_do/2.,mylar_layer_x_up/2.,mylar_layer_y/2.,mylar_layer_y/2.,mylar_layer_z/2.);
1558 G4UnionSolid *mylar_layer_2 = new G4UnionSolid("mylar_layer_2",mylar_layer,mylar_layer,transf_mylarlayer_2);
1559 G4UnionSolid *mylar_layer_3 = new G4UnionSolid("mylar_layer_3",mylar_layer_2,mylar_layer,transf_mylarlayer_3);
1560 G4UnionSolid *mylarlayer_4 = new G4UnionSolid("mylarlayer_4",mylar_layer_3,mylar_layer,transf_mylarlayer_4);
1561
1562
1563 ///////////////////////
1564 //Construct honeycomb
1565 double honeycomb_x_do=98.17*mm;
1566 double honeycomb_x_up=157.83*mm;
1567 double honeycomb_y=3*mm;
1568 double honeycomb_z=350*mm;
1569 G4Trd* honeycomb= new G4Trd("honeycomb",honeycomb_x_do/2,honeycomb_x_up/2,honeycomb_y/2,honeycomb_y/2,honeycomb_z/2);
1570
1571
1572
1573 //Construct gascontainer (InsidePart of frame)
1574 G4Trd* gascontainer_1 = new G4Trd("gas_container_1",(l_mrpc_xdo_ins)/2.,(lmrpc_xup_ins)/2.,(lmrpc_yfr_ins)/2.,(lmrpc_yba_ins)/2.,(lmrpc_z_ins)/2.);
1575 G4Trd* gascontainer_2 = new G4Trd("gas_container_2",((l_mrpc_xdo_ins)/2.+ delta_frame_x/cos(inner_angle/2.)),((lmrpc_xup_ins)/2. + delta_frame_x/cos(inner_angle/2.)),
1576 ((lmrpc_yfr_ins)/2.-delta_frame_y),
1577 ((lmrpc_yba_ins)/2.-delta_frame_y),(lmrpc_z_ins)/2.);// Schneide Auskerbung an Innenseite raus (inside 2)
1578 G4UnionSolid* gascontainer_3= new G4UnionSolid("gascontainer_3",gascontainer_1,gascontainer_2,transf_dummy);
1579
1580
1581 logical_assembly_west_1 = new G4LogicalVolume(assembly_04_e,G4Material::GetMaterial("Aluminium"),"logical_assembly_west_1");
1582 logical_assembly_west_2 = new G4LogicalVolume(assembly_04_e,G4Material::GetMaterial("Aluminium"),"logical_assembly_west_2");
1583 logical_assembly_east_1 = new G4LogicalVolume(assembly_04_e,G4Material::GetMaterial("Aluminium"),"logical_assembly_east_1");
1584 logical_assembly_east_2 = new G4LogicalVolume(assembly_04_e,G4Material::GetMaterial("Aluminium"),"logical_assembly_east_2");
1585
1586 /*
1587 logical_assembly_west_1 = new G4LogicalVolume(assembly_04_e,G4Material::GetMaterial("Galactic"),"logical_assembly_west_1");
1588 logical_assembly_west_2 = new G4LogicalVolume(assembly_04_e,G4Material::GetMaterial("Galactic"),"logical_assembly_west_2");
1589 logical_assembly_east_1 = new G4LogicalVolume(assembly_04_e,G4Material::GetMaterial("Galactic"),"logical_assembly_east_1");
1590 logical_assembly_east_2 = new G4LogicalVolume(assembly_04_e,G4Material::GetMaterial("Galactic"),"logical_assembly_east_2");
1591 */
1592
1593
1594
1595 logical_gascontainer_3_west_1 =new G4LogicalVolume(gascontainer_3,MRPCGas,"logical_gascontainer_3_west_1");
1596 logical_pcboard_west_1 = new G4LogicalVolume(pcboard,Mylar_1397,"logical_pcboard_west_1");
1597 logical_gaslayer_tot_west_1 = new G4LogicalVolume(gas_layer_tot,MRPCGas,"logical_gaslayer_tot_west_1");
1598 logical_sensitive_detector_west_1 = new G4LogicalVolume(sensitive_detector,MRPCGas,"logical_sensitive_detector_west_1");
1599 logical_glass_layer_west_1 = new G4LogicalVolume(glass_layer,G4Material::GetMaterial("SiO2"),"logical_glass_layer_west_1");
1600 logical_electrodes_west_1 = new G4LogicalVolume(electrodes,Graphite,"logical_electrodes_west_1");
1601 logical_readoutstrips_012_west_1 = new G4LogicalVolume(readoutstrips_012,G4Material::GetMaterial("Copper"),"logical_readoutstrips_012_west_1");
1602 logical_mylarlayer_west_1 = new G4LogicalVolume(mylarlayer_4,Mylar_1397,"logical_mylarlayer_west_1");
1603 logical_honeycomb_west_1 = new G4LogicalVolume(honeycomb,Mylar_073,"logical_honeycomb_west_1");
1604
1605
1606 logical_gascontainer_3_west_2 =new G4LogicalVolume(gascontainer_3,MRPCGas,"logical_gascontainer_3_west_2");
1607 logical_pcboard_west_2 = new G4LogicalVolume(pcboard,Mylar_1397,"logical_pcboard_west_2");
1608 logical_gaslayer_tot_west_2 = new G4LogicalVolume(gas_layer_tot,MRPCGas,"logical_gaslayer_tot_west_2");
1609 logical_sensitive_detector_west_2 = new G4LogicalVolume(sensitive_detector,MRPCGas,"logical_sensitive_detector_west_2");
1610 logical_electrodes_west_2 = new G4LogicalVolume(electrodes,Graphite,"logical_electrodes_west_2");
1611 logical_glass_layer_west_2 = new G4LogicalVolume(glass_layer,G4Material::GetMaterial("SiO2"),"logical_glass_layer_west_2");
1612 logical_readoutstrips_012_west_2 = new G4LogicalVolume(readoutstrips_012,G4Material::GetMaterial("Copper"),"logical_readoutstrips_012_west_2");
1613 logical_mylarlayer_west_2 = new G4LogicalVolume(mylarlayer_4,Mylar_1397,"logical_mylarlayer_west_2");
1614 logical_honeycomb_west_2 = new G4LogicalVolume(honeycomb,Mylar_073,"logical_honeycomb_west_2");
1615
1616
1617 logical_gascontainer_3_east_1 =new G4LogicalVolume(gascontainer_3,MRPCGas,"logical_gascontainer_3_east_1");
1618 logical_pcboard_east_1 = new G4LogicalVolume(pcboard,Mylar_1397,"logical_pcboard_east_1");
1619 logical_gaslayer_tot_east_1 = new G4LogicalVolume(gas_layer_tot,MRPCGas,"logical_gaslayer_tot_east_1");
1620 logical_sensitive_detector_east_1 = new G4LogicalVolume(sensitive_detector,MRPCGas,"logical_sensitive_detector_east_1");
1621 logical_electrodes_east_1 = new G4LogicalVolume(electrodes,Graphite,"logical_electrodes_east_1");
1622 logical_glass_layer_east_1 = new G4LogicalVolume(glass_layer,G4Material::GetMaterial("SiO2"),"logical_glass_layer_east_1");
1623 logical_readoutstrips_012_east_1 = new G4LogicalVolume(readoutstrips_012,G4Material::GetMaterial("Copper"),"logical_readoutstrips_012_east_1");
1624 logical_mylarlayer_east_1 = new G4LogicalVolume(mylarlayer_4,Mylar_1397,"logical_mylarlayer_east_1");
1625 logical_honeycomb_east_1 = new G4LogicalVolume(honeycomb,Mylar_073,"logical_honeycomb_east_1");
1626
1627
1628
1629
1630 logical_gascontainer_3_east_2 =new G4LogicalVolume(gascontainer_3,MRPCGas,"logical_gascontain_3_east_2");
1631 logical_pcboard_east_2 = new G4LogicalVolume(pcboard,Mylar_1397,"logical_pcboard_east_2");
1632 logical_gaslayer_tot_east_2 = new G4LogicalVolume(gas_layer_tot,MRPCGas,"logical_gaslayer_tot_east_2");
1633 logical_sensitive_detector_east_2 = new G4LogicalVolume(sensitive_detector,MRPCGas,"logical_sensitive_detector_east_2");
1634 logical_electrodes_east_2 = new G4LogicalVolume(electrodes,Graphite,"logical_electrodes_east_2");
1635 logical_glass_layer_east_2 = new G4LogicalVolume(glass_layer,G4Material::GetMaterial("SiO2"),"logical_glass_layer_east_2");
1636 logical_readoutstrips_012_east_2 = new G4LogicalVolume(readoutstrips_012,G4Material::GetMaterial("Copper"),"logical_readoutstrips_012_east_2");
1637 logical_mylarlayer_east_2 = new G4LogicalVolume(mylarlayer_4,Mylar_1397,"logical_mylarlayer_east_2");
1638 logical_honeycomb_east_2 = new G4LogicalVolume(honeycomb,Mylar_073,"logical_honeycomb_east_2");
1639
1640
1641
1642
1643 //Use for the implementation of the PAI Modeö the following code
1644 /* G4Region* my_mrpc_gas= new G4Region("my_mrpc_gas");
1645 my_mrpc_gas->AddRootLogicalVolume(logical_sensitive_detector_west_1);
1646 my_mrpc_gas->AddRootLogicalVolume(logical_sensitive_detector_west_2);
1647 my_mrpc_gas->AddRootLogicalVolume(logical_sensitive_detector_east_1);
1648 my_mrpc_gas->AddRootLogicalVolume(logical_sensitive_detector_east_2);
1649
1650 G4double cut = 1*mm;
1651 fMrpcGasDetectorCuts = new G4ProductionCuts();
1652 fMrpcGasDetectorCuts->SetProductionCut(cut,"gamma");
1653 fMrpcGasDetectorCuts->SetProductionCut(cut,"e-");
1654 fMrpcGasDetectorCuts->SetProductionCut(cut,"e+");
1655 fMrpcGasDetectorCuts->SetProductionCut(cut,"proton");
1656 my_mrpc_gas->SetProductionCuts(fMrpcGasDetectorCuts);
1657 */
1658
1659
1660
1661 physical_gascontainer_3_west_1 = new G4PVPlacement(0,G4ThreeVector(0,0,ks_trafo),logical_gascontainer_3_west_1, "physical_gascontainer_3_west_1",logical_assembly_west_1, false,0);
1662 physical_pcboard_west_1 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logical_pcboard_west_1,"physical_pcboard_west_1",logical_gascontainer_3_west_1,false,0);
1663 physical_gaslayer_tot_west_1 = new G4PVPlacement(0,G4ThreeVector(0,-3.16*mm,0),logical_gaslayer_tot_west_1,"physical_gaslayer_tot_west_1",logical_gascontainer_3_west_1,false,0);
1664 physical_sensitive_detector_west_1 = new G4PVPlacement(0,G4ThreeVector(0,-4.71*mm,0),logical_sensitive_detector_west_1,"physical_sensitive_detector_west_1",logical_pcboard_west_1,false,0);
1665 physical_glass_layer_west_1 = new G4PVPlacement(0,G4ThreeVector(0,-5.095*mm,0),logical_glass_layer_west_1,"physical_glass_layer_west_1",logical_pcboard_west_1,false,0);
1666 physical_electrodes_west_1 = new G4PVPlacement(0,G4ThreeVector(0,-5.435*mm,0),logical_electrodes_west_1,"physical_electrodes_west_1",logical_pcboard_west_1,false,0);
1667 physical_readoutstrips_012_west_1 = new G4PVPlacement(0,G4ThreeVector(0,0*mm,-159.5*mm),logical_readoutstrips_012_west_1,"physical_readoutstrips_012_west_1",logical_pcboard_west_1,false,0);
1668 physical_mylarlayer_west_1 = new G4PVPlacement(0,G4ThreeVector(0,-5.535*mm,0*mm),logical_mylarlayer_west_1,"physical_mylarlayer_west_1",logical_pcboard_west_1,false,0);
1669 physical_honeycomb_1_west_1 = new G4PVPlacement(0,G4ThreeVector(0,l_pcboard_y/2.+readoutstrip_y+honeycomb_y/2,0),
1670 logical_honeycomb_west_1,"physical_honeycomb_1_west_1",logical_gascontainer_3_west_1,false,0);
1671 physical_honeycomb_2_west_1 = new G4PVPlacement(0,G4ThreeVector(0,-(l_pcboard_y/2.+readoutstrip_y+honeycomb_y/2),0),
1672 logical_honeycomb_west_1,"physical_honeycomb_2_west_1",logical_gascontainer_3_west_1,false,0);
1673
1674
1675 physical_gascontainer_3_west_2 = new G4PVPlacement(0,G4ThreeVector(0,0,ks_trafo),logical_gascontainer_3_west_2, "physical_gascontainer_3_west_2",logical_assembly_west_2, false,0);
1676 physical_pcboard_west_2 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logical_pcboard_west_2,"physical_pcboard_west_2",logical_gascontainer_3_west_2,false,0);
1677 physical_gaslayer_tot_west_2 = new G4PVPlacement(0,G4ThreeVector(0,-3.16*mm,0),logical_gaslayer_tot_west_2,"physical_gaslayer_tot_west_2",logical_gascontainer_3_west_2,false,0);
1678 physical_sensitive_detector_west_2 = new G4PVPlacement(0,G4ThreeVector(0,-4.71*mm,0),logical_sensitive_detector_west_2,"physical_sensitive_detector_west_2",logical_pcboard_west_2,false,0);
1679 physical_glass_layer_west_2 = new G4PVPlacement(0,G4ThreeVector(0,-5.095*mm,0),logical_glass_layer_west_2,"physical_glass_layer_west_2",logical_pcboard_west_2,false,0);
1680 physical_electrodes_west_2 = new G4PVPlacement(0,G4ThreeVector(0,-5.435*mm,0),logical_electrodes_west_2,"physical_electrodes_west_2",logical_pcboard_west_2,false,0);
1681 physical_readoutstrips_012_west_2 = new G4PVPlacement(0,G4ThreeVector(0,0*mm,-159.5*mm),logical_readoutstrips_012_west_2,"physical_readoutstrips_012_west_2",logical_pcboard_west_2,false,0);
1682 physical_mylarlayer_west_2 = new G4PVPlacement(0,G4ThreeVector(0,-5.535*mm,0*mm),logical_mylarlayer_west_2,"physical_mylarlayer_west_2",logical_pcboard_west_2,false,0);
1683 physical_honeycomb_1_west_2 = new G4PVPlacement(0,G4ThreeVector(0,l_pcboard_y/2.+readoutstrip_y+honeycomb_y/2,0),
1684 logical_honeycomb_west_2,"physical_honeycomb_1_west_2",logical_gascontainer_3_west_2,false,0);
1685 physical_honeycomb_2_west_2 = new G4PVPlacement(0,G4ThreeVector(0,-(l_pcboard_y/2.+readoutstrip_y+honeycomb_y/2),0),
1686 logical_honeycomb_west_2,"physical_honeycomb_2_west_2",logical_gascontainer_3_west_2,false,0);
1687
1688
1689 physical_gascontainer_3_east_1 = new G4PVPlacement(0,G4ThreeVector(0,0,ks_trafo),logical_gascontainer_3_east_1, "physical_gascontainer_3_east_1",logical_assembly_east_1, false,0);
1690 physical_pcboard_east_1 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logical_pcboard_east_1,"physical_pcboard_east_1",logical_gascontainer_3_east_1,false,0);
1691 physical_gaslayer_tot_east_1 = new G4PVPlacement(0,G4ThreeVector(0,-3.16*mm,0),logical_gaslayer_tot_east_1,"physical_gaslayer_tot_east_1",logical_gascontainer_3_east_1,false,0);
1692 physical_sensitive_detector_east_1 = new G4PVPlacement(0,G4ThreeVector(0,-4.71*mm,0),logical_sensitive_detector_east_1,"physical_sensitive_detector_east_1",logical_pcboard_east_1,false,0);
1693 physical_glass_layer_east_1 = new G4PVPlacement(0,G4ThreeVector(0,-5.095*mm,0),logical_glass_layer_east_1,"physical_glass_layer_east_1",logical_pcboard_east_1,false,0);
1694 physical_electrodes_east_1 = new G4PVPlacement(0,G4ThreeVector(0,-5.435*mm,0),logical_electrodes_east_1,"physical_electrodes_east_1",logical_pcboard_east_1,false,0);
1695 physical_readoutstrips_012_east_1 = new G4PVPlacement(0,G4ThreeVector(0,0*mm,-159.5*mm),logical_readoutstrips_012_east_1,"physical_readoutstrips_012_east_1",logical_pcboard_east_1,false,0);
1696 physical_mylarlayer_east_1 = new G4PVPlacement(0,G4ThreeVector(0,-5.535*mm,0*mm),logical_mylarlayer_east_1,"physical_mylarlayer_east_1",logical_pcboard_east_1,false,0);
1697 physical_honeycomb_1_east_1 = new G4PVPlacement(0,G4ThreeVector(0,l_pcboard_y/2.+readoutstrip_y+honeycomb_y/2,0),
1698 logical_honeycomb_east_1,"physical_honeycomb_1_east_1",logical_gascontainer_3_east_1,false,0);
1699 physical_honeycomb_2_east_1 = new G4PVPlacement(0,G4ThreeVector(0,-(l_pcboard_y/2.+readoutstrip_y+honeycomb_y/2),0),
1700 logical_honeycomb_east_1,"physical_honeycomb_2_east_1",logical_gascontainer_3_east_1,false,0);
1701
1702
1703
1704 physical_gascontainer_3_east_2 = new G4PVPlacement(0,G4ThreeVector(0,0,ks_trafo),logical_gascontainer_3_east_2, "physical_gascontainer_3_east_2",logical_assembly_east_2, false,0);
1705 physical_pcboard_east_2 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logical_pcboard_east_2,"physical_pcboard_east_2",logical_gascontainer_3_east_2,false,0);
1706 physical_gaslayer_tot_east_2 = new G4PVPlacement(0,G4ThreeVector(0,-3.16*mm,0),logical_gaslayer_tot_east_2,"physical_gaslayer_tot_east_2",logical_gascontainer_3_east_2,false,0);
1707 physical_sensitive_detector_east_2 = new G4PVPlacement(0,G4ThreeVector(0,-4.71*mm,0),logical_sensitive_detector_east_2,"physical_sensitive_detector_east_2",logical_pcboard_east_2,false,0);
1708 physical_glass_layer_east_2 = new G4PVPlacement(0,G4ThreeVector(0,-5.095*mm,0),logical_glass_layer_east_2,"physical_glass_layer_east_2",logical_pcboard_east_2,false,0);
1709 physical_electrodes_east_2 = new G4PVPlacement(0,G4ThreeVector(0,-5.435*mm,0),logical_electrodes_east_2,"physical_electrodes_east_2",logical_pcboard_east_2,false,0);
1710 physical_readoutstrips_012_east_2 = new G4PVPlacement(0,G4ThreeVector(0,0*mm,-159.5*mm),logical_readoutstrips_012_east_2,"physical_readoutstrips_012_east_2",logical_pcboard_east_2,false,0);
1711 physical_mylarlayer_east_2 = new G4PVPlacement(0,G4ThreeVector(0,-5.535*mm,0*mm),logical_mylarlayer_east_2,"physical_mylarlayer_east_2",logical_pcboard_east_2,false,0);
1712 physical_honeycomb_1_east_2 = new G4PVPlacement(0,G4ThreeVector(0,l_pcboard_y/2.+readoutstrip_y+honeycomb_y/2,0),
1713 logical_honeycomb_east_2,"physical_honeycomb_1_east_2",logical_gascontainer_3_east_2,false,0);
1714 physical_honeycomb_2_east_2 = new G4PVPlacement(0,G4ThreeVector(0,-(l_pcboard_y/2.+readoutstrip_y+honeycomb_y/2),0),
1715 logical_honeycomb_east_2,"physical_honeycomb_2_east_2",logical_gascontainer_3_east_2,false,0);
1716
1717
1718
1719
1720 G4ThreeVector pos_west_1(0,0,+12.5*mm);
1721 G4ThreeVector pos_west_2(0,0,-12.5*mm);
1722 G4ThreeVector pos_east_1(0,0,-12.5*mm);
1723 G4ThreeVector pos_east_2(0,0,+12.5*mm);
1724
1725 int n_mrpc_modules=18;
1726 double shift_angle_mrpc=360*deg/n_mrpc_modules;
1727 double shift_angle_layer_2=(angle_readoutbox+inner_angle)/2.;
1728
1729 double radius_physical_mrpc_placement = 634.56*mm;
1730
1731
1732 //aaaaa
1733 for (int i=0;i<n_mrpc_modules;i++)
1734 {
1735
1736
1737 pos_west_1.setX(radius_physical_mrpc_placement*cos(90*deg+i*shift_angle_mrpc));
1738 pos_west_1.setY(radius_physical_mrpc_placement*sin(90*deg+i*shift_angle_mrpc));
1739
1740 pos_west_2.setX(radius_physical_mrpc_placement*cos(90*deg+shift_angle_layer_2+i*shift_angle_mrpc));
1741 pos_west_2.setY(radius_physical_mrpc_placement*sin(90*deg+shift_angle_layer_2+i*shift_angle_mrpc));
1742
1743 G4RotationMatrix rot_west_1,rot_west_2;
1744
1745 rot_west_1.rotateX(90*deg);
1746 rot_west_1.rotateY(shift_angle_mrpc*i);
1747 rot_west_1.rotateZ(180*deg);
1748 rot_west_1.invert();
1749 G4Transform3D transf_west_1(rot_west_1,pos_west_1);
1750
1751 rot_west_2.rotateX(90*deg);
1752 rot_west_2.rotateY(shift_angle_layer_2+shift_angle_mrpc*i);
1753 rot_west_2.rotateZ(180*deg);
1754 rot_west_2.invert();
1755 G4Transform3D transf_west_2(rot_west_2,pos_west_2);
1756
1757
1758 std::ostringstream string_physical_mrpc_lay1,string_physical_mrpc_lay2;
1759 string_physical_mrpc_lay1 << "physical_mrpc_west_lay1_mod_"<<i;
1760 string_physical_mrpc_lay2 << "physical_mrpc_west_lay2_mod_"<<i;
1761
1762
1763 physical_assembly_west_1 = new G4PVPlacement(transf_west_1,logical_assembly_west_1,string_physical_mrpc_lay1.str(),logicalEcTofWest,false,(i+1));
1764 physical_assembly_west_2 = new G4PVPlacement(transf_west_2,logical_assembly_west_2,string_physical_mrpc_lay2.str(),logicalEcTofWest,false,(i+1));
1765
1766 }
1767
1768
1769 G4cout << G4endl << G4endl << "You are using the new MRPC TOF Detector" <<G4endl << G4endl;
1770
1771 for (int i=0;i<n_mrpc_modules;i++)
1772 {
1773
1774 pos_east_1.setX(radius_physical_mrpc_placement*cos(90*deg+i*shift_angle_mrpc));
1775 pos_east_1.setY(radius_physical_mrpc_placement*sin(90*deg+i*shift_angle_mrpc));
1776
1777 pos_east_2.setX(radius_physical_mrpc_placement*cos(90*deg+shift_angle_layer_2+i*shift_angle_mrpc));
1778 pos_east_2.setY(radius_physical_mrpc_placement*sin(90*deg+shift_angle_layer_2+i*shift_angle_mrpc));
1779
1780 G4RotationMatrix rot_east_1,rot_east_2;
1781
1782 rot_east_1.rotateX(90*deg);
1783 rot_east_1.rotateY(shift_angle_mrpc*i);
1784 rot_east_1.invert();
1785 G4Transform3D transf_east_1(rot_east_1,pos_east_1);
1786
1787 rot_east_2.rotateX(90*deg);
1788 rot_east_2.rotateY(shift_angle_layer_2+shift_angle_mrpc*i);
1789 rot_east_2.invert();
1790 G4Transform3D transf_east_2(rot_east_2,pos_east_2);
1791
1792 std::ostringstream string_physical_mrpc_lay1,string_physical_mrpc_lay2;
1793 string_physical_mrpc_lay1 << "physical_mrpc_east_lay1_mod_"<<(17-i);
1794 string_physical_mrpc_lay2 << "physical_mrpc_east_lay2_mod_"<<(17-i);
1795
1796 physical_assembly_east_1 = new G4PVPlacement(transf_east_1,logical_assembly_east_1,string_physical_mrpc_lay1.str(),logicalEcTofEast,false,(18-i));
1797 physical_assembly_east_2 = new G4PVPlacement(transf_east_2,logical_assembly_east_2,string_physical_mrpc_lay2.str(),logicalEcTofEast,false,(18-i));
1798
1799 }
1800
1801}
1802
1803
1804
1805
1806void BesTofConstruction::DefineMaterial() //This fucntion just "build" my materials
1807{
1808 G4double a,z,density,fraction;
1809 G4int nel, natoms, ncomponents;
1810 G4String name, symbol;
1811
1812
1813 G4Element* H=G4Element::GetElement("Hydrogen");
1814 if (!H)
1815 H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a=1.01*g/mole);
1816
1817 G4Element* C=G4Element::GetElement("Carbon");
1818 if (!C)
1819 C = new G4Element(name="Carbon" ,symbol="C" , z= 6., a=12.01*g/mole);
1820
1821 G4Element* F=G4Element::GetElement("Fluorin");
1822 if (!F)
1823 F = new G4Element(name="Fluorin", symbol="F", z=9., a=18.01*g/mole);
1824
1825 G4Element* O=G4Element::GetElement("Oxygen");
1826 if (!O)
1827 O = new G4Element(name="Oxygen",symbol="O",z= 8., a= 16.00*g/mole);
1828
1829 G4Element* S=G4Element::GetElement("Sulfur");
1830 if(!S)
1831 S = new G4Element(name="Sulfur",symbol="S",z= 16., a= 32.06*g/mole);
1832
1833 //The density is just an approximation. I don't know the correct value.
1834 Mylar_1397 = new G4Material("Mylar_1397", density= 1.397*g/cm3, ncomponents=3);
1835 Mylar_1397->AddElement(C,natoms=10);
1836 Mylar_1397->AddElement(H,natoms=8);
1837 Mylar_1397->AddElement(O,natoms=4);
1838
1839 //#Guess: The density is just an approximation. I don't know the correct value.
1840 Mylar_073 = new G4Material("Mylar_073", density= 0.73*g/cm3, ncomponents=3);
1841 Mylar_073->AddElement(C,natoms=10);
1842 Mylar_073->AddElement(H,natoms=8);
1843 Mylar_073->AddElement(O,natoms=4);
1844
1845 //#Guess: The density is just an approximation. I don't know the correct value.
1846 FreonR134A = new G4Material("FreonR134A", density =4.168*mg/cm3,ncomponents=3);
1847 FreonR134A->AddElement(C,natoms=2);
1848 FreonR134A->AddElement(H,natoms=2);
1849 FreonR134A->AddElement(F,natoms=4);
1850
1851 //#Guess: The density is just an approximation. I don't know the correct value.
1852 SF6 = new G4Material("SF6", density =6.18*mg/cm3,ncomponents=2);
1853 SF6->AddElement(S,natoms=1);
1854 SF6->AddElement(F,natoms=6);
1855
1856 //#Guess: The density is just an approximation. I don't know the correct value.
1857 Isobutan = new G4Material("Isobutan", density =2.506*mg/cm3,ncomponents=2);
1858 Isobutan->AddElement(C, natoms=4);
1859 Isobutan->AddElement(H, natoms=10);
1860
1861 //#Guess: The density is just an approximation. I don't know the correct value. (Calculate using the ideal gas law)
1862 //The value are the fractional mass calculated from the Atomic weight per mol. Corrsponds to 90% Freon,5 % SF6, 5% Isobutan
1863 MRPCGas = new G4Material(name="MRPCGas", density=4.18*mg/cm3,ncomponents=3);
1864 MRPCGas->AddMaterial(FreonR134A, fraction= 33.3*perCent);
1865 MRPCGas->AddMaterial(SF6, fraction=47.7*perCent);
1866 MRPCGas->AddMaterial(Isobutan, fraction=19.*perCent);
1867
1868 if(0.0 == MRPCGas->GetIonisation()->GetMeanEnergyPerIonPair()) {
1869 MRPCGas->GetIonisation()->SetMeanEnergyPerIonPair(20*eV);
1870 }
1871
1872
1873
1874 Carbonfiber = new G4Material(name="Carbonfiber", density=1.8*g/cm3,nel=1);
1875 Carbonfiber->AddElement(C,1.);
1876
1877 Graphite = new G4Material("Graphite", density=2.2*g/cm3,ncomponents=1);
1878 Graphite->AddElement(C,1.);
1879
1880
1881
1882 BC404 = new G4Material("BC404",density=1.032*g/cm3,nel=2);
1883 BC404->AddElement(C,10);
1884 BC404->AddElement(H,11);
1885
1886 BC408 = new G4Material("BC408",density=1.032*g/cm3,nel=2);
1887 BC408->AddElement(C,1000);
1888 BC408->AddElement(H,1104);
1889
1890 PVF = new G4Material("PVF",density=1.45*g/cm3,nel=3);
1891 PVF->AddElement(C,2);
1892 PVF->AddElement(H,3);
1893 PVF->AddElement(F,1);
1894 //PVF = G4Material::GetMaterial("Air");
1895
1896 //PMT mixed material
1897 G4Material* Cu = G4Material::GetMaterial("Copper");
1898
1899 G4Material* Al = G4Material::GetMaterial("Aluminium");
1900
1901 //SiO2
1902 G4Material* SiO2 =G4Material::GetMaterial("SiO2");
1903
1904 //G4Material* SiO2 = new G4Material("SiO2",density=2*g/cm3, 2);
1905 //G4Element* Si = new G4Element("Silicon",symbol="Si" , z= 14., a= 28.09*g/mole);
1906 //G4Element* O=G4Element::GetElement("Oxygen");
1907 //if(!O)
1908 // O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a= 16.00*g/mole);
1909 //SiO2->AddElement(Si,1);
1910 //SiO2->AddElement(O,2);
1911
1912 //vacuum
1913 //G4Material* Vacuum =
1914 // new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density,
1915 // kStateGas, 3.e-18*pascal, 2.73*kelvin);
1916
1917 density = 1.4618815*g/cm3;
1918 PMTmaterial = new G4Material(name="PMTmaterial", density, 4);
1919 PMTmaterial->AddMaterial(Al, 0.4495);
1920 PMTmaterial->AddMaterial(Cu,0.35);
1921 PMTmaterial->AddMaterial(SiO2,0.2);
1922 PMTmaterial->AddMaterial(G4Material::GetMaterial("Air"),0.0005);
1923 //PMTmaterial->AddMaterial(Vacuum,0.1);
1924 G4cout<<PMTmaterial;
1925
1926 density = 1.002*g/cm3;
1927 G4Material* tape = new G4Material(name="tape",density,nel=2);
1928 tape->AddElement(C,2);
1929 tape->AddElement(H,5);
1930
1931
1932
1933}
1934
1935void BesTofConstruction::getXYZ( const G4RotationMatrix r, double& a, double& b, double& c) const
1936{
1937 double cosb = sqrt( r.xx()*r.xx() + r.yx()*r.yx() );
1938
1939 if (cosb > 16*FLT_EPSILON)
1940 {
1941 a = atan2( r.zy(), r.zz() );
1942 b = atan2( -r.zx(), cosb );
1943 c = atan2( r.yx(), r.xx() );
1944 }
1945 else
1946 {
1947 a = atan2( -r.yz(), r.yy() );
1948 b = atan2( -r.zx(), cosb );
1949 c = 0.;
1950 }
1951 //std::cout.precision(20);
1952 //std::cout<<"in getXYZ :( "<<r.xx()<<" "<<r.xy()<<" "<<r.xz()<<std::endl;
1953 //std::cout<<" "<<r.yx()<<" "<<r.yy()<<" "<<r.yz()<<std::endl;
1954 //std::cout<<" "<<r.zx()<<" "<<r.zy()<<" "<<r.zz()<<std::endl;
1955
1956 //std::cout<<" details: cosb="<<cosb<<" a="<<a<<" b="<<b<<" c="<<c<<" min="<<16*FLT_EPSILON<<std::endl;
1957
1958
1959
1960 G4RotationMatrix temp;
1961// std::cout<<"in detail temp :( "<<temp.xx()<<" "<<temp.xy()<<" "<<temp.xz()<<std::endl;
1962// std::cout<<" "<<temp.yx()<<" "<<temp.yy()<<" "<<temp.yz()<<std::endl;
1963// std::cout<<" "<<temp.zx()<<" "<<temp.zy()<<" "<<temp.zz()<<std::endl;
1964// temp.rotateZ(0.5*360/88.0*deg-90.*deg);
1965 temp.rotateZ((c/deg)*deg);
1966 //std::cout.precision(20);
1967 //std::cout<<"in detail temp2:( "<<temp.xx()<<" "<<temp.xy()<<" "<<temp.xz()<<std::endl;
1968 //std::cout<<" "<<temp.yx()<<" "<<temp.yy()<<" "<<temp.yz()<<std::endl;
1969 //std::cout<<" "<<temp.zx()<<" "<<temp.zy()<<" "<<temp.zz()<<std::endl;
1970
1971}
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
CgemGeoAlign * Al
Double_t x[10]
std::string help()
***************************************************************************************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)
static BesTofGeoParameter * GetInstance()
static G4int GetTof()
G4LogicalVolume * GetTopVolume()
Get the top(world) volume;.
IMPLICIT REAL *A H
Definition myXsection.h:1
const float pi
Definition vector3.h:133