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