3 #include <phparameter/PHParameters.h>
5 #include <Geant4/G4Colour.hh>
6 #include <Geant4/G4Element.hh>
7 #include <Geant4/G4LogicalVolume.hh>
8 #include <Geant4/G4Material.hh>
9 #include <Geant4/G4PVDivision.hh>
10 #include <Geant4/G4PVPlacement.hh>
11 #include <Geant4/G4RotationMatrix.hh>
12 #include <Geant4/G4SystemOfUnits.hh>
13 #include <Geant4/G4ThreeVector.hh>
14 #include <Geant4/G4Tubs.hh>
15 #include <Geant4/G4VPhysicalVolume.hh>
16 #include <Geant4/G4VisAttributes.hh>
28 , m_Params(parameters)
30 , fPhysicsRadiator(nullptr)
31 , TRD_det_Phys(nullptr)
32 , MPGD_win_Phys(nullptr)
33 , Cathode_Phys(nullptr)
35 , GEM_top_Phys(nullptr)
36 , GEM_diel_Phys(nullptr)
37 , GEM_bottom_Phys(nullptr)
38 , MMG_mesh_Phys(nullptr)
39 , Res_lay_Phys(nullptr)
40 , MMG_strips_Phys(nullptr)
42 , m_Active(m_Params->get_int_param(
"active"))
43 , m_AbsorberActive(m_Params->get_int_param(
"absorberactive"))
82 cout <<
"Mother CENTER Pos ( z ) :"
83 <<
" " << PosZ <<
" Mother length " << ThicknessZ << endl;
85 G4Tubs *Solid =
new G4Tubs(
"TRD_GVol_Solid", RIn, ROut, ThicknessZ / 2., 0., 360 * deg);
86 G4LogicalVolume *Logic =
new G4LogicalVolume(Solid, TRDMaterial,
"TRD_GVol_Logic", 0, 0, 0);
87 G4VisAttributes *attr_TRD_GVol =
new G4VisAttributes(G4Color(0.3, 0.5, 0.9, 0.9));
89 attr_TRD_GVol->SetForceSolid(
true);
90 Logic->SetVisAttributes(attr_TRD_GVol);
91 Phys =
new G4PVPlacement(0, G4ThreeVector(0, 0, PosZ), Logic,
"H_CAP_TRD_Physics", logicWorld, 0,
false,
OverlapCheck());
97 double fGasGap = 0.0600 *
cm;
98 double fDetGap = 0.001 *
cm;
99 double fRadThickness = 0.0020 *
cm;
101 double fRadThick = 10. *
cm - fGasGap + fDetGap;
107 fRadZ = (-ThicknessZ / 2. + fRadThick / 2.);
109 double foilGasRatio = fRadThickness / (fRadThickness + fGasGap);
119 double a_c = 12.0107 *
g / mole;
120 G4Element *Carbon =
new G4Element(
"Carbon",
"C", 6, a_c);
121 double a_h = 1.01 *
g / mole;
122 G4Element *Hydrogen =
new G4Element(
"Hydrogen",
"H", 1, a_h);
124 double density_ch2 = 0.935 *
g /
cm3;
125 G4Material *CH2 =
new G4Material(
"CH2", density_ch2, 2);
126 CH2->AddElement(Carbon, 1);
127 CH2->AddElement(Hydrogen, 2);
129 double foilDensity = 0.91 *
g /
cm3;
130 double gasDensity = 1.2928 * mg /
cm3;
131 double totDensity = foilDensity * foilGasRatio + gasDensity * (1.0 - foilGasRatio);
132 double fractionFoil = foilDensity * foilGasRatio / totDensity;
133 double fractionGas = gasDensity * (1.0 - foilGasRatio) / totDensity;
135 G4Material *radiatorMat0 =
new G4Material(
"radiatorMat0", totDensity, 2);
136 radiatorMat0->AddMaterial(CH2, fractionFoil);
137 radiatorMat0->AddMaterial(Air, fractionGas);
138 double NewDensity = 0.083 * (
g /
cm3);
139 G4Material *radiatorMat =
new G4Material(
"radiatorMat", NewDensity, 1);
140 radiatorMat->AddMaterial(radiatorMat0, 1.);
145 G4Tubs *fSolidRadiator =
new G4Tubs(
"TRD_Radiator_Solid", det_RIn, det_ROut, 0.5 * fRadThick, 0., 360 * deg);
146 G4LogicalVolume *fLogicRadiator =
new G4LogicalVolume(fSolidRadiator, radiatorMat,
"TRD_Radiator_Logic", 0, 0, 0);
148 G4VisAttributes *TRD_rad_att =
new G4VisAttributes();
149 TRD_rad_att->SetColour(G4Colour::Blue());
150 TRD_rad_att->SetVisibility(
true);
151 TRD_rad_att->SetForceSolid(
true);
152 fLogicRadiator->SetVisAttributes(TRD_rad_att);
154 fPhysicsRadiator =
new G4PVPlacement(0, G4ThreeVector(0, 0, fRadZ), fLogicRadiator,
"TRD_Radiator_Phys", Logic, 0,
false,
OverlapCheck());
164 double window_th = 0.002 *
cm;
167 double window_pos_Z = fRadZ + fRadThick / 2. + window_th / 2.;
170 G4Tubs *MPGD_win_Solid =
new G4Tubs(
"MPGD_win_Solid", det_RIn, det_ROut, window_th / 2., 0., 360 * deg);
172 G4LogicalVolume *MPGD_win_Logic =
new G4LogicalVolume(MPGD_win_Solid, window_Material,
"MPGD_win_Logic", 0, 0, 0);
173 G4VisAttributes *MPGD_win_att =
new G4VisAttributes();
174 MPGD_win_att->SetColour(G4Colour::Gray());
175 MPGD_win_att->SetVisibility(
true);
176 MPGD_win_att->SetForceSolid(
true);
177 MPGD_win_Logic->SetVisAttributes(MPGD_win_att);
179 MPGD_win_Phys =
new G4PVPlacement(0, G4ThreeVector(0, 0, window_pos_Z), MPGD_win_Logic,
"MPGD_win_Phys", Logic, 0,
false,
OverlapCheck());
181 double det_ThicknessZ = 2.5 *
cm;
183 double det_Pos_Z = window_pos_Z + window_th / 2. + det_ThicknessZ / 2.;
187 G4Tubs *TRD_det_Solid =
new G4Tubs(
"TRD_det_Solid", det_RIn, det_ROut, det_ThicknessZ / 2., 0., 360 * deg);
189 G4LogicalVolume *TRD_det_Logic =
new G4LogicalVolume(TRD_det_Solid, det_Material,
"TRD_det_Logic", 0, 0, 0);
190 G4VisAttributes *TRD_det_att =
new G4VisAttributes();
191 TRD_det_att->SetColour(G4Colour::Red());
192 TRD_det_att->SetVisibility(
true);
193 TRD_det_att->SetForceSolid(
true);
194 TRD_det_Logic->SetVisAttributes(TRD_det_att);
196 TRD_det_Phys =
new G4PVPlacement(0, G4ThreeVector(0, 0, det_Pos_Z), TRD_det_Logic,
"TRD_det_Phys", Logic, 0,
false,
OverlapCheck());
198 cout <<
" det RIN :" << det_RIn <<
" det ROUT :" << det_ROut << endl;
204 double cat_th = 0.005 *
cm;
205 double dead_ar = 0.01 *
cm;
207 G4Material *myCatMesh =
new G4Material(
"myCatMesh", 0.9 *
g /
cm3, G4_Al, kStateSolid);
209 G4Tubs *Cathode =
new G4Tubs(
"Cathode", det_RIn, det_ROut, cat_th / 2., 0., 360 * deg);
210 G4LogicalVolume *Cathode_Logic =
new G4LogicalVolume(Cathode, myCatMesh,
" Cathode_Logic", 0, 0, 0);
211 G4VisAttributes *Cathode_att =
new G4VisAttributes();
212 Cathode_att->SetColour(G4Colour::Magenta());
213 Cathode_att->SetVisibility(
true);
214 Cathode_att->SetForceSolid(
true);
215 Cathode_Logic->SetVisAttributes(Cathode_att);
216 double cat_pos = -1.0 * det_ThicknessZ / 2. + dead_ar + cat_th / 2.;
218 Cathode_Phys =
new G4PVPlacement(0, G4ThreeVector(0, 0, cat_pos), Cathode_Logic,
"Cathode_Phys", TRD_det_Logic, 0,
false,
OverlapCheck());
221 double gas_thick = 2.0 *
cm;
223 G4Tubs *drift_gas =
new G4Tubs(
"drift_gas", det_RIn, det_ROut, gas_thick / 2., 0., 360 * deg);
224 G4LogicalVolume *gas_Logic =
new G4LogicalVolume(drift_gas, gas_act,
"gas_Logic", 0, 0, 0);
225 G4VisAttributes *gas_att =
new G4VisAttributes();
226 gas_att->SetColour(G4Colour::Green());
227 gas_att->SetVisibility(
true);
228 gas_att->SetForceSolid(
true);
229 gas_Logic->SetVisAttributes(gas_att);
230 double gas_pos = cat_pos + cat_th / 2. + gas_thick / 2.;
232 Gas_Active =
new G4PVPlacement(0, G4ThreeVector(0, 0, gas_pos), gas_Logic,
"Gas_Active", TRD_det_Logic, 0,
false,
OverlapCheck());
236 double cu_th = 0.0005 *
cm;
238 double tr_gap = 0.2 *
cm;
239 double kap_th = 0.005 *
cm;
244 double av_gap = 0.014 *
cm;
245 double mesh_th = 0.0012 *
cm;
255 G4Material *myMMMesh =
new G4Material(
"myMMMesh", 2.8548 *
g /
cm3, 5, kStateSolid);
256 myMMMesh->AddMaterial(G4_Cr, 0.1900);
257 myMMMesh->AddMaterial(G4_Fe, 0.6800);
258 myMMMesh->AddMaterial(G4_Mn, 0.0200);
259 myMMMesh->AddMaterial(G4_Ni, 0.1000);
260 myMMMesh->AddMaterial(G4_Si, 0.0100);
263 double res_th = 0.0020 *
cm;
264 double pcb_th = 0.01 *
cm;
265 double cu_st_th = 0.0012 *
cm;
268 G4Material *Reslay =
new G4Material(
"Reslay", 0.77906 *
g /
cm3, G4_C, kStateSolid);
271 G4Material *MMstrips =
new G4Material(
"MMstrips", 5.28414 *
g /
cm3, G4_Cu, kStateSolid);
273 G4Material *myFR4 =
new G4Material(
"myFR4", 1.860 *
g /
cm3, 4, kStateSolid);
274 myFR4->AddMaterial(G4_C, 0.43550);
275 myFR4->AddMaterial(G4_H, 0.03650);
276 myFR4->AddMaterial(G4_O, 0.28120);
277 myFR4->AddMaterial(G4_Si, 0.24680);
279 G4Tubs *GEM_top_Solid =
new G4Tubs(
"GEM_top_Solid", det_RIn, det_ROut, cu_th / 2., 0., 360 * deg);
280 G4LogicalVolume *GEM_top_Logic =
new G4LogicalVolume(GEM_top_Solid, gem_cond,
"GEM_top_Logic", 0, 0, 0);
281 G4VisAttributes *GEM_top_att =
new G4VisAttributes();
282 GEM_top_att->SetColour(G4Colour::Yellow());
283 GEM_top_att->SetVisibility(
true);
284 GEM_top_att->SetForceSolid(
true);
285 GEM_top_Logic->SetVisAttributes(GEM_top_att);
288 double gem_top_z = gas_pos + gas_thick / 2. + cu_th / 2;
289 GEM_top_Phys =
new G4PVPlacement(0, G4ThreeVector(0, 0, gem_top_z), GEM_top_Logic,
"GEM_top_Phys", TRD_det_Logic, 0,
false,
OverlapCheck());
291 G4Tubs *GEM_diel_Solid =
new G4Tubs(
"GEM_diel_Solid", det_RIn, det_ROut, kap_th / 2., 0., 360 * deg);
292 G4LogicalVolume *GEM_diel_Logic =
new G4LogicalVolume(GEM_diel_Solid, gem_diel,
"GEM_diel_Logic", 0, 0, 0);
293 G4VisAttributes *GEM_diel_att =
new G4VisAttributes();
294 GEM_diel_att->SetColour(G4Colour::Green());
295 GEM_diel_att->SetVisibility(
true);
296 GEM_diel_att->SetForceSolid(
true);
297 GEM_diel_Logic->SetVisAttributes(GEM_diel_att);
299 double diel_z = gem_top_z + cu_th / 2. + kap_th / 2.;
301 GEM_diel_Phys =
new G4PVPlacement(0, G4ThreeVector(0, 0, diel_z), GEM_diel_Logic,
"GEM_diel_Phys", TRD_det_Logic, 0,
false,
OverlapCheck());
303 G4Tubs *GEM_bottom_Solid =
new G4Tubs(
"GEM_bottom_Solid", det_RIn, det_ROut, cu_th / 2., 0., 360 * deg);
304 G4LogicalVolume *GEM_bottom_Logic =
new G4LogicalVolume(GEM_bottom_Solid, gem_cond,
"GEM_bottom_Logic", 0, 0, 0);
305 G4VisAttributes *GEM_bottom_att =
new G4VisAttributes();
306 GEM_bottom_att->SetColour(G4Colour::Yellow());
307 GEM_bottom_att->SetVisibility(
true);
308 GEM_bottom_att->SetForceSolid(
true);
309 GEM_bottom_Logic->SetVisAttributes(GEM_bottom_att);
311 double gem_bot_z = diel_z + kap_th / 2. + cu_th / 2.;
312 GEM_bottom_Phys =
new G4PVPlacement(0, G4ThreeVector(0, 0, gem_bot_z), GEM_bottom_Logic,
"GEM_bottom_Phys", TRD_det_Logic, 0,
false,
OverlapCheck());
314 G4Tubs *MMG_mesh_Solid =
new G4Tubs(
"MMG_mesh_Solid", det_RIn, det_ROut, cu_th / 2., 0., 360 * deg);
315 G4LogicalVolume *MMG_mesh_Logic =
new G4LogicalVolume(MMG_mesh_Solid, myMMMesh,
"MMG_mesh_Logic", 0, 0, 0);
316 G4VisAttributes *MMG_mesh_att =
new G4VisAttributes();
317 MMG_mesh_att->SetColour(G4Colour::Brown());
318 MMG_mesh_att->SetVisibility(
true);
319 MMG_mesh_att->SetForceSolid(
true);
320 MMG_mesh_Logic->SetVisAttributes(MMG_mesh_att);
322 double mmg_mesh_z = gem_bot_z + cu_th / 2. + tr_gap + mesh_th / 2.;
323 MMG_mesh_Phys =
new G4PVPlacement(0, G4ThreeVector(0, 0, mmg_mesh_z), MMG_mesh_Logic,
"MMG_mesh_Phys", TRD_det_Logic, 0,
false,
OverlapCheck());
325 G4Tubs *Res_lay_Solid =
new G4Tubs(
"Res_lay_Solid", det_RIn, det_ROut, res_th / 2., 0., 360 * deg);
326 G4LogicalVolume *Res_lay_Logic =
new G4LogicalVolume(Res_lay_Solid, Reslay,
"Res_lay_Logic", 0, 0, 0);
327 G4VisAttributes *Res_lay_att =
new G4VisAttributes();
328 Res_lay_att->SetColour(G4Colour::Brown());
329 Res_lay_att->SetVisibility(
true);
330 Res_lay_att->SetForceSolid(
true);
331 Res_lay_Logic->SetVisAttributes(Res_lay_att);
333 double res_lay_z = mmg_mesh_z + mesh_th / 2. + av_gap + res_th / 2.;
334 Res_lay_Phys =
new G4PVPlacement(0, G4ThreeVector(0, 0, res_lay_z), Res_lay_Logic,
"Res_lay_Phys", TRD_det_Logic, 0,
false,
OverlapCheck());
336 G4Tubs *MMG_strips_Solid =
new G4Tubs(
"MMG_strips_Solid", det_RIn, det_ROut, cu_st_th / 2., 0., 360. * deg);
337 G4LogicalVolume *MMG_strips_Logic =
new G4LogicalVolume(MMG_strips_Solid, MMstrips,
"MMG_strips_Logic", 0, 0, 0);
338 G4VisAttributes *MMG_strips_att =
new G4VisAttributes();
339 MMG_strips_att->SetColour(G4Colour::Yellow());
340 MMG_strips_att->SetVisibility(
true);
341 MMG_strips_att->SetForceSolid(
true);
342 MMG_strips_Logic->SetVisAttributes(MMG_strips_att);
344 double mmg_str_z = res_lay_z + res_th / 2. + cu_st_th / 2.;
345 MMG_strips_Phys =
new G4PVPlacement(0, G4ThreeVector(0, 0, mmg_str_z), MMG_strips_Logic,
"MMG_strips_Phys", TRD_det_Logic, 0,
false,
OverlapCheck());
347 G4Tubs *PCB_Solid =
new G4Tubs(
"PCB_Solid", det_RIn, det_ROut, pcb_th / 2., 0., 360. * deg);
348 G4LogicalVolume *PCB_Logic =
new G4LogicalVolume(PCB_Solid, myFR4,
"PCB_Logic", 0, 0, 0);
349 G4VisAttributes *PCB_att =
new G4VisAttributes();
350 PCB_att->SetColour(G4Colour::Green());
351 PCB_att->SetVisibility(
true);
352 PCB_att->SetForceSolid(
true);
353 PCB_Logic->SetVisAttributes(PCB_att);
355 double pcb_z = mmg_str_z + cu_st_th / 2. + pcb_th / 2.;
356 PCB_Phys =
new G4PVPlacement(0, G4ThreeVector(0, 0, pcb_z), PCB_Logic,
"PCB_Phys", TRD_det_Logic, 0,
false,
OverlapCheck());