ATLAS Offline Software
BarrelConstruction.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 // GeoModel description of LAr EM Barrel calorimeter
7 // translated from G4 code (G.Parrour) by G.Unal
8 // translated then from placements to parameterizations
9 // by J. Boudreau.
10 // made consistent with last hardcoded G4 version by G.Unal, July 2005
11 
12 // creation: August 2003
13 
15 #include "BarrelAuxFunctions.h"
16 
18 #include "GeoModelKernel/GeoFullPhysVol.h"
19 
20 #include "GeoModelKernel/GeoElement.h"
21 #include "GeoModelKernel/GeoIdentifierTag.h"
22 #include "GeoModelKernel/GeoLogVol.h"
23 #include "GeoModelKernel/GeoMaterial.h"
24 #include "GeoModelKernel/GeoNameTag.h"
25 #include "GeoModelKernel/GeoPhysVol.h"
26 #include "GeoModelKernel/GeoSerialIdentifier.h"
27 #include "GeoModelKernel/GeoSerialTransformer.h"
28 #include "GeoModelKernel/GeoTransform.h"
29 #include "GeoModelKernel/GeoVPhysVol.h"
30 #include "GeoModelKernel/GeoXF.h"
32 
33 // volumes used: Pcon, Tubs, Cons, Box, Trap
34 #include "GeoModelKernel/GeoPcon.h"
35 #include "GeoModelKernel/GeoTubs.h"
36 #include "GeoModelKernel/GeoCons.h"
37 #include "GeoModelKernel/GeoBox.h"
38 #include "GeoModelKernel/GeoTrap.h"
39 #include "StoreGate/StoreGateSvc.h"
42 // For transforms:
43 #include "CLHEP/Geometry/Transform3D.h"
44 #include "CLHEP/Vector/Rotation.h"
45 // For functions:
46 #include "GeoGenericFunctions/Abs.h"
47 #include "GeoGenericFunctions/Sin.h"
48 #include "GeoGenericFunctions/Cos.h"
49 #include "GeoGenericFunctions/Sqrt.h"
50 #include "GeoGenericFunctions/ATan.h"
51 #include "GeoGenericFunctions/Rectangular.h"
52 #include "GeoGenericFunctions/Mod.h"
53 #include "GeoGenericFunctions/Variable.h"
54 #include "GeoGenericFunctions/FixedConstant.h"
55 // For units:
56 #include "GaudiKernel/PhysicalConstants.h"
57 #include "GaudiKernel/Bootstrap.h"
58 
64 
65 
66 // Some additional objects to store for future reference:
68 
69 #include <string>
70 #include <cmath>
71 #include <cfloat>
72 
73 #define BUILD_FRONT_ELECTRONICS
74 #define BUILD_HIGHETA_ELECTRONICS
75 #define BUILD_FRONT_G10
76 #define BUILD_BACK_G10
77 #define BUILD_ACCORDION_PLATES
78 #define BUILD_FRONT_STEEL
79 
80 // GU 29-Jul-2005
81 // *Add summing board effective layer
82 // *Change material for inner and outer G10 ring -> G10_bar
83 // *Put small iron tips in the front G10 pieces before the absorbers
84 // *Fix z lenght as in latest hardcoded G4 geometry
85 // *if no sagging, set deltay=0 => almost all code sagging/no_sagging becomes the same
86 // and much less if(m_A_SAGGING) are needed
87 // *small modifications in test beam case to agree with last hardcoded version
88 
89 // JFB Notes:
90 // Parameterizing most volumes.
91 // Wrote the motherboard positioning using function composition.
92 // Write the cable positioning by inheriting a positioning function.
93 // All log messages are at the end. They are sent to msg stream.
94 // Stack logical volume was set smartless in G4, still no solution to that.
95 // Please review the number of electrodes in the test beam case. Should be
96 // one less than number of cells.
97 
98 // Redid the structure a little bit. There are two, full, physical volumes one
99 // for the positive half-barrel and one for the negative half-barrel but they
100 // both share the same innards... don't want to duplicate this, do we?
101 
102 //===================constructor
103 
106  : AthMessaging("BarrelConstruction")
107  , m_parameters(params)
108  , m_fullGeo(fullGeo)
109 {
110 }
111 
112 //===================destructor
113 
115 = default;
116 
117 //================== get envelope
118 
119 GeoIntrusivePtr<GeoFullPhysVol>LArGeo::BarrelConstruction::GetPositiveEnvelope() {
120  if (!m_ecamPhysicalPos) MakeEnvelope();
121  return m_ecamPhysicalPos;
122 }
123 
124 GeoIntrusivePtr<GeoFullPhysVol>LArGeo::BarrelConstruction::GetNegativeEnvelope() {
125  if (!m_ecamPhysicalNeg) MakeEnvelope();
126  return m_ecamPhysicalNeg;
127 }
128 
130 {
131  ISvcLocator *svcLocator = Gaudi::svcLocator();
132 
133  ATH_MSG_DEBUG("++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
134  << "+ +\n"
135  << "+ Start of Barrel EM GeoModel definition +\n"
136  << "+ +\n"
137  << "++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
138  << " \n"
139  << "Sagging in geometry " << m_A_SAGGING << "\n"
140  << " \n"
141  << " ");
142 
143  if (msgLvl(MSG::DEBUG)) {
144  printParams();
145  }
146 
147  bool doDetailedAbsorberStraight = false;
148  bool doDetailedAbsorberFold = false;
149 
150  SmartIF<IGeoModelSvc> geoModel{svcLocator->service ("GeoModelSvc")};
151  if(!geoModel.isValid())
152  throw std::runtime_error("Error in BarrelConstruction, cannot access GeoModelSvc");
153  SmartIF<IRDBAccessSvc> rdbAccess{svcLocator->service ("RDBAccessSvc")};
154  if(!rdbAccess.isValid())
155  throw std::runtime_error("Error in BarrelConstruction, cannot access RDBAccessSvc");
156 
157  DecodeVersionKey larVersionKey(geoModel, "LAr");
158 
159  ATH_MSG_INFO("Getting primary numbers for " << larVersionKey.node() << ", " << larVersionKey.tag());
160 
161  IRDBRecordset_ptr switchSet = rdbAccess->getRecordsetPtr("LArSwitches", larVersionKey.tag(), larVersionKey.node());
162  if ((*switchSet).size() !=0) {
163  const IRDBRecord *switches = (*switchSet)[0];
164  if (!switches->isFieldNull("DETAILED_ABSORBER")) {
165  if (switches->getInt("DETAILED_ABSORBER") !=0) {
166  ATH_MSG_DEBUG(" DETAILED_ABSORBER is 1 ");
167  doDetailedAbsorberStraight = true;
168  doDetailedAbsorberFold = true;
169  } else {
170  ATH_MSG_DEBUG(" DETAILED_ABSORBER is 0 ");
171  }
172  } else {
173  ATH_MSG_DEBUG(" no DETAILED_ABSORBER structure in DB ");
174  }
175  } else {
176  ATH_MSG_WARNING(" LArSwitches structure not found ");
177  }
178 
179  ATH_MSG_INFO(" Makes detailed absorber sandwich ? " << doDetailedAbsorberStraight << " " << doDetailedAbsorberFold);
180  ATH_MSG_INFO(" Use sagging in geometry ? " << m_A_SAGGING);
181 
182  GeoGenfun::Cos Cos;
183  GeoGenfun::Sin Sin;
184  GeoGenfun::Sqrt Sqrt;
185  GeoGenfun::ATan ATan;
186 
187  double twopi64 = Gaudi::Units::pi/32.;
188  double twopi32 = 2.*twopi64;
189 
190 
191  SmartIF<StoreGateSvc> detStore{svcLocator->service("DetectorStore")};
192  if (!detStore.isValid()) {
193  throw std::runtime_error("Error in LArDetectorFactory, cannot access DetectorStore");
194  }
195 
196 
197  StoredMaterialManager* materialManager = nullptr;
198  if (StatusCode::SUCCESS != detStore->retrieve(materialManager, std::string("MATERIALS"))) {
199  throw std::runtime_error("Error in BarrelConstruction, stored MaterialManager is not found.");
200  }
201 
202  const GeoMaterial *Iron = materialManager->getMaterial("std::Iron");
203  if (!Iron) throw std::runtime_error("Error in BarrelConstruction, std::Iron is not found.");
204 
205  const GeoMaterial *LAr = materialManager->getMaterial("std::LiquidArgon");
206  if (!LAr) throw std::runtime_error("Error in BarrelConstruction, std::LiquidArgon is not found.");
207 
208  const GeoMaterial *Lead = materialManager->getMaterial("std::Lead");
209  if (!Lead) throw std::runtime_error("Error in BarrelConstruction, std::Lead is not found.");
210 
211  const GeoMaterial *G10_bar = materialManager->getMaterial("LAr::G10_bar");
212  if (!G10_bar) throw std::runtime_error("Error in BarrelConstruction, LAr::G10_bar is not found.");
213 
214  const GeoMaterial *Moth_elect = materialManager->getMaterial("LAr::MBoards");
215  if (!Moth_elect) throw std::runtime_error("Error in BarrelConstruction, LAr::MBoards is not found.");
216 
217  const GeoMaterial *Cable_elect = materialManager->getMaterial("LAr::Cables");
218  if (!Cable_elect) throw std::runtime_error("Error in BarrelConstruction, LAr::Cables is not found.");
219 
220  const GeoMaterial *Thin_abs = materialManager->getMaterial("LAr::Thinabs");
221  if (!Thin_abs) throw std::runtime_error("Error in BarrelConstruction, LAr::Thinabs is not found.");
222 
223  const GeoMaterial *Thick_abs = materialManager->getMaterial("LAr::Thickabs");
224  if (!Thick_abs) throw std::runtime_error("Error in BarrelConstruction, LAr::Thickabs is not found.");
225 
226  const GeoMaterial *Kapton_Cu = materialManager->getMaterial("LAr::KaptonC");
227  if (!Kapton_Cu) throw std::runtime_error("Error in BarrelConstruction, LAr::KaptonC is not found.");
228 
229  const GeoMaterial *Sumb = materialManager->getMaterial("LAr::SBoard");
230  if (!Sumb) throw std::runtime_error("Error in BarrelConstruction, LAr::SBoard is not found.");
231 
232  const GeoMaterial *Glue = materialManager->getMaterial("LAr::Glue");
233  if (!Glue) throw std::runtime_error("Error in BarrelConstruction, LAr::Glue is not found.");
234 
235  const GeoElement *Pb = materialManager->getElement("Lead");
236  if (!Pb) throw std::runtime_error("Error in BarrelConstruction, element lead not found ");
237 
238  const GeoElement *Fe = materialManager->getElement("Iron");
239  if (!Fe) throw std::runtime_error("Error in BarrelConstruction, element Fe not found ");
240 
241 
242  double contract = m_parameters->GetValue("LArEMBAbsorberContraction");
243 
244  double density_lead = Lead->getDensity()/(contract*contract*contract);
245  GeoRef<GeoMaterial> myLead (new GeoMaterial("myLead",density_lead));
246  myLead->add(Pb,1.0);
247  myLead->lock();
248 
249  double density_iron = Iron->getDensity()/(contract*contract*contract);
250  GeoRef<GeoMaterial> myIron (new GeoMaterial("myIron",density_iron));
251  myIron->add(Fe,1.0);
252  myIron->lock();
253 
254 
255 
256 #ifdef DEBUGGEO
257  std::cout << "*** BarrelConstruction: List of Materials, density,X0,Lambda " << std::endl;
258  std::cout << " Iron " << Iron->getDensity() << " "
259  << Iron->getRadLength() << " "
260  << Iron->getIntLength() << std::endl;
261  std::cout << " LAR " << LAr->getDensity() << " "
262  << LAr->getRadLength() << " "
263  << LAr->getIntLength() << std::endl;
264  std::cout << " G10_bar " << G10_bar->getDensity() << " "
265  << G10_bar->getRadLength() << " "
266  << G10_bar->getIntLength() << std::endl,
267  std::cout << " Moth_elect " << Moth_elect->getDensity() << " "
268  << Moth_elect->getRadLength() << " "
269  << Moth_elect->getIntLength() << std::endl;
270  std::cout << " Cable " << Cable_elect->getDensity() << " "
271  << Cable_elect->getRadLength() << " "
272  << Cable_elect->getIntLength() << std::endl;
273  std::cout << " Sumb " << Sumb->getDensity() << " "
274  << Sumb->getRadLength() << " "
275  << Sumb->getIntLength() << std::endl;
276  std::cout << " Thin_abs " << Thin_abs->getDensity() << " "
277  << Thin_abs->getRadLength() << " "
278  << Thin_abs->getIntLength() << std::endl;
279  std::cout << " Thick_abs " << Thick_abs->getDensity() << " "
280  << Thick_abs->getRadLength() << " "
281  << Thick_abs->getIntLength() << std::endl;
282  std::cout << " Kapton_Cu " << Kapton_Cu->getDensity() << " "
283  << Kapton_Cu->getRadLength() << " "
284  << Kapton_Cu->getIntLength() << std::endl;
285 #endif
286  std::string baseName = "LAr::EMB::";
287 
288 
289  // -------------------------------------------------------------
290  // start Detector geometry
291  //--------------------------------------------------------------
292 
293  double Moth_Z_min = m_parameters->GetValue("LArEMBMotherZmin");
294  double Moth_Z_max = m_parameters->GetValue("LArEMBMotherZmax");
295 
296  // radius and phi ranges of EM barrel
297 
298  double Moth_inner_radius = m_parameters->GetValue("LArEMBMotherRmin");
299  double Moth_outer_radius = m_parameters->GetValue("LArEMBMotherRmax");
300 
301  double Moth_Phi_Min = 0.;
302  double Moth_Phi_Max = m_parameters->GetValue("LArEMBphiMaxBarrel")*Gaudi::Units::deg;
303 
304 #ifdef DEBUGGEO
305  std::cout << " *** Mother volume (Ecam) parameters " << std::endl;
306  std::cout << " Rmin/Rmax " << Moth_inner_radius << " " << Moth_outer_radius << std::endl;
307  std::cout << " Zmin/Zmax " << Moth_Z_min << " " << Moth_Z_max << std::endl;
308  std::cout << " phi1,Dphi (Gaudi::Units::deg)" << Moth_Phi_Min/Gaudi::Units::deg << " " << Moth_Phi_Max/Gaudi::Units::deg << std::endl;
309 #endif
310 
311  // number of zigs for accordion
312  int Nbrt = (int) ( m_parameters->GetValue("LArEMBnoOFAccZigs") ); // =14
313 
314  // Z coordinates for half barrel in
315  double Bar_Z_min = Moth_Z_min;
316  double Bar_Z_max = Moth_Z_max;
317 
318  // Radius of the first fold
319 //GU -> to be consistent with hard coded geometry
320  double Rhocen1 = m_parameters->GetValue("LArEMBRadiusAtCurvature",0);
321 
322  // R and Z coordinates of ETA_cuts.
323  double Bar_Eta_cut = (double) (m_parameters->GetValue("LArEMBMaxEtaAcceptance"));
324 #ifdef DEBUGGEO
325  std::cout << " Bar_Eta_cut " << Bar_Eta_cut << std::endl;
326 #endif
327 
328  double Bar_Z_cut, Bar_Rcmx ;
329 // z max at low radius
330  Bar_Z_cut = (double) (m_parameters->GetValue("LArEMBMotherZmin"))
331  + (double) (m_parameters->GetValue("LArEMBG10FrontDeltaZ"));
332 // minimal radius at Bar_z_max
333  Bar_Rcmx = (double) (m_parameters->GetValue("LArEMBRminHighZ"));
334 
335  double Zp0 = 0.;
336 
337  // Half-length of this Half barrel
338  double Zhalf = (Bar_Z_max-Bar_Z_min)/2.;
339  // Half-length of the half barrel up to Zcut
340  double Zhalfc = (Bar_Z_cut-Bar_Z_min)/2.;
341 
342 
343  // Accordion shape parameters:
344  // rho phi of curvature centers and delta's
345  // IN 2D_transverse LOCAL framework of a layer and symetry axis as X_axis
346  // delta's are GEOMETRICAL angles of straight parts w.r. the Y_axis )
347 
348  double Rhocen[15], Phicen[15], Delta[15], deltay[15], deltax[15], TetaTrans[15];
349  for (int idat=0; idat<15; idat++)
350  {
351  Rhocen[idat] =
352  (double) (m_parameters->GetValue("LArEMBRadiusAtCurvature",idat));
353  Phicen[idat] =
354  (double) (m_parameters->GetValue("LArEMBPhiAtCurvature",idat));
355  Delta[idat] =
356  (double) (m_parameters->GetValue("LArEMBDeltaZigAngle",idat));
357  if(idat == 14) Delta[idat] = (90.0) * Gaudi::Units::deg;
358 
359  // Maximum SAGGING displacement for each of the fifteen folds in Gaudi::Units::mm
360  // (should be 0.0, 0.17, 0.30, 0.63, 0.78, 1.06, 1.09, 1.21, 1.07, 1.03, 0.74, 0.61, 0.27, 0.20, 0.0)
361 //GUtmp sagging amplied by 10
362  if (m_A_SAGGING) {
363  deltay[idat] =
364  (double) (m_parameters->GetValue("LArEMBSaggingAmplitude",idat));
365  deltax[idat] =
366  (double) (m_parameters->GetValue("LArEMBSaggingAmplitude2",idat));
367  }
368  else {
369  deltay[idat]=0.;
370  deltax[idat]=0.;
371  }
372 
373  // eta of lead transition
374  double etaTrans = (double) (m_parameters->GetValue("LArEMBEtaTrans",idat));
375  TetaTrans[idat] = 2.*atan(exp(-etaTrans));
376 
377  ATH_MSG_DEBUG("idat " << idat << " Rhocen/Phice/Delta/deltay/deltax/etatrans "
378  << Rhocen[idat] << " " << Phicen[idat]*(1./Gaudi::Units::deg) << " "
379  << Delta[idat]*(1./Gaudi::Units::deg) << " " << deltay[idat] << " " << deltax[idat]
380  << " " << etaTrans);
381  }
382 
383 // parity of accordion waves
384  int checkParity=0; // for case where first absorber wave goes up
385  if (Phicen[0]<0.) checkParity=1; // case where first absorber wave goes down
386 
387 
388  int Ncell = (int) (m_parameters->GetValue("LArEMBnoOFPhysPhiCell"));
389  int Nabsorber = (Ncell==64) ? Ncell + 1 : Ncell;
390  int Nelectrode = Ncell;
391 
392  // If the user has specifically limited the number of cells (e.g. for visualization)
393  // then only create this number....
394  if (m_NVISLIM > 0) Nabsorber = m_NVISLIM;
395  if (m_NVISLIM > 0) Nelectrode = m_NVISLIM;
396  if (m_NVISLIM > 0) {
397  ATH_MSG_WARNING("================LAr BarrelConstruction===========================\n"
398  << "===YOU ARE RUNNING WITH A LIMITED SLICE OF BARREL ACCORDEON ===\n"
399  << "===THIS OPTION IS FOR VISUALIZATION OR OTHER TESTING, ONLY!! ===\n"
400  << "===AND IF THIS IS NOT YOUR INTENTION PLEASE BE SURE TO SET ===\n"
401  << "===THE FLAG GeoModelSvc.LArDetectorTool.BarrelCellVisLimit=-1 ===\n"
402  << "===Remember there are no defaults in Athena. Thank you. ===\n"
403  << "=================================================================");
404  }
405 
406 
407 // z of end of G10 ring
408  double z1 = m_parameters->GetValue("LArEMBG10FrontDeltaZ")+ Moth_Z_min;
409 // radius of end of G10 ring
410  const double r1 = Moth_inner_radius
411  + m_parameters->GetValue("LArEMBInnerElectronics")
412  + m_parameters->GetValue("LArEMBG10SupportBarsIn");
413 // minimum radius at end of volume
414  const double r2 = m_parameters->GetValue("LArEMBRminHighZ");
415  const double inv_r2_r1 = 1. / (r2-r1);
416 
417 // max z of Stac (@ r = Rhocen[0] )
418  double zmax1_Stac = z1 + (Rhocen[0]-r1)*(Moth_Z_max-z1)*inv_r2_r1;
419 
420 
421  // Construct the container volume (Accordion plates, G10 bars, etc...)
422  // for the LAr in the Barrel
423  // That is the volume ECAM
424  // Define the volume into which we'll place all other EMB elements.
425  // ==GU 11/06/2003
426  // in test beam case need to have ECAM between -1.555 and size 24.055 degrees
427  // (i.e. a little bit wider than one calorimeter module)
428  // (we need to have ECAM volume sligthly wider than STAC to avoid G4 tracking becoming
429  // very confused at the common surface between ECAM and STAC)
430  //-----------------ECAM---------------------------------------------------------//
431  { //
432  double Moth_Phi_Min2 = (Ncell == 64) ? -1.555*Gaudi::Units::deg : 0.; //
433  double Moth_Phi_Max2 = (Ncell == 64) ? 25.61*Gaudi::Units::deg : 2*M_PI; //
434  //
435  double safety_rhocen1 = 0.040*Gaudi::Units::mm; //
436  double Zplan[] = {Bar_Z_min-Zp0,Bar_Z_cut-Zp0,Bar_Z_max-Zp0}; //
437  double Riacc[] = {Moth_inner_radius,Moth_inner_radius, Rhocen1-safety_rhocen1}; //
438  double Roacc[] = {Moth_outer_radius,Moth_outer_radius,Moth_outer_radius}; //
439  //
440 #ifdef DEBUGGEO
441  std::cout << " *** Parameters for ECAM Pcon volume " << std::endl;
442  std::cout << " Zplan " << Zplan[0] << " " << Zplan[1] << " " << Zplan[2] << std::endl;
443  std::cout << " Rin " << Riacc[0] << " " << Riacc[1] << " " << Riacc[2] << std::endl;
444  std::cout << " Rout " << Roacc[0] << " " << Roacc[1] << " " << Roacc[2] << std::endl;
445  std::cout << " PhiMin,Dphi " << Moth_Phi_Min2/Gaudi::Units::deg << " " << Moth_Phi_Max2/Gaudi::Units::deg << std::endl;
446 #endif
447  int ecamArraySize = sizeof(Zplan) / sizeof(double); //
448  std::string name = baseName + "ECAM"; //
449  GeoPcon* pCon = new GeoPcon(Moth_Phi_Min2, // starting phi //
450  Moth_Phi_Max2); // moth_phi_max2=Dphi //
451  // //
452  for (int i=0; i< ecamArraySize; i++) //
453  { //
454  pCon->addPlane(Zplan[i],Riacc[i],Roacc[i]); //
455  } //
456  const GeoLogVol* logVol = new GeoLogVol(name,pCon,LAr); //
457  m_ecamPhysicalPos = new GeoFullPhysVol(logVol); //
458  m_ecamPhysicalNeg = new GeoFullPhysVol(logVol); //
459  //
460  // store FullPhysicalVolumes in the manager //
461  //_manager->set_volLink(CaloSubdetNames::EMB_POS,m_ecamPhysicalPos); //
462  //_manager->set_volLink(CaloSubdetNames::EMB_NEG,m_ecamPhysicalNeg); //
463  {
464  StoredPhysVol *sPhysVol = new StoredPhysVol(m_ecamPhysicalPos);
465  StatusCode status=detStore->record(sPhysVol,"EMB_POS");
466  if(!status.isSuccess()) throw std::runtime_error ("Cannot store EMB_POS");
467  }
468  {
469  StoredPhysVol *sPhysVol = new StoredPhysVol(m_ecamPhysicalNeg);
470  StatusCode status=detStore->record(sPhysVol,"EMB_NEG");
471  if(!status.isSuccess()) throw std::runtime_error ("Cannot store EMB_NEG");
472  }
473  } //
474  //------------------------------------------------------------------------------//
475 
476  if(!m_fullGeo) return;
477 
478  //
479  // Front and Back ELECTRONICS in ECAM
480  //
481 #ifdef BUILD_FRONT_ELECTRONICS
482 
483  // Front Electronics are in a TUBE
484 
485 
486  //-----------------TELF---------------------------------------------------------//
487  GeoIntrusivePtr<GeoPhysVol>Elnicsf_phys=nullptr;
488  double Xel1f;
489  {
490  // WARNING : this "hard_coded" 0.010*Gaudi::Units::mm is a "security" to avoid
491  // fake "overlapping" diagnostics with "DAVID"
492  Xel1f = m_parameters->GetValue("LArEMBInnerElectronics"); // 23.*Gaudi::Units::mm
493  double DeltaZ = Zhalfc;
494  double Zpos = Zhalfc+Bar_Z_min;
495  double Rmini = Moth_inner_radius + 0.010*Gaudi::Units::mm;
496  double Rmaxi = Rmini+Xel1f - 0.010*Gaudi::Units::mm;
497  std::string name = baseName + "TELF";
498 #ifdef DEBUGGEO
499  std::cout << " *** parameters for TELF tubs " << std::endl;
500  std::cout << " DeltaZ " << DeltaZ << std::endl;
501  std::cout << " Rmin/Rmax " << Rmini << " " << Rmaxi << std::endl,
502  std::cout << " PhiMin,Dphi " << Moth_Phi_Min/Gaudi::Units::deg << " " << Moth_Phi_Max/Gaudi::Units::deg << std::endl;
503  std::cout << " Zpos in ECAM " << Zpos << std::endl;
504 #endif
505  GeoTubs* tubs = new GeoTubs(Rmini, // rmin
506  Rmaxi, // rmax
507  DeltaZ, // deltaZ/2.
508  Moth_Phi_Min, // phi min
509  Moth_Phi_Max); // deltaphi
510  const GeoLogVol* logVol = new GeoLogVol(name,tubs,LAr);
511  Elnicsf_phys = new GeoPhysVol(logVol);
512  m_ecamPhysicalPos->add(new GeoTransform(GeoTrf::TranslateZ3D(Zpos)));
513  m_ecamPhysicalPos->add(Elnicsf_phys);
514  m_ecamPhysicalNeg->add(new GeoTransform(GeoTrf::TranslateZ3D(Zpos)));
515  m_ecamPhysicalNeg->add(Elnicsf_phys);
516  }
517  //------------------------------------------------------------------------------//
518 
519 
520  // GU 28-07-2005
521  //------- effective Copper + LAr mixture to accoung for pins+summing boards
522  // (follow mixture described in Pascal Perrodo note
523  GeoIntrusivePtr<GeoPhysVol>Sumb_phys=nullptr;
524  {
525  double ThickSum = 10.*Gaudi::Units::mm; // FIXME should be in geometry database
526  double Rmini = Moth_inner_radius+Xel1f-ThickSum;
527  double Rmaxi = Moth_inner_radius+Xel1f -0.020*Gaudi::Units::mm; // safety margin
528  double DeltaZ = Zhalfc;
529  double Zpos=0.;
530  std::string name = baseName + "SUMB";
531 #ifdef DEBUGGEO
532  std::cout << " *** parameters for SUMB tubs " << std::endl;
533  std::cout << " DeltaZ " << DeltaZ << std::endl;
534  std::cout << " Rmin/Rmax " << Rmini << " " << Rmaxi << std::endl,
535  std::cout << " PhiMin,Dphi " << Moth_Phi_Min/Gaudi::Units::deg << " " << Moth_Phi_Max/Gaudi::Units::deg << std::endl;
536  std::cout << " Zpos in TELF " << Zpos << std::endl;
537 #endif
538 
539  GeoTubs * tubs = new GeoTubs(Rmini,Rmaxi,DeltaZ,Moth_Phi_Min,Moth_Phi_Max);
540  const GeoLogVol* logVol = new GeoLogVol(name,tubs,Sumb);
541  Sumb_phys = new GeoPhysVol(logVol);
542  Elnicsf_phys->add(new GeoTransform(GeoTrf::TranslateZ3D(Zpos)));
543  Elnicsf_phys->add(Sumb_phys);
544  }
545 
546 
547  // Solids and Logical Volumes for Mother_Boards and cables-------------------//
548  {
549  double ClearancePS = m_parameters->GetValue("LArEMBMoBoclearfrPS");
550  double RhoPosB = Moth_inner_radius + ClearancePS;
551  double bdx = .5*(m_parameters->GetValue("LArEMBMoBoTchickness")); // 4.3/2.*Gaudi::Units::mm
552  double bdy = .5*(m_parameters->GetValue("LArEMBMoBoHeight")); // 72.3/2.*Gaudi::Units::mm;
553  double bdz = Zhalfc - 0.007*Gaudi::Units::mm;
554 
555  //------------------------MOTHERBOARDS--------------------------------------------//
556  // JFB Make & Place the motherboards inside overall tube //
557  { //
558  double PhiOrig = 0.; //
559  int NoOFboard = (int) m_parameters->GetValue("LArEMBnoOFmothboard"); // 32
560  double PhiPos0 = twopi64 + PhiOrig; //
561  // //
562  std::string name = baseName + "MOAC"; //
563 #ifdef DEBUGGEO
564  std::cout << " *** parameters for MotherBoard (box)" << std::endl;
565  std::cout << " dx,dy,dz " << bdx << " " << bdy << " " << bdz << std::endl;
566  std::cout << " Radius pos " << RhoPosB << std::endl;
567  std::cout << " Phi0,Dphi " << PhiPos0/Gaudi::Units::deg << " " << twopi32/Gaudi::Units::deg << std::endl;
568 #endif
569  GeoBox * box = new GeoBox(bdx,bdy,bdz); //
570  const GeoLogVol * logVol = new GeoLogVol(name,box,Moth_elect); //
571  GeoPhysVol * pV = new GeoPhysVol(logVol); //
572  GeoSerialIdentifier * iD = new GeoSerialIdentifier(0); //
573  GeoGenfun::Variable c; //
574  GeoGenfun::GENFUNCTION PhiPos = PhiPos0 + twopi32*c; //
575  GeoXF::TRANSFUNCTION TX = //
576  GeoXF::Pow(GeoTrf::TranslateX3D(1.0),RhoPosB*Cos(PhiPos))* //
577  GeoXF::Pow(GeoTrf::TranslateY3D(1.0),RhoPosB*Sin(PhiPos))* //
578  GeoXF::Pow(GeoTrf::RotateZ3D(1.0),PhiPos); //
579  GeoSerialTransformer *st = new GeoSerialTransformer(pV, &TX, NoOFboard); //
580  Elnicsf_phys->add(iD); //
581  Elnicsf_phys->add(st); //
582  // //
583  } //
584  //--------------------------------------------------------------------------------//
585 
586  //** GU: GeoModel GeoTrap constructor only has the 11 argument
587  // full list and not some possible shorter versions of G4
588  // => add the needed arguments
589  // Dz=Dzc,Theta=0,Phi=0,DyDzn=Dy1,DxDyndzn=Dx1 Dxdypdzn=Dx1
590  // Angleydzn=0, DyDzp=Dy2,Dxdnydzp=Dx2,dwdypdzp=Dx2
591  // Angleydzp=0
592  //---------------------------------CABLES-----------------------------------------//
593  // JFB Place the cables //
594  { //
595  // //
596  double Dzc = Zhalfc - 0.007*Gaudi::Units::mm; //
597  double Dx1 = .5*(m_parameters->GetValue("LArEMBCablethickat0")); // 1./2.*Gaudi::Units::mm
598  double Dx2 = .5*Bar_Eta_cut*(m_parameters->GetValue("LArEMBthickincrfac")); //
599  // Dx2 should be 5.17/2.*Bar_Eta_cut*Gaudi::Units::mm Trapezoid's side linear with Eta //
600  double Dy1 = .5*(m_parameters->GetValue("LArEMBCableEtaheight")); // 70./2.*Gaudi::Units::mm
601  double Dy2 = Dy1; //
602  // //
603  int NoOFcable = (int) m_parameters->GetValue("LArEMBnoOFcableBundle"); // 64
604  double RhoPosC = Moth_inner_radius + ClearancePS; //
605  // //
606  std::string name = baseName + "CAAC"; //
607 #ifdef DEBUGGEO
608  std::cout << " *** Parameters for Cable (Trap) " << std::endl;
609  std::cout << " Dzc " << Dzc << std::endl;
610  std::cout << " Dx1,Dx2 (half thickness at eta=0 and etamax " << Dx1 << " " << Dx2 << std::endl;
611  std::cout << " Dy1,Dy2 " << Dy1 << " " << Dy2 << std::endl;
612  std::cout << " Radial Position " << RhoPosC << std::endl;
613 #endif
614  // GeoTrap* trap = new GeoTrap(Dx1,Dx2,Dy1,Dy2,Dzc); //
615  GeoTrap* trap = new GeoTrap(Dzc,0.,0.,Dy1,Dx1,Dx1,0., //
616  Dy2,Dx2,Dx2,0.); //
617  const GeoLogVol* logVol = new GeoLogVol(name,trap,Cable_elect); //
618  // //
619  GeoPhysVol * pV = new GeoPhysVol(logVol); //
620  GeoSerialIdentifier * iD = new GeoSerialIdentifier(0); //
621  double PhiPos0 = (twopi64 - asin(bdy/RhoPosB))/2.; //
622 #ifdef DEBUGGEO
623  std::cout << " PhiPos0 " << PhiPos0 << std::endl;
624 #endif
625  GeoGenfun::Variable I; //
626  // //
627  // -------------Make a Kronecker Delta Here--------// //
628  GeoGenfun::Rectangular KDelta; // //
629  KDelta.baseline().setValue(0.0); // //
630  KDelta.height().setValue(1.0); // //
631  KDelta.x0().setValue(-0.5); // //
632  KDelta.x1().setValue(0.5); // //
633  //-------------------------------------------------// //
634  // //
635  GeoGenfun::Mod Mod1(1.0),Mod2(2.0),Mod4(4.0); //
636  GeoGenfun::GENFUNCTION Int = I - Mod1; //
637  GeoGenfun::GENFUNCTION Ccopy = Int(I + 0.5); //
638  GeoGenfun::GENFUNCTION PhiOrig = 22.5*Gaudi::Units::deg*Int(Ccopy/4); //
639  GeoGenfun::GENFUNCTION PhiPos1 = PhiPos0 + PhiOrig; //
640  GeoGenfun::GENFUNCTION PhiPos2 = twopi32 - PhiPos0 + PhiOrig; //
641  GeoGenfun::GENFUNCTION PhiPos00 = //
642  (KDelta(Mod4(Ccopy)-2) + KDelta(Mod4(Ccopy)-3))*PhiPos2 + //
643  (1.0-KDelta(Mod4(Ccopy)-2)-KDelta(Mod4(Ccopy)-3))*PhiPos1; //
644  GeoGenfun::GENFUNCTION PhiPos = PhiPos00 + Mod2(Ccopy)*twopi32; //
645  GeoXF::TRANSFUNCTION TX = //
646  GeoXF::Pow(GeoTrf::TranslateX3D(1.0),RhoPosC*Cos(PhiPos))* //
647  GeoXF::Pow(GeoTrf::TranslateY3D(1.0),RhoPosC*Sin(PhiPos))* //
648  GeoXF::Pow(GeoTrf::RotateZ3D(1.0),PhiPos); //
649  GeoSerialTransformer *st = new GeoSerialTransformer(pV, &TX, NoOFcable); //
650 #ifdef DEBUGGEO
651  for (int ii=0;ii<NoOFcable;ii++) {
652  std::cout << "copy, phi " << ii << " " << PhiPos(ii)/Gaudi::Units::deg << std::endl;
653  }
654 #endif
655  Elnicsf_phys->add(iD); //
656  Elnicsf_phys->add(st); //
657  // //
658  } //
659  //--------------------------------------------------------------------------------//
660  }
661 #endif // BUILD_FRONT_ELECTRONICS
662 
663  // add 1.3 Gaudi::Units::mm in z to allow cleareance for absorber with non //
664  // 0 thickness, at eta=1.475, low r part of the barrel //
665  // this affects STAC and TELB volumes //
666  double clearance = 1.3*Gaudi::Units::mm;
667 
668 #ifdef BUILD_HIGHETA_ELECTRONICS
669 
670  // back electronics are in an extruded cone
671  //
672  // ***GU: GeoCons be very careful, the order of the arguments
673  // is NOT the same as in G4Cons routine!!!
674  // G4 order: Rmin1,Rmax1,Rmin2,Rmax2,DeltaZ,phi0,Dphi
675  // Geo order: Rmin1,Rmin2,Rmax1,Rmax2,DeltaZ,phi0,Dphi
676  //---------------------------------HIGHETA ELECTRONICS----------------------------//
677  { //
678  // //
679  // GU fix of TELB //
680  double ze1= zmax1_Stac+clearance; //
681  double ze2 = Bar_Z_max; //
682  double safety = 0.05*Gaudi::Units::mm;
683  double DeltaZ = 0.5*(ze2-ze1)-safety; // 50 micron for safety.
684  double Zpos = ze1+DeltaZ+0.5*safety; //
685  double Rmini1 = Rhocen[0] - .030*Gaudi::Units::mm; //
686  double Rmaxi1 = Rhocen[0] - .020*Gaudi::Units::mm; //
687  double Rmini2 = Rhocen[0] - .030*Gaudi::Units::mm; //
688  double Rmaxi2 = Bar_Rcmx - clearance - .070*Gaudi::Units::mm; //
689  std::string name = baseName + "TELB"; //
690 #ifdef DEBUGGEO
691  std::cout << " *** Parameters for high eta electronics (Cons) " <<std::endl;
692  std::cout << " Rmini1,Rmini2,Rmaxi1,Rmaxi2 " << Rmini1 << " " << Rmini2 << " "
693  << Rmaxi1 << " " << Rmaxi2 << std::endl,
694  std::cout << " DeltaZ " << DeltaZ << std::endl;
695  std::cout << " Phi_Min,Dphi " << Moth_Phi_Min/Gaudi::Units::deg << " " << Moth_Phi_Max/Gaudi::Units::deg << std::endl;
696  std::cout << " Zpos " << Zpos << std::endl;
697 #endif
698  GeoCons* cons = new GeoCons(Rmini1,Rmini2,Rmaxi1,Rmaxi2, //
699  DeltaZ,Moth_Phi_Min,Moth_Phi_Max); //
700  const GeoLogVol* logVol = new GeoLogVol(name,cons,Cable_elect); //
701  GeoIntrusivePtr<GeoPhysVol> physVol = new GeoPhysVol(logVol); //
702  m_ecamPhysicalPos->add(new GeoTransform(GeoTrf::TranslateZ3D(Zpos))); //
703  m_ecamPhysicalPos->add(physVol); //
704  m_ecamPhysicalNeg->add(new GeoTransform(GeoTrf::TranslateZ3D(Zpos))); //
705  m_ecamPhysicalNeg->add(physVol); //
706  // //
707  } //
708  //--------------------------------------------------------------------------------//
709 
710 #endif // BUILD_HIGHETA_ELECTRONICS
711 
712 
713 //
714 // Front and back G10 : TUBES in ECAM
715 //
716 
717 #ifdef BUILD_FRONT_G10
718 
719 
720  //---------------------------------FRONT G10-------------------------------------//
721  { //
722  double Xel1f = m_parameters->GetValue("LArEMBInnerElectronics"); // 23.*Gaudi::Units::mm
723  double Xg10f = m_parameters->GetValue("LArEMBG10SupportBarsIn"); // 20.*Gaudi::Units::mm
724  double DeltaZ = 0.5* m_parameters->GetValue("LArEMBG10FrontDeltaZ"); //
725  double Zpos = DeltaZ+Bar_Z_min; //
726  double Rmini = Moth_inner_radius + Xel1f; //
727  double Rmaxi = Rmini+Xg10f; //
728  std::string name = baseName + "GTENF"; //
729 #ifdef DEBUGGEO
730  std::cout << " *** parameters for front G10 ring (tubs) " << std::endl;
731  std::cout << " Rmini,Rmaxi " << Rmini << " " << Rmaxi << std::endl;
732  std::cout << " DeltaZ " << DeltaZ << std::endl;
733  std::cout << " phimin,dphi " << Moth_Phi_Min/Gaudi::Units::deg << " " << Moth_Phi_Max/Gaudi::Units::deg << std::endl;
734  std::cout << " Zpos " << Zpos << std::endl;
735 #endif
736  GeoTubs* tubs = new GeoTubs(Rmini,Rmaxi,DeltaZ,Moth_Phi_Min,Moth_Phi_Max); //
737  const GeoLogVol* logVol = new GeoLogVol(name,tubs,G10_bar); //
738  GeoIntrusivePtr<GeoPhysVol> physVol = new GeoPhysVol(logVol); //
739  m_ecamPhysicalPos->add(new GeoTransform(GeoTrf::TranslateZ3D(Zpos))); //
740  m_ecamPhysicalPos->add(physVol); //
741  m_ecamPhysicalNeg->add(new GeoTransform(GeoTrf::TranslateZ3D(Zpos))); //
742  m_ecamPhysicalNeg->add(physVol); //
743 
744  IRDBRecordset_ptr extraCones = rdbAccess->getRecordsetPtr("LArCones",
745  larVersionKey.tag(),
746  larVersionKey.node());
747  if (extraCones->size() > 0 ) {
748  for(const IRDBRecord_ptr& cone : *extraCones) {
749  const std::string& conName = cone->getString("CONE");
750  if (conName=="ExtraInBar") {
751  double extra_dz = 0.5*( cone->getDouble("DZ") );
752  double extra_rmin1 = cone->getDouble("RMIN1");
753  double extra_rmin2 = cone->getDouble("RMIN2");
754  double extra_rmax1 = cone->getDouble("RMAX1");
755  double extra_rmax2 = cone->getDouble("RMAX2");
756  double extra_phi0 = cone->getDouble("PHI0");
757  double extra_dphi = cone->getDouble("DPHI");
758  double extra_zpos = cone->getDouble("ZPOS");
759 
760  std::string name = baseName + "ExtraMat1";
761  GeoCons* cons = new GeoCons(extra_rmin1,extra_rmin2,extra_rmax1,extra_rmax2,
762  extra_dz,extra_phi0,extra_dphi);
763  const GeoLogVol* logVol = new GeoLogVol(name,cons,Lead);
764  GeoIntrusivePtr<GeoPhysVol> physVol2 = new GeoPhysVol(logVol);
765  physVol->add(new GeoTransform(GeoTrf::TranslateZ3D(extra_zpos)));
766  physVol->add(physVol2);
767  }
768  }
769  }
770 
771  } //
772  //-------------------------------------------------------------------------------//
773 #endif // BUILD_FRONT_G10
774 
775 #ifdef BUILD_BACK_G10
776 
777  //---------------------------------BACK G10-------------------------------------//
778  { //
779  double DeltaZ = Zhalf; //
780  double Zpos = Zhalf+Bar_Z_min; //
781  double Xtal = m_parameters->GetValue("LArEMBLArGapTail")+ 0.1*Gaudi::Units::mm; // 13.*Gaudi::Units::mm
782  double Rmini = Rhocen[Nbrt]+Xtal; // //
783  // GU to be sure that GTENB does not go outside mother ECAM volume //
784  // Rmaxi = Rmini+Xg10b; //
785  double Rmaxi = Moth_outer_radius-0.01*Gaudi::Units::mm; // 10 microns for more safety.. //
786  // //
787  std::string name = baseName +"GTENB"; //
788 #ifdef DEBUGGEO
789  std::cout << " *** parameters for back G10 ring (tubs) " << std::endl;
790  std::cout << " Rmini,Rmaxi " << Rmini << " " << Rmaxi << std::endl;
791  std::cout << " DeltaZ " << DeltaZ << std::endl;
792  std::cout << " phimin,dphi " << Moth_Phi_Min/Gaudi::Units::deg << " " << Moth_Phi_Max/Gaudi::Units::deg << std::endl;
793  std::cout << " Zpos " << Zpos << std::endl;
794 #endif
795 
796  GeoTubs* tubs = new GeoTubs(Rmini,Rmaxi,DeltaZ,Moth_Phi_Min,Moth_Phi_Max); //
797  const GeoLogVol* logVol = new GeoLogVol(name,tubs,G10_bar); //
798  GeoIntrusivePtr<GeoPhysVol> physVol = new GeoPhysVol(logVol); //
799  m_ecamPhysicalPos->add(new GeoTransform(GeoTrf::TranslateZ3D(Zpos))); //
800  m_ecamPhysicalPos->add(physVol); //
801  m_ecamPhysicalNeg->add(new GeoTransform(GeoTrf::TranslateZ3D(Zpos))); //
802  m_ecamPhysicalNeg->add(physVol); //
803  } //
804  //------------------------------------------------------------------------------//
805 #endif // BUILD_BACK_G10
806 
807 
808  GeoIntrusivePtr<GeoPhysVol>stacPhysical=nullptr;
809  //---------------------------------ACCORDION VOLUME---------------------------//
810  // STAC = Pcon: LAr volume in which the accordion structure is located //
811  // (the front/back small straight parts are in ECAM not in STAC) //
812  // in test beam case need to have STAC between -1.055 and size 23.555 degrees
813  // (i.e. a little bit wider than one calorimeter module)
814  { //
815 
816  double Moth_Phi_Min2 = (Ncell == 64) ? -1.055*Gaudi::Units::deg : 0.; //
817  double Moth_Phi_Max2 = (Ncell == 64) ? 24.61*Gaudi::Units::deg : 2*M_PI; //
818 
819  double Zplan1[] = {Bar_Z_min,zmax1_Stac+clearance,Bar_Z_max}; //
820  double Riacc1[] = {Rhocen[0],Rhocen[0], Bar_Rcmx-clearance}; //
821  double Roacc1[] = {Rhocen[Nbrt],Rhocen[Nbrt],Rhocen[Nbrt]}; //
822  // //
823  std::string name = baseName + "STAC"; //
824 #ifdef DEBUGGEO
825  std::cout << " *** Parameters for STAC Pcon volume " << std::endl;
826  std::cout << " Zplan " << Zplan1[0] << " " << Zplan1[1] << " " << Zplan1[2] << std::endl;
827  std::cout << " Rin " << Riacc1[0] << " " << Riacc1[1] << " " << Riacc1[2] << std::endl;
828  std::cout << " Rout " << Roacc1[0] << " " << Roacc1[1] << " " << Roacc1[2] << std::endl;
829  std::cout << " PhiMin,Dphi " << Moth_Phi_Min2/Gaudi::Units::deg << " " << Moth_Phi_Max2/Gaudi::Units::deg << std::endl;
830  std::cout << " Zpos " << -Zp0 << std::endl;
831 #endif
832  GeoPcon* pCone = new GeoPcon(Moth_Phi_Min2,Moth_Phi_Max2); //
833  for (int i=0; i<3; i++) pCone->addPlane(Zplan1[i],Riacc1[i],Roacc1[i]); //
834  const GeoLogVol* logVol = new GeoLogVol(name,pCone,LAr); //
835  stacPhysical = new GeoPhysVol(logVol); //
836  m_ecamPhysicalPos->add(new GeoTransform(GeoTrf::TranslateZ3D(-Zp0))); //
837  m_ecamPhysicalPos->add(stacPhysical); //
838  m_ecamPhysicalNeg->add(new GeoTransform(GeoTrf::TranslateZ3D(-Zp0))); //
839  m_ecamPhysicalNeg->add(stacPhysical); //
840  } //
841  //----------------------------------------------------------------------------//
842 
843 #ifdef BUILD_ACCORDION_PLATES
844  {
845  // Construct the straight and the corner parts of the Accordion plates
846 
847  double Xtip_pb = m_parameters->GetValue("LArEMBLeadTipThickFront");
848  double Xtip_pc = m_parameters->GetValue("LArEMBLeadTipThickEnd");
849  double Xtip_gt = m_parameters->GetValue("LArEMBG10TipThickFront");
850  double Xtip_gs = m_parameters->GetValue("LArEMBG10TipThickEnd");
851  double Thgl = m_parameters->GetValue("LArEMBThickAbsGlue");
852  double Thfe = m_parameters->GetValue("LArEMBThickAbsIron");
853  double Thpb = m_parameters->GetValue("LArEMBThickAbsLead");
854  double Thpb_thin = m_parameters->GetValue("LArEMBThinAbsLead");
855  double Thcu = m_parameters->GetValue("LArEMBThickElecCopper");
856  double Thfg = m_parameters->GetValue("LArEMBThickElecKapton");
857  double Psi = m_parameters->GetValue("LArEMBPhiGapAperture"); // 360.*Gaudi::Units::deg/1024
858  double Contract = m_parameters->GetValue("LArEMBAbsorberContraction");
859 
860  double Thce = (Thpb+Thgl+Thfe)*Contract;
861  double Thel = Thcu+Thfg;
862 
863  double Alfa = Psi; // size of one phi cell
864 
865  double Zmin = Bar_Z_min;
866  double Zmax = Bar_Z_max;
867 // Zcp1 = z max for eta=0.8 at the radius of the middle of the fold
868 // Zcp2 = z max for eta=1.475 at the radius of the middle of the fold
869 // Along = lenght of the straight sections
870  double Zcp1[15]={};
871  double Zcp2[15]={};
872  double Along[14]={};
873 
874 // Rhol = radius at the beginning of the straight section
875 // Rhoh = radius at the end of the straight section
876 // Zcp1l = z max for eta=0.8 at the beginning of the straight section
877 // Zcp1h = z max for eta=0.8 at the end of the straight section
878 // Zcp2l = z max for eta~=1.475 at the beginning of the straight section
879 // Zcp2h = z max for eta~=1.475 at the end of the straight section
880  double Zcp1l[14]={},Zcp1h[14]={},Zcp2l[14]={},Zcp2h[14]={};
881  double Rhol[14]={},Rhoh[14]={};
882 
883  double safety_along = 0.007*Gaudi::Units::mm;
884 
885 
886  // Compute centers of curvature coordinates in a local frame.
887 
888  double Cenx[15]={0}, Ceny[15]={0} ;
889  for (int jf=0; jf<(Nbrt+1); jf++)
890  {
891  Cenx[jf] = Rhocen[jf]*cos(Phicen[jf]); // Phicen[] already in radians
892  Ceny[jf] = Rhocen[jf]*sin(Phicen[jf]);
893  Zcp1[jf] = Rhocen[jf]/tan(TetaTrans[jf]);
894  if (Rhocen[jf] < r2)
895  Zcp2[jf] = z1 + (Rhocen[jf]-r1)*inv_r2_r1*(Moth_Z_max-z1);
896  else
897  Zcp2[jf]=Moth_Z_max;
898 
899 #ifdef DEBUGGEO
900  std::cout << " jf " << jf
901  << "Cenx/Ceny " << Cenx[jf] << " " << Ceny[jf] << " "
902  << "Zcp1/Zcp2 " << Zcp1[jf] << " " << Zcp2[jf] << std::endl;
903 #endif
904 
905  }
906 
907 // Compute staight lengths of folds
908  double Rint = m_parameters->GetValue("LArEMBNeutFiberRadius");
909  for (int jl=0; jl<Nbrt; jl++)
910  {
911  double Adisc2 = (Cenx[jl+1]-Cenx[jl])*(Cenx[jl+1]-Cenx[jl])+
912  (Ceny[jl+1]-Ceny[jl])*(Ceny[jl+1]-Ceny[jl]);
913  double Along2 = Adisc2 - 4.*Rint*Rint;
914  Along[jl] = sqrt(Along2);
915 #ifdef DEBUGGEO
916  std::cout << "jl " << jl
917  << "straight length " << Along[jl] << std::endl;
918 #endif
919  double ddelta = M_PI/2.-Delta[jl];
920 // different parity depending on direction of first wave
921  if (checkParity==0) {
922  if (jl%2==1) ddelta=-1.*ddelta;
923  } else {
924  if (jl%2==0) ddelta=-1.*ddelta;
925  }
926  double xlong=Along[jl]-2.*safety_along;
927  double x2=0.5*(Cenx[jl+1]+Cenx[jl])+0.5*xlong*cos(ddelta);
928  double y2=0.5*(Ceny[jl+1]+Ceny[jl])+0.5*xlong*sin(ddelta);
929  double x1=0.5*(Cenx[jl+1]+Cenx[jl])-0.5*xlong*cos(ddelta);
930  double y1=0.5*(Ceny[jl+1]+Ceny[jl])-0.5*xlong*sin(ddelta);
931  Rhol[jl] = sqrt(x1*x1+y1*y1);
932  Rhoh[jl] = sqrt(x2*x2+y2*y2);
933  Zcp1l[jl] = Rhol[jl]/tan(TetaTrans[jl]);
934  Zcp1h[jl] = Rhoh[jl]/tan(TetaTrans[jl+1]);
935  if (Rhol[jl] < r2)
936  Zcp2l[jl] = z1 + (Rhol[jl]-r1)*inv_r2_r1*(Moth_Z_max-z1);
937  else
938  Zcp2l[jl]=Moth_Z_max;
939  if (Rhoh[jl] < r2)
940  Zcp2h[jl] = z1 + (Rhoh[jl]-r1)*inv_r2_r1*(Moth_Z_max-z1);
941  else
942  Zcp2h[jl]=Moth_Z_max;
943 #ifdef DEBUGGEO
944  std::cout << "x1,y1,x2,y2 " << x1 << " " << y1 << " " << x2 << " "
945  << y2 << std::endl;
946  std::cout << " lower/upper radius " << Rhol[jl] << " " << Rhoh[jl]
947  << " Z for eta0.8 " << Zcp1l[jl] << " " << Zcp1h[jl]
948  << " Z for etamax " << Zcp2l[jl] << " " << Zcp2h[jl] << std::endl;
949 #endif
950  }
951 
952 
953 
954  double Gama0 = m_parameters->GetValue("LArEMBAbsPhiFirst");
955 
956  GeoGenfun::Variable icopy;
957  GeoGenfun::GENFUNCTION Game = Gama0 + Psi/2 + Alfa*icopy;
958  GeoGenfun::GENFUNCTION Gama = Gama0 + Alfa*icopy;
959 
960  // Creation of the straight absorber parts. Front (TIPB) & Back (TIPC)
961  // Creation of the straight electrode parts. Front (TIPK) & Back (TIPL)
962 
963  enum FB {FRONT, BACK, TERM};
964 
965  for (int fb=FRONT; fb!=TERM; fb++)
966  {
967 
968  int irl = fb==FRONT ? 0 : Nbrt;
969 
970  double Xtips = Xtip_pb + Xtip_gt;
971  double Xtipt = Xtip_pc + Xtip_gs;
972 
973  // Absorber (thick, thin)
974  {
975  double radius = fb==FRONT ? Cenx[0] - Xtip_pb/2 : Cenx[Nbrt] + Xtipt/2;
976  double Xhalfb = fb==FRONT ? Xtip_pb/2 -0.002*Gaudi::Units::mm : Xtipt/2 - .004*Gaudi::Units::mm;
977  double Zhalfb = fb==FRONT ? (Bar_Z_cut-Zmin)/2. : (Zmax-Zmin)/2.;
978  double dz01 = (std::min(Zcp1[irl],Zmax)-Zmin)/2.; // half lenght for thick lead
979 
980  std::string name = baseName + "FrontBack::Absorber";
981  GeoBox *box = new GeoBox(Xhalfb,Thce/2,Zhalfb);
982  GeoBox *box2 = new GeoBox(Xhalfb,Thce/2,dz01);
983  const GeoLogVol *logVol = new GeoLogVol(name,box,Thin_abs);
984  const GeoLogVol *logVol2 = new GeoLogVol(name,box2,Thick_abs);
985  GeoIntrusivePtr<GeoPhysVol> physVol = new GeoPhysVol(logVol);
986  GeoIntrusivePtr<GeoPhysVol> physVol2 = new GeoPhysVol(logVol2);
987  physVol->add(new GeoTransform(GeoTrf::Translate3D(0.,0.,dz01-Zhalfb)));
988  physVol->add(physVol2);
989  GeoGenfun::GENFUNCTION Xcd = radius*Cos(Gama);
990  GeoGenfun::GENFUNCTION Ycd = radius*Sin(Gama);
991  GeoGenfun::GENFUNCTION Zcd = GeoGenfun::FixedConstant(Zmin+Zhalfb);
992 
993 
994  GeoXF::TRANSFUNCTION TX =
995  GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcd) *
996  GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycd) *
997  GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcd) *
998  GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Gama);
999  GeoSerialTransformer *st = new GeoSerialTransformer(physVol, &TX, Nabsorber);
1000  m_ecamPhysicalPos->add(st);
1001  m_ecamPhysicalNeg->add(st);
1002 #ifdef DEBUGGEO
1003  if (fb==FRONT) std::cout << " *** Front tip Absorber " << std::endl;
1004  else std::cout << " *** Back tip Absorber " << std::endl;
1005  std::cout << " Thin Abs Box " << Xhalfb << " " << Thce/2. << " " << Zhalfb << std::endl;
1006  std::cout << " Thick Abs Box " << Xhalfb << " " << Thce/2. << " " << dz01 << std::endl;
1007  std::cout << " Z position thick in thin " << dz01-Zhalfb << std::endl;
1008  std::cout << " Radial position " << radius << std::endl;
1009  std::cout << " Phi0 (Gaudi::Units::deg) " << Gama(0)/Gaudi::Units::deg << std::endl;
1010  std::cout << " Z position in ECAM " << Zmin+Zhalfb << std::endl;
1011 #endif
1012  }
1013  // G10 (only for front part)
1014  if (fb==FRONT)
1015  {
1016  double Xhalfbg = Xtip_gt/2-0.002*Gaudi::Units::mm;
1017  double radiusg = Cenx[0]-Xtip_pb/2. - Xtips/2 ;
1018  double Zhalfbg = (Bar_Z_cut-Zmin)/2. ;
1019  std::string name = baseName + "FrontBack::G10";
1020 #ifdef DEBUGGEO
1021  std::cout << " *** Front tip G10 " << std::endl;
1022  std::cout << " Box parameters " << Xhalfbg << " " << Thce/2. << " " << Zhalfbg << std::endl;
1023 #endif
1024  GeoBox *box = new GeoBox(Xhalfbg,Thce/2,Zhalfbg);
1025  const GeoLogVol *logVol = new GeoLogVol(name,box,G10_bar);
1026  GeoPhysVol *physVol = new GeoPhysVol(logVol);
1027 
1028 #ifdef BUILD_FRONT_STEEL
1029 // GU 28-07-2005
1030 // add small iron pieces on each side of the G10
1031  name = baseName + "FrontBack::Steel";
1032  double Tgfe = m_parameters->GetValue("LArEMBThinAbsIron");
1033 #ifdef DEBUGGEO
1034  std::cout << " Iron Box parameters " << Xhalfbg
1035  << " " << Tgfe/4. << " " << Zhalfbg << std::endl;
1036 #endif
1037  GeoBox *box2 = new GeoBox(Xhalfbg,Tgfe/4.,Zhalfbg);
1038  const GeoLogVol *logVol2 = new GeoLogVol(name,box2,Iron);
1039  GeoIntrusivePtr<GeoPhysVol>physVol2 = new GeoPhysVol(logVol2);
1040 #ifdef DEBUGGEO
1041  std::cout << " Position Iron in G10 at y = +- " << 0.5*(+Thce-Tgfe/2.) << std::endl;
1042 #endif
1043  physVol->add(new GeoTransform(GeoTrf::Translate3D(0.,0.5*(-Thce+Tgfe/2.),0.)));
1044  physVol->add(physVol2);
1045  physVol->add(new GeoTransform(GeoTrf::Translate3D(0.,0.5*(+Thce-Tgfe/2.),0.)));
1046  physVol->add(physVol2);
1047 #endif // build_front_steel
1048 
1049 // position of G10+Steel inside LAr bath
1050  GeoGenfun::GENFUNCTION Xcd = radiusg*Cos(Gama);
1051  GeoGenfun::GENFUNCTION Ycd = radiusg*Sin(Gama);
1052  GeoGenfun::GENFUNCTION Zcd = GeoGenfun::FixedConstant(Zhalfbg+Zmin);
1053  GeoXF::TRANSFUNCTION TX =
1054  GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcd) *
1055  GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycd) *
1056  GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcd) *
1057  GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Gama);
1058  GeoSerialTransformer *st = new GeoSerialTransformer(physVol, &TX, Nabsorber);
1059  m_ecamPhysicalPos->add(st);
1060  m_ecamPhysicalNeg->add(st);
1061 #ifdef DEBUGGEO
1062  std::cout << " Radial position G10 tip " << radiusg << std::endl;
1063  std::cout << " Phi0 (Gaudi::Units::deg)" << Gama(0)/Gaudi::Units::deg << std::endl;
1064  std::cout << " Zposition in ECAM " << Zmin+Zhalfbg << std::endl;
1065 #endif
1066 
1067  }
1068  // Electrode
1069  {
1070  double Xhalfbe = fb==FRONT ? Xtips/2 -0.002*Gaudi::Units::mm : Xtipt/2 - .004*Gaudi::Units::mm;
1071  double Zhalfbe = fb==FRONT ? (Bar_Z_cut-Zmin)/2. : (Zmax - Zmin)/2;
1072  double radiuse = fb==FRONT ? Cenx[0] - Xtips/2 : Cenx[Nbrt] + Xtipt/2;
1073  std::string name = baseName + "FrontBack::Electrode";
1074  GeoBox *box = new GeoBox(Xhalfbe,Thel/2,Zhalfbe);
1075  const GeoLogVol *logVol = new GeoLogVol(name,box,Kapton_Cu);
1076  GeoIntrusivePtr<GeoPhysVol> physVol = new GeoPhysVol(logVol);
1077  GeoGenfun::GENFUNCTION Xcd = radiuse*Cos(Game);
1078  GeoGenfun::GENFUNCTION Ycd = radiuse*Sin(Game);
1079  GeoGenfun::GENFUNCTION Zcd = GeoGenfun::FixedConstant(Zmin+Zhalfbe);
1080 
1081  GeoXF::TRANSFUNCTION TX =
1082  GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcd) *
1083  GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycd) *
1084  GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcd) *
1085  GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Game);
1086 
1087  GeoSerialTransformer *st = new GeoSerialTransformer(physVol, &TX, Nelectrode);
1088  m_ecamPhysicalPos->add(st);
1089  m_ecamPhysicalNeg->add(st);
1090 
1091 #ifdef DEBUGGEO
1092  if (fb==FRONT) std::cout << " *** Front tip electrode " << std::endl;
1093  else std::cout << " *** Back tip electrode " << std::endl;
1094  std::cout << " Box " << Xhalfbe << " " << Thel/2. << " " << Zhalfbe << std::endl;
1095  std::cout << " Radial position " << radiuse << std::endl;
1096  std::cout << " Phi0 (Gaudi::Units::deg)" << Game(0)/Gaudi::Units::deg << std::endl;
1097  std::cout << " Z position in ECAM " << Zmin+Zhalfbe << std::endl;
1098 #endif
1099 
1100 
1101  }
1102  }
1103 
1104 
1105  GeoStraightAccSection *gStraightElectrodes=nullptr;
1106  GeoStraightAccSection *gStraightAbsorbers =nullptr;
1107  //
1108  // Loop through the straight and corner(Fold) parts of the Accordion plates
1109  // Repeat each part around Phi, then move to the next, towards outer radii
1110  //
1111 
1112 // GU 09/06/2004 add some safety in z size
1113  double safety_zlen=0.050*Gaudi::Units::mm;
1114 
1115  for(int irl=0; irl<Nbrt; irl++) // loop over zig-zag in radius
1116  {
1117 #ifdef DEBUGGEO
1118  std::cout << " ----- irl = " << irl << std::endl;
1119 #endif
1120  int iparit;
1121 // different parity depending on direction of first wave
1122  if (checkParity==0) {
1123  iparit= (1-2*(irl%2)); // +1 for irl=0,2,4,.. -1 for irl=1,3,5,..
1124  } else {
1125  iparit=(2*(irl%2)-1); // -1 for irl=0,2,3... +1 for irl=1,3,5
1126  }
1127 
1128 // length of tubs for folds
1129  double Zcon1 = Zcp2[irl];
1130  double Zcon2 = Zcp2[irl+1];
1131 // if the radius at the lower edge of this fold is smaller than
1132 // Bar_rcmx, take the lenght at this radius instead of the radius
1133 // of the fold to avoid going outside the mother volume
1134  if (irl>0 && Rhoh[irl-1] < Bar_Rcmx) Zcon1=Zcp2h[irl-1];
1135  if (Rhoh[irl] < Bar_Rcmx) Zcon2=Zcp2h[irl];
1136 
1137  double dz0 = (std::min(Zcon1,Zmax)-Zmin)/2.; // half lenght in z (fold)
1138  double dza = (std::min(Zcon2,Zmax)-Zmin)/2.; // (for last fold)
1139  double dz01 = (std::min(Zcp1[irl],Zmax)-Zmin)/2.; // half lenght for thick lead
1140  double dza1 = (std::min(Zcp1[irl+1],Zmax)-Zmin)/2.;
1141 
1142 
1143 // special case if Rhocen[il] < Bar_Rcmx < Rhocen[il+1]
1144 // we had to divide the fold in two different pieces to deal with the shape
1145  int ndivi=1;
1146  if (Rhocen[irl] < Bar_Rcmx && Rhocen[irl+1] > Bar_Rcmx) {
1147 #ifdef DEBUGGEO
1148  std::cout << " Divide section in two pieces at r= " << Bar_Rcmx << std::endl;
1149 #endif
1150  ndivi=2;
1151  }
1152 
1153  for (int idivi=0;idivi<ndivi;idivi++) {
1154 
1155  // lenght in z at beginning and end of straigth part
1156  double bl1,tl1;
1157  double frac;
1158  if (ndivi==1) {
1159  bl1 = (std::min(Zcp2l[irl],Zmax)-Zmin)/2.;
1160  tl1 = (std::min(Zcp2h[irl],Zmax)-Zmin)/2.;
1161  frac=1.;
1162  }
1163  else {
1164  if (idivi==0) {
1165  bl1 = (std::min(Zcp2l[irl],Zmax)-Zmin)/2.;
1166  tl1 = (Zmax-Zmin)/2.;
1167  frac=(Bar_Rcmx-Rhol[irl])/(Rhoh[irl]-Rhol[irl]);
1168  }
1169  else {
1170  bl1 = (Zmax-Zmin)/2.;
1171  tl1 = (Zmax-Zmin)/2.;
1172  frac=(Rhoh[irl]-Bar_Rcmx)/(Rhoh[irl]-Rhol[irl]);
1173  }
1174 #ifdef DEBUGGEO
1175  std::cout << " Division " << idivi << " fraction of straight section " << frac << std::endl;
1176 #endif
1177  }
1178 //GU 09/06/2004 add small safety in size tl1 and bl1
1179  tl1=tl1-safety_zlen;
1180  bl1=bl1-safety_zlen;
1181 
1182 // =================================== Absorbers
1183  {
1184 
1185  // thickness of absorber
1186  double Dz = Thce/2.;
1187 
1188  // For absorbers
1189  GeoGenfun::GENFUNCTION x1a = LArGeo::Fx(irl+0., Gama, Cenx, Ceny)
1190  +deltay[irl]*LArGeo::Del1(Gama)
1191  +deltax[irl]*LArGeo::Del2(Gama);
1192  GeoGenfun::GENFUNCTION x2a = LArGeo::Fx(irl+1., Gama, Cenx, Ceny)
1193  +deltay[irl+1]*LArGeo::Del1(Gama)
1194  +deltax[irl+1]*LArGeo::Del2(Gama);
1195  GeoGenfun::GENFUNCTION y1a = LArGeo::Fy(irl+0., Gama, Cenx, Ceny)
1196  -deltay[irl]*LArGeo::Del2(Gama)
1197  +deltax[irl]*LArGeo::Del1(Gama);
1198  GeoGenfun::GENFUNCTION y2a = LArGeo::Fy(irl+1., Gama, Cenx, Ceny)
1199  -deltay[irl+1]*LArGeo::Del2(Gama)
1200  +deltax[irl+1]*LArGeo::Del1(Gama);
1201  GeoGenfun::GENFUNCTION dx = x2a - x1a;
1202  GeoGenfun::GENFUNCTION dy = y2a - y1a;
1203 
1204  // Da the two fold centers distance, da straight part length
1205 
1206  GeoGenfun::GENFUNCTION Da = Sqrt ( dx*dx + dy*dy );
1207  GeoGenfun::GENFUNCTION da = Sqrt ( (Da - 2.*Rint)*(Da + 2.*Rint) );
1208 
1209  // newalpha (slant angle) value of the rotation angle around Z_axis
1210  GeoGenfun::GENFUNCTION cosalfa = (da*dx -iparit*2.*Rint*dy)/Da/Da;
1211  GeoGenfun::GENFUNCTION sinalfa = (da*dy +iparit*2.*Rint*dx)/Da/Da;
1212  GeoGenfun::GENFUNCTION newalpha = LArGeo::ATan2(sinalfa,cosalfa);
1213 
1214  GeoGenfun::GENFUNCTION h1 = da/2. * frac - .007*Gaudi::Units::mm;
1215 
1216  double Zx0 = (tl1+bl1)/2.;
1217 // thick absorber pieces
1218 // more correct computation with z lenght computed exactly at the
1219 // radius of the end and the beginning of the straight sections
1220  double Xb1,Xt1;
1221  if (ndivi==1) {
1222  Xb1 = (Zcp1l[irl]-Zmin)/2.;
1223  Xt1 = (Zcp1h[irl]-Zmin)/2.;
1224  } else {
1225  double xfrac=(Bar_Rcmx-Rhol[irl])/(Rhoh[irl]-Rhol[irl]);
1226  if (idivi==0) {
1227  Xb1 = (Zcp1l[irl]-Zmin)/2.;
1228  Xt1 = (xfrac*Zcp1h[irl]+(1.-xfrac)*Zcp1l[irl]-Zmin)/2.;
1229  }
1230  else {
1231  Xb1 = (xfrac*Zcp1h[irl]+(1.-xfrac)*Zcp1l[irl]-Zmin)/2.;
1232  Xt1 = (Zcp1h[irl]-Zmin)/2.;
1233  }
1234  }
1235  // translation in x to include thick absorber into thin absorber
1236  double Xtrans = (Xb1+Xt1)/2.-Zx0 + .007*Gaudi::Units::mm;
1237 
1238  // lengths that remain to be covered with the thin absorber
1239  double Xt2 = tl1-Xt1;
1240  double Xb2 = bl1-Xb1;
1241 
1242  // trabslation that would be needed to include think absorber only into overall thin+thick volume
1243  double Xtrans2 = Zx0 - (Xb2+Xt2)/2.;
1244  Xt2 = Xt2 -0.007*Gaudi::Units::mm;
1245  Xb2 = Xb2 -0.007*Gaudi::Units::mm;
1246 
1247 
1248  GeoGenfun::GENFUNCTION alpha = ATan(0.5*(bl1-tl1)/h1);
1249  GeoGenfun::GENFUNCTION alpha_t = ATan(0.5*(Xb1-Xt1)/h1);
1250 
1251  // angle that would be needed for trap do describe only thin absorber
1252  // ------------------|---------X---------|
1253  // <-------------------------------------> 2*tl1
1254  // <---------> Xt2
1255  //
1256  // <---------------------------------> 2*bl1
1257  // <--------> Xb2
1258  // ---------------|--------X---------|
1259  // alpha = (-) angle between X's
1260  // tan(alpha) = delta X size / width, deltaX size = 2*tl1-Xt2-(2*bl1-Xb2), width = 2.*h1
1261  GeoGenfun::GENFUNCTION alpha_2 = ATan((2.*bl1-Xb2-(2.*tl1-Xt2))/(2.*h1));
1262 
1263 
1264  // .newalpha is already computed angle wrt z axis
1265  // P/2 rotation is to get absorber aligned along local x axis
1266  // instead of y, then rotate with angle newalpha
1267  GeoGenfun::GENFUNCTION alfrot = -M_PI/2. - newalpha;
1268 
1269  GeoGenfun::GENFUNCTION Xcd = (x1a + x2a)/2. + (2.*idivi-1.)*(1.-frac)*da/2.*cosalfa;
1270  GeoGenfun::GENFUNCTION Ycd = (y1a + y2a)/2. + (2.*idivi-1.)*(1.-frac)*da/2.*sinalfa;
1271  GeoGenfun::GENFUNCTION Zcd = GeoGenfun::FixedConstant(Zmin+(tl1+bl1)/2.+safety_zlen);
1272 
1273  GeoXF::TRANSFUNCTION TX =
1274  GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcd) *
1275  GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycd) *
1276  GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcd) *
1277  GeoXF::Pow(GeoTrf::RotateZ3D(1.0),-alfrot)*
1278  GeoTrf::RotateY3D(-90*Gaudi::Units::deg);
1279 
1280  //
1281 
1282  for (int instance = 0; instance < Nabsorber; instance++)
1283  {
1284 
1285  // Define some commonly-used volume names.
1286  std::string thinName = baseName + "ThinAbs::Straight";
1287  std::string thickName = baseName + "ThickAbs::Straight";
1288 
1289 #ifdef DEBUGGEO
1290  std::cout << " *** thinAbs trap parameters " << std::endl;
1291  std::cout << " Thickness " << Dz << std::endl;
1292  std::cout << " h1 (rad leng) " << h1(instance) << std::endl;
1293  std::cout << " tl1,bl1 " << tl1 << " " << bl1 << std::endl;
1294  std::cout << " alpha " << alpha(instance) << std::endl;
1295  std::cout << " *** thickAbs trap parameters " << std::endl;
1296  std::cout << " Thickness " << Dz << std::endl;
1297  std::cout << " h1 (rad leng) " << h1(instance) << std::endl;
1298  std::cout << " tl1,bl1 " << Xt1 << " " << Xb1 << std::endl;
1299  std::cout << " alpha " << alpha_t(instance) << std::endl;
1300 
1301  std::cout << " Position absorber x,y,z " << Xcd(instance) << " " << Ycd(instance)
1302  << " " << Zcd(instance) << std::endl;
1303  std::cout << " Rotation along Z " << -alfrot(instance)/deg << std::endl;
1304  std::cout << " Rotation along Y " << -90 << std::endl;
1305 
1306 #endif
1307 
1308 
1309  GeoIntrusivePtr<GeoPhysVol> thinPhys = nullptr;
1310  GeoTrap* thinTrap = new GeoTrap(Dz,0.,0.,h1(instance),tl1,bl1,alpha(instance),
1311  h1(instance),tl1,bl1,alpha(instance));
1312  if (!doDetailedAbsorberStraight) {
1313 
1314  const GeoLogVol* thinLog = new GeoLogVol(thinName,thinTrap,Thin_abs);
1315  thinPhys = new GeoPhysVol(thinLog);
1316 
1317  GeoTrap* thickTrap = new GeoTrap(Dz,0.,0.,h1(instance),Xt1,Xb1,alpha_t(instance),
1318  h1(instance),Xt1,Xb1,alpha_t(instance));
1319  const GeoLogVol* thickLog = new GeoLogVol(thickName,thickTrap,Thick_abs);
1320  GeoIntrusivePtr<GeoPhysVol> thickPhys = new GeoPhysVol(thickLog);
1321  // put thick absorber in straight_phys
1322  thinPhys->add(new GeoTransform(GeoTrf::TranslateX3D(Xtrans)));
1323  thinPhys->add(thickPhys);
1324 
1325 #ifdef DEBUGGEO
1326  std::cout << " Position thick Abs in Thin at " << Xtrans << std::endl;
1327 #endif
1328  }
1329 
1330  if (doDetailedAbsorberStraight) {
1331 
1332  // overall volume => steel
1333 #ifdef DEBUGGEO
1334  std::cout << " dz overall absorber volume " << Dz << " radial length " << h1(instance) <<
1335  " lenghts " << tl1 << " " << bl1 << " Angle y axis " << alpha(instance) << std::endl;
1336 #endif
1337  const GeoLogVol* thinLog = new GeoLogVol(thinName,thinTrap,myIron);
1338  thinPhys = new GeoPhysVol(thinLog);
1339 
1340  // inside steel put glue, Dz size = Dz size of steel - total thickness of steel/2. covers full eta range
1341 
1342  double dz_glue = Dz - 0.5*Thfe*Contract;
1343 #ifdef DEBUGGEO
1344  std::cout << " dz glue volume in which lead will be put " << dz_glue << std::endl;
1345 #endif
1346  GeoTrap* thickTrapGlue = new GeoTrap(dz_glue,0.,0.,h1(instance),tl1,bl1,alpha(instance),
1347  h1(instance),tl1,bl1,alpha(instance));
1348  std::string thickGlueName = baseName + "ThickAbsGlue::Straight";
1349  const GeoLogVol* thickTrapGlueLog = new GeoLogVol(thickGlueName,thickTrapGlue, Glue);
1350  GeoIntrusivePtr<GeoPhysVol> thickTrapGluePhys = new GeoPhysVol(thickTrapGlueLog);
1351  thinPhys->add(new GeoTransform(GeoTrf::Translate3D(0.,0.,0.)));
1352  thinPhys->add(thickTrapGluePhys);
1353 
1354  // inside glue put lead, Dz size = 0.5*Thpb*Contract, 2 separate volumes for eta<0.8 and eta>0.8
1355  double dz_lead_thick=0.5*Thpb*Contract;
1356 #ifdef DEBUGGEO
1357  std::cout << " dz thick lead " << dz_lead_thick << " lenghts " << Xt1 << " " << Xb1 << " Angle y axis " << alpha_t(instance) << std::endl;
1358  std::cout << " position in overall absorber at X trans " << Xtrans << std::endl;
1359 #endif
1360  GeoTrap* thickTrapLead = new GeoTrap(dz_lead_thick,0.,0.,h1(instance),Xt1,Xb1,alpha_t(instance),
1361  h1(instance),Xt1,Xb1,alpha_t(instance));
1362  std::string thickLeadName= baseName+"ThickAbsLead::Straight";
1363  const GeoLogVol* thickTrapLeadLog = new GeoLogVol(thickLeadName,thickTrapLead, myLead);
1364  GeoIntrusivePtr<GeoPhysVol> thickTrapLeadPhys = new GeoPhysVol(thickTrapLeadLog);
1365  thickTrapGluePhys->add(new GeoTransform(GeoTrf::TranslateX3D(Xtrans)));
1366  thickTrapGluePhys->add(thickTrapLeadPhys);
1367 
1368  double dz_lead_thin = 0.5*Thpb_thin*Contract;
1369 #ifdef DEBUGGEO
1370  std::cout << " dz thin lead " << dz_lead_thin << " lenghts " << Xt2 << " " << Xb2 << " Angle y axis " << alpha_2(instance) << std::endl;
1371  std::cout << " position in overall absorber at X trans " << Xtrans2 << std::endl;
1372 #endif
1373  GeoTrap* thinTrapLead = new GeoTrap(dz_lead_thin,0.,0.,h1(instance),Xt2,Xb2,alpha_2(instance),
1374  h1(instance),Xt2,Xb2,alpha_2(instance));
1375  std::string thinLeadName = baseName+"ThinAbsLead::Straight";
1376  const GeoLogVol* thinTrapLeadLog = new GeoLogVol(thinLeadName,thinTrapLead, myLead);
1377  GeoIntrusivePtr<GeoPhysVol> thinTrapLeadPhys = new GeoPhysVol(thinTrapLeadLog);
1378  thickTrapGluePhys->add(new GeoTransform(GeoTrf::TranslateX3D(Xtrans2)));
1379  thickTrapGluePhys->add(thinTrapLeadPhys);
1380 
1381 
1382  }
1383 
1384  //------------------------------------------------------------------------
1385  // JFB. If there is no sagging we can exit this loop after only one pass..
1386  // We simply declare the placement recipe, and place the first phys Vol
1387  // everywhere.
1388  //------------------------------------------------------------------------
1389  if (m_A_SAGGING) {
1390  if (!gStraightAbsorbers) gStraightAbsorbers = new GeoStraightAccSection();
1391  gStraightAbsorbers->XCent(instance,irl)=TX(instance)(0,3); //dx
1392  gStraightAbsorbers->YCent(instance,irl)=TX(instance)(1,3); //dy
1393  gStraightAbsorbers->Cosu(instance,irl) =-(TX(instance)(0,1)); //xy
1394  gStraightAbsorbers->Sinu(instance,irl) = (TX(instance)(0,2)); //xz
1395  gStraightAbsorbers->HalfLength(instance,irl) = thinTrap->getDydzn();
1396 
1397  stacPhysical->add(new GeoTransform(TX(instance)));
1398  int icopytot=1000000*idivi+10000*irl+instance;
1399  stacPhysical->add(new GeoIdentifierTag(icopytot));
1400  stacPhysical->add(thinPhys);
1401  }
1402  else {
1403  if (!gStraightAbsorbers) gStraightAbsorbers = new GeoStraightAccSection();
1404  gStraightAbsorbers->setTransform (irl,TX);
1405  gStraightAbsorbers->setHalfLength(irl,thinTrap->getDydzn());
1406  GeoSerialTransformer *st = new GeoSerialTransformer(thinPhys, &TX, Nabsorber);
1407  stacPhysical->add(new GeoSerialIdentifier(irl*10000+idivi*1000000));
1408  stacPhysical->add(st);
1409  break;
1410  }
1411  } // loop over instances
1412 
1413 
1414  if (idivi==0) {
1415 // Folds
1416  double phi0_safety=0.;
1417  if (irl==0) phi0_safety=0.003;
1418 
1419 // for most section, one fold = fold at the beginning of this section
1420 // for last section, should also to last fold, at the end of the section
1421 
1422  int irl1=irl;
1423  int irl2 = (irl==Nbrt-1) ? irl+1 : irl;
1424 
1425  for (int jrl=irl1; jrl<=irl2; jrl++) {
1426 
1427 // get slant angle for the previous zig-zag
1428  int iirl=jrl-1;
1429  if (iirl<0) iirl=1;
1430  GeoGenfun::GENFUNCTION x0a = LArGeo::Fx(iirl, Gama, Cenx, Ceny)
1431  +deltay[iirl]*LArGeo::Del1(Gama)
1432  +deltax[iirl]*LArGeo::Del2(Gama);
1433  GeoGenfun::GENFUNCTION y0a = LArGeo::Fy(iirl, Gama, Cenx, Ceny)
1434  -deltay[iirl]*LArGeo::Del2(Gama)
1435  +deltax[iirl]*LArGeo::Del1(Gama);
1436  GeoGenfun::GENFUNCTION dx0 = x1a - x0a;
1437  GeoGenfun::GENFUNCTION dy0 = y1a - y0a;
1438  // Da the two fold centers distance, da straight part length
1439  GeoGenfun::GENFUNCTION Da0 = Sqrt ( dx0*dx0 + dy0*dy0 );
1440  GeoGenfun::GENFUNCTION da0 = Sqrt ( (Da0 - 2.*Rint)*(Da0 + 2.*Rint) );
1441  // newalpha (slant angle) value of the rotation angle around Z_axis
1442  GeoGenfun::GENFUNCTION cosalfa0 = (da0*dx0 +iparit*2.*Rint*dy0)/Da0/Da0;
1443  GeoGenfun::GENFUNCTION sinalfa0 = (da0*dy0 -iparit*2.*Rint*dx0)/Da0/Da0;
1444  GeoGenfun::GENFUNCTION alpha_prev = LArGeo::ATan2(sinalfa0,cosalfa0);
1445 
1446 #ifdef DEBUGGEO
1447  if (jrl>0 && jrl<Nbrt) {
1448  std::cout << "x1,y1,x0,y0 " << x1a(0) << " " << y1a(0) << " "
1449  << x0a(0) << " " << y0a(0) << std::endl;
1450  std::cout << " newalpha, alpha_prev " << newalpha(0) << " "
1451  << alpha_prev(0) << std::endl;
1452  }
1453 #endif
1454  GeoGenfun::Mod Mod2Pi(2*M_PI);
1455 // down folds (add +M_PI and then rotate by -M_PI to follow same logic as old code)
1456  GeoGenfun::GENFUNCTION phi0_dfold_0 =
1457  GeoGenfun::FixedConstant(M_PI/2.+phi0_safety);
1458  GeoGenfun::GENFUNCTION dphi_dfold_0 = Mod2Pi(newalpha-phi0_safety - Gama);
1459  GeoGenfun::GENFUNCTION phi0_dfold_1 = Mod2Pi(M_PI/2.+ alpha_prev - Gama);
1460  GeoGenfun::GENFUNCTION dphi_dfold_1 = Mod2Pi(newalpha-alpha_prev);
1461  GeoGenfun::GENFUNCTION phi0_dfold_2 = Mod2Pi(M_PI/2.+ newalpha - Gama);
1462  GeoGenfun::GENFUNCTION dphi_dfold_2 = Mod2Pi(- newalpha + Gama);
1463 // up folds
1464  GeoGenfun::GENFUNCTION phi0_ufold_0 =
1465  Mod2Pi(M_PI/2.+newalpha-Gama);
1466  GeoGenfun::GENFUNCTION dphi_ufold_0 = Mod2Pi(-newalpha+Gama-phi0_safety);
1467  GeoGenfun::GENFUNCTION phi0_ufold_1 = Mod2Pi(M_PI/2. + newalpha - Gama);
1468  GeoGenfun::GENFUNCTION dphi_ufold_1 = Mod2Pi(alpha_prev - newalpha);
1469  GeoGenfun::GENFUNCTION phi0_ufold_2 = GeoGenfun::FixedConstant(M_PI/2.);
1470  GeoGenfun::GENFUNCTION dphi_ufold_2 = Mod2Pi(newalpha-Gama);
1471 
1472  const GeoGenfun::AbsFunction* phi0_fold=nullptr;
1473  const GeoGenfun::AbsFunction* dphi_fold=nullptr;
1474  const GeoXF::Function* TXfold=nullptr;
1475 
1476  std::string thinName;
1477  std::string thickName;
1478  if (jrl%2==checkParity) {
1479  thinName = baseName + "ThinAbs::CornerDownFold";
1480  thickName = baseName + "ThickAbs::CornerDownFold";
1481  } else {
1482  thinName = baseName + "ThinAbs::CornerUpFold";
1483  thickName = baseName + "ThickAbs::CornerUpFold";
1484  }
1485 
1486 // radius of tubs for folds
1487  double Rcmin=Rint-Thce/2.;
1488  double Rcmax=Rint+Thce/2.;
1489 
1490 // GU 09/06/2004 add some safety in z size
1491  double ddz0 = dz0-safety_zlen;
1492  double ddz01 = dz01-safety_zlen;
1493  if (jrl==Nbrt){
1494  ddz0=dza-safety_zlen;
1495  ddz01=dza1-safety_zlen;
1496  }
1497 
1498 
1499  GeoGenfun::GENFUNCTION zpos = GeoGenfun::FixedConstant(Zmin+dz0);
1500  double phirot=0;
1501  if (jrl%2==checkParity) phirot = -M_PI;
1502  GeoXF::TRANSFUNCTION TXfold1=
1503  GeoXF::Pow(GeoTrf::TranslateX3D(1.0),x1a) *
1504  GeoXF::Pow(GeoTrf::TranslateY3D(1.0),y1a) *
1505  GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),zpos) *
1506  GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Gama+phirot);
1507  GeoXF::TRANSFUNCTION TXfold2 =
1508  GeoXF::Pow(GeoTrf::TranslateX3D(1.0),x2a) *
1509  GeoXF::Pow(GeoTrf::TranslateY3D(1.0),y2a) *
1510  GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),zpos) *
1511  GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Gama+phirot);
1512 
1513 // first fown fold
1514  if (jrl==0 && checkParity==0) {
1515  phi0_fold = &(phi0_dfold_0);
1516  dphi_fold = &(dphi_dfold_0);
1517  TXfold = &(TXfold1);
1518  }
1519 // normal fold
1520  if (jrl%2==checkParity && jrl >0 && jrl<Nbrt) {
1521  phi0_fold = &(phi0_dfold_1);
1522  dphi_fold = &(dphi_dfold_1);
1523  TXfold = &(TXfold1);
1524  }
1525 // last fold if down
1526  if (jrl%2 ==checkParity && jrl == Nbrt) {
1527  phi0_fold = &(phi0_dfold_2);
1528  dphi_fold = &(dphi_dfold_2);
1529  TXfold = &(TXfold2);
1530  }
1531 // first up fold
1532  if (jrl==0 && checkParity==1) {
1533  phi0_fold = &(phi0_ufold_0);
1534  dphi_fold = &(dphi_ufold_0);
1535  TXfold = &(TXfold1);
1536  }
1537 // up fold
1538  if (jrl%2 ==(1-checkParity) && jrl>0 && jrl < Nbrt) {
1539  phi0_fold = &(phi0_ufold_1);
1540  dphi_fold = &(dphi_ufold_1);
1541  TXfold = &(TXfold1);
1542  }
1543 // last fold if up
1544  if (jrl%2==(1-checkParity) && jrl==Nbrt) {
1545  phi0_fold = &(phi0_ufold_2);
1546  dphi_fold = &(dphi_ufold_2);
1547  TXfold = &(TXfold2);
1548  }
1549 
1550  if (!phi0_fold || !dphi_fold || !TXfold) {
1551  ATH_MSG_INFO(" LArGeoBarrel::BarrelConstruction fold not defined...");
1552  }
1553  else
1554  for (int instance = 0; instance < Nabsorber; instance++)
1555  {
1556 
1557  GeoIntrusivePtr<GeoPhysVol> thinPhys = nullptr;
1558 
1559  if (!doDetailedAbsorberFold) {
1560  GeoTubs* thinTubs = new GeoTubs(Rcmin,Rcmax,ddz0,
1561  (*phi0_fold)(instance),(*dphi_fold)(instance));
1562  GeoTubs* thickTubs = new GeoTubs(Rcmin,Rcmax,ddz01,
1563  (*phi0_fold)(instance),(*dphi_fold)(instance));
1564 #ifdef DEBUGGEO
1565  std::cout << " Thin Abs Corner (tubs) " << std::endl;
1566  std::cout << " Rmin,Rmax,dZ,phi0,Dphi[rad] " << Rcmin << " " << Rcmax << " "
1567  << ddz0 << " " << (*phi0_fold)(instance) << " "
1568  <<(*dphi_fold)(instance) << std::endl;
1569  std::cout << " Thick Abs Corner (tubs) " << std::endl;
1570  std::cout << " Rmin,Rmax,dZ,phi0,Dphi[rad] " << Rcmin << " " << Rcmax << " "
1571  << ddz01 << " " << (*phi0_fold)(instance) << " "
1572  << (*dphi_fold)(instance) << std::endl;
1573 #endif
1574  const GeoLogVol* thinLog = new GeoLogVol(thinName,thinTubs,Thin_abs);
1575  const GeoLogVol* thickLog = new GeoLogVol(thickName,thickTubs,Thick_abs);
1576 
1577  thinPhys = new GeoPhysVol(thinLog);
1578  GeoIntrusivePtr<GeoPhysVol> thickPhys = new GeoPhysVol(thickLog);
1579 
1580  thinPhys->add(new GeoTransform(GeoTrf::TranslateZ3D(ddz01-ddz0)));
1581  thinPhys->add(thickPhys);
1582 #ifdef DEBUGGEO
1583  std::cout << " Position Thick fold in Thin Z = " << ddz01-ddz0 << std::endl;
1584 #endif
1585 
1586  }
1587 
1588  if (doDetailedAbsorberFold) {
1589 
1590  // bigger volume in steel to cover outer edges of absorber
1591  GeoTubs* thinTubs = new GeoTubs(Rcmin,Rcmax,ddz0,
1592  (*phi0_fold)(instance),(*dphi_fold)(instance));
1593  const GeoLogVol* thinLog = new GeoLogVol(thinName,thinTubs,myIron);
1594  thinPhys = new GeoPhysVol(thinLog);
1595 
1596 #ifdef DEBUGGEO
1597  std::cout << " overall fold volume rmin,rmax,dz " << Rcmin << " " << Rcmax << " " << ddz0 << std::endl;
1598 #endif
1599 
1600  // put inside volume with glue
1601  GeoTubs* glueTubs = new GeoTubs(Rcmin+0.5*Thfe*Contract,Rcmax-0.5*Thfe*Contract,ddz0,
1602  (*phi0_fold)(instance),(*dphi_fold)(instance));
1603  std::string foldGlueName = baseName+"Glue::Fold";
1604  const GeoLogVol* glueTubsLog = new GeoLogVol(foldGlueName,glueTubs,Glue);
1605  GeoIntrusivePtr<GeoPhysVol> glueTubsPhys = new GeoPhysVol(glueTubsLog);
1606  thinPhys->add(new GeoTransform(GeoTrf::TranslateZ3D(0.)));
1607  thinPhys->add(glueTubsPhys);
1608 #ifdef DEBUGGEO
1609  std::cout << " glue fold volume " << Rcmin+0.5*Thfe*Contract << " " << Rcmax-0.5*Thfe*Contract << " " << ddz0 << std::endl;
1610 #endif
1611 
1612  // put inside glue, volumes for lead, 2 thickness => 2 volumes
1613 
1614  // thick lead
1615  GeoTubs* thickLeadTubs = new GeoTubs(Rint-0.5*Thpb*Contract,Rint+0.5*Thpb*Contract,ddz01,
1616  (*phi0_fold)(instance),(*dphi_fold)(instance));
1617  std::string foldThickLeadName = baseName+"ThickLead::Fold";
1618  const GeoLogVol* thickLeadLog = new GeoLogVol(foldThickLeadName,thickLeadTubs,myLead);
1619  GeoIntrusivePtr<GeoPhysVol> thickLeadPhys = new GeoPhysVol(thickLeadLog);
1620  glueTubsPhys->add(new GeoTransform(GeoTrf::TranslateZ3D(ddz01-ddz0)));
1621  glueTubsPhys->add(thickLeadPhys);
1622 #ifdef DEBUGGEO
1623  std::cout << " thick lead volume " << Rint-Thpb*Contract << " " << Rint+Thpb*Contract << " " << ddz01 << std::endl;
1624  std::cout << " put in glue fold volume with z translation " << ddz01-ddz0 << std::endl;
1625 #endif
1626 
1627  // thin lead
1628  GeoTubs* thinLeadTubs = new GeoTubs(Rint-0.5*Thpb_thin*Contract,Rint+0.5*Thpb_thin*Contract,ddz0-ddz01,
1629  (*phi0_fold)(instance),(*dphi_fold)(instance));
1630  std::string foldThinLeadName = baseName+"ThinLead::Fold";
1631  const GeoLogVol* thinLeadLog = new GeoLogVol(foldThinLeadName,thinLeadTubs,myLead);
1632  GeoIntrusivePtr<GeoPhysVol> thinLeadPhys = new GeoPhysVol(thinLeadLog);
1633  glueTubsPhys->add(new GeoTransform(GeoTrf::TranslateZ3D(ddz01)));
1634  glueTubsPhys->add(thinLeadPhys);
1635 
1636 #ifdef DEBUGGEO
1637  std::cout << " thin lead volume " << Rint-Thpb_thin*Contract << " " << Rint+Thpb_thin*Contract << " " << ddz01 << std::endl;
1638  std::cout << " put in glue fold volume with z translation " << ddz01 << std::endl;
1639 #endif
1640 
1641 
1642 
1643  }
1644 
1645 #ifdef DEBUGGEO
1646  if (jrl !=Nbrt) {
1647  std::cout << " Position absorber fold x,y,z,rotation/z " << x1a(instance) <<
1648  " " << y1a(instance) << " " << zpos(instance) << " "
1649  << Gama(instance) << std::endl;
1650  } else {
1651  std::cout << " Position absorber fold x,y,z,rotation/z " << x2a(instance) <<
1652  " " << y2a(instance) << " " << zpos(instance) << " "
1653  << Gama(instance) << std::endl;
1654  }
1655 #endif
1656  if (m_A_SAGGING) {
1657  stacPhysical->add(new GeoTransform((*TXfold)(instance)));
1658  int icopytot = 10000*jrl+instance;
1659  stacPhysical->add(new GeoIdentifierTag(icopytot));
1660  stacPhysical->add(thinPhys);
1661  }
1662  else {
1663  GeoSerialTransformer *st = new GeoSerialTransformer(thinPhys, TXfold, Nabsorber);
1664  stacPhysical->add(new GeoSerialIdentifier(jrl*10000));
1665  stacPhysical->add(st);
1666  break;
1667  }
1668 
1669  } // loop over absorber folds instance
1670  } // loop over jrl
1671 
1672  } // idivi==0
1673  } // end absorbers
1674 
1675 // ======================== Electrodes:
1676  {
1677 
1678  // thickness of electrode
1679  double Dze = Thel/2.;
1680 
1681  // For electrodes
1682  GeoGenfun::GENFUNCTION x1e = LArGeo::Fx(irl+0., Game, Cenx, Ceny)
1683  +deltay[irl]*LArGeo::Del1(Game)
1684  +deltax[irl]*LArGeo::Del2(Game);
1685  GeoGenfun::GENFUNCTION x2e = LArGeo::Fx(irl+1., Game, Cenx, Ceny)
1686  +deltay[irl+1]*LArGeo::Del1(Game)
1687  +deltax[irl+1]*LArGeo::Del2(Game);
1688  GeoGenfun::GENFUNCTION y1e = LArGeo::Fy(irl+0., Game, Cenx, Ceny)
1689  -deltay[irl]*LArGeo::Del2(Game)
1690  +deltax[irl]*LArGeo::Del1(Game);
1691  GeoGenfun::GENFUNCTION y2e = LArGeo::Fy(irl+1., Game, Cenx, Ceny)
1692  -deltay[irl+1]*LArGeo::Del2(Game)
1693  +deltax[irl+1]*LArGeo::Del1(Game);
1694  GeoGenfun::GENFUNCTION dxe = x2e - x1e;
1695  GeoGenfun::GENFUNCTION dye = y2e - y1e;
1696  // De the two fold centers distance, de straight part length
1697  GeoGenfun::GENFUNCTION De = Sqrt ( dxe*dxe + dye*dye );
1698  GeoGenfun::GENFUNCTION de = Sqrt ( (De - 2.*Rint)*(De + 2.*Rint) );
1699 
1700  //newalphe (slant angle) value of the rotation angle around Z_axis
1701  GeoGenfun::GENFUNCTION cosalfae = (de*dxe -iparit*2.*Rint*dye)/De/De;
1702  GeoGenfun::GENFUNCTION sinalfae = (de*dye +iparit*2.*Rint*dxe)/De/De;
1703  GeoGenfun::GENFUNCTION newalphe = LArGeo::ATan2(sinalfae,cosalfae);
1704 
1705 
1706  // newalphae is already computed angle wrt z axis
1707  // P/2 rotation is to get absorber aligned along local x axis
1708  // instead of y, then rotate with angle newalpha
1709  GeoGenfun::GENFUNCTION alfrote = -M_PI/2. - newalphe;
1710 
1711  GeoGenfun::GENFUNCTION Xcde = (x1e + x2e)/2.+ (2.*idivi-1.)*(1.-frac)*de/2.*cosalfae;
1712  GeoGenfun::GENFUNCTION Ycde = (y1e + y2e)/2.+ (2.*idivi-1.)*(1.-frac)*de/2.*sinalfae;
1713  GeoGenfun::GENFUNCTION Zcde = GeoGenfun::FixedConstant(Zmin+(tl1+bl1)/2.+safety_zlen);
1714 
1715 
1716  GeoGenfun::GENFUNCTION h1e = de/2.*frac - .007*Gaudi::Units::mm;
1717  GeoGenfun::GENFUNCTION alpha_e = ATan(0.5*(bl1-tl1)/h1e);
1718 
1719 
1720  GeoXF::TRANSFUNCTION TXE =
1721  GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcde) *
1722  GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycde) *
1723  GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcde) *
1724  GeoXF::Pow(GeoTrf::RotateZ3D(1.0),-alfrote)*
1725  GeoTrf::RotateY3D(-90*Gaudi::Units::deg);
1726 
1727 
1728  for (int instance = 0; instance < Nelectrode; instance++)
1729  {
1730  std::string name = baseName + "Electrode::Straight";
1731 #ifdef DEBUGGEO
1732  std::cout << " *** Electrode trap parameters " << std::endl;
1733  std::cout << " Thickness " << Dze << std::endl;
1734  std::cout << " h1 (rad leng) " << h1e(instance) << std::endl;
1735  std::cout << " tl1,tb1 " << tl1 << " " << bl1 << std::endl;
1736  std::cout << " alpha " << alpha_e(instance) << std::endl;
1737  std::cout << " Position electrode x,y,z " << Xcde(instance) << " " << Ycde(instance)
1738  << " " << Zcde(instance) << std::endl;
1739  std::cout << " Rotation along Z " << -alfrote(instance)/deg << std::endl;
1740  std::cout << " Rotation along Y " << -90 << std::endl;
1741 
1742 #endif
1743 
1744  GeoTrap* trap = new GeoTrap(Dze,0.,0.,h1e(instance),tl1,bl1,alpha_e(instance),
1745  h1e(instance),tl1,bl1,alpha_e(instance));
1746  const GeoLogVol* logVol = new GeoLogVol(name,trap,Kapton_Cu);
1747  GeoIntrusivePtr<GeoPhysVol> physVol = new GeoPhysVol(logVol);
1748  //------------------------------------------------------------------------
1749  // JFB. If there is no sagging we can exit this loop after only one pass..
1750  // We simply declare the placement recipe, and place the first phys Vol
1751  // everywhere.
1752  //------------------------------------------------------------------------
1753  if (m_A_SAGGING) {
1754  if (!gStraightElectrodes) gStraightElectrodes = new GeoStraightAccSection();
1755  gStraightElectrodes->XCent(instance,irl)=TXE(instance)(0,3); //dx
1756  gStraightElectrodes->YCent(instance,irl)=TXE(instance)(1,3); //dy
1757  gStraightElectrodes->Cosu(instance,irl) =-(TXE(instance)(0,1)); //xy
1758  gStraightElectrodes->Sinu(instance,irl) = (TXE(instance)(0,2)); //xz
1759  gStraightElectrodes->HalfLength(instance,irl) = trap->getDydzn();
1760 
1761  stacPhysical->add(new GeoTransform(TXE(instance)));
1762  int icopytot=1000000*idivi+10000*irl+instance;
1763  stacPhysical->add(new GeoIdentifierTag(icopytot));
1764  stacPhysical->add(physVol);
1765  }
1766  else {
1767  if (!gStraightElectrodes) gStraightElectrodes = new GeoStraightAccSection();
1768  gStraightElectrodes->setTransform (irl,TXE);
1769  gStraightElectrodes->setHalfLength(irl,trap->getDydzn());
1770  GeoSerialTransformer *st = new GeoSerialTransformer(physVol, &TXE, Nelectrode);
1771  stacPhysical->add(new GeoSerialIdentifier(irl*10000+idivi*1000000));
1772  stacPhysical->add(st);
1773  break;
1774  }
1775  } // loop over instances
1776 
1777 
1778 
1779  if (idivi==0) {
1780 // Folds
1781  double phi0_safety=0.;
1782  if (irl==0) phi0_safety=0.003;
1783 
1784 // for most section, one fold = fold at the beginning of this section
1785 // for last section, should also to last fold, at the end of the section
1786 
1787  int irl1=irl;
1788  int irl2 = (irl==Nbrt-1) ? irl+1 : irl;
1789 
1790  for (int jrl=irl1; jrl<=irl2; jrl++) {
1791 
1792 // get slant angle for the previous zig-zag
1793  int iirl=jrl-1;
1794  if (iirl<0) iirl=1;
1795  GeoGenfun::GENFUNCTION x0e = LArGeo::Fx(iirl, Game, Cenx, Ceny)
1796  +deltay[iirl]*LArGeo::Del1(Game)
1797  +deltax[iirl]*LArGeo::Del2(Game);
1798  GeoGenfun::GENFUNCTION y0e = LArGeo::Fy(iirl, Game, Cenx, Ceny)
1799  -deltay[iirl]*LArGeo::Del2(Game)
1800  +deltax[iirl]*LArGeo::Del1(Game);
1801  GeoGenfun::GENFUNCTION dx0 = x1e - x0e;
1802  GeoGenfun::GENFUNCTION dy0 = y1e - y0e;
1803  // Da the two fold centers distance, da straight part length
1804  GeoGenfun::GENFUNCTION Da0 = Sqrt ( dx0*dx0 + dy0*dy0 );
1805  GeoGenfun::GENFUNCTION da0 = Sqrt ( (Da0 - 2.*Rint)*(Da0 + 2.*Rint) );
1806  // newalpha (slant angle) value of the rotation angle around Z_axis
1807  GeoGenfun::GENFUNCTION cosalfa0 = (da0*dx0 +iparit*2.*Rint*dy0)/Da0/Da0;
1808  GeoGenfun::GENFUNCTION sinalfa0 = (da0*dy0 -iparit*2.*Rint*dx0)/Da0/Da0;
1809  GeoGenfun::GENFUNCTION alphe_prev = LArGeo::ATan2(sinalfa0,cosalfa0);
1810 
1811 #ifdef DEBUGGEO
1812  if (jrl>0 && jrl<Nbrt) {
1813  std::cout << " newalphae, alphae_prev " << newalphe(0) << " "
1814  << alphe_prev(0) << std::endl;
1815  }
1816 #endif
1817 
1818 // down folds (add +M_PI and then rotate by -M_PI to follow same logic as old code)
1819  GeoGenfun::Mod Mod2Pi(2*M_PI);
1820  GeoGenfun::GENFUNCTION phi0_dfold_0 =
1821  GeoGenfun::FixedConstant(M_PI/2.+phi0_safety);
1822  GeoGenfun::GENFUNCTION dphi_dfold_0 = Mod2Pi(newalphe-phi0_safety-Game);
1823  GeoGenfun::GENFUNCTION phi0_dfold_1 = Mod2Pi(M_PI/2.+ alphe_prev - Game);
1824  GeoGenfun::GENFUNCTION dphi_dfold_1 = Mod2Pi(newalphe-alphe_prev);
1825  GeoGenfun::GENFUNCTION phi0_dfold_2 = Mod2Pi(M_PI/2.+ newalphe - Game);
1826  GeoGenfun::GENFUNCTION dphi_dfold_2 = Mod2Pi(- newalphe + Game);
1827 // up folds
1828  GeoGenfun::GENFUNCTION phi0_ufold_0 =
1829  Mod2Pi(M_PI/2.+newalphe-Game);
1830  GeoGenfun::GENFUNCTION dphi_ufold_0 = Mod2Pi(-newalphe+Game-phi0_safety);
1831  GeoGenfun::GENFUNCTION phi0_ufold_1 = Mod2Pi(M_PI/2. + newalphe - Game);
1832  GeoGenfun::GENFUNCTION dphi_ufold_1 = Mod2Pi(alphe_prev - newalphe);
1833  GeoGenfun::GENFUNCTION phi0_ufold_2 = GeoGenfun::FixedConstant(M_PI/2.);
1834  GeoGenfun::GENFUNCTION dphi_ufold_2 = Mod2Pi(newalphe - Game);
1835 
1836  const GeoGenfun::AbsFunction* phi0_fold=nullptr;
1837  const GeoGenfun::AbsFunction* dphi_fold=nullptr;
1838  const GeoXF::Function* TXfold=nullptr;
1839 
1840  std::string eName;
1841  if (jrl%2==checkParity) {
1842  eName = baseName + "Electrode::CornerDownFold";
1843  } else {
1844  eName = baseName + "Electrode::CornerUpFold";
1845  }
1846 
1847 // radius of tubs for folds
1848  double Rcmine=Rint-Thel/2.;
1849  double Rcmaxe=Rint+Thel/2.;
1850 
1851 // GU 09/06/2004 add some safety in z size
1852  double ddz0 = dz0-safety_zlen;
1853  if (jrl==Nbrt) {
1854  ddz0 = dza - safety_zlen;
1855  }
1856 
1857  GeoGenfun::GENFUNCTION zpos = GeoGenfun::FixedConstant(Zmin+dz0);
1858  double phirot = 0;
1859  if (jrl%2==checkParity) phirot = -M_PI;
1860  GeoXF::TRANSFUNCTION TXfold1=
1861  GeoXF::Pow(GeoTrf::TranslateX3D(1.0),x1e) *
1862  GeoXF::Pow(GeoTrf::TranslateY3D(1.0),y1e) *
1863  GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),zpos) *
1864  GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Game+phirot);
1865  GeoXF::TRANSFUNCTION TXfold2 =
1866  GeoXF::Pow(GeoTrf::TranslateX3D(1.0),x2e) *
1867  GeoXF::Pow(GeoTrf::TranslateY3D(1.0),y2e) *
1868  GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),zpos) *
1869  GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Game+phirot);
1870 
1871 // first fown fold
1872  if (jrl==0 && checkParity==0) {
1873  phi0_fold = &(phi0_dfold_0);
1874  dphi_fold = &(dphi_dfold_0);
1875  TXfold = &(TXfold1);
1876  }
1877 // normal fold
1878  if (jrl%2==checkParity && jrl >0 && jrl<Nbrt) {
1879  phi0_fold = &(phi0_dfold_1);
1880  dphi_fold = &(dphi_dfold_1);
1881  TXfold = &(TXfold1);
1882  }
1883 // last fold if down
1884  if (jrl%2 ==checkParity && jrl == Nbrt) {
1885  phi0_fold = &(phi0_dfold_2);
1886  dphi_fold = &(dphi_dfold_2);
1887  TXfold = &(TXfold2);
1888  }
1889 // first up fold
1890  if (jrl==0 && checkParity==1 ) {
1891  phi0_fold = &(phi0_ufold_0);
1892  dphi_fold = &(dphi_ufold_0);
1893  TXfold = &(TXfold1);
1894 
1895  }
1896 // up fold
1897  if (jrl%2 ==(1-checkParity) && jrl>0 && jrl < Nbrt) {
1898  phi0_fold = &(phi0_ufold_1);
1899  dphi_fold = &(dphi_ufold_1);
1900  TXfold = &(TXfold1);
1901  }
1902 // last fold if up
1903  if (jrl%2==(1-checkParity) && jrl==Nbrt) {
1904  phi0_fold = &(phi0_ufold_2);
1905  dphi_fold = &(dphi_ufold_2);
1906  TXfold = &(TXfold2);
1907  }
1908 
1909  if (!phi0_fold || !dphi_fold || !TXfold) {
1910  ATH_MSG_INFO(" LArGeoBarrel::BarrelConstruction fold not defined...");
1911  }
1912  else
1913  for (int instance = 0; instance < Nelectrode; instance++)
1914  {
1915 
1916  GeoTubs* foldeTubs = new GeoTubs(Rcmine,Rcmaxe,ddz0,
1917  (*phi0_fold)(instance),(*dphi_fold)(instance));
1918 #ifdef DEBUGGEO
1919  std::cout << " Electrode Corner (tubs) " << std::endl;
1920  std::cout << " Rmin,Rmax,dZ,phi0,Dphi[rad] " << Rcmine << " " << Rcmaxe << " "
1921  << ddz0 << " " << (*phi0_fold)(instance) << " "
1922  <<(*dphi_fold)(instance) << std::endl;
1923 #endif
1924  const GeoLogVol* foldeLog = new GeoLogVol(eName,foldeTubs,Kapton_Cu);
1925 
1926  GeoIntrusivePtr<GeoPhysVol> foldePhys = new GeoPhysVol(foldeLog);
1927 
1928 #ifdef DEBUGGEO
1929  if (jrl!=Nbrt) {
1930  std::cout << " Position electrode fold x,y,z,rotation/z " << x1e(instance) <<
1931  " " << y1e(instance) << " " << zpos(instance) << " "
1932  << Game(instance) << std::endl;
1933  } else {
1934  std::cout << " Position electrode fold x,y,z,rotation/z " << x2e(instance) <<
1935  " " << y2e(instance) << " " << zpos(instance) << " "
1936  << Game(instance) << std::endl;
1937  }
1938 #endif
1939  if (m_A_SAGGING) {
1940  stacPhysical->add(new GeoTransform((*TXfold)(instance)));
1941  int icopytot = 10000*jrl+instance;
1942  stacPhysical->add(new GeoIdentifierTag(icopytot));
1943  stacPhysical->add(foldePhys);
1944  }
1945  else {
1946  GeoSerialTransformer *st = new GeoSerialTransformer(foldePhys, TXfold, Nelectrode);
1947  stacPhysical->add(new GeoSerialIdentifier(jrl*10000));
1948  stacPhysical->add(st);
1949  break;
1950  }
1951 
1952  } // loop over electrode folds instance
1953  } // loop over jrl
1954 
1955  } // idivi==0
1956  } // end electrodes
1957  } // end loop over ndivi
1958  } // end loop over irl (zig-zag)
1959  {
1960  StatusCode status = detStore->record(gStraightElectrodes,"STRAIGHTELECTRODES");
1961  if(!status.isSuccess()) throw std::runtime_error ("Cannot store STRAIGHTELECTRODES structure");
1962  }
1963  {
1964  StatusCode status = detStore->record(gStraightAbsorbers,"STRAIGHTABSORBERS");
1965  if(!status.isSuccess()) throw std::runtime_error ("Cannot store STRAIGHTABSORBERS structure");
1966  }
1967  }
1968 
1969 #endif // BUILD_ACCORDION_PLATES
1970 
1971  ATH_MSG_DEBUG("++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1972  << "+ +\n"
1973  << "+ END of Barrel EM GeoModel definition +\n"
1974  << "+ +\n"
1975  << "++++++++++++++++++++++++++++++++++++++++++++++++++++");
1976 }
1977 
1979 {
1980  ATH_MSG_DEBUG("******** Print out of LArBarrel Accordion parameters ");
1981  ATH_MSG_DEBUG("Absorber parameters: ");
1982  ATH_MSG_DEBUG("Glue for ThinAbs " <<
1983  m_parameters->GetValue("LArEMBThinAbsGlue"));
1984  ATH_MSG_DEBUG("Iron for ThinAbs " <<
1985  m_parameters->GetValue("LArEMBThinAbsIron"));
1986  ATH_MSG_DEBUG("Lead for ThinAbs " <<
1987  m_parameters->GetValue("LArEMBThinAbsLead"));
1988  ATH_MSG_DEBUG("Glue for ThickAbs " <<
1989  m_parameters->GetValue("LArEMBThickAbsGlue"));
1990  ATH_MSG_DEBUG("Iron for ThickAbs " <<
1991  m_parameters->GetValue("LArEMBThickAbsIron"));
1992  ATH_MSG_DEBUG("Lead for ThickAbs "
1993  << m_parameters->GetValue("LArEMBThickAbsLead"));
1994 
1995  ATH_MSG_DEBUG("Electrode parameters: ");
1996  ATH_MSG_DEBUG("Copper thickness " <<
1997  m_parameters->GetValue("LArEMBThickElecCopper"));
1998  ATH_MSG_DEBUG("Kapton thickness " <<
1999  m_parameters->GetValue("LArEMBThickElecKapton"));
2000 
2001  ATH_MSG_DEBUG("Accordion geometry description ");
2002  ATH_MSG_DEBUG("phi first absorber " <<
2003  m_parameters->GetValue("LArEMBAbsPhiFirst"));
2004  ATH_MSG_DEBUG("zmin of absorber " <<
2005  m_parameters->GetValue("LArEMBMotherZmin"));
2006  ATH_MSG_DEBUG("zmax of absorber " <<
2007  m_parameters->GetValue("LArEMBMotherZmax"));
2008  ATH_MSG_DEBUG("Max eta " <<
2009  m_parameters->GetValue("LArEMBMaxEtaAcceptance"));
2010  ATH_MSG_DEBUG("Nominal eta lead change " <<
2011  m_parameters->GetValue("LArEMBThickEtaAcceptance"));
2012  ATH_MSG_DEBUG("Number of abs in phi " <<
2013  m_parameters->GetValue("LArEMBnoOFPhysPhiCell"));
2014  ATH_MSG_DEBUG("Dphi between absorbers " <<
2015  m_parameters->GetValue("LArEMBPhiGapAperture"));
2016  ATH_MSG_DEBUG("Rmin Mother " <<
2017  m_parameters->GetValue("LArEMBMotherRmin"));
2018  ATH_MSG_DEBUG("Rmax Mother " <<
2019  m_parameters->GetValue("LArEMBMotherRmax"));
2020  ATH_MSG_DEBUG("Rmin at zmax " <<
2021  m_parameters->GetValue("LArEMBRminHighZ"));
2022  ATH_MSG_DEBUG("Phimax barrel " <<
2023  m_parameters->GetValue("LArEMBphiMaxBarrel"));
2024  ATH_MSG_DEBUG("Number of zigs " <<
2025  m_parameters->GetValue("LArEMBnoOFAccZigs"));
2026  ATH_MSG_DEBUG("Fold Gaudi::Units::rad of curvature " <<
2027  m_parameters->GetValue("LArEMBNeutFiberRadius"));
2028  for (int i=0;i<15;i++) {
2029  ATH_MSG_DEBUG("Fold " << i << " radius " <<
2030  m_parameters->GetValue("LArEMBRadiusAtCurvature",i));
2031  }
2032  for (int i=0;i<15;i++) {
2033  ATH_MSG_DEBUG("Fold " << i << " phi0 " <<
2034  m_parameters->GetValue("LArEMBPhiAtCurvature",i));
2035  }
2036  for (int i=0;i<15;i++) {
2037  ATH_MSG_DEBUG("Fold " << i << " eta trans " <<
2038  m_parameters->GetValue("LArEMBEtaTrans",i));
2039  }
2040  for (int i=0;i<14;i++) {
2041  ATH_MSG_DEBUG("zig " << i << " angle " <<
2042  m_parameters->GetValue("LArEMBDeltaZigAngle",i));
2043  }
2044 
2045  ATH_MSG_DEBUG("Fiducial active region definition ");
2046  ATH_MSG_DEBUG("Zmin " <<
2047  m_parameters->GetValue("LArEMBfiducialMothZmin"));
2048  ATH_MSG_DEBUG("Zmax " <<
2049  m_parameters->GetValue("LArEMBfiducialMothZmax"));
2050  ATH_MSG_DEBUG("Rmin " <<
2051  m_parameters->GetValue("LArEMBRadiusInnerAccordion"));
2052  ATH_MSG_DEBUG("Rmax " <<
2053  m_parameters->GetValue("LArEMBFiducialRmax"));
2054  ATH_MSG_DEBUG("Inactive DR S1 to S2 " <<
2055  m_parameters->GetValue("LArEMBDeltaRS12"));
2056 
2057  ATH_MSG_DEBUG("Description of matter from PS to strip ");
2058  ATH_MSG_DEBUG("DeltaR for LAR+Cable+MotherBoard volume " <<
2059  m_parameters->GetValue("LArEMBInnerElectronics"));
2060  ATH_MSG_DEBUG("Number of cable volumes " <<
2061  m_parameters->GetValue("LArEMBnoOFcableBundle"));
2062  ATH_MSG_DEBUG("Cable Cu fraction " <<
2063  m_parameters->GetValue("LArEMBmasspercentCu"));
2064  ATH_MSG_DEBUG("Cable Kapton fraction " <<
2065  m_parameters->GetValue("LArEMBmasspercentKap"));
2066  ATH_MSG_DEBUG("Cable thickness@eta=0 " <<
2067  m_parameters->GetValue("LArEMBCablethickat0"));
2068  ATH_MSG_DEBUG("Cable thick increase/eta " <<
2069  m_parameters->GetValue("LArEMBthickincrfac"));
2070  ATH_MSG_DEBUG("Cable width " <<
2071  m_parameters->GetValue("LArEMBCableEtaheight"));
2072  ATH_MSG_DEBUG("DR of cable from PS " <<
2073  m_parameters->GetValue("LArEMBCablclearfrPS"));
2074  ATH_MSG_DEBUG("Number of motherboard " <<
2075  m_parameters->GetValue("LArEMBnoOFmothboard"));
2076  ATH_MSG_DEBUG("MotherBoard Cu thickness " <<
2077  m_parameters->GetValue("LArEMBCuThickness"));
2078  ATH_MSG_DEBUG("MotherBoard G10 thickness " <<
2079  m_parameters->GetValue("LArEMBG10Thickness"));
2080  ATH_MSG_DEBUG("MotherBoard thickness " <<
2081  m_parameters->GetValue("LArEMBMoBoTchickness"));
2082  ATH_MSG_DEBUG("MotherBoard width " <<
2083  m_parameters->GetValue("LArEMBMoBoHeight"));
2084  ATH_MSG_DEBUG("MotherBoard DR from PS " <<
2085  m_parameters->GetValue("LArEMBMoBoclearfrPS"));
2086  ATH_MSG_DEBUG("G10 inner ring thickness " <<
2087  m_parameters->GetValue("LArEMBG10SupportBarsIn"));
2088  ATH_MSG_DEBUG("Dz G10 inner ring " <<
2089  m_parameters->GetValue("LArEMBG10FrontDeltaZ"));
2090  ATH_MSG_DEBUG("G10 front tip " <<
2091  m_parameters->GetValue("LArEMBG10TipThickFront"));
2092  ATH_MSG_DEBUG("Absorber front tip " <<
2093  m_parameters->GetValue("LArEMBLeadTipThickFront"));
2094  ATH_MSG_DEBUG("Description of matter after accordion ");
2095  ATH_MSG_DEBUG("G10 outer ring thickness " <<
2096  m_parameters->GetValue("LArEMBG10SupportBarsOut"));
2097  ATH_MSG_DEBUG("Absorber outer tip " <<
2098  m_parameters->GetValue("LArEMBLeadTipThickEnd"));
2099  ATH_MSG_DEBUG("G10 outer tip " <<
2100  m_parameters->GetValue("LArEMBG10TipThickEnd"));
2101  ATH_MSG_DEBUG("total outer tip DeltaR " <<
2102  m_parameters->GetValue("LArEMBLArGapTail"));
2103 }
IRDBRecord::getInt
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
LArGeo::BarrelConstruction::GetNegativeEnvelope
GeoIntrusivePtr< GeoFullPhysVol > GetNegativeEnvelope()
Definition: BarrelConstruction.cxx:124
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
VertexShift::Zmax
const float Zmax
Definition: VertexShift.h:26
GeoRef.h
Simple smart-pointer class for GeoModel objects.
GeoStraightAccSection
Record of All Electrode Straight Pieces.
Definition: GeoStraightAccSection.h:24
LArGeo::VDetectorParameters
Definition: VDetectorParameters.h:29
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
LAr
Definition: LArVolumeBuilder.h:36
LArGeo::BarrelConstruction::BarrelConstruction
BarrelConstruction(bool fullGeo, const VDetectorParameters *params)
Definition: BarrelConstruction.cxx:104
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
GeoStraightAccSection::Sinu
const double & Sinu(int stackid, int cellid) const
Zmin
double Zmin
Definition: LArDetectorConstructionTBEC.cxx:58
StoredMaterialManager::getElement
virtual const GeoElement * getElement(const std::string &name)=0
M_PI
#define M_PI
Definition: ActiveFraction.h:11
deg
#define deg
Definition: SbPolyhedron.cxx:17
DecodeVersionKey::node
const std::string & node() const
Return the version node.
Definition: DecodeVersionKey.cxx:97
LArGeo::BarrelConstruction::GetPositiveEnvelope
GeoIntrusivePtr< GeoFullPhysVol > GetPositiveEnvelope()
Definition: BarrelConstruction.cxx:119
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
read_hist_ntuple.h1
h1
Definition: read_hist_ntuple.py:21
GeoStraightAccSection.h
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
LArGeo::Fx
GeoGenfun::FunctionNoop Fx(double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[])
Definition: BarrelAuxFunctions.cxx:16
pi
#define pi
Definition: TileMuonFitter.cxx:65
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
GeoStraightAccSection::YCent
const double & YCent(int stackid, int cellid) const
StoredPhysVol
Definition: StoredPhysVol.h:27
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
LArGeo::Del1
GeoGenfun::FunctionNoop Del1(GeoGenfun::GENFUNCTION G)
Definition: BarrelAuxFunctions.cxx:34
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
checkxAOD.frac
frac
Definition: Tools/PyUtils/bin/checkxAOD.py:259
Dz
double Dz
Definition: LArDetectorConstructionTBEC.cxx:59
makeTRTBarrelCans.y2
tuple y2
Definition: makeTRTBarrelCans.py:18
DecodeVersionKey
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
Definition: DecodeVersionKey.h:18
DecodeVersionKey::tag
const std::string & tag() const
Return version tag.
Definition: DecodeVersionKey.cxx:91
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
BarrelConstruction.h
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
LArGeo::Del2
GeoGenfun::FunctionNoop Del2(GeoGenfun::GENFUNCTION G)
Definition: BarrelAuxFunctions.cxx:42
GeoStraightAccSection::Cosu
const double & Cosu(int stackid, int cellid) const
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
BarrelAuxFunctions.h
Namespace with auxiliary functions used by BarrelConstruction and ElStraightSectionBuilder classes.
VDetectorParameters.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
StoredMaterialManager.h
DecodeVersionKey.h
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
makeTRTBarrelCans.dy
tuple dy
Definition: makeTRTBarrelCans.py:21
LArGeo::Fy
GeoGenfun::FunctionNoop Fy(double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[])
Definition: BarrelAuxFunctions.cxx:25
LArGeo::BarrelConstruction::printParams
void printParams()
Definition: BarrelConstruction.cxx:1978
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
IRDBRecord::isFieldNull
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
GeoStraightAccSection::setHalfLength
void setHalfLength(int stackid, double halfLength)
Definition: GeoStraightAccSection.cxx:56
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition: IRDBRecord.h:27
DEBUG
#define DEBUG
Definition: page_access.h:11
IRDBRecord_ptr
std::unique_ptr< IRDBRecord > IRDBRecord_ptr
Definition: IRDBRecordset.h:23
makeTRTBarrelCans.dx
tuple dx
Definition: makeTRTBarrelCans.py:20
GeoStraightAccSection::HalfLength
const double & HalfLength(int stackid, int cellid) const
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
GeoStraightAccSection::XCent
const double & XCent(int stackid, int cellid) const
merge.status
status
Definition: merge.py:17
GeoStraightAccSection::setTransform
void setTransform(int stackid, GeoXF::TRANSFUNCTION TXE)
Definition: GeoStraightAccSection.cxx:60
I
#define I(x, y, z)
Definition: MD5.cxx:116
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
LArGeo::BarrelConstruction::MakeEnvelope
void MakeEnvelope()
Definition: BarrelConstruction.cxx:129
IGeoModelSvc.h
LArGeo::BarrelConstruction::~BarrelConstruction
virtual ~BarrelConstruction()
StoreGateSvc.h
python.compressB64.c
def c
Definition: compressB64.py:93
GeoRef
GeoIntrusivePtr< T > GeoRef
Definition: GeoRef.h:20
StoredPhysVol.h
LArGeo::ATan2
GeoGenfun::FunctionNoop ATan2(GeoGenfun::GENFUNCTION y, GeoGenfun::GENFUNCTION x)
Definition: BarrelAuxFunctions.cxx:50
MuonR4::contract
double contract(const CalibratedSpacePoint::Covariance_t &mat, const Amg::Vector3D &a, const Amg::Vector3D &b)
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/UtilFunctions.cxx:13