1#include "PartProduce.hh"
3#include "G4LogicalVolume.hh"
4#include "G4VPhysicalVolume.hh"
5#include "G4PVPlacement.hh"
8#include "G4Transform3D.hh"
9#include "G4UnionSolid.hh"
13#include "G4SubtractionSolid.hh"
14#include "G4IntersectionSolid.hh"
15#include "G4VisAttributes.hh"
39 containerOut_xdown = tofPara->
Get(
"containerOut_xdown");
40 containerOut_xup = tofPara->
Get(
"containerOut_xup");
41 containerOut_y = tofPara->
Get(
"containerOut_y");
42 containerOut_z = tofPara->
Get(
"containerOut_z");
43 container_thickness = tofPara->
Get(
"container_thickness");
44 container_lowBorder = tofPara->
Get(
"container_lowBorder");
46 containerIn_xdown = tofPara->
Get(
"containerIn_xdown");
47 containerIn_xup = tofPara->
Get(
"containerIn_xup");
48 containerIn_y = tofPara->
Get(
"containerIn_y");
49 containerIn_z = tofPara->
Get(
"containerIn_z");
51 upCover_xdown = tofPara->
Get(
"upCover_xdown");
52 upCover_xup = tofPara->
Get(
"upCover_xup");
53 upCover_y = tofPara->
Get(
"upCover_y");
54 upCover_z = tofPara->
Get(
"upCover_z");
55 upCover_posz = tofPara->
Get(
"upCover_posz");
57 lowCover1_xdown = tofPara->
Get(
"lowCover1_xdown");
58 lowCover1_xup = tofPara->
Get(
"lowCover1_xup");
59 lowCover1_y = tofPara->
Get(
"lowCover1_y");
60 lowCover1_z = tofPara->
Get(
"lowCover1_z");
61 lowCover1_addx = tofPara->
Get(
"lowCover1_addx");
62 lowCover1_addz = tofPara->
Get(
"lowCover1_addz");
63 lowCover1_posz = tofPara->
Get(
"lowCover1_posz");
65 lowCover2_xdown = tofPara->
Get(
"lowCover2_xdown");
66 lowCover2_xup = tofPara->
Get(
"lowCover2_xup");
67 lowCover2_y = tofPara->
Get(
"lowCover2_y");
68 lowCover2_z = tofPara->
Get(
"lowCover2_z");
69 lowCover2_posz = tofPara->
Get(
"lowCover2_posz");
71 upFEE_xdown = tofPara->
Get(
"upFEE_xdown");
72 upFEE_xup = tofPara->
Get(
"upFEE_xup");
73 upFEE_y = tofPara->
Get(
"upFEE_y");
74 upFEE_z = tofPara->
Get(
"upFEE_z");
75 FEE_thickness = tofPara->
Get(
"FEE_thickness");
76 upFEE_posz = tofPara->
Get(
"upFEE_posz");
78 upFEE_pcb_xdown = tofPara->
Get(
"upFEE_pcb_xdown");
79 upFEE_pcb_xup = tofPara->
Get(
"upFEE_pcb_xup");
80 upFEE_pcb_y = tofPara->
Get(
"upFEE_pcb_y");
81 upFEE_pcb_z = tofPara->
Get(
"upFEE_pcb_z");
83 sideFEE_x = tofPara->
Get(
"sideFEE_x");
84 sideFEE_y = tofPara->
Get(
"sideFEE_y");
85 sideFEE_z = tofPara->
Get(
"sideFEE_z");
86 sideFEE_posl = tofPara->
Get(
"sideFEE_posl");
88 sideFEE_pcb_x = tofPara->
Get(
"sideFEE_pcb_x");
89 sideFEE_pcb_y = tofPara->
Get(
"sideFEE_pcb_y");
90 sideFEE_pcb_z = tofPara->
Get(
"sideFEE_pcb_z");
92 castingDie_x = tofPara->
Get(
"castingDie_x");
93 castingDie_y = tofPara->
Get(
"castingDie_y");
94 castingDie_z = tofPara->
Get(
"castingDie_z");
95 castingDie_addr = tofPara->
Get(
"castingDie_addr");
96 castingDie_subtractx = tofPara->
Get(
"castingDie_subtractx");
97 castingDie_subtract_posz = tofPara->
Get(
"castingDie_subtract_posz");
98 castingDie_posz1 = tofPara->
Get(
"castingDie_posz1");
99 castingDie_posz2 = tofPara->
Get(
"castingDie_posz2");
101 chamber_in_posy = tofPara->
Get(
"chamber_in_posy");
102 chamber_out_posy = tofPara->
Get(
"chamber_out_posy");
104 bracket_x = tofPara->
Get(
"bracket_x");
105 bracket_y = tofPara->
Get(
"bracket_y");
106 bracket_z = tofPara->
Get(
"bracket_z");
107 bracket_r = tofPara->
Get(
"bracket_r");
108 bracket_posx = tofPara->
Get(
"bracket_posx");
110 upStopBlock_x = tofPara->
Get(
"upStopBlock_x");
111 upStopBlock_y = tofPara->
Get(
"upStopBlock_y");
112 upStopBlock_z = tofPara->
Get(
"upStopBlock_z");
113 upStopBlock_subtractr = tofPara->
Get(
"upStopBlock_subtractr");
114 upStopBlock_subtractposz = tofPara->
Get(
"upStopBlock_subtractposz");
116 sideStopBlock_x = tofPara->
Get(
"sideStopBlock_x");
117 sideStopBlock_y = tofPara->
Get(
"sideStopBlock_y");
118 sideStopBlock_z = tofPara->
Get(
"sideStopBlock_z");
119 sideStopBlock_thickness = tofPara->
Get(
"sideStopBlock_thickness");
120 sideStopBlock_posz0 = tofPara->
Get(
"sideStopBlock_posz0");
121 sideStopBlock_posz1 = tofPara->
Get(
"sideStopBlock_posz1");
124 honeyComb_xdown = tofPara->
Get(
"honeyComb_xdown");
125 honeyComb_xup = tofPara->
Get(
"honeyComb_xup");
126 honeyComb_y = tofPara->
Get(
"honeyComb_y");
127 honeyComb_z = tofPara->
Get(
"honeyComb_z");
128 honeyComb_surface_y = tofPara->
Get(
"honeyComb_surface_y");
129 honeyComb_posz = tofPara->
Get(
"honeyComb_posz");
131 tape_mrpc_xdown = tofPara->
Get(
"tape_mrpc_xdown");
132 tape_mrpc_xup = tofPara->
Get(
"tape_mrpc_xup");
133 tape_mrpc_y = tofPara->
Get(
"tape_mrpc_y");
134 tape_mrpc_z = tofPara->
Get(
"tape_mrpc_z");
135 tape_mrpc_posz = tofPara->
Get(
"tape_mrpc_posz");
137 pcbBoard_xdown = tofPara->
Get(
"pcbBoard_xdown");
138 pcbBoard_xup = tofPara->
Get(
"pcbBoard_xup");
139 pcbBoard_y0 = tofPara->
Get(
"pcbBoard_y0");
140 pcbBoard_y1 = tofPara->
Get(
"pcbBoard_y1");
141 pcbBoard_z = tofPara->
Get(
"pcbBoard_z");
143 strip_x[0] = tofPara->
Get(
"strip_x[0]");
144 strip_x[1] = tofPara->
Get(
"strip_x[1]");
145 strip_x[2] = tofPara->
Get(
"strip_x[2]");
146 strip_x[3] = tofPara->
Get(
"strip_x[3]");
147 strip_x[4] = tofPara->
Get(
"strip_x[4]");
148 strip_x[5] = tofPara->
Get(
"strip_x[5]");
149 strip_x[6] = tofPara->
Get(
"strip_x[6]");
150 strip_x[7] = tofPara->
Get(
"strip_x[7]");
151 strip_x[8] = tofPara->
Get(
"strip_x[8]");
152 strip_x[9] = tofPara->
Get(
"strip_x[9]");
153 strip_x[10] = tofPara->
Get(
"strip_x[10]");
154 strip_x[11] = tofPara->
Get(
"strip_x[11]");
155 strip_y = tofPara->
Get(
"strip_y");
156 strip_z = tofPara->
Get(
"strip_z");
157 strip_gap = tofPara->
Get(
"strip_gap");
158 strip_posz = tofPara->
Get(
"strip_posz");
160 mylar_xdown = tofPara->
Get(
"mylar_xdown");
161 mylar_xup = tofPara->
Get(
"mylar_xup");
162 mylar_y = tofPara->
Get(
"mylar_y");
163 mylar_z = tofPara->
Get(
"mylar_z");
164 mylar_posz = tofPara->
Get(
"mylar_posz");
166 glass0_xdown = tofPara->
Get(
"glass0_xdown");
167 glass0_xup = tofPara->
Get(
"glass0_xup");
168 glass0_y = tofPara->
Get(
"glass0_y");
169 glass0_z = tofPara->
Get(
"glass0_z");
170 glass0_posz = tofPara->
Get(
"glass0_posz");
172 glass1_xdown = tofPara->
Get(
"glass1_xdown");
173 glass1_xup = tofPara->
Get(
"glass1_xup");
174 glass1_y = tofPara->
Get(
"glass1_y");
175 glass1_z = tofPara->
Get(
"glass1_z");
176 glass1_posz = tofPara->
Get(
"glass1_posz");
178 gasLayer_xdown = tofPara->
Get(
"gasLayer_xdown");
179 gasLayer_xup = tofPara->
Get(
"gasLayer_xup");
180 gasLayer_y = tofPara->
Get(
"gasLayer_y");
181 gasLayer_z = tofPara->
Get(
"gasLayer_z");
182 gasLayer_posz = tofPara->
Get(
"gasLayer_posz");
184 endcap_r = tofPara->
Get(
"endcap_r");
185 endcap_length = tofPara->
Get(
"endcap_length");
186 layer_posz = tofPara->
Get(
"layer_posz");
187 startAngle_east = tofPara->
Get(
"startAngle_east");
188 startAngle_west = tofPara->
Get(
"startAngle_west");
194 G4Trd* solid_containerOut =
new G4Trd(name, containerOut_xdown/2+
smallL, containerOut_xup/2+
smallL, containerOut_y/2+
smallL, containerOut_y/2+
smallL, containerOut_z/2+
smallL);
195 return solid_containerOut;
200 G4Trd* solid_containerIn =
new G4Trd(name, containerIn_xdown/2+
smallL, containerIn_xup/2+
smallL, containerIn_y/2+
smallL, containerIn_y/2+
smallL, containerIn_z/2+
smallL);
201 return solid_containerIn;
207 Name<<
"solid_containerOut_"<<name;
210 Name<<
"solid_containerIn_"<<name;
213 double lz = (container_lowBorder-container_thickness)/2;
214 G4ThreeVector translation_containerFrame(0,0,lz);
215 G4Transform3D transform_containerFrame(
rot_dummy, translation_containerFrame);
217 Name<<
"solid_containerFrame_"<<name;
218 G4SubtractionSolid* solid_containerFrame =
new G4SubtractionSolid(
Name.str(), solid_containerOut, solid_containerIn, transform_containerFrame);
219 G4LogicalVolume* logical_containerFrame =
new G4LogicalVolume(solid_containerFrame, G4Material::GetMaterial(
"Aluminium"), name);
221 G4VisAttributes* vis =
new G4VisAttributes();
222 vis->SetColor(G4Color(0.5,0.5,0.6));
223 logical_containerFrame->SetVisAttributes(vis);
225 return logical_containerFrame;
231 return solid_upCover;
242 G4Trd* solid_lowCover1_2 =
new G4Trd(
Name.str(), lowCover1_addx/2+
smallL, lowCover1_addx/2+
smallL, lowCover1_y/2+
smallL, lowCover1_y/2+
smallL, lowCover1_addz/2+
smallL);
244 G4Transform3D transform_lowCover1(
rot_dummy, G4ThreeVector(0,0,-(lowCover1_z+lowCover1_addz)/2));
245 G4UnionSolid* solid_lowCover1 =
new G4UnionSolid(name, solid_lowCover1_1, solid_lowCover1_2, transform_lowCover1);
246 return solid_lowCover1;
251 G4Trd* solid_lowCover2 =
new G4Trd(name, lowCover2_xdown/2+
smallL, lowCover2_xup/2+
smallL, lowCover2_y/2+
smallL, lowCover2_y/2+
smallL, lowCover2_z/2+
smallL);
252 return solid_lowCover2;
258 Name<<
"solid_upCover_"<<name;
260 G4LogicalVolume* logical_upCover =
new G4LogicalVolume(solid_upCover, G4Material::GetMaterial(
"Aluminium"), name);
262 G4VisAttributes* vis =
new G4VisAttributes();
263 vis->SetColor(G4Color(0.5,0.5,0.6));
265 logical_upCover->SetVisAttributes(vis);
267 return logical_upCover;
273 Name<<
"solid_lowCover1_"<<name;
275 G4LogicalVolume* logical_lowCover1 =
new G4LogicalVolume(solid_lowCover1, G4Material::GetMaterial(
"Aluminium"), name);
277 G4VisAttributes* vis =
new G4VisAttributes();
278 vis->SetColor(G4Color(0.5,0.5,0.6));
280 logical_lowCover1->SetVisAttributes(vis);
282 return logical_lowCover1;
288 Name<<
"solid_lowCover2_"<<name;
290 G4LogicalVolume* logical_lowCover2 =
new G4LogicalVolume(solid_lowCover2, G4Material::GetMaterial(
"Aluminium"), name);
292 G4VisAttributes* vis =
new G4VisAttributes();
293 vis->SetColor(G4Color(0.5,0.5,0.6));
295 logical_lowCover2->SetVisAttributes(vis);
297 return logical_lowCover2;
309 Name<<
"solid_upFEE_pcb_"<<name;
310 G4Trd* solid_upFEE_pcb =
new G4Trd(
Name.str(), upFEE_pcb_xdown/2, upFEE_pcb_xup/2, upFEE_pcb_y/2, upFEE_pcb_y/2, upFEE_pcb_z/2);
311 G4LogicalVolume* logical_upFEE_pcb =
new G4LogicalVolume(solid_upFEE_pcb, G4Material::GetMaterial(
"insulationBoard"), name);
313 G4VisAttributes* vis =
new G4VisAttributes();
314 vis->SetForceWireframe(
true);
315 vis->SetColor(G4Color(0.2, 1, 0));
316 logical_upFEE_pcb->SetVisAttributes(vis);
318 return logical_upFEE_pcb;
324 Name<<
"solid_upFEE_"<<name;
326 G4LogicalVolume* logical_upFEE =
new G4LogicalVolume(solid_upFEE, G4Material::GetMaterial(
"Air"), name);
329 Name<<
"solid_upFEE_out_"<<name;
333 Name<<
"solid_upFEE_in_"<<name;
334 G4Trd* solid_upFEE_in =
new G4Trd(
Name.str(), upFEE_xdown/2-FEE_thickness, upFEE_xup/2-FEE_thickness, upFEE_y/2, upFEE_y/2, upFEE_z/2-FEE_thickness);
337 Name<<
"solid_upFEE_box_"<<name;
338 G4Transform3D transform_upFEE(
rot_dummy, G4ThreeVector(0, -1*FEE_thickness, 0));
339 G4SubtractionSolid* solid_upFEE_box =
new G4SubtractionSolid(
Name.str(), solid_upFEE_out, solid_upFEE_in, transform_upFEE);
342 Name<<
"logical_upFEE_box_"<<name;
343 G4LogicalVolume* logical_upFEE_box =
new G4LogicalVolume(solid_upFEE_box, G4Material::GetMaterial(
"Aluminium"),
Name.str());
346 Name<<
"logical_upFEE_pcb_"<<name;
350 Name<<
"physical_upFEE_pcb_"<<name;
351 new G4PVPlacement(0, G4ThreeVector(0,0,0), logical_upFEE_pcb,
Name.str(), logical_upFEE,
false, 0,
checkOverlap);
354 Name<<
"physical_upFEE_box_"<<name;
355 new G4PVPlacement(0, G4ThreeVector(0,0,0), logical_upFEE_box,
Name.str(), logical_upFEE,
false, 0,
checkOverlap);
357 G4VisAttributes* vis =
new G4VisAttributes();
358 vis->SetColor(G4Color(0.2,0.,1));
360 logical_upFEE_box->SetVisAttributes(vis);
362 G4VisAttributes* vis1 =
new G4VisAttributes();
363 vis1->SetVisibility(0);
364 logical_upFEE->SetVisAttributes(vis1);
366 return logical_upFEE;
373 return solid_sideFEE;
379 Name<<
"solid_sideFEE_pcb_"<<name;
380 G4Trd* solid_sideFEE_pcb =
new G4Trd(
Name.str(), sideFEE_pcb_x/2, sideFEE_pcb_x/2, sideFEE_pcb_y/2, sideFEE_pcb_y/2, sideFEE_pcb_z/2);
381 G4LogicalVolume* logical_sideFEE_pcb =
new G4LogicalVolume(solid_sideFEE_pcb, G4Material::GetMaterial(
"insulationBoard"), name);
383 G4VisAttributes* vis =
new G4VisAttributes();
384 vis->SetColor(G4Color(0.2, 1, 0));
385 logical_sideFEE_pcb->SetVisAttributes(vis);
387 return logical_sideFEE_pcb;
393 Name<<
"solid_sideFEE_"<<name;
395 G4LogicalVolume* logical_sideFEE =
new G4LogicalVolume(solid_sideFEE, G4Material::GetMaterial(
"Air"), name);
398 Name<<
"solid_sideFEE_out_"<<name;
402 Name<<
"solid_sideFEE_in_"<<name;
403 G4Trd* solid_sideFEE_in =
new G4Trd(
Name.str(), sideFEE_x/2, sideFEE_x/2, sideFEE_y/2-FEE_thickness, sideFEE_y/2-FEE_thickness, sideFEE_z/2-FEE_thickness);
406 Name<<
"solid_sideFEE_box_"<<name;
407 G4Transform3D transform_sideFEE(
rot_dummy, G4ThreeVector(FEE_thickness, 0, 0));
408 G4SubtractionSolid* solid_sideFEE_box =
new G4SubtractionSolid(
Name.str(), solid_sideFEE_out, solid_sideFEE_in, transform_sideFEE);
411 Name<<
"logical_sideFEE_box_"<<name;
412 G4LogicalVolume* logical_sideFEE_box =
new G4LogicalVolume(solid_sideFEE_box, G4Material::GetMaterial(
"Aluminium"),
Name.str());
415 Name<<
"logical_sideFEE_pcb_"<<name;
419 Name<<
"physical_sideFEE_pcb_"<<name;
420 new G4PVPlacement(0, G4ThreeVector(0,0,0), logical_sideFEE_pcb,
Name.str(), logical_sideFEE,
false, 0,
checkOverlap);
423 Name<<
"physical_sideFEE_box_"<<name;
424 new G4PVPlacement(0, G4ThreeVector(0,0,0), logical_sideFEE_box,
Name.str(), logical_sideFEE,
false, 0,
checkOverlap);
426 G4VisAttributes* vis =
new G4VisAttributes();
427 vis->SetColor(G4Color(0.2,0.,1));
429 logical_sideFEE_box->SetVisAttributes(vis);
431 G4VisAttributes* vis1 =
new G4VisAttributes();
432 vis1->SetVisibility(0);
433 logical_sideFEE->SetVisAttributes(vis1);
435 return logical_sideFEE;
444 G4Trd* solid_castingDie_outline_1 =
new G4Trd(
Name.str(), castingDie_x/2+
smallL, castingDie_x/2+
smallL, castingDie_y/2+
smallL, castingDie_y/2+
smallL, castingDie_z/2+
smallL*10);
447 G4Tubs* solid_castingDie_outline_2 =
new G4Tubs(
Name.str(), 0, castingDie_addr+
smallL, castingDie_z/2+
smallL*10, 0*degree, 360*degree);
450 G4Transform3D transform_castingDie_outline_1(
rot_dummy, G4ThreeVector(castingDie_x/2-0.1*mm,0,0));
453 G4UnionSolid* solid_castingDie_outline_3 =
new G4UnionSolid(
Name.str(), solid_castingDie_outline_1, solid_castingDie_outline_2, transform_castingDie_outline_1);
455 G4Transform3D transform_castingDie_outline_2(
rot_dummy, G4ThreeVector(-1*castingDie_x/2+0.1*mm,0,0));
456 G4UnionSolid* solid_castingDie_outline =
new G4UnionSolid(name, solid_castingDie_outline_3, solid_castingDie_outline_2, transform_castingDie_outline_2);
457 return solid_castingDie_outline;
463 Name<<
"solid_castingDie_outline_"<<name;
467 Name<<
"solid_castingDie_subtract_"<<name;
468 G4Trd* solid_castingDie_subtract =
new G4Trd(
Name.str(), castingDie_subtractx/2, castingDie_subtractx/2, castingDie_y, castingDie_y, castingDie_z/2);
470 G4Transform3D transform_castingDie(
rot_dummy, G4ThreeVector(0,0,-1*castingDie_subtract_posz));
472 Name<<
"solid_castingDie_"<<name;
473 G4SubtractionSolid* solid_castingDie =
new G4SubtractionSolid(
Name.str(), solid_castingDie_outline, solid_castingDie_subtract, transform_castingDie);
474 G4LogicalVolume* logical_castingDie =
new G4LogicalVolume(solid_castingDie, G4Material::GetMaterial(
"Aluminium"), name);
476 G4VisAttributes* vis =
new G4VisAttributes();
477 vis->SetColor(G4Color(0.2,0.,1));
480 logical_castingDie->SetVisAttributes(vis);
482 return logical_castingDie;
488 Name<<
"solid_containerOut_"<<name;
493 Name<<
"solid_upCover_"<<name;
495 G4ThreeVector translation_upCover(0, (containerOut_y+upCover_y)/2, (upCover_z-containerOut_z)/2-upCover_posz);
496 G4Transform3D transform_upCover(
rot_dummy, translation_upCover);
498 Name<<
"solid_container_"<<name<<
"_1";
499 G4UnionSolid* solid_container_1 =
new G4UnionSolid(
Name.str(), solid_containerOut, solid_upCover, transform_upCover);
503 Name<<
"solid_upFEE_"<<name;
505 G4ThreeVector translation_upFEE(0, containerOut_y/2+upCover_y+upFEE_y/2, upCover_z-upFEE_posz-upFEE_z/2-upCover_posz-containerOut_z/2);
506 G4Transform3D transform_upFEE(
rot_dummy, translation_upFEE);
508 Name<<
"solid_container_"<<name<<
"_2";
509 G4UnionSolid* solid_container_2 =
new G4UnionSolid(
Name.str(), solid_container_1, solid_upFEE, transform_upFEE);
513 Name<<
"solid_sideFEE_"<<name;
516 double angle_containerFrameSide = atan((containerOut_xup-containerOut_xdown)/2/containerOut_z) *
rad;
517 double l_containerFrameSide = containerOut_z/
cos(angle_containerFrameSide);
518 double x_sideFEE = (l_containerFrameSide/2-sideFEE_posl)*
sin(angle_containerFrameSide)+(containerOut_xup+containerOut_xdown)/4+sideFEE_x/2*
cos(angle_containerFrameSide);
519 double z_sideFEE = (l_containerFrameSide/2-sideFEE_posl)*
cos(angle_containerFrameSide)-sideFEE_x/2*
sin(angle_containerFrameSide);
520 G4ThreeVector translation_sideFEE_left(-x_sideFEE, 0, z_sideFEE);
521 G4RotationMatrix rot_sideFEE_left;
522 rot_sideFEE_left.rotateY(-angle_containerFrameSide);
523 G4Transform3D transform_sideFEE_left(rot_sideFEE_left, translation_sideFEE_left);
525 Name<<
"solid_container_"<<name<<
"_3";
526 G4UnionSolid* solid_container_3 =
new G4UnionSolid(
Name.str(), solid_container_2, solid_sideFEE, transform_sideFEE_left);
528 G4ThreeVector translation_sideFEE_right(x_sideFEE, 0, z_sideFEE);
529 G4RotationMatrix rot_sideFEE_right;
530 rot_sideFEE_right.rotateY(angle_containerFrameSide);
531 G4Transform3D transform_sideFEE_right(rot_sideFEE_right, translation_sideFEE_right);
533 Name<<
"solid_container_"<<name<<
"_4";
534 G4UnionSolid* solid_container_4 =
new G4UnionSolid(
Name.str(), solid_container_3, solid_sideFEE, transform_sideFEE_right);
538 Name<<
"solid_castingDie_"<<name;
541 G4RotationMatrix rot_castingDie;
542 rot_castingDie.rotateX(90*deg);
543 G4ThreeVector translation_castingDie_1(0, containerOut_y/2+upCover_y+castingDie_z/2, -containerOut_z/2+upCover_posz+castingDie_posz1);
544 G4Transform3D transform_castingDie_1(rot_castingDie, translation_castingDie_1);
546 Name<<
"solid_container_"<<name<<
"_5";
547 G4UnionSolid* solid_container_5 =
new G4UnionSolid(
Name.str(), solid_container_4, solid_castingDie, transform_castingDie_1);
549 G4ThreeVector translation_castingDie_2(0, containerOut_y/2+upCover_y+castingDie_z/2, -containerOut_z/2+upCover_posz+castingDie_posz2);
550 G4Transform3D transform_castingDie_2(rot_castingDie, translation_castingDie_2);
552 Name<<
"solid_container_"<<name<<
"_6";
553 G4UnionSolid* solid_container_6 =
new G4UnionSolid(
Name.str(), solid_container_5, solid_castingDie, transform_castingDie_2);
556 G4VSolid* solid_lowCover;
558 Name<<
"solid_lowCover_"<<name;
562 z_lowCover = (lowCover1_z-containerOut_z)/2-lowCover1_posz;
567 z_lowCover = (lowCover2_z-containerOut_z)/2-lowCover2_posz;
570 else G4cout<<
"!!!!!!!! Wrong lower Board !!!!!!!!!"<<G4endl;
572 G4ThreeVector translation_lowCover(0, -1*(containerOut_y+upCover_y)/2, z_lowCover);
573 G4Transform3D transform_lowCover(
rot_dummy, translation_lowCover);
575 Name<<
"solid_container_"<<name;
576 G4UnionSolid* solid_container =
new G4UnionSolid(
Name.str(), solid_container_6, solid_lowCover, transform_lowCover);
577 G4LogicalVolume* logical_container =
new G4LogicalVolume(solid_container, G4Material::GetMaterial(
"Air"), name);
579 G4VisAttributes* vis =
new G4VisAttributes();
580 vis->SetColor(G4Color(0.5,0.5,0.6));
581 vis->SetForceWireframe(
true);
582 logical_container->SetVisAttributes(vis);
585 return logical_container;
592 Name<<
"solid_gasContainer_"<<name;
594 G4LogicalVolume* logical_gasContainer =
new G4LogicalVolume(solid_gasContainer, G4Material::GetMaterial(
"MRPCGas"), name);
596 G4VisAttributes* vis =
new G4VisAttributes();
598 vis->SetForceWireframe(
true);
599 logical_gasContainer->SetVisAttributes(vis);
601 return logical_gasContainer;
608 double xdown = pcbBoard_xdown;
609 double xup = pcbBoard_xup;
610 double y = honeyComb_y*2+tape_mrpc_y*2+pcbBoard_y0*2+pcbBoard_y1+mylar_y*4+glass0_y*4+glass1_y*10+gasLayer_y*12;
611 double z = pcbBoard_z;
613 Name<<
"solid_bareChamber_"<<name;
615 G4LogicalVolume* logical_bareChamber =
new G4LogicalVolume(solid_bareChamber, G4Material::GetMaterial(
"MRPCGas"), name);
617 G4VisAttributes* vis =
new G4VisAttributes();
619 vis->SetVisibility(0);
621 logical_bareChamber->SetVisAttributes(vis);
623 return logical_bareChamber;
630 Name<<
"solid_honeyComb_"<<name;
631 G4Trd* solid_honeyComb =
new G4Trd(
Name.str(), honeyComb_xdown/2, honeyComb_xup/2, honeyComb_y/2, honeyComb_y/2, honeyComb_z/2);
632 G4LogicalVolume* logical_honeyComb =
new G4LogicalVolume(solid_honeyComb, G4Material::GetMaterial(
"honeycombCore"), name);
636 Name<<
"solid_honeyComb_surface_"<<name;
637 G4Trd* solid_honeyComb_surface =
new G4Trd(
Name.str(), honeyComb_xdown/2, honeyComb_xup/2, honeyComb_surface_y/2, honeyComb_surface_y/2, honeyComb_z/2);
640 Name<<
"logical_honeyComb_surface_"<<name;
641 G4LogicalVolume* logical_honeyComb_surface =
new G4LogicalVolume(solid_honeyComb_surface, G4Material::GetMaterial(
"insulationBoard"),
Name.str());
644 Name<<
"physical_honeyComb_surface_"<<name<<
"_0";
645 new G4PVPlacement(0, G4ThreeVector(0,(honeyComb_y-honeyComb_surface_y)/2.-
smallL,0), logical_honeyComb_surface,
Name.str(), logical_honeyComb,
false, 0,
checkOverlap);
648 Name<<
"physical_honeyComb_surface_"<<name<<
"_1";
649 new G4PVPlacement(0, G4ThreeVector(0,-(honeyComb_y-honeyComb_surface_y)/2.+
smallL,0), logical_honeyComb_surface,
Name.str(), logical_honeyComb,
false, 0,
checkOverlap);
651 G4VisAttributes* vis1 =
new G4VisAttributes();
652 vis1->SetColor(G4Color::Green());
654 logical_honeyComb_surface->SetVisAttributes(vis1);
656 G4VisAttributes* vis =
new G4VisAttributes();
657 vis->SetColor(G4Color(0.55, 0.3, 0.3));
659 logical_honeyComb->SetVisAttributes(vis);
661 return logical_honeyComb;
667 Name<<
"solid_tape_mrpc_"<<name;
668 G4Trd* solid_tape_mrpc=
new G4Trd(
Name.str(),tape_mrpc_xdown/2,tape_mrpc_xup/2,tape_mrpc_y/2,tape_mrpc_y/2,tape_mrpc_z/2);
669 G4LogicalVolume* logical_tape_mrpc =
new G4LogicalVolume(solid_tape_mrpc,G4Material::GetMaterial(
"PET"), name);
671 G4VisAttributes* vis =
new G4VisAttributes();
672 vis->SetColor(G4Color(1, 1, 0));
675 logical_tape_mrpc->SetVisAttributes(vis);
677 return logical_tape_mrpc;
683 if(
flag==0) pcbBoard_y=pcbBoard_y0;
684 else pcbBoard_y=pcbBoard_y1;
687 Name<<
"solid_pcbBoard_"<<name;
688 G4Trd* solid_pcbBoard =
new G4Trd(
Name.str(),pcbBoard_xdown/2., pcbBoard_xup/2., pcbBoard_y/2., pcbBoard_y/2.,pcbBoard_z/2.);
689 G4LogicalVolume* logical_pcbBoard =
new G4LogicalVolume(solid_pcbBoard,G4Material::GetMaterial(
"insulationBoard"), name);
691 G4VisAttributes* vis =
new G4VisAttributes();
692 vis->SetColor(G4Color(0.2, 1, 0));
695 logical_pcbBoard->SetVisAttributes(vis);
697 return logical_pcbBoard;
703 G4Trd* solid_strip[
no];
704 G4LogicalVolume* logical_strip[
no];
705 G4VisAttributes* vis =
new G4VisAttributes();
706 vis->SetColor(G4Color(1, 0, 0));
707 vis->SetForceSolid(1);
708 for(G4int i=0; i<
no; i++)
711 Name<<
"solid_strip_"<<name<<
"_"<<i;
712 solid_strip[i] =
new G4Trd(
Name.str(), strip_x[i]/2., strip_x[i]/2., strip_y/2., strip_y/2., strip_z/2.);
715 logical_strip[i] =
new G4LogicalVolume(solid_strip[i], G4Material::GetMaterial(
"Copper"),
Name.str());
716 logical_strip[i]->SetVisAttributes(vis);
719 G4AssemblyVolume* logical_strip_unified =
new G4AssemblyVolume();
720 G4ThreeVector translation_strip;
721 G4Transform3D transform_strip;
722 for(G4int i=0; i<
no; i++)
724 translation_strip.set(0, 0, (i-5.5)*(strip_z+strip_gap));
725 transform_strip = G4Transform3D(
rot_dummy, translation_strip);
726 logical_strip_unified->AddPlacedVolume(logical_strip[i], transform_strip);
729 return logical_strip_unified;
735 Name<<
"solid_mylar_"<<name;
736 G4Trd* solid_mylar =
new G4Trd(
Name.str(),mylar_xdown/2.,mylar_xup/2.,mylar_y/2.,mylar_y/2.,mylar_z/2.);
737 G4LogicalVolume* logical_mylar =
new G4LogicalVolume(solid_mylar,G4Material::GetMaterial(
"PET"), name);
739 G4VisAttributes* vis =
new G4VisAttributes();
740 vis->SetColor(G4Color(1, 0., 0.7));
742 logical_mylar->SetVisAttributes(vis);
744 return logical_mylar;
755 glass_xdown = glass0_xdown;
756 glass_xup = glass0_xup;
762 glass_xdown = glass1_xdown;
763 glass_xup = glass1_xup;
769 Name<<
"solid_glass_"<<name;
770 G4Trd* solid_glass =
new G4Trd(
Name.str(), glass_xdown/2.,glass_xup/2. ,glass_y/2.,glass_y/2.,glass_z/2.);
771 G4LogicalVolume* logical_glass =
new G4LogicalVolume(solid_glass,G4Material::GetMaterial(
"SiO2"), name);
773 G4VisAttributes* vis =
new G4VisAttributes();
774 vis->SetColor(G4Color(0.2, 0.4, 1));
776 logical_glass->SetVisAttributes(vis);
778 return logical_glass;
784 Name<<
"solid_gasLayer_"<<name;
785 G4Trd* solid_gasLayer =
new G4Trd(
Name.str(),gasLayer_xdown/2.,gasLayer_xup/2.,gasLayer_y/2.,gasLayer_y/2.,gasLayer_z/2.);
786 G4LogicalVolume* logical_gasLayer =
new G4LogicalVolume(solid_gasLayer,G4Material::GetMaterial(
"MRPCGas"), name);
788 G4VisAttributes* vis =
new G4VisAttributes();
789 vis->SetColor(G4Color::Blue());
793 return logical_gasLayer;
799 Name<<
"solid_bracket_"<<name<<
"_1";
800 G4Tubs* solid_bracket_1 =
new G4Tubs(
Name.str(), 0, bracket_r, bracket_z/2, 0*degree, 360*degree);
803 Name<<
"solid_bracket_"<<name<<
"_2";
804 G4Trd* solid_bracket_2 =
new G4Trd(
Name.str(), bracket_x/2, bracket_x/2, bracket_x/2, bracket_x/2, bracket_y/2);
806 G4Transform3D transform_bracket(
rot_dummy, G4ThreeVector(0, 0, (bracket_y+bracket_z)/2));
808 Name<<
"solid_bracket_"<<name;
809 G4UnionSolid* solid_bracket =
new G4UnionSolid(
Name.str(), solid_bracket_1, solid_bracket_2, transform_bracket);
810 G4LogicalVolume* logical_bracket =
new G4LogicalVolume(solid_bracket, G4Material::GetMaterial(
"Nylon"), name);
812 G4VisAttributes* vis =
new G4VisAttributes();
813 vis->SetColor(G4Color(0.3, 0.3, 0.3));
815 logical_bracket->SetVisAttributes(vis);
817 return logical_bracket;
823 Name<<
"solid_upStopBlock_"<<name<<
"_1";
824 G4Trd* solid_upStopBlock_1 =
new G4Trd(
Name.str(), upStopBlock_x/2, upStopBlock_x/2, upStopBlock_y/2, upStopBlock_y/2, upStopBlock_z/2);
827 Name<<
"solid_upStopBlock_"<<name<<
"_2";
828 G4Tubs* solid_upStopBlock_2 =
new G4Tubs(
Name.str(), 0, upStopBlock_subtractr+
smallL, upStopBlock_x/2+
smallL, 0*degree, 360*degree);
830 G4RotationMatrix rot_upStopBlock;
832 rot_upStopBlock.rotateY(90*degree);
833 G4Transform3D transform_upStopBlock(rot_upStopBlock, G4ThreeVector(0,0,(upStopBlock_z-upStopBlock_subtractr)/2-upStopBlock_subtractposz));
836 Name<<
"solid_upStopBlock_"<<name;
837 G4SubtractionSolid* solid_upStopBlock =
new G4SubtractionSolid(
Name.str(), solid_upStopBlock_1, solid_upStopBlock_2, transform_upStopBlock);
838 G4LogicalVolume* logical_upStopBlock =
new G4LogicalVolume(solid_upStopBlock, G4Material::GetMaterial(
"Nylon"), name);
840 G4VisAttributes* vis =
new G4VisAttributes();
841 vis->SetColor(G4Color(0.3, 0.3, 0.3));
843 logical_upStopBlock->SetVisAttributes(vis);
845 return logical_upStopBlock;
851 Name<<
"solid_sideStopBlock_"<<name<<
"_1";
852 G4Trd* solid_sideStopBlock_1 =
new G4Trd(
Name.str(), sideStopBlock_x/2, sideStopBlock_x/2, sideStopBlock_y/2, sideStopBlock_y/2, sideStopBlock_z/2);
855 Name<<
"solid_sideStopBlock_"<<name<<
"_2";
856 G4Trd* solid_sideStopBlock_2 =
new G4Trd(
Name.str(), (sideStopBlock_x-sideStopBlock_thickness)/2+
smallL, (sideStopBlock_x-sideStopBlock_thickness)/2+
smallL, sideStopBlock_y/2+
smallL, sideStopBlock_y/2+
smallL, sideStopBlock_z/2-sideStopBlock_thickness);
858 G4Transform3D transform_upStopBlock(
rot_dummy, G4ThreeVector(sideStopBlock_thickness/2, 0, 0));
861 Name<<
"solid_sideStopBlock_"<<name;
862 G4SubtractionSolid* solid_sideStopBlock =
new G4SubtractionSolid(
Name.str(), solid_sideStopBlock_1, solid_sideStopBlock_2, transform_upStopBlock);
863 G4LogicalVolume* logical_sideStopBlock =
new G4LogicalVolume(solid_sideStopBlock, G4Material::GetMaterial(
"Nylon"), name);
865 G4VisAttributes* vis =
new G4VisAttributes();
866 vis->SetColor(G4Color(0.3, 0.3, 0.3));
868 logical_sideStopBlock->SetVisAttributes(vis);
870 return logical_sideStopBlock;
double sin(const BesAngle a)
double cos(const BesAngle a)
G4RotationMatrix rot_dummy(0 *deg, 0 *deg, 0 *deg)
double Get(std::string key)
static BesTofGeoParameter * GetInstance()
G4LogicalVolume * lg_sideFEE(string name="")
G4LogicalVolume * lg_mylar(string name="")
G4LogicalVolume * lg_lowCover1(string name="")
G4LogicalVolume * lg_glass(G4int flag, string name="")
G4VSolid * sd_containerIn(double smallL=0, string name="")
G4LogicalVolume * lg_container(int flag, string name="")
G4VSolid * sd_sideFEE(double smallL=0, string name="")
G4VSolid * sd_upFEE(double smallL=0, string name="")
G4VSolid * sd_lowCover2(double smallL=0, string name="")
G4LogicalVolume * lg_gasContainer(string name="")
G4LogicalVolume * lg_sideStopBlock(string name="")
G4VSolid * sd_upCover(double smallL=0, string name="")
G4AssemblyVolume * lg_strip(string name="")
G4LogicalVolume * lg_upFEE_pcb(string name="")
G4LogicalVolume * lg_honeyComb(string name="")
G4LogicalVolume * lg_sideFEE_pcb(string name="")
G4LogicalVolume * lg_containerFrame(string name="")
G4VSolid * sd_lowCover1(double smallL=0, string name="")
G4LogicalVolume * lg_lowCover2(string name="")
G4LogicalVolume * lg_pcbBoard(G4int flag, string name="")
G4LogicalVolume * lg_bracket(string name="")
G4LogicalVolume * lg_bareChamber(string name="")
G4LogicalVolume * lg_upStopBlock(string name="")
G4LogicalVolume * lg_tape_mrpc(string name="")
G4VSolid * sd_containerOut(double smallL=0, string name="")
G4LogicalVolume * lg_gasLayer(string name="")
G4LogicalVolume * lg_castingDie(string name="")
G4LogicalVolume * lg_upFEE(string name="")
G4VSolid * sd_castingDie_outline(double smallL=0, string name="")
G4LogicalVolume * lg_upCover(string name="")