CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
BesCgemConstruction.cc
Go to the documentation of this file.
1//-------------------------------------------------------------------------------------//
2// BOOST --- BESIII Object_Oriented Simulation Tool //
3//-------------------------------------------------------------------------------------//
4/*
5 * =====================================================================================
6 *
7 * Filename: BesCgemConstruction.hh
8 * Description:
9 * Conventions:
10 * gv_ : global variable
11 * lv_ : local variable used in function
12 * lvd_ : local variable double
13 * m_* : normal member of class
14 * sm_* : static member of class
15 * m_M_* : class data member, material of each layer
16 * m_N_* : class data member, number of layers (CgemLayer,GemFoil)
17 * m_R_* : class data member, radius of each (material) layer, and so on
18 * m_L_* : class data member, length of each layer or hole pitch
19 * m_T_* : class data member, thickness of each (material) layer
20 * m_A_* : class data member, angle of anode VStrip
21 * Version: CgemSim-01-00-00
22 * Created: 12/16/2013 08:59:21 AM
23 * Revision: CgemSim-00-00-01(in CMT version CgemBoss-0.0.1 written by xiuql)
24 * Compiler: gcc
25 * Author: [email protected]
26 * Organization: DG1,EPC,IHEP
27 * History:
28 * <Num> <Author> <Time> <Version> <remark>
29 * 0 juxd 20131216 00-01-00 created,
30 *
31 * =====================================================================================
32 */
33
34//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35/* Header file: BOSS */
36#include "BesCgemConstruction.hh"
37#include "BesCgemSD.hh"
38#include "ReadBoostRoot.hh"
39#include "BesCgemSliceParametrization.hh"
40
41/* Header file: Geant4 */
42#include "globals.hh"
43#include "G4NistManager.hh"
44#include "G4UnitsTable.hh"
45#include "G4Box.hh"
46#include "G4Tubs.hh"
47#include "G4Cons.hh"
48#include "G4UnionSolid.hh"
49#include "G4LogicalVolume.hh"
50#include "G4PVPlacement.hh"
51#include "G4PVReplica.hh"
52#include "G4SDManager.hh"
53#include "G4VisAttributes.hh"
54#include "G4Colour.hh"
55#include "G4FieldManager.hh"
56#include "G4TransportationManager.hh"
57#include "G4PVParameterised.hh"
58
59#include "GaudiKernel/ISvcLocator.h"
60#include "GaudiKernel/Bootstrap.h"
61
62/* Header file: C++ */
63#include <iostream>
64#include <iomanip>
65#include <string>
66#include <vector>
67#include <cmath>
68
69using namespace std;
70
71//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 : m_CheckOverlaps(true), m_CreateHole(false)
74{
75 IMessageSvc* msgSvc;
76 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
77 MsgStream log(msgSvc, "BesCgemConstruction::BesCgemConstruction(): initialization of the geometry service");
78
79 ISvcLocator* svcLocator = Gaudi::svcLocator();
80 ICgemGeomSvc* ISvc;
81 StatusCode sc=svcLocator->service("CgemGeomSvc", ISvc);
82
83 m_cgem_geomsvc=dynamic_cast<CgemGeomSvc *>(ISvc);
84 if (!sc.isSuccess()) log<< MSG::INFO << "BesCgemConsruction::BesCgemConstruction(): could not open geometry file" << endreq;
85
86
87}
88
89//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91{
92}
93
94//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
95void BesCgemConstruction::Construct(G4LogicalVolume* logicBes)
96{
97 IMessageSvc* msgSvc;
98 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
99 MsgStream log(msgSvc, "BesCgemConstruction::Construct()");
100
101 // ---------------------- CHECK
102 G4LogicalVolume *logicContainer = NULL; cout << "logicBes daughters " << logicBes->GetNoDaughters() << endl;
103
104 for(int i=0; i<logicBes->GetNoDaughters(); i++) {
105 G4VPhysicalVolume *daughter = logicBes->GetDaughter(i);
106 if(daughter->GetName()=="physicalMdc") {
107 logicContainer = daughter->GetLogicalVolume();
108 }
109 }
110 if(logicContainer == NULL) {
111 log<< MSG::INFO << "BesCgemConstruction::Construct, CGEM must stay inside MDC mother volume, you must build MDC!" << endreq;
112 cout<< "BesCgemConstruction::Construct, MDC not built --> put CGEM in WORLD" << endl;
113 logicContainer= logicBes;
114 }
115 else cout<< "BesCgemConstruction::Construct, MDC built --> put CGEM in MDC container logical volume" << endl;
116 // -------------------------
117
118
119
120 /* Construct Sensitive detectors */
121 G4SDManager* gv_SDman = G4SDManager::GetSDMpointer();
122 G4String lvs_cgemSDname = "BesCgemSD";
123 //G4String lvs_CuSDname = "CuSD";
124 m_CgemSD = new BesCgemSD(lvs_cgemSDname);
125 //m_CuSD = new BesCgemSD(lvs_CuSDname);
126 gv_SDman->AddNewDetector(m_CgemSD);
127 //gv_SDman->AddNewDetector(m_CuSD);
128
129 /* When tuning, no construct CGEM */
131 {
132 log<< MSG::INFO << "BesCgemConstruction::Construct, Tunning! DO NOT CONSTRUCT CGEM!" << endreq;
133 return ;
134 }
135
136 /* Construct CGEM from GDML */
137 if (ReadBoostRoot::GetCgem()==2)
138 {
139 log<< MSG::INFO << "BesCgemConstruciton::Construct, Construct CGEM from GDML!" << endreq;
140 }
141 /* Construct CGEM from G4code */
142 else
143 {
144 log<< MSG::INFO << "BesCgemConstruction::Construct, Construct CGEM from G4code!" << endreq;
145 ConstructMaterial();
146 G4LogicalVolume *logicCgem = ConstructFromCode(logicContainer,m_CgemSD);
147 //if(m_cgem_geomsvc->isPassive() == true && ReadBoostRoot::GetCgem()!=3) ConstructPassiveElements(logicCgem);
148 if(ReadBoostRoot::GetCgem()!=3) ConstructPassiveElements(logicCgem);
149 }
150}
151
152//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
153G4LogicalVolume* BesCgemConstruction::ConstructFromCode(G4LogicalVolume* logicMother, BesCgemSD* m_CgemSD)
154{
155 IMessageSvc* msgSvc;
156 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
157 MsgStream log(msgSvc, "BesCgemConstruction::ConstructFromCode()");
158 log<< MSG::INFO << "===========================================" << endreq;
159 log<< MSG::INFO << "BesCgemConstruction::ConstructFromCode(), Begin to construct CGEM!" << endreq;
160
161 /* Visualization attributes */
162 G4VisAttributes *lv_black = new G4VisAttributes(G4Colour::Black());
163 G4VisAttributes *lv_white = new G4VisAttributes(G4Colour::White());
164 G4VisAttributes *lv_green = new G4VisAttributes(G4Colour::Green());
165 G4VisAttributes *lv_yellow = new G4VisAttributes(G4Colour::Yellow());
166 G4VisAttributes *lv_blue = new G4VisAttributes(G4Colour::Blue());
167 G4VisAttributes *lv_red = new G4VisAttributes(G4Colour::Red());
168 G4VisAttributes *lv_cyan = new G4VisAttributes(G4Colour::Cyan());
169 G4VisAttributes *lv_magenta = new G4VisAttributes(G4Colour::Magenta());
170
171 /* Construct CGEM Geometry */
172 /* World *****(the total Cgem Detector)***** */
173 G4RotationMatrix *lv_rotation = 0; /* Rotation with respect to mother volume */
174 G4ThreeVector lv_3vector(0., 0., 0.); /* Translation with respect to mother */
175 G4bool lv_boolen = false; /* No boolen opertation */
176 G4int lv_copyNo = 0; /* Integer which identifies this placement */
177
178 G4double lvd_R_i = m_cgem_geomsvc->getInnerROfCgem()*mm; /* Inner radius of Cgem detector */
179 G4double lvd_R_o = m_cgem_geomsvc->getOuterROfCgem()*mm; /* Outer radius of Cgem detector */
180 G4double lvd_L_z = m_cgem_geomsvc->getLengthOfCgem()*mm; /* Z length of Cgem detector */
181
182 G4double lvd_A_s = 0*deg; /* Start phi angle in radius of layer */
183 G4double lvd_A_d = 360*deg; /* Delta, spanning segment phi angle in radius of layer */
184
185 G4bool lv_use_x_strip_description = m_cgem_geomsvc->isXStripDescriptionOn();
186 G4bool lv_use_v_strip_description = m_cgem_geomsvc->isVStripDescriptionOn();
187
188 G4Tubs *lv_Cgem_solid =
189 new G4Tubs("Cgem_solid", lvd_R_i, lvd_R_o, 0.5*lvd_L_z, lvd_A_s, lvd_A_d);
190 G4LogicalVolume* lv_Cgem_logic =
191 new G4LogicalVolume(lv_Cgem_solid, m_M_Air, "Cgem_logic");
192 G4VPhysicalVolume *lv_Cgem_physi =
193 new G4PVPlacement(lv_rotation, lv_3vector, lv_Cgem_logic, "Cgem_physi",
194 logicMother, lv_boolen, lv_copyNo, m_CheckOverlaps);
195
196 // CHECK delete this printouts
197 G4cout << "CGEM container" << G4endl;
198 G4cout << "CGEM, Rin =" << ((G4Tubs*) (lv_Cgem_physi->GetLogicalVolume()->GetSolid()))->GetInnerRadius() << G4endl;
199 G4cout << "CGEM, Rout =" << ((G4Tubs*) (lv_Cgem_physi->GetLogicalVolume()->GetSolid()))->GetOuterRadius() << G4endl;
200 G4cout << "CGEM, length =" << ((G4Tubs*) (lv_Cgem_physi->GetLogicalVolume()->GetSolid()))->GetDz() * 2 << G4endl;
201
202 lv_Cgem_logic->SetVisAttributes(lv_black);
203
204 /* CgemLayer */
205 G4int lvi_N_CgemLayer = m_cgem_geomsvc->getNumberOfCgemLayer();/* Number of CgemLayer */
206 G4int lvi_N_GemFoil = m_cgem_geomsvc->getNumberOfCgemFoil(); /* Number of GemFoil */
207 stringstream sssolid,sslogic,ssphysi;
208 string ssolid,slogic,sphysi;
209 CgemGeoLayer *lv_CgemLayer = NULL;
210 for (G4int i=0; i < lvi_N_CgemLayer; i++)
211 {
212 log<< MSG::INFO << "BesCgemConstruciton::ConstructFromCode(), Construct CgemLayer " << i << endreq;
213
214 /* CgemLayer with copyNo i*/
215 sssolid.str("");
216 sssolid << "CgemLayer_solid";
217 sssolid << i;
218 ssolid = sssolid.str();
219 sslogic.str("");
220 sslogic << "CgemLayer_logic";
221 sslogic << i;
222 slogic = sslogic.str();
223 ssphysi.str("");
224 ssphysi << "CgemLayer_physi";
225 ssphysi << i;
226 sphysi = ssphysi.str();
227 lv_CgemLayer = m_cgem_geomsvc->getCgemLayer(i);
228 lvd_R_i = lv_CgemLayer->getInnerROfCgemLayer()*mm;
229 lvd_R_o = lv_CgemLayer->getOuterROfCgemLayer()*mm;
230 lvd_L_z = lv_CgemLayer->getLengthOfCgemLayer()*mm;
231
232 G4Tubs *lv_CgemLayer_solid =
233 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
234 G4LogicalVolume *lv_CgemLayer_logic =
235 new G4LogicalVolume(lv_CgemLayer_solid, m_M_Air, slogic);
236 G4VPhysicalVolume *lv_CgemLayer_physi =
237 new G4PVPlacement(lv_rotation, lv_3vector, lv_CgemLayer_logic, sphysi,
238 lv_Cgem_logic, lv_boolen, i, m_CheckOverlaps); /* Set CgemLayer copyNo i */
239
240 //G4cout << "lvd_R_i =" << lvd_R_i << G4endl;
241 //G4cout << "lvd_R_o =" << lvd_R_o << G4endl;
242 //G4cout << "lvd_L_z =" << lvd_L_z << G4endl;
243
244 log<< MSG::INFO << "BesCgemConstruciton::ConstructFromCode(), Construct CgemLayer " << i << " Cathode "<< endreq;
245
246 /* Construct solids */
247 /* Cathode */
248 sssolid.str("");
249 sssolid << "Cathode_solid";
250 sssolid << i;
251 ssolid = sssolid.str();
252 sslogic.str("");
253 sslogic << "Cathode_logic";
254 sslogic << i;
255 slogic = sslogic.str();
256 ssphysi.str("");
257 ssphysi << "Cathode_physi";
258 ssphysi << i;
259 sphysi = ssphysi.str();
260 lvd_R_i = lv_CgemLayer->getInnerROfCathode()*mm;
261 lvd_R_o = lv_CgemLayer->getOuterROfCathode()*mm;
262 G4Tubs *lv_Cathode_solid =
263 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
264 G4LogicalVolume *lv_Cathode_logic =
265 new G4LogicalVolume(lv_Cathode_solid, m_M_CgemGas, slogic);
266 G4VPhysicalVolume *lv_Cathode_physi =
267 new G4PVPlacement(lv_rotation, lv_3vector, lv_Cathode_logic, sphysi,
268 lv_CgemLayer_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
269 cout << "CATHODE " << lvd_R_i << " " << lvd_R_o << " " << lvd_L_z << endl;
270 /* Cathode_Kapton1 */
271 sssolid.str("");
272 sssolid << "Cathode_Kapton1_solid";
273 sssolid << i;
274 ssolid = sssolid.str();
275 sslogic.str("");
276 sslogic << "Cathode_Kapton1_logic";
277 sslogic << i;
278 slogic = sslogic.str();
279 ssphysi.str("");
280 ssphysi << "Cathode_Kapton1_physi";
281 ssphysi << i;
282 sphysi = ssphysi.str();
283 lvd_R_i = lv_CgemLayer->getInnerROfCathodeKapton1()*mm;
284 lvd_R_o = lv_CgemLayer->getOuterROfCathodeKapton1()*mm;
285 G4Tubs *lv_Cathode_Kapton1_solid =
286 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
287 G4LogicalVolume *lv_Cathode_Kapton1_logic =
288 new G4LogicalVolume(lv_Cathode_Kapton1_solid, m_M_Kapton, slogic);
289 G4VPhysicalVolume *lv_Cathode_Kapton1_physi =
290 new G4PVPlacement(lv_rotation, lv_3vector, lv_Cathode_Kapton1_logic,
291 sphysi, lv_Cathode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
292
293 /* Cathode_Epoxy1 */
294 sssolid.str("");
295 sssolid << "athode_Epoxy1_solid";
296 sssolid << i;
297 ssolid = sssolid.str();
298 sslogic.str("");
299 sslogic << "Cathode_Epoxy1_logic";
300 sslogic << i;
301 slogic = sslogic.str();
302 ssphysi.str("");
303 ssphysi << "Cathode_Epoxy1_physi";
304 ssphysi << i;
305 sphysi = ssphysi.str();
306 lvd_R_i = lv_CgemLayer->getInnerROfCathodeEpoxy1()*mm;
307 lvd_R_o = lv_CgemLayer->getOuterROfCathodeEpoxy1()*mm;
308 G4Tubs *lv_Cathode_Epoxy1_solid =
309 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
310 G4LogicalVolume *lv_Cathode_Epoxy1_logic =
311 new G4LogicalVolume(lv_Cathode_Epoxy1_solid, m_M_Epoxy, slogic);
312 G4VPhysicalVolume *lv_Cathode_Epoxy1_physi =
313 new G4PVPlacement(lv_rotation, lv_3vector, lv_Cathode_Epoxy1_logic,
314 sphysi,lv_Cathode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
315
316 /* Cathode_Rohacell1 */
317 sssolid.str("");
318 sssolid << "Cathode_Rohacell1_solid";
319 sssolid << i;
320 ssolid = sssolid.str();
321 sslogic.str("");
322 sslogic << "Cathode_Rohacell1_logic";
323 sslogic << i;
324 slogic = sslogic.str();
325 ssphysi.str("");
326 ssphysi << "Cathode_Rohacell1_physi";
327 ssphysi << i;
328 sphysi = ssphysi.str();
329 lvd_R_i = lv_CgemLayer->getInnerROfCathodeRohacell1()*mm;
330 lvd_R_o = lv_CgemLayer->getOuterROfCathodeRohacell1()*mm;
331 G4Tubs *lv_Cathode_Rohacell1_solid =
332 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
333 G4LogicalVolume *lv_Cathode_Rohacell1_logic =
334 new G4LogicalVolume(lv_Cathode_Rohacell1_solid, m_M_Rohacell, slogic);
335 G4VPhysicalVolume *lv_Cathode_Rohacell1_physi =
336 new G4PVPlacement(lv_rotation, lv_3vector, lv_Cathode_Rohacell1_logic,
337 sphysi, lv_Cathode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
338
339 /* Cathode_Epoxy2 */
340 sssolid.str("");
341 sssolid << "Cathode_Epoxy2_solid";
342 sssolid << i;
343 ssolid = sssolid.str();
344 sslogic.str("");
345 sslogic << "Cathode_Epoxy2_logic";
346 sslogic << i;
347 slogic = sslogic.str();
348 ssphysi.str("");
349 ssphysi << "Cathode_Epoxy2_physi";
350 ssphysi << i;
351 sphysi = ssphysi.str();
352 lvd_R_i = lv_CgemLayer->getInnerROfCathodeEpoxy2()*mm;
353 lvd_R_o = lv_CgemLayer->getOuterROfCathodeEpoxy2()*mm;
354 G4Tubs *lv_Cathode_Epoxy2_solid =
355 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
356 G4LogicalVolume *lv_Cathode_Epoxy2_logic =
357 new G4LogicalVolume(lv_Cathode_Epoxy2_solid, m_M_Epoxy, slogic);
358 G4VPhysicalVolume *lv_Cathode_Epoxy2_physi =
359 new G4PVPlacement(lv_rotation, lv_3vector, lv_Cathode_Epoxy2_logic,
360 sphysi, lv_Cathode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
361
362 /* Cathode_Kapton2 */
363 sssolid.str("");
364 sssolid << "Cathode_Kapton2_solid";
365 sssolid << i;
366 ssolid = sssolid.str();
367 sslogic.str("");
368 sslogic << "Cathode_Kapton2_logic";
369 sslogic << i;
370 slogic = sslogic.str();
371 ssphysi.str("");
372 ssphysi << "Cathode_Kapton2_physi";
373 ssphysi << i;
374 sphysi = ssphysi.str();
375 lvd_R_i = lv_CgemLayer->getInnerROfCathodeKapton2()*mm;
376 lvd_R_o = lv_CgemLayer->getOuterROfCathodeKapton2()*mm;
377 G4Tubs *lv_Cathode_Kapton2_solid =
378 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
379 G4LogicalVolume *lv_Cathode_Kapton2_logic =
380 new G4LogicalVolume(lv_Cathode_Kapton2_solid, m_M_Kapton, slogic);
381 G4VPhysicalVolume *lv_Cathode_Kapton2_physi =
382 new G4PVPlacement(lv_rotation, lv_3vector, lv_Cathode_Kapton2_logic,
383 sphysi, lv_Cathode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
384
385 /* Cathode_Epoxy3 */
386 sssolid.str("");
387 sssolid << "Cathode_Epoxy3_solid";
388 sssolid << i;
389 ssolid = sssolid.str();
390 sslogic.str("");
391 sslogic << "Cathode_Epoxy3_logic";
392 sslogic << i;
393 slogic = sslogic.str();
394 ssphysi.str("");
395 ssphysi << "Cathode_Epoxy3_physi";
396 ssphysi << i;
397 sphysi = ssphysi.str();
398 lvd_R_i = lv_CgemLayer->getInnerROfCathodeEpoxy3()*mm;
399 lvd_R_o = lv_CgemLayer->getOuterROfCathodeEpoxy3()*mm;
400 G4Tubs *lv_Cathode_Epoxy3_solid =
401 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
402 G4LogicalVolume *lv_Cathode_Epoxy3_logic =
403 new G4LogicalVolume(lv_Cathode_Epoxy3_solid, m_M_Epoxy, slogic);
404 G4VPhysicalVolume *lv_Cathode_Epoxy3_physi =
405 new G4PVPlacement(lv_rotation, lv_3vector, lv_Cathode_Epoxy3_logic,
406 sphysi,lv_Cathode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
407
408 /* Cathode_Rohacell2 */
409 sssolid.str("");
410 sssolid << "Cathode_Rohacell2_solid";
411 sssolid << i;
412 ssolid = sssolid.str();
413 sslogic.str("");
414 sslogic << "Cathode_Rohacell2_logic";
415 sslogic << i;
416 slogic = sslogic.str();
417 ssphysi.str("");
418 ssphysi << "Cathode_Rohacell2_physi";
419 ssphysi << i;
420 sphysi = ssphysi.str();
421 lvd_R_i = lv_CgemLayer->getInnerROfCathodeRohacell2()*mm;
422 lvd_R_o = lv_CgemLayer->getOuterROfCathodeRohacell2()*mm;
423 G4Tubs *lv_Cathode_Rohacell2_solid =
424 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
425 G4LogicalVolume *lv_Cathode_Rohacell2_logic =
426 new G4LogicalVolume(lv_Cathode_Rohacell2_solid, m_M_Rohacell, slogic);
427 G4VPhysicalVolume *lv_Cathode_Rohacell2_physi =
428 new G4PVPlacement(lv_rotation, lv_3vector, lv_Cathode_Rohacell2_logic,
429 sphysi, lv_Cathode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
430
431 /* Cathode_Epoxy4 */
432 sssolid.str("");
433 sssolid << "Cathode_Epoxy4_solid";
434 sssolid << i;
435 ssolid = sssolid.str();
436 sslogic.str("");
437 sslogic << "Cathode_Epoxy4_logic";
438 sslogic << i;
439 slogic = sslogic.str();
440 ssphysi.str("");
441 ssphysi << "Cathode_Epoxy4_physi";
442 ssphysi << i;
443 sphysi = ssphysi.str();
444 lvd_R_i = lv_CgemLayer->getInnerROfCathodeEpoxy4()*mm;
445 lvd_R_o = lv_CgemLayer->getOuterROfCathodeEpoxy4()*mm;
446 G4Tubs *lv_Cathode_Epoxy4_solid =
447 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
448 G4LogicalVolume *lv_Cathode_Epoxy4_logic =
449 new G4LogicalVolume(lv_Cathode_Epoxy4_solid, m_M_Epoxy, slogic);
450 G4VPhysicalVolume *lv_Cathode_Epoxy4_physi =
451 new G4PVPlacement(lv_rotation, lv_3vector, lv_Cathode_Epoxy4_logic,
452 sphysi, lv_Cathode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
453
454 /* Cathode_Kapton3 */
455 sssolid.str("");
456 sssolid << "Cathode_Kapton3_solid";
457 sssolid << i;
458 ssolid = sssolid.str();
459 sslogic.str("");
460 sslogic << "Cathode_Kapton3_logic";
461 sslogic << i;
462 slogic = sslogic.str();
463 ssphysi.str("");
464 ssphysi << "Cathode_Kapton3_physi";
465 ssphysi << i;
466 sphysi = ssphysi.str();
467 lvd_R_i = lv_CgemLayer->getInnerROfCathodeKapton3()*mm;
468 lvd_R_o = lv_CgemLayer->getOuterROfCathodeKapton3()*mm;
469 G4Tubs *lv_Cathode_Kapton3_solid =
470 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
471 G4LogicalVolume *lv_Cathode_Kapton3_logic =
472 new G4LogicalVolume(lv_Cathode_Kapton3_solid, m_M_Kapton, slogic);
473 G4VPhysicalVolume *lv_Cathode_Kapton3_physi =
474 new G4PVPlacement(lv_rotation, lv_3vector, lv_Cathode_Kapton3_logic,
475 sphysi, lv_Cathode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
476
477 /* Cathode_Cu */
478 sssolid.str("");
479 sssolid << "Cathode_Cu_solid";
480 sssolid << i;
481 ssolid = sssolid.str();
482 sslogic.str("");
483 sslogic << "Cathode_Cu_logic";
484 sslogic << i;
485 slogic = sslogic.str();
486 ssphysi.str("");
487 ssphysi << "Cathode_Cu_physi";
488 ssphysi << i;
489 sphysi = ssphysi.str();
490 lvd_R_i = lv_CgemLayer->getInnerROfCathodeCu()*mm;
491 lvd_R_o = lv_CgemLayer->getOuterROfCathodeCu()*mm;
492 G4Tubs *lv_Cathode_Cu_solid =
493 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
494 G4LogicalVolume *lv_Cathode_Cu_logic =
495 new G4LogicalVolume(lv_Cathode_Cu_solid, m_M_Cu, slogic);
496 G4VPhysicalVolume *lv_Cathode_Cu_physi =
497 new G4PVPlacement(lv_rotation, lv_3vector, lv_Cathode_Cu_logic, sphysi,
498 lv_Cathode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
499
500 /* Gap_D */
501
502 log<< MSG::INFO << "BesCgemConstruciton::ConstructFromCode(), Construct CgemLayer " << i << " Gap_D "<< endreq;
503
504 sssolid.str("");
505 sssolid << "Gap_D_solid";
506 sssolid << i;
507 ssolid = sssolid.str();
508 sslogic.str("");
509 sslogic << "Gap_D_logic";
510 sslogic << i;
511 slogic = sslogic.str();
512 ssphysi.str("");
513 ssphysi << "Gap_D_physi";
514 ssphysi << i;
515 sphysi = ssphysi.str();
516 lvd_R_i = lv_CgemLayer->getInnerROfGapD()*mm;
517 lvd_R_o = lv_CgemLayer->getOuterROfGapD()*mm;
518 G4Tubs *lv_Gap_D_solid =
519 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
520 G4LogicalVolume *lv_Gap_D_logic =
521 new G4LogicalVolume(lv_Gap_D_solid, m_M_CgemGas, slogic);
522 G4VPhysicalVolume *lv_Gap_D_physi =
523 new G4PVPlacement(lv_rotation, lv_3vector, lv_Gap_D_logic, sphysi,
524 lv_CgemLayer_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
525
526 lv_Gap_D_logic->SetSensitiveDetector(m_CgemSD); /* Sensitive Detector */
527 G4cout << "R of SD : "<< "lvd_R_i =" << lvd_R_i << " " << "lvd_R_o =" << lvd_R_o << G4endl;
528
529 /* Gap_T1 */
530 sssolid.str("");
531 sssolid << "Gap_T1_solid";
532 sssolid << i;
533 ssolid = sssolid.str();
534 sslogic.str("");
535 sslogic << "Gap_T1_logic";
536 sslogic << i;
537 slogic = sslogic.str();
538 ssphysi.str("");
539 ssphysi << "Gap_T1_physi";
540 ssphysi << i;
541 sphysi = ssphysi.str();
542 lvd_R_i = lv_CgemLayer->getInnerROfGapT1()*mm;
543 lvd_R_o = lv_CgemLayer->getOuterROfGapT1()*mm;
544 G4Tubs *lv_Gap_T1_solid =
545 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
546 G4LogicalVolume *lv_Gap_T1_logic =
547 new G4LogicalVolume(lv_Gap_T1_solid, m_M_CgemGas, slogic);
548 G4VPhysicalVolume *lv_Gap_T1_physi =
549 new G4PVPlacement(lv_rotation, lv_3vector, lv_Gap_T1_logic, sphysi,
550 lv_CgemLayer_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
551
552 /* Gap_T2 */
553 sssolid.str("");
554 sssolid << "Gap_T2_solid";
555 sssolid << i;
556 ssolid = sssolid.str();
557 sslogic.str("");
558 sslogic << "Gap_T2_logic";
559 sslogic << i;
560 slogic = sslogic.str();
561 ssphysi.str("");
562 ssphysi << "Gap_T2_physi";
563 ssphysi << i;
564 sphysi = ssphysi.str();
565 lvd_R_i = lv_CgemLayer->getInnerROfGapT2()*mm;
566 lvd_R_o = lv_CgemLayer->getOuterROfGapT2()*mm;
567 G4Tubs *lv_Gap_T2_solid =
568 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
569 G4LogicalVolume *lv_Gap_T2_logic =
570 new G4LogicalVolume(lv_Gap_T2_solid, m_M_CgemGas, slogic);
571 G4VPhysicalVolume *lv_Gap_T2_physi =
572 new G4PVPlacement(lv_rotation, lv_3vector, lv_Gap_T2_logic, sphysi,
573 lv_CgemLayer_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
574
575 /* Gap_I */
576 sssolid.str("");
577 sssolid << "Gap_I_solid";
578 sssolid << i;
579 ssolid = sssolid.str();
580 sslogic.str("");
581 sslogic << "Gap_I_logic";
582 sslogic << i;
583 slogic = sslogic.str();
584 ssphysi.str("");
585 ssphysi << "Gap_I_physi";
586 ssphysi << i;
587 sphysi = ssphysi.str();
588 lvd_R_i = lv_CgemLayer->getInnerROfGapI()*mm;
589 lvd_R_o = lv_CgemLayer->getOuterROfGapI()*mm;
590 G4Tubs *lv_Gap_I_solid =
591 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
592 G4LogicalVolume *lv_Gap_I_logic =
593 new G4LogicalVolume(lv_Gap_I_solid, m_M_CgemGas, slogic);
594 G4VPhysicalVolume *lv_Gap_I_physi =
595 new G4PVPlacement(lv_rotation, lv_3vector, lv_Gap_I_logic, sphysi,
596 lv_CgemLayer_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
597
598 /* GemFoil */
599 for (G4int j=0; j < lvi_N_GemFoil; j++)
600 {
601 log<< MSG::INFO << "BesCgemConstruciton::ConstructFromCode(), Construct CgemLayer " << i << " GemFoil " << j << endreq;
602
603 /* GemFoil */
604 //CgemGeoFoil &lv_GemFoil = lv_CgemLayer->getCgemFoil(j);
605 //lvd_R_i = lv_GemFoil.GetInnerROfGemFoil()*mm;
606 //lvd_R_o = lv_GemFoil.GetOuterROfGemFoil()*mm;
607 sssolid.str("");
608 sssolid << "GemFoil_solid";
609 sssolid << i;
610 sssolid << "foil";
611 sssolid << j;
612 ssolid = sssolid.str();
613 sslogic.str("");
614 sslogic << "GemFoil_logic";
615 sslogic << i;
616 sslogic << "foil";
617 sslogic << j;
618 slogic = sslogic.str();
619 ssphysi.str("");
620 ssphysi << "GemFoil_physi";
621 ssphysi << i;
622 ssphysi << "foil";
623 ssphysi << j;
624 sphysi = ssphysi.str();
625 lvd_R_i = lv_CgemLayer->getCgemFoil(j)->getInnerROfCgemFoil()*mm;
626 lvd_R_o = lv_CgemLayer->getCgemFoil(j)->getOuterROfCgemFoil()*mm;
627 G4Tubs *lv_GemFoil_solid =
628 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
629 G4LogicalVolume *lv_GemFoil_logic =
630 new G4LogicalVolume(lv_GemFoil_solid, m_M_CgemGas, slogic);
631 G4VPhysicalVolume *lv_GemFoil_physi =
632 new G4PVPlacement(lv_rotation, lv_3vector, lv_GemFoil_logic, sphysi,
633 lv_CgemLayer_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
634 cout << "GEM LAYER " << j << " " << lvd_R_i << " " << lvd_R_o << " " << lvd_L_z << endl;
635 /* Create Hole or NOT */
636 if (!m_CreateHole) /* if : Not create hole */
637 {
638 /* GemFoil_Cu1 */
639 sssolid.str("");
640 sssolid << "GemFoil_Cu1_solid";
641 sssolid << i;
642 sssolid << "foil";
643 sssolid << j;
644 ssolid = sssolid.str();
645 sslogic.str("");
646 sslogic << "GemFoil_Cu1_logic";
647 sslogic << i;
648 sslogic << "foil";
649 sslogic << j;
650 slogic = sslogic.str();
651 ssphysi.str("");
652 ssphysi << "GemFoil_Cu1_physi";
653 ssphysi << i;
654 ssphysi << "foil";
655 ssphysi << j;
656 sphysi = ssphysi.str();
657 lvd_R_i = lv_CgemLayer->getCgemFoil(j)->getInnerROfCgemFoilCu1()*mm;
658 lvd_R_o = lv_CgemLayer->getCgemFoil(j)->getOuterROfCgemFoilCu1()*mm;
659 G4Tubs *lv_GemFoil_Cu1_solid =
660 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
661 G4LogicalVolume *lv_GemFoil_Cu1_logic =
662 new G4LogicalVolume(lv_GemFoil_Cu1_solid, m_M_Cu_GEMFoils, slogic); //m_M_Cu_GEMFoils
663 G4VPhysicalVolume *lv_GemFoil_Cu1_physi =
664 new G4PVPlacement(lv_rotation, lv_3vector, lv_GemFoil_Cu1_logic, sphysi,
665 lv_GemFoil_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
666
667 /* GemFoil_Kapton */
668 sssolid.str("");
669 sssolid << "GemFoil_Kapton_solid";
670 sssolid << i;
671 sssolid << "foil";
672 sssolid << j;
673 ssolid = sssolid.str();
674 sslogic.str("");
675 sslogic << "GemFoil_Kapton_logic";
676 sslogic << i;
677 sslogic << "foil";
678 sslogic << j;
679 slogic = sslogic.str();
680 ssphysi.str("");
681 ssphysi << "GemFoil_Kapton_physi";
682 ssphysi << i;
683 ssphysi << "foil";
684 ssphysi << j;
685 sphysi = ssphysi.str();
686 lvd_R_i = lv_CgemLayer->getCgemFoil(j)->getInnerROfCgemFoilKapton()*mm;
687 lvd_R_o = lv_CgemLayer->getCgemFoil(j)->getOuterROfCgemFoilKapton()*mm;
688 G4Tubs *lv_GemFoil_Kapton_solid =
689 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
690 G4LogicalVolume *lv_GemFoil_Kapton_logic =
691 new G4LogicalVolume(lv_GemFoil_Kapton_solid, m_M_Kapton_GEMFoils, slogic); //m_M_Kapton_GEMFoils
692 G4VPhysicalVolume *lv_GemFoil_Kapton_physi =
693 new G4PVPlacement(lv_rotation, lv_3vector, lv_GemFoil_Kapton_logic,
694 sphysi, lv_GemFoil_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
695
696 /* GemFoil_Cu2 */
697 sssolid.str("");
698 sssolid << "GemFoil_Cu2_solid";
699 sssolid << i;
700 sssolid << "foil";
701 sssolid << j;
702 ssolid = sssolid.str();
703 sslogic.str("");
704 sslogic << "GemFoil_Cu2_logic";
705 sslogic << i;
706 sslogic << "foil";
707 sslogic << j;
708 slogic = sslogic.str();
709 ssphysi.str("");
710 ssphysi << "GemFoil_Cu2_physi";
711 ssphysi << i;
712 ssphysi << "foil";
713 ssphysi << j;
714 sphysi = ssphysi.str();
715 lvd_R_i = lv_CgemLayer->getCgemFoil(j)->getInnerROfCgemFoilCu2()*mm;
716 lvd_R_o = lv_CgemLayer->getCgemFoil(j)->getOuterROfCgemFoilCu2()*mm;
717 G4Tubs *lv_GemFoil_Cu2_solid =
718 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
719 G4LogicalVolume *lv_GemFoil_Cu2_logic =
720 new G4LogicalVolume(lv_GemFoil_Cu2_solid, m_M_Cu_GEMFoils, slogic); //m_M_Cu_GEMFoils
721 G4VPhysicalVolume *lv_GemFoil_Cu2_physi =
722 new G4PVPlacement(lv_rotation, lv_3vector, lv_GemFoil_Cu2_logic, sphysi,
723 lv_GemFoil_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
724 } /* End of 'if (!m_CreateHole)' */
725 else /* else : Create Hole */
726 {
727
728
729
730 } /* End of 'else' */
731
732 lv_GemFoil_logic->SetVisAttributes(lv_magenta);
733
734 Print(lv_GemFoil_logic);
735
736 } /* End of 'for (G4int j=0; j < lvi_N_GemFoil; j++)' */
737
738 /* Anode */
739
740 log<< MSG::INFO << "BesCgemConstruciton::ConstructFromCode(), Construct CgemLayer " << i << " Anode "<< endreq;
741
742 sssolid.str("");
743 sssolid << "Anode_solid";
744 sssolid << i;
745 ssolid = sssolid.str();
746 sslogic.str("");
747 sslogic << "Anode_logic";
748 sslogic << i;
749 slogic = sslogic.str();
750 ssphysi.str("");
751 ssphysi << "Anode_physi";
752 ssphysi << i;
753 sphysi = ssphysi.str();
754 lvd_R_i = lv_CgemLayer->getInnerROfAnode()*mm;
755 lvd_R_o = lv_CgemLayer->getOuterROfAnode()*mm;
756 G4Tubs *lv_Anode_solid =
757 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
758 G4LogicalVolume *lv_Anode_logic =
759 new G4LogicalVolume(lv_Anode_solid, m_M_CgemGas, slogic);
760 G4VPhysicalVolume *lv_Anode_physi =
761 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_logic, sphysi,
762 lv_CgemLayer_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
763
764 /* Anode_Cu1 */
765 sssolid.str("");
766 sssolid << "Anode_Cu1_solid";
767 sssolid << i;
768 ssolid = sssolid.str();
769 sslogic.str("");
770 sslogic << "Anode_Cu1_logic";
771 sslogic << i;
772 slogic = sslogic.str();
773 ssphysi.str("");
774 ssphysi << "Anode_Cu1_physi";
775 ssphysi << i;
776 sphysi = ssphysi.str();
777 lvd_R_i = lv_CgemLayer->getInnerROfAnodeCu1()*mm;
778 lvd_R_o = lv_CgemLayer->getOuterROfAnodeCu1()*mm;
779
780 G4Tubs *lv_Anode_Cu1_solid =
781 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
782
783
784 cout << "ANODE " << lvd_R_i << " " << lvd_R_o << " " << lvd_L_z << endl;
785
786
787 if(lv_use_v_strip_description == false)
788 {
789 // full cylinder of copper
790 G4LogicalVolume *lv_Anode_Cu1_logic =
791 new G4LogicalVolume(lv_Anode_Cu1_solid, m_M_Cu_AnodeStripV, slogic); //m_M_Cu_AnodeStripV
792 G4VPhysicalVolume *lv_Anode_Cu1_physi =
793 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Cu1_logic, sphysi,
794 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
795
796 // lv_Anode_Cu1_logic->SetSensitiveDetector(m_CuSD); /* Sensitive Detector */
797 // lv_Anode_Cu1_logic->SetSensitiveDetector(m_CgemSD); /* Sensitive Detector */
798 }
799 else
800 {
801 // ----------------- STRIP
802 double v_active = lv_CgemLayer->getWidthOfStripV();
803 double v_spacing = lv_CgemLayer->getWidthOfPitchV();
804 double v_airgap = v_spacing - v_active;
805
806 double anode_cu1_mean_radius = 0.5 * (lvd_R_i + lvd_R_o);
807 double anode_full_v = anode_cu1_mean_radius * CLHEP::twopi; // CHECK should it be mean/inner/outer radius?
808 int nof_anode_v = floor(anode_full_v / v_spacing); // CHECK floor or ceil? how many in reality?
809
810 // if(i == 0) nof_replicas = 5015;
811 // else if(i == 1) nof_replicas = 4162;
812 // else if(i == 2) nof_replicas = 5498;
813
814 double tan_stereo = tan(lv_CgemLayer->getAngleOfStereo() * CLHEP::deg);
815 if(tan_stereo < 0) tan_stereo *= -1.;
816 // double b = tan(stereo) * anode_length / nof_replicas;
817 // we want the exceding part to be < 10% of the total
818 int nof_replicas = tan_stereo * lvd_L_z / 0.10;
819 cout << "nof_replicas: " << i + 1 << " " << nof_replicas << endl;
820
821 double replica_length = lvd_L_z / nof_replicas; // CHECK is it full length or half length?
822
823 // phi is in radian
824 double phi_v = (CLHEP::twopi/nof_anode_v) * CLHEP::rad;
825 double tilt = tan(lv_CgemLayer->getAngleOfStereo()) * lvd_L_z/(nof_replicas * anode_cu1_mean_radius); // CHECK if the angle is in rad or degree? and CHECK if the length is full or half
826 if(tilt > CLHEP::pi) tilt = CLHEP::twopi - tilt;
827
828 std::cout << "STRIP in v: pitch " << v_spacing << " active " << v_active << " air gap " << v_airgap << " N " << nof_anode_v << " stereo " << lv_CgemLayer->getAngleOfStereo() << std::endl;
829
830 // full cylinder of gas, as container for the strips
831 G4LogicalVolume *lv_Anode_Cu1_logic =
832 new G4LogicalVolume(lv_Anode_Cu1_solid, m_M_CgemGas, "Anode_Cu1_logic");
833
834 // strips
835 G4VSolid* lv_Anode_V_Strip_solid =
836 new G4Tubs("Anode_V_Strip_solid", lvd_R_i, lvd_R_o, replica_length * 0.5, lvd_A_s, lvd_A_d);
837
838 // full strip of gas
839 G4LogicalVolume *lv_Anode_V_Strip_logic =
840 new G4LogicalVolume(lv_Anode_V_Strip_solid, m_M_CgemGas, "Anode_V_Strip_logic");
841
842
843 // // vis
844 // G4Colour BLU(0., 0., 1.);
845 // G4VisAttributes anode_v_strip_attributes;
846 // anode_v_strip_attributes.SetColor(BLU);
847 // anode_v_strip_attributes.SetForceSolid(true);
848 // lv_Anode_V_Strip_logic->SetVisAttributes(anode_v_strip_attributes);
849
850 // strip active copper area
851 // double v_spacing_phi = (v_spacing / anode_cu1_mean_radius) * CLHEP::radian;
852 double v_active_phi = (v_active / anode_cu1_mean_radius) * CLHEP::radian;
853 // double dphi = v_spacing_phi - v_active_phi;
854 // double start_phi = 0.5 * dphi;
855
856 G4Tubs* lv_Anode_V_Active_solid =
857 new G4Tubs("Anode_V_Active_solid", lvd_R_i, lvd_R_o, replica_length * 0.5,
858 -0.5 * v_active_phi, // CHECK this!
859 v_active_phi); // delta_phi in rad
860
861 G4LogicalVolume *lv_Anode_V_Active_logic =
862 new G4LogicalVolume(lv_Anode_V_Active_solid, m_M_Cu, "Anode_V_Active_logic");
863
864 // vis
865 // G4Colour RED(1., 0., 0.);
866 G4VisAttributes anode_v_active_attributes;
867 // anode_v_active_attributes.SetColor(RED);
868 // anode_v_active_attributes.SetForceSolid(true);
869 anode_v_active_attributes.SetVisibility(false); // CHECK if the visibility of the strips is ON
870 // then the memory consumption rise a lot and
871 // it becomes very sloooow!
872 lv_Anode_V_Active_logic->SetVisAttributes(anode_v_active_attributes);
873
874 // place the active copper inside the full gas strip
875 G4VPhysicalVolume *lv_Anode_V_Active_physi =
876 new G4PVReplica("Anode_V_Active_physi", lv_Anode_V_Active_logic, lv_Anode_V_Strip_logic, kPhi, nof_anode_v, phi_v);
877
879 sliceParam->SetAnodeLength(lvd_L_z);
880 sliceParam->SetSliceLength(replica_length);
881 sliceParam->SetTiltAngle(tilt);
882
883 // place it
884 G4VPhysicalVolume* lv_Anode_V_Strip_physi =
885 new G4PVParameterised("Anode_V_Strip_physi", lv_Anode_V_Strip_logic, lv_Anode_Cu1_logic, kZAxis, nof_replicas, sliceParam);
886
887 G4VPhysicalVolume *lv_Anode_Cu1_physi =
888 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Cu1_logic, "Anode_Cu1_physi",
889 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
890
891 }
892
893
894 /* Anode_Kapton1 */
895 sssolid.str("");
896 sssolid << "Anode_Kapton1_solid";
897 sssolid << i;
898 ssolid = sssolid.str();
899 sslogic.str("");
900 sslogic << "Anode_Kapton1_logic";
901 sslogic << i;
902 slogic = sslogic.str();
903 ssphysi.str("");
904 ssphysi << "Anode_Kapton1_physi";
905 ssphysi << i;
906 sphysi = ssphysi.str();
907 lvd_R_i = lv_CgemLayer->getInnerROfAnodeKapton1()*mm;
908 lvd_R_o = lv_CgemLayer->getOuterROfAnodeKapton1()*mm;
909 G4Tubs *lv_Anode_Kapton1_solid =
910 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
911 G4LogicalVolume *lv_Anode_Kapton1_logic =
912 new G4LogicalVolume(lv_Anode_Kapton1_solid, m_M_Kapton_StripV, slogic); //m_M_Kapton_StripV
913 G4VPhysicalVolume *lv_Anode_Kapton1_physi =
914 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Kapton1_logic, sphysi,
915 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
916
917 /* Anode_Cu2: X strips available */
918 sssolid.str("");
919 sssolid << "Anode_Cu2_solid";
920 sssolid << i;
921 ssolid = sssolid.str();
922 sslogic.str("");
923 sslogic << "Anode_Cu2_logic";
924 sslogic << i;
925 slogic = sslogic.str();
926 ssphysi.str("");
927 ssphysi << "Anode_Cu2_physi";
928 ssphysi << i;
929 sphysi = ssphysi.str();
930 lvd_R_i = lv_CgemLayer->getInnerROfAnodeCu2()*mm;
931 lvd_R_o = lv_CgemLayer->getOuterROfAnodeCu2()*mm;
932
933 G4Tubs *lv_Anode_Cu2_solid =
934 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
935
936 if(lv_use_x_strip_description == false)
937 {
938 // full cylinder of copper
939 G4LogicalVolume *lv_Anode_Cu2_logic =
940 new G4LogicalVolume(lv_Anode_Cu2_solid, m_M_Cu_AnodeStripX, slogic); //m_M_Cu_AnodeStripX
941 G4VPhysicalVolume *lv_Anode_Cu2_physi =
942 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Cu2_logic, sphysi,
943 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
944 }
945 else
946 {
947 // ----------------- STRIP
948 double x_active = lv_CgemLayer->getWidthOfStripX();
949 double x_spacing = lv_CgemLayer->getWidthOfPitchX();
950 double x_airgap = x_spacing - x_active;
951
952 double anode_cu2_mean_radius = 0.5 * (lvd_R_i + lvd_R_o);
953 double anode_full_x = anode_cu2_mean_radius * CLHEP::twopi; // CHECK should it be mean/inner/outer radius?
954 int nof_anode_x = floor(anode_full_x / x_spacing); // CHECK floor or ceil? how many in reality?
955
956 // phi is in radian
957 double phi_x = (CLHEP::twopi/nof_anode_x) * CLHEP::rad;
958
959 std::cout << "STRIP in x: pitch " << x_spacing << " active " << x_active << " air gap " << x_airgap << " N " << nof_anode_x << std::endl;
960
961 // std::cout << "X view - mean_radius " << anode_cu2_mean_radius << " full_x " << anode_full_x << " nof strips " << nof_anode_x << " covered " << nof_anode_x * x_spacing << " phi "<< phi_x/deg << " total phi " << nof_anode_x * phi_x/deg << std::endl;
962
963 // full cylinder of gas, as container of the strips
964 G4LogicalVolume *lv_Anode_Cu2_logic =
965 new G4LogicalVolume(lv_Anode_Cu2_solid, m_M_CgemGas, "lv_Anode_Cu2_logic");
966 G4VPhysicalVolume *lv_Anode_Cu2_physi =
967 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Cu2_logic, "Anode_Cu2_physi",
968 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
969
970 // strips
971 G4VSolid* lv_Anode_X_Strip_solid =
972 new G4Tubs("lv_Anode_X_Strip_solid", lvd_R_i, lvd_R_o, lvd_L_z/2., -0.5 * phi_x, phi_x);
973
974 // full strip of gas
975 G4LogicalVolume *lv_Anode_X_Strip_logic =
976 new G4LogicalVolume(lv_Anode_X_Strip_solid, m_M_CgemGas, "lv_Anode_Cu2_logic");
977
978 // // vis
979 // G4Colour BLU(0., 0., 1.);
980 // G4VisAttributes anode_x_strip_attributes;
981 // anode_x_strip_attributes.SetColor(BLU);
982 // anode_x_strip_attributes.SetForceSolid(true);
983 // lv_Anode_X_Strip_logic->SetVisAttributes(anode_x_strip_attributes);
984
985
986 // active copper area
987 double x_delay_phi = ((0.5 * x_airgap) / anode_cu2_mean_radius) * CLHEP::radian;
988 double x_active_phi = (x_active / anode_cu2_mean_radius) * CLHEP::radian;
989 std::cout << "delay " << x_delay_phi/deg << " " << x_airgap << " " << anode_cu2_mean_radius << std::endl;
990 G4Tubs* lv_Anode_X_Active_solid =
991 new G4Tubs("Anode_X_Active_solid", lvd_R_i, lvd_R_o, lvd_L_z/2., -0.5 * x_active_phi, x_active_phi); // delta_phi in rad
992 G4LogicalVolume *lv_Anode_X_Active_logic =
993 new G4LogicalVolume(lv_Anode_X_Active_solid, m_M_Cu, "Anode_X_Active_logic");
994
995 // // vis
996 // G4Colour RED(1., 0., 0.);
997 // G4VisAttributes anode_x_active_attributes;
998 // anode_x_active_attributes.SetColor(RED);
999 // anode_x_active_attributes.SetForceSolid(true);
1000 // lv_Anode_X_Active_logic->SetVisAttributes(anode_x_active_attributes);
1001
1002
1003 // place the active copper inside the full gas strip
1004 G4VPhysicalVolume *lv_Anode_X_Active_physi =
1005 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_X_Active_logic, "Anode_X_Strip_physi",
1006 lv_Anode_X_Strip_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1007
1008 // divide the full gas cylinder in gas strips
1009 G4VPhysicalVolume *lv_Anode_X_Strip_physi =
1010 new G4PVReplica("Anode_X_Strip_physi", lv_Anode_X_Strip_logic,
1011 lv_Anode_Cu2_logic, kPhi, nof_anode_x, phi_x);
1012
1013 }
1014 // -----------------------
1015
1016 /* Anode_Epoxy1 */
1017 sssolid.str("");
1018 sssolid << "Anode_Epoxy1_solid";
1019 sssolid << i;
1020 ssolid = sssolid.str();
1021 sslogic.str("");
1022 sslogic << "Anode_Epoxy1_logic";
1023 sslogic << i;
1024 slogic = sslogic.str();
1025 ssphysi.str("");
1026 ssphysi << "Anode_Epoxy1_physi";
1027 ssphysi << i;
1028 sphysi = ssphysi.str();
1029 lvd_R_i = lv_CgemLayer->getInnerROfAnodeEpoxy1()*mm;
1030 lvd_R_o = lv_CgemLayer->getOuterROfAnodeEpoxy1()*mm;
1031 G4Tubs *lv_Anode_Epoxy1_solid =
1032 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
1033 G4LogicalVolume *lv_Anode_Epoxy1_logic =
1034 new G4LogicalVolume(lv_Anode_Epoxy1_solid, m_M_Epoxy, slogic);
1035 G4VPhysicalVolume *lv_Anode_Epoxy1_physi =
1036 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Epoxy1_logic, sphysi,
1037 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1038
1039 /* Anode_Kapton2 */
1040 sssolid.str("");
1041 sssolid << "Anode_Kapton2_solid";
1042 sssolid << i;
1043 ssolid = sssolid.str();
1044 sslogic.str("");
1045 sslogic << "Anode_Kapton2_logic";
1046 sslogic << i;
1047 slogic = sslogic.str();
1048 ssphysi.str("");
1049 ssphysi << "Anode_Kapton2_physi";
1050 ssphysi << i;
1051 sphysi = ssphysi.str();
1052 lvd_R_i = lv_CgemLayer->getInnerROfAnodeKapton2()*mm;
1053 lvd_R_o = lv_CgemLayer->getOuterROfAnodeKapton2()*mm;
1054 G4Tubs *lv_Anode_Kapton2_solid =
1055 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
1056 G4LogicalVolume *lv_Anode_Kapton2_logic =
1057 new G4LogicalVolume(lv_Anode_Kapton2_solid, m_M_Kapton, slogic);
1058 G4VPhysicalVolume *lv_Anode_Kapton2_physi =
1059 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Kapton2_logic, sphysi,
1060 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1061
1062 /* Anode_Epoxy2 */
1063 sssolid.str("");
1064 sssolid << "Anode_Epoxy2_solid";
1065 sssolid << i;
1066 ssolid = sssolid.str();
1067 sslogic.str("");
1068 sslogic << "Anode_Epoxy2_logic";
1069 sslogic << i;
1070 slogic = sslogic.str();
1071 ssphysi.str("");
1072 ssphysi << "Anode_Epoxy2_physi";
1073 ssphysi << i;
1074 sphysi = ssphysi.str();
1075 lvd_R_i = lv_CgemLayer->getInnerROfAnodeEpoxy2()*mm;
1076 lvd_R_o = lv_CgemLayer->getOuterROfAnodeEpoxy2()*mm;
1077 G4Tubs *lv_Anode_Epoxy2_solid =
1078 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
1079 G4LogicalVolume *lv_Anode_Epoxy2_logic =
1080 new G4LogicalVolume(lv_Anode_Epoxy2_solid, m_M_Epoxy, slogic);
1081 G4VPhysicalVolume *lv_Anode_Epoxy2_physi =
1082 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Epoxy2_logic, sphysi,
1083 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1084
1085 /* Anode_Rohacell1 */
1086 sssolid.str("");
1087 sssolid << "Anode_Rohacell1_solid";
1088 sssolid << i;
1089 ssolid = sssolid.str();
1090 sslogic.str("");
1091 sslogic << "Anode_Rohacell1_logic";
1092 sslogic << i;
1093 slogic = sslogic.str();
1094 ssphysi.str("");
1095 ssphysi << "Anode_Rohacell1_physi";
1096 ssphysi << i;
1097 sphysi = ssphysi.str();
1098 lvd_R_i = lv_CgemLayer->getInnerROfAnodeRohacell1()*mm;
1099 lvd_R_o = lv_CgemLayer->getOuterROfAnodeRohacell1()*mm;
1100 G4Tubs *lv_Anode_Rohacell1_solid =
1101 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
1102 G4LogicalVolume *lv_Anode_Rohacell1_logic =
1103 new G4LogicalVolume(lv_Anode_Rohacell1_solid, m_M_Rohacell, slogic);
1104 G4VPhysicalVolume *lv_Anode_Rohacell1_physi =
1105 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Rohacell1_logic, sphysi,
1106 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1107
1108 /* Anode_Epoxy3 */
1109 sssolid.str("");
1110 sssolid << "Anode_Epoxy3_solid";
1111 sssolid << i;
1112 ssolid = sssolid.str();
1113 sslogic.str("");
1114 sslogic << "Anode_Epoxy3_logic";
1115 sslogic << i;
1116 slogic = sslogic.str();
1117 ssphysi.str("");
1118 ssphysi << "Anode_Epoxy3_physi";
1119 ssphysi << i;
1120 sphysi = ssphysi.str();
1121 lvd_R_i = lv_CgemLayer->getInnerROfAnodeEpoxy3()*mm;
1122 lvd_R_o = lv_CgemLayer->getOuterROfAnodeEpoxy3()*mm;
1123 G4Tubs *lv_Anode_Epoxy3_solid =
1124 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
1125 G4LogicalVolume *lv_Anode_Epoxy3_logic =
1126 new G4LogicalVolume(lv_Anode_Epoxy3_solid, m_M_Epoxy, slogic);
1127 G4VPhysicalVolume *lv_Anode_Epoxy3_physi =
1128 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Epoxy3_logic, sphysi,
1129 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1130
1131 /* Anode_Kapton3 */
1132 sssolid.str("");
1133 sssolid << "Anode_Kapton3_solid";
1134 sssolid << i;
1135 ssolid = sssolid.str();
1136 sslogic.str("");
1137 sslogic << "Anode_Kapton3_logic";
1138 sslogic << i;
1139 slogic = sslogic.str();
1140 ssphysi.str("");
1141 ssphysi << "Anode_Kapton3_physi";
1142 ssphysi << i;
1143 sphysi = ssphysi.str();
1144 lvd_R_i = lv_CgemLayer->getInnerROfAnodeKapton3()*mm;
1145 lvd_R_o = lv_CgemLayer->getOuterROfAnodeKapton3()*mm;
1146 G4Tubs *lv_Anode_Kapton3_solid =
1147 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
1148 G4LogicalVolume *lv_Anode_Kapton3_logic =
1149 new G4LogicalVolume(lv_Anode_Kapton3_solid, m_M_Kapton, slogic);
1150 G4VPhysicalVolume *lv_Anode_Kapton3_physi =
1151 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Kapton3_logic, sphysi,
1152 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1153
1154 /* Anode_Epoxy4 */
1155 sssolid.str("");
1156 sssolid << "Anode_Epoxy4_solid";
1157 sssolid << i;
1158 ssolid = sssolid.str();
1159 sslogic.str("");
1160 sslogic << "Anode_Epoxy4_logic";
1161 sslogic << i;
1162 slogic = sslogic.str();
1163 ssphysi.str("");
1164 ssphysi << "Anode_Epoxy4_physi";
1165 ssphysi << i;
1166 sphysi = ssphysi.str();
1167 lvd_R_i = lv_CgemLayer->getInnerROfAnodeEpoxy4()*mm;
1168 lvd_R_o = lv_CgemLayer->getOuterROfAnodeEpoxy4()*mm;
1169 G4Tubs *lv_Anode_Epoxy4_solid =
1170 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
1171 G4LogicalVolume *lv_Anode_Epoxy4_logic =
1172 new G4LogicalVolume(lv_Anode_Epoxy4_solid, m_M_Epoxy, slogic);
1173 G4VPhysicalVolume *lv_Anode_Epoxy4_physi =
1174 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Epoxy4_logic, sphysi,
1175 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1176
1177 /* Anode_Rohacell2 */
1178 sssolid.str("");
1179 sssolid << "Anode_Rohacell2_solid";
1180 sssolid << i;
1181 ssolid = sssolid.str();
1182 sslogic.str("");
1183 sslogic << "Anode_Rohacell2_logic";
1184 sslogic << i;
1185 slogic = sslogic.str();
1186 ssphysi.str("");
1187 ssphysi << "Anode_Rohacell2_physi";
1188 ssphysi << i;
1189 sphysi = ssphysi.str();
1190 lvd_R_i = lv_CgemLayer->getInnerROfAnodeRohacell2()*mm;
1191 lvd_R_o = lv_CgemLayer->getOuterROfAnodeRohacell2()*mm;
1192 G4Tubs *lv_Anode_Rohacell2_solid =
1193 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
1194 G4LogicalVolume *lv_Anode_Rohacell2_logic =
1195 new G4LogicalVolume(lv_Anode_Rohacell2_solid, m_M_Rohacell, slogic);
1196 G4VPhysicalVolume *lv_Anode_Rohacell2_physi =
1197 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Rohacell2_logic, sphysi,
1198 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1199
1200 /* Anode_Epoxy5 */
1201 sssolid.str("");
1202 sssolid << "Anode_Epoxy5_solid";
1203 sssolid << i;
1204 ssolid = sssolid.str();
1205 sslogic.str("");
1206 sslogic << "Anode_Epoxy5_logic";
1207 sslogic << i;
1208 slogic = sslogic.str();
1209 ssphysi.str("");
1210 ssphysi << "Anode_Epoxy5_physi";
1211 ssphysi << i;
1212 sphysi = ssphysi.str();
1213 lvd_R_i = lv_CgemLayer->getInnerROfAnodeEpoxy5()*mm;
1214 lvd_R_o = lv_CgemLayer->getOuterROfAnodeEpoxy5()*mm;
1215
1216 G4Tubs *lv_Anode_Epoxy5_solid =
1217 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
1218 G4LogicalVolume *lv_Anode_Epoxy5_logic =
1219 new G4LogicalVolume(lv_Anode_Epoxy5_solid, m_M_Epoxy, slogic);
1220 G4VPhysicalVolume *lv_Anode_Epoxy5_physi =
1221 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Epoxy5_logic, sphysi,
1222 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1223
1224 /* Anode_Cu3 */
1225 sssolid.str("");
1226 sssolid << "Anode_Cu3_solid";
1227 sssolid << i;
1228 ssolid = sssolid.str();
1229 sslogic.str("");
1230 sslogic << "Anode_Cu3_logic";
1231 sslogic << i;
1232 slogic = sslogic.str();
1233 ssphysi.str("");
1234 ssphysi << "Anode_Cu3_physi";
1235 ssphysi << i;
1236 sphysi = ssphysi.str();
1237 lvd_R_i = lv_CgemLayer->getInnerROfAnodeCu3()*mm;
1238 lvd_R_o = lv_CgemLayer->getOuterROfAnodeCu3()*mm;
1239 G4Tubs *lv_Anode_Cu3_solid =
1240 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
1241 G4LogicalVolume *lv_Anode_Cu3_logic =
1242 new G4LogicalVolume(lv_Anode_Cu3_solid, m_M_Cu, slogic);
1243 G4VPhysicalVolume *lv_Anode_Cu3_physi =
1244 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Cu3_logic, sphysi,
1245 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1246
1247 /* Anode_Kapton4 */
1248 sssolid.str("");
1249 sssolid << "Anode_Kapton4_solid";
1250 sssolid << i;
1251 ssolid = sssolid.str();
1252 sslogic.str("");
1253 sslogic << "Anode_Kapton4_logic";
1254 sslogic << i;
1255 slogic = sslogic.str();
1256 ssphysi.str("");
1257 ssphysi << "Anode_Kapton4_physi";
1258 ssphysi << i;
1259 sphysi = ssphysi.str();
1260 lvd_R_i = lv_CgemLayer->getInnerROfAnodeKapton4()*mm;
1261 lvd_R_o = lv_CgemLayer->getOuterROfAnodeKapton4()*mm;
1262 G4Tubs *lv_Anode_Kapton4_solid =
1263 new G4Tubs(ssolid, lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
1264 G4LogicalVolume *lv_Anode_Kapton4_logic =
1265 new G4LogicalVolume(lv_Anode_Kapton4_solid, m_M_Kapton, slogic);
1266 G4VPhysicalVolume *lv_Anode_Kapton4_physi =
1267 new G4PVPlacement(lv_rotation, lv_3vector, lv_Anode_Kapton4_logic, sphysi,
1268 lv_Anode_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1269
1270
1271 /* Set logical volume colour */
1272 lv_CgemLayer_logic -> SetVisAttributes(lv_white);
1273 lv_Cathode_logic -> SetVisAttributes(lv_green);
1274 lv_Anode_logic -> SetVisAttributes(lv_red);
1275
1276 /* Print Information */
1277 Print(lv_CgemLayer_logic);
1278 Print(lv_Cathode_logic);
1279 Print(lv_Anode_logic);
1280
1281 } /* End of 'for (G4int i=0; i < lvi_N_CgemLayer; i++)' */
1282
1283 /* CGEM/MDC Separator */
1284 CgemGeoSeparator *lv_CgemSeparator = m_cgem_geomsvc->getCgemSeparator();
1285 lvd_R_i = lv_CgemSeparator->getInnerR()*mm;
1286 lvd_R_o = lv_CgemSeparator->getOuterR()*mm;
1287 lvd_L_z = lv_CgemSeparator->getLength()*mm;
1288
1289 G4Tubs *lv_Separator_solid =
1290 new G4Tubs("Separator_solid", lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
1291
1292 lvd_R_o = lvd_R_i + lv_CgemSeparator->getThickOfInnerAluminum()*mm;
1293 G4Tubs *lv_Separator_solid_Al1 =
1294 new G4Tubs("Separator_solid_Al1", lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
1295 lvd_R_i = lvd_R_o;
1296 lvd_R_o= lvd_R_i + lv_CgemSeparator->getThickOfCarbonFiber()*mm;
1297 G4Tubs *lv_Separator_solid_CarFib =
1298 new G4Tubs("Separator_solid_CarFib", lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
1299 lvd_R_i = lvd_R_o;
1300 lvd_R_o= lvd_R_i + lv_CgemSeparator->getThickOfOuterAluminum()*mm;
1301 G4Tubs *lv_Separator_solid_Al2 =
1302 new G4Tubs("Separator_solid_Al2", lvd_R_i, lvd_R_o, lvd_L_z/2., lvd_A_s, lvd_A_d);
1303
1304 cout << "CGEM/MDC SEPARATOR" << endl;
1305 cout << lv_Separator_solid_Al1->GetName()
1306 << " rin " << lv_Separator_solid_Al1->GetInnerRadius()
1307 << " rout " << lv_Separator_solid_Al1->GetOuterRadius()
1308 << " length " << lv_Separator_solid_Al1->GetZHalfLength()*2
1309 << endl;
1310 cout << lv_Separator_solid_CarFib->GetName()
1311 << " rin " << lv_Separator_solid_CarFib->GetInnerRadius()
1312 << " rout " << lv_Separator_solid_CarFib->GetOuterRadius()
1313 << " length " << lv_Separator_solid_CarFib->GetZHalfLength()*2
1314 << endl;
1315 cout << lv_Separator_solid_Al2->GetName()
1316 << " rin " << lv_Separator_solid_Al2->GetInnerRadius()
1317 << " rout " << lv_Separator_solid_Al2->GetOuterRadius()
1318 << " length " << lv_Separator_solid_Al2->GetZHalfLength()*2
1319 << endl;
1320
1321
1322 G4LogicalVolume *lv_Separator_logic =
1323 new G4LogicalVolume(lv_Separator_solid, m_M_Air, "Separator_logic");
1324 G4LogicalVolume *lv_Separator_logic_Al1 =
1325 new G4LogicalVolume(lv_Separator_solid_Al1, m_M_Aluminum, "Separator_logic_Al1");
1326 G4LogicalVolume *lv_Separator_logic_CarFib =
1327 new G4LogicalVolume(lv_Separator_solid_CarFib, m_M_CarbonFiber, "Separator_logic_CarFib");
1328 G4LogicalVolume *lv_Separator_logic_Al2 =
1329 new G4LogicalVolume(lv_Separator_solid_Al2, m_M_Aluminum, "Separator_logic_Al2");
1330
1331 G4VPhysicalVolume *lv_Separator_physi =
1332 new G4PVPlacement(lv_rotation, lv_3vector, lv_Separator_logic, "Separator_physi",
1333 lv_Cgem_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1334 G4VPhysicalVolume *lv_Separator_physi_Al1 =
1335 new G4PVPlacement(lv_rotation, lv_3vector, lv_Separator_logic_Al1, "Separator_physi_Al1",
1336 lv_Separator_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1337 G4VPhysicalVolume *lv_Separator_physi_CarFib =
1338 new G4PVPlacement(lv_rotation, lv_3vector, lv_Separator_logic_CarFib, "Separator_physi_CarFib",
1339 lv_Separator_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1340 G4VPhysicalVolume *lv_Separator_physi_Al2 =
1341 new G4PVPlacement(lv_rotation, lv_3vector, lv_Separator_logic_Al2, "Separator_physi_Al2",
1342 lv_Separator_logic, lv_boolen, lv_copyNo, m_CheckOverlaps);
1343
1344 return lv_Cgem_logic;
1345}
1346
1347void BesCgemConstruction::ConstructPassiveElements(G4LogicalVolume* logicCgem)
1348{
1349
1350 cout << "================!!!! CONSTRUCT CGEM PASSIVE ELEMENTS !!!!================" << endl;
1351
1352 IMessageSvc* msgSvc;
1353 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
1354 MsgStream log(msgSvc, "BesCgemConstruction::ConstructPassiveElements()");
1355 log<< MSG::INFO << "===========================================" << endreq;
1356 log<< MSG::INFO << "BesCgemConstruction::ConstructPassiveElements(), Begin to construct CGEM passives!" << endreq;
1357
1358 /* Visualization attributes */ // CHECK rendi queste variabli d'ambiente
1359 G4VisAttributes *lv_white = new G4VisAttributes(G4Colour::White());
1360 G4VisAttributes *lv_yellow = new G4VisAttributes(G4Colour::Yellow());
1361 G4VisAttributes *lv_cyan = new G4VisAttributes(G4Colour::Cyan());
1362 G4bool lv_boolen = false; /* No boolen opertation */
1363 G4int lv_copyNo = 0; /* Integer which identifies this placement */
1364
1365 /* Construct Geometry */
1366 // PLACEMENTS
1367 // positions w.r.t. center of as_L1_2
1368 // placement from CAD
1369 double zref = 358;
1370 double displ_as_L2_1 = 64;
1371 double displ_as_L3_4 = 83;
1372 double displ_ef_1 = 171;
1373
1374 // GEOMETRY PARAMETERS
1375 // assembly L1
1376 double as_L1_1_rin = 71.;
1377 double as_L1_2_rin = 90.1;
1378 double as_L1_3_rin = 96.;
1379 double as_L1_4_rin = 71.;
1380
1381 double as_L1_1_rout = 90.1;
1382 double as_L1_2_rout = 112.;
1383 double as_L1_3_rout = 112.;
1384 double as_L1_4_rout = 88.;
1385
1386 double as_L1_1_thick = 34;
1387 double as_L1_2_thick = 48;
1388 double as_L1_3_thick = 32.5;
1389 double as_L1_4_thick = 45;
1390
1391 // assembly 2
1392 double as_L2_1_rin = 113.5;
1393 double as_L2_2_rin = 132.5;
1394 double as_L2_3_rin = 139.5;
1395 double as_L2_4_rin = 113.5;
1396 double as_L2_5_0_rin = 132.5;
1397 double as_L2_5_1_rin = 132.5;
1398
1399 double as_L2_1_rout = 132.5;
1400 double as_L2_2_rout = 154.5;
1401 double as_L2_3_rout = 154.5;
1402 double as_L2_4_rout = 130.5;
1403 double as_L2_5_0_rout = 152.6; // changed
1404 double as_L2_5_1_rout = 154.5;
1405
1406 double as_L2_1_thick = 34;
1407 double as_L2_2_thick = 43;
1408 double as_L2_3_thick = 34;
1409 double as_L2_4_thick = 33;
1410 double as_L2_5_thick = 5;
1411
1412 // assembly 3
1413 double as_L3_1_rin = 156.;
1414 double as_L3_2_rin = 154.5;
1415 double as_L3_3_rin = 175.;
1416 double as_L3_4_0_rin = 156.;
1417 double as_L3_4_1_rin = 156.;
1418 double as_L3_5_0_rin = 175.;
1419 double as_L3_5_1_rin = 175.;
1420
1421 double as_L3_1_rout = 175.;
1422 double as_L3_2_rout = 162.1;
1423 double as_L3_3_rout = 180.7;
1424 double as_L3_4_0_rout = 170.96;
1425 double as_L3_4_1_rout = 175.;
1426 double as_L3_5_0_rout = 176.;
1427 double as_L3_5_1_rout = 180.7;
1428
1429 double as_L3_1_thick = 21;
1430 double as_L3_2_thick = 28;
1431 double as_L3_3_thick = 34.5;
1432 double as_L3_4_thick = 10;
1433 double as_L3_5_thick = 14.5;
1434
1435 // connecting flange out
1436 double cfo_1_rin = 65.5;
1437 double cfo_1_rout = 71.;
1438 double cfo_2_rin = cfo_1_rin;
1439 double cfo_2_rout = 85.;
1440 //
1441 double cfo_brick_2_x = 40.5;
1442 double cfo_brick_2_y = 13;
1443 double cfo_brick_2_z = 12;
1444 // NOTE: brick -> tubes to avoid overlap
1445 double cfo_brick_1_rin = cfo_2_rout;
1446 double cfo_brick_1_rout = cfo_2_rout + as_L2_4_rin - cfo_2_rout;
1447 double cfo_brick_1_thick = 10;
1448 double cfo_rad = (cfo_2_rout + 0.5 * (cfo_brick_1_rout - cfo_brick_1_rin)) *CLHEP::mm;
1449 double cfo_phi = cfo_brick_2_y/cfo_rad;
1450
1451 // east flange (modified to accomodate separator MDC-CGEM_IT)
1452 /* CGEM/MDC Separator */
1453 CgemGeoSeparator *lv_CgemSeparator = m_cgem_geomsvc->getCgemSeparator();
1454 double sep_rin = lv_CgemSeparator->getInnerR()*mm;
1455 double sep_rout = lv_CgemSeparator->getOuterR()*mm;
1456 double sep_len = lv_CgemSeparator->getLength()*mm;
1457
1458 // east flange
1459 double ef_1_rin = 159.;
1460 double ef_2_rin = 174.5;
1461
1462 double ef_1_rout = 186.5; // CHECK before 183.5
1463 double ef_2_rout = ef_1_rout;
1464
1465 double ef_1_thick = 12;
1466 double ef_2_thick = 35; // east, 39 west
1467
1468 // inside cables
1469 double ef_1_a_rin = ef_1_rin;
1470 double ef_2_a_rin = ef_2_rin;
1471
1472 double ef_1_a_rout = sep_rin;
1473 double ef_2_a_rout = sep_rin;
1474
1475 double ef_1_a_thick = ef_1_thick;
1476 double ef_2_a_thick = ef_2_thick;
1477
1478 // outside cables
1479 double ef_3_rin = sep_rout;
1480 double ef_4_rin = sep_rin;
1481
1482 double ef_3_rout = ef_1_rout;
1483 double ef_4_rout = sep_rout;
1484
1485 double ef_3_thick = ef_1_thick + ef_2_thick;
1486 double ef_4_thick = ef_3_thick - (0.5 * sep_len - (zref + displ_ef_1) + 0.5 * ef_1_thick);
1487
1488 // pink flange
1489 double pf_1_rin = 60;
1490 double pf_2_rin = 60;
1491 double pf_3_0_rin = 75.174;
1492 double pf_3_1_rin = 75.174;
1493 double pf_side_0_0_rin = 75.174;
1494 double pf_side_0_1_rin = 115.516;
1495 double pf_side_1_0_rin = pf_side_0_1_rin;
1496 double pf_side_1_1_rin = 132;
1497
1498 double pf_arc_rin = 132;
1499
1500 double pf_1_rout = 90.5;
1501 double pf_2_rout = 75.174;
1502 double pf_3_0_rout = 90.5;
1503 double pf_3_1_rout = 91.657;
1504 double pf_side_0_0_rout = 91.657;
1505 double pf_side_0_1_rout = 132;
1506 double pf_side_1_0_rout = pf_side_0_1_rout;
1507 double pf_side_1_1_rout = 155;
1508
1509
1510 double pf_arc_rout = 155;
1511
1512 double pf_1_thick = 5.7;
1513 double pf_2_thick = 10.3;
1514 double pf_3_thick = 10.3;
1515 double pf_side_0_thick = 23.332;
1516 double pf_side_1_thick = 9.332;
1517
1518 double pf_brick_x = 24;
1519 double pf_brick_y = 36;
1520 double pf_brick_z = 10;
1521
1522 double pf_arc_thick = 9;
1523
1524 // shield
1525 double sh_0_rin = 90.5;
1526 double sh_1_rin = 131.78;
1527
1528 double sh_0_rout = 91.5;
1529 double sh_1_rout = 132.78;
1530
1531 double sh_thick = 25.8;
1532
1533 // new ring west
1534 double nwr_1_rin = 159.;
1535 double nwr_2_rin = as_L3_5_1_rout;
1536
1537 double nwr_1_rout = 182.6;
1538 double nwr_2_rout = 182.6;
1539
1540 double nwr_1_thick = 2;
1541 double nwr_2_thick = 15;
1542
1543 // inside cable
1544 double nwr_1_a_rin = nwr_1_rin;
1545 double nwr_1_a_rout = as_L3_5_1_rout;
1546 double nwr_1_a_thick = nwr_1_thick;
1547
1548 // outside
1549 double nwr_1_b_rin = as_L3_5_1_rout;
1550 double nwr_1_b_rout = nwr_1_rout;
1551 double nwr_1_b_thick = nwr_1_thick;
1552
1553 // brick
1554 double w_brick_x = 40.;
1555 double w_brick_y = 18.;
1556 double w_brick_z = 11.;
1557
1558 // placement
1559 // list of z
1560 double z_as_L1_2_eP = zref;
1561 double z_as_L1_1_eP = z_as_L1_2_eP + 0.5 * as_L1_2_thick - 0.5 * as_L1_1_thick;
1562 double z_as_L1_3_eP = z_as_L1_2_eP + 0.5 * as_L1_2_thick + 0.5 * as_L1_3_thick;
1563 double z_as_L1_4_eP = z_as_L1_2_eP + 0.5 * as_L1_2_thick + 0.5 * as_L1_4_thick;
1564
1565 // cout << "as_L1 z" << endl;
1566 // cout << z_as_L1_1_eP << endl;
1567 // cout << z_as_L1_2_eP << endl;
1568 // cout << z_as_L1_3_eP << endl;
1569 // cout << z_as_L1_4_eP << endl;
1570
1571
1572 double z_as_L2_1_eP = zref + displ_as_L2_1;
1573 double z_as_L2_2_eP = z_as_L2_1_eP + 0.5 * as_L2_1_thick - 0.5 * as_L2_2_thick;
1574 double z_as_L2_3_eP = z_as_L2_2_eP + 0.5 * as_L2_2_thick + 0.5 * as_L2_3_thick;
1575 double z_as_L2_4_eP = z_as_L2_1_eP + 0.5 * as_L2_1_thick + 0.5 * as_L2_4_thick;
1576 double z_as_L2_5_eP = z_as_L2_2_eP - 0.5 * as_L2_2_thick - 0.5 * as_L2_5_thick;
1577
1578 // cout << "as_L2 z" << endl;
1579 // cout << z_as_L2_1_eP << endl;
1580 // cout << z_as_L2_2_eP << endl;
1581 // cout << z_as_L2_3_eP << endl;
1582 // cout << z_as_L2_4_eP << endl;
1583 // cout << z_as_L2_5_eP << endl;
1584
1585 double z_as_L3_4_eP = zref + displ_as_L3_4;
1586 double z_as_L3_1_eP = z_as_L3_4_eP + 0.5 * as_L3_4_thick + 0.5 * as_L3_1_thick;
1587 double z_as_L3_2_eP = z_as_L3_1_eP + 0.5 * as_L3_1_thick + 0.5 * as_L3_2_thick;
1588 double z_as_L3_5_eP = z_as_L3_4_eP + 0.5 * as_L3_4_thick + 0.5 * as_L3_5_thick;
1589 double z_as_L3_3_eP = z_as_L3_5_eP + 0.5 * as_L3_5_thick + 0.5 * as_L3_3_thick;
1590
1591 // cout << "as_L3 z" << endl;
1592 // cout << z_as_L3_1_eP << endl;
1593 // cout << z_as_L3_2_eP << endl;
1594 // cout << z_as_L3_3_eP << endl;
1595 // cout << z_as_L3_4_eP << endl;
1596 // cout << z_as_L3_5_eP << endl;
1597
1598 double z_cfo_1_eP = 427.;
1599 double z_cfo_2_eP = 473.;
1600
1601 double z_ef_1_eP = zref + displ_ef_1;
1602 double z_ef_1_a_eP = z_ef_1_eP;
1603 double z_ef_2_a_eP = z_ef_1_eP + 0.5 * (ef_1_a_thick + ef_2_a_thick);
1604 double z_ef_3_eP = z_ef_1_a_eP - 0.5* ef_1_a_thick + 0.5 * ef_3_thick;
1605 double z_ef_4_eP = z_ef_3_eP + 0.5 * ef_3_thick - 0.5 * ef_4_thick;
1606
1607 double z_pf_1_eP = 486.85;
1608 double z_pf_2_eP = 494.85;
1609 double z_pf_3_eP = 494.85;
1610 double z_pf_side_0_eP = 511.666;
1611 double z_pf_side_1_eP = z_pf_side_0_eP + 0.5 * (pf_side_0_thick + pf_side_1_thick);
1612
1613 double z_pf_arc_eP = 527.832;
1614 double z_pf_brick_eP = z_ef_1_eP + 0.5 * (ef_1_thick + pf_brick_z);
1615
1616 double z_sh_eP = 502.6;
1617
1618 double z_cbe_brick_eP = 479.5; // 478.5;
1619
1620 // west positioning
1621 double zref_w = zref;
1622 double z_nwr_1_wP = 522.;
1623 double z_nwr_2_wP = zref + displ_ef_1 - 0.5 * ef_1_thick - 0.5*nwr_2_thick;
1624
1625 double z_w_brick_wP = 479.5;
1626
1627 // CABLES
1628 double cable_1_rin = as_L1_1_rin;
1629 double cable_2_0_rin = cfo_1_rin;
1630 double cable_2_1_rin = cable_2_0_rin;
1631 double cable_3_rin = cable_2_0_rin;
1632 double cable_4_0_rin = cable_2_0_rin;
1633 double cable_4_1_rin = cable_2_0_rin;
1634 double cable_5_0_rin = cable_2_0_rin;
1635 double cable_5_1_rin = cable_2_0_rin;
1636 double cable_6_rin = cable_2_0_rin;
1637 double cable_7_rin = pf_1_rin;
1638 double cable_8_rin = cable_7_rin;
1639
1640 double cable_1_rout = as_L1_2_rout;
1641 double cable_2_0_rout = as_L2_5_0_rout;
1642 double cable_2_1_rout = as_L2_5_1_rout;
1643 double cable_3_rout = cable_2_1_rout;
1644 double cable_4_0_rout = as_L3_4_0_rout;
1645 double cable_4_1_rout = as_L3_4_1_rout;
1646 double cable_5_0_rout = as_L3_5_0_rout;
1647 double cable_5_1_rout = as_L3_5_1_rout;
1648 double cable_6_rout = cable_5_1_rout;
1649 double cable_7_rout = cable_5_1_rout;
1650 double cable_8_rout = sep_rin;
1651
1652 // cout << "cable rin " << endl;
1653 // cout << cable_1_rin << endl;
1654 // cout << cable_2_0_rin << endl;
1655 // cout << cable_2_1_rin << endl;
1656 // cout << cable_3_rin << endl;
1657 // cout << cable_4_0_rin << endl;
1658 // cout << cable_4_1_rin << endl;
1659 // cout << cable_5_0_rin << endl;
1660 // cout << cable_5_1_rin << endl;
1661 // cout << cable_6_rin << endl;
1662 // cout << cable_7_rin << endl;
1663 // cout << cable_8_rin << endl;
1664
1665
1666 // cout << "cable rout " << endl;
1667 // cout << cable_1_rout << endl;
1668 // cout << cable_2_0_rout << endl;
1669 // cout << cable_2_1_rout << endl;
1670 // cout << cable_3_rout << endl;
1671 // cout << cable_4_0_rout << endl;
1672 // cout << cable_4_1_rout << endl;
1673 // cout << cable_5_0_rout << endl;
1674 // cout << cable_5_1_rout << endl;
1675 // cout << cable_6_rout << endl;
1676 // cout << cable_7_rout << endl;
1677 // cout << cable_8_rout << endl;
1678
1679 double z_limit_1 = zref - 0.5 * as_L1_2_thick;
1680 double z_limit_2 = zref + displ_as_L2_1 + 0.5 * as_L2_1_thick - as_L2_2_thick - as_L2_5_thick;
1681 double z_limit_3 = z_limit_2 + as_L2_5_thick;
1682 double z_limit_4 = zref + displ_as_L3_4 - 0.5 * as_L3_4_thick;
1683 double z_limit_5 = z_limit_4 + as_L3_4_thick;
1684 double z_limit_6 = z_limit_5 + as_L3_5_thick;
1685 double z_limit_7 = 484;
1686 double z_limit_8 = zref + displ_ef_1 - 0.5 * ef_1_thick;
1687 double z_limit_9 = z_limit_8 + ef_1_thick + ef_2_thick;
1688
1689 double z_limit_min = z_limit_1;
1690 double z_limit_max = z_limit_9;
1691
1692 double cable_1_thick = z_limit_2 - z_limit_1;
1693 double cable_2_thick = z_limit_3 - z_limit_2;
1694 double cable_3_thick = z_limit_4 - z_limit_3;
1695 double cable_4_thick = z_limit_5 - z_limit_4;
1696 double cable_5_thick = z_limit_6 - z_limit_5;
1697 double cable_6_thick = z_limit_7 - z_limit_6;
1698 double cable_7_thick = z_limit_8 - z_limit_7;
1699 double cable_8_thick = z_limit_9 - z_limit_8;
1700
1701 double angle2pi = CLHEP::twopi *CLHEP::rad;
1702
1703 G4Tubs* cable_1 = new G4Tubs("cable_1", cable_1_rin *CLHEP::mm, cable_1_rout *CLHEP::mm,
1704 0.5 * cable_1_thick *CLHEP::mm, 0, angle2pi);
1705 G4Cons* cable_2 = new G4Cons("cable_2", cable_2_0_rin *CLHEP::mm, cable_2_0_rout *CLHEP::mm,
1706 cable_2_1_rin *CLHEP::mm, cable_2_1_rout *CLHEP::mm,
1707 0.5 * cable_2_thick *CLHEP::mm, 0, angle2pi);
1708 G4Tubs* cable_3 = new G4Tubs("cable_3", cable_3_rin *CLHEP::mm, cable_3_rout *CLHEP::mm,
1709 0.5 * cable_3_thick *CLHEP::mm, 0, angle2pi);
1710 G4Cons* cable_4 = new G4Cons("cable_4", cable_4_0_rin *CLHEP::mm, cable_4_0_rout *CLHEP::mm,
1711 cable_4_1_rin *CLHEP::mm, cable_4_1_rout *CLHEP::mm,
1712 0.5 * cable_4_thick *CLHEP::mm, 0, angle2pi);
1713 G4Cons* cable_5 = new G4Cons("cable_5", cable_5_0_rin *CLHEP::mm, cable_5_0_rout *CLHEP::mm,
1714 cable_5_1_rin *CLHEP::mm, cable_5_1_rout *CLHEP::mm,
1715 0.5 * cable_5_thick *CLHEP::mm, 0, angle2pi);
1716 G4Tubs* cable_6 = new G4Tubs("cable_6", cable_6_rin *CLHEP::mm, cable_6_rout *CLHEP::mm,
1717 0.5 * cable_6_thick *CLHEP::mm, 0, angle2pi);
1718 G4Tubs* cable_7 = new G4Tubs("cable_7", cable_7_rin *CLHEP::mm, cable_7_rout *CLHEP::mm,
1719 0.5 * cable_7_thick *CLHEP::mm, 0, angle2pi);
1720 G4Tubs* cable_8 = new G4Tubs("cable_8", cable_8_rin *CLHEP::mm, cable_8_rout *CLHEP::mm,
1721 0.5 * cable_8_thick *CLHEP::mm, 0, angle2pi);
1722
1723
1724 // cout << "---- z limits" << endl;
1725 // cout << z_limit_1 << endl;
1726 // cout << z_limit_2 << endl;
1727 // cout << z_limit_3 << endl;
1728 // cout << z_limit_4 << endl;
1729 // cout << z_limit_5 << endl;
1730 // cout << z_limit_6 << endl;
1731 // cout << z_limit_7 << endl;
1732 // cout << z_limit_8 << endl;
1733 // cout << z_limit_9 << endl;
1734
1735
1736 // cout << "---- thicknesses" << endl;
1737 // cout << cable_1_thick << endl;
1738 // cout << cable_2_thick << endl;
1739 // cout << cable_3_thick << endl;
1740 // cout << cable_4_thick << endl;
1741 // cout << cable_5_thick << endl;
1742 // cout << cable_6_thick << endl;
1743 // cout << cable_7_thick << endl;
1744 // cout << cable_8_thick << endl;
1745
1746 double z_shift = -0.5*(cable_1_thick - as_L1_2_thick);
1747
1748 // material
1749 G4Material* cable_copper = G4NistManager::Instance()->FindOrBuildMaterial("G4_Cu");
1750 G4Material* cable_plastic = G4NistManager::Instance()->FindOrBuildMaterial("G4_POLYETHYLENE");
1751 double cable_density = m_cgem_geomsvc->getDensityOfCable()*g/cm3;
1752 G4Material *cable_material = new G4Material("cable_material", cable_density, 1);
1753 cable_material->AddMaterial(cable_copper, 1);
1754
1755 // G4cout << "COPPER " << copper_rho << " " << copper_V << " " << copper_rho * copper_V << endl;
1756 // G4cout << "PLASTIC " << plastic_rho << " " << plastic_V << " " << plastic_rho * plastic_V << endl;
1757 // G4cout << "CABLE " << cable_rho << " " << cable_V << " " << cable_rho * cable_V << endl;
1758
1759
1760 // G4cout << "copper mass fract " << copper_massfract << G4endl;
1761 // G4cout << "plastic mass fract " << plastic_massfract << G4endl;
1762
1763 // EAST union solid for cables
1764 G4RotationMatrix cable_rot;
1765 G4ThreeVector cable_tr(0, 0, 0.5* (cable_1_thick + cable_2_thick) *CLHEP::mm);
1766
1767 G4Transform3D cable_tr12(cable_rot, cable_tr);
1768 G4UnionSolid *cable_12 = new G4UnionSolid("cable_12", cable_1, cable_2, cable_tr12);
1769
1770 cable_tr.set(0, 0, (0.5* (cable_1_thick + cable_3_thick) + cable_2_thick) * CLHEP::mm);
1771 G4Transform3D cable_tr123(cable_rot, cable_tr);
1772 G4UnionSolid *cable_123 = new G4UnionSolid("cable_123", cable_12, cable_3, cable_tr123);
1773
1774 cable_tr.set(0, 0, (0.5* (cable_1_thick + cable_4_thick) + cable_3_thick + cable_2_thick) * CLHEP::mm);
1775 G4Transform3D cable_tr1234(cable_rot, cable_tr);
1776 G4UnionSolid *cable_1234 = new G4UnionSolid("cable_1234", cable_123, cable_4, cable_tr1234);
1777
1778 cable_tr.set(0, 0, (0.5* (cable_1_thick + cable_5_thick) + cable_4_thick + cable_3_thick + cable_2_thick) * CLHEP::mm);
1779 G4Transform3D cable_tr12345(cable_rot, cable_tr);
1780 G4UnionSolid *cable_12345 = new G4UnionSolid("cable_12345", cable_1234, cable_5, cable_tr12345);
1781
1782 cable_tr.set(0, 0, (0.5* (cable_1_thick + cable_6_thick) + cable_5_thick + cable_4_thick + cable_3_thick + cable_2_thick) * CLHEP::mm);
1783 G4Transform3D cable_tr123456(cable_rot, cable_tr);
1784 G4UnionSolid *cable_123456 = new G4UnionSolid("cable_123456", cable_12345, cable_6, cable_tr123456);
1785
1786 cable_tr.set(0, 0, (0.5* (cable_1_thick + cable_7_thick) + cable_6_thick + cable_5_thick + cable_4_thick + cable_3_thick + cable_2_thick) * CLHEP::mm);
1787 G4Transform3D cable_tr1234567(cable_rot, cable_tr);
1788 G4UnionSolid *cable_1234567 = new G4UnionSolid("cable_1234567", cable_123456, cable_7, cable_tr1234567);
1789
1790 cable_tr.set(0, 0, (0.5* (cable_1_thick + cable_8_thick) +
1791 cable_7_thick + cable_6_thick + cable_5_thick + cable_4_thick + cable_3_thick + cable_2_thick) * CLHEP::mm);
1792 G4Transform3D cable_tr12345678(cable_rot, cable_tr);
1793 G4UnionSolid *cable_12345678 = new G4UnionSolid("cable_12345678", cable_1234567, cable_8, cable_tr12345678);
1794
1795
1796
1797 // east logical
1798 G4LogicalVolume* cable_e_L = new G4LogicalVolume(cable_12345678, cable_material, "cable_e_L", 0, 0, 0);
1799 // west logical
1800 G4LogicalVolume* cable_w_L = new G4LogicalVolume(cable_12345678, cable_material, "cable_w_L", 0, 0, 0);
1801
1802 G4VisAttributes cable_attributes;
1803 // cable_attributes.SetForceSolid(true);
1804 cable_attributes.SetColor(G4Color::Magenta());
1805 cable_e_L->SetVisAttributes(cable_attributes);
1806 cable_attributes.SetColor(G4Color::Cyan());
1807 cable_w_L->SetVisAttributes(cable_attributes);
1808 // **************************************************
1809
1810 // assembly L1
1811 G4Tubs* as_L1_1 = new G4Tubs("as_L1_1", as_L1_1_rin *CLHEP::mm, as_L1_1_rout *CLHEP::mm,
1812 0.5 * as_L1_1_thick *CLHEP::mm, 0, angle2pi);
1813 G4Tubs* as_L1_2 = new G4Tubs("as_L1_2", as_L1_2_rin *CLHEP::mm, as_L1_2_rout *CLHEP::mm,
1814 0.5 * as_L1_2_thick *CLHEP::mm, 0, angle2pi);
1815 G4Tubs* as_L1_3 = new G4Tubs("as_L1_3", as_L1_3_rin *CLHEP::mm, as_L1_3_rout *CLHEP::mm,
1816 0.5 * as_L1_3_thick *CLHEP::mm, 0, angle2pi);
1817 G4Tubs* as_L1_4 = new G4Tubs("as_L1_4", as_L1_4_rin *CLHEP::mm, as_L1_4_rout *CLHEP::mm,
1818 0.5 * as_L1_4_thick *CLHEP::mm, 0, angle2pi);
1819
1820 // assembly 2
1821 G4Tubs* as_L2_1 = new G4Tubs("as_L2_1", as_L2_1_rin *CLHEP::mm, as_L2_1_rout *CLHEP::mm,
1822 0.5 * as_L2_1_thick *CLHEP::mm, 0, angle2pi);
1823 G4Tubs* as_L2_2 = new G4Tubs("as_L2_2", as_L2_2_rin *CLHEP::mm, as_L2_2_rout *CLHEP::mm,
1824 0.5 * as_L2_2_thick *CLHEP::mm, 0, angle2pi);
1825 G4Tubs* as_L2_3 = new G4Tubs("as_L2_3", as_L2_3_rin *CLHEP::mm, as_L2_3_rout *CLHEP::mm,
1826 0.5 * as_L2_3_thick *CLHEP::mm, 0, angle2pi);
1827 G4Tubs* as_L2_4 = new G4Tubs("as_L2_4", as_L2_4_rin *CLHEP::mm, as_L2_4_rout *CLHEP::mm,
1828 0.5 * as_L2_4_thick *CLHEP::mm, 0, angle2pi);
1829 G4Cons* as_L2_5 = new G4Cons("as_L2_5", as_L2_5_0_rin *CLHEP::mm, as_L2_5_0_rout *CLHEP::mm,
1830 as_L2_5_1_rin *CLHEP::mm, as_L2_5_1_rout *CLHEP::mm,
1831 0.5 * as_L2_5_thick *CLHEP::mm, 0, angle2pi);
1832 // assembly 3
1833 G4Tubs* as_L3_1 = new G4Tubs("as_L3_1", as_L3_1_rin *CLHEP::mm, as_L3_1_rout *CLHEP::mm,
1834 0.5 * as_L3_1_thick *CLHEP::mm, 0, angle2pi);
1835 G4Tubs* as_L3_2 = new G4Tubs("as_L3_2", as_L3_2_rin *CLHEP::mm, as_L3_2_rout *CLHEP::mm,
1836 0.5 * as_L3_2_thick *CLHEP::mm, 0, angle2pi);
1837 G4Tubs* as_L3_3 = new G4Tubs("as_L3_3", as_L3_3_rin *CLHEP::mm, as_L3_3_rout *CLHEP::mm,
1838 0.5 * as_L3_3_thick *CLHEP::mm, 0, angle2pi);
1839 G4Cons* as_L3_4 = new G4Cons("as_L3_4", as_L3_4_0_rin *CLHEP::mm, as_L3_4_0_rout *CLHEP::mm,
1840 as_L3_4_1_rin *CLHEP::mm, as_L3_4_1_rout *CLHEP::mm,
1841 0.5 * as_L3_4_thick *CLHEP::mm, 0, angle2pi);
1842 G4Cons* as_L3_5 = new G4Cons("as_L3_5", as_L3_5_0_rin *CLHEP::mm, as_L3_5_0_rout *CLHEP::mm,
1843 as_L3_5_1_rin *CLHEP::mm, as_L3_5_1_rout *CLHEP::mm,
1844 0.5 * as_L3_5_thick *CLHEP::mm, 0, angle2pi);
1845
1846 // connecting flange out
1847 G4Tubs* cfo_1 = new G4Tubs("cfo_1", cfo_1_rin *CLHEP::mm, cfo_1_rout *CLHEP::mm, 0.5*70. *CLHEP::mm, 0, angle2pi);
1848 G4Tubs* cfo_2 = new G4Tubs("cfo_2", cfo_2_rin *CLHEP::mm, cfo_2_rout *CLHEP::mm, 0.5*22. *CLHEP::mm, 0, angle2pi);
1849
1850 // cfo brick
1851 G4Tubs* cfo_brick_1 = new G4Tubs("cfo_brick_1", cfo_brick_1_rin *CLHEP::mm, cfo_brick_1_rout *CLHEP::mm,
1852 0.5 * cfo_brick_1_thick *CLHEP::mm, -0.5* cfo_phi * CLHEP::rad, cfo_phi * CLHEP::rad);
1853 G4Box *cfo_brick_2 = new G4Box("cfo_brick_2",
1854 0.5* cfo_brick_2_x *CLHEP::mm,
1855 0.5* cfo_brick_2_y *CLHEP::mm,
1856 0.5* cfo_brick_2_z *CLHEP::mm);
1857 G4ThreeVector cfo_brick_pos_1_2((cfo_2_rout + 0.5* cfo_brick_2_x) *CLHEP::mm,
1858 0,
1859 0.5 * (cfo_brick_2_z + cfo_brick_1_thick) *CLHEP::mm);
1860 G4Transform3D cfo_transform(G4RotationMatrix(), cfo_brick_pos_1_2);
1861 G4UnionSolid *cfo_brick = new G4UnionSolid("cfo_brick", cfo_brick_1, cfo_brick_2, cfo_transform);
1862
1863 // east flange
1864 G4Tubs* ef_1_a = new G4Tubs("ef_1_a", ef_1_a_rin *CLHEP::mm, ef_1_a_rout *CLHEP::mm, 0.5 * ef_1_a_thick *CLHEP::mm, 0, angle2pi);
1865 G4Tubs* ef_2_a = new G4Tubs("ef_2_a", ef_2_a_rin *CLHEP::mm, ef_2_a_rout *CLHEP::mm, 0.5 * ef_2_a_thick *CLHEP::mm, 0, angle2pi);
1866 G4Tubs* ef_3 = new G4Tubs("ef_3", ef_3_rin *CLHEP::mm, ef_3_rout *CLHEP::mm, 0.5 * ef_3_thick *CLHEP::mm, 0, angle2pi);
1867 G4Tubs* ef_4 = new G4Tubs("ef_4", ef_4_rin *CLHEP::mm, ef_4_rout *CLHEP::mm, 0.5 * ef_4_thick *CLHEP::mm, 0, angle2pi);
1868
1869 // pink flange
1870 G4Tubs* pf_1 = new G4Tubs("pf_1", pf_1_rin*CLHEP::mm, pf_1_rout*CLHEP::mm, 0.5 * pf_1_thick *CLHEP::mm, 0, angle2pi);
1871 G4Tubs* pf_2 = new G4Tubs("pf_2", pf_2_rin*CLHEP::mm, pf_2_rout*CLHEP::mm, 0.5 * pf_2_thick *CLHEP::mm, 0, angle2pi);
1872 G4Cons* pf_3 = new G4Cons("pf_3",
1873 pf_3_0_rin *CLHEP::mm, pf_3_0_rout *CLHEP::mm,
1874 pf_3_1_rin *CLHEP::mm, pf_3_1_rout *CLHEP::mm,
1875 0.5 * pf_3_thick *CLHEP::mm, 0, angle2pi);
1876
1877 G4Box *pf_brick = new G4Box("pf_brick", 0.5* pf_brick_x *CLHEP::mm, 0.5* pf_brick_y*CLHEP::mm, 0.5* pf_brick_z*CLHEP::mm);
1878
1879 double pf_arc_dphi = 74.33;
1880 G4Tubs* pf_arc = new G4Tubs("pf_arc", 132. *CLHEP::mm, 155. *CLHEP::mm, 0.5*9. *CLHEP::mm, - 0.5 * pf_arc_dphi *CLHEP::deg, pf_arc_dphi *CLHEP::deg);
1881
1882 // pf side
1883 double pf_side_0_l = 84 *CLHEP::mm;
1884 double pf_side_0_R = 132. *CLHEP::mm;
1885 double pf_side_0_dphi = pf_side_0_l/pf_side_0_R;
1886 G4Cons* pf_side_0 = new G4Cons("pf_side_0",
1887 pf_side_0_0_rin *CLHEP::mm, pf_side_0_0_rout *CLHEP::mm,
1888 pf_side_0_1_rin *CLHEP::mm, pf_side_0_1_rout *CLHEP::mm,
1889 0.5 * pf_side_0_thick *CLHEP::mm, - 0.5 * pf_side_0_dphi *CLHEP::rad, pf_side_0_dphi *CLHEP::rad);
1890 double pf_side_1_dphi = 90 - pf_arc_dphi;
1891 G4Cons* pf_side_1 = new G4Cons("pf_side_1",
1892 pf_side_1_0_rin *CLHEP::mm, pf_side_1_0_rout *CLHEP::mm,
1893 pf_side_1_1_rin *CLHEP::mm, pf_side_1_1_rout *CLHEP::mm,
1894 0.5 * pf_side_1_thick *CLHEP::mm, -0.5 * pf_side_1_dphi*CLHEP::deg, pf_side_1_dphi*CLHEP::deg);
1895
1896
1897 // shield
1898 G4Cons* sh = new G4Cons("sh",
1899 sh_0_rin *CLHEP::mm, sh_0_rout *CLHEP::mm,
1900 sh_1_rin *CLHEP::mm, sh_1_rout *CLHEP::mm,
1901 0.5 * sh_thick *CLHEP::mm, 0, angle2pi);
1902
1903 // connecting bracket east (6 bricks)
1904 G4Box *cbe_brick = new G4Box("cbe_brick", 0.5* 38.5*CLHEP::mm, 0.5* 18.*CLHEP::mm, 0.5* 13*CLHEP::mm);
1905
1906
1907
1908 // logical
1909 G4LogicalVolume* as_L1_1_L = new G4LogicalVolume(as_L1_1, m_M_Permaglas, "as_L1_1_L", 0, 0, 0);
1910 G4LogicalVolume* as_L1_2_L = new G4LogicalVolume(as_L1_2, m_M_Permaglas, "as_L1_2_L", 0, 0, 0);
1911 G4LogicalVolume* as_L1_3_L = new G4LogicalVolume(as_L1_3, m_M_Permaglas, "as_L1_3_L", 0, 0, 0);
1912 G4LogicalVolume* as_L1_4_L = new G4LogicalVolume(as_L1_4, m_M_Permaglas, "as_L1_4_L", 0, 0, 0);
1913
1914 G4LogicalVolume* as_L2_1_L = new G4LogicalVolume(as_L2_1, m_M_Permaglas, "as_L2_1_L", 0, 0, 0);
1915 G4LogicalVolume* as_L2_2_L = new G4LogicalVolume(as_L2_2, m_M_Permaglas, "as_L2_2_L", 0, 0, 0);
1916 G4LogicalVolume* as_L2_3_L = new G4LogicalVolume(as_L2_3, m_M_Permaglas, "as_L2_3_L", 0, 0, 0);
1917 G4LogicalVolume* as_L2_4_L = new G4LogicalVolume(as_L2_4, m_M_Permaglas, "as_L2_4_L", 0, 0, 0);
1918 G4LogicalVolume* as_L2_5_L = new G4LogicalVolume(as_L2_5, m_M_Permaglas, "as_L2_5_L", 0, 0, 0);
1919
1920 G4LogicalVolume* as_L3_1_L = new G4LogicalVolume(as_L3_1, m_M_Permaglas, "as_L3_1_L", 0, 0, 0);
1921 G4LogicalVolume* as_L3_2_L = new G4LogicalVolume(as_L3_2, m_M_Permaglas, "as_L3_2_L", 0, 0, 0);
1922 G4LogicalVolume* as_L3_3_L = new G4LogicalVolume(as_L3_3, m_M_Permaglas, "as_L3_3_L", 0, 0, 0);
1923 G4LogicalVolume* as_L3_4_L = new G4LogicalVolume(as_L3_4, m_M_Permaglas, "as_L3_4_L", 0, 0, 0);
1924 G4LogicalVolume* as_L3_5_L = new G4LogicalVolume(as_L3_5, m_M_Permaglas, "as_L3_5_L", 0, 0, 0);
1925
1926 G4LogicalVolume* cfo_1_L = new G4LogicalVolume(cfo_1, m_M_Permaglas, "cfo_1_L", 0, 0, 0);
1927 G4LogicalVolume* cfo_2_L = new G4LogicalVolume(cfo_2, m_M_Permaglas, "cfo_2_L", 0, 0, 0);
1928 G4LogicalVolume* cfo_brick_L = new G4LogicalVolume(cfo_brick, m_M_Permaglas, "cfo_brick_L", 0, 0, 0);
1929
1930 G4LogicalVolume* ef_1_a_L = new G4LogicalVolume(ef_1_a, m_M_Aluminum, "ef_1_a_L", 0, 0, 0);
1931 G4LogicalVolume* ef_2_a_L = new G4LogicalVolume(ef_2_a, m_M_Aluminum, "ef_2_a_L", 0, 0, 0);
1932 G4LogicalVolume* ef_3_L = new G4LogicalVolume(ef_3, m_M_Aluminum, "ef_3_L", 0, 0, 0);
1933 G4LogicalVolume* ef_4_L = new G4LogicalVolume(ef_4, m_M_Aluminum, "ef_4_L", 0, 0, 0);
1934
1935 G4LogicalVolume* pf_1_L = new G4LogicalVolume(pf_1, m_M_Permaglas, "pf_1_L", 0, 0, 0);
1936 G4LogicalVolume* pf_2_L = new G4LogicalVolume(pf_2, m_M_Permaglas, "pf_2_L", 0, 0, 0);
1937 G4LogicalVolume* pf_3_L = new G4LogicalVolume(pf_3, m_M_Permaglas, "pf_3_L", 0, 0, 0);
1938 G4LogicalVolume* pf_arc_L = new G4LogicalVolume(pf_arc, m_M_Aluminum, "pf_arc_L", 0, 0, 0);
1939 G4LogicalVolume* pf_brick_L = new G4LogicalVolume(pf_brick, m_M_Aluminum, "pf_brick_L", 0, 0, 0);
1940 G4LogicalVolume* pf_side_0_L = new G4LogicalVolume(pf_side_0, m_M_Permaglas, "pf_side_0_L", 0, 0, 0);
1941 G4LogicalVolume* pf_side_1_L = new G4LogicalVolume(pf_side_1, m_M_Permaglas, "pf_side_1_L", 0, 0, 0);
1942
1943 G4LogicalVolume* sh_L = new G4LogicalVolume(sh, m_M_Aluminum, "sh_L", 0, 0, 0);
1944
1945 G4LogicalVolume* cbe_brick_L = new G4LogicalVolume(cbe_brick, m_M_Permaglas, "cbe_brick_L", 0, 0, 0);
1946 // materiali
1947 // Al
1948 G4VisAttributes Al_attributes;
1949 Al_attributes.SetForceSolid(true);
1950 Al_attributes.SetColor(G4Color::Grey());
1951 as_L1_1_L->SetVisAttributes(Al_attributes);
1952 as_L1_2_L->SetVisAttributes(Al_attributes);
1953 as_L1_3_L->SetVisAttributes(Al_attributes);
1954
1955 as_L2_2_L->SetVisAttributes(Al_attributes);
1956 as_L2_3_L->SetVisAttributes(Al_attributes);
1957 as_L2_5_L->SetVisAttributes(Al_attributes);
1958
1959 as_L3_3_L->SetVisAttributes(Al_attributes);
1960 as_L3_5_L->SetVisAttributes(Al_attributes);
1961
1962 ef_1_a_L->SetVisAttributes(Al_attributes);
1963 ef_2_a_L->SetVisAttributes(Al_attributes);
1964 ef_3_L->SetVisAttributes(Al_attributes);
1965 ef_4_L->SetVisAttributes(Al_attributes);
1966
1967 pf_arc_L->SetVisAttributes(Al_attributes);
1968 pf_brick_L->SetVisAttributes(Al_attributes);
1969
1970 sh_L->SetVisAttributes(Al_attributes);
1971
1972 // permaglas
1973 G4VisAttributes PER_attributes;
1974 PER_attributes.SetForceSolid(true);
1975 PER_attributes.SetColor(G4Color::Yellow());
1976
1977 as_L1_4_L->SetVisAttributes(PER_attributes);
1978
1979 as_L2_1_L->SetVisAttributes(PER_attributes);
1980 as_L2_4_L->SetVisAttributes(PER_attributes);
1981
1982 as_L3_1_L->SetVisAttributes(PER_attributes);
1983 as_L3_2_L->SetVisAttributes(PER_attributes);
1984 as_L3_4_L->SetVisAttributes(PER_attributes);
1985
1986 cfo_1_L->SetVisAttributes(PER_attributes);
1987 cfo_2_L->SetVisAttributes(PER_attributes);
1988 cfo_brick_L->SetVisAttributes(PER_attributes);
1989 cbe_brick_L->SetVisAttributes(PER_attributes);
1990
1991 pf_1_L->SetVisAttributes(PER_attributes);
1992 pf_2_L->SetVisAttributes(PER_attributes);
1993 pf_3_L->SetVisAttributes(PER_attributes);
1994 pf_side_0_L->SetVisAttributes(PER_attributes);
1995 pf_side_1_L->SetVisAttributes(PER_attributes);
1996
1997 /**
1998 // colori
1999 G4VisAttributes as_1_attributes;
2000 as_1_attributes.SetForceSolid(true);
2001 as_1_attributes.SetColor(1, 0, 0);
2002 as_L1_1_L->SetVisAttributes(as_1_attributes);
2003 as_L1_2_L->SetVisAttributes(as_1_attributes);
2004 as_L1_3_L->SetVisAttributes(as_1_attributes);
2005 as_L1_4_L->SetVisAttributes(as_1_attributes);
2006
2007 G4VisAttributes as_2_attributes;
2008 as_2_attributes.SetForceSolid(true);
2009 as_2_attributes.SetColor(0, 1, 0);
2010 as_L2_1_L->SetVisAttributes(as_2_attributes);
2011 as_L2_2_L->SetVisAttributes(as_2_attributes);
2012 as_L2_3_L->SetVisAttributes(as_2_attributes);
2013 as_L2_4_L->SetVisAttributes(as_2_attributes);
2014 as_L2_5_L->SetVisAttributes(as_2_attributes);
2015
2016 G4VisAttributes as_3_attributes;
2017 as_3_attributes.SetForceSolid(true);
2018 as_3_attributes.SetColor(G4Color::Black());
2019 as_L3_1_L->SetVisAttributes(as_3_attributes);
2020 as_3_attributes.SetColor(G4Color::Red());
2021 as_L3_2_L->SetVisAttributes(as_3_attributes);
2022 as_3_attributes.SetColor(G4Color::Green());
2023 as_L3_3_L->SetVisAttributes(as_3_attributes);
2024 as_3_attributes.SetColor(G4Color::Blue());
2025 as_L3_4_L->SetVisAttributes(as_3_attributes);
2026 as_3_attributes.SetColor(G4Color::Yellow());
2027 as_L3_5_L->SetVisAttributes(as_3_attributes);
2028
2029 G4VisAttributes pf_attributes;
2030 pf_attributes.SetForceSolid(true);
2031 pf_attributes.SetColor(1, 0, 1);
2032 pf_1_L->SetVisAttributes(pf_attributes);
2033 pf_2_L->SetVisAttributes(pf_attributes);
2034 pf_3_L->SetVisAttributes(pf_attributes);
2035 pf_arc_L->SetVisAttributes(pf_attributes);
2036 pf_brick_L->SetVisAttributes(pf_attributes);
2037 pf_side_0_L->SetVisAttributes(pf_attributes);
2038 pf_side_1_L->SetVisAttributes(pf_attributes);
2039
2040 G4VisAttributes ot_attributes;
2041 ot_attributes.SetForceSolid(true);
2042 ot_attributes.SetColor(1, 1, 1);
2043 cfo_1_L->SetVisAttributes(ot_attributes);
2044 cfo_2_L->SetVisAttributes(ot_attributes);
2045 cfo_brick_L->SetVisAttributes(ot_attributes);
2046 ef_1_L->SetVisAttributes(ot_attributes);
2047 ef_2_L->SetVisAttributes(ot_attributes);
2048 sh_L->SetVisAttributes(ot_attributes);
2049 cbe_brick_L->SetVisAttributes(ot_attributes);
2050 **/
2051
2052 // EAST FLANGE -----------------
2053 // ASSEMBLY FOR EAST FLANGE
2054 G4AssemblyVolume *common_supp = new G4AssemblyVolume();
2055
2056 G4ThreeVector position;
2057
2058 // assembly 1
2059 position.set(0, 0, (z_as_L1_1_eP - zref) * CLHEP::mm);
2060 common_supp->AddPlacedVolume(as_L1_1_L, position, 0);
2061 position.set(0, 0, (z_as_L1_2_eP - zref)*CLHEP::mm);
2062 common_supp->AddPlacedVolume(as_L1_2_L, position, 0);
2063 position.set(0, 0, (z_as_L1_3_eP - zref)*CLHEP::mm);
2064 common_supp->AddPlacedVolume(as_L1_3_L, position, 0);
2065 position.set(0, 0, (z_as_L1_4_eP - zref)*CLHEP::mm);
2066 common_supp->AddPlacedVolume(as_L1_4_L, position, 0);
2067
2068 // assembly 2
2069 position.set(0, 0, (z_as_L2_1_eP - zref)*CLHEP::mm);
2070 common_supp->AddPlacedVolume(as_L2_1_L, position, 0);
2071 position.set(0, 0, (z_as_L2_2_eP - zref)*CLHEP::mm);
2072 common_supp->AddPlacedVolume(as_L2_2_L, position, 0);
2073 position.set(0, 0, (z_as_L2_3_eP - zref)*CLHEP::mm);
2074 common_supp->AddPlacedVolume(as_L2_3_L, position, 0);
2075 position.set(0, 0, (z_as_L2_4_eP - zref)*CLHEP::mm);
2076 common_supp->AddPlacedVolume(as_L2_4_L, position, 0);
2077 position.set(0, 0, (z_as_L2_5_eP - zref)*CLHEP::mm);
2078 common_supp->AddPlacedVolume(as_L2_5_L, position, 0);
2079
2080
2081 // assembly 3
2082 position.set(0, 0, (z_as_L3_1_eP - zref)*CLHEP::mm);
2083 common_supp->AddPlacedVolume(as_L3_1_L, position, 0);
2084 position.set(0, 0, (z_as_L3_2_eP - zref)*CLHEP::mm);
2085 common_supp->AddPlacedVolume(as_L3_2_L, position, 0);
2086 position.set(0, 0, (z_as_L3_3_eP - zref)*CLHEP::mm);
2087 common_supp->AddPlacedVolume(as_L3_3_L, position, 0);
2088 position.set(0, 0, (z_as_L3_4_eP - zref)*CLHEP::mm);
2089 common_supp->AddPlacedVolume(as_L3_4_L, position, 0);
2090 position.set(0, 0, (z_as_L3_5_eP - zref)*CLHEP::mm);
2091 common_supp->AddPlacedVolume(as_L3_5_L, position, 0);
2092
2093
2094 // connecting flange out
2095 position.set(0, 0, (z_cfo_1_eP - zref)*CLHEP::mm);
2096 common_supp->AddPlacedVolume(cfo_1_L, position, 0);
2097 position.set(0, 0, (z_cfo_2_eP - zref)*CLHEP::mm);
2098 common_supp->AddPlacedVolume(cfo_2_L, position, 0);
2099
2100 /**
2101 double cfo_angle = 83 *CLHEP::deg;
2102 G4RotationMatrix *cfo_brick_1_rot = new G4RotationMatrix();
2103 cfo_brick_1_rot->rotateZ(cfo_angle);
2104 position.set(0, 0, z_cfo_2_eP - zref - 0.5 * cfo_brick_2_z);
2105 common_supp->AddPlacedVolume(cfo_brick_L, position, cfo_brick_1_rot);
2106
2107 cfo_angle = 157.5 *CLHEP::deg;
2108 G4RotationMatrix *cfo_brick_2_rot = new G4RotationMatrix();
2109 cfo_brick_2_rot->rotateZ(cfo_angle);
2110 common_supp->AddPlacedVolume(cfo_brick_L, position, cfo_brick_2_rot);
2111
2112 cfo_angle = 263 *CLHEP::deg;
2113 G4RotationMatrix *cfo_brick_3_rot = new G4RotationMatrix();
2114 cfo_brick_3_rot->rotateZ(cfo_angle);
2115 common_supp->AddPlacedVolume(cfo_brick_L, position, cfo_brick_3_rot);
2116
2117 cfo_angle = 337.5 *CLHEP::deg;
2118 G4RotationMatrix *cfo_brick_4_rot = new G4RotationMatrix();
2119 cfo_brick_4_rot->rotateZ(cfo_angle);
2120 common_supp->AddPlacedVolume(cfo_brick_L, position, cfo_brick_4_rot);
2121 **/
2122
2123 // east flange
2124 position.set(0, 0, z_ef_1_a_eP - zref);
2125 common_supp->AddPlacedVolume(ef_1_a_L, position, 0);
2126 position.set(0, 0, z_ef_2_a_eP - zref);
2127 common_supp->AddPlacedVolume(ef_2_a_L, position, 0);
2128
2129 // pink flange
2130 position.set(0, 0, z_pf_1_eP - zref);
2131 common_supp->AddPlacedVolume(pf_1_L, position, 0);
2132 position.set(0, 0, z_pf_2_eP - zref);
2133 common_supp->AddPlacedVolume(pf_2_L, position, 0);
2134 position.set(0, 0, z_pf_3_eP - zref);
2135 common_supp->AddPlacedVolume(pf_3_L, position, 0);
2136
2137 position.set(0, 0, z_pf_arc_eP - zref);
2138 common_supp->AddPlacedVolume(pf_arc_L, position, 0);
2139
2140 G4RotationMatrix *pf_arc_2_rot = new G4RotationMatrix();
2141 pf_arc_2_rot->rotateZ(-90. *CLHEP::deg);
2142 position.set(0, 0, z_pf_arc_eP - zref);
2143 common_supp->AddPlacedVolume(pf_arc_L, position, pf_arc_2_rot);
2144
2145 G4RotationMatrix *pf_arc_3_rot = new G4RotationMatrix();
2146 pf_arc_3_rot->rotateZ(-180. *CLHEP::deg);
2147 position.set(0, 0, z_pf_arc_eP - zref);
2148 common_supp->AddPlacedVolume(pf_arc_L, position, pf_arc_3_rot);
2149
2150 G4RotationMatrix *pf_arc_4_rot = new G4RotationMatrix();
2151 pf_arc_4_rot->rotateZ(-270. *CLHEP::deg);
2152 position.set(0, 0, z_pf_arc_eP - zref);
2153 common_supp->AddPlacedVolume(pf_arc_L, position, pf_arc_4_rot);
2154
2155 double pf_angle = 45 *CLHEP::deg; double pf_rad = pf_side_1_0_rout + 0.5*pf_brick_y;
2156 position.set(pf_rad * cos(pf_angle), pf_rad * sin(pf_angle), z_pf_brick_eP - zref);
2157 G4RotationMatrix *pf_brick_1_rot = new G4RotationMatrix();
2158 pf_brick_1_rot->rotateZ(-pf_angle);
2159 common_supp->AddPlacedVolume(pf_brick_L, position, pf_brick_1_rot);
2160
2161 position.set(pf_rad * cos(3*pf_angle), pf_rad * sin(3*pf_angle), z_pf_brick_eP - zref);
2162 G4RotationMatrix *pf_brick_2_rot = new G4RotationMatrix();
2163 pf_brick_2_rot->rotateZ(pf_angle);
2164 common_supp->AddPlacedVolume(pf_brick_L, position, pf_brick_2_rot);
2165
2166 position.set(pf_rad * cos(5*pf_angle), pf_rad * sin(5*pf_angle), z_pf_brick_eP - zref);
2167 G4RotationMatrix *pf_brick_3_rot = new G4RotationMatrix();
2168 pf_brick_3_rot->rotateZ(3*pf_angle);
2169 common_supp->AddPlacedVolume(pf_brick_L, position, pf_brick_3_rot);
2170
2171 position.set(pf_rad * cos(7*pf_angle), pf_rad * sin(7*pf_angle), z_pf_brick_eP - zref);
2172 G4RotationMatrix *pf_brick_4_rot = new G4RotationMatrix();
2173 pf_brick_4_rot->rotateZ(-3*pf_angle);
2174 common_supp->AddPlacedVolume(pf_brick_L, position, pf_brick_4_rot);
2175
2176 double pf_side_0_angle = 45. *CLHEP::deg;
2177 // double pf_side_0_rad = 114.58 *CLHEP::mm;
2178 position.set(0, 0, z_pf_side_0_eP - zref);
2179 G4RotationMatrix * pf_side_0_1_rot = new G4RotationMatrix();
2180 pf_side_0_1_rot->rotateZ(pf_side_0_angle);
2181 common_supp->AddPlacedVolume(pf_side_0_L, position, pf_side_0_1_rot);
2182 position.set(0, 0, z_pf_side_1_eP - zref);
2183 common_supp->AddPlacedVolume(pf_side_1_L, position, pf_side_0_1_rot);
2184
2185 position.set(0, 0, z_pf_side_0_eP - zref);
2186 G4RotationMatrix * pf_side_0_2_rot = new G4RotationMatrix();
2187 pf_side_0_2_rot->rotateZ(3*pf_side_0_angle);
2188 common_supp->AddPlacedVolume(pf_side_0_L, position, pf_side_0_2_rot);
2189 position.set(0, 0, z_pf_side_1_eP - zref);
2190 common_supp->AddPlacedVolume(pf_side_1_L, position, pf_side_0_2_rot);
2191
2192 position.set(0, 0, z_pf_side_0_eP - zref);
2193 G4RotationMatrix * pf_side_0_3_rot = new G4RotationMatrix();
2194 pf_side_0_3_rot->rotateZ(5*pf_side_0_angle);
2195 common_supp->AddPlacedVolume(pf_side_0_L, position, pf_side_0_3_rot);
2196 position.set(0, 0, z_pf_side_1_eP - zref);
2197 common_supp->AddPlacedVolume(pf_side_1_L, position, pf_side_0_3_rot);
2198
2199 position.set(0, 0, z_pf_side_0_eP - zref);
2200 G4RotationMatrix * pf_side_0_4_rot = new G4RotationMatrix();
2201 pf_side_0_4_rot->rotateZ(7*pf_side_0_angle);
2202 common_supp->AddPlacedVolume(pf_side_0_L, position, pf_side_0_4_rot);
2203 position.set(0, 0, z_pf_side_1_eP - zref);
2204 common_supp->AddPlacedVolume(pf_side_1_L, position, pf_side_0_4_rot);
2205
2206 // shield
2207 // position.set(0, 0, z_sh_eP - zref);
2208 // common_supp->AddPlacedVolume(sh_L, position, 0);
2209 // ONLY EAST
2210
2211 double cfo_angle = 97 *CLHEP::deg;
2212 G4RotationMatrix *cfo_brick_1_rot = new G4RotationMatrix();
2213 cfo_brick_1_rot->rotateZ(cfo_angle);
2214 position.set(0, 0, z_cfo_2_eP - zref - 0.5 * cfo_brick_2_z + z_shift);
2215 G4VPhysicalVolume* cfo_brick_1_eP = new G4PVPlacement(cfo_brick_1_rot, position, cfo_brick_L,
2216 "cfo_brick_1_eP", cable_e_L, false, 0, m_CheckOverlaps);
2217
2218 cfo_angle = 22.5 *CLHEP::deg;
2219 G4RotationMatrix *cfo_brick_2_rot = new G4RotationMatrix();
2220 cfo_brick_2_rot->rotateZ(cfo_angle);
2221 G4VPhysicalVolume* cfo_brick_2_eP = new G4PVPlacement(cfo_brick_2_rot, position, cfo_brick_L,
2222 "cfo_brick_2_eP", cable_e_L, false, 1, m_CheckOverlaps);
2223
2224 cfo_angle = 276.5 *CLHEP::deg;
2225 G4RotationMatrix *cfo_brick_3_rot = new G4RotationMatrix();
2226 cfo_brick_3_rot->rotateZ(cfo_angle);
2227 G4VPhysicalVolume* cfo_brick_3_eP = new G4PVPlacement(cfo_brick_3_rot, position, cfo_brick_L,
2228 "cfo_brick_3_eP", cable_e_L, false, 2, m_CheckOverlaps);
2229
2230 cfo_angle = 202.5 *CLHEP::deg;
2231 G4RotationMatrix *cfo_brick_4_rot = new G4RotationMatrix();
2232 cfo_brick_4_rot->rotateZ(cfo_angle);
2233 G4VPhysicalVolume* cfo_brick_4_eP = new G4PVPlacement(cfo_brick_4_rot, position, cfo_brick_L,
2234 "cfo_brick_4_eP", cable_e_L, false, 3, m_CheckOverlaps);
2235
2236
2237 double cbe_rangle = 64.3 *CLHEP::deg; double cbe_angle = 51.4 *CLHEP::deg; double cbe_rad = 132.5 *CLHEP::mm;
2238 G4RotationMatrix * cbe_brick_1_rot = new G4RotationMatrix(); cbe_brick_1_rot->rotateZ(-cbe_rangle);
2239 G4VPhysicalVolume* cbe_brick_1_eP = new G4PVPlacement(cbe_brick_1_rot,
2240 G4ThreeVector(cbe_rad * cos(cbe_rangle),
2241 cbe_rad * sin(cbe_rangle),
2242 z_cbe_brick_eP - zref + z_shift),
2243 cbe_brick_L, "cbe_brick_1_eP", cable_e_L, false, 1, m_CheckOverlaps);
2244 G4VPhysicalVolume* cbe_brick_4_eP = new G4PVPlacement(cbe_brick_1_rot,
2245 G4ThreeVector(cbe_rad * cos(CLHEP::pi+cbe_rangle),
2246 cbe_rad * sin(CLHEP::pi+cbe_rangle),
2247 z_cbe_brick_eP - zref + z_shift),
2248 cbe_brick_L, "cbe_brick_4_eP", cable_e_L, false, 4, m_CheckOverlaps);
2249
2250 cbe_rangle += cbe_angle;
2251 G4RotationMatrix * cbe_brick_2_rot = new G4RotationMatrix(); cbe_brick_2_rot->rotateZ(-cbe_rangle);
2252 G4VPhysicalVolume* cbe_brick_2_eP = new G4PVPlacement(cbe_brick_2_rot,
2253 G4ThreeVector(cbe_rad * cos(cbe_rangle),
2254 cbe_rad * sin(cbe_rangle),
2255 z_cbe_brick_eP - zref + z_shift),
2256 cbe_brick_L, "cbe_brick_2_eP", cable_e_L, false, 2, m_CheckOverlaps);
2257 G4VPhysicalVolume* cbe_brick_5_eP = new G4PVPlacement(cbe_brick_2_rot,
2258 G4ThreeVector(cbe_rad * cos(CLHEP::pi+cbe_rangle),
2259 cbe_rad * sin(CLHEP::pi+cbe_rangle),
2260 z_cbe_brick_eP - zref + z_shift),
2261 cbe_brick_L, "cbe_brick_5_eP", cable_e_L, false, 5, m_CheckOverlaps);
2262
2263 cbe_rangle += cbe_angle;
2264 G4RotationMatrix * cbe_brick_3_rot = new G4RotationMatrix(); cbe_brick_3_rot->rotateZ(-cbe_rangle);
2265 G4VPhysicalVolume* cbe_brick_3_eP = new G4PVPlacement(cbe_brick_3_rot,
2266 G4ThreeVector(cbe_rad * cos(cbe_rangle),
2267 cbe_rad * sin(cbe_rangle),
2268 z_cbe_brick_eP - zref + z_shift),
2269 cbe_brick_L, "cbe_brick_3_eP", cable_e_L, false, 3, m_CheckOverlaps);
2270 G4VPhysicalVolume* cbe_brick_6_eP = new G4PVPlacement(cbe_brick_3_rot,
2271 G4ThreeVector(cbe_rad * cos(CLHEP::pi+cbe_rangle),
2272 cbe_rad * sin(CLHEP::pi+cbe_rangle),
2273 z_cbe_brick_eP - zref + z_shift),
2274 cbe_brick_L, "cbe_brick_6_eP", cable_e_L, false, 6, m_CheckOverlaps);
2275
2276 double ef_east_thick = 4;
2277 G4Tubs* ef_east = new G4Tubs("ef_east", ef_2_a_rin *CLHEP::mm, ef_4_rout *CLHEP::mm, 0.5 * ef_east_thick*CLHEP::mm, 0, angle2pi);
2278 G4LogicalVolume* ef_east_L = new G4LogicalVolume(ef_east, m_M_Aluminum, "ef_east_L", 0, 0, 0);
2279 double z_ef_east = z_ef_1_eP + 0.5*ef_1_thick + ef_2_thick+0.5*ef_east_thick;
2280 G4VPhysicalVolume* ef_east_eP = new G4PVPlacement(0, G4ThreeVector(0., 0., z_ef_east), ef_east_L, "ef_east_eP", logicCgem, false, 0, m_CheckOverlaps);
2281 ef_east_L->SetVisAttributes(Al_attributes);
2282
2283 // ONLY WEST
2284 double cfo_w_angle = -55. *CLHEP::deg;
2285 G4RotationMatrix *cfo_w_brick_1_rot = new G4RotationMatrix();
2286 cfo_w_brick_1_rot->rotateZ(cfo_w_angle);
2287 position.set(0, 0, z_cfo_2_eP - zref - 0.5 * cfo_brick_2_z + z_shift);
2288 G4VPhysicalVolume* cfo_w_brick_1_eP = new G4PVPlacement(cfo_w_brick_1_rot, position, cfo_brick_L,
2289 "cfo_w_brick_1_eP", cable_w_L, false, 1, m_CheckOverlaps);
2290 cfo_w_angle = -160 *CLHEP::deg;
2291 G4RotationMatrix *cfo_w_brick_2_rot = new G4RotationMatrix();
2292 cfo_w_brick_2_rot->rotateZ(cfo_w_angle);
2293 G4VPhysicalVolume* cfo_w_brick_2_eP = new G4PVPlacement(cfo_w_brick_2_rot, position, cfo_brick_L,
2294 "cfo_w_brick_2_eP", cable_w_L, false, 2, m_CheckOverlaps);
2295 cfo_w_angle = -235 *CLHEP::deg;
2296 G4RotationMatrix *cfo_w_brick_3_rot = new G4RotationMatrix();
2297 cfo_w_brick_3_rot->rotateZ(cfo_w_angle);
2298 G4VPhysicalVolume* cfo_w_brick_3_eP = new G4PVPlacement(cfo_w_brick_3_rot, position, cfo_brick_L,
2299 "cfo_w_brick_3_eP", cable_w_L, false, 3, m_CheckOverlaps);
2300 cfo_w_angle = -340. *CLHEP::deg;
2301 G4RotationMatrix *cfo_w_brick_4_rot = new G4RotationMatrix();
2302 cfo_w_brick_4_rot->rotateZ(cfo_w_angle);
2303 G4VPhysicalVolume* cfo_w_brick_4_eP = new G4PVPlacement(cfo_w_brick_4_rot, position, cfo_brick_L,
2304 "cfo_w_brick_4_eP", cable_w_L, false, 4, m_CheckOverlaps);
2305 // new west ring
2306 G4Tubs* nwr_1_a = new G4Tubs("nwr_1_a", nwr_1_a_rin *CLHEP::mm, nwr_1_a_rout *CLHEP::mm, 0.5 * nwr_1_a_thick *CLHEP::mm, 0, angle2pi);
2307 G4Tubs* nwr_1_b = new G4Tubs("nwr_1_b", nwr_1_b_rin *CLHEP::mm, nwr_1_b_rout *CLHEP::mm, 0.5 * nwr_1_b_thick *CLHEP::mm, 0, angle2pi);
2308 G4Tubs* nwr_2 = new G4Tubs("nwr_2", nwr_2_rin *CLHEP::mm, nwr_2_rout *CLHEP::mm, 0.5 * nwr_2_thick *CLHEP::mm, 0, angle2pi);
2309
2310 // connecting bracket
2311 G4Box *w_brick = new G4Box("w_brick", 0.5 * w_brick_x *CLHEP::mm, 0.5 * w_brick_y *CLHEP::mm, 0.5* w_brick_z *CLHEP::mm); // 4 elem
2312
2313 // log
2314 G4LogicalVolume* nwr_1_a_L = new G4LogicalVolume(nwr_1_a, m_M_Aluminum, "nwr_1_a_L", 0, 0, 0);
2315 G4LogicalVolume* nwr_1_b_L = new G4LogicalVolume(nwr_1_b, m_M_Aluminum, "nwr_1_b_L", 0, 0, 0);
2316 G4LogicalVolume* nwr_2_L = new G4LogicalVolume(nwr_2, m_M_Aluminum, "nwr_2_L", 0, 0, 0);
2317 G4LogicalVolume* w_brick_L = new G4LogicalVolume(w_brick, m_M_Permaglas, "w_brick_L", 0, 0, 0);
2318
2319 nwr_1_a_L->SetVisAttributes(Al_attributes);
2320 nwr_1_b_L->SetVisAttributes(Al_attributes);
2321 nwr_2_L->SetVisAttributes(Al_attributes);
2322 w_brick_L->SetVisAttributes(PER_attributes);
2323
2324 // phy
2325 G4VPhysicalVolume* nwr_1_a_wP = new G4PVPlacement(0, G4ThreeVector(0, 0, z_nwr_1_wP - zref_w + z_shift), nwr_1_a_L, "nwr_1_a_wP", cable_w_L, false, 0, m_CheckOverlaps);
2326
2327 double w_rangle = 38.6 *CLHEP::deg; double w_angle = 25.7 *CLHEP::deg; double w_rad = 133.25 *CLHEP::mm;
2328 G4RotationMatrix * w_brick_1_rot = new G4RotationMatrix(); w_brick_1_rot->rotateZ(-w_rangle);
2329 G4VPhysicalVolume* w_brick_1_wP = new G4PVPlacement(w_brick_1_rot,
2330 G4ThreeVector(w_rad * cos(w_rangle),
2331 w_rad * sin(w_rangle),
2332 z_w_brick_wP - zref_w + z_shift),
2333 w_brick_L, "w_brick_1_wP", cable_w_L, false, 1, m_CheckOverlaps);
2334 G4VPhysicalVolume* w_brick_5_wP = new G4PVPlacement(w_brick_1_rot,
2335 G4ThreeVector(w_rad * cos(CLHEP::pi+w_rangle),
2336 w_rad * sin(CLHEP::pi+w_rangle),
2337 z_w_brick_wP - zref_w + z_shift),
2338 w_brick_L, "w_brick_5_wP", cable_w_L,false, 5, m_CheckOverlaps);
2339
2340 w_rangle += w_angle;
2341 G4RotationMatrix * w_brick_2_rot = new G4RotationMatrix(); w_brick_2_rot->rotateZ(-w_rangle);
2342 G4VPhysicalVolume* w_brick_2_wP = new G4PVPlacement(w_brick_2_rot,
2343 G4ThreeVector(w_rad * cos(w_rangle),
2344 w_rad * sin(w_rangle),
2345 z_w_brick_wP - zref_w + z_shift),
2346 w_brick_L, "w_brick_2_wP", cable_w_L,false, 2, m_CheckOverlaps);
2347 G4VPhysicalVolume* w_brick_6_wP = new G4PVPlacement(w_brick_2_rot,
2348 G4ThreeVector(w_rad * cos(CLHEP::pi+w_rangle),
2349 w_rad * sin(CLHEP::pi+w_rangle),
2350 z_w_brick_wP - zref_w + z_shift),
2351 w_brick_L, "w_brick_6_wP", cable_w_L,false, 6, m_CheckOverlaps);
2352
2353 w_rangle += w_angle;
2354 G4RotationMatrix * w_brick_3_rot = new G4RotationMatrix(); w_brick_3_rot->rotateZ(-w_rangle);
2355 G4VPhysicalVolume* w_brick_3_wP = new G4PVPlacement(w_brick_3_rot,
2356 G4ThreeVector(w_rad * cos(w_rangle),
2357 w_rad * sin(w_rangle),
2358 z_w_brick_wP - zref_w + z_shift),
2359 w_brick_L, "w_brick_3_wP", cable_w_L,false, 3, m_CheckOverlaps);
2360 G4VPhysicalVolume* w_brick_7_wP = new G4PVPlacement(w_brick_3_rot,
2361 G4ThreeVector(w_rad * cos(CLHEP::pi+w_rangle),
2362 w_rad * sin(CLHEP::pi+w_rangle),
2363 z_w_brick_wP - zref_w + z_shift),
2364 w_brick_L, "w_brick_7_wP", cable_w_L,false, 7,m_CheckOverlaps);
2365
2366 w_rangle += w_angle;
2367 G4RotationMatrix * w_brick_4_rot = new G4RotationMatrix(); w_brick_4_rot->rotateZ(-w_rangle);
2368 G4VPhysicalVolume* w_brick_4_wP = new G4PVPlacement(w_brick_4_rot,
2369 G4ThreeVector(w_rad * cos(w_rangle),
2370 w_rad * sin(w_rangle),
2371 z_w_brick_wP - zref_w + z_shift),
2372 w_brick_L, "w_brick_4_wP", cable_w_L,false, 4, m_CheckOverlaps);
2373 G4VPhysicalVolume* w_brick_8_wP = new G4PVPlacement(w_brick_4_rot,
2374 G4ThreeVector(w_rad * cos(CLHEP::pi+w_rangle),
2375 w_rad * sin(CLHEP::pi+w_rangle),
2376 z_w_brick_wP - zref_w + z_shift),
2377 w_brick_L, "w_brick_8_wP", cable_w_L,false, 8, m_CheckOverlaps);
2378
2379
2380
2381 // FINAL PLACEMENT ------------------------------------------------------------
2382 // shift of the assembly w.r.t the mother volume cable_L
2383 G4ThreeVector pos(0, 0, z_shift);
2384
2385 // EAST
2386 common_supp->MakeImprint(cable_e_L, pos, 0, m_CheckOverlaps);
2387 G4VPhysicalVolume* cable_e_P = new G4PVPlacement(0, G4ThreeVector(0, 0, zref), cable_e_L, "cable_e_P", logicCgem, lv_boolen, lv_copyNo, m_CheckOverlaps);
2388
2389 pos.set(0, 0, z_ef_3_eP);
2390 G4VPhysicalVolume* ef_3_eP = new G4PVPlacement(0, pos, ef_3_L, "ef_3_eP", logicCgem, 0, 0, m_CheckOverlaps);
2391 pos.set(0, 0, z_ef_4_eP);
2392 G4VPhysicalVolume* ef_4_eP = new G4PVPlacement(0, pos, ef_4_L, "ef_4_eP", logicCgem, 0, 0, m_CheckOverlaps);
2393
2394
2395 /**
2396 cout << "cable_e_P z " << cable_e_P->GetTranslation().getZ() << endl;
2397 cout << "ndaugthers " << cable_e_P->GetLogicalVolume()->GetNoDaughters() << endl;
2398 for(int id = 0; id < cable_e_P->GetLogicalVolume()->GetNoDaughters(); id++) {
2399 cout << cable_e_P->GetLogicalVolume()->GetDaughter(id)->GetName()
2400 << " " << cable_e_P->GetLogicalVolume()->GetDaughter(id)->GetTranslation().getZ()
2401 << endl;
2402 }
2403 **/
2404
2405
2406 // WEST
2407 pos.set(0, 0, z_shift);
2408 common_supp->MakeImprint(cable_w_L, pos, 0, m_CheckOverlaps);
2409 G4RotationMatrix *rot_west = new G4RotationMatrix();
2410 rot_west->rotateX(180 *CLHEP::deg);
2411 G4VPhysicalVolume* cable_w_P = new G4PVPlacement(rot_west, G4ThreeVector(0, 0, -zref), cable_w_L, "cable_w_P", logicCgem, lv_boolen, lv_copyNo, m_CheckOverlaps);
2412
2413 pos.set(0, 0, -z_ef_3_eP);
2414 G4VPhysicalVolume* ef_3_wP = new G4PVPlacement(rot_west, pos, ef_3_L, "ef_3_wP", logicCgem, 0, 1, m_CheckOverlaps);
2415 pos.set(0, 0, -z_ef_4_eP);
2416 G4VPhysicalVolume* ef_4_wP = new G4PVPlacement(rot_west, pos, ef_4_L, "ef_4_wP", logicCgem, 0, 1, m_CheckOverlaps);
2417
2418 pos.set(0, 0, -(z_nwr_1_wP+z_shift));
2419 G4VPhysicalVolume* nwr_1_b_wP = new G4PVPlacement(0, pos, nwr_1_b_L, "nwr_1_b_wP", logicCgem, false, 0, m_CheckOverlaps);
2420 bool ovl = nwr_1_b_wP->CheckOverlaps();
2421 cout << "nwr_1_b_wP re-check overlap " << ovl << endl;
2422
2423 pos.set(0, 0, -(z_nwr_2_wP+z_shift));
2424 G4VPhysicalVolume* nwr_2_wP = new G4PVPlacement(rot_west, pos, nwr_2_L, "nwr_2_wP", logicCgem, false, 0, m_CheckOverlaps);
2425 ovl= nwr_2_wP->CheckOverlaps();
2426
2427}
2428
2429//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
2430void BesCgemConstruction::ConstructMaterial()
2431{
2432 IMessageSvc* msgSvc;
2433 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
2434 MsgStream log(msgSvc, "BesCgemConstruction::ConstructMaterial()");
2435 log<< MSG::INFO << "INFO : BesCgemConstruction::ConstructMaterial(), Construct Material needed by Cgem!" << endreq;
2436
2437 /* Material defined by NIST Manager */
2438 G4NistManager *gv_NistManager = G4NistManager::Instance();
2439
2440 /* Air */
2441 m_M_Air = gv_NistManager -> FindOrBuildMaterial("G4_AIR");
2442
2443 /* copper */
2444 m_M_Cu = gv_NistManager -> FindOrBuildMaterial("G4_Cu");
2445
2446 /* Kapton */
2447 m_M_Kapton = gv_NistManager -> FindOrBuildMaterial("G4_KAPTON");
2448
2449 //std::cout<<"******************* Original material info **************************"<<std::endl;
2450 //G4cout << m_M_Cu << G4endl; G4cout << G4endl;
2451 //G4cout << m_M_Kapton << G4endl; G4cout << G4endl;
2452
2453 G4double lvd_density;
2454 G4double lvd_fractionmass;
2455 G4int lvi_element;
2456 G4int lvi_natoms;
2457 G4String lvs_name;
2458
2459 /* CgemGas, Ar:CO2 */
2460 /** lvs_name = "CgemGas";
2461 lvd_density = 0.001716043*g/cm3;
2462 lvi_element = 2;
2463 G4Material *lv_Ar = gv_NistManager->FindOrBuildMaterial("G4_Ar");
2464 G4Material *lv_CO2 = gv_NistManager->FindOrBuildMaterial("G4_CARBON_DIOXIDE");
2465 m_M_CgemGas = new G4Material(lvs_name, lvd_density, lvi_element);
2466 m_M_CgemGas -> AddMaterial(lv_Ar , lvd_fractionmass=0.677959119);
2467 m_M_CgemGas -> AddMaterial(lv_CO2, lvd_fractionmass=0.322040881);
2468 **/
2469
2470 /* CgemGas, Ar:i-C4H10 = Ar:Isobutane */
2471 lvs_name = "CgemGas";
2472 lvd_density = 0.0017451520*g/cm3;
2473 lvi_element = 2;
2474 G4Material *lv_Ar = gv_NistManager->FindOrBuildMaterial("G4_Ar");
2475 G4Material *lv_C4H10 = gv_NistManager->FindOrBuildMaterial("G4_BUTANE");
2476 m_M_CgemGas = new G4Material(lvs_name, lvd_density, lvi_element);
2477 m_M_CgemGas -> AddMaterial(lv_Ar , lvd_fractionmass=0.85712247);
2478 m_M_CgemGas -> AddMaterial(lv_C4H10, lvd_fractionmass=0.14287753);
2479
2480 // /* Honeycomb */
2481 // lvs_name = "Nomex";
2482 // lvd_density = 3.2e-2*g/cm3;
2483 // lvi_element = 4;
2484 // G4Element *C = G4Element::GetElement("Carbon");
2485 // G4Element *H = G4Element::GetElement("Hydrogen");
2486 // G4Element *O = G4Element::GetElement("Oxygen");
2487 // G4Element *N = G4Element::GetElement("Nitrogen");
2488 // m_M_Honeycomb = new G4Material(lvs_name, lvd_density, lvi_element);
2489 // m_M_Honeycomb -> AddElement(C, lvi_natoms=14);
2490 // m_M_Honeycomb -> AddElement(H, lvi_natoms=22);
2491 // m_M_Honeycomb -> AddElement(O, lvi_natoms=2 );
2492 // m_M_Honeycomb -> AddElement(N, lvi_natoms=2 );
2493
2494 /* Rohacell */
2495 lvs_name = "Rohacell31";
2496 lvd_density = 3.e-2*g/cm3;
2497 lvi_element = 4;
2498 G4Element *C = G4Element::GetElement("Carbon");
2499 G4Element *H = G4Element::GetElement("Hydrogen");
2500 G4Element *O = G4Element::GetElement("Oxygen");
2501 G4Element *N = G4Element::GetElement("Nitrogen");
2502 m_M_Rohacell = new G4Material(lvs_name, lvd_density, lvi_element);
2503 m_M_Rohacell -> AddElement(C, lvi_natoms=9);
2504 m_M_Rohacell -> AddElement(H, lvi_natoms=13);
2505 m_M_Rohacell -> AddElement(O, lvi_natoms=2 );
2506 m_M_Rohacell -> AddElement(N, lvi_natoms=1 );
2507
2508 /* Epoxy */
2509 lvs_name = "Epoxy";
2510 lvd_density = 1.25*g/cm3;
2511 lvi_element = 3;
2512 m_M_Epoxy = new G4Material(lvs_name, lvd_density, lvi_element);
2513 m_M_Epoxy -> AddElement(C, lvi_natoms=18);
2514 m_M_Epoxy -> AddElement(H, lvi_natoms=31);
2515 m_M_Epoxy -> AddElement(O, lvi_natoms=3 );
2516
2517 /* CarbonFiber */
2518 lvs_name = "CarbonFiber";
2519 lvd_density = 1.57*g/cm3;
2520 lvi_element = 3;
2521 m_M_CarbonFiber = new G4Material(lvs_name, lvd_density, lvi_element);
2522 m_M_CarbonFiber -> AddElement(C, 0.697 );
2523 m_M_CarbonFiber -> AddElement(H, 0.0061);
2524 m_M_CarbonFiber -> AddElement(O, 0.2969);
2525
2526 /* Fiberglass */
2527 // a.k.a. fibra di vetro a.k.a. vetroresina */
2528 // fiberglas, a mean value from tab. 1 in https://www.asminternational.org/documents/10192/1849770/06781G_p27-34.pdf
2529 // mass fraction %:
2530 // SiO2 60 wt%
2531 // B2O3 5 wt%
2532 // Al2O3 13 wt%
2533 // CaO 22 wt%
2534 G4Material* SiO2 = G4NistManager::Instance()->FindOrBuildMaterial("G4_SILICON_DIOXIDE");
2535 G4Material* B2O3 = G4NistManager::Instance()->FindOrBuildMaterial("G4_BORON_OXIDE");
2536 G4Material* Al2O3 = G4NistManager::Instance()->FindOrBuildMaterial("G4_ALUMINUM_OXIDE");
2537 G4Material* CaO = G4NistManager::Instance()->FindOrBuildMaterial("G4_CALCIUM_OXIDE");
2538
2539 lvs_name = "Fiberglass";
2540 lvd_density = 1.99*g/cm3;;
2541 lvi_element = 4;
2542 G4Material *m_M_Fiberglass = new G4Material(lvs_name, lvd_density, lvi_element);
2543 m_M_Fiberglass->AddMaterial(SiO2, 0.6);
2544 m_M_Fiberglass->AddMaterial(B2O3, 0.05);
2545 m_M_Fiberglass->AddMaterial(Al2O3, 0.13);
2546 m_M_Fiberglass->AddMaterial(CaO, 0.22);
2547
2548 /* Permaglas */
2549 // Fiberglas 60% + epoxy 40% */
2550 lvs_name = "Permaglas";
2551 lvd_density = 1.97*g/cm3; // fiche technique da Michele
2552 lvi_element = 2;
2553 m_M_Permaglas = new G4Material(lvs_name, lvd_density, lvi_element);
2554 m_M_Permaglas->AddMaterial(m_M_Fiberglass, 0.6);
2555 m_M_Permaglas->AddMaterial(m_M_Epoxy, 0.4);
2556
2557 /* Aluminum */
2558 m_M_Aluminum= G4NistManager::Instance()->FindOrBuildMaterial("G4_Al");
2559
2560
2561 /* new definition for effective densities */
2562 /* ------------------------------------- */
2563 /* ------------------------------------- */
2564 log<< MSG::INFO << "BesCgemConstruction::ConstructMaterial(), check id effective density is used : " << m_cgem_geomsvc->isEffDensity() << endreq;
2565 ///* use effective density
2566
2567 G4Material *myCu = G4NistManager::Instance()->FindOrBuildMaterial("G4_Cu");
2568 lvs_name = "G4_Cu_GEMFoils";
2569 lvd_density = 8.960*g/cm3;
2570 if(m_cgem_geomsvc->isEffDensity())
2571 lvd_density = 6.44708*g/cm3;
2572 lvi_element = 1;
2573 m_M_Cu_GEMFoils = new G4Material(lvs_name, lvd_density, lvi_element); //// name, density, number of components
2574 m_M_Cu_GEMFoils->AddMaterial(myCu, 1.0); //element, fraction
2575
2576 lvs_name = "G4_Cu_AnodeStripX";
2577 lvd_density = 8.960*g/cm3;
2578 if(m_cgem_geomsvc->isEffDensity())
2579 lvd_density = 7.88*g/cm3;
2580 lvi_element = 1;
2581 m_M_Cu_AnodeStripX = new G4Material(lvs_name, lvd_density, lvi_element);
2582 m_M_Cu_AnodeStripX->AddMaterial(myCu, 1.0);
2583
2584 lvs_name = "G4_Cu_AnodeStripV";
2585 lvd_density = 8.960*g/cm3;
2586 if(m_cgem_geomsvc->isEffDensity())
2587 lvd_density = 1.77*g/cm3;
2588 lvi_element = 1;
2589 m_M_Cu_AnodeStripV = new G4Material(lvs_name, lvd_density, lvi_element);
2590 m_M_Cu_AnodeStripV->AddMaterial(myCu, 1.0);
2591
2592 G4Material *myKapton = G4NistManager::Instance()->FindOrBuildMaterial("G4_KAPTON");
2593 lvs_name = "G4_KAPTON_GEMFoils";
2594 lvd_density = 1.420*g/cm3;
2595 if(m_cgem_geomsvc->isEffDensity())
2596 lvd_density = 1.14794*g/cm3;
2597 lvi_element = 1;
2598 m_M_Kapton_GEMFoils = new G4Material(lvs_name, lvd_density, lvi_element);
2599 m_M_Kapton_GEMFoils->AddMaterial(myKapton, 1.0);
2600
2601 lvs_name = "G4_KAPTON_StripV";
2602 lvd_density = 1.420*g/cm3;
2603 if(m_cgem_geomsvc->isEffDensity())
2604 lvd_density = 0.284*g/cm3;
2605 lvi_element = 1;
2606 m_M_Kapton_StripV = new G4Material(lvs_name, lvd_density, lvi_element);
2607 m_M_Kapton_StripV->AddMaterial(myKapton, 1.0);
2608
2609 /*
2610 G4cout << m_M_Cu_GEMFoils << G4endl; G4cout << G4endl;
2611 G4cout << m_M_Cu_AnodeStripX << G4endl; G4cout << G4endl;
2612 G4cout << m_M_Cu_AnodeStripV << G4endl; G4cout << G4endl;
2613 G4cout << m_M_Kapton_GEMFoils << G4endl; G4cout << G4endl;
2614 G4cout << m_M_Kapton_StripV << G4endl; G4cout << G4endl;
2615 */
2616 /* ------------------------------------- */
2617 /* ------------------------------------- */
2618 /* ------------------------------------- */
2619
2620}
2621
2622//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
2623void BesCgemConstruction::Print(G4LogicalVolume* f_LV)
2624{
2625 IMessageSvc* msgSvc;
2626 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
2627 MsgStream log(msgSvc, "BesCgemConstruction::Print()");
2628 G4Material *lv_M = f_LV->GetMaterial(); /* Material of f_LV */
2629 G4Tubs *lv_tub = dynamic_cast<G4Tubs*>(f_LV->GetSolid());
2630 G4double lvd_M_Z = 0.; /* Z of element */
2631 G4double lvd_M_A = 0.; /* A of element */
2632 for (G4int i = 0; i < lv_M->GetElementVector()->size(); i++)
2633 {
2634 lvd_M_Z += (lv_M->GetElement(i)->GetZ()) * (lv_M->GetFractionVector()[i]);
2635 lvd_M_A += (lv_M->GetElement(i)->GetA()) * (lv_M->GetFractionVector()[i]);
2636 }
2637 G4double lvd_ionisation = lv_M->GetIonisation()->GetMeanExcitationEnergy();
2638 G4double lvd_density = lv_M->GetDensity() / (g/cm3);
2639 G4double lvd_X0 = lv_M->GetRadlen() / (mm);
2640 G4double lvd_R_i = lv_tub->GetInnerRadius() / (mm);
2641 G4double lvd_R_o = lv_tub->GetOuterRadius() / (mm);
2642 G4double lvd_L = lv_tub->GetZHalfLength() / (mm) * 2.0;
2643
2644 log<< MSG::INFO << "BesCgemConstruction::Print(), Construct Detector Volume : " << f_LV->GetName() << endreq;
2645 log<< MSG::INFO << left << setw(10) << "Material "
2646 << left << setw(10) << "Z "
2647 << left << setw(10) << "A "
2648 << left << setw(11) << "Ionisation "
2649 << left << setw(12) << "Density "
2650 << left << setw(10) << "X0 "
2651 << left << setw(10) << "Inner R "
2652 << left << setw(10) << "Outer R "
2653 << left << setw(10) << "Length" << endreq;
2654 log<< MSG::INFO << left << setw(10) << lv_M->GetName()
2655 << left << setw(10) << lvd_M_Z
2656 << left << setw(10) << lvd_M_A / (g/mole)
2657 << left << setw(11) << lvd_ionisation / eV
2658 << left << setw(12) << lvd_density
2659 << left << setw(10) << lvd_X0
2660 << left << setw(10) << lvd_R_i
2661 << left << setw(10) << lvd_R_o
2662 << left << setw(10) << lvd_L
2663 << endreq;
2664 log<< MSG::INFO << left << " " << endreq;
2665}
2666
2667//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
double tan(const BesAngle a)
double sin(const BesAngle a)
double cos(const BesAngle a)
***************************************************************************************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
void Construct(G4LogicalVolume *)
IMPLICIT REAL *A H
Definition: myXsection.h:1