ATLAS Offline Software
LArVolumeBuilder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // LArVolumeBuilder.cxx, (c) ATLAS Detector software
8 
9 // Calo
10 #include "LArVolumeBuilder.h"
11 // LAr
13 // CaloDepth
16 // GeoModel
17 #include "GeoModelKernel/GeoFullPhysVol.h"
18 #include "GeoModelKernel/GeoLogVol.h"
19 #include "GeoModelKernel/GeoShape.h"
20 #include "GeoModelKernel/GeoTubs.h"
21 #include "GeoModelKernel/GeoTube.h"
22 #include "GeoModelKernel/GeoPcon.h"
23 #include "GeoModelKernel/GeoTrd.h"
24 #include "GeoModelKernel/GeoMaterial.h"
28 // Trk
36 #include "TrkGeometry/Material.h"
38 #include "TrkGeometry/DiscLayer.h"
45 #include "TrkSurfaces/DiscBounds.h"
48 
49 // constructor
50 LAr::LArVolumeBuilder::LArVolumeBuilder(const std::string& t, const std::string& n, const IInterface* p) :
51  AthAlgTool(t,n,p)
52 {
53  declareInterface<Trk::ICaloTrackingVolumeBuilder>(this);
54 }
55 
56 // destructor
57 LAr::LArVolumeBuilder::~ LArVolumeBuilder() = default;
58 
59 
60 // Athena standard methods
61 // initialize
63 {
64  // Retrieve the volume creator
65  ATH_CHECK(m_trackingVolumeCreator.retrieve());
66  ATH_MSG_DEBUG( "Retrieved tool " << m_trackingVolumeCreator );
67 
68  if(m_useCaloSurfBuilder){
69  ATH_CHECK(m_calosurf.retrieve());
70  ATH_MSG_DEBUG( "Retrieved tool " << m_calosurf );
71  }
72 
73  ATH_MSG_DEBUG( name() << " initialize() successful" );
74  return StatusCode::SUCCESS;
75 }
76 
77 // finalize
79 {
80  ATH_MSG_DEBUG( "finalize() successful" );
81  return StatusCode::SUCCESS;
82 }
83 
84 std::vector<Trk::TrackingVolume*> LAr::LArVolumeBuilder::trackingVolumes(
85  const CaloDetDescrManager& caloDDM,
86  const GeoAlignmentStore* geoAlign) const {
87 
88  Trk::Material dummyMaterial;
89  // get LAr Detector Description Manager
90  const LArDetectorManager* lArMgr=nullptr;
91  if (detStore()->retrieve(lArMgr, m_lArMgrLocation).isFailure()) {
92  ATH_MSG_FATAL( "Could not get LArDetectorManager! Calo TrackingGeometry will not be built");
93  return {};
94  }
95 
96  // out of couriosity
97  unsigned int numTreeTops = lArMgr->getNumTreeTops();
98  ATH_MSG_DEBUG( "Retrieved " << numTreeTops << " tree tops from the LArDetDescrManager. " );
99 
100  for (unsigned int itreetop = 0; itreetop<numTreeTops; ++itreetop){
101  PVConstLink currentVPhysVolLink = lArMgr->getTreeTop(itreetop);
102  const GeoLogVol* currentLogVol = currentVPhysVolLink->getLogVol();
103 
104  unsigned int currentChilds = currentVPhysVolLink->getNChildVols();
105 
106  ATH_MSG_DEBUG( "Processing " << currentLogVol->getName() << "... has "
107  << currentChilds << " childs, position " << currentVPhysVolLink->getX(geoAlign).translation());
108  //printInfo( currentVPhysVolLink,geoAlign,2);
109  }
110 
111 
113  // THE BARREL SECTION
114  ATH_MSG_DEBUG( "============ Barrel Section ======================" );
115 
116  Trk::TrackingVolume* solenoid = nullptr;
117  Trk::TrackingVolume* solenoidLArBarrelGap = nullptr;
118  Trk::TrackingVolume* lArBarrelPresampler = nullptr;
119  Trk::TrackingVolume* lArBarrel = nullptr;
120 
121  std::shared_ptr<Trk::CylinderVolumeBounds> solenoidBounds = nullptr;
122  std::shared_ptr<Trk::CylinderVolumeBounds> solenoidLArBarrelGapBounds = nullptr;
123 
124  // default material definition
125  Trk::Material solenoidMaterial = Trk::Material( 69.9, 811.5, 28.9, 13.8, 0.003);
126  auto lArBarrelPresamplerMaterial = std::make_shared<Trk::Material>(130., 634.4, 33.7, 15.4, 0.0017);
127  auto lArBarrelMaterial = std::make_shared<Trk::Material>( 26.2, 436.3, 65.4, 27.8, 0.0035);
128 
129  // load layer surfaces
130  std::vector<std::pair<const Trk::Surface*, const Trk::Surface*>> entrySurf =
131  m_calosurf->entrySurfaces(&caloDDM);
132  std::vector<std::pair<const Trk::Surface*, const Trk::Surface*>> exitSurf =
133  m_calosurf->exitSurfaces(&caloDDM);
134 
135  StoredPhysVol* storedPV = nullptr;
136 
137  // -> The BARREL Section ---------------------------------------------------------
138  ATH_MSG_DEBUG( "Building Barrel ... " );
139 
140  std::shared_ptr<Trk::CylinderVolumeBounds> lArBarrelPosBounds = nullptr;
141  std::shared_ptr<Trk::CylinderVolumeBounds> lArBarrelNegBounds = nullptr;
142 
143  if (detStore()->contains<StoredPhysVol>("EMB_POS")) {
144  if (detStore()->retrieve(storedPV, "EMB_POS") == StatusCode::FAILURE) {
145  ATH_MSG_DEBUG("Unable to retrieve Stored PV EMB_POS");
146  storedPV = nullptr;
147  }
148  }
149  GeoFullPhysVol* lArBarrelPosPhysVol =
150  storedPV ? storedPV->getPhysVol() : nullptr;
151 
152  //if (lArBarrelPosPhysVol) printInfo(lArBarrelPosPhysVol,geoAlign,2);
153 
154  if (detStore()->contains<StoredPhysVol>("EMB_NEG")) {
155  if (detStore()->retrieve(storedPV, "EMB_NEG") == StatusCode::FAILURE) {
156  ATH_MSG_DEBUG("Unable to retrieve Stored PV EMB_NEG");
157  storedPV = nullptr;
158  }
159  }
160  GeoFullPhysVol* lArBarrelNegPhysVol =
161  storedPV ? storedPV->getPhysVol() : nullptr;
162 
163  const GeoLogVol* lArBarrelPosLogVol = lArBarrelPosPhysVol ? lArBarrelPosPhysVol->getLogVol() : nullptr;
164  const GeoLogVol* lArBarrelNegLogVol = lArBarrelNegPhysVol ? lArBarrelNegPhysVol->getLogVol() : nullptr;
165 
166  // get the material : needs averaging
167 
168  double lArBarrelHalflength = 0.;
169  std::vector<double> zBoundaries;
170 
171  // retrival worked out
172  if (lArBarrelPosLogVol && lArBarrelNegLogVol){
173 
174  int poschilds = lArBarrelPosPhysVol->getNChildVols();
175  int negchilds = lArBarrelNegPhysVol->getNChildVols();
176 
177  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume " << lArBarrelPosPhysVol->getAbsoluteName()
178  << " (" << poschilds << " childs) ." );
179  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume " << lArBarrelNegPhysVol->getAbsoluteName()
180  << " (" << negchilds << " childs) ." );
181 
182  // and the shapes
183  const GeoShape* lArBarrelPosShape = lArBarrelPosLogVol->getShape();
184  const GeoShape* lArBarrelNegShape = lArBarrelNegLogVol->getShape();
185 
186  // dynamic cast to 'Tubs' shape
187  const GeoPcon* lArBarrelPosPcon = dynamic_cast<const GeoPcon*>(lArBarrelPosShape);
188  lArBarrelPosBounds = (lArBarrelPosPcon) ? Trk::GeoShapeConverter::convert(lArBarrelPosPcon, zBoundaries) : nullptr;
189  const GeoPcon* lArBarrelNegPcon = dynamic_cast<const GeoPcon*>(lArBarrelNegShape);
190  lArBarrelNegBounds = (lArBarrelNegPcon) ? Trk::GeoShapeConverter::convert(lArBarrelNegPcon, zBoundaries) : nullptr;
191 
192  if (lArBarrelPosBounds)
193  ATH_MSG_VERBOSE( " -> Positive Barrel Bounds: " << *lArBarrelPosBounds );
194  if (lArBarrelNegBounds)
195  ATH_MSG_VERBOSE( " -> Negative Barrel Bounds: " << *lArBarrelNegBounds );
196 
197 
198  }
199  // conversion of PreSamplers done -> make one out of two
200  if (lArBarrelPosBounds && lArBarrelNegBounds){
201 
202  // new dimensions
203  double lArBarrelRmin = lArBarrelPosBounds->innerRadius();
204  double lArBarrelRmax = lArBarrelPosBounds->outerRadius();
205  lArBarrelHalflength = zBoundaries[1];
206 
207  // create the static half-bounds
208  auto lArBarrelBoundsPos = std::make_shared<Trk::CylinderVolumeBounds>(
209  lArBarrelRmin, lArBarrelRmax, 0.5 * lArBarrelHalflength);
210  auto lArBarrelBoundsNeg =
211  std::make_shared<Trk::CylinderVolumeBounds>(*lArBarrelBoundsPos);
212 
213  // position static half-volumes
214  Amg::Vector3D lArBPos(0.,0.,0.5*lArBarrelHalflength);
215  Amg::Vector3D lArBNeg(0.,0.,-0.5*lArBarrelHalflength);
216  auto lArBPosTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArBPos));
217  auto lArBNegTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArBNeg));
218 
219  // layer entry/exit
220 
221  // binned material for LAr : steering in binEta
222  std::vector<Trk::IdentifiedMaterial> matID;
223  // layer material can be adjusted here
224  int baseID = Trk::GeometrySignature(Trk::Calo)*1000;
225  matID.emplace_back(lArBarrelMaterial,0);
226  matID.emplace_back(lArBarrelMaterial,baseID+1);
227  matID.emplace_back(lArBarrelMaterial,baseID+2);
228  matID.emplace_back(lArBarrelMaterial,baseID+3);
229  // scaling factors refer to avZ(avA) change
230  matID.emplace_back(lArBarrelMaterial->scale(1.3),baseID+1);
231  matID.emplace_back(lArBarrelMaterial->scale(1.3),baseID+2);
232  matID.emplace_back(lArBarrelMaterial->scale(0.6),baseID+3);
233  matID.emplace_back(lArBarrelMaterial->scale(0.7),baseID+3);
234  matID.emplace_back(lArBarrelMaterial->scale(0.8),baseID+3);
235  matID.emplace_back(lArBarrelMaterial->scale(0.9),baseID+3);
236  matID.emplace_back(lArBarrelMaterial->scale(1.1),baseID+3);
237 
238  //
239  auto bubn = Trk::BinUtility(30,-1.5,0.,Trk::open,Trk::binEta);
240  auto bubp = Trk::BinUtility(30, 0.,1.5,Trk::open,Trk::binEta);
241  // array of indices
242  std::vector<std::vector<size_t> > indexP(bubn.bins());
243  std::vector<std::vector<size_t> > indexN;
244  // binned material for LAr : layer depth per eta bin
245  std::vector< Trk::BinUtility> layBUN(bubn.bins());
246  std::vector< Trk::BinUtility> layBUP(bubp.bins());
247  // retrieve offset values (from surfaces on negative side)
248  double r1 = entrySurf[CaloCell_ID::EMB1].second->bounds().r(); // first layer has no modulations
249  double r2 = entrySurf[CaloCell_ID::EMB2].second->bounds().r(); // base value
250  double r3 = entrySurf[CaloCell_ID::EMB3].second->bounds().r(); // base value
251 
252  std::vector<float> offset2{};
253  const Trk::SlidingCylinderSurface* scyl2 = dynamic_cast<const Trk::SlidingCylinderSurface* > (entrySurf[CaloCell_ID::EMB2].second);
254  if (scyl2) offset2 = scyl2->offset();
255  std::vector<float> offset3{};
256  const Trk::SlidingCylinderSurface* scyl3 = dynamic_cast<const Trk::SlidingCylinderSurface* > (entrySurf[CaloCell_ID::EMB3].second);
257  if (scyl3) offset3 = scyl3->offset();
258  // construct bin utilities symmetrically
259  std::vector<float> steps;
260  for (unsigned int i=0; i< bubn.bins(); i++) {
261  steps.clear();
262  steps.push_back(lArBarrelBoundsNeg->innerRadius());
263  std::vector<size_t> indx; indx.clear();
264  indx.push_back(0);
265  steps.push_back(r1);
266  indx.push_back( i<14 ? 1:4 );
267  steps.push_back(r2 + offset2[i] );
268  indx.push_back( i<14 ? 2:5 );
269  steps.push_back(r3 + offset3[i]);
270  // 3rd layer complicated
271  if (i>19) indx.push_back(7);
272  else if (i>17) indx.push_back(8);
273  else if (i>15) indx.push_back(9);
274  else if (i>13) indx.push_back(3);
275  else if (i>11) indx.push_back(6);
276  else if (i>9) indx.push_back(7);
277  else if (i>7) indx.push_back(8);
278  else if (i>5) indx.push_back(8);
279  else if (i>4) indx.push_back(9);
280  else indx.push_back(3);
281  // end 3rd layer
282  steps.push_back(lArBarrelBoundsNeg->outerRadius());
284  layBUN[i] = rBU;
285  layBUP[bubp.bins()-1-i] = rBU;
286  indexN.push_back(indx);
287  indexP[bubp.bins()-1-i] = std::vector<size_t>(indx);
288  }
289 
290  const Trk::BinnedMaterial lArBarrelMaterialBinPos(*lArBarrelMaterial,bubp,layBUP,indexP,matID);
291  const Trk::BinnedMaterial lArBarrelMaterialBinNeg(*lArBarrelMaterial,bubn,layBUN,indexN,matID);
292 
293 
294  auto *lArBarrelPos = new Trk::AlignableTrackingVolume(
295  std::move(lArBPosTransform),
296  std::move(lArBarrelBoundsPos),
297  lArBarrelMaterialBinPos,
298  1,
299  "Calo::Detectors::LAr::BarrelPos");
300 
301  auto *lArBarrelNeg = new Trk::AlignableTrackingVolume(
302  std::move(lArBNegTransform),
303  std::move(lArBarrelBoundsNeg),
304  lArBarrelMaterialBinNeg,
305  1,
306  "Calo::Detectors::LAr::BarrelNeg");
307 
308  // glue barrel EM
309  std::vector<Trk::TrackingVolume*> volsB;
310  volsB.push_back(lArBarrelNeg);
311  volsB.push_back(lArBarrelPos);
312 
313  lArBarrel = m_trackingVolumeCreator->createContainerTrackingVolume(volsB,
314  dummyMaterial,
315  "Calo::Container::LAr::Barrel");
316  }
317 
318  // (1) Build the Solenoid ------------------------------------------------------------
319  ATH_MSG_DEBUG( "Building the Solenoid ... " );
320 
321  if(detStore()->contains<StoredPhysVol>("SOLENOID"))
322  {
323  if(detStore()->retrieve(storedPV,"SOLENOID")==StatusCode::FAILURE)
324  {
325  ATH_MSG_DEBUG( "Unable to retrieve Stored PV SOLENOID" );
326  storedPV = nullptr;
327  }
328  }
329  GeoFullPhysVol* solenoidPhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
330 
331 
332  const GeoLogVol* solenoidLogVol = solenoidPhysVol ? solenoidPhysVol->getLogVol() : nullptr;
333 
334  // retrival worked out
335  if (solenoidLogVol){
336  int childs = solenoidPhysVol->getNChildVols();
337 
338  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume "
339  << solenoidPhysVol->getAbsoluteName() << " (" << childs << " childs) ." );
340 
341  const GeoShape* solenoidShape = solenoidLogVol->getShape();
342  // dynamic cast to 'Tubs' shape
343  const GeoTubs* solenoidTubs = dynamic_cast<const GeoTubs*>(solenoidShape);
344  solenoidBounds = std::make_shared<Trk::CylinderVolumeBounds>(solenoidTubs->getRMin(),solenoidTubs->getRMax(),lArBarrelHalflength);
345  // assing the material
346  const GeoMaterial* solenoidMaterialGM = solenoidLogVol->getMaterial();
347  if (solenoidMaterialGM) {
348  solenoidMaterial = Trk::GeoMaterialConverter::convert(solenoidMaterialGM);
349  }
350  }
351 
352  // conversion ok : create the volume
353  if (solenoidBounds) {
354  // output the bounds
355  ATH_MSG_DEBUG( " -> Solenoid Bounds: " << *solenoidBounds );
356 
357  solenoid = new Trk::TrackingVolume(
358  nullptr,
359  solenoidBounds,
360  solenoidMaterial,
361  nullptr, nullptr,
362  "Calo::Solenoid");
363 
364  }
365 
366  // (2) Build the Presampler ------------------------------------------------------------
367  ATH_MSG_DEBUG( "Building Barrel Presampler ... " );
368 
369  std::shared_ptr<Trk::CylinderVolumeBounds> lArBarrelPresamplerPosBounds = nullptr;
370  std::shared_ptr<Trk::CylinderVolumeBounds> lArBarrelPresamplerNegBounds = nullptr;
371 
372  if(detStore()->contains<StoredPhysVol>("PRESAMPLER_B_POS"))
373  {
374  if(detStore()->retrieve(storedPV,"PRESAMPLER_B_POS")==StatusCode::FAILURE)
375  {
376  ATH_MSG_DEBUG( "Unable to retrieve Stored PV PRESAMPLER_B_POS" );
377  storedPV = nullptr;
378  }
379  }
380  GeoFullPhysVol* lArBarrelPresamplerPosPhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
381 
382 
383 
384  if(detStore()->contains<StoredPhysVol>("PRESAMPLER_B_NEG"))
385  {
386  if(detStore()->retrieve(storedPV,"PRESAMPLER_B_NEG")==StatusCode::FAILURE)
387  {
388  ATH_MSG_DEBUG( "Unable to retrieve Stored PV PRESAMPLER_B_NEG" );
389  storedPV = nullptr;
390  }
391  }
392  GeoFullPhysVol* lArBarrelPresamplerNegPhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
393 
394 
395  const GeoLogVol* lArBarrelPresamplerPosLogVol = lArBarrelPresamplerPosPhysVol ? lArBarrelPresamplerPosPhysVol->getLogVol() : nullptr;
396  const GeoLogVol* lArBarrelPresamplerNegLogVol = lArBarrelPresamplerNegPhysVol ? lArBarrelPresamplerNegPhysVol->getLogVol() : nullptr;
397 
398  // retrival worked out
399  if (lArBarrelPresamplerPosLogVol && lArBarrelPresamplerNegLogVol){
400 
401  int poschilds = lArBarrelPresamplerPosPhysVol->getNChildVols();
402  int negchilds = lArBarrelPresamplerNegPhysVol->getNChildVols();
403 
404  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume "
405  << lArBarrelPresamplerPosPhysVol->getAbsoluteName() << " (" << poschilds << " childs) ." );
406  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume "
407  << lArBarrelPresamplerNegPhysVol->getAbsoluteName() << " (" << negchilds << " childs) ." );
408 
409  Amg::Vector3D lArBPos(0.,0.,0.5*lArBarrelHalflength);
410  Amg::Vector3D lArBNeg(0.,0.,-0.5*lArBarrelHalflength);
411  auto lArPBPosTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArBPos));
412  auto lArPBNegTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArBNeg));
413 
414  // and the shapes
415  const GeoShape* lArBarrelPresamplerPosShape = lArBarrelPresamplerPosLogVol->getShape();
416 
417  // dynamic cast to 'Tubs' shape
418  const GeoTubs* lArBarrelPresamplerPosTubs = dynamic_cast<const GeoTubs*>(lArBarrelPresamplerPosShape);
419  lArBarrelPresamplerPosBounds = std::make_shared<Trk::CylinderVolumeBounds>(lArBarrelPresamplerPosTubs->getRMin(),
420  lArBarrelPresamplerPosTubs->getRMax(),
421  0.5*lArBarrelHalflength);
422 
423 
424  if (lArBarrelPresamplerPosBounds){
425  lArBarrelPresamplerNegBounds = std::make_shared<Trk::CylinderVolumeBounds>(*lArBarrelPresamplerPosBounds);
426  ATH_MSG_VERBOSE( " -> Positive Barrel Presampler Bounds: "
427  << *lArBarrelPresamplerPosBounds );
428  }
429  if (lArBarrelPresamplerNegBounds){
430  ATH_MSG_VERBOSE( " -> Negative Barrel Presampler Bounds: "
431  << *lArBarrelPresamplerNegBounds );
432  }
433 
434  // material needs averaging, don't use pure Ar
435 
436 
437  // trivial binning
438  std::vector<float> bpsteps{float(lArBarrelPresamplerPosBounds->innerRadius()),
439  float(lArBarrelPresamplerPosBounds->outerRadius())};
440  auto rBU = Trk::BinUtility(bpsteps, Trk::open, Trk::binR);
441  const Trk::BinUtility& rBUc(rBU);
442 
443  std::vector<size_t> dummylay (1,0);
444  // binned material for Presampler :
445  std::vector<Trk::IdentifiedMaterial> matBP;
446  // layer material can be adjusted here
447  int baseID = Trk::GeometrySignature(Trk::Calo)*1000;
448  matBP.emplace_back(lArBarrelPresamplerMaterial,baseID);
449 
450  const Trk::BinnedMaterial lArBarrelPresamplerMaterialBinPos(*lArBarrelPresamplerMaterial,rBU,dummylay,matBP);
451  const Trk::BinnedMaterial lArBarrelPresamplerMaterialBinNeg(*lArBarrelPresamplerMaterial,rBUc,dummylay,matBP);
452 
453  auto *lArBarrelPresamplerPos = new Trk::AlignableTrackingVolume(
454  std::move(lArPBPosTransform),
455  lArBarrelPresamplerPosBounds,
456  lArBarrelPresamplerMaterialBinPos,
457  0,
458  "Calo::Detectors::LAr::BarrelPresamplerPos");
459 
460  auto *lArBarrelPresamplerNeg = new Trk::AlignableTrackingVolume(
461  std::move(lArPBNegTransform),
462  std::move(lArBarrelPresamplerNegBounds),
463  lArBarrelPresamplerMaterialBinNeg,
464  0,
465  "Calo::Detectors::LAr::BarrelPresamplerNeg");
466 
467  // glue barrel presampler
468  std::vector<Trk::TrackingVolume*> volsBP;
469  volsBP.push_back(lArBarrelPresamplerNeg);
470  volsBP.push_back(lArBarrelPresamplerPos);
471 
472  lArBarrelPresampler = m_trackingVolumeCreator->createContainerTrackingVolume(volsBP,
473  dummyMaterial,
474  "Calo::Container::LAr::BarrelPresampler");
475  }
476 
477  // (3) Build the solenoid gap ------------------------------------------------------------
478 
479  if (solenoidBounds && lArBarrelPresamplerPosBounds) {
480  solenoidLArBarrelGapBounds = std::make_shared<Trk::CylinderVolumeBounds>(solenoidBounds->outerRadius(),
481  lArBarrelPresamplerPosBounds->innerRadius(),
482  lArBarrelHalflength);
483 
484  //Trk::MaterialProperties solenoidGapMaterial = Trk::MaterialProperties(1., 93.9/0.5, 0.0028*pow(0.5,3), 39.);
485  // Trk::Material solenoidGapMaterial= Trk::Material(534.9, 2871.2, 18.6, 9.1, 0.0004);
486  Trk::Material solenoidGapMaterial= Trk::Material(182.6, 1007., 22.9, 10.9, 0.0012);
487 
488  solenoidLArBarrelGap = new Trk::TrackingVolume(nullptr,
489  std::move(solenoidLArBarrelGapBounds),
490  solenoidGapMaterial,
491  nullptr, nullptr,
492  "Calo::GapVolumes::LAr::SolenoidPresamplerGap");
493  }
494 
496  // THE ENDCAP SECTION
497  ATH_MSG_DEBUG( "============ Endcap Section ======================" );
498  // PRESAMPLER_EC_POS, PRESAMPLER_EC_NEG
499  // EMEC_POS, EMEC_NEG
500  // HEC1_POS, HEC1_NEG
501  // HEC2_POS, HEC2_NEG
502  // FCAL1_POS, FCAL1_NEG
503  // FCAL2_POS, FCAL2_NEG
504  // FCAL3_POS, FCAL3_NEG
505 
506  // positive Side
507  Trk::TrackingVolume* lArPositiveEndcapInnerGap = nullptr;
508  Trk::TrackingVolume* lArPositiveEndcap = nullptr;
509  Trk::TrackingVolume* lArPositiveHec = nullptr;
510  Trk::TrackingVolume* lArPositiveHecFcalCover = nullptr;
511  Trk::TrackingVolume* lArPositiveFcal = nullptr;
512  Trk::TrackingVolume* lArPosECPresampler = nullptr;
513 
514  // negative Side
515  Trk::TrackingVolume* lArNegativeEndcapInnerGap = nullptr;
516  Trk::TrackingVolume* lArNegativeEndcap = nullptr;
517  Trk::TrackingVolume* lArNegativeHec = nullptr;
518  Trk::TrackingVolume* lArNegativeHecFcalCover = nullptr;
519  Trk::TrackingVolume* lArNegativeFcal = nullptr;
520  Trk::TrackingVolume* lArNegECPresampler = nullptr;
521 
522  // the smoothed ones
523  std::shared_ptr<Trk::CylinderVolumeBounds> lArPositiveHecBounds = nullptr;
524  std::shared_ptr<Trk::CylinderVolumeBounds> lArPositiveHecFcalCoverBounds = nullptr;
525  std::shared_ptr<Trk::CylinderVolumeBounds> lArPositiveFcalBounds = nullptr;
526 
527  std::shared_ptr<Trk::CylinderVolumeBounds> lArNegativeHecBounds = nullptr;
528  std::shared_ptr<Trk::CylinderVolumeBounds> lArNegativeHecFcalCoverBounds = nullptr;
529  std::shared_ptr<Trk::CylinderVolumeBounds> lArNegativeFcalBounds = nullptr;
530 
531  // (1) now parse the EC
532  std::shared_ptr<Trk::CylinderVolumeBounds> lArPositiveEndcapBounds;
533  std::shared_ptr<Trk::CylinderVolumeBounds> lArNegativeEndcapBounds;
534 
535  if(detStore()->contains<StoredPhysVol>("EMEC_POS"))
536  {
537  if(detStore()->retrieve(storedPV,"EMEC_POS")==StatusCode::FAILURE)
538  {
539  ATH_MSG_DEBUG( "Unable to retrieve Stored PV EMEC_POS" );
540  storedPV = nullptr;
541  }
542  }
543  GeoFullPhysVol* lArPositiveEndcapPhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
544 
545  const GeoLogVol* lArPositiveEndcapLogVol = lArPositiveEndcapPhysVol ? lArPositiveEndcapPhysVol->getLogVol() : nullptr;
546 
547  if(detStore()->contains<StoredPhysVol>("EMEC_NEG"))
548  {
549  if(detStore()->retrieve(storedPV,"EMEC_NEG")==StatusCode::FAILURE)
550  {
551  ATH_MSG_DEBUG( "Unable to retrieve Stored PV EMEC_NEG" );
552  storedPV = nullptr;
553  }
554  }
555  GeoFullPhysVol* lArNegativeEndcapPhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
556 
557  const GeoLogVol* lArNegativeEndcapLogVol = lArNegativeEndcapPhysVol ? lArNegativeEndcapPhysVol->getLogVol() : nullptr;
558 
559  // get the material
560  const GeoMaterial* lArPositiveEndcapMaterial = nullptr;
561  //const GeoMaterial* lArNegativeEndcapMaterial = 0;
562 
563  std::vector<double> positiveEndcapZboundaries;
564  std::vector<double> negativeEndcapZboundaries;
565 
566  double lArEndcapZpos = 0.;
567 
568  // retrival worked out
569  if (lArPositiveEndcapLogVol && lArNegativeEndcapLogVol){
570 
571  int poschilds = lArPositiveEndcapPhysVol->getNChildVols();
572  int negchilds = lArNegativeEndcapPhysVol->getNChildVols();
573 
574  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume " << lArPositiveEndcapPhysVol->getAbsoluteName()
575  << " (" << poschilds << " childs)." );
576  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume " << lArNegativeEndcapPhysVol->getAbsoluteName()
577  << " (" << negchilds << " childs)." );
578 
579 
580  // and the shapes
581  const GeoShape* lArPositiveEndcapShape = lArPositiveEndcapLogVol->getShape();
582  const GeoShape* lArNegativeEndcapShape = lArNegativeEndcapLogVol->getShape();
583 
584  // get the transforms
585  const Amg::Transform3D& lArPositiveEndcapTransform = geoAlign
586  ? lArPositiveEndcapPhysVol->getCachedAbsoluteTransform(geoAlign)
587  : lArPositiveEndcapPhysVol->getAbsoluteTransform();
588  //const Amg::Transform3D& lArNegativeEndcapTransform = Amg::CLHEPTransformToEigen(lArNegativeEndcapPhysVol->getAbsoluteTransform());
589  Amg::Vector3D lArPositiveEndcapNomPosition = lArPositiveEndcapTransform.translation();
590  //Amg::Vector3D lArNegativeEndcapNomPosition = lArNegativeEndcapTransform.translation();
591 
592  // dynamic cast to 'Tubs' shape
593  const GeoPcon* lArPositiveEndcapPcon = dynamic_cast<const GeoPcon*>(lArPositiveEndcapShape);
594  if (lArPositiveEndcapPcon)
595  lArPositiveEndcapBounds = std::shared_ptr<Trk::CylinderVolumeBounds>
596  (Trk::GeoShapeConverter::convert(lArPositiveEndcapPcon,
597  positiveEndcapZboundaries));
598 
599  const GeoPcon* lArNegativeEndcapPcon = dynamic_cast<const GeoPcon*>(lArNegativeEndcapShape);
600  if (lArNegativeEndcapPcon)
601  lArNegativeEndcapBounds = std::shared_ptr<Trk::CylinderVolumeBounds>
602  (Trk::GeoShapeConverter::convert(lArNegativeEndcapPcon,
603  negativeEndcapZboundaries));
604 
605  if (lArPositiveEndcapBounds)
606  ATH_MSG_DEBUG( " -> Positive Endcap Bounds: " << *lArPositiveEndcapBounds );
607  if (lArNegativeEndcapBounds)
608  ATH_MSG_DEBUG( " -> Negative Endcap Bounds: " << *lArNegativeEndcapBounds );
609 
610  double positiveEndcapZpos = 0.5 *(positiveEndcapZboundaries[1] + positiveEndcapZboundaries[0]);
611 
612  lArEndcapZpos = positiveEndcapZpos+lArPositiveEndcapNomPosition.z();
613 
614  ATH_MSG_DEBUG( " located at z-positions " << lArEndcapZpos << " / " << -lArEndcapZpos );
615 
616  // assing the material
617  lArPositiveEndcapMaterial = lArPositiveEndcapLogVol->getMaterial();
618  //lArNegativeEndcapMaterial = lArNegativeEndcapLogVol->getMaterial();
619 
620  }
621 
622  double lArEndcapHalfZ = 0.;
623  double lArEndcapZmin = 0.;
624  double lArEndcapZmax = 0.;
625  double lArEndcapInnerRadius = 0;
626  double lArEndcapOuterRadius = 0;
627 
628  // now create the Tracking Volumes
629  if (lArPositiveEndcapBounds && lArNegativeEndcapBounds && lArPositiveEndcapMaterial){
630 
631 
632  // create the material
633  auto lArEndcapMaterial= std::make_shared<Trk::Material>(22.21, 402.2, 72.6, 30.5, 0.0039);
634 
635  lArEndcapHalfZ = lArPositiveEndcapBounds->halflengthZ();
636  lArEndcapZmin = lArEndcapZpos - lArPositiveEndcapBounds->halflengthZ();
637  lArEndcapZmax = lArEndcapZpos + lArPositiveEndcapBounds->halflengthZ();
638  lArEndcapInnerRadius = lArPositiveEndcapBounds->innerRadius();
639  lArEndcapOuterRadius = lArPositiveEndcapBounds->outerRadius();
640 
641  Amg::Vector3D lArEndcapPositionPos(0.,0.,lArEndcapZpos);
642  Amg::Vector3D lArEndcapPositionNeg(0.,0.,-lArEndcapZpos);
643  auto lArPositiveEndcapTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArEndcapPositionPos));
644  auto lArNegativeEndcapTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArEndcapPositionNeg));
645 
646  // binned material for LAr
647  auto bup = Trk::BinUtility(37,1.35,3.2,Trk::open,Trk::binEta);
648  auto bun = Trk::BinUtility(37,-3.2,-1.35,Trk::open,Trk::binEta);
649 
650  // binned material for LAr : steering in binEta
651  std::vector<Trk::IdentifiedMaterial> matEID;
652  // layer material can be adjusted here
653  int baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 4;
654  matEID.emplace_back(lArEndcapMaterial,0);
655  matEID.emplace_back(lArEndcapMaterial,baseID+1);
656  matEID.emplace_back(lArEndcapMaterial,baseID+2);
657  matEID.emplace_back(lArEndcapMaterial,baseID+3);
658  // scaled
659  matEID.emplace_back(lArEndcapMaterial->scale(1.05),baseID+1);
660  matEID.emplace_back(lArEndcapMaterial->scale(1.1),baseID+1);
661  matEID.emplace_back(lArEndcapMaterial->scale(1.15),baseID+1);
662  matEID.emplace_back(lArEndcapMaterial->scale(1.2),baseID+1);
663  matEID.emplace_back(lArEndcapMaterial->scale(1.25),baseID+1);
664  matEID.emplace_back(lArEndcapMaterial->scale(1.3),baseID+1);
665  matEID.emplace_back(lArEndcapMaterial->scale(1.35),baseID+1);
666  matEID.emplace_back(lArEndcapMaterial->scale(1.4),baseID+1);
667  matEID.emplace_back(lArEndcapMaterial->scale(1.05),baseID+2);
668  matEID.emplace_back(lArEndcapMaterial->scale(1.1),baseID+2);
669  matEID.emplace_back(lArEndcapMaterial->scale(1.15),baseID+2);
670  matEID.emplace_back(lArEndcapMaterial->scale(1.2),baseID+2);
671  matEID.emplace_back(lArEndcapMaterial->scale(1.25),baseID+2);
672  matEID.emplace_back(lArEndcapMaterial->scale(1.3),baseID+2);
673  matEID.emplace_back(lArEndcapMaterial->scale(1.35),baseID+2);
674  matEID.emplace_back(lArEndcapMaterial->scale(1.4),baseID+2);
675  matEID.emplace_back(lArEndcapMaterial->scale(1.45),baseID+2);
676  matEID.emplace_back(lArEndcapMaterial->scale(0.7),baseID+3);
677  matEID.emplace_back(lArEndcapMaterial->scale(0.75),baseID+3);
678  matEID.emplace_back(lArEndcapMaterial->scale(0.8),baseID+3);
679  matEID.emplace_back(lArEndcapMaterial->scale(0.85),baseID+3);
680  matEID.emplace_back(lArEndcapMaterial->scale(0.9),baseID+3);
681  matEID.emplace_back(lArEndcapMaterial->scale(0.95),baseID+3);
682  matEID.emplace_back(lArEndcapMaterial->scale(1.05),baseID+3);
683  matEID.emplace_back(lArEndcapMaterial->scale(1.1),baseID+3);
684  matEID.emplace_back(lArEndcapMaterial->scale(1.15),baseID+3);
685  matEID.emplace_back(lArEndcapMaterial->scale(1.2),baseID+3);
686 
687  // binned material for LAr : layer depth per eta bin
688  std::vector< Trk::BinUtility> layEUP(bup.bins());
689  // array of indices
690  std::vector<std::vector<size_t> > indexEP;
691  // retrieve offset values (positive)
692  float z1 = entrySurf[CaloCell_ID::EME1].first->center().z(); // first layer has no modulations
693  float z2 = entrySurf[CaloCell_ID::EME2].first->center().z(); // base value
694  float z3 = entrySurf[CaloCell_ID::EME3].first->center().z(); // base value
695 
696  std::vector<float> offset2;
697  const Trk::SlidingDiscSurface* sd2 = dynamic_cast<const Trk::SlidingDiscSurface* > (entrySurf[CaloCell_ID::EME2].first);
698  if (sd2) offset2 = sd2->offset();
699  std::vector<float>offset3;
700  const Trk::SlidingDiscSurface* sd3 = dynamic_cast<const Trk::SlidingDiscSurface* > (entrySurf[CaloCell_ID::EME3].first);
701  if (sd3) offset3 = sd3->offset();
702  // construct bin utilities
703  std::vector<float> steps;
704  for (unsigned int i=0; i< bup.bins(); i++) {
705  steps.clear();
706  std::vector<size_t> indx; indx.clear();
707  steps.push_back( lArEndcapZmin);
708  indx.push_back(0);
709  steps.push_back(z1);
710  if (i<4) indx.push_back(1);
711  else if (i<6) indx.push_back(4);
712  else if (i<8) indx.push_back(5);
713  else if (i<10) indx.push_back(6);
714  else if (i<12) indx.push_back(7);
715  else if (i<14) indx.push_back(8);
716  else if (i<16) indx.push_back(9);
717  else if (i<18) indx.push_back(10);
718  else if (i<23) indx.push_back(11);
719  else indx.push_back(1);
720 
721  float z2c = z2 + offset2[i];
722  if (z2c!= steps.back()) { steps.push_back(z2c); indx.push_back(2);}
723  else { indx.back()=2; }
724  if (i<4) {}
725  else if (i<6) indx.back()=12;
726  else if (i<8) indx.back()=13;
727  else if (i<10) indx.back()=14;
728  else if (i<12) indx.back()=15;
729  else if (i<14) indx.back()=16;
730  else if (i<16) indx.back()=17;
731  else if (i<18) indx.back()=18;
732  else if (i<21) indx.back()=19;
733  else if (i<23) indx.back()=20;
734  else if (i<25) indx.back()=14;
735  else if (i<27) indx.back()=15;
736  else if (i<29) indx.back()=16;
737  else if (i<31) indx.back()=17;
738  else if (i<33) indx.back()=18;
739  else if (i<35) indx.back()=19;
740  else if (i<37) indx.back()=20;
741 
742  steps.push_back(z3 + offset3[i] );
743  if (i<6) indx.push_back(21);
744  else if (i<8) indx.push_back(22);
745  else if (i<10) indx.push_back(23);
746  else if (i<12) indx.push_back(24);
747  else if (i<14) indx.push_back(25);
748  else if (i<16) indx.push_back(26);
749  else if (i<18) indx.push_back(3);
750  else if (i<20) indx.push_back(28);
751  else if (i<23) indx.push_back(29);
752  else if (i<25) indx.push_back(22);
753  else if (i<27) indx.push_back(23);
754  else if (i<29) indx.push_back(24);
755  else if (i<31) indx.push_back(26);
756  else if (i<33) indx.push_back(3);
757  else if (i<35) indx.push_back(27);
758  else indx.push_back(28);
759  steps.push_back(lArEndcapZmax);
761  layEUP[i] = zBU;
762  indexEP.push_back(indx);
763  }
764 
765  // binned material for LAr : layer depth per eta bin
766  std::vector< Trk::BinUtility> layEUN(bun.bins());
767  std::vector<std::vector<size_t> > indexEN;
768  for ( int j=indexEP.size()-1; j>-1; j--) {
769  std::vector<size_t> indx; indx.clear();
770  for ( int jj=indexEP[j].size()-1; jj>-1; jj--) {
771  indx.push_back(indexEP[j][jj]);
772  }
773  indexEN.push_back(indx);
774  }
775  // retrieve offset values (negative)
776  z1 = entrySurf[CaloCell_ID::EME1].second->center().z(); // first layer has no modulations
777  z2 = entrySurf[CaloCell_ID::EME2].second->center().z(); // base value
778  z3 = entrySurf[CaloCell_ID::EME3].second->center().z(); // base value
779 
780  offset2.clear();
781  sd2 = dynamic_cast<const Trk::SlidingDiscSurface* > (entrySurf[CaloCell_ID::EME2].second);
782  if (sd2) offset2 = sd2->offset();
783  offset3.clear();
784  sd3 = dynamic_cast<const Trk::SlidingDiscSurface* > (entrySurf[CaloCell_ID::EME3].second);
785  if (sd3) offset3 = sd3->offset();
786  // construct bin utilities ( in increasing ordering )
787  for (unsigned int i=0; i< bun.bins(); i++) {
788  steps.clear();
789  steps.push_back(-lArEndcapZmax);
790  steps.push_back(z3 + offset3[i] );
791  steps.push_back(z2 + offset2[i] );
792  if (z1!= steps.back()) { steps.push_back(z1); }
793  steps.push_back(-lArEndcapZmin);
795  layEUN[i] = zBU;
796  }
797 
798  const Trk::BinnedMaterial lArEndcapMaterialBinnedPos(*lArEndcapMaterial,bup,layEUP,indexEP,matEID);
799  const Trk::BinnedMaterial lArEndcapMaterialBinnedNeg(*lArEndcapMaterial,bun,layEUN,indexEN,matEID);
800 
801  lArPositiveEndcap = new Trk::AlignableTrackingVolume(
802  std::move(lArPositiveEndcapTransform),
803  std::move(lArPositiveEndcapBounds),
804  lArEndcapMaterialBinnedPos,
805  5,//lpEntries
806  "Calo::Detectors::LAr::PositiveEndcap");
807 
808  lArNegativeEndcap = new Trk::AlignableTrackingVolume(
809  std::move(lArNegativeEndcapTransform),
810  std::move(lArNegativeEndcapBounds),
811  lArEndcapMaterialBinnedNeg,
812  5, //lnEntries
813  "Calo::Detectors::LAr::NegativeEndcap");
814  }
815 
816  // presampler
817  ATH_MSG_DEBUG( "Building Endcap Presampler ... " );
818 
819  std::shared_ptr<Trk::CylinderVolumeBounds> lArECPresamplerBounds = nullptr;
820 
821  if(detStore()->contains<StoredPhysVol>("PRESAMPLER_EC_POS"))
822  {
823  if(detStore()->retrieve(storedPV,"PRESAMPLER_EC_POS")==StatusCode::FAILURE)
824  {
825  ATH_MSG_DEBUG( "Unable to retrieve Stored PV PRESAMPLER_EC_POS" );
826  storedPV = nullptr;
827  }
828  }
829  GeoFullPhysVol* lArECPresamplerPhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
830  // if (lArECPresamplerPhysVol) printInfo(lArECPresamplerPhysVol, geoAlign);
831 
832  const GeoLogVol* lArECPresamplerLogVol = lArECPresamplerPhysVol ? lArECPresamplerPhysVol->getLogVol() : nullptr;
833 
834  // binned material for EC Presampler : layers only
835  std::vector<Trk::IdentifiedMaterial> matECP;
836  auto mAr = std::make_shared<Trk::Material>(140., 1170./1.4, 40., 18., 0.0014);
837  auto mAl = std::make_shared<Trk::Material>(88.93, 388.8, 27., 13., 0.0027);
838 
839  // layer material can be adjusted here
840  int baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 4;
841  matECP.emplace_back(mAl,0);
842  matECP.emplace_back(mAr,baseID);
843 
844  if ( lArECPresamplerLogVol ) {
845 
846  const GeoShape* lArECPresamplerShape = lArECPresamplerLogVol->getShape();
847  const Amg::Transform3D& lArECPresamplerTransform = geoAlign
848  ? lArECPresamplerPhysVol->getCachedAbsoluteTransform(geoAlign)
849  : lArECPresamplerPhysVol->getAbsoluteTransform();
850  // dynamic cast to 'Tubs' shape
851  const GeoTubs* psTubs = dynamic_cast<const GeoTubs*>(lArECPresamplerShape);
852 
853  float d = psTubs->getZHalfLength();
854  // presampler is embedded in 65 mm of Alu
855  float ecd = 32.5 ;
856  // the new HepTransforms
857  float zec = lArECPresamplerTransform.translation().z()-ecd+d;
858  Amg::Vector3D lArECPresamplerPos(0.,0.,zec);
859  Amg::Vector3D lArECPresamplerNeg(0.,0.,-zec);
860  auto lArPosECPresamplerTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArECPresamplerPos));
861  auto lArNegECPresamplerTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArECPresamplerNeg));
862 
863  lArECPresamplerBounds = std::make_shared<Trk::CylinderVolumeBounds>(psTubs->getRMin(),psTubs->getRMax(),ecd);
864 
865  // layer binning in Z
866  std::vector<float> ecp;
867  ecp.push_back( zec-ecd);
868  ecp.push_back( zec+ecd-2*d);
869  ecp.push_back( zec+ecd);
870  auto hecp = Trk::BinUtility(ecp,Trk::open,Trk::binZ);
871 
872  // material index
873  std::vector<size_t> iep{0,1};
874 
875  // binned material
876  const Trk::BinnedMaterial lArECPresamplerMaterialBinPos(*lArBarrelPresamplerMaterial,hecp,iep,matECP);
877 
878 
879  lArPosECPresampler = new Trk::AlignableTrackingVolume(
880  std::move(lArPosECPresamplerTransform),
881  std::make_shared<Trk::CylinderVolumeBounds>(*lArECPresamplerBounds),
882  lArECPresamplerMaterialBinPos,
883  4,
884  "Calo::Detectors::LAr::PositiveECPresampler");
885 
886  // layer binning in Z
887  std::vector<float> ecpn;
888  ecpn.push_back(-zec-ecd);
889  ecpn.push_back(-zec-ecd+2*d);
890  ecpn.push_back(-zec+ecd);
891  auto hecpn = Trk::BinUtility(ecpn,Trk::open,Trk::binZ);
892 
893  // material index
894  std::vector<size_t> ien{1,0};
895 
896  // binned material
897  const Trk::BinnedMaterial lArECPresamplerMaterialBinNeg(*lArBarrelPresamplerMaterial,hecpn,ien,matECP);
898 
899  lArNegECPresampler = new Trk::AlignableTrackingVolume(
900  std::move(lArNegECPresamplerTransform),
901  std::move(lArECPresamplerBounds),
902  lArECPresamplerMaterialBinNeg,
903  4,
904  "Calo::Detectors::LAr::NegativeECPresampler");
905 
906 
907  }
908 
909  // (2) now parse the HEC
910  std::shared_ptr<Trk::CylinderVolumeBounds> lArPositiveHec1Bounds = nullptr;
911  std::shared_ptr<Trk::CylinderVolumeBounds> lArPositiveHec2Bounds = nullptr;
912  std::shared_ptr<Trk::CylinderVolumeBounds> lArNegativeHec1Bounds = nullptr;
913  std::shared_ptr<Trk::CylinderVolumeBounds> lArNegativeHec2Bounds = nullptr;
914 
915 
916  if(detStore()->contains<StoredPhysVol>("HEC1_POS")){
917 
918  if(detStore()->retrieve(storedPV,"HEC1_POS")==StatusCode::FAILURE){
919  ATH_MSG_DEBUG( "Unable to retrieve Stored PV HEC1_POS" );
920  storedPV = nullptr;
921  }
922 
923  }
924  GeoFullPhysVol* lArPositiveHec1PhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
925 
926  if(detStore()->contains<StoredPhysVol>("HEC2_POS")){
927 
928  if(detStore()->retrieve(storedPV,"HEC2_POS")==StatusCode::FAILURE){
929  ATH_MSG_DEBUG( "Unable to retrieve Stored PV HEC2_POS" );
930  storedPV = nullptr;
931  }
932 
933  }
934  GeoFullPhysVol* lArPositiveHec2PhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
935 
936  if(detStore()->contains<StoredPhysVol>("HEC1_NEG")){
937 
938  if(detStore()->retrieve(storedPV,"HEC1_NEG")==StatusCode::FAILURE){
939  ATH_MSG_DEBUG( "Unable to retrieve Stored PV HEC1_NEG" );
940  storedPV = nullptr;
941  }
942 
943  }
944  GeoFullPhysVol* lArNegativeHec1PhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
945 
946  if(detStore()->contains<StoredPhysVol>("HEC2_NEG")){
947 
948  if(detStore()->retrieve(storedPV,"HEC2_NEG")==StatusCode::FAILURE){
949  ATH_MSG_DEBUG("Unable to retrieve Stored PV HEC2_NEG" );
950  storedPV = nullptr;
951  }
952 
953  }
954 
955  GeoFullPhysVol* lArNegativeHec2PhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
956 
957  const GeoLogVol* lArPositiveHec1LogVol = lArPositiveHec1PhysVol ? lArPositiveHec1PhysVol->getLogVol() : nullptr;
958  const GeoLogVol* lArPositiveHec2LogVol = lArPositiveHec2PhysVol ? lArPositiveHec2PhysVol->getLogVol() : nullptr;
959  const GeoLogVol* lArNegativeHec1LogVol = lArNegativeHec1PhysVol ? lArNegativeHec1PhysVol->getLogVol() : nullptr;
960  const GeoLogVol* lArNegativeHec2LogVol = lArNegativeHec2PhysVol ? lArNegativeHec2PhysVol->getLogVol() : nullptr;
961 
962  std::vector<double> positiveEndcapZboundariesHec1;
963  std::vector<double> positiveEndcapZboundariesHec2;
964  std::vector<double> negativeEndcapZboundariesHec1;
965  std::vector<double> negativeEndcapZboundariesHec2;
966  double hecEnd = 0;
967 
968  // retrival worked out
969  if (lArPositiveHec1LogVol && lArPositiveHec2LogVol && lArNegativeHec1LogVol && lArNegativeHec2LogVol){
970 
971  int poschildsHec1 = lArPositiveHec1PhysVol->getNChildVols();
972  int poschildsHec2 = lArPositiveHec2PhysVol->getNChildVols();
973  int negchildsHec1 = lArNegativeHec1PhysVol->getNChildVols();
974  int negchildsHec2 = lArNegativeHec2PhysVol->getNChildVols();
975 
976  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume " << lArPositiveHec1PhysVol->getAbsoluteName()
977  << " (" << poschildsHec1 << " childs) ." );
978  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume " << lArNegativeHec2PhysVol->getAbsoluteName()
979  << " (" << poschildsHec2 << " childs) ." );
980  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume " << lArPositiveHec1PhysVol->getAbsoluteName()
981  << " (" << negchildsHec1 << " childs) ." );
982  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume " << lArNegativeHec2PhysVol->getAbsoluteName()
983  << " (" << negchildsHec2 << " childs) ." );
984 
985  // and the shapes
986  const GeoShape* lArPositiveHec1Shape = lArPositiveHec1LogVol->getShape();
987  const GeoShape* lArPositiveHec2Shape = lArPositiveHec2LogVol->getShape();
988  const GeoShape* lArNegativeHec1Shape = lArNegativeHec1LogVol->getShape();
989  const GeoShape* lArNegativeHec2Shape = lArNegativeHec2LogVol->getShape();
990 
991  // get the transforms
992  const Amg::Transform3D& lArPositiveHec1Transform = geoAlign
993  ? lArPositiveHec1PhysVol->getCachedAbsoluteTransform(geoAlign)
994  : lArPositiveHec1PhysVol->getAbsoluteTransform();
995  const Amg::Transform3D& lArPositiveHec2Transform = geoAlign
996  ? lArPositiveHec2PhysVol->getCachedAbsoluteTransform(geoAlign)
997  : lArPositiveHec2PhysVol->getAbsoluteTransform();
998  const Amg::Transform3D& lArNegativeHec1Transform = geoAlign
999  ? lArNegativeHec1PhysVol->getCachedAbsoluteTransform(geoAlign)
1000  : lArNegativeHec1PhysVol->getAbsoluteTransform();
1001  const Amg::Transform3D& lArNegativeHec2Transform = geoAlign
1002  ? lArNegativeHec2PhysVol->getCachedAbsoluteTransform(geoAlign)
1003  : lArNegativeHec2PhysVol->getAbsoluteTransform();
1004 
1005  Amg::Vector3D lArPositiveHec1NomPosition = lArPositiveHec1Transform.translation();
1006  Amg::Vector3D lArPositiveHec2NomPosition = lArPositiveHec2Transform.translation();
1007  Amg::Vector3D lArNegativeHec1NomPosition = lArNegativeHec1Transform.translation();
1008  Amg::Vector3D lArNegativeHec2NomPosition = lArNegativeHec2Transform.translation();
1009 
1010  // dynamic cast to 'Pcon' shape
1011  const GeoPcon* lArPositiveHec1Pcon = dynamic_cast<const GeoPcon*>(lArPositiveHec1Shape);
1012  lArPositiveHec1Bounds = (lArPositiveHec1Pcon) ? Trk::GeoShapeConverter::convert(lArPositiveHec1Pcon,
1013  positiveEndcapZboundariesHec1) : nullptr;
1014  const GeoPcon* lArPositiveHec2Pcon = dynamic_cast<const GeoPcon*>(lArPositiveHec2Shape);
1015  lArPositiveHec2Bounds = (lArPositiveHec2Pcon) ? Trk::GeoShapeConverter::convert(lArPositiveHec2Pcon,
1016  positiveEndcapZboundariesHec2) : nullptr;
1017  const GeoPcon* lArNegativeHec1Pcon = dynamic_cast<const GeoPcon*>(lArNegativeHec1Shape);
1018  lArNegativeHec1Bounds = (lArNegativeHec1Pcon) ? Trk::GeoShapeConverter::convert(lArNegativeHec1Pcon,
1019  negativeEndcapZboundariesHec1) : nullptr;
1020  const GeoPcon* lArNegativeHec2Pcon = dynamic_cast<const GeoPcon*>(lArNegativeHec2Shape);
1021  lArNegativeHec2Bounds = (lArNegativeHec2Pcon) ? Trk::GeoShapeConverter::convert(lArNegativeHec2Pcon,
1022  negativeEndcapZboundariesHec2) : nullptr;
1023 
1024  if (lArPositiveHec1Bounds)
1025  ATH_MSG_VERBOSE( " -> Positive Hec1 Bounds: " << *lArPositiveHec1Bounds );
1026  if (lArPositiveHec2Bounds)
1027  ATH_MSG_VERBOSE( " -> Positive Hec2 Bounds: " << *lArPositiveHec2Bounds );
1028 
1029  if (lArNegativeHec1Bounds)
1030  ATH_MSG_VERBOSE( " -> Negative Hec1 Bounds: " << *lArNegativeHec1Bounds );
1031  if (lArNegativeHec2Bounds)
1032  ATH_MSG_VERBOSE( " -> Negative Hec2 Bounds: " << *lArNegativeHec2Bounds );
1033 
1034 
1035  double positiveHec1Zpos = 0.5 *(positiveEndcapZboundariesHec1[1] + positiveEndcapZboundariesHec1[0]);
1036  double positiveHec2Zpos = 0.5 *(positiveEndcapZboundariesHec2[1] + positiveEndcapZboundariesHec2[0]);
1037  double negativeHec1Zpos = -fabs(0.5 *(negativeEndcapZboundariesHec1[1] + negativeEndcapZboundariesHec1[0]));
1038  double negativeHec2Zpos = -fabs(0.5 *(negativeEndcapZboundariesHec2[1] + negativeEndcapZboundariesHec2[0]));
1039 
1040  ATH_MSG_VERBOSE( " Positive parts located at: " << positiveHec1Zpos + lArPositiveHec1NomPosition.z()
1041  << " / " << positiveHec2Zpos + lArPositiveHec2NomPosition.z() );
1042 
1043  ATH_MSG_VERBOSE( " Negative parts located at: " << negativeHec1Zpos + lArNegativeHec1NomPosition.z()
1044  << " / " << negativeHec2Zpos + lArNegativeHec2NomPosition.z() );
1045 
1046  }
1047 
1048  // (3) Browser the FCAL, we construct some things
1049  // from HEC numbers, but we need the radius to build the HEC too
1050  // So we browse the FCAL before building the HEC
1051  // We will build both later
1052  // FCAL1_POS, FCAL1_NEG
1053  // FCAL2_POS, FCAL2_NEG
1054  // FCAL3_POS, FCAL3_NEG
1055  std::shared_ptr<Trk::CylinderVolumeBounds> lArPositiveFcal1Bounds = nullptr;
1056  std::shared_ptr<Trk::CylinderVolumeBounds> lArPositiveFcal2Bounds = nullptr;
1057  std::shared_ptr<Trk::CylinderVolumeBounds> lArPositiveFcal3Bounds = nullptr;
1058 
1059 
1060  std::shared_ptr<Trk::CylinderVolumeBounds> lArNegativeFcal1Bounds = nullptr;
1061  std::shared_ptr<Trk::CylinderVolumeBounds> lArNegativeFcal2Bounds = nullptr;
1062  std::shared_ptr<Trk::CylinderVolumeBounds> lArNegativeFcal3Bounds = nullptr;
1063 
1064  if(detStore()->contains<StoredPhysVol>("FCAL1_POS"))
1065  {
1066  if(detStore()->retrieve(storedPV,"FCAL1_POS")==StatusCode::FAILURE)
1067  {
1068  ATH_MSG_DEBUG( "Unable to retrieve Stored PV FCAL1_POS" );
1069  storedPV = nullptr;
1070  }
1071  }
1072  GeoFullPhysVol* lArPositiveFcal1PhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
1073 
1074  if(detStore()->contains<StoredPhysVol>("FCAL2_POS"))
1075  {
1076  if(detStore()->retrieve(storedPV,"FCAL2_POS")==StatusCode::FAILURE)
1077  {
1078  ATH_MSG_DEBUG( "Unable to retrieve Stored PV FCAL2_POS" );
1079  storedPV = nullptr;
1080  }
1081  }
1082  GeoFullPhysVol* lArPositiveFcal2PhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
1083 
1084 
1085  if(detStore()->contains<StoredPhysVol>("FCAL3_POS"))
1086  {
1087  if(detStore()->retrieve(storedPV,"FCAL3_POS")==StatusCode::FAILURE)
1088  {
1089  ATH_MSG_DEBUG( "Unable to retrieve Stored PV FCAL3_POS" );
1090  storedPV = nullptr;
1091  }
1092  }
1093  GeoFullPhysVol* lArPositiveFcal3PhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
1094 
1095  if(detStore()->contains<StoredPhysVol>("FCAL1_NEG"))
1096  {
1097  if(detStore()->retrieve(storedPV,"FCAL1_NEG")==StatusCode::FAILURE)
1098  {
1099  ATH_MSG_DEBUG( "Unable to retrieve Stored PV FCAL1_NEG" );
1100  storedPV = nullptr;
1101  }
1102  }
1103  GeoFullPhysVol* lArNegativeFcal1PhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
1104 
1105  if(detStore()->contains<StoredPhysVol>("FCAL2_NEG"))
1106  {
1107  if(detStore()->retrieve(storedPV,"FCAL2_NEG")==StatusCode::FAILURE)
1108  {
1109  ATH_MSG_DEBUG( "Unable to retrieve Stored PV FCAL2_NEG" );
1110  storedPV = nullptr;
1111  }
1112  }
1113  GeoFullPhysVol* lArNegativeFcal2PhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
1114 
1115  if(detStore()->contains<StoredPhysVol>("FCAL3_NEG"))
1116  {
1117  if(detStore()->retrieve(storedPV,"FCAL3_NEG")==StatusCode::FAILURE)
1118  {
1119  ATH_MSG_DEBUG( "Unable to retrieve Stored PV FCAL3_NEG" );
1120  storedPV = nullptr;
1121  }
1122  }
1123  GeoFullPhysVol* lArNegativeFcal3PhysVol = storedPV ? storedPV->getPhysVol() : nullptr;
1124 
1125  const GeoLogVol* lArPositiveFcal1LogVol = lArPositiveFcal1PhysVol ? lArPositiveFcal1PhysVol->getLogVol() : nullptr;
1126  const GeoLogVol* lArPositiveFcal2LogVol = lArPositiveFcal2PhysVol ? lArPositiveFcal2PhysVol->getLogVol() : nullptr;
1127  const GeoLogVol* lArPositiveFcal3LogVol = lArPositiveFcal3PhysVol ? lArPositiveFcal3PhysVol->getLogVol() : nullptr;
1128 
1129  const GeoLogVol* lArNegativeFcal1LogVol = lArNegativeFcal1PhysVol ? lArNegativeFcal1PhysVol->getLogVol() : nullptr;
1130  const GeoLogVol* lArNegativeFcal2LogVol = lArNegativeFcal2PhysVol ? lArNegativeFcal2PhysVol->getLogVol() : nullptr;
1131  const GeoLogVol* lArNegativeFcal3LogVol = lArNegativeFcal3PhysVol ? lArNegativeFcal3PhysVol->getLogVol() : nullptr;
1132 
1133  // z position - force to be symmetric
1134  double lArFcalHalflength = 0.;
1135  double lArFcalZposition = 0.;
1136  double lArFcalZmin = 0.;
1137  double lArFcalZmax = 0.;
1138 
1139  // retrival worked out
1140  if (lArPositiveFcal1LogVol &&
1141  lArPositiveFcal2LogVol &&
1142  lArPositiveFcal3LogVol &&
1143  lArNegativeFcal1LogVol &&
1144  lArNegativeFcal2LogVol &&
1145  lArNegativeFcal3LogVol){
1146 
1147  int poschildsFcal1 = lArPositiveFcal1PhysVol->getNChildVols();
1148  int poschildsFcal2 = lArPositiveFcal2PhysVol->getNChildVols();
1149  int poschildsFcal3 = lArPositiveFcal3PhysVol->getNChildVols();
1150 
1151  int negchildsFcal1 = lArNegativeFcal1PhysVol->getNChildVols();
1152  int negchildsFcal2 = lArNegativeFcal2PhysVol->getNChildVols();
1153  int negchildsFcal3 = lArNegativeFcal3PhysVol->getNChildVols();
1154 
1155 
1156  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume " << lArPositiveFcal1PhysVol->getAbsoluteName()
1157  << " (" << poschildsFcal1 << " childs) ." );
1158  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume " << lArPositiveFcal2PhysVol->getAbsoluteName()
1159  << " (" << poschildsFcal2 << " childs) ." );
1160  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume " << lArPositiveFcal3PhysVol->getAbsoluteName()
1161  << " (" << poschildsFcal3 << " childs) ." );
1162 
1163  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume " << lArNegativeFcal1PhysVol->getAbsoluteName()
1164  << " (" << negchildsFcal1 << " childs) ." );
1165  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume " << lArNegativeFcal2PhysVol->getAbsoluteName()
1166  << " (" << negchildsFcal2 << " childs) ." );
1167  ATH_MSG_VERBOSE( " -> Retrieved GeoModel Volume " << lArNegativeFcal3PhysVol->getAbsoluteName()
1168  << " (" << negchildsFcal3 << " childs) ." );
1169 
1170  // and the shapes
1171  const GeoShape* lArPositiveFcal1Shape = lArPositiveFcal1LogVol->getShape();
1172  const GeoShape* lArPositiveFcal2Shape = lArPositiveFcal2LogVol->getShape();
1173  const GeoShape* lArPositiveFcal3Shape = lArPositiveFcal3LogVol->getShape();
1174 
1175  const GeoShape* lArNegativeFcal1Shape = lArNegativeFcal1LogVol->getShape();
1176  const GeoShape* lArNegativeFcal2Shape = lArNegativeFcal2LogVol->getShape();
1177  const GeoShape* lArNegativeFcal3Shape = lArNegativeFcal3LogVol->getShape();
1178 
1179 
1180  // get the transforms
1181  const Amg::Transform3D& lArPositiveFcal1Transform = geoAlign
1182  ? lArPositiveFcal1PhysVol->getCachedAbsoluteTransform(geoAlign)
1183  : lArPositiveFcal1PhysVol->getAbsoluteTransform();
1184  const Amg::Transform3D& lArPositiveFcal2Transform = geoAlign
1185  ? lArPositiveFcal2PhysVol->getCachedAbsoluteTransform(geoAlign)
1186  : lArPositiveFcal2PhysVol->getAbsoluteTransform();
1187  const Amg::Transform3D& lArPositiveFcal3Transform = geoAlign
1188  ? lArPositiveFcal3PhysVol->getCachedAbsoluteTransform(geoAlign)
1189  : lArPositiveFcal3PhysVol->getAbsoluteTransform();
1190 
1191  const Amg::Transform3D& lArNegativeFcal1Transform = geoAlign
1192  ? lArNegativeFcal1PhysVol->getCachedAbsoluteTransform(geoAlign)
1193  : lArNegativeFcal1PhysVol->getAbsoluteTransform();
1194  const Amg::Transform3D& lArNegativeFcal2Transform = geoAlign
1195  ? lArNegativeFcal2PhysVol->getCachedAbsoluteTransform(geoAlign)
1196  : lArNegativeFcal2PhysVol->getAbsoluteTransform();
1197  const Amg::Transform3D& lArNegativeFcal3Transform = geoAlign
1198  ? lArNegativeFcal3PhysVol->getCachedAbsoluteTransform(geoAlign)
1199  : lArNegativeFcal3PhysVol->getAbsoluteTransform();
1200 
1201  Amg::Vector3D lArPositiveFcal1NomPosition = lArPositiveFcal1Transform.translation();
1202  Amg::Vector3D lArPositiveFcal2NomPosition = lArPositiveFcal2Transform.translation();
1203  Amg::Vector3D lArPositiveFcal3NomPosition = lArPositiveFcal3Transform.translation();
1204 
1205  Amg::Vector3D lArNegativeFcal1NomPosition = lArNegativeFcal1Transform.translation();
1206  Amg::Vector3D lArNegativeFcal2NomPosition = lArNegativeFcal2Transform.translation();
1207  Amg::Vector3D lArNegativeFcal3NomPosition = lArNegativeFcal3Transform.translation();
1208 
1209  // dynamic cast to 'Pcon' shape
1210  const GeoTubs* lArPositiveFcal1Tubs = dynamic_cast<const GeoTubs*>(lArPositiveFcal1Shape);
1211  lArPositiveFcal1Bounds = (lArPositiveFcal1Tubs) ? Trk::GeoShapeConverter::convert(lArPositiveFcal1Tubs) : nullptr;
1212  const GeoTubs* lArPositiveFcal2Tubs = dynamic_cast<const GeoTubs*>(lArPositiveFcal2Shape);
1213  lArPositiveFcal2Bounds = (lArPositiveFcal2Tubs) ? Trk::GeoShapeConverter::convert(lArPositiveFcal2Tubs) : nullptr;
1214  const GeoTubs* lArPositiveFcal3Tubs = dynamic_cast<const GeoTubs*>(lArPositiveFcal3Shape);
1215  lArPositiveFcal3Bounds = (lArPositiveFcal3Tubs) ? Trk::GeoShapeConverter::convert(lArPositiveFcal3Tubs) : nullptr;
1216 
1217  const GeoTubs* lArNegativeFcal1Tubs = dynamic_cast<const GeoTubs*>(lArNegativeFcal1Shape);
1218  lArNegativeFcal1Bounds = (lArNegativeFcal1Tubs) ? Trk::GeoShapeConverter::convert(lArNegativeFcal1Tubs) : nullptr;
1219  const GeoTubs* lArNegativeFcal2Tubs = dynamic_cast<const GeoTubs*>(lArNegativeFcal2Shape);
1220  lArNegativeFcal2Bounds = (lArNegativeFcal2Tubs) ? Trk::GeoShapeConverter::convert(lArNegativeFcal2Tubs) : nullptr;
1221  const GeoTubs* lArNegativeFcal3Tubs = dynamic_cast<const GeoTubs*>(lArNegativeFcal3Shape);
1222  lArNegativeFcal3Bounds = (lArNegativeFcal3Tubs) ? Trk::GeoShapeConverter::convert(lArNegativeFcal3Tubs) : nullptr;
1223 
1224  if (lArPositiveFcal1Bounds)
1225  ATH_MSG_VERBOSE( " -> Positive Fcal1 Bounds: " << *lArPositiveFcal1Bounds );
1226  if (lArPositiveFcal2Bounds)
1227  ATH_MSG_VERBOSE( " -> Positive Fcal2 Bounds: " << *lArPositiveFcal2Bounds );
1228  if (lArPositiveFcal3Bounds)
1229  ATH_MSG_VERBOSE( " -> Positive Fcal3 Bounds: " << *lArPositiveFcal3Bounds );
1230 
1231 
1232  if (lArNegativeFcal1Bounds)
1233  ATH_MSG_VERBOSE( " -> Negative Fcal1 Bounds: " << *lArNegativeFcal1Bounds );
1234  if (lArNegativeFcal2Bounds)
1235  ATH_MSG_VERBOSE( " -> Negative Fcal2 Bounds: " << *lArNegativeFcal2Bounds );
1236  if (lArNegativeFcal3Bounds)
1237  ATH_MSG_VERBOSE( " -> Negative Fcal3 Bounds: " << *lArNegativeFcal3Bounds );
1238 
1239 
1240  ATH_MSG_VERBOSE( " Positive parts located at: " << lArPositiveFcal1NomPosition.z()
1241  << " / " << lArPositiveFcal2NomPosition.z() << " / " << lArPositiveFcal3NomPosition.z() );
1242 
1243  ATH_MSG_VERBOSE( " Negative parts located at: " << lArNegativeFcal1NomPosition.z()
1244  << " / " << lArNegativeFcal2NomPosition.z() << " / " << lArNegativeFcal3NomPosition.z() );
1245 
1246  // construct the halflength
1247  // this is actual halflength
1248  // will change to include the cover, but this is left here for future use
1249  lArFcalHalflength = lArPositiveFcal3NomPosition.z() + lArPositiveFcal3Bounds->halflengthZ()
1250  - lArPositiveFcal1NomPosition.z() + lArNegativeFcal1Bounds->halflengthZ();
1251 
1252  lArFcalHalflength *= 0.5;
1253  // construct the z-Position
1254  // this is actual z-Position
1255  // will change to include the cover, but this is left here for future use
1256  lArFcalZposition = lArPositiveFcal3NomPosition.z() + lArPositiveFcal3Bounds->halflengthZ();
1257  lArFcalZposition += lArPositiveFcal1NomPosition.z() - lArNegativeFcal1Bounds->halflengthZ();
1258  lArFcalZposition *= 0.5;
1259  }
1260 
1261  //Building section, we start with the HEC
1262 
1263  // get position and halflength of the Fill-In-Hec
1264  // First HEC, if we do not use calo surface builder will go
1265  // up to sensitive FCAL (too long)
1266  double lArHecZmax = lArFcalZposition - lArFcalHalflength;
1267  double lArHecZmin = 0;
1268  if (lArPositiveEndcap && lArEndcapHalfZ != 0)
1269  lArHecZmin = lArPositiveEndcap->center().z() + lArEndcapHalfZ;
1270  else
1271  ATH_MSG_ERROR("lArPositiveEndcap/Bounds is null!");
1272 
1273  //small offset between caloSurfaceBuilder and GeoModel
1274  double caloSurfZOffset = 0;
1275 
1276  if(m_useCaloSurfBuilder){
1277 
1278  double z;
1279  double rmin;
1280  double rmax;
1281  double hphi;
1282  double depth;
1284  m_calosurf->get_disk_surface(CaloCell_ID::HEC0, 1, pos, z, rmin, rmax, hphi, depth, &caloDDM);
1285  caloSurfZOffset = lArHecZmin - z;
1286  lArHecZmax = z + depth + caloSurfZOffset;
1287  m_calosurf->get_disk_surface(CaloCell_ID::HEC3, 1, pos, z, rmin, rmax, hphi, depth, &caloDDM);
1288  hecEnd = z + depth + caloSurfZOffset;
1289  }
1290 
1291  // that creates a position
1292  double lArHecZpos = 0.5*(lArHecZmax + lArHecZmin);
1293  double lArHecHalflength = 0.5*(lArHecZmax - lArHecZmin);
1294 
1295  double hecFcalCoverHalflength = 0.5*(hecEnd - lArHecZmax);
1296  double hecFcalCoverZpos = 0.5*(lArHecZmax + hecEnd);
1297 
1298  lArFcalHalflength = hecFcalCoverHalflength;
1299  lArFcalZposition = hecFcalCoverZpos;
1300 
1301  // binned material for HEC : layers only
1302  std::vector<Trk::IdentifiedMaterial> matHEC;
1303  auto lArHecFcalCoverMaterial= std::make_shared<Trk::Material>(18.4, 201.9, 57.2, 26.1, 0.0071);
1304  auto lArHecMaterial = std::make_shared<Trk::Material>(19., 224.4, 56.7, 25.8, 0.007);
1305 
1306  // layer material can be adjusted here
1307  baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 8;
1308  matHEC.emplace_back(lArHecFcalCoverMaterial->scale(0.13*m_scale_HECmaterial),0);
1309  matHEC.emplace_back(lArHecMaterial->scale(m_scale_HECmaterial),baseID);
1310  matHEC.emplace_back(lArHecFcalCoverMaterial->scale(0.93*m_scale_HECmaterial),baseID+1);
1311  matHEC.emplace_back(lArHecFcalCoverMaterial->scale(1.09*m_scale_HECmaterial),baseID+2);
1312  matHEC.emplace_back(lArHecFcalCoverMaterial->scale(1.12*m_scale_HECmaterial),baseID+3);
1313 
1314  // divide the HEC into two parts per EC :
1315  // - fit one around the FCAL - and adopt to LAr Endcap outer radius
1316  if (lArPositiveFcal1Bounds && lArNegativeFcal1Bounds){
1317  // cleanup the HecBounds
1318 
1319  // adopt the boundaries
1320  lArPositiveHecFcalCoverBounds = std::make_shared<Trk::CylinderVolumeBounds>(lArPositiveFcal1Bounds->outerRadius(),
1321  lArEndcapOuterRadius,
1322  hecFcalCoverHalflength);
1323 
1324  lArNegativeHecFcalCoverBounds = std::make_shared<Trk::CylinderVolumeBounds>(*lArPositiveHecFcalCoverBounds);
1325  // output
1326  ATH_MSG_DEBUG( "Smoothed LAr Hec (Fcal covering part) bounds : " << *lArPositiveHecFcalCoverBounds );
1327  ATH_MSG_DEBUG( " -> at z-position: +/- " << hecFcalCoverZpos );
1328 
1329  // the new HepTransforms
1330  Amg::Vector3D lArPositiveHecFcalCoverPos(0.,0.,hecFcalCoverZpos);
1331  Amg::Vector3D lArPositiveHecFcalCoverNeg(0.,0.,-hecFcalCoverZpos);
1332  auto lArPositiveHecFcalCoverTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArPositiveHecFcalCoverPos));
1333  auto lArNegativeHecFcalCoverTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArPositiveHecFcalCoverNeg));
1334 
1335 
1336  // layer binning in Z
1337  std::vector<float> spCover;
1338  spCover.push_back(hecFcalCoverZpos-hecFcalCoverHalflength);
1339  spCover.push_back(entrySurf[CaloCell_ID::HEC1].first->center().z());
1340  spCover.push_back(entrySurf[CaloCell_ID::HEC2].first->center().z());
1341  spCover.push_back(entrySurf[CaloCell_ID::HEC3].first->center().z());
1342  spCover.push_back(hecFcalCoverZpos+hecFcalCoverHalflength);
1343  auto hfp = Trk::BinUtility(spCover,Trk::open,Trk::binZ);
1344 
1345  // material index
1346  std::vector<size_t> hfc{0,2,3,4};
1347 
1348  // binned material
1349  const Trk::BinnedMaterial lArHecFcalCoverMaterialBinPos(*lArHecFcalCoverMaterial,hfp,hfc,matHEC);
1350 
1351  lArPositiveHecFcalCover = new Trk::AlignableTrackingVolume(
1352  std::move(lArPositiveHecFcalCoverTransform),
1353  std::move(lArPositiveHecFcalCoverBounds),
1354  lArHecFcalCoverMaterialBinPos,
1355  9,
1356  //hpEntries,
1357  "Calo::Detectors::LAr::PositiveHecFcalCover");
1358  // layer binning in Z
1359  std::vector<float> snCover;
1360  snCover.push_back(-hecFcalCoverZpos-hecFcalCoverHalflength);
1361  snCover.push_back(entrySurf[CaloCell_ID::HEC3].second->center().z());
1362  snCover.push_back(entrySurf[CaloCell_ID::HEC2].second->center().z());
1363  snCover.push_back(entrySurf[CaloCell_ID::HEC1].second->center().z());
1364  snCover.push_back(-hecFcalCoverZpos+hecFcalCoverHalflength);
1365  auto hfn = Trk::BinUtility(snCover,Trk::open,Trk::binZ);
1366 
1367  // material index
1368  std::vector<size_t> hfcn{4,3,2,0};
1369 
1370  // binned material
1371  const Trk::BinnedMaterial lArHecFcalCoverMaterialBinNeg(*lArHecFcalCoverMaterial,hfn,hfcn,matHEC);
1372 
1373  lArNegativeHecFcalCover = new Trk::AlignableTrackingVolume(
1374  std::move(lArNegativeHecFcalCoverTransform),
1375  std::move(lArNegativeHecFcalCoverBounds),
1376  lArHecFcalCoverMaterialBinNeg,
1377  9,
1378  //hnEntries,
1379  "Calo::Detectors::LAr::NegativeHecFcalCover");
1380  }
1381 
1382 
1383  // the second part of the HEC between LAr Endcap and FCAL/HEC cover
1384  if (lArPositiveFcal1Bounds && lArEndcapOuterRadius != 0){
1385 
1386  // get the inner radius
1387  // ST Hec lower radius moved up
1388  double lArHecRmin = 0.5*(lArPositiveFcal1Bounds->outerRadius()+lArEndcapInnerRadius);
1389  double lArHecRmax = lArEndcapOuterRadius;
1390  Amg::Vector3D lArHecZposition(0.,0.,lArHecZpos);
1391  // bounds
1392  lArPositiveHecBounds = std::make_shared<Trk::CylinderVolumeBounds>(lArHecRmin, lArHecRmax, lArHecHalflength);
1393  lArNegativeHecBounds = std::make_shared<Trk::CylinderVolumeBounds>(*lArPositiveHecBounds);
1394  // output
1395  ATH_MSG_DEBUG( "Smoothed LAr Hec bounds : " << *lArPositiveHecBounds );
1396  ATH_MSG_DEBUG( " -> at z-position: +/- " << lArHecZpos );
1397 
1398  // the new HepTransforms
1399  Amg::Vector3D lArPositiveHecPos(0.,0.,lArHecZpos);
1400  Amg::Vector3D lArPositiveHecNeg(0.,0.,-lArHecZpos);
1401  auto lArPositiveHecTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArPositiveHecPos));
1402  auto lArNegativeHecTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArPositiveHecNeg));
1403 
1404 
1405  // layer binning in Z
1406  std::vector<float> sphec;
1407  sphec.push_back(lArHecZpos-lArHecHalflength);
1408  sphec.push_back(entrySurf[CaloCell_ID::HEC0].first->center().z());
1409  sphec.push_back(lArHecZpos+lArHecHalflength);
1410  auto hp = Trk::BinUtility(sphec,Trk::open,Trk::binZ);
1411 
1412  // material index
1413  std::vector<size_t> hf{0,1};
1414 
1415  // binned material
1416  const Trk::BinnedMaterial lArHecMaterialBinPos(*lArHecMaterial,hp,hf,matHEC);
1417 
1418  lArPositiveHec = new Trk::AlignableTrackingVolume(
1419  std::move(lArPositiveHecTransform),
1420  std::move(lArPositiveHecBounds),
1421  lArHecMaterialBinPos,
1422  8,
1423  //hpEntries,
1424  "Calo::Detectors::LAr::PositiveHec");
1425 
1426  // layer binning in Z
1427  std::vector<float> snhec;
1428  snhec.push_back(-lArHecZpos-lArHecHalflength);
1429  snhec.push_back(entrySurf[CaloCell_ID::HEC0].second->center().z());
1430  snhec.push_back(-lArHecZpos+lArHecHalflength);
1431  auto hn = Trk::BinUtility(snhec,Trk::open,Trk::binZ);
1432 
1433  // material index
1434  std::vector<size_t> hfn{1,0};
1435 
1436  // binned material
1437  const Trk::BinnedMaterial lArHecMaterialBinNeg(*lArHecMaterial,hn,hfn,matHEC);
1438 
1439  lArNegativeHec = new Trk::AlignableTrackingVolume(
1440  std::move(lArNegativeHecTransform),
1441  std::move(lArNegativeHecBounds),
1442  lArHecMaterialBinNeg,
1443  8,
1444  //hnEntries,
1445  "Calo::Detectors::LAr::NegativeHec");
1446  }
1447 
1448  // Now the FCAL
1449  // binned material for FCAL : layers only
1450  std::vector<Trk::IdentifiedMaterial> matFCAL;
1451  // convert the Material
1452  auto lArFcalMaterial = std::make_shared<Trk::Material>(8.4, 175.5, 100.8, 42.1, 0.0097);
1453  auto lArFcalMaterial0 = std::make_shared<Trk::Material>(96., 560., 30.3, 14.3, 0.0025);
1454 
1455  // layer material can be adjusted here
1456  baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 20;
1457  matFCAL.emplace_back(lArFcalMaterial0,0);
1458  matFCAL.emplace_back(lArFcalMaterial->scale(0.5),baseID+1);
1459  matFCAL.emplace_back(lArFcalMaterial->scale(1.5),baseID+2);
1460  matFCAL.emplace_back(lArFcalMaterial->scale(1.4),baseID+3);
1461 
1462  // smooth the FCal to Tube form
1463  if (lArPositiveFcal1Bounds && lArPositiveFcal2Bounds && lArPositiveFcal3Bounds &&
1464  lArNegativeFcal1Bounds && lArNegativeFcal2Bounds && lArNegativeFcal3Bounds){
1465 
1466  // get the minimum/maximmum of the three radii - it's the one of FCAL1
1467  double lArFcalRmin = lArPositiveFcal1Bounds->innerRadius();
1468  double lArFcalRmax = lArPositiveFcal1Bounds->outerRadius();
1469  // assign the bounds
1470  lArPositiveFcalBounds = std::make_shared<Trk::CylinderVolumeBounds>(lArFcalRmin, lArFcalRmax, lArFcalHalflength);
1471  lArNegativeFcalBounds = std::make_shared<Trk::CylinderVolumeBounds>(*lArPositiveFcalBounds);
1472  // output
1473  ATH_MSG_DEBUG( "Smoothed LAr Fcal bounds : " << *lArPositiveFcalBounds );
1474  ATH_MSG_DEBUG( " -> at z-position: +/- " << lArFcalZposition );
1475 
1476  // get min and max for the Layer Creation
1477  lArFcalZmin = lArFcalZposition - lArFcalHalflength;
1478  lArFcalZmax = lArFcalZposition + lArFcalHalflength;
1479 
1480  // layer binning in Z
1481  std::vector<float> spfc;
1482  spfc.push_back(lArFcalZmin);
1483  spfc.push_back(entrySurf[CaloCell_ID::FCAL0].first->center().z());
1484  spfc.push_back(entrySurf[CaloCell_ID::FCAL1].first->center().z());
1485  spfc.push_back(entrySurf[CaloCell_ID::FCAL2].first->center().z());
1486  spfc.push_back(lArFcalZmax);
1487  auto fcp = Trk::BinUtility(spfc,Trk::open,Trk::binZ);
1488 
1489  // material index
1490  std::vector<size_t> hf{0,1,2,3};
1491 
1492  // binned material
1493  const Trk::BinnedMaterial lArFcalMaterialBinPos(*lArFcalMaterial,fcp,hf,matFCAL);
1494 
1495  // layer binning in Z
1496  std::vector<float> snfc;
1497  snfc.push_back(-lArFcalZmax);
1498  snfc.push_back(entrySurf[CaloCell_ID::FCAL2].second->center().z());
1499  snfc.push_back(entrySurf[CaloCell_ID::FCAL1].second->center().z());
1500  snfc.push_back(entrySurf[CaloCell_ID::FCAL0].second->center().z());
1501  snfc.push_back(-lArFcalZmin);
1502  auto fcn = Trk::BinUtility(snfc,Trk::open,Trk::binZ);
1503 
1504  // material index
1505  std::vector<size_t> hfn{3,2,1,0};
1506 
1507  // binned material
1508  const Trk::BinnedMaterial lArFcalMaterialBinNeg(*lArFcalMaterial,fcn,hfn,matFCAL);
1509 
1510  // the new HepTransforms
1511  Amg::Vector3D lArPositiveFcalPos(0.,0.,lArFcalZposition);
1512  Amg::Vector3D lArPositiveFcalNeg(0.,0.,-lArFcalZposition);
1513  auto lArPositiveFcalTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArPositiveFcalPos));
1514  auto lArNegativeFcalTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArPositiveFcalNeg));
1515 
1516 
1517  lArPositiveFcal = new Trk::AlignableTrackingVolume(
1518  std::move(lArPositiveFcalTransform),
1519  std::move(lArPositiveFcalBounds),
1520  lArFcalMaterialBinPos,
1521  21,
1522  //fcpEntries,
1523  "Calo::Detectors::LAr::PositiveFcal");
1524 
1525  lArNegativeFcal = new Trk::AlignableTrackingVolume(
1526  std::move(lArNegativeFcalTransform),
1527  std::move(lArNegativeFcalBounds),
1528  lArFcalMaterialBinNeg,
1529  21,
1530  //fcnEntries,
1531  "Calo::Detectors::LAr::NegativeFcal");
1532  }
1533 
1534  // fill in the inner Gap
1535  // ST this better to be done by CaloTrackingGeometry ( to glue with BeamPipe )
1536  // pass MBTS info to CaloTG
1537  // MBTS
1538  const PVConstLink topEC = lArMgr->getTreeTop(1U);
1539  Amg::Transform3D trIn= topEC->getX(geoAlign);
1540  Amg::Transform3D tr2(trIn);
1541  const PVConstLink mbts= getChild(topEC,"MBTS_mother",trIn);
1542 
1543  float mbtsZ{-1}; // MBTS layer position
1544  float mbts_rmin{0}; // MBTS layer dimensions
1545  float mbts_rmax{0}; // MBTS layer dimensions
1546 
1547  if (mbts) {
1548  //printChildren(mbts,-1,0,Amg::Transform3D(trIn));
1549  const PVConstLink mbts1= getChild(mbts,"MBTS1",trIn);
1550  if (mbts1) mbtsZ=fabs(trIn.translation().z());
1551  if (mbts1) {
1552  ATH_MSG_VERBOSE("MBTS1 layer found at z "<<mbtsZ);
1553  // retrieve Rmin
1554  const GeoLogVol* clv = mbts1->getLogVol();
1555  const GeoTrd* trd=dynamic_cast<const GeoTrd*> (clv->getShape());
1556  if (trd) mbts_rmin = trIn.translation().perp()-trd->getZHalfLength();
1557  }
1558  // retrieve MBTS2 for Rmax
1559  const PVConstLink mbts2= getChild(mbts,"MBTS2",tr2);
1560  if (mbts2) {
1561  const GeoLogVol* clv = mbts2->getLogVol();
1562  const GeoTrd* trd=dynamic_cast<const GeoTrd*> (clv->getShape());
1563  if (trd) mbts_rmax = (tr2.translation().perp()+trd->getZHalfLength())/cos(acos(-1.)/8);
1564  }
1565  ATH_MSG_VERBOSE("MBTS layer span in R "<<mbts_rmin<<","<<mbts_rmax);
1566 
1567  } else {
1568  ATH_MSG_VERBOSE("MBTS not found ");
1569  }
1570 
1571  if (mbtsZ>0. && mbts_rmin>0. && mbts_rmax>0.){
1572  // create the dummy volume to pass on the MBTS position
1573  auto lArNegativeMBTSBounds = std::make_shared<Trk::CylinderVolumeBounds>(
1574  mbts_rmin,
1575  mbts_rmax,
1576  10. );
1577 
1578  ATH_MSG_DEBUG( "Filled in LAr MBTS bounds : " << *lArNegativeMBTSBounds );
1579  ATH_MSG_DEBUG( " -> at z-position: +/- " << mbtsZ );
1580 
1581 
1582  Amg::Vector3D lArEndcapInnerGapPos(0.,0., mbtsZ);
1583  Amg::Vector3D lArEndcapInnerGapNeg(0.,0.,-mbtsZ);
1584  auto lArPositiveMBTSTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArEndcapInnerGapPos));
1585  auto lArNegativeMBTSTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(lArEndcapInnerGapNeg));
1586 
1587  // building dense volume here
1588  lArPositiveEndcapInnerGap = new Trk::TrackingVolume(
1589  std::move(lArPositiveMBTSTransform),
1590  std::make_shared<Trk::CylinderVolumeBounds>(*lArNegativeMBTSBounds),
1591  dummyMaterial,
1592  nullptr, nullptr,
1593  "Calo::Detectors::MBTS");
1594 
1595  lArNegativeEndcapInnerGap = new Trk::TrackingVolume(
1596  std::move(lArNegativeMBTSTransform),
1597  std::move(lArNegativeMBTSBounds),
1598  dummyMaterial,
1599  nullptr, nullptr,
1600  "Calo::Detectors::MBTS");
1601  }
1602 
1603  if (msgLvl(MSG::DEBUG)) {
1604  ATH_MSG_DEBUG( "Checking the existence of all Tracking Volumes:" );
1605  ATH_MSG_DEBUG( " -> Calo::Solenoid ");
1606  printCheckResult(msg(MSG::DEBUG), solenoid);
1607  ATH_MSG_DEBUG( " -> Calo::GapVolumes::LAr::SolenoidPresamplerGap ");
1608  printCheckResult(msg(MSG::DEBUG), solenoidLArBarrelGap);
1609  ATH_MSG_DEBUG( " -> Calo::Detectors::LAr::BarrelPresampler ");
1610  printCheckResult(msg(MSG::DEBUG), lArBarrelPresampler);
1611  ATH_MSG_DEBUG( " -> Calo::Detectors::LAr::Barrel ");
1612  printCheckResult(msg(MSG::DEBUG), lArBarrel);
1613  if (lArPositiveEndcapInnerGap) {
1614  ATH_MSG_DEBUG( " -> Calo::GapVolumes::LAr::PositiveEndcapInnerGap ");
1615  printCheckResult(msg(MSG::DEBUG), lArPositiveEndcapInnerGap);
1616  }
1617  ATH_MSG_DEBUG( " -> Calo::Detectors::LAr::PositiveEndcap ");
1618  printCheckResult(msg(MSG::DEBUG), lArPositiveEndcap);
1619  ATH_MSG_DEBUG( " -> Calo::Detectors::LAr::PositiveHec ");
1620  printCheckResult(msg(MSG::DEBUG), lArPositiveHec);
1621  ATH_MSG_DEBUG( " -> Calo::Detectors::LAr::PositiveFcal ");
1622  printCheckResult(msg(MSG::DEBUG), lArPositiveFcal);
1623  ATH_MSG_DEBUG( " -> Calo::Detectors::LAr::LArPositiveHecFcalCover ");
1624  printCheckResult(msg(MSG::DEBUG), lArPositiveHecFcalCover);
1625  if (lArNegativeEndcapInnerGap) {
1626  ATH_MSG_DEBUG( " -> Calo::GapVolumes::LAr::NegativeEndcapInnerGap ");
1627  printCheckResult(msg(MSG::DEBUG), lArNegativeEndcapInnerGap);
1628  }
1629  ATH_MSG_DEBUG( " -> Calo::Detectors::LAr::NegativeEndcap ");
1630  printCheckResult(msg(MSG::DEBUG), lArNegativeEndcap);
1631  ATH_MSG_DEBUG( " -> Calo::Detectors::LAr::NegativeHec ");
1632  printCheckResult(msg(MSG::DEBUG), lArNegativeHec);
1633  ATH_MSG_DEBUG( " -> Calo::Detectors::LAr::NegativeFcal ");
1634  printCheckResult(msg(MSG::DEBUG), lArNegativeFcal);
1635  ATH_MSG_DEBUG( " -> Calo::Detectors::LAr::LArNegativeHecFcalCover ");
1636  printCheckResult(msg(MSG::DEBUG), lArNegativeHecFcalCover);
1637  ATH_MSG_DEBUG( " -> Calo::Detectors::LAr::LArPositiveECPresampler ");
1638  printCheckResult(msg(MSG::DEBUG), lArPosECPresampler);
1639  ATH_MSG_DEBUG( " -> Calo::Detectors::LAr::LArNegativeECPresampler ");
1640  printCheckResult(msg(MSG::DEBUG), lArNegECPresampler);
1641  } // end of detailed output
1642 
1643  // the return vector
1644  auto lArTrackingVolumes = std::vector<Trk::TrackingVolume*>();
1645 
1646  // check if everything went fine
1647  if (solenoid && solenoidLArBarrelGap && lArBarrelPresampler && lArBarrel &&
1648  lArPositiveEndcap && lArPositiveHec && lArPositiveFcal && lArPositiveHecFcalCover &&
1649  lArNegativeEndcap && lArNegativeHec && lArNegativeFcal && lArNegativeHecFcalCover){
1650 
1651  // + register color code for displaying
1652 
1653  // Barrel Part
1654  lArTrackingVolumes.push_back(solenoid); // 0
1655  solenoid->registerColorCode(6);
1656  lArTrackingVolumes.push_back(solenoidLArBarrelGap); // 1
1657  solenoidLArBarrelGap->registerColorCode(21);
1658  lArTrackingVolumes.push_back(lArBarrelPresampler); // 2
1659  lArBarrelPresampler->registerColorCode(7);
1660  lArTrackingVolumes.push_back(lArBarrel); // 3
1661  lArBarrel->registerColorCode(3);
1662  // Positive Endcap Part
1663  lArTrackingVolumes.push_back(lArPositiveEndcapInnerGap); //4
1664  lArTrackingVolumes.push_back(lArPositiveEndcap); //5
1665  lArPositiveEndcap->registerColorCode(3);
1666  lArTrackingVolumes.push_back(lArPositiveHec); //6
1667  lArPositiveHec->registerColorCode(9);
1668  lArTrackingVolumes.push_back(lArPositiveFcal); //7
1669  lArPositiveFcal->registerColorCode(8);
1670  lArTrackingVolumes.push_back(lArPositiveHecFcalCover); //8
1671  lArPositiveHecFcalCover->registerColorCode(9);
1672  // Positive Endcap Part
1673  lArTrackingVolumes.push_back(lArNegativeEndcapInnerGap); //9
1674  lArTrackingVolumes.push_back(lArNegativeEndcap); //10
1675  lArNegativeEndcap->registerColorCode(3);
1676  lArTrackingVolumes.push_back(lArNegativeHec); //11
1677  lArNegativeHec->registerColorCode(9);
1678  lArTrackingVolumes.push_back(lArNegativeFcal); //12
1679  lArNegativeFcal->registerColorCode(8);
1680  lArTrackingVolumes.push_back(lArNegativeHecFcalCover); //13
1681  lArNegativeHecFcalCover->registerColorCode(9);
1682  lArTrackingVolumes.push_back(lArPosECPresampler); //14
1683  lArPosECPresampler->registerColorCode(7);
1684  lArTrackingVolumes.push_back(lArNegECPresampler); //15
1685  lArNegECPresampler->registerColorCode(7);
1686 
1687  }
1688  return lArTrackingVolumes;
1689 }
1690 
1692 {
1693  if (vol) log << "... ok" << endmsg;
1694  else log << "... missing" << endmsg;
1695 }
1696 
1697 void LAr::LArVolumeBuilder::printInfo(const PVConstLink& pv, const GeoAlignmentStore* gas, int gen) const
1698 {
1699  const GeoLogVol* lv = pv->getLogVol();
1700  ATH_MSG_VERBOSE("New LAr Object:" << lv->getName() << ", made of"
1701  << lv->getMaterial()->getName() << ","
1702  << lv->getShape()->type());
1703  const GeoTrd* trd = dynamic_cast<const GeoTrd*>(lv->getShape());
1704  if (trd)
1705  ATH_MSG_VERBOSE("trddim:"
1706  << trd->getXHalfLength1() << "," << trd->getXHalfLength2()
1707  << "," << trd->getYHalfLength1() << ","
1708  << trd->getYHalfLength2() << "," << trd->getZHalfLength());
1709  const GeoTubs* tub = dynamic_cast<const GeoTubs*>(lv->getShape());
1710  if (tub)
1711  ATH_MSG_VERBOSE("tubdim:" << tub->getRMin() << "," << tub->getRMax() << ","
1712  << tub->getZHalfLength());
1713  const GeoTube* tube = dynamic_cast<const GeoTube*>(lv->getShape());
1714  if (tube)
1715  ATH_MSG_VERBOSE("tubdim:" << tube->getRMin() << "," << tube->getRMax()
1716  << "," << tube->getZHalfLength());
1717  const GeoPcon* con = dynamic_cast<const GeoPcon*>(lv->getShape());
1718  if (con) {
1719  const unsigned int nPlanes = con->getNPlanes();
1720  for (unsigned int i = 0; i < nPlanes; i++) {
1721  ATH_MSG_VERBOSE("polycone:" << i << ":" << con->getRMinPlane(i) << ","
1722  << con->getRMaxPlane(i) << ","
1723  << con->getZPlane(i));
1724  }
1725  }
1726  Amg::Transform3D transf = pv->getX(gas);
1727  ATH_MSG_VERBOSE("position:" << "R:" << transf.translation().perp()
1728  << ",phi:" << transf.translation().phi()
1729  << ",x:" << transf.translation().x()
1730  << ",y:" << transf.translation().y()
1731  << ",z:" << transf.translation().z());
1732  int igen = 0;
1733  printChildren(pv, gen, igen, transf);
1734 }
1735 
1736 void LAr::LArVolumeBuilder::printChildren(const PVConstLink& pv,int gen, int igen, const Amg::Transform3D& trIn) const
1737 {
1738  // subcomponents
1739  unsigned int nc = pv->getNChildVols();
1740  igen++;
1741  if (gen>-1 && igen>gen) return;
1742  std::string cname;
1743  for (unsigned int ic=0; ic<nc; ic++) {
1744  Amg::Transform3D transf = trIn*pv->getXToChildVol(ic);
1745  const PVConstLink cv = pv->getChildVol(ic);
1746  const GeoLogVol* clv = cv->getLogVol();
1747  ATH_MSG_VERBOSE(" ");
1748  ATH_MSG_VERBOSE("subcomponent:" << igen << ":" << ic << ":"
1749  << clv->getName() << ", made of"
1750  << clv->getMaterial()->getName() << ","
1751  << clv->getShape()->type());
1752  ATH_MSG_VERBOSE("position:" << "R:" << transf.translation().perp()
1753  << ",phi:" << transf.translation().phi()
1754  << ",x:" << transf.translation().x()
1755  << ",y:" << transf.translation().y()
1756  << ",z:" << transf.translation().z());
1757  const GeoTrd* trd = dynamic_cast<const GeoTrd*>(clv->getShape());
1758  if (trd)
1760  "trddim:" << trd->getXHalfLength1() << "," << trd->getXHalfLength2()
1761  << "," << trd->getYHalfLength1() << ","
1762  << trd->getYHalfLength2() << "," << trd->getZHalfLength());
1763  const GeoTubs* tub = dynamic_cast<const GeoTubs*>(clv->getShape());
1764  if (tub)
1765  ATH_MSG_VERBOSE("tubdim:" << tub->getRMin() << "," << tub->getRMax()
1766  << "," << tub->getZHalfLength());
1767  const GeoTube* tube = dynamic_cast<const GeoTube*>(clv->getShape());
1768  if (tube)
1769  ATH_MSG_VERBOSE("tubdim:" << tube->getRMin() << "," << tube->getRMax()
1770  << "," << tube->getZHalfLength());
1771  const GeoPcon* con = dynamic_cast<const GeoPcon*>(clv->getShape());
1772  if (con) {
1773  const unsigned int nPlanes = con->getNPlanes();
1774  for (unsigned int i = 0; i < nPlanes; i++) {
1775  ATH_MSG_VERBOSE("polycone:" << i << ":" << con->getRMinPlane(i) << ","
1776  << con->getRMaxPlane(i) << ","
1777  << con->getZPlane(i));
1778  }
1779  }
1780 
1781  if (ic == 0 || cname != clv->getName()) {
1782  printChildren(cv, gen, igen, transf);
1783  cname = clv->getName();
1784  }
1785  }
1786 }
1787 
1788 GeoPVConstLink LAr::LArVolumeBuilder::getChild(const GeoPVConstLink& mother,
1789  const std::string& name,
1790  Amg::Transform3D& trIn) const {
1791  // subcomponents
1792  for (const GeoVolumeVec_t::value_type& p : geoGetVolumes (&*mother))
1793  {
1794  Amg::Transform3D transf = trIn*p.second;
1795  GeoPVConstLink cv = p.first;
1796  const GeoLogVol* clv = cv->getLogVol();
1797  if (clv->getName().substr(0,name.size())==name) { trIn = transf; return cv; }
1798  GeoPVConstLink next=getChild(cv,name,transf);
1799  if (next) {trIn = transf; return next; }
1800  }
1801  return nullptr;
1802 }
BinnedMaterial.h
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
geoGetVolumes
GeoVolumeVec_t geoGetVolumes(const GeoGraphNode *node, int depthLimit=1, int sizeHint=20)
Return the child volumes and associated transforms.
Definition: GeoVisitVolumes.cxx:211
GeoAlignmentStore
Ensure that the extensions for the Vector3D are properly loaded.
Definition: GeoAlignmentStore.h:24
SlidingCylinderSurface.h
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
egammaParameters::depth
@ depth
pointing depth of the shower as calculated in egammaqgcld
Definition: egammaParamDefs.h:276
Example_ReadSampleNoise.hfn
hfn
Definition: Example_ReadSampleNoise.py:46
Trk::SlidingDiscSurface
Definition: SlidingDiscSurface.h:45
LAr::LArVolumeBuilder::printChildren
void printChildren(const GeoPVConstLink &pv, int gen, int igen, const Amg::Transform3D &tr) const
Definition: LArVolumeBuilder.cxx:1736
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
DiscBounds.h
GeometrySignature.h
LAr::LArVolumeBuilder::finalize
virtual StatusCode finalize() override final
AlgTool finalize method.
Definition: LArVolumeBuilder.cxx:78
Trk::binZ
@ binZ
Definition: BinningType.h:49
hist_file_dump.d
d
Definition: hist_file_dump.py:142
LArDetectorManager::getTreeTop
virtual PVConstLink getTreeTop(unsigned int i) const override
Gets the ith tree top.
Definition: LArDetectorManager.cxx:21
BinnedArray.h
LAr::LArVolumeBuilder::trackingVolumes
virtual std::vector< Trk::TrackingVolume * > trackingVolumes(const CaloDetDescrManager &caloDDM, const GeoAlignmentStore *geoAlign) const override final
TrackingVolumeBuilder interface method - returns vector of ptrs to tracking Volumes.
Definition: LArVolumeBuilder.cxx:84
Trk::BinnedMaterial
Definition: BinnedMaterial.h:31
python.SystemOfUnits.second
float second
Definition: SystemOfUnits.py:135
CaloDepthTool.h
Declaration of CaloDepthTool. Created by Claire Bourdarios, 25.10.2004.
Trk::GeoMaterialConverter::convert
static Material convert(const GeoMaterial *gm)
Single conversion , input type GeoMaterial - output type Trk::MaterialProperties.
Definition: GeoMaterialConverter.cxx:18
DiscLayer.h
CaloCell_ID_FCS::FCAL1
@ FCAL1
Definition: FastCaloSim_CaloCell_ID.h:41
LArDetectorManager::getNumTreeTops
virtual unsigned int getNumTreeTops() const override
Gets the number of tree tops.
Definition: LArDetectorManager.cxx:26
Trk::binEta
@ binEta
Definition: BinningType.h:54
CaloCell_ID_FCS::HEC2
@ HEC2
Definition: FastCaloSim_CaloCell_ID.h:29
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Trk::Calo
@ Calo
Definition: GeometrySignature.h:28
Trk::TrackingVolume::registerColorCode
void registerColorCode(unsigned int icolor)
Register the color code.
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
master.gen
gen
Definition: master.py:32
RunTileMonitoring.mbts
mbts
Definition: RunTileMonitoring.py:133
StoredPhysVol
Definition: StoredPhysVol.h:27
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
GeometryStatics.h
GeoVisitVolumes.h
Visitor to process all volumes under a GeoModel node.
CylinderVolumeBounds.h
StoredPhysVol::getPhysVol
GeoFullPhysVol * getPhysVol()
Destructor.
Definition: StoredPhysVol.cxx:20
Trk::GeometrySignature
GeometrySignature
Definition: GeometrySignature.h:24
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
beamspotman.steps
int steps
Definition: beamspotman.py:503
CaloCell_ID_FCS::HEC1
@ HEC1
Definition: FastCaloSim_CaloCell_ID.h:28
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
SlidingDiscSurface.h
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
beamspotman.n
n
Definition: beamspotman.py:729
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
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
LAr::LArVolumeBuilder::printCheckResult
static void printCheckResult(MsgStream &log, const Trk::TrackingVolume *vol)
Definition: LArVolumeBuilder.cxx:1691
Trk::SlidingDiscSurface::offset
const std::vector< float > & offset() const
This method allows access to the radial offset values.
Definition: SlidingDiscSurface.h:128
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
CylinderSurface.h
Trk::CylinderVolumeBounds::halflengthZ
double halflengthZ() const
This method returns the halflengthZ.
Definition: CylinderVolumeBounds.h:207
Trk::SlidingCylinderSurface::offset
const std::vector< float > & offset() const
This method allows access to the radial offset values.
Definition: SlidingCylinderSurface.h:82
constants.EME1
int EME1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:55
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CylinderLayer.h
Trk::Volume::center
const Amg::Vector3D & center() const
returns the center of the volume
Definition: Volume.h:90
LArDetectorManager
Stored in storegate. Provides access to EMB, EMEC, HEC and FCAL Detector Managers....
Definition: LArDetectorManager.h:26
Trk::BinUtility
Definition: BinUtility.h:39
grepfile.ic
int ic
Definition: grepfile.py:33
LAr::LArVolumeBuilder::getChild
GeoPVConstLink getChild(const GeoPVConstLink &mother, const std::string &name, Amg::Transform3D &trIn) const
Definition: LArVolumeBuilder.cxx:1788
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
GeoAlignmentStore.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
Trk::CylinderVolumeBounds::outerRadius
double outerRadius() const
This method returns the outer radius.
Definition: CylinderVolumeBounds.h:191
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
GeoMaterialConverter.h
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
LArDetectorManager.h
LAr::LArVolumeBuilder::initialize
virtual StatusCode initialize() override final
AlgTool initialize method.
Definition: LArVolumeBuilder.cxx:62
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
CaloCell_ID_FCS::HEC0
@ HEC0
Definition: FastCaloSim_CaloCell_ID.h:27
Trk::open
@ open
Definition: BinningType.h:40
CylinderBounds.h
Trk::binR
@ binR
Definition: BinningType.h:50
TrackingVolume.h
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
Trk::CylinderVolumeBounds::innerRadius
double innerRadius() const
This method returns the inner radius.
Definition: CylinderVolumeBounds.h:187
LArVolumeBuilder.h
DeMoScan.first
bool first
Definition: DeMoScan.py:534
DEBUG
#define DEBUG
Definition: page_access.h:11
LAr::LArVolumeBuilder::printInfo
void printInfo(const GeoPVConstLink &pv, const GeoAlignmentStore *gas, int gen=-1) const
Definition: LArVolumeBuilder.cxx:1697
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
python.changerun.pv
pv
Definition: changerun.py:79
GeoShapeConverter.h
DiscSurface.h
Trk::SlidingCylinderSurface
Definition: SlidingCylinderSurface.h:34
CaloCell_ID_FCS::FCAL2
@ FCAL2
Definition: FastCaloSim_CaloCell_ID.h:42
Trk::GeoShapeConverter::convert
static std::shared_ptr< CylinderVolumeBounds > convert(const GeoTubs *gtub)
Convert a tubs.
Definition: GeoShapeConverter.cxx:57
Trk::Material
Definition: Material.h:117
LAr::LArVolumeBuilder::LArVolumeBuilder
LArVolumeBuilder(const std::string &, const std::string &, const IInterface *)
AlgTool style constructor.
Definition: LArVolumeBuilder.cxx:50
AthAlgTool
Definition: AthAlgTool.h:26
CaloCell_ID_FCS::HEC3
@ HEC3
Definition: FastCaloSim_CaloCell_ID.h:30
CaloCell_ID_FCS::FCAL0
@ FCAL0
Definition: FastCaloSim_CaloCell_ID.h:40
Trk::TrackingVolume
Definition: TrackingVolume.h:119
CaloCell_ID_FCS::EMB3
@ EMB3
Definition: FastCaloSim_CaloCell_ID.h:22
Material
@ Material
Definition: MaterialTypes.h:8
AlignableTrackingVolume.h
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
calibdata.tube
tube
Definition: calibdata.py:30
plotBeamSpotMon.nc
int nc
Definition: plotBeamSpotMon.py:82
Material.h
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
LayerMaterialProperties.h
StoredPhysVol.h
python.LArMinBiasAlgConfig.float
float
Definition: LArMinBiasAlgConfig.py:65
Trk::AlignableTrackingVolume
Definition: AlignableTrackingVolume.h:36