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