ATLAS Offline Software
ModulesConstructionH62004.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ModulesConstructionH62004
10 
11 // need if we want to use EMEC from LArGeoTBEC:
13 
14 #include "GeoModelKernel/GeoMaterial.h"
15 #include "GeoModelKernel/GeoBox.h"
16 #include "GeoModelKernel/GeoPcon.h"
17 #include "GeoModelKernel/GeoTube.h"
18 #include "GeoModelKernel/GeoTubs.h"
19 #include "GeoModelKernel/GeoTrd.h"
20 #include "GeoModelKernel/GeoCons.h"
21 #include "GeoModelKernel/GeoLogVol.h"
22 #include "GeoModelKernel/GeoShapeShift.h"
23 #include "GeoModelKernel/GeoShapeIntersection.h"
24 #include "GeoModelKernel/GeoShapeSubtraction.h"
25 #include "GeoModelKernel/GeoNameTag.h"
26 #include "GeoModelKernel/GeoPhysVol.h"
27 #include "GeoModelKernel/GeoFullPhysVol.h"
28 #include "GeoModelKernel/GeoVFullPhysVol.h"
29 #include "GeoModelKernel/GeoTransform.h"
30 #include "GeoModelKernel/GeoSerialDenominator.h"
31 #include "GeoModelKernel/GeoSerialIdentifier.h"
32 #include "GeoModelKernel/GeoAlignableTransform.h"
33 #include "GeoModelKernel/GeoSerialTransformer.h"
34 #include "GeoModelKernel/GeoIdentifierTag.h"
35 #include "GeoModelKernel/GeoShapeUnion.h"
36 #include "GeoModelKernel/GeoDefinitions.h"
37 #include "GeoModelKernel/Units.h"
38 #include "GeoGenericFunctions/AbsFunction.h"
39 #include "GeoGenericFunctions/Variable.h"
40 #include "GeoGenericFunctions/Sin.h"
41 #include "GeoGenericFunctions/Cos.h"
42 
45 
46 #include "GaudiKernel/MsgStream.h"
47 #include "GaudiKernel/Bootstrap.h"
48 #include "GaudiKernel/SystemOfUnits.h"
52 #include <string>
53 #include <cmath>
54 #include <iostream>
55 
57 
58 
60 {
61  for(int i=0; i<NUM_LEAK; ++i) {
62  m_dX[i] = m_dY[i] = m_dZ[i] = 0.;
63  m_shiftX[i] = m_shiftY[i] = m_shiftZ[i] = 0.;
64  m_angleX[i] = m_angleY[i] = m_angleZ[i] = 0.;
65  }
66 
67  m_dX[0] = m_dX[1] = 1.*Gaudi::Units::cm; m_dY[0]= m_dY[1] = 31.6*Gaudi::Units::cm; m_dZ[0] = m_dZ[1] = 50.*Gaudi::Units::cm;
68  m_shiftX[0] = -26.*Gaudi::Units::cm; m_shiftX[1] = -m_shiftX[0];
71  m_angleY[0] = -30.*Gaudi::Units::deg; m_angleY[1] = -m_angleY[0];
72  m_dX[2] = 98.1*Gaudi::Units::cm; m_dY[2] = 98.2*Gaudi::Units::cm; m_dZ[2] = 30.6*Gaudi::Units::cm;
74  m_angleX[2] = 94.668*Gaudi::Units::deg; m_angleY[2] = 0.; m_angleZ[2] = 90.*Gaudi::Units::degree;
75 
76 
77  m_dX[3] = 1.*Gaudi::Units::cm; m_dY[3] = 43.*Gaudi::Units::cm; m_dZ[3] = 40.*Gaudi::Units::cm;
78  m_dX[4] = m_dX[3]; m_dY[4] = m_dY[3]; m_dZ[4] = m_dZ[3];
80  m_shiftX[4] = -m_shiftX[3]; m_shiftY[4] = m_shiftY[3]; m_shiftZ[4] = m_shiftZ[3];
81  m_angleX[3] = m_angleX[4] = 4.668*Gaudi::Units::deg; m_angleY[3] = -45.*Gaudi::Units::deg;
82  m_angleY[4] = -m_angleY[3];
83  m_angleZ[3] = 0.*Gaudi::Units::deg;
84  m_angleZ[4] = -m_angleZ[3];
85  m_dX[5] = 130.*Gaudi::Units::cm; m_dY[5] = 131.*Gaudi::Units::cm; m_dZ[5] = 43.*Gaudi::Units::cm;
88  m_angleZ[5] = 90.*Gaudi::Units::deg;
89 
90  m_dX[6] = m_dX[7] = 1.*Gaudi::Units::cm; m_dY[6] = m_dY[7] = 27.*Gaudi::Units::cm; m_dZ[6] = m_dZ[7] = 40.*Gaudi::Units::cm;
92  m_shiftX[7] = - m_shiftX[6];
94  m_angleY[7] = -m_angleY[6];
95  m_dX[8] = 130.*Gaudi::Units::cm; m_dY[8] = 131.*Gaudi::Units::cm; m_dZ[8] = 27.*Gaudi::Units::cm;
98  m_dX[9] = 1.*Gaudi::Units::cm; m_dY[9] = 82.*Gaudi::Units::cm; m_dZ[9] = 44.5*Gaudi::Units::cm;
101 
102  m_dX[10] = m_dX[11] = 1.*Gaudi::Units::cm; m_dY[10] = m_dY[11] = 41.5*Gaudi::Units::cm; m_dZ[10] = m_dZ[11] = 20.3*Gaudi::Units::cm;
103  m_shiftX[10] = -15.4*Gaudi::Units::cm; m_shiftY[10] = m_shiftY[11] = 14.50*Gaudi::Units::cm; m_shiftZ[10] = m_shiftZ[11] = -39.*Gaudi::Units::cm;
104  m_shiftX[11] = - m_shiftX[10];
106  m_angleY[11] = -m_angleY[10]; m_angleZ[11] = -m_angleZ[10];
107 
108  m_dX[12] = m_dX[13] = 1.*Gaudi::Units::cm; m_dY[12] = m_dY[13] = 27.*Gaudi::Units::cm; m_dZ[12] = m_dZ[13] = 20.3*Gaudi::Units::cm;
109  m_shiftX[12] = -15.4*Gaudi::Units::cm; m_shiftY[12] = m_shiftY[13] = -54.4*Gaudi::Units::cm; m_shiftZ[12] = m_shiftZ[13] = -43.8*Gaudi::Units::cm;
110  m_shiftX[13] = -m_shiftX[12];
112  m_angleY[13] = -m_angleY[12]; m_angleZ[13] = -m_angleZ[12];
113 
114  m_dX[14] = m_dX[15] = 1.*Gaudi::Units::cm; m_dY[14] = m_dY[15] = 12.*Gaudi::Units::cm; m_dZ[14] = m_dZ[15] = 25.3*Gaudi::Units::cm;
115  m_shiftX[14] = -19.5*Gaudi::Units::cm; m_shiftY[14] = m_shiftY[15] = -93.5*Gaudi::Units::cm; m_shiftZ[14] = m_shiftZ[15] = -46.5*Gaudi::Units::cm;
116  m_shiftX[15] = -m_shiftX[14];
118  m_angleY[15] = -m_angleY[14];
119 
120  m_dX[16] = 59.5*Gaudi::Units::cm; m_dY[16] = 60.0*Gaudi::Units::cm; m_dZ[16] = 12.0*Gaudi::Units::cm;
121  m_shiftX[16] = 0.*Gaudi::Units::cm; m_shiftY[16] = -91.5*Gaudi::Units::cm; m_shiftZ[16] = -73.5*Gaudi::Units::cm;
123  m_dX[17] = 0.3*Gaudi::Units::cm; m_dY[17] = 35.*Gaudi::Units::cm; m_dZ[17] = 25.*Gaudi::Units::cm;
124  m_shiftX[17] = 0.*Gaudi::Units::cm; m_shiftY[17] = -107.0*Gaudi::Units::cm; m_shiftZ[17] = -40.*Gaudi::Units::cm;
126 }
127 
128 
131 
132 
134 {
136  ISvcLocator* svcLocator = Gaudi::svcLocator();
137  if (svcLocator->service("DetectorStore", m_detectorStore, false )==StatusCode::FAILURE) {
138  throw std::runtime_error("Error in ModulesConstruction, cannot access DetectorStore");
139  }
140 
141  status = m_detectorStore->retrieve(m_Options, "LArGeoTB2004Options");
142 
143  if(!status.isSuccess() ) {
144  std::cout << "ModulesConstructionH62004:\tCan't access LArGeoTB2004Options, using default values\n";
145  }
146 }
147 
149 
150 GeoIntrusivePtr<GeoVFullPhysVol> LArGeo::ModulesConstructionH62004::GetEnvelope()
151 {
152  StoredMaterialManager* materialManager = nullptr;
153  if (StatusCode::SUCCESS != m_detectorStore->retrieve(materialManager, std::string("MATERIALS"))) {
154  throw std::runtime_error("Error in ModulesConstruction, cannot access Material manager");
155  }
156 
157  if (m_ModulesPhys) return (m_ModulesPhys);
158  ISvcLocator *svcLocator = Gaudi::svcLocator();
159  IMessageSvc * msgSvc;
160  if (svcLocator->service("MessageSvc", msgSvc, true )==StatusCode::FAILURE) {
161  throw std::runtime_error("Error in ModulesConstructionH62004, cannot access MessageSvc");
162  }
163  MsgStream log(msgSvc, "ModulesConstructionH62004");
164  log << MSG::INFO;
165  log << "++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
166  log << "+ +" << std::endl;
167  log << "+ Start of H62004 GeoModel definition +" << std::endl;
168  log << "+ +" << std::endl;
169  log << "++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
170 
171  const GeoMaterial *LAr = materialManager->getMaterial("std::LiquidArgon");
172  if (!LAr) throw std::runtime_error("Error in ModulesConstruction, std::LiquidArgon is not found.");
173 
174  // How to get Rohacell ????
175  // Taking Margret's one
176  // Define Rohacell Foam.
177  // Rohacell foam has density: 0.11g/cm3
178  std::string name;
179  double density;
180 
181  const GeoElement* C=materialManager->getElement("Carbon");
182  const GeoElement* H=materialManager->getElement("Hydrogen");
183  const GeoElement* O=materialManager->getElement("Oxygen");
184  const GeoElement* N=materialManager->getElement("Nitrogen");
185  GeoMaterial* Rohacell = new GeoMaterial(name="Rohacell", density=0.112*GeoModelKernelUnits::g/Gaudi::Units::cm3);
186  Rohacell->add(C,0.6465);
187  Rohacell->add(H,0.07836);
188  Rohacell->add(O,0.19137);
189  Rohacell->add(N,0.08377);
190  Rohacell->lock();
191 
192  /*
193  a = 12.957*GeoModelKernelUnits::g/Gaudi::Units::mole;
194  density = 0.112*g/cm3;
195  z = 6.18;
196  G4Material* Rohacell = new G4Material(name="Rohacell",z, a, density);
197  */
198 
199  const GeoMaterial *Alu = materialManager->getMaterial("std::Aluminium");
200  if (!Alu) throw std::runtime_error("Error in ModulesConstruction, std::Aluminium is not found.");
201 
202  // DB numbers:
203  double bryr_y = 200.0*Gaudi::Units::cm;
204  double bcry_rlar = 125.5*Gaudi::Units::cm;
205  double bcry_phistart = 0.*Gaudi::Units::degree;
206  double bcry_phiend = 360.*Gaudi::Units::degree;
207  //double EMECdzende = 63.2*Gaudi::Units::cm; // Can not get from parameters
208  //double Zall = 62.6*cm; // Excluder dimension
209 
210  double bepo_tx = 180.0*Gaudi::Units::degree;
211  double bepo_tz = 90.0*Gaudi::Units::degree;
212  double bepo_tz_e = ( M_PI / 4 )*Gaudi::Units::rad;
213  double bepo_ty = 90.0*Gaudi::Units::degree;
214  double bepo_Beta = 4.668*Gaudi::Units::degree;
215  double bepo_z_e = -42.86*Gaudi::Units::cm; // 43 Gaudi::Units::cm * cos(4.668)
216  double bepo_emec_shift = 2.5*Gaudi::Units::cm;
217  double bepo_excluder_shift = 34.4*Gaudi::Units::cm;
218  //double bepo_hec_shift = 63.6*Gaudi::Units::cm; // relative position of HEC versus EMEC
219  //double bepo_y_a = bcry_rlar-bepo_emec_shift-bepo_hec_shift;
220  double bepo_y_ex = bcry_rlar-bepo_excluder_shift;
221  double bepo_y_hecshift = 6.*Gaudi::Units::mm;
222  double bepo_y_emecshift = 11.*Gaudi::Units::mm;
223  double bepo_x = -2.75*Gaudi::Units::mm;
224  double bepo_x_e = -17.*Gaudi::Units::mm;
225 // double bepo_x = 13.25*Gaudi::Units::mm;
226 // double bepo_x_e = -3.*Gaudi::Units::mm;
227 // double bepo_x = 17.25*Gaudi::Units::mm;
228 // double bepo_x_e = -3.*Gaudi::Units::mm;
229  //double bepo_z = -48.24*Gaudi::Units::cm; // 48.4 Gaudi::Units::cm * cos(4.668)
230  double bepo_y_e = bcry_rlar-bepo_emec_shift;
231  double bepo_pz = 45.0*Gaudi::Units::degree;
232 
233  std::string baseName = "LArGeoTB::LeakageDet::";
234 
235  double ylen;
236  if(m_Options && m_Options->isRun1()) {
237  ylen = bryr_y;
238  } else {
239  ylen = bryr_y - 200.*Gaudi::Units::mm;
240  }
241  GeoTubs *shapeMother = new GeoTubs( 0.0*Gaudi::Units::cm, bcry_rlar, ylen, bcry_phistart,bcry_phiend);
242  GeoLogVol *logMother = new GeoLogVol(baseName + "LAr", shapeMother, LAr);
243 
244  m_ModulesPhys = new GeoFullPhysVol(logMother);
245 
246  std::string tag = std::string("MODULES_POS");
248  StoredPhysVol *sPhysVol = new StoredPhysVol(m_ModulesPhys);
249  status=m_detectorStore->record(sPhysVol,tag);
250  if(!status.isSuccess()) throw std::runtime_error ((std::string("Cannot store")+tag).c_str());
251 
252 // position leakage detectors
253 /*
254  for(int cal = 0; cal <= 5; ++cal){
255  for(int dir = 0; dir <= 2; ++dir){
256  for(int sid = 0; sid <= 1; ++sid){
257  GeoLogVol *leak_log = construct(materialManager, sid, dir, cal);
258  if(leak_log == 0) continue;
259  leak_log->SetSensitiveDetector(LeakSDdetector);
260  leak_log->SetVisAttributes(G4VisAttributes::Invisible);
261 // leak_log->SetVisAttributes(new G4VisAttributes(G4Color(0.7,0.1,0.7)));
262  GeoTrf::Transform3D leak_pos = position(sid, dir, cal);
263  G4VPhysicalVolume *leak_phys =
264  new G4PVPlacement(leak_pos,
265  leak_log,
266  leak_log->GetName(),
267  logMother,
268  false,
269  10000+GetID(sid,dir,cal));
270  }
271  }
272  }
273 */
274 
275 // position EMEC excluder
276 
277  ExcluderConstructionH62004 excluder(0);
278  /*if(excluder != 0)*/{
279 // std::cout<<"ModulesConstructionH62004::GetEnvelope positioning Excluder"<<std::endl;
280  GeoIntrusivePtr<GeoVFullPhysVol> excluderEnvelope = excluder.GetEnvelope();
281  /*if(excluderEnvelope != 0)*/{
282  GeoTrf::Transform3D rot2 = GeoTrf::RotateX3D(bepo_Beta) * GeoTrf::RotateX3D(bepo_ty) * GeoTrf::RotateZ3D(bepo_tz);
283  m_ModulesPhys->add(new GeoSerialIdentifier(0));
284  m_ModulesPhys->add(new GeoTransform(GeoTrf::Translation3D(0.,bepo_y_ex,bepo_z_e+42.*Gaudi::Units::mm) * rot2));
285  m_ModulesPhys->add(excluderEnvelope);
286  }
287  }
288 
289 
290 // position FCAL excluder
291 
292 
293  ExcluderConstructionH62004 fcexcluder(1);
294  /*if(fcexcluder != 0)*/{
295 // std::cout<<"ModulesConstructionH62004::GetEnvelope positioning Excluder"<<std::endl;
296  GeoIntrusivePtr<GeoVFullPhysVol> fcexcluderEnvelope = fcexcluder.GetEnvelope();
297  if(fcexcluderEnvelope ){
298  GeoTrf::Transform3D rot2 = GeoTrf::RotateX3D(0.8*bepo_Beta) * GeoTrf::RotateX3D(-bepo_ty) * GeoTrf::RotateZ3D(bepo_tx);
299  m_ModulesPhys->add(new GeoSerialIdentifier(0));
300 // m_ModulesPhys->add(new GeoTransform(GeoTrf::Transform3D(rot2,GeoTrf::Vector3D(0.,bepo_y_ex-138.*Gaudi::Units::mm,-477.3*Gaudi::Units::mm))));
301  m_ModulesPhys->add(new GeoTransform(GeoTrf::Translation3D(0.,bepo_y_ex-146.*Gaudi::Units::mm,-412.0*Gaudi::Units::mm) * rot2));
302  m_ModulesPhys->add(fcexcluderEnvelope);
303  }
304  }
305 
306 
307 // position Front excluder
308 
309  ExcluderConstructionH62004 frontexcluder(2);
310 
311  /*if(frontexcluder != 0)*/{
312  GeoIntrusivePtr<GeoVFullPhysVol> frontexcluderEnvelope = frontexcluder.GetEnvelope();
313  if(frontexcluderEnvelope ){
314  GeoTrf::RotateZ3D rot2((90.)*Gaudi::Units::degree);
315  m_ModulesPhys->add(new GeoSerialIdentifier(0));
316  m_ModulesPhys->add(new GeoTransform(GeoTrf::Translation3D(0.,0.,20.*Gaudi::Units::mm) * rot2));
317  m_ModulesPhys->add(frontexcluderEnvelope);
318  /*
319  G4VPhysicalVolume* frontexcluderPhysical =
320 // new G4PVPlacement(GeoTrf::Transform3D(rot2,GeoTrf::Vector3D(0.,0.,220.*Gaudi::Units::mm)), // Translation
321  new G4PVPlacement(GeoTrf::Transform3D(rot2,GeoTrf::Vector3D(0.,0.,20.*Gaudi::Units::mm)), // Translation
322  frontexcluderEnvelope, // Logical volume
323  frontexcluderEnvelope->GetName(), // Name
324  logMother, // Mother volume
325  false, // Boolean volume?
326  0); // Copy number
327  */
328  }
329  }
330 
331 
332 // position Back excluder
333 
334  ExcluderConstructionH62004 backexcluder(3);
335 
336  /*if(backexcluder != 0)*/{
337  GeoIntrusivePtr<GeoVFullPhysVol> backexcluderEnvelope = backexcluder.GetEnvelope();
338  if(backexcluderEnvelope ){
339  GeoTrf::RotateZ3D rot2((-90.-29.)*Gaudi::Units::degree);
340  m_ModulesPhys->add(new GeoSerialIdentifier(0));
341  m_ModulesPhys->add(new GeoTransform(GeoTrf::Translation3D(0.,0.,0.*Gaudi::Units::mm) * rot2));
342  m_ModulesPhys->add(backexcluderEnvelope);
343  /*
344  G4VPhysicalVolume* backexcluderPhysical =
345  new G4PVPlacement(GeoTrf::Transform3D(rot2,GeoTrf::Vector3D(0.,0.,0.*Gaudi::Units::mm)), // Translation
346  backexcluderEnvelope, // Logical volume
347  backexcluderEnvelope->GetName(), // Name
348  logMother, // Mother volume
349  false, // Boolean volume?
350  0); // Copy number
351  */
352  }
353  }
354 
355 
356 
357  // Let's try assembly volume
358 
359  // G4AssemblyVolume* assemblyMother = new G4AssemblyVolume();
360 
361  // Transformation for assembly - should be putted to each piece now.
362  GeoTrf::Transform3D rota = GeoTrf::RotateX3D(bepo_Beta) * GeoTrf::RotateX3D(bepo_ty) * GeoTrf::RotateZ3D(-bepo_pz);
363  GeoTrf::Transform3D trans = GeoTrf::Translation3D(0.,bepo_y_e,bepo_z_e+65.*Gaudi::Units::mm) * rota;
364 
365 //positions emec
366 
367  // Z-positions DB values !!!!
368 
369  double HECzStart = 427.7*Gaudi::Units::cm;
370  double EMECzStart = 364.1*Gaudi::Units::cm;
371  double FCALzStart = 466.85*Gaudi::Units::cm;
372  double FCALzEnd = 588.28*Gaudi::Units::cm;
373 
374  if((!m_Options) || m_Options->isEmec()){
375  GeoTrf::RotateZ3D MrotEmec(bepo_tz_e);
376  // original value:
377 // GeoTrf::Vector3D pos3Emec( 0*Gaudi::Units::mm, 9.0*Gaudi::Units::mm , 55.9*Gaudi::Units::mm);
378 // GeoTrf::Vector3D pos3Emec( 3.636*Gaudi::Units::mm, 9.0*Gaudi::Units::mm , 55.9*Gaudi::Units::mm);
379 // GeoTrf::Vector3D pos3Emec( bepo_x_e, 9.*Gaudi::Units::mm , 61.*Gaudi::Units::mm);
380  GeoTrf::Translation3D pos3Emec((bepo_x_e - bepo_y_emecshift )/2./sin(bepo_tz_e)
381  , (bepo_x_e + bepo_y_emecshift )/2./sin(bepo_tz_e)
382  , 61.*Gaudi::Units::mm);
383 // GeoTrf::Vector3D pos3Emec( 0.*Gaudi::Units::mm, bepo_x_e, 61.*Gaudi::Units::mm);
384 
385 // std::cout<<"ModulesConstructionH62004 calling EMECModuleConstruction....."<<std::endl;
386  //use this line for physical construction of the EMEC inner wheel only:
387 // EMECModuleConstruction* emecConstruction = new EMECModuleConstruction(true, true, false);
388  EMECModuleConstruction emecConstruction(true, true, false);
389 
390  GeoIntrusivePtr<GeoVFullPhysVol> emecEnvelope = emecConstruction.GetEnvelope();
391  m_ModulesPhys->add(new GeoNameTag("LAr"));
392  m_ModulesPhys->add( new GeoTransform(trans) );
393  m_ModulesPhys->add( new GeoTransform( pos3Emec * MrotEmec ));
394  m_ModulesPhys->add(emecEnvelope);
395 // std::cout<<"ModulesConstructionH62004 EMECModuleConstruction done...."<<std::endl;
396  }
397 
398 
399  if((!m_Options) || m_Options->isHec()){
400  //positions hec
401 
403  /*if(hec != 0)*/{
404  PVLink hecEnvelope = hec.GetEnvelope();
405  if(hecEnvelope ){
406 // rot.rotateZ(-bepo_pz);
407 // rot.rotateX(bepo_ty);
408 // rot.rotateX(bepo_Beta);
409 
410 // GeoTrf::Transform3D hpos = GeoTrf::Transform3D(rot,GeoTrf::Vector3D(bepo_x,bepo_y_a,bepo_z));
411 // GeoTrf::Vector3D hecshift(0.,6.*Gaudi::Units::mm,HECzStart-EMECzStart);
412 // GeoTrf::Vector3D hecshift((bepo_x - bepo_y_hecshift)/2./sin(bepo_tz_e), (bepo_x + bepo_y_hecshift)/2./sin(bepo_tz_e), HECzStart-EMECzStart);
413 // GeoTrf::Vector3D hecshift(-21.*Gaudi::Units::mm, bepo_x, HECzStart-EMECzStart);
414 // GeoTrf::Vector3D hecshift(-5.*Gaudi::Units::mm, bepo_x, HECzStart-EMECzStart);
415 // GeoTrf::Vector3D hecshift(0.*Gaudi::Units::mm, bepo_x, HECzStart-EMECzStart);
416 // Gaudi::Units::HepRotation norot;
417  m_ModulesPhys->add(new GeoTransform(trans));
418  m_ModulesPhys->add( new GeoTransform(GeoTrf::Translate3D((bepo_x - bepo_y_hecshift)/2./sin(bepo_tz_e)
419  , (bepo_x + bepo_y_hecshift)/2./sin(bepo_tz_e)
420  , HECzStart-EMECzStart)) );
421  m_ModulesPhys->add(hecEnvelope);
422 
423 // assemblyMother->AddPlacedVolume( hecEnvelope, hectrans );
424  }
425  }
426  }
427 
428  if((!m_Options) || m_Options->isFcal()){
430  /*if(fcal != 0)*/{
431  fcal.setFCALVisLimit(m_fcalVisLimit);
432  PVLink fcalEnvelope = fcal.GetEnvelope();
433  if(fcalEnvelope ){
434 // Gaudi::Units::HepRotation rotFCal;
435  // rotFCal.rotateY(0.*Gaudi::Units::deg);
436  // rotFCal.rotateZ(-bepo_pz);
437  // rotFCal.rotateX(bepo_ty);
438  // rotFCal.rotateX(bepo_Beta);
439 // GeoTrf::Vector3D fcalshift(0.,-7.*Gaudi::Units::mm,FCALzStart-EMECzStart+(FCALzEnd-FCALzStart)/2.);
440  m_ModulesPhys->add(new GeoTransform(trans));
441  m_ModulesPhys->add( new GeoTransform(GeoTrf::Translate3D(9.*Gaudi::Units::mm
442  ,0.*Gaudi::Units::mm
443  ,FCALzStart-EMECzStart+(FCALzEnd-FCALzStart)/2.)) );
444  m_ModulesPhys->add(fcalEnvelope);
445  }
446  }
447  }
448 
449  if((!m_Options) || m_Options->isColdnose()){
450  // Position a cold nose
451  //
452 
453  double box_x = (650./2.)*Gaudi::Units::mm;
454  double box_y = (356./2.)*Gaudi::Units::mm;
455  double box_z = (50.8/2.)*Gaudi::Units::mm;
456  double btot = 494.*Gaudi::Units::mm;
457  double tub_r = 452.*Gaudi::Units::mm;
458  double tub1_dr = 8.*Gaudi::Units::mm;
459  double tub1_z = (1320./2.)*Gaudi::Units::mm;
460  double cyl_dr = 10.*Gaudi::Units::mm;
461  double cyl_r1 = 262.*Gaudi::Units::mm;
462  double cyl_r2 = 336.5*Gaudi::Units::mm;
463  double cyl_z = (912./2.)*Gaudi::Units::mm;
464  double cyl_shift = (10. + 25.)*Gaudi::Units::mm;
465 // double NoseZshift = -360.*Gaudi::Units::mm;
466  double NoseZshift = -63.1*Gaudi::Units::mm;
467 // double NoseYshift = 94.4*Gaudi::Units::mm;
468 // double NoseYshift = 96.4*Gaudi::Units::mm;
469  double NoseYshift = 98.4*Gaudi::Units::mm;
470 // double NoseXshift = -195.*Gaudi::Units::mm;
471  double NoseXshift = -94.4*Gaudi::Units::mm;
472 
473  GeoBox* Box1 = new GeoBox(box_x, box_y, box_z);
474  double alpha = acos(box_x/tub_r);
475  double ax = M_PI - 2*alpha;
476  GeoTubs* Tub= new GeoTubs(0., tub_r, box_z, alpha, ax);
477 
478 // tRot.rotateX(90*Gaudi::Units::degree);
479  GeoTrf::Translate3D TubTrans(0.,btot-box_y-tub_r,0.);
480  const GeoShapeUnion &uSolid = (*Box1).add((*Tub)<<TubTrans);
481 
482  GeoTubs* Tub1 = new GeoTubs(tub_r, tub_r+tub1_dr, tub1_z, alpha, ax);
483 // GeoTrf::Vector3D TubShift2(0.,btot-box_y-tub_r,-tub1_z+box_z);
484 // GeoTrf::Vector3D TubShift2(0.,0.,0.);
485 // tRot.rotateX(90*Gaudi::Units::degree);
486  GeoTrf::Translate3D UnTrans(0.,-135.5*Gaudi::Units::mm,-tub1_z+box_z);
487  const GeoShapeUnion &uSolid2 = uSolid.add((*Tub1)<<UnTrans);
488 
489  GeoCons* Cone = new GeoCons(cyl_r2, cyl_r1, cyl_r2+cyl_dr, cyl_r1+cyl_dr, cyl_z, M_PI/4.,M_PI/2.);
490 // GeoTrf::Vector3D CylShift(0.,-box_y+cyl_shift,cyl_z+box_z-3.*Gaudi::Units::mm);
491  GeoTrf::Translation3D CylShift(0.,-box_y+cyl_shift,cyl_z+box_z-5.*Gaudi::Units::mm);
492 // GeoTrf::Vector3D CylShift(0.,0.,cyl_z+box_z);
493  GeoTrf::RotateX3D tRot(1.*Gaudi::Units::degree);
494 // tRot.rotateZ(-90*Gaudi::Units::degree);
495  GeoTrf::Transform3D CylTrans = CylShift * tRot;
496  const GeoShapeUnion &uSolid3 = uSolid2.add((*Cone)<<CylTrans);
497 
498  GeoLogVol* Cnose = new GeoLogVol("LArGeoTB::LeakageDet::ColdNose", &uSolid3 , Alu);
499  GeoIntrusivePtr<GeoPhysVol>PhysCnose = new GeoPhysVol(Cnose);
500 // cnose->SetVisAttributes(G4VisAttributes::Invisible);
501  GeoTrf::Transform3D CRotation = GeoTrf::RotateZ3D(-3*M_PI/4.) * GeoTrf::RotateX3D(M_PI);
502 // GeoTrf::Vector3D tShift(NoseXshift,0.,FCALzStart-EMECzStart+NoseZshift);
503  GeoTrf::Translation3D tShift(NoseXshift,NoseYshift,FCALzStart-EMECzStart+NoseZshift);
504 // GeoTrf::Vector3D tShift(0.,NoseYshift,NoseZshift);
505  GeoTrf::Transform3D CTrans = tShift * CRotation;
506  m_ModulesPhys->add( new GeoTransform(trans) ) ;
507  m_ModulesPhys->add(new GeoTransform(CTrans));
508  m_ModulesPhys->add(PhysCnose);
509 // assemblyMother->AddPlacedVolume( cnose, CTrans );
510  /*
511  G4VPhysicalVolume* nosePhysical = new
512  G4PVPlacement(GeoTrf::Transform3D(CRotation,tShift),
513  cnose, cnose->GetName(),logMother, false, 0);
514  */
515 
516  // Do an imprint of assembly:
517 
518  /*
519  Gaudi::Units::HepRotation rota;
520  rota.rotateZ(-bepo_pz);
521  rota.rotateX(bepo_ty);
522  rota.rotateX(bepo_Beta);
523 
524  GeoTrf::Transform3D trans(rota, GeoTrf::Vector3D(0.,bepo_y_e,bepo_z_e));
525 
526  assemblyMother->MakeImprint( logMother, trans );
527  */
528  }
529  return m_ModulesPhys;
530 }
531 
533 {
534  int i;
535  if(calo<0 || calo >5) return 0;
536  if(side<0 || side >1) return 0;
537 
538  switch(dir) {
539  case 0: {
540  if(calo<=2) i=1; else i=5-calo;
541  return 3*calo+i+side;
542  }
543  case 2: {
544  if(side==1) return 0;
545  if(calo==2) return 10;
546  else if(calo==5) return 18;
547  else return 0;
548  }
549  case 1: {
550  if(side==1) return 0;
551  if(calo==3 || calo==4) return 0;
552  if(calo==5) i=2; else i=3;
553  return 3*calo+i;
554  }
555 
556  default : {return 0;}
557  }
558 
559 }
560 
561 
562 GeoLogVol*
564  int side, int dir, int calo)
565 {
566 //--------- Material definition for leakage detectors ---------
567  //double density, pressure, temperature;
568  std::string name;
569 
570  //density = universe_mean_density; //from PhysicalConstants.h
571  //pressure = 3.e-18*pascal;
572  //temperature = 2.73*kelvin;
573  const GeoMaterial* Vacuum = materialManager->getMaterial("std::Vacuum");
574  if (!Vacuum) throw std::runtime_error("Error in ModulesConstruction, std::Vacuum is not found.");
575 
576 //----------------- construct ID and name
577  int myID = GetID(side,dir,calo);
578  if(myID == 0 || myID > NUM_LEAK) return nullptr;
579  if(s_leakGeom.m_dX[myID-1] == 0 && s_leakGeom.m_dY[myID-1] == 0 && s_leakGeom.m_dZ[myID-1] == 0) return nullptr;
580  name = "LArGeoTB::LeakageDet::";
581  switch(calo){
582  case 0:
583  name += "emec";
584  break;
585  case 1:
586  name += "hec1";
587  break;
588  case 2:
589  name += "hec2";
590  break;
591  case 3:
592  name += "fcal1";
593  break;
594  case 4:
595  name += "fcal2";
596  break;
597  case 5:
598  name += "coldtc";
599  break;
600  default:
601  std::cerr << "Wrong calo for leakage !!" << std::endl;
602  return nullptr;
603  }
604  switch(dir){
605  case 0:
606  name += "_side";
607  break;
608  case 1:
609  name += "_up";
610  break;
611  case 2:
612  name += "_back";
613  break;
614  default:
615  std::cerr << "Wrong direction for leakage !!" << std::endl;
616  return nullptr;
617  }
618  if(dir != 1){
619  switch(side){
620  case 0:
621  name += "_left";
622  break;
623  case 1:
624  name += "_right";
625  break;
626  default:
627  std::cerr << "Wrong side for leakage !!" << std::endl;
628  return nullptr;
629  }
630  }
631 
632 // std::cout<<"ModulesConstructionH62004::construct: "<<myID<<": "<<name<<std::endl;
633 
634 //------------------ now construct shape and logical volume ---------------
635  GeoLogVol *volume_log;
636  if(myID == 6 || myID == 9 || myID == 17) {
637  GeoTubs *tub = new GeoTubs(s_leakGeom.m_dX[myID-1],s_leakGeom.m_dY[myID-1],s_leakGeom.m_dZ[myID-1],-43.*Gaudi::Units::degree,86.*Gaudi::Units::degree);
638  volume_log = new GeoLogVol(name,tub,Vacuum);
639  } else if(myID == 3) {
640  GeoTubs *tub = new GeoTubs(s_leakGeom.m_dX[myID-1],s_leakGeom.m_dY[myID-1],s_leakGeom.m_dZ[myID-1],-32.*Gaudi::Units::degree,64.*Gaudi::Units::degree);
641  volume_log = new GeoLogVol(name,tub,Vacuum);
642 #if 0 // impossible case...
643  } else if(myID == 19) {
644  GeoTrd *trd = new GeoTrd(s_leakGeom.m_dX[myID-1]-16.*Gaudi::Units::cm,s_leakGeom.m_dX[myID-1],s_leakGeom.m_dY[myID-1],s_leakGeom.m_dY[myID-1],s_leakGeom.m_dZ[myID-1]);
645  volume_log = new GeoLogVol(name,trd,Vacuum);
646 #endif
647  } else {
648  GeoBox *mbox = new GeoBox(s_leakGeom.m_dX[myID-1], s_leakGeom.m_dY[myID-1], s_leakGeom.m_dZ[myID-1]);
649  volume_log = new GeoLogVol(name,mbox,Vacuum);
650  }
651  return volume_log;
652 }
653 
655 {
656  GeoTrf::Transform3D leak_position(GeoTrf::Transform3D::Identity());
657 
658  int myID = GetID(side,dir,calo);
659  if(myID == 0) {
660  std::cerr << "Error! First construct the leakage detector !!" << std::endl;
661  }
662  assert(myID>0 && myID <= NUM_LEAK);
663  if(myID > NUM_LEAK) return leak_position;
664 
665  GeoTrf::Transform3D rotM = GeoTrf::RotateX3D(s_leakGeom.m_angleX[myID-1]) * GeoTrf::RotateY3D(s_leakGeom.m_angleY[myID-1]) * GeoTrf::RotateZ3D(s_leakGeom.m_angleZ[myID-1]);
666 
667  leak_position = GeoTrf::Transform3D(GeoTrf::Translation3D(s_leakGeom.m_shiftX[myID-1],s_leakGeom.m_shiftY[myID-1],s_leakGeom.m_shiftZ[myID-1]) * rotM);
668 
669  return leak_position;
670 }
671 
LArGeo::ExcluderConstructionH62004::GetEnvelope
GeoIntrusivePtr< GeoVFullPhysVol > GetEnvelope() const
Definition: ExcluderConstructionH62004.cxx:54
fitman.ax
ax
Definition: fitman.py:522
LArGeo::ModulesConstructionH62004::GetEnvelope
GeoIntrusivePtr< GeoVFullPhysVol > GetEnvelope()
Definition: ModulesConstructionH62004.cxx:150
LArGeo::FCALConstructionH62004::setFCALVisLimit
void setFCALVisLimit(int maxCell)
Definition: FCALConstructionH62004.h:34
LArGeo::ModulesConstructionH62004::GetID
static int GetID(int side, int dir, int calo)
Definition: ModulesConstructionH62004.cxx:532
LArGeo::FCALConstructionH62004::GetEnvelope
GeoIntrusivePtr< GeoVFullPhysVol > GetEnvelope()
Definition: FCALConstructionH62004.cxx:104
LAr
Definition: LArVolumeBuilder.h:36
LArGeo::ModulesConstructionH62004::m_Options
const LArGeoTB2004Options * m_Options
Definition: ModulesConstructionH62004.h:42
LArGeo::ModulesConstructionH62004::LeakGeom::m_angleY
float m_angleY[NUM_LEAK]
Definition: ModulesConstructionH62004.h:48
LArGeo::ModulesConstructionH62004::m_detectorStore
StoreGateSvc * m_detectorStore
Definition: ModulesConstructionH62004.h:40
StoredMaterialManager::getElement
virtual const GeoElement * getElement(const std::string &name)=0
cm3
#define cm3
M_PI
#define M_PI
Definition: ActiveFraction.h:11
deg
#define deg
Definition: SbPolyhedron.cxx:17
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
LArGeo::ExcluderConstructionH62004
Definition: ExcluderConstructionH62004.h:14
LArGeo::ModulesConstructionH62004::ModulesConstructionH62004
ModulesConstructionH62004()
Definition: ModulesConstructionH62004.cxx:133
StoreGateSvc::retrieve
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
StoredPhysVol
Definition: StoredPhysVol.h:27
TRT::Hit::side
@ side
Definition: HitInfo.h:83
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
NUM_LEAK
#define NUM_LEAK
Definition: ModulesConstructionH62004.h:19
H
#define H(x, y, z)
Definition: MD5.cxx:114
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
LArGeo::ModulesConstructionH62004::LeakGeom::m_angleZ
float m_angleZ[NUM_LEAK]
Definition: ModulesConstructionH62004.h:48
LArGeo::ModulesConstructionH62004::LeakGeom::m_angleX
float m_angleX[NUM_LEAK]
Definition: ModulesConstructionH62004.h:48
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:92
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
EMECModuleConstruction.h
ExcluderConstructionH62004.h
LArGeo::ModulesConstructionH62004::m_fcalVisLimit
int m_fcalVisLimit
Definition: ModulesConstructionH62004.h:52
LArGeo::ModulesConstructionH62004::m_ModulesPhys
GeoIntrusivePtr< GeoFullPhysVol > m_ModulesPhys
Definition: ModulesConstructionH62004.h:39
LArGeo::EMECModuleConstruction
Definition: EMECModuleConstruction.h:18
LArGeo::HECConstructionH62004::GetEnvelope
GeoIntrusivePtr< GeoVFullPhysVol > GetEnvelope()
Definition: HECConstructionH62004.cxx:65
LArGeo::HECConstructionH62004
Definition: HECConstructionH62004.h:21
beamspotman.dir
string dir
Definition: beamspotman.py:623
LArGeo::ModulesConstructionH62004::LeakGeom::m_shiftY
float m_shiftY[NUM_LEAK]
Definition: ModulesConstructionH62004.h:47
LArGeo::ModulesConstructionH62004::~ModulesConstructionH62004
virtual ~ModulesConstructionH62004()
ModulesConstructionH62004.h
LArGeo::FCALConstructionH62004
Definition: FCALConstructionH62004.h:21
LArGeo::ModulesConstructionH62004::LeakGeom
Definition: ModulesConstructionH62004.h:44
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
StoredMaterialManager.h
LArGeo::ModulesConstructionH62004::LeakGeom::m_shiftZ
float m_shiftZ[NUM_LEAK]
Definition: ModulesConstructionH62004.h:47
LArGeo::ModulesConstructionH62004::LeakGeom::m_shiftX
float m_shiftX[NUM_LEAK]
Definition: ModulesConstructionH62004.h:47
PixelConvert::GetID
unsigned int GetID(const Map &map, const unsigned int moduleID)
Definition: PixelConvert.cxx:433
FCALConstructionH62004.h
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
LArGeoTB2004Options.h
LArGeo::ModulesConstructionH62004::LeakGeom::m_dY
float m_dY[NUM_LEAK]
Definition: ModulesConstructionH62004.h:46
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
LArGeo::ModulesConstructionH62004::s_leakGeom
static const LeakGeom s_leakGeom
Definition: ModulesConstructionH62004.h:50
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
LArGeo::ModulesConstructionH62004::LeakGeom::m_dX
float m_dX[NUM_LEAK]
Definition: ModulesConstructionH62004.h:46
LArGeo::ModulesConstructionH62004::LeakGeom::LeakGeom
LeakGeom()
Definition: ModulesConstructionH62004.cxx:59
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
StoredMaterialManager::getMaterial
virtual const GeoMaterial * getMaterial(const std::string &name)=0
StoredMaterialManager
This class holds one or more material managers and makes them storeable, under StoreGate.
Definition: StoredMaterialManager.h:28
LArGeo::ModulesConstructionH62004::construct
static GeoLogVol * construct(StoredMaterialManager *materialManager, int side, int dir, int calo)
Definition: ModulesConstructionH62004.cxx:563
HECConstructionH62004.h
merge.status
status
Definition: merge.py:17
LArGeo::ModulesConstructionH62004::position
static GeoTrf::Transform3D position(int side, int dir, int calo)
Definition: ModulesConstructionH62004.cxx:654
LArGeo::ModulesConstructionH62004::LeakGeom::m_dZ
float m_dZ[NUM_LEAK]
Definition: ModulesConstructionH62004.h:46
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
LArGeo::EMECModuleConstruction::GetEnvelope
virtual GeoIntrusivePtr< GeoVFullPhysVol > GetEnvelope()
Definition: EMECModuleConstruction.cxx:75
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
python.CaloScaleNoiseConfig.default
default
Definition: CaloScaleNoiseConfig.py:79
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
python.SystemOfUnits.degree
tuple degree
Definition: SystemOfUnits.py:106
python.SystemOfUnits.rad
int rad
Definition: SystemOfUnits.py:111
StoredPhysVol.h