ATLAS Offline Software
MuonTrackingGeometryBuilderImpl.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // MuonTrackingGeometryBuilderImpl.cxx, (c) ATLAS Detector software
8 
9 // Muon
12 
13 
15 // Amg
17 // Units
18 #include "GaudiKernel/SystemOfUnits.h"
19 // Trk
28 #include "TrkGeometry/Material.h"
41 
42 // Athena
44 
45 // STD
46 #include <cmath>
47 #include <fstream>
48 #include <map>
49 
50 namespace Muon {
51 
57 // constructor
59  const std::string& t, const std::string& n, const IInterface* p)
60  : AthAlgTool(t, n, p) {}
61 
62 // Athena standard methods
63 // initialize
64 
66  // Retrieve the tracking volume helper
67  // -------------------------------------------------
70  if (m_loadMSentry) {
71  // retrieve envelope definition service
72  // --------------------------------------------------
74  }
75 
76  ATH_MSG_DEBUG( " initialize() successful");
77  return StatusCode::SUCCESS;
78 }
79 
80 std::unique_ptr<Trk::TrackingGeometry>
82  DetachedVolVec && inertObjs,
83  Trk::TrackingVolume* tvol) const {
84  ATH_MSG_DEBUG( " building tracking geometry");
85  bool hasStations = inertObjs.size() || stations.size();
86 
87  // load local variables to container
94  aLVC.m_static3d = m_static3d;
96  // check setup
98  if (!aLVC.m_adjustStatic || !aLVC.m_static3d) {
99  ATH_MSG_INFO( " diluted inert material hardcoded for 3D "
100  "volume frame, adjusting setup");
101  aLVC.m_adjustStatic = true;
102  aLVC.m_static3d = true;
103  }
104  }
105  // find object's span with tolerance for the alignment
106 
107  aLVC.m_stationSpan = findVolumesSpan(stations, 100. * m_alignTolerance,
109 
110  aLVC.m_inertSpan = findVolumesSpan(inertObjs, 0., 0., aLVC);
111 
112  // 0) Preparation
113  // //////////////////////////////////////////////////////////////////////////////////////
114 
115  aLVC.m_muonMaterial = Trk::Material(10e10, 10e10, 0., 0., 0.); // default material properties
116 
117 
118 
120  // Envelope definition (cutouts)
122  RZPairVector envelopeDefs;
124  // get the dimensions from the envelope service
125  const RZPairVector& envelopeDefsIn = m_enclosingEnvelopeSvc->getMuonRZBoundary();
126 
127  // find the max,max pair
128  unsigned int ii = 0;
129  for (unsigned int i = 0; i < envelopeDefsIn.size(); i++) {
130  if (envelopeDefsIn[i].second > envelopeDefsIn[ii].second)
131  ii = i;
132  else if (envelopeDefsIn[i].second == envelopeDefsIn[ii].second &&
133  envelopeDefsIn[i].first > envelopeDefsIn[ii].first)
134  ii = i;
135  }
136 
137  // find the sense of rotation
138  int irot = 1;
139  unsigned int inext = ii + 1;
140  if (inext == envelopeDefsIn.size())
141  inext = 0;
142  if (envelopeDefsIn[inext].second != envelopeDefsIn[ii].second) {
143  irot = -1;
144  inext = ii > 0 ? ii - 1 : envelopeDefsIn.size() - 1;
145  }
146 
147  // fill starting with upper low edge, end with upper high edge
148  if (irot > 0) {
149  for (unsigned int i = inext; i < envelopeDefsIn.size(); i++)
150  envelopeDefs.push_back(envelopeDefsIn[i]);
151  if (inext > 0)
152  for (unsigned int i = 0; i <= inext - 1; i++)
153  envelopeDefs.push_back(envelopeDefsIn[i]);
154  } else {
155  int i = inext;
156  while (i >= 0) {
157  envelopeDefs.push_back(envelopeDefsIn[i]);
158  i = i - 1;
159  };
160  inext = envelopeDefsIn.size() - 1;
161  while (inext >= ii) {
162  envelopeDefs.push_back(envelopeDefsIn[inext]);
163  inext = inext - 1;
164  };
165  }
166 
167  // find maximal z,R extent
168  double maxR = 0.;
169  for (auto& envelopeDef : envelopeDefs) {
170  if (envelopeDef.first > maxR)
171  maxR = envelopeDef.first;
172  }
173 
174  aLVC.m_outerBarrelRadius = maxR;
175  aLVC.m_outerEndcapZ = envelopeDefs[0].second;
176 
177  ATH_MSG_VERBOSE("Muon envelope definition retrieved: outer R,Z:"
178  << aLVC.m_outerBarrelRadius << ","
179  << aLVC.m_outerEndcapZ);
180 
181  // construct inner and outer envelope
182 
183  for (unsigned int i = 0; i < envelopeDefs.size(); i++) {
184  ATH_MSG_VERBOSE("Rz pair:" << i << ":" << envelopeDefs[i].first
185  << "," << envelopeDefs[i].second);
186  }
187  }
188 
190 
191  if (m_muonSimple) {
192  auto globalBounds = std::make_unique<Trk::CylinderVolumeBounds>(aLVC.m_outerBarrelRadius, aLVC.m_outerEndcapZ);
193  auto topVolume = std::make_unique<Trk::TrackingVolume>(nullptr, globalBounds.release(), aLVC.m_muonMaterial,
194  nullptr, nullptr, "GlobalVolume");
195  return std::make_unique<Trk::TrackingGeometry>(topVolume.release());
196  }
197 
198  ATH_MSG_DEBUG( "building barrel+innerEndcap+outerEndcap");
199 
201  // MuonSpectrometer contains:
202  // - Barrel
203  // - Endcaps inner/outer
204  std::vector<TrackingVolumePtr> volumeGarbage{};
205 
206  TrackingVolumePtr muonBarrel{}, negativeMuonOuterWheel{},
207  negativeMuonBigWheel{}, negativeMuonOuterBuffer{},
208  positiveMuonOuterWheel{}, negativeMuonSmallWheel{},
209  positiveMuonSmallWheel{}, negativeECT{}, positiveECT{},
210  positiveMuonBigWheel{}, positiveMuonOuterBuffer{};
211  // volumes needed to close the geometry
212  TrackingVolumePtr negBeamPipe{}, posBeamPipe{}, negDiskShield{}, posDiskShield{},
213  negInnerShield{}, posInnerShield{}, negOuterShield{}, posOuterShield{};
214 
215  std::unique_ptr<Trk::CylinderVolumeBounds> enclosedBounds{};
216 
217  TrackingVolumePtr barrelZPBuffer{}, barrelZMBuffer{};
218  TrackingVolumePtr barrelZP{}, centralP{}, central{},
219  negativeMuonInnerEndcap{}, positiveMuonInnerEndcap{},
220  negNavOEndcap{}, posNavOEndcap{}, negativeMuonOuterEndcap{},
221  positiveMuonOuterEndcap{}, barrel{}, negOuterEndcap{},
222  posOuterEndcap{}, negInnerEndcap{}, posInnerEndcap{}, negNavEndcap{},
223  posNavEndcap{}, negEndcap{}, posEndcap{}, negDet{}, detector{}, enclosed{};
224 
225 
226  // if input, redefine dimensions to fit expected MS entry
227  if (tvol) {
228  bool msEntryDefined = false;
229  if (tvol->volumeName() == m_entryVolume)
230  msEntryDefined = true;
231  // get dimensions
232  ATH_MSG_DEBUG(" msEntryDefined " << msEntryDefined);
233  auto enclosedDetectorBounds =dynamic_cast<const Trk::CylinderVolumeBounds*>(&(tvol->volumeBounds()));
234  if (!enclosedDetectorBounds) {
235  ATH_MSG_ERROR(" dynamic cast of enclosed volume to the cylinder bounds failed, aborting MTG build-up ");
236  return nullptr;
237  }
238  double enclosedDetectorHalfZ = enclosedDetectorBounds->halflengthZ();
239  double enclosedDetectorOuterRadius =
240  enclosedDetectorBounds->outerRadius();
241  // get subvolumes at navigation level and check THEIR dimensions
242  Trk::GlueVolumesDescriptor& enclosedDetGlueVolumes = tvol->glueVolumesDescriptor();
243  std::vector<Trk::TrackingVolume*> enclosedCentralFaceVolumes = enclosedDetGlueVolumes.glueVolumes(Trk::cylinderCover);
244  std::vector<Trk::TrackingVolume*> enclosedNegativeFaceVolumes = enclosedDetGlueVolumes.glueVolumes(Trk::negativeFaceXY);
245  std::vector<Trk::TrackingVolume*> enclosedPositiveFaceVolumes = enclosedDetGlueVolumes.glueVolumes(Trk::positiveFaceXY);
246  if (!enclosedCentralFaceVolumes.empty()) {
247  auto cylR = dynamic_cast<const Trk::CylinderVolumeBounds*>(&(enclosedCentralFaceVolumes[0]->volumeBounds()));
248  if (cylR && cylR->outerRadius() != enclosedDetectorOuterRadius) {
249  enclosedDetectorOuterRadius = cylR->outerRadius();
250  ATH_MSG_WARNING(" enclosed volume envelope outer radius does not "
251  "correspond to radius of glue volumes : adjusted ");
252  }
253  }
254  if (!enclosedNegativeFaceVolumes.empty() &&
255  !enclosedPositiveFaceVolumes.empty()) {
256  double negZ = -enclosedDetectorHalfZ;
257  double posZ = enclosedDetectorHalfZ;
258  auto cylN = dynamic_cast<const Trk::CylinderVolumeBounds*>(&(enclosedNegativeFaceVolumes[0]->volumeBounds()));
259  if (cylN){
260  negZ = enclosedNegativeFaceVolumes[0]->center().z() - cylN->halflengthZ();
261  }
262  auto cylP =dynamic_cast<const Trk::CylinderVolumeBounds*>(&(enclosedPositiveFaceVolumes[0]->volumeBounds()));
263  if (cylP) {
264  posZ = enclosedPositiveFaceVolumes[0]->center().z() +
265  cylP->halflengthZ();
266  }
267  if (std::abs(negZ + enclosedDetectorHalfZ) > 0.001 ||
268  std::abs(posZ - enclosedDetectorHalfZ) > 0.001) {
269  ATH_MSG_WARNING(" enclosed volume envelope z dimension does not correspond to that of glue volumes ");
270  if (std::abs(negZ + posZ) < 0.001) {
271  enclosedDetectorHalfZ = posZ;
272  ATH_MSG_WARNING( " z adjusted ");
273  } else {
274  ATH_MSG_ERROR("assymetric Z dimensions - cannot recover " << negZ << "," << posZ);
275  return nullptr;
276  }
277  }
278  }
279  //
280 
281  //
282  ATH_MSG_DEBUG(" dimensions of enclosed detectors (halfZ,outerR):"
283  << enclosedDetectorHalfZ << ","<< enclosedDetectorOuterRadius);
284  // check if input makes sense - gives warning if cuts into muon envelope
285  // adjust radius
286  if (enclosedDetectorOuterRadius > aLVC.m_innerBarrelRadius) {
287  ATH_MSG_WARNING( " enclosed volume too wide, cuts into "
288  "muon envelope, abandon :R:"
289  << enclosedDetectorOuterRadius);
290  return nullptr;
291  }
292  aLVC.m_innerBarrelRadius = enclosedDetectorOuterRadius;
293 
294  // adjust z
295  if (enclosedDetectorHalfZ > m_barrelZ) {
296  ATH_MSG_WARNING( " enclosed volume too long, cuts into "
297  <<"muon envelope, abandon :Z:"<< enclosedDetectorHalfZ);
298  return nullptr;
299  } else {
300  if (enclosedDetectorHalfZ < m_barrelZ) {
301  auto barrelZPBounds = std::make_unique<Trk::CylinderVolumeBounds>(aLVC.m_innerBarrelRadius,
302  0.5 * (m_barrelZ - enclosedDetectorHalfZ));
303  auto barrelZMBounds = std::make_unique<Trk::CylinderVolumeBounds>(aLVC.m_innerBarrelRadius,
304  0.5 * (m_barrelZ - enclosedDetectorHalfZ));
305  double zbShift = 0.5 * (m_barrelZ + enclosedDetectorHalfZ);
306 
307  barrelZPBuffer = std::make_unique<Trk::TrackingVolume>(makeTransform(Amg::getTranslateZ3D(zbShift)),
308  barrelZPBounds.release(), aLVC.m_muonMaterial, nullptr,
309  nullptr, "BarrelRZPosBuffer");
310  barrelZMBuffer = std::make_unique<Trk::TrackingVolume>(makeTransform(Amg::getTranslateZ3D(-zbShift)),
311  barrelZMBounds.release(), aLVC.m_muonMaterial, nullptr,
312  nullptr, "BarrelRZNegBuffer");
313 
314  ATH_MSG_DEBUG( "glue barrel R + barrel Z buffer");
315  barrelZP = (m_trackingVolumeHelper->glueTrackingVolumeArrays(TrackingVolumePtr(tvol),
317  std::move(barrelZPBuffer),
318  Trk::negativeFaceXY, "All::Gaps::BarrelZP"));
319  // set name
320  std::string nameEncl = msEntryDefined ? "All::Gaps::Barrel" : m_entryVolume;
321  ATH_MSG_DEBUG(" nameEncl " << nameEncl);
322  enclosed = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(barrelZP),
324  std::move(barrelZMBuffer),
326  nameEncl);
327 
328  } else{
330  enclosed.reset(tvol);
331  }
332  }
333 
334  } else { // no input, create the enclosed volume
336  const RZPairVector& envelopeDefs = m_enclosingEnvelopeSvc->getCaloRZBoundary();
337  // to be implemented in detail - for the moment, take just maximal
338  // extent
339  ATH_MSG_DEBUG(" m_loadMSentry " << m_loadMSentry
340  << " m_enclosingEnvelopeSvc "
342  double rmax = 0.;
343  double zmax = 0.;
344  for (const auto& envelopeDef : envelopeDefs) {
345  rmax = std::max(envelopeDef.first, rmax);
346  zmax = std::max(std::abs(envelopeDef.second), zmax);
347  }
348  if (!envelopeDefs.empty()) {
349  if (rmax > 0. && rmax <= aLVC.m_innerBarrelRadius &&
350  zmax > 0. && zmax <= m_barrelZ) {
351  enclosedBounds = std::make_unique<Trk::CylinderVolumeBounds>(rmax, zmax);
352  } else {
353  ATH_MSG_DEBUG( " input MSEntrance size (R,Z:"<< rmax << "," << zmax
354  << ") clashes with MS material, switch to default values (R,Z:"
355  << aLVC.m_innerBarrelRadius << "," << m_barrelZ << ")");
356  }
357  }
358  }
359 
360  if (!enclosedBounds) {
361  enclosedBounds = std::make_unique<Trk::CylinderVolumeBounds>(aLVC.m_innerBarrelRadius, m_barrelZ);
362  }
363  {
364  enclosed = std::make_unique<Trk::TrackingVolume>(nullptr, enclosedBounds.release(),
365  aLVC.m_muonMaterial, nullptr,
366  nullptr, m_entryVolume);
367  enclosed->registerColorCode(0);
368  }
369  ATH_MSG_DEBUG(" register Barrel m_entryVolume " << m_entryVolume);
370  }
371 
372  // construct inner and outer envelope
373 
374  for (auto& envelopeDef : envelopeDefs) {
375  // ATH_MSG_VERBOSE( "Rz pair:"<< i<<":"<<
376  // envelopeDefs[i].first<<","<<envelopeDefs[i].second );
377  if (!aLVC.m_msCutoutsIn.empty() &&
378  aLVC.m_msCutoutsIn.back().second == -aLVC.m_outerEndcapZ)
379  break;
380  if (aLVC.m_msCutoutsIn.empty() ||
381  std::abs(aLVC.m_msCutoutsIn.back().second) > m_barrelZ ||
382  std::abs(envelopeDef.second) > m_barrelZ)
383  aLVC.m_msCutoutsIn.push_back(envelopeDef);
384  else if (!aLVC.m_msCutoutsIn.empty() &&
385  aLVC.m_msCutoutsIn.back().second == m_barrelZ &&
386  aLVC.m_msCutoutsIn.back().first != aLVC.m_innerBarrelRadius) {
387  aLVC.m_msCutoutsIn.emplace_back(aLVC.m_innerBarrelRadius,
388  m_barrelZ);
389  aLVC.m_msCutoutsIn.emplace_back(aLVC.m_innerBarrelRadius,
390  -m_barrelZ);
391  aLVC.m_msCutoutsIn.emplace_back(
392  aLVC.m_msCutoutsIn[aLVC.m_msCutoutsIn.size() - 3].first,
393  -m_barrelZ);
394  }
395  }
396 
397  unsigned int il = 1;
398  while (envelopeDefs[il - 1].second != -aLVC.m_outerEndcapZ)
399  il++;
400  for (; il < envelopeDefs.size(); il++)
401  aLVC.m_msCutoutsOut.push_back(envelopeDefs[il]);
402 
403  for (unsigned int i = 0; i < aLVC.m_msCutoutsIn.size(); i++) {
404  ATH_MSG_VERBOSE("Rz pair for inner MS envelope:"
405  << i << ":" << aLVC.m_msCutoutsIn[i].first << ","
406  << aLVC.m_msCutoutsIn[i].second);
407  }
408  for (unsigned int i = 0; i < aLVC.m_msCutoutsOut.size(); i++) {
409  ATH_MSG_VERBOSE("Rz pair for outer MS envelope:"
410  << i << ":" << aLVC.m_msCutoutsOut[i].first << ","
411  << aLVC.m_msCutoutsOut[i].second);
412  }
413 
414  if (aLVC.m_msCutoutsIn[5].second != aLVC.m_innerEndcapZ) {
415  aLVC.m_innerEndcapZ = aLVC.m_msCutoutsIn[5].second;
416  }
417  ATH_MSG_VERBOSE("inner endcap Z set to:" << aLVC.m_innerEndcapZ);
418 
419  // create central volume ("enclosed" + disk shields ) - this is to allow
420  // safe gluing with 3D MS binning
421  getShieldParts(aLVC);
422 
423  auto negDiskShieldBounds = std::make_unique<Trk::CylinderVolumeBounds>(aLVC.m_innerBarrelRadius,
424  0.5 * (m_diskShieldZ - m_barrelZ));
426  negDiskShieldBounds.release());
427  negDiskShield = processShield(negDiskVol, 2, "Muons::Detectors::NegativeDiskShield",
428  aLVC, hasStations);
429 
430  auto posDiskShieldBounds = std::make_unique<Trk::CylinderVolumeBounds>(aLVC.m_innerBarrelRadius,
431  0.5 * (m_diskShieldZ - m_barrelZ));
433  posDiskShieldBounds.release());
434  posDiskShield = processShield(posDiskVol, 2, "Muons::Detectors::PositiveDiskShield",
435  aLVC, hasStations);
436 
437  ATH_MSG_DEBUG( "glue enclosed + disk shields");
438  centralP = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(enclosed),
440  std::move(posDiskShield),
442  "Container::CentralP");
443  central = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(centralP),
445  std::move(negDiskShield),
447  "Container::Central");
448  // define basic volumes
449  if (aLVC.m_adjustStatic) {
450  getZParts(aLVC);
451  getHParts(aLVC);
452  }
453 
454  // muon barrel
455  auto barrelBounds = std::make_unique<Trk::CylinderVolumeBounds>(aLVC.m_innerBarrelRadius,
456  aLVC.m_outerBarrelRadius,
457  m_diskShieldZ);
458  Trk::Volume barrelVol(nullptr, barrelBounds.release());
459  // process volume
460  // barrel
461  if (aLVC.m_adjustStatic && aLVC.m_static3d)
462  muonBarrel = processVolume(barrelVol, 0, "Detectors::Barrel",
463  aLVC, hasStations);
464  else if (aLVC.m_adjustStatic)
465  muonBarrel = processVolume(barrelVol, -1, "Detectors::Barrel",
466  aLVC, hasStations);
467  else
468  muonBarrel = processVolume(barrelVol, m_barrelEtaPartition, m_phiPartition,
469  "Detectors::Barrel", aLVC, hasStations);
470  // inner Endcap
471  // build as smallWheel+ECT
472  // small wheel
473  double smallWheelZHalfSize = 0.5 * (m_ectZ - m_diskShieldZ);
474  auto negativeSmallWheelBounds = std::make_unique<Trk::CylinderVolumeBounds>(m_innerShieldRadius,
475  aLVC.m_outerBarrelRadius,
476  smallWheelZHalfSize);
477 
478  Trk::Volume negSWVol(makeTransform(Amg::getTranslateZ3D(-m_ectZ + smallWheelZHalfSize)),
479  negativeSmallWheelBounds.release());
480  if (aLVC.m_adjustStatic && aLVC.m_static3d) {
481  negativeMuonSmallWheel = processVolume(negSWVol, 1, "Detectors::NegativeSmallWheel",
482  aLVC, hasStations);
483  } else if (aLVC.m_adjustStatic) {
484  negativeMuonSmallWheel = processVolume(negSWVol, -1, "Detectors::NegativeSmallWheel",
485  aLVC, hasStations);
486  } else {
487  negativeMuonSmallWheel = processVolume(negSWVol,
490  "Detectors::NegativeSmallWheel",
491  aLVC, hasStations);
492  }
493  //
494  Trk::Volume posSWVol(negSWVol, Amg::getTranslateZ3D(2 * (m_ectZ - smallWheelZHalfSize)));
495  if (aLVC.m_adjustStatic && aLVC.m_static3d) {
496  positiveMuonSmallWheel = processVolume(posSWVol, 1, "Detectors::PositiveSmallWheel",
497  aLVC, hasStations);
498  } else if (aLVC.m_adjustStatic) {
499  positiveMuonSmallWheel = processVolume(posSWVol, -1, "Detectors::PositiveSmallWheel",
500  aLVC, hasStations);
501  } else {
502  positiveMuonSmallWheel = processVolume(posSWVol, m_innerEndcapEtaPartition,
503  m_phiPartition, "Detectors::PositiveSmallWheel",
504  aLVC, hasStations);
505  }
506  // checkVolume(positiveMuonSmallWheel);
507  // ECT
508  double ectZHalfSize = 0.5 * (aLVC.m_innerEndcapZ - m_ectZ);
509 
510  auto negativeECTBounds = std::make_unique<Trk::CylinderVolumeBounds>(m_innerShieldRadius,
511  aLVC.m_outerBarrelRadius,
512  ectZHalfSize);
513 
514  Trk::Volume negECTVol(makeTransform(Amg::getTranslateZ3D(-m_ectZ - ectZHalfSize)),
515  negativeECTBounds.release());
516  if (aLVC.m_adjustStatic && aLVC.m_static3d) {
517  negativeECT = processVolume(negECTVol, 2, "Detectors::NegativeECT",
518  aLVC, hasStations);
519  } else if (aLVC.m_adjustStatic) {
520  negativeECT = processVolume(negECTVol, -1, "Detectors::NegativeECT",
521  aLVC, hasStations);
522  } else {
523  negativeECT = processVolume(negECTVol, m_innerEndcapEtaPartition, m_phiPartition,
524  "Detectors::NegativeECT", aLVC, hasStations);
525  }
526  // checkVolume(negativeECT);
527  //
528  Trk::Volume posECTVol(negECTVol,
529  Amg::getTranslateZ3D(2 * (m_ectZ + ectZHalfSize)));
530  if (aLVC.m_adjustStatic && m_static3d) {
531  positiveECT = processVolume(posECTVol, 2, "Detectors::PositiveECT",
532  aLVC, hasStations);
533  } else if (aLVC.m_adjustStatic) {
534  positiveECT = processVolume(posECTVol, -1, "Detectors::PositiveECT",
535  aLVC, hasStations);
536  } else {
537  positiveECT = processVolume(posECTVol, m_innerEndcapEtaPartition,
538  m_phiPartition, "Detectors::PositiveECT",
539  aLVC, hasStations);
540  }
541  // checkVolume(positiveECT);
542  // glue
543  negativeMuonInnerEndcap = (m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(negativeECT),
545  std::move(negativeMuonSmallWheel),
547  "Container::NegInnerEndcap"));
548  positiveMuonInnerEndcap = (m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(positiveMuonSmallWheel),
550  std::move(positiveECT),
552  "Container::PosInnerEndcap"));
553 
554  // inner shields
555  double innerEndcapZHalfSize = 0.5 * (aLVC.m_innerEndcapZ - m_diskShieldZ);
556  auto negInnerShieldBounds = std::make_unique<Trk::CylinderVolumeBounds>(m_beamPipeRadius,
558  innerEndcapZHalfSize);
559  Trk::Volume negisVol{makeTransform(Amg::getTranslateZ3D(-m_diskShieldZ - innerEndcapZHalfSize)),
560  negInnerShieldBounds.release()};
561  negInnerShield = processShield(negisVol, 1, "Muons::Detectors::NegativeInnerShield",
562  aLVC, hasStations);
563 
564  auto posInnerShieldBounds = std::make_unique<Trk::CylinderVolumeBounds>(m_beamPipeRadius,
566  innerEndcapZHalfSize);
567  Trk::Volume posisVol(makeTransform(Amg::getTranslateZ3D(m_diskShieldZ + innerEndcapZHalfSize)),
568  posInnerShieldBounds.release());
569  posInnerShield = processShield(posisVol, 1, "Muons::Detectors::PositiveInnerShield",
570  aLVC, hasStations);
571 
572  // outer Endcap
573  // build as bigWheel+buffer+outerWheel
574  // outer wheel
575  double outerWheelZHalfSize = 0.5 * (aLVC.m_outerEndcapZ - m_outerWheel);
576  auto negativeOuterWheelBounds = std::make_unique<Trk::CylinderVolumeBounds>(m_outerShieldRadius,
577  aLVC.m_outerBarrelRadius,
578  outerWheelZHalfSize);
580  outerWheelZHalfSize)),
581  negativeOuterWheelBounds.release());
582  if (aLVC.m_adjustStatic && aLVC.m_static3d) {
583  negativeMuonOuterWheel = processVolume(negOWVol, 3, "Detectors::NegativeOuterWheel",
584  aLVC, hasStations);
585  } else if (aLVC.m_adjustStatic) {
586  negativeMuonOuterWheel = processVolume(negOWVol, -1, "Detectors::NegativeOuterWheel",
587  aLVC, hasStations);
588  } else {
589  negativeMuonOuterWheel = processVolume(negOWVol, m_outerEndcapEtaPartition,
590  m_phiPartition, "Detectors::NegativeOuterWheel",
591  aLVC, hasStations);
592  }
593  //
594  Trk::Volume posOWVol(negOWVol,
595  Amg::getTranslateZ3D(2 * (aLVC.m_outerEndcapZ - outerWheelZHalfSize)));
596 
597  if (aLVC.m_adjustStatic && aLVC.m_static3d) {
598  positiveMuonOuterWheel = processVolume(posOWVol, 3, "Detectors::PositiveOuterWheel",
599  aLVC, hasStations);
600  } else if (aLVC.m_adjustStatic) {
601  positiveMuonOuterWheel = processVolume(posOWVol, -1, "Detectors::PositiveOuterWheel",
602  aLVC, hasStations);
603  } else {
604  positiveMuonOuterWheel = processVolume(posOWVol, m_outerEndcapEtaPartition,
605  m_phiPartition, "Detectors::PositiveOuterWheel",
606  aLVC, hasStations);
607  }
608  // outer buffer
609  double outerBufferZHalfSize = 0.5 * (m_outerWheel - m_bigWheel);
610  auto negativeOuterBufferBounds = std::make_unique<Trk::CylinderVolumeBounds>(m_outerShieldRadius,
611  aLVC.m_outerBarrelRadius,
612  outerBufferZHalfSize);
613 
615  outerBufferZHalfSize)),
616  negativeOuterBufferBounds.release());
617  if (aLVC.m_adjustStatic && aLVC.m_static3d) {
618  negativeMuonOuterBuffer = processVolume(negBuffVol, 3, "Detectors::NegativeOuterBuffer",
619  aLVC, hasStations);
620  } else if (aLVC.m_adjustStatic) {
621  negativeMuonOuterBuffer = processVolume(negBuffVol, -1, "Detectors::NegativeOuterBuffer",
622  aLVC, hasStations);
623  } else {
624  negativeMuonOuterBuffer = processVolume(negBuffVol, m_outerEndcapEtaPartition,
625  m_phiPartition, "Detectors::NegativeOuterBuffer",
626  aLVC, hasStations);
627  }
628  //
629  Trk::Volume posBuffVol(negBuffVol, Amg::getTranslateZ3D(2 *(m_bigWheel + outerBufferZHalfSize)));
630  if (aLVC.m_adjustStatic && aLVC.m_static3d) {
631  positiveMuonOuterBuffer = processVolume(posBuffVol, 3, "Detectors::PositiveOuterBuffer",
632  aLVC, hasStations);
633  } else if (aLVC.m_adjustStatic) {
634  positiveMuonOuterBuffer = processVolume(posBuffVol, -1, "Detectors::PositiveOuterBuffer",
635  aLVC, hasStations);
636  } else {
637  positiveMuonOuterBuffer = processVolume(posBuffVol, m_outerEndcapEtaPartition,
638  m_phiPartition, "Detectors::PositiveOuterBuffer",
639  aLVC, hasStations);
640  }
641  // big wheel
642  double bigWheelZHalfSize = 0.5 * (m_bigWheel - aLVC.m_innerEndcapZ);
643  auto negativeBigWheelBounds = std::make_unique<Trk::CylinderVolumeBounds>(m_outerShieldRadius,
644  aLVC.m_outerBarrelRadius,
645  bigWheelZHalfSize);
646 
648  bigWheelZHalfSize)),
649  negativeBigWheelBounds.release());
650  if (aLVC.m_adjustStatic && aLVC.m_static3d) {
651  negativeMuonBigWheel = processVolume(negBWVol, 3, "Detectors::NegativeBigWheel",
652  aLVC, hasStations);
653  } else if (aLVC.m_adjustStatic) {
654  negativeMuonBigWheel = processVolume(negBWVol, -1, "Detectors::NegativeBigWheel",
655  aLVC, hasStations);
656  } else {
657  negativeMuonBigWheel = processVolume(negBWVol, m_outerEndcapEtaPartition,
658  m_phiPartition, "Detectors::NegativeBigWheel",
659  aLVC, hasStations);
660  }
661  //
662  Trk::Volume posBWVol(negBWVol,
663  Amg::getTranslateZ3D(2 * (aLVC.m_innerEndcapZ + bigWheelZHalfSize)));
664  if (aLVC.m_adjustStatic && aLVC.m_static3d) {
665  positiveMuonBigWheel = processVolume(posBWVol, 3, "Detectors::PositiveBigWheel",
666  aLVC, hasStations);
667  } else if (aLVC.m_adjustStatic) {
668  positiveMuonBigWheel = processVolume(posBWVol, -1, "Detectors::PositiveBigWheel",
669  aLVC, hasStations);
670  } else {
671  positiveMuonBigWheel = processVolume(posBWVol, m_outerEndcapEtaPartition,
672  m_phiPartition, "Detectors::PositiveBigWheel",
673  aLVC, hasStations);
674  }
675  // glue
676  negNavOEndcap = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(negativeMuonOuterWheel),
678  std::move(negativeMuonOuterBuffer),
680  "Container::NegOEndcap");
681 
682  posNavOEndcap = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(positiveMuonOuterBuffer),
684  std::move(positiveMuonOuterWheel),
686  "Container::PosOEndcap");
687 
688 
689  negativeMuonOuterEndcap = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(negNavOEndcap),
691  std::move(negativeMuonBigWheel),
693  "Container::NegOuterEndcap");
694 
695  positiveMuonOuterEndcap = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(positiveMuonBigWheel),
697  std::move(posNavOEndcap),
699  "Container::PosOuterEndcap");
700 
701  // outer shields
702  double outerEndcapZHalfSize = 0.5 * (aLVC.m_outerEndcapZ - aLVC.m_innerEndcapZ);
703  double outerEndcapPosition = 0.5 * (aLVC.m_outerEndcapZ + aLVC.m_innerEndcapZ);
704  auto negOuterShieldBounds = std::make_unique<Trk::CylinderVolumeBounds>(m_beamPipeRadius,
706  outerEndcapZHalfSize);
707  Trk::Volume negosVol(makeTransform(Amg::getTranslateZ3D(-outerEndcapPosition)),
708  negOuterShieldBounds.release());
709  negOuterShield = processShield(negosVol, 0, "Muons::Detectors::NegativeOuterShield",
710  aLVC, hasStations);
711 
712  auto posOuterShieldBounds = std::make_unique<Trk::CylinderVolumeBounds>(
713  m_beamPipeRadius, m_outerShieldRadius, outerEndcapZHalfSize);
714  Trk::Volume pososVol(makeTransform(Amg::getTranslateZ3D(outerEndcapPosition)),
715  posOuterShieldBounds.release());
716  posOuterShield = processShield(pososVol, 0, "Muons::Detectors::PositiveOuterShield",
717  aLVC, hasStations);
718 
719  // beamPipe
720  auto negBeamPipeBounds = std::make_unique<Trk::CylinderVolumeBounds>(m_beamPipeRadius,
721  outerEndcapZHalfSize + innerEndcapZHalfSize);
722  auto posBeamPipeBounds = std::make_unique<Trk::CylinderVolumeBounds>(m_beamPipeRadius,
723  outerEndcapZHalfSize + innerEndcapZHalfSize);
724  Trk::Volume negbpVol(makeTransform(Amg::getTranslateZ3D(-aLVC.m_outerEndcapZ + innerEndcapZHalfSize + outerEndcapZHalfSize)),
725  negBeamPipeBounds.release());
726  negBeamPipe = processVolume(negbpVol, 1, 1, "Muons::Gaps::NegativeBeamPipe",
727  aLVC, hasStations);
728  Trk::Volume posbpVol(makeTransform(Amg::getTranslateZ3D(aLVC.m_outerEndcapZ - innerEndcapZHalfSize - outerEndcapZHalfSize)),
729  posBeamPipeBounds.release());
730  posBeamPipe = processVolume(posbpVol, 1, 1, "Muons::Gaps::PositiveBeamPipe",
731  aLVC, hasStations);
732 
733  negBeamPipe->registerColorCode(0);
734  posBeamPipe->registerColorCode(0);
735 
736  ATH_MSG_DEBUG( " volumes defined ");
737  //
738  // glue volumes at navigation level, create enveloping volume
739  // radially
740  // central + barrel
741  ATH_MSG_DEBUG( "glue barrel+enclosed volumes");
742  barrel = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(muonBarrel),
744  std::move(central),
746  "All::Container::Barrel");
747  // shield+outerEndcap
748  ATH_MSG_DEBUG( "glue shield+outerEndcap");
749  negOuterEndcap = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(negativeMuonOuterEndcap),
751  std::move(negOuterShield),
753  "Container::NegativeOuterEndcap");
754 
755  posOuterEndcap = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(positiveMuonOuterEndcap),
757  std::move(posOuterShield),
759  "Container::PositiveOuterEndcap");
760 
761  // shield+innerEndcap
762  ATH_MSG_DEBUG( "glue shield+innerEndcap");
763  negInnerEndcap = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(negativeMuonInnerEndcap),
765  std::move(negInnerShield),
767  "Container::NegativeInnerEndcap");
768  // checkVolume(negInnerEndcap);
769  posInnerEndcap = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(positiveMuonInnerEndcap),
771  std::move(posInnerShield),
773  "Container::PositiveInnerEndcap");
774  // checkVolume(posInnerEndcap);
775  // inner+outerEndcap
776  ATH_MSG_DEBUG( "glue inner+outerEndcap");
777  negNavEndcap = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(negOuterEndcap),
779  std::move(negInnerEndcap),
781  "Container::NegativeEndcap");
782 
783  posNavEndcap = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(posInnerEndcap),
785  std::move(posOuterEndcap),
787  "Container::PositiveEndcap");
788 
789  // beam pipe + endcaps
790  ATH_MSG_DEBUG( "glue beamPipe+endcaps");
791  negEndcap = (m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(negNavEndcap),
793  std::move(negBeamPipe),
795  "All::Container::NegativeEndcap"));
796  posEndcap = (m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(posNavEndcap),
798  std::move(posBeamPipe),
800  "All::Container::PositiveEndcap"));
801  // checkVolume(negEndcap);
802  // checkVolume(posEndcap);
803  // barrel + endcaps
804  ATH_MSG_DEBUG( "glue barrel+endcaps");
805 
806  negDet = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(negEndcap),
808  std::move(barrel),
810  "All::Container::NegDet");
811  detector = m_trackingVolumeHelper->glueTrackingVolumeArrays(std::move(posEndcap),
813  std::move(negDet),
815  m_exitVolume);
816  // blend material
818  blendMaterial(aLVC);
819 
820  // tracking geometry
821  auto trackingGeometry = std::make_unique<Trk::TrackingGeometry>(detector.release(), Trk::globalSearch);
822 
823 
824  trackingGeometry->addToGarbage(std::move(stations));
825  trackingGeometry->addToGarbage(std::move(inertObjs));
826 
827  volumeGarbage.push_back(std::move(negativeMuonOuterWheel));
828  volumeGarbage.push_back(std::move(negativeMuonBigWheel));
829  volumeGarbage.push_back(std::move(negativeMuonOuterBuffer));
830  volumeGarbage.push_back(std::move(positiveMuonOuterWheel));
831 
832  volumeGarbage.push_back(std::move(negativeMuonSmallWheel));
833  volumeGarbage.push_back(std::move(positiveMuonSmallWheel));
834  volumeGarbage.push_back(std::move(negativeECT));
835  volumeGarbage.push_back(std::move(positiveECT));
836  volumeGarbage.push_back(std::move(positiveMuonBigWheel));
837 
838  volumeGarbage.push_back(std::move(positiveMuonOuterBuffer));
839  volumeGarbage.push_back(std::move(negDiskShield));
840  volumeGarbage.push_back(std::move(posDiskShield));
841 
842  trackingGeometry->addToGarbage(std::move(volumeGarbage));
843  ATH_MSG_DEBUG( " returning tracking geometry ");
844  ATH_MSG_DEBUG( " with " << aLVC.m_frameNum << " subvolumes at navigation level");
845  ATH_MSG_DEBUG( "( mean number of enclosed detached volumes:" << float(aLVC.m_frameStat) / aLVC.m_frameNum << ")");
846  return trackingGeometry;
847 }
848 
851  double zTol,
852  double phiTol,
853  const LocalVariablesContainer& aLVC) const {
854  VolumeSpanArray spans{};
855 
856  if (objs.empty()) {
857  return spans;
858  }
859 
860  for (const auto& obj : objs) {
861  VolumeSpanPtr span{m_volumeConverter.findVolumeSpan(obj->trackingVolume()->volumeBounds(),
862  obj->trackingVolume()->transform(), zTol, phiTol)};
863  double x0 = obj->trackingVolume()->X0;
864  double intX0 = std::abs(span->zMin - span->zMax) / (x0 + 0.000000001);
865  double l0 = obj->trackingVolume()->L0;
866  ATH_MSG_DEBUG("span:" << obj->name() << "," << span->zMin << ","
867  << span->zMax << "," << span->phiMin << ","
868  << span->phiMax << "," << span->rMin << ","
869  << span->rMax << " X0 " << x0 << " L0 " << l0
870  << " intX0 for span0 span1 " << intX0);
871 
872  int nspans = 0;
873  // negative outer wheel
874  if (span->zMin < -m_bigWheel) {
875  spans[0].emplace_back(obj.get(), span);
876  nspans++;
877  }
878  // negative big wheel
879  if (span->zMin < -aLVC.m_innerEndcapZ && span->zMax > -m_bigWheel) {
880  spans[1].emplace_back(obj.get(), span);
881  nspans++;
882  }
883  // neg.ect
884  if (span->zMin < -m_ectZ && span->zMax > -aLVC.m_innerEndcapZ) {
885  spans[2].emplace_back(obj.get(), span);
886  nspans++;
887  }
888  // neg.small wheel
889  if (span->zMin < -m_diskShieldZ && span->zMax > -m_ectZ) {
890  spans[3].emplace_back(obj.get(), span);
891  nspans++;
892  }
893  // barrel
894  if (span->zMin < m_diskShieldZ && span->zMax > -m_diskShieldZ) {
895  spans[4].emplace_back(obj.get(), span);
896  nspans++;
897  }
898  // pos.small wheel
899  if (span->zMin < m_ectZ && span->zMax > m_diskShieldZ) {
900  spans[5].emplace_back(obj.get(), span);
901  nspans++;
902  }
903  // pos.ect
904  if (span->zMin < aLVC.m_innerEndcapZ && span->zMax > m_ectZ) {
905  spans[6].emplace_back(obj.get(), span);
906  nspans++;
907  }
908  // positive big wheel
909  if (span->zMin < m_bigWheel && span->zMax > aLVC.m_innerEndcapZ) {
910  spans[7].emplace_back(obj.get(), span);
911  nspans++;
912  }
913  // positive outer wheel
914  if (span->zMax > m_bigWheel) {
915  spans[8].emplace_back(obj.get(), span);
916  nspans++;
917  }
918 
919  if (nspans == 0)
920  ATH_MSG_WARNING(" object not selected in span regions "
921  << obj->name());
922  if (nspans > 1)
923  ATH_MSG_VERBOSE(" object selected in " << nspans << " span regions "
924  << obj->name());
925  }
926 
927  return spans;
928 }
929 
931  int etaN, int phiN,
932  const std::string& volumeName,
934  bool hasStations) const {
935  TrackingVolumePtr tVol{};
936 
937  unsigned int colorCode = m_colorCode;
938 
939  std::vector<Trk::DetachedTrackingVolume*> blendVols;
940 
941  // partitions ? include protection against wrong setup
942  if (etaN < 1 || phiN < 1) {
943  ATH_MSG_ERROR( "wrong partition setup");
944  etaN = 1;
945  phiN = 1;
946  }
947  if (etaN * phiN > 1) { // partition
948  auto cyl = dynamic_cast<const Trk::CylinderVolumeBounds*>(&(vol.volumeBounds()));
949  if (!cyl) {
950  ATH_MSG_ERROR(" process volume: volume cylinder boundaries not retrieved, return 0 ");
951  return nullptr;
952  }
953  double phiSect = M_PI / phiN;
954  double etaSect = (cyl->halflengthZ()) / etaN;
955 
956  auto subBds = std::make_unique<Trk::CylinderVolumeBounds>(cyl->innerRadius(), cyl->outerRadius(), phiSect, etaSect);
957  auto protVol = std::make_unique<Trk::Volume>(nullptr, subBds.release());
958 
959  // create subvolumes & BinnedArray
960  std::vector<Trk::TrackingVolumeOrderPosition> subVolumes;
961  std::vector<Trk::TrackingVolume*> sVols; // for gluing
962  std::vector<Trk::TrackingVolume*> sVolsNeg; // for gluing
963  std::vector<Trk::TrackingVolume*> sVolsPos; // for gluing
964  for (int eta = 0; eta < etaN; eta++) {
965  if (colorCode > 0)
966  colorCode = 26 - colorCode;
967  // reference point for the check of envelope
968  double posZ = vol.center().z() + etaSect * (2. * eta + 1. - etaN);
969  double posR = 0.5 * (cyl->innerRadius() + cyl->outerRadius());
970  int geoSignature = 4;
971  // loop over inner cutouts
972  for (unsigned int in = 1; in < aLVC.m_msCutoutsIn.size(); in++) {
973  if (posZ >= aLVC.m_msCutoutsIn[in].second &&
974  posZ <= aLVC.m_msCutoutsIn[in - 1].second) {
975  if (posR < aLVC.m_msCutoutsIn[in].first)
976  geoSignature = 2;
977  break;
978  }
979  }
980  if (geoSignature == 4) {
981  // loop over outer cutouts
982  for (unsigned int io = 1; io < aLVC.m_msCutoutsOut.size();
983  io++) {
984  if (posZ >= aLVC.m_msCutoutsOut[io - 1].second &&
985  posZ <= aLVC.m_msCutoutsOut[io].second) {
986  if (posR > aLVC.m_msCutoutsOut[io].first)
987  geoSignature = 5;
988  break;
989  }
990  }
991  }
992  for (int phi = 0; phi < phiN; phi++) {
993  if (colorCode > 0)
994  colorCode = 26 - colorCode;
995  // define subvolume
996  const Amg::Transform3D transf = Amg::getRotateZ3D(phiSect * (2 * phi + 1)) *
998  auto subVol = std::make_unique<Trk::Volume>(*protVol, transf);
999  // enclosed muon objects ?
1000  std::string volName = volumeName + MuonGM::buildString(eta, 2) +
1001  MuonGM::buildString(phi, 2);
1002  blendVols.clear();
1003  std::vector<Trk::DetachedTrackingVolume*> detVols{};
1004  if (hasStations) {
1005  detVols = getDetachedObjects(*subVol, blendVols, aLVC);
1006  }
1007  auto detVolVecPtr = std::make_unique<std::vector<Trk::DetachedTrackingVolume*>>(detVols);
1008  auto sVol = std::make_unique<Trk::TrackingVolume>(*subVol, aLVC.m_muonMaterial,
1009  detVolVecPtr.release(), volName);
1010  // statistics
1011  ++aLVC.m_frameNum;
1012  aLVC.m_frameStat += detVols.size();
1013  // prepare blending
1014  if (m_blendInertMaterial && !blendVols.empty()) {
1015  for (auto& blendVol : blendVols) {
1016  aLVC.m_blendMap[blendVol].push_back(sVol.get());
1017  }
1018  }
1019  //
1020  if (geoSignature == 2) {
1021  sVol->sign(Trk::BeamPipe);
1022  }
1023  if (geoSignature == 5) {
1024  sVol->sign(Trk::Cavern);
1025  }
1026  sVol->registerColorCode(colorCode);
1027  // reference position
1028  const Amg::Vector3D gp = cyl->outerRadius() *
1029  Amg::Vector3D::UnitX();;
1030  // glue subVolumes
1031  sVols.push_back(sVol.get());
1032  if (eta == 0)
1033  sVolsNeg.push_back(sVol.get());
1034  if (eta == etaN - 1)
1035  sVolsPos.push_back(sVol.get());
1036  // in phi
1037  if (phiN > 1 && phi > 0) {
1038  m_trackingVolumeHelper->glueTrackingVolumes(*sVol,
1040  *sVols[eta * phiN + phi - 1],
1042  if (phi == phiN - 1)
1043  m_trackingVolumeHelper->glueTrackingVolumes(*sVols[eta * phiN],
1045  *sVol,
1047  }
1048  // in eta
1049  if (etaN > 1 && eta > 0)
1050  m_trackingVolumeHelper->glueTrackingVolumes(*sVol,
1052  *sVols[(eta - 1) * phiN + phi],
1054  //
1055  subVolumes.emplace_back(std::move(sVol), transf * gp);
1056  }
1057  }
1058 
1059  Trk::BinUtility buPhi(phiN, -M_PI, M_PI, Trk::closed, Trk::binPhi);
1060  const Amg::Vector3D volCenter{vol.transform().translation()};
1061  const Trk::BinUtility buZ(etaN,
1062  volCenter.z() - cyl->halflengthZ(),
1063  volCenter.z() + cyl->halflengthZ(),
1064  Trk::open, Trk::binZ);
1065  buPhi += buZ;
1066 
1067  auto volBinUtil = std::make_unique<Trk::BinUtility>(buPhi);
1068  auto subVols = std::make_unique<Trk::BinnedArray2D<Trk::TrackingVolume>>(std::move(subVolumes),
1069  volBinUtil.release());
1070 
1071  tVol = std::make_unique<Trk::TrackingVolume>(vol, aLVC.m_muonMaterial, nullptr,
1072  subVols.release(), volumeName);
1073  // register glue volumes
1074  Trk::GlueVolumesDescriptor& volGlueVolumes = tVol->glueVolumesDescriptor();
1075  volGlueVolumes.registerGlueVolumes(Trk::tubeInnerCover, sVols);
1076  volGlueVolumes.registerGlueVolumes(Trk::tubeOuterCover, sVols);
1077  volGlueVolumes.registerGlueVolumes(Trk::negativeFaceXY, sVolsNeg);
1078  volGlueVolumes.registerGlueVolumes(Trk::positiveFaceXY, sVolsPos);
1079 
1080  } else {
1081  // enclosed muon objects ?
1082  blendVols.clear();
1083  std::vector<Trk::DetachedTrackingVolume*> muonObjs{};
1084  if (hasStations) {
1085  muonObjs = getDetachedObjects(vol, blendVols, aLVC);
1086  }
1087  auto muonObjsPtr = std::make_unique<std::vector<Trk::DetachedTrackingVolume*>>(muonObjs);
1088 
1089  tVol = std::make_unique<Trk::TrackingVolume>(vol, aLVC.m_muonMaterial, muonObjsPtr.release(),
1090  volumeName);
1091  // statistics
1092  ++aLVC.m_frameNum;
1093  aLVC.m_frameStat += muonObjs.size();
1094  // prepare blending
1095  if (m_blendInertMaterial && !blendVols.empty()) {
1096  for (auto& blendVol : blendVols) {
1097  aLVC.m_blendMap[blendVol].push_back(tVol.get());
1098  }
1099  }
1100  }
1101 
1102  return tVol;
1103 }
1104 
1106  int mode,
1107  const std::string& volumeName,
1108  LocalVariablesContainer& aLVC,
1109  bool hasStations) const {
1110  ATH_MSG_VERBOSE( "processing volume in mode:" << mode);
1111 
1112  // mode : -1 ( adjusted z/phi partition )
1113  // 0 ( -"- plus barrel H binning )
1114  // 0 ( -"- plus inner endcap H binning )
1115  // 0 ( -"- plus outer endcap H binning )
1116 
1117  TrackingVolumePtr tVol{};
1118 
1119  unsigned int colorCode = m_colorCode;
1120 
1121  std::vector<Trk::DetachedTrackingVolume*> blendVols;
1122 
1123  // getPartitionFromMaterial(vol);
1124 
1125  // retrieve cylinder
1126  auto cyl = dynamic_cast<const Trk::CylinderVolumeBounds*>(&(vol.volumeBounds()));
1127  if (!cyl) {
1128  ATH_MSG_ERROR(" process volume: volume cylinder boundaries not retrieved, return 0 ");
1129  return nullptr;
1130  }
1131  // create vector of zSteps for this volume
1132  std::vector<float> zSteps;
1133  std::vector<int> zTypes;
1134  double zPos = vol.center().z();
1135  double hz = cyl->halflengthZ();
1136  double z1 = zPos - hz;
1137  double z2 = zPos + hz;
1138  zSteps.push_back(z1);
1139  for (unsigned int iz = 0; iz < aLVC.m_zPartitions.size(); iz++) {
1140  if (aLVC.m_zPartitions[iz] == zSteps.front())
1141  zTypes.push_back(aLVC.m_zPartitionsType[iz]);
1142  if (aLVC.m_zPartitions[iz] > z1 && aLVC.m_zPartitions[iz] < z2) {
1143  zSteps.push_back(aLVC.m_zPartitions[iz]);
1144  if (zTypes.empty()) {
1145  if (iz == 0)
1146  zTypes.push_back(0);
1147  else
1148  zTypes.push_back(aLVC.m_zPartitionsType[iz - 1]);
1149  }
1150  zTypes.push_back(aLVC.m_zPartitionsType[iz]);
1151  z1 = aLVC.m_zPartitions[iz];
1152  }
1153  }
1154  zSteps.push_back(z2);
1155 
1156  for (unsigned int iz = 0; iz < zSteps.size(); iz++)
1157  ATH_MSG_DEBUG("z partition in volume:" << volumeName << ":" << iz << ":"
1158  << zSteps[iz]);
1159 
1160  // phi binning
1161  if (std::abs(zPos) > m_barrelZ &&
1162  cyl->outerRadius() < aLVC.m_outerBarrelRadius)
1163  getPhiParts(0, aLVC);
1164  else if (std::abs(zPos) <= m_ectZ)
1165  getPhiParts(2, aLVC);
1166  else if (std::abs(zPos) <= aLVC.m_innerEndcapZ)
1167  getPhiParts(3, aLVC);
1168  else if (std::abs(zPos) > m_outerWheel &&
1169  cyl->outerRadius() > m_outerShieldRadius)
1170  getPhiParts(1, aLVC);
1171  else if (std::abs(zPos) > aLVC.m_innerEndcapZ &&
1172  std::abs(zPos) < m_bigWheel &&
1173  cyl->outerRadius() > m_outerShieldRadius)
1174  getPhiParts(1, aLVC);
1175  else
1176  getPhiParts(0, aLVC);
1177 
1178  // R/H binning ?
1179  unsigned int etaN = zSteps.size() - 1;
1180  unsigned int phiN = aLVC.m_adjustedPhi.size();
1181 
1182  int phiTypeMax = 0; // count different partitions
1183 
1184  if (mode > -1) {
1185  // create z,phi bin utilities
1186  auto zBinUtil = std::make_unique<Trk::BinUtility>(zSteps, Trk::open, Trk::binZ);
1187  auto pBinUtil = std::make_unique<Trk::BinUtility>(aLVC.m_adjustedPhi, Trk::closed, Trk::binPhi);
1188  std::vector<std::vector<std::unique_ptr<Trk::BinUtility>> > hBinUtil{};
1189  for (unsigned iz = 0; iz < zSteps.size() - 1; iz++) {
1190  std::vector<std::unique_ptr<Trk::BinUtility>> phBinUtil{};
1191  for (unsigned ip = 0; ip < aLVC.m_adjustedPhi.size(); ip++) {
1192  // retrieve reference phi
1193  float phiRef = 0.5 * aLVC.m_adjustedPhi[ip];
1194  if (ip < aLVC.m_adjustedPhi.size() - 1)
1195  phiRef += 0.5 * aLVC.m_adjustedPhi[ip + 1];
1196  else
1197  phiRef += 0.5 * aLVC.m_adjustedPhi[0] + M_PI;
1198 
1199  if (aLVC.m_adjustedPhiType[ip] > phiTypeMax)
1200  phiTypeMax = aLVC.m_adjustedPhiType[ip];
1201  for (std::pair<int, float> i :
1202  aLVC.m_hPartitions[mode][zTypes[iz]]
1203  [aLVC.m_adjustedPhiType[ip]]) {
1204  ATH_MSG_VERBOSE(" mode " << mode << " phiRef " << phiRef
1205  << " zTypes[iz] " << zTypes[iz]
1206  << " m_adjustedPhiType[ip] "
1207  << aLVC.m_adjustedPhiType[ip]
1208  << " hPartitions " << i.second);
1209  }
1210  phBinUtil.push_back(std::make_unique<Trk::BinUtility>(phiRef,
1211  aLVC.m_hPartitions[mode][zTypes[iz]][aLVC.m_adjustedPhiType[ip]]));
1212  }
1213  hBinUtil.push_back(std::move(phBinUtil));
1214  }
1215 
1216  // create subvolumes & BinnedArray
1217  std::vector<Trk::TrackingVolumeOrderPosition> subVolumesVect;
1218  std::vector<std::vector<std::vector<Trk::TrackingVolume*>>> subVolumes;
1219  std::vector<std::vector<std::shared_ptr<Trk::BinnedArray<Trk::TrackingVolume> > > >
1220  hBins;
1221  std::vector<Trk::TrackingVolume*> sVolsInn; // for gluing
1222  std::vector<Trk::TrackingVolume*> sVolsOut; // for gluing
1223  std::vector<Trk::TrackingVolume*> sVolsNeg; // for gluing
1224  std::vector<Trk::TrackingVolume*> sVolsPos; // for gluing
1225  for (unsigned int eta = 0; eta < zSteps.size() - 1; eta++) {
1226  if (colorCode > 0) {
1227  colorCode = 6 - colorCode;
1228  }
1229  double posZ = 0.5 * (zSteps[eta] + zSteps[eta + 1]);
1230  double hZ = 0.5 * std::abs(zSteps[eta + 1] - zSteps[eta]);
1231  std::vector<std::vector<Trk::TrackingVolume*> > phiSubs;
1232  std::vector<std::shared_ptr<Trk::BinnedArray<Trk::TrackingVolume>>> phBins;
1233  std::vector<int> phiType(phiTypeMax + 1, -1);
1234  std::vector<std::vector<Trk::Volume*> > garbVol(phiTypeMax + 1);
1235  unsigned int pCode = 1;
1236  for (unsigned int phi = 0; phi < phiN; phi++) {
1237  pCode = (colorCode > 0) ? 3 - pCode : 0;
1238  double posPhi = 0.5 * aLVC.m_adjustedPhi[phi];
1239  double phiSect = 0.;
1240  if (phi < phiN - 1) {
1241  posPhi += 0.5 * aLVC.m_adjustedPhi[phi + 1];
1242  phiSect = 0.5 * std::abs(aLVC.m_adjustedPhi[phi + 1] -
1243  aLVC.m_adjustedPhi[phi]);
1244  } else {
1245  posPhi += 0.5 * aLVC.m_adjustedPhi[0] + M_PI;
1246  phiSect = 0.5 * std::abs(aLVC.m_adjustedPhi[0] + 2 * M_PI -
1247  aLVC.m_adjustedPhi[phi]);
1248  }
1249  std::vector<std::pair<int, float> > hSteps =
1250  aLVC.m_hPartitions[mode][zTypes[eta]]
1251  [aLVC.m_adjustedPhiType[phi]];
1252  std::vector<Trk::TrackingVolume*> hSubs;
1253  std::vector<Trk::TrackingVolumeOrderPosition> hSubsTr;
1254  int phiP = phiType[aLVC.m_adjustedPhiType[phi]];
1255 
1256  unsigned int hCode = 1;
1257  for (unsigned int h = 0; h < hSteps.size() - 1; h++) {
1258  hCode = colorCode > 0 ? 1 - hCode : 0;
1259  // similar volume may exist already
1260  std::unique_ptr<Trk::Volume> subVol{};
1261  const Amg::Transform3D transf = Amg::getRotateZ3D(posPhi) * Amg::getTranslateZ3D(posZ);
1262  //
1263  int volType = 0; // cylinder
1264  if (hSteps[h].first == 1 && hSteps[h + 1].first == 0)
1265  volType = 1;
1266  if (hSteps[h].first == 0 && hSteps[h + 1].first == 1)
1267  volType = 2;
1268  if (hSteps[h].first == 1 && hSteps[h + 1].first == 1)
1269  volType = 3;
1270  // define subvolume
1271  if (phiP > -1) {
1272  subVol = std::make_unique<Trk::Volume>(*phiSubs[phiP][h],
1273  transf *phiSubs[phiP][h]->transform().inverse());
1274  } else if (phiSect < 0.5 * M_PI) {
1275  auto subBds = std::make_unique<Trk::BevelledCylinderVolumeBounds>(hSteps[h].second,
1276  hSteps[h + 1].second,
1277  phiSect,
1278  hZ, volType);
1279  subVol = std::make_unique<Trk::Volume>(makeTransform(transf), subBds.release());
1280  } else {
1281  auto subBds = std::make_unique<Trk::CylinderVolumeBounds>(hSteps[h].second,
1282  hSteps[h + 1].second,
1283  phiSect, hZ);
1284  subVol = std::make_unique<Trk::Volume>(makeTransform(transf), subBds.release());
1285  }
1286 
1287  // enclosed muon objects ? also adjusts material properties
1288  // in case of material blend
1289  std::string volName = volumeName +
1290  MuonGM::buildString(eta, 2) +
1291  MuonGM::buildString(phi, 2) +
1292  MuonGM::buildString(h, 2);
1293  blendVols.clear();
1294  std::vector<Trk::DetachedTrackingVolume*> detVols{};
1295  if (hasStations) {
1296  detVols = getDetachedObjects(*subVol, blendVols, aLVC);
1297  }
1298  auto detVolsPtr = std::make_unique<std::vector<Trk::DetachedTrackingVolume*>>(detVols);
1299  auto sVol = std::make_unique<Trk::TrackingVolume>(*subVol,
1300  aLVC.m_muonMaterial,
1301  detVolsPtr.release(),
1302  volName);
1303 
1304  // statistics
1305  ++aLVC.m_frameNum;
1306  aLVC.m_frameStat += detVols.size();
1307  // prepare blending
1308  if (m_blendInertMaterial && !blendVols.empty()) {
1309  for (auto& blendVol : blendVols) {
1310  aLVC.m_blendMap[blendVol].push_back(sVol.get());
1311  }
1312  }
1313  // reference point for the check of envelope
1314  double posR = 0.5 * (hSteps[h].second + hSteps[h + 1].second);
1315  // loop over inner cutouts
1316  for (unsigned int in = 1; in < aLVC.m_msCutoutsIn.size(); ++in) {
1317  if (posZ >= aLVC.m_msCutoutsIn[in].second &&
1318  posZ <= aLVC.m_msCutoutsIn[in - 1].second) {
1319  if (posR < aLVC.m_msCutoutsIn[in].first) {
1320  sVol->sign(Trk::BeamPipe);
1321  }
1322  break;
1323  }
1324  }
1325  // loop over outer cutouts
1326  for (unsigned int io = 1; io < aLVC.m_msCutoutsOut.size(); ++io) {
1327  if (posZ >= aLVC.m_msCutoutsOut[io - 1].second &&
1328  posZ <= aLVC.m_msCutoutsOut[io].second) {
1329  if (posR > aLVC.m_msCutoutsOut[io].first){
1330  sVol->sign(Trk::Cavern);
1331  }
1332  break;
1333  }
1334  }
1335  //
1336  sVol->registerColorCode(colorCode + pCode + hCode);
1337  // reference position
1338  const Amg::Vector3D gp =
1339  0.5 * (hSteps[h].second + hSteps[h + 1].second) * Amg::Vector3D::UnitX();
1340  hSubs.push_back(sVol.get());
1341 
1342  // glue subVolume
1343  if (h == 0)
1344  sVolsInn.push_back(sVol.get());
1345  if (h == hSteps.size() - 2)
1346  sVolsOut.push_back(sVol.get());
1347  if (eta == 0)
1348  sVolsNeg.push_back(sVol.get());
1349  if (eta == etaN - 1)
1350  sVolsPos.push_back(sVol.get());
1351  // in R/H
1352  if (h > 0) { // glue 'manually'
1353  if (volType == 1 || volType == 3) { // plane surface
1354  m_trackingVolumeHelper->setOutsideTrackingVolume(*sVol,
1356  hSubs[h - 1]);
1357  m_trackingVolumeHelper->setOutsideTrackingVolume(*hSubs[h - 1],
1359  sVol.get());
1360  } else { // cylinder surface
1361  m_trackingVolumeHelper->setInsideTrackingVolume(*sVol,
1363  hSubs[h - 1]);
1364  m_trackingVolumeHelper->setOutsideTrackingVolume(*hSubs[h - 1],
1366  sVol.get());
1367  }
1368  }
1369  // in phi
1370  if (phiN > 1 && phi > 0) {
1371  m_trackingVolumeHelper->setOutsideTrackingVolumeArray(*sVol,
1373  phBins[phi - 1]);
1374  if (phi == phiN - 1){
1375  m_trackingVolumeHelper->setOutsideTrackingVolumeArray(*sVol,
1377  phBins[0]);
1378  }
1379  }
1380  // in eta
1381  if (etaN > 1 && eta > 0) {
1382  m_trackingVolumeHelper->setOutsideTrackingVolumeArray(*sVol,
1384  hBins[eta - 1][phi]);
1385  }
1386  //
1387  subVolumesVect.emplace_back(std::move(sVol), transf * gp);
1388  hSubsTr.emplace_back(subVolumesVect.back());
1389  }
1390  phiSubs.push_back(hSubs);
1391  auto volBinArray = std::make_unique<Trk::BinnedArray1D<Trk::TrackingVolume>>(hSubsTr,
1392  hBinUtil[eta][phi]->clone());
1393  phBins.emplace_back(std::move(volBinArray));
1394  // save link to current partition for cloning
1395  if (phiP < 0)
1396  phiType[aLVC.m_adjustedPhiType[phi]] = phi;
1397 
1398  // finish phi gluing
1399  if (phiN > 1 && phi > 0) {
1400  for (auto& j : phiSubs[phi - 1]) {
1401  m_trackingVolumeHelper->setOutsideTrackingVolumeArray(*j,
1403  phBins[phi]);
1404  }
1405  }
1406  if (phiN > 1 && phi == phiN - 1) {
1407  for (auto& j : phiSubs[0]) {
1408  m_trackingVolumeHelper->setOutsideTrackingVolumeArray(*j,
1410  phBins[phi]);
1411  }
1412  }
1413  // finish eta gluing
1414  if (etaN > 1 && eta > 0) {
1415  for (auto& j: subVolumes[eta - 1][phi]) {
1416  m_trackingVolumeHelper->setOutsideTrackingVolumeArray(*j, Trk::positiveFaceXY,
1417  phBins[phi]);
1418  }
1419  }
1420  }
1421  subVolumes.push_back(phiSubs);
1422  hBins.push_back(phBins);
1423  }
1424 
1425  auto hBinVecPtr = std::make_unique<std::vector<std::vector<Trk::BinUtility*>>>(Muon::release(hBinUtil));
1426  auto subVols = std::make_unique<Trk::BinnedArray1D1D1D<Trk::TrackingVolume>>(subVolumesVect,
1427  zBinUtil.release(),
1428  pBinUtil.release(),
1429  hBinVecPtr.release());
1430 
1431  tVol = std::make_unique<Trk::TrackingVolume>(vol, aLVC.m_muonMaterial, nullptr,
1432  subVols.release(), volumeName);
1433  // register glue volumes
1434  Trk::GlueVolumesDescriptor& volGlueVolumes = tVol->glueVolumesDescriptor();
1435  volGlueVolumes.registerGlueVolumes(Trk::tubeInnerCover, sVolsInn);
1436  volGlueVolumes.registerGlueVolumes(Trk::tubeOuterCover, sVolsOut);
1437  volGlueVolumes.registerGlueVolumes(Trk::negativeFaceXY, sVolsNeg);
1438  volGlueVolumes.registerGlueVolumes(Trk::positiveFaceXY, sVolsPos);
1439 
1440  return tVol;
1441  }
1442 
1443  // proceed with 2D z/phi binning
1444  // partitions ? include protection against wrong setup
1445  if (phiN < 1) {
1446  ATH_MSG_ERROR( "wrong partition setup");
1447  phiN = 1;
1448  } else {
1449  ATH_MSG_VERBOSE("partition setup:(z,phi):" << etaN << "," << phiN);
1450  }
1451 
1452  if (etaN * phiN > 1) { // partition
1453  // subvolume boundaries
1454 
1455  // create subvolumes & BinnedArray
1456  std::vector<Trk::TrackingVolumeOrderPosition> subVolumes(etaN * phiN);
1457  std::vector<Trk::TrackingVolume*> sVols(etaN * phiN); // for gluing
1458  std::vector<Trk::TrackingVolume*> sVolsNeg(phiN); // for gluing
1459  std::vector<Trk::TrackingVolume*> sVolsPos(phiN); // for gluing
1460  for (unsigned int eta = 0; eta < zSteps.size() - 1; ++eta) {
1461  double posZ = 0.5 * (zSteps[eta] + zSteps[eta + 1]);
1462  double hZ = 0.5 * std::abs(zSteps[eta + 1] - zSteps[eta]);
1463  colorCode = 26 - colorCode;
1464  for (unsigned int phi = 0; phi < phiN; phi++) {
1465  colorCode = 26 - colorCode;
1466  double posPhi = 0.5 * aLVC.m_adjustedPhi[phi];
1467  double phiSect = 0.;
1468  if (phi < phiN - 1) {
1469  posPhi += 0.5 * aLVC.m_adjustedPhi[phi + 1];
1470  phiSect = 0.5 * std::abs(aLVC.m_adjustedPhi[phi + 1] -
1471  aLVC.m_adjustedPhi[phi]);
1472  } else {
1473  posPhi += 0.5 * aLVC.m_adjustedPhi[0] + M_PI;
1474  phiSect = 0.5 * std::abs(aLVC.m_adjustedPhi[0] + 2 * M_PI -
1475  aLVC.m_adjustedPhi[phi]);
1476  }
1477  // define subvolume
1478  auto subBds = std::make_unique<Trk::CylinderVolumeBounds>(cyl->innerRadius(), cyl->outerRadius(), phiSect, hZ);
1479  const Amg::Transform3D transf = Amg::getRotateZ3D(posPhi) *
1481  Trk::Volume subVol(makeTransform(transf), subBds.release());
1482  // enclosed muon objects ?
1483  std::string volName = volumeName + MuonGM::buildString(eta, 2) +
1484  MuonGM::buildString(phi, 2);
1485 
1487  blendVols.clear();
1488  std::vector<Trk::DetachedTrackingVolume*> detVols{} ;
1489  if (hasStations) {
1490  detVols = getDetachedObjects(subVol, blendVols, aLVC);
1491  }
1492  auto detVolPtr = std::make_unique<std::vector<Trk::DetachedTrackingVolume*>>(detVols);
1493  auto sVol = std::make_unique<Trk::TrackingVolume>(subVol, aLVC.m_muonMaterial,
1494  detVolPtr.release(),
1495  volName);
1496  // statistics
1497  ++aLVC.m_frameNum;
1498  aLVC.m_frameStat += detVols.size();
1499  // prepare blending
1500  if (m_blendInertMaterial && !blendVols.empty()) {
1501  for (auto& blendVol : blendVols) {
1502  aLVC.m_blendMap[blendVol].push_back(sVol.get());
1503  }
1504  }
1505  // reference point for the check of envelope
1506  double posR = 0.5 * (cyl->innerRadius() + cyl->outerRadius());
1507  // loop over inner cutouts
1508  for (unsigned int in = 1; in < aLVC.m_msCutoutsIn.size(); ++in) {
1509  if (posZ >= aLVC.m_msCutoutsIn[in].second &&
1510  posZ <= aLVC.m_msCutoutsIn[in - 1].second) {
1511  if (posR < aLVC.m_msCutoutsIn[in].first)
1512  sVol->sign(Trk::BeamPipe);
1513  break;
1514  }
1515  }
1516  // loop over outer cutouts
1517  for (unsigned int io = 1; io < aLVC.m_msCutoutsOut.size(); ++io) {
1518  if (posZ >= aLVC.m_msCutoutsOut[io - 1].second &&
1519  posZ <= aLVC.m_msCutoutsOut[io].second) {
1520  if (posR > aLVC.m_msCutoutsOut[io].first)
1521  sVol->sign(Trk::Cavern);
1522  break;
1523  }
1524  }
1525  sVol->registerColorCode(colorCode);
1526  // reference position
1527  const Amg::Vector3D gp = cyl->outerRadius() * Amg::Vector3D::UnitX();
1528  // glue subVolumes
1529  // sVols[phi*etaN+eta] = sVol;
1530  sVols[phiN * eta + phi] = sVol.get();
1531  if (eta == 0){
1532  sVolsNeg[phi] = sVol.get();
1533  }
1534  if (eta == etaN - 1) {
1535  sVolsPos[phi] = sVol.get();
1536  }
1537  // in phi
1538  if (phiN > 1 && phi > 0) {
1539  m_trackingVolumeHelper->glueTrackingVolumes(*sVol,
1541  *sVols[eta * phiN + phi - 1],
1543  if (phi == phiN - 1) {
1544  m_trackingVolumeHelper->glueTrackingVolumes(*sVols[eta * phiN],
1546  *sVol,
1548  }
1549  }
1550  // in eta
1551  if (etaN > 1 && eta > 0) {
1552  m_trackingVolumeHelper->glueTrackingVolumes(*sVol,
1554  *sVols[(eta - 1) * phiN + phi],
1556  }
1557  //
1558  subVolumes[phi * etaN + eta] = std::make_pair(std::move(sVol), transf * gp);
1559 
1560  }
1561  }
1562 
1563  // Trk::BinUtility2DZF* volBinUtil=new
1564  // Trk::BinUtility2DZF(zSteps,m_adjustedPhi,new
1565  // Amg::Transform3D(vol->transform()));
1566  Trk::BinUtility zBinUtil(zSteps, Trk::BinningOption::open,
1568  const Trk::BinUtility pBinUtil(aLVC.m_adjustedPhi,
1571 
1572  zBinUtil += pBinUtil;
1573 
1574  auto volBinUtil = std::make_unique<Trk::BinUtility>(zBinUtil); // TODO verify ordering PhiZ vs. ZPhi
1575 
1576  auto subVols = std::make_unique<Trk::BinnedArray2D<Trk::TrackingVolume>>(subVolumes,
1577  volBinUtil.release());
1578 
1579  tVol = std::make_unique<Trk::TrackingVolume>(vol, aLVC.m_muonMaterial, nullptr,
1580  subVols.release(), volumeName);
1581  // register glue volumes
1582  Trk::GlueVolumesDescriptor& volGlueVolumes = tVol->glueVolumesDescriptor();
1583  volGlueVolumes.registerGlueVolumes(Trk::tubeInnerCover, sVols);
1584  volGlueVolumes.registerGlueVolumes(Trk::tubeOuterCover, sVols);
1585  volGlueVolumes.registerGlueVolumes(Trk::negativeFaceXY, sVolsNeg);
1586  volGlueVolumes.registerGlueVolumes(Trk::positiveFaceXY, sVolsPos);
1587 
1588  } else {
1589  // enclosed muon objects ?
1590  blendVols.clear();
1591  std::vector<Trk::DetachedTrackingVolume*> muonObjs{};
1592  if (hasStations) {
1593  muonObjs = getDetachedObjects(vol, blendVols, aLVC);
1594  }
1595  auto muonObjPtr = std::make_unique<std::vector<Trk::DetachedTrackingVolume*>>(muonObjs);
1596  tVol = std::make_unique<Trk::TrackingVolume>(vol, aLVC.m_muonMaterial,
1597  muonObjPtr.release(),
1598  volumeName);
1599  // statistics
1600  ++aLVC.m_frameNum;
1601  aLVC.m_frameStat += muonObjs.size();
1602  // prepare blending
1603  if (m_blendInertMaterial && !blendVols.empty()) {
1604  for (auto& blendVol : blendVols) {
1605  aLVC.m_blendMap[blendVol].push_back(tVol.get());
1606  }
1607  }
1608  }
1609 
1610  return tVol;
1611 }
1612 
1614  int type,
1615  const std::string& volumeName,
1616  LocalVariablesContainer& aLVC,
1617  bool hasStations) const {
1618  ATH_MSG_VERBOSE( "processing shield volume " << volumeName
1619  << " in mode:" << type);
1620 
1621  TrackingVolumePtr tVol{};
1622 
1623  unsigned int colorCode = m_colorCode;
1624 
1625  std::vector<Trk::DetachedTrackingVolume*> blendVols;
1626 
1627  // getPartitionFromMaterial(vol);
1628 
1629  // retrieve cylinder
1630  auto cyl = dynamic_cast<const Trk::CylinderVolumeBounds*>(&(vol.volumeBounds()));
1631  if (!cyl) {
1632  ATH_MSG_ERROR(" process volume: volume cylinder boundaries not retrieved, return 0 ");
1633  return nullptr;
1634  }
1635  // create vector of zSteps for this volume
1636  std::vector<float> zSteps;
1637  zSteps.clear();
1638  double zPos = vol.center().z();
1639  double hz = cyl->halflengthZ();
1640  double z1 = zPos - hz;
1641  double z2 = zPos + hz;
1642  zSteps.push_back(z1);
1643  for (double iz : aLVC.m_shieldZPart) {
1644  if (iz > z1 && iz < z2) {
1645  zSteps.push_back(iz);
1646  z1 = iz;
1647  }
1648  }
1649  zSteps.push_back(z2);
1650 
1651  // phi binning trivial
1652  aLVC.m_adjustedPhi.clear();
1653  aLVC.m_adjustedPhi.push_back(0.);
1654 
1655  unsigned int etaN = zSteps.size() - 1;
1656 
1657  // create z,h bin utilities
1658  auto zBinUtil = std::make_unique<Trk::BinUtility>(zSteps, Trk::BinningOption::open,
1660  auto pBinUtil = std::make_unique<Trk::BinUtility>(1, -M_PI, M_PI, Trk::BinningOption::closed,
1662  std::vector<std::vector<std::unique_ptr<Trk::BinUtility>> > hBinUtil{};
1663  float phiRef = 0.;
1664  for (unsigned iz = 0; iz < zSteps.size() - 1; iz++) {
1665  std::vector<std::unique_ptr<Trk::BinUtility>> phBinUtil;
1666  phBinUtil.push_back(std::make_unique<Trk::BinUtility>(phiRef, aLVC.m_shieldHPart[type]));
1667  hBinUtil.push_back(std::move(phBinUtil));
1668  }
1669 
1670 
1671  // create subvolumes & BinnedArray
1672  std::vector<Trk::TrackingVolumeOrderPosition> subVolumesVect;
1673  std::vector<std::vector<std::vector<Trk::TrackingVolume*>>> subVolumes;
1674  std::vector<std::vector<std::shared_ptr<Trk::BinnedArray<Trk::TrackingVolume>>>> hBins;
1675  std::vector<Trk::TrackingVolume*> sVolsInn; // for gluing
1676  std::vector<Trk::TrackingVolume*> sVolsOut; // for gluing
1677  std::vector<Trk::TrackingVolume*> sVolsNeg; // for gluing
1678  std::vector<Trk::TrackingVolume*> sVolsPos; // for gluing
1679  for (unsigned int eta = 0; eta < zSteps.size() - 1; eta++) {
1680  if (colorCode > 0)
1681  colorCode = 26 - colorCode;
1682  double posZ = 0.5 * (zSteps[eta] + zSteps[eta + 1]);
1683  double hZ = 0.5 * std::abs(zSteps[eta + 1] - zSteps[eta]);
1684  std::vector<std::vector<Trk::TrackingVolume*> > phiSubs;
1685  std::vector<std::shared_ptr<Trk::BinnedArray<Trk::TrackingVolume>>> phBins{};
1686  int phi = 0;
1687  double posPhi = 0.;
1688  double phiSect = M_PI;
1689  std::vector<std::pair<int, float> > hSteps = aLVC.m_shieldHPart[type];
1690  std::vector<Trk::TrackingVolume*> hSubs;
1691  std::vector<Trk::TrackingVolumeOrderPosition> hSubsTr;
1692  unsigned int hCode = 1;
1693  for (unsigned int h = 0; h < hSteps.size() - 1; h++) {
1694  hCode = (colorCode > 0) ? 1 - hCode : 0;
1695  // define subvolume
1696  auto subBds = std::make_unique<Trk::CylinderVolumeBounds>(hSteps[h].second, hSteps[h + 1].second, phiSect, hZ);
1697  const double mediumRadius = subBds->mediumRadius();
1699  Trk::Volume subVol(makeTransform(transf), subBds.release());
1700 
1701  // enclosed muon objects ? also adjusts material properties in case
1702  // of material blend
1703  std::string volName = volumeName + MuonGM::buildString(eta, 2) +
1704  MuonGM::buildString(phi, 2) +
1705  MuonGM::buildString(h, 2);
1706  blendVols.clear();
1707  std::vector<Trk::DetachedTrackingVolume*> detVols{};
1708  if (hasStations) {
1709  detVols = getDetachedObjects(subVol, blendVols, aLVC);
1710  }
1711  auto detVolPtr = std::make_unique<std::vector<Trk::DetachedTrackingVolume*>>(detVols);
1712  auto sVol = std::make_unique<Trk::TrackingVolume>(subVol, aLVC.m_muonMaterial,
1713  detVolPtr.release(), volName);
1714 
1715  // statistics
1716  ++aLVC.m_frameNum;
1717  aLVC.m_frameStat += detVols.size();
1718  // prepare blending
1719  if (m_blendInertMaterial && !blendVols.empty()) {
1720  for (auto& blendVol : blendVols) {
1721  aLVC.m_blendMap[blendVol].push_back(sVol.get());
1722  }
1723  }
1724  // reference point for the check of envelope
1725  double posR = 0.5 * (hSteps[h].second + hSteps[h + 1].second);
1726  // loop over inner cutouts
1727  for (unsigned int in = 1; in < aLVC.m_msCutoutsIn.size(); in++) {
1728  if (posZ >= aLVC.m_msCutoutsIn[in].second &&
1729  posZ <= aLVC.m_msCutoutsIn[in - 1].second) {
1730  if (posR < aLVC.m_msCutoutsIn[in].first)
1731  sVol->sign(Trk::BeamPipe);
1732  break;
1733  }
1734  }
1735  //
1736  sVol->registerColorCode(colorCode + hCode);
1737  // reference position
1738  const Amg::Vector3D gp = mediumRadius * Amg::Vector3D::UnitX();
1739  hSubs.push_back(sVol.get());
1740 
1741  // glue subVolume
1742  if (h == 0)
1743  sVolsInn.push_back(sVol.get());
1744  if (h == hSteps.size() - 2)
1745  sVolsOut.push_back(sVol.get());
1746  if (eta == 0)
1747  sVolsNeg.push_back(sVol.get());
1748  if (eta == etaN - 1)
1749  sVolsPos.push_back(sVol.get());
1750  // in R/H
1751  if (h > 0) { // glue 'manually'
1752  m_trackingVolumeHelper->setInsideTrackingVolume(*sVol,
1754  hSubs[h - 1]);
1755  m_trackingVolumeHelper->setOutsideTrackingVolume(*hSubs[h - 1],
1757  sVol.get());
1758  }
1759  // in eta
1760  if (etaN > 1 && eta > 0)
1761  m_trackingVolumeHelper->setOutsideTrackingVolumeArray(*sVol,
1763  hBins[eta - 1][phi]);
1764 
1765  subVolumesVect.emplace_back(std::move(sVol), transf * gp);
1766  hSubsTr.emplace_back(subVolumesVect.back());
1767 
1768  }
1769  phiSubs.push_back(hSubs);
1771  auto volBinArray = std::make_unique<Trk::BinnedArray1D<Trk::TrackingVolume>>(hSubsTr, hBinUtil[eta][phi]->clone());
1772  phBins.push_back(std::move(volBinArray));
1773 
1774  // finish eta gluing
1775  if (etaN > 1 && eta > 0) {
1776  for (auto& j : subVolumes[eta - 1][phi]) {
1777  m_trackingVolumeHelper->setOutsideTrackingVolumeArray(*j,
1779  phBins[phi]);
1780  }
1781  }
1782  subVolumes.push_back(phiSubs);
1783  hBins.push_back(phBins);
1784  }
1785 
1786  auto hBinVecPtr = std::make_unique<std::vector<std::vector<Trk::BinUtility*>>>(Muon::release(hBinUtil));
1787  auto subVols = std::make_unique<Trk::BinnedArray1D1D1D<Trk::TrackingVolume>>(subVolumesVect,
1788  zBinUtil.release(),
1789  pBinUtil.release(),
1790  hBinVecPtr.release());
1791 
1792  tVol = std::make_unique<Trk::TrackingVolume>(vol, aLVC.m_muonMaterial, nullptr,
1793  subVols.release(), volumeName);
1794  // register glue volumes
1795  Trk::GlueVolumesDescriptor& volGlueVolumes = tVol->glueVolumesDescriptor();
1796  volGlueVolumes.registerGlueVolumes(Trk::tubeInnerCover, sVolsInn);
1797  volGlueVolumes.registerGlueVolumes(Trk::tubeOuterCover, sVolsOut);
1798  volGlueVolumes.registerGlueVolumes(Trk::negativeFaceXY, sVolsNeg);
1799  volGlueVolumes.registerGlueVolumes(Trk::positiveFaceXY, sVolsPos);
1800 
1801  return tVol;
1802 }
1803 
1804 std::vector<Trk::DetachedTrackingVolume*>
1806  std::vector<Trk::DetachedTrackingVolume*>& blendVols,
1807  LocalVariablesContainer& aLVC,
1808  int mode) const {
1809  // mode : 0 all, 1 active only, 2 inert only
1810 
1811  std::vector<Trk::DetachedTrackingVolume*> detTVs{};
1812 
1813  // get min/max Z/Phi from volume (allways a cylinder/bevelled cylinder
1814  // volume )
1815  auto cyl = dynamic_cast<const Trk::CylinderVolumeBounds*>(&(vol.volumeBounds()));
1816  auto bcyl = dynamic_cast<const Trk::BevelledCylinderVolumeBounds*>(&(vol.volumeBounds()));
1817 
1818  double rmed{0.}, dphi{0.}, hz{0.}, rMin{0.}, rMax{0.}, rMaxc{0.};
1819  int type = 0;
1820  if (cyl) {
1821  rmed = cyl->mediumRadius();
1822  dphi = cyl->halfPhiSector();
1823  hz = cyl->halflengthZ();
1824  rMin = cyl->innerRadius();
1825  rMax = cyl->outerRadius();
1826  rMaxc = rMax;
1827  } else if (bcyl) {
1828  rmed = bcyl->mediumRadius();
1829  dphi = bcyl->halfPhiSector();
1830  hz = bcyl->halflengthZ();
1831  rMin = bcyl->innerRadius();
1832  rMax = bcyl->outerRadius();
1833  rMaxc = rMax;
1834  type = bcyl->type();
1835  if (type > 1)
1836  rMaxc *= 1. / cos(dphi);
1837  } else {
1838  return detTVs;
1839  }
1840  const Amg::Vector3D center = vol.transform() * (rmed *Amg::Vector3D::UnitX());
1841 
1842  double zMin = center[2] - hz;
1843  double zMax = center[2] + hz;
1844  double pMin = 0.;
1845  double pMax = +2 * M_PI;
1846  bool phiLim = false;
1847  if (dphi < M_PI) {
1848  pMin = center.phi() - dphi + M_PI;
1849  pMax = center.phi() + dphi + M_PI;
1850  phiLim = true;
1851  }
1852 
1853  ATH_MSG_VERBOSE(" zMin " << zMin << " zMax " << zMax << " rMin " << rMin
1854  << " rMax " << rMax << " rMaxc " << rMaxc
1855  << " phi limits " << pMin << " phiMax " << pMax
1856  << " phiLim " << phiLim);
1857 
1858  // define detector region : can extend over several
1859  int gMin = (zMax <= -m_bigWheel) ? 0 : 1;
1860  if (zMin >= m_bigWheel)
1861  gMin = 8;
1862  else if (zMin >= aLVC.m_innerEndcapZ)
1863  gMin = 7;
1864  else if (zMin >= m_ectZ)
1865  gMin = 6;
1866  else if (zMin >= m_diskShieldZ)
1867  gMin = 5;
1868  else if (zMin >= -m_diskShieldZ)
1869  gMin = 4;
1870  else if (zMin >= -m_ectZ)
1871  gMin = 3;
1872  else if (zMin >= -aLVC.m_innerEndcapZ)
1873  gMin = 2;
1874  int gMax = (zMax >= m_bigWheel) ? 8 : 7;
1875  if (zMax <= -m_bigWheel)
1876  gMax = 0;
1877  else if (zMax <= -aLVC.m_innerEndcapZ)
1878  gMax = 1;
1879  else if (zMax <= -m_ectZ)
1880  gMax = 2;
1881  else if (zMax <= -m_diskShieldZ)
1882  gMax = 3;
1883  else if (zMax <= m_diskShieldZ)
1884  gMax = 4;
1885  else if (zMax <= m_ectZ)
1886  gMax = 5;
1887  else if (zMax <= aLVC.m_innerEndcapZ)
1888  gMax = 6;
1889 
1890  ATH_MSG_VERBOSE(" active volumes gMin " << gMin << " gMax " << gMax);
1891 
1892  // active, use corrected rMax
1893  if (mode < 2 && aLVC.m_stationSpan.size()) {
1894  for (int gMode = gMin; gMode <= gMax; gMode++) {
1895  for (const auto&[station, s] : (aLVC.m_stationSpan)[gMode]) {
1896  bool rLimit = !aLVC.m_static3d || (s->rMin <= rMaxc && s->rMax >= rMin);
1897  // Check meanZ for BME stations
1898  bool meanZOK = false;
1899  if (station->name() == "BME1_Station" ||
1900  station->name() == "BME2_Station") {
1901  if ((s->zMin + s->zMax) / 2. < zMax &&
1902  (s->zMin + s->zMax) / 2. > zMin)
1903  meanZOK = true;
1904  if ((s->phiMin + s->phiMax) / 2 < pMin && phiLim)
1905  meanZOK = false;
1906  // if ((s->phiMin + s->phiMax) / 2 < pMin && phiLim)
1907  // meanZOK = false;
1908  }
1909  if (rLimit &&
1910  ((s->zMin < zMax && s->zMax > zMin) || meanZOK)) {
1911  bool accepted = false;
1912  if (phiLim) {
1913  if (pMin >= 0 && pMax <= 2 * M_PI) {
1914  if (s->phiMin <= s->phiMax &&
1915  s->phiMin <= pMax && s->phiMax >= pMin)
1916  accepted = true;
1917  if (s->phiMin > s->phiMax &&
1918  (s->phiMin <= pMax || s->phiMax >= pMin))
1919  accepted = true;
1920  } else if (pMin < 0) {
1921  if (s->phiMin <= s->phiMax &&
1922  (s->phiMin <= pMax ||
1923  s->phiMax >= pMin + 2 * M_PI))
1924  accepted = true;
1925  if (s->phiMin > s->phiMax)
1926  accepted = true;
1927  } else if (pMax > 2 * M_PI) {
1928  if (s->phiMin <= s->phiMax &&
1929  (s->phiMin <= pMax - 2 * M_PI ||
1930  s->phiMax >= pMin))
1931  accepted = true;
1932  if (s->phiMin > s->phiMax)
1933  accepted = true;
1934  }
1935  } else
1936  accepted = true;
1937  if (meanZOK)
1938  accepted = true;
1939  if (accepted) {
1940  detTVs.push_back(station);
1941  ATH_MSG_VERBOSE(" active volume accepted by rLimit "
1942  << station->name() << " zMin " << zMin
1943  << " zMax " << zMax << " rMin " << rMin
1944  << " rMax " << rMax << " PhiMin "
1945  << pMin << " PhiMax " << pMax);
1946  }
1947  }
1948  }
1949  }
1950  }
1951  // passive
1952  if (mode != 1 && aLVC.m_inertSpan.size()) {
1953  for (int gMode = gMin; gMode <= gMax; gMode++) {
1954  for (const auto& [inert, s]: (aLVC.m_inertSpan)[gMode]) {
1955  bool rLimit = (!aLVC.m_static3d ||
1956  (s->rMin <= rMaxc && s->rMax >= rMin));
1957  if (rLimit && s->zMin < zMax && s->zMax > zMin) {
1958  bool accepted = false;
1959  if (phiLim) {
1960  if (pMin >= 0 && pMax <= 2 * M_PI) {
1961  if (s->phiMin <= s->phiMax &&
1962  s->phiMin <= pMax && s->phiMax >= pMin)
1963  accepted = true;
1964  if (s->phiMin > s->phiMax &&
1965  (s->phiMin <= pMax || s->phiMax >= pMin))
1966  accepted = true;
1967  } else if (pMin < 0) {
1968  if (s->phiMin <= s->phiMax &&
1969  (s->phiMin <= pMax ||
1970  s->phiMax >= pMin + 2 * M_PI))
1971  accepted = true;
1972  if (s->phiMin > s->phiMax)
1973  accepted = true;
1974  } else if (pMax > 2 * M_PI) {
1975  if (s->phiMin <= s->phiMax &&
1976  (s->phiMin <= pMax - 2 * M_PI ||
1977  s->phiMax >= pMin))
1978  accepted = true;
1979  if (s->phiMin > s->phiMax)
1980  accepted = true;
1981  }
1982  } else
1983  accepted = true;
1984  if (accepted) {
1985  bool perm =
1986  inert->name().compare(inert->name().size() - 4, 4,
1987  "PERM") == 0;
1988  if (!m_blendInertMaterial || !m_removeBlended || perm)
1989  detTVs.push_back(inert);
1990  if (m_blendInertMaterial && !perm)
1991  blendVols.push_back(inert);
1992  ATH_MSG_VERBOSE(" Inert volume accepted by rLimit "
1993  << inert->name() << " zMin " << zMin
1994  << " zMax " << zMax << " rMin " << rMin
1995  << " rMax " << rMax << " PhiMin "
1996  << pMin << " PhiMax " << pMax);
1997  }
1998  }
1999  }
2000  }
2001  }
2002  return detTVs;
2003 }
2004 
2006  const Trk::VolumeSpan& span,
2007  LocalVariablesContainer& aLVC) const {
2008  bool encl = false;
2009  constexpr double tol = 1.;
2010  constexpr double ptol = 0.11; // 0.08 for BT, 0.11 feet
2011 
2012  // get min/max Z/Phi from volume (allways a cylinder/bevelled cylinder
2013  // volume )
2014  auto cyl = dynamic_cast<const Trk::CylinderVolumeBounds*>(&(vol.volumeBounds()));
2015  auto bcyl =dynamic_cast<const Trk::BevelledCylinderVolumeBounds*>(&(vol.volumeBounds()));
2016 
2017  double rmed{0.}, dphi{0.}, hz{0.}, rMin{0.}, rMax{0.};
2018  if (cyl) {
2019  rmed = cyl->mediumRadius();
2020  dphi = cyl->halfPhiSector();
2021  hz = cyl->halflengthZ();
2022  rMin = cyl->innerRadius();
2023  rMax = cyl->outerRadius();
2024  } else if (bcyl) {
2025  rmed = bcyl->mediumRadius();
2026  dphi = bcyl->halfPhiSector();
2027  hz = bcyl->halflengthZ();
2028  rMin = bcyl->innerRadius();
2029  rMax = bcyl->outerRadius();
2030  } else
2031  return false;
2032 
2033  const Amg::Vector3D center = vol.transform() * (rmed* Amg::Vector3D::UnitX());
2034 
2035  double zMin = center[2] - hz;
2036  double zMax = center[2] + hz;
2037  double pMin = 0.;
2038  double pMax = +2 * M_PI;
2039  bool phiLim = false;
2040  if (dphi < M_PI) {
2041  pMin = center.phi() - dphi + M_PI;
2042  pMax = center.phi() + dphi + M_PI;
2043  phiLim = true;
2044  }
2045  //
2046  ATH_MSG_VERBOSE("enclosing volume:z:" << zMin << "," << zMax
2047  << ":r:" << rMin << "," << rMax
2048  << ":phi:" << pMin << "," << pMax);
2049  //
2050  bool rLimit = (!aLVC.m_static3d ||
2051  (span.rMin < rMax - tol && span.rMax > rMin + tol));
2052  if (rLimit && span.zMin < zMax - tol && span.zMax > zMin + tol) {
2053  if (phiLim) {
2054  if (pMin >= 0 && pMax <= 2 * M_PI) {
2055  if (span.phiMin <= span.phiMax && span.phiMin < pMax + ptol &&
2056  span.phiMax > pMin - ptol)
2057  return true;
2058  if (span.phiMin > span.phiMax &&
2059  (span.phiMin < pMax - ptol || span.phiMax > pMin + ptol))
2060  return true;
2061  } else if (pMin < 0) {
2062  if (span.phiMin <= span.phiMax &&
2063  (span.phiMin < pMax + ptol ||
2064  span.phiMax > pMin - ptol + 2 * M_PI))
2065  return true;
2066  if (span.phiMin > span.phiMax)
2067  return true;
2068  } else if (pMax > 2 * M_PI) {
2069  if (span.phiMin <= span.phiMax &&
2070  (span.phiMin < pMax + ptol - 2 * M_PI ||
2071  span.phiMax > pMin - ptol))
2072  return true;
2073  if (span.phiMin > span.phiMax)
2074  return true;
2075  }
2076  } else {
2077  return true;
2078  }
2079  }
2080  return encl;
2081 }
2083  LocalVariablesContainer& aLVC) const {
2084  // activeAdjustLevel: 1: separate MDT stations
2085  // +(inertLevel=0) barrel Z partition
2086  // 2: split TGC
2087  // +(inertLevel=0) barrel R partition
2088  // 3: split TGC supports
2089  // inertAdjustLevel: 1: BT,ECT
2090 
2091  // hardcode for the moment
2092  aLVC.m_zPartitions.clear();
2093  aLVC.m_zPartitionsType.clear();
2094  aLVC.m_zPartitions.reserve(120);
2095  aLVC.m_zPartitionsType.reserve(120);
2096 
2097  // outer endcap
2098  aLVC.m_zPartitions.push_back(-aLVC.m_outerEndcapZ);
2099  aLVC.m_zPartitionsType.push_back(1); // EO
2100  aLVC.m_zPartitions.push_back(-23001.);
2101  aLVC.m_zPartitionsType.push_back(1); // oute envelope change
2102  // if (m_activeAdjustLevel>0) { m_zPartitions.push_back(-21630.);
2103  // m_zPartitionsType.push_back(1); } // EOL
2104  aLVC.m_zPartitions.push_back(-22030.);
2105  aLVC.m_zPartitionsType.push_back(1); // EOL
2106  aLVC.m_zPartitions.push_back(-m_outerWheel);
2107  aLVC.m_zPartitionsType.push_back(0); // Octogon
2108  // m_zPartitions.push_back(-17990.); m_zPartitionsType.push_back(0); //
2109  // buffer
2110  aLVC.m_zPartitions.push_back(-18650.);
2111  aLVC.m_zPartitionsType.push_back(0); // buffer
2112  aLVC.m_zPartitions.push_back(-m_bigWheel);
2113  aLVC.m_zPartitionsType.push_back(1); // TGC3
2114  if (m_activeAdjustLevel > 2) {
2115  aLVC.m_zPartitions.push_back(-15225.);
2116  aLVC.m_zPartitionsType.push_back(1);
2117  }
2118  if (m_activeAdjustLevel > 1) {
2119  aLVC.m_zPartitions.push_back(-15172.);
2120  aLVC.m_zPartitionsType.push_back(1);
2121  } // end supp
2122  if (m_activeAdjustLevel > 2) {
2123  aLVC.m_zPartitions.push_back(-15128.);
2124  aLVC.m_zPartitionsType.push_back(1);
2125  } // supp
2126  if (m_activeAdjustLevel > 2) {
2127  aLVC.m_zPartitions.push_back(-15070.);
2128  aLVC.m_zPartitionsType.push_back(1);
2129  }
2130  if (m_activeAdjustLevel > 0) {
2131  aLVC.m_zPartitions.push_back(-14940.);
2132  aLVC.m_zPartitionsType.push_back(1);
2133  } //
2134  if (m_activeAdjustLevel > 2) {
2135  aLVC.m_zPartitions.push_back(-14805.);
2136  aLVC.m_zPartitionsType.push_back(1);
2137  }
2138  if (m_activeAdjustLevel > 1) {
2139  aLVC.m_zPartitions.push_back(-14733.);
2140  aLVC.m_zPartitionsType.push_back(1);
2141  } // end supp.
2142  if (m_activeAdjustLevel > 2) {
2143  aLVC.m_zPartitions.push_back(-14708.);
2144  aLVC.m_zPartitionsType.push_back(1);
2145  } // supp.
2146  if (m_activeAdjustLevel > 2) {
2147  aLVC.m_zPartitions.push_back(-14650.);
2148  aLVC.m_zPartitionsType.push_back(1);
2149  } //
2150  if (m_activeAdjustLevel > 0) {
2151  aLVC.m_zPartitions.push_back(-14560.);
2152  aLVC.m_zPartitionsType.push_back(1);
2153  } // EML
2154  if (m_activeAdjustLevel > 0) {
2155  aLVC.m_zPartitions.push_back(-14080.);
2156  aLVC.m_zPartitionsType.push_back(1);
2157  } // EMS
2158  if (m_activeAdjustLevel > 0) {
2159  aLVC.m_zPartitions.push_back(-13620.);
2160  aLVC.m_zPartitionsType.push_back(1);
2161  } // TGC
2162  if (m_activeAdjustLevel > 2) {
2163  aLVC.m_zPartitions.push_back(-13525.);
2164  aLVC.m_zPartitionsType.push_back(1);
2165  } // TGC
2166  if (m_activeAdjustLevel > 1) {
2167  aLVC.m_zPartitions.push_back(-13448.5);
2168  aLVC.m_zPartitionsType.push_back(1);
2169  } // end supp.
2170  if (m_activeAdjustLevel > 2) {
2171  aLVC.m_zPartitions.push_back(-13421.5);
2172  aLVC.m_zPartitionsType.push_back(1);
2173  } // supp.
2174  if (m_activeAdjustLevel > 2) {
2175  aLVC.m_zPartitions.push_back(-13346);
2176  aLVC.m_zPartitionsType.push_back(1);
2177  } // TGC
2178 
2179  // inner endcap
2180  aLVC.m_zPartitions.push_back(-aLVC.m_innerEndcapZ);
2181  aLVC.m_zPartitionsType.push_back(0); //
2182  if (m_inertAdjustLevel > 0) {
2183  aLVC.m_zPartitions.push_back(-12790);
2184  aLVC.m_zPartitionsType.push_back(0);
2185  } // ECT
2186  if (m_inertAdjustLevel > 1) {
2187  aLVC.m_zPartitions.push_back(-12100.);
2188  aLVC.m_zPartitionsType.push_back(0);
2189  } //
2190  if (m_inertAdjustLevel > 0) {
2191  aLVC.m_zPartitions.push_back(-12000.);
2192  aLVC.m_zPartitionsType.push_back(0);
2193  } //
2194  if (m_inertAdjustLevel > 0) {
2195  aLVC.m_zPartitions.push_back(-11210.);
2196  aLVC.m_zPartitionsType.push_back(1);
2197  } // BT
2198  if (m_inertAdjustLevel > 0) {
2199  aLVC.m_zPartitions.push_back(-10480.);
2200  aLVC.m_zPartitionsType.push_back(0);
2201  } //
2202  if (m_inertAdjustLevel > 0) {
2203  aLVC.m_zPartitions.push_back(-9700.);
2204  aLVC.m_zPartitionsType.push_back(0);
2205  } //
2206  if (m_inertAdjustLevel > 1) {
2207  aLVC.m_zPartitions.push_back(-9300.);
2208  aLVC.m_zPartitionsType.push_back(0);
2209  } // rib
2210  if (m_inertAdjustLevel > 1) {
2211  aLVC.m_zPartitions.push_back(-8800.);
2212  aLVC.m_zPartitionsType.push_back(0);
2213  } // ect
2214  if (m_inertAdjustLevel > 0) {
2215  aLVC.m_zPartitions.push_back(-8610.);
2216  aLVC.m_zPartitionsType.push_back(1);
2217  } // BT
2218  if (m_inertAdjustLevel > 0) {
2219  aLVC.m_zPartitions.push_back(-8000.);
2220  aLVC.m_zPartitionsType.push_back(1);
2221  } // BT
2222  aLVC.m_zPartitions.push_back(-m_ectZ);
2223  aLVC.m_zPartitionsType.push_back(0); // ECT/small wheel
2224  if (m_activeAdjustLevel > 0) {
2225  aLVC.m_zPartitions.push_back(-7450.);
2226  aLVC.m_zPartitionsType.push_back(0);
2227  } // EIS
2228  if (m_activeAdjustLevel > 2) {
2229  aLVC.m_zPartitions.push_back(-7364.);
2230  aLVC.m_zPartitionsType.push_back(0);
2231  } // EIS
2232  if (m_activeAdjustLevel > 0 || m_inertAdjustLevel > 0) {
2233  aLVC.m_zPartitions.push_back(-7170.);
2234  aLVC.m_zPartitionsType.push_back(0);
2235  } // cone assembly,TGC
2236  if (m_activeAdjustLevel > 0) {
2237  aLVC.m_zPartitions.push_back(-7030.);
2238  aLVC.m_zPartitionsType.push_back(0);
2239  } // TGC
2240  if (m_activeAdjustLevel > 2) {
2241  aLVC.m_zPartitions.push_back(-6978.);
2242  aLVC.m_zPartitionsType.push_back(0);
2243  } // TGC
2244 
2245  // barrel
2246  aLVC.m_zPartitions.push_back(-m_diskShieldZ);
2247  aLVC.m_zPartitionsType.push_back(0); // disk
2248  if (m_inertAdjustLevel > 0) {
2249  aLVC.m_zPartitions.push_back(-6829.);
2250  aLVC.m_zPartitionsType.push_back(0);
2251  } // back disk
2252  // if (m_inertAdjustLevel>1) { (*m_zPartitions).push_back(-6600.);
2253  // m_zPartitionsType.push_back(0); } //
2254  aLVC.m_zPartitions.push_back(-6550.);
2255  aLVC.m_zPartitionsType.push_back(0); // outer envelope change
2256  if (m_activeAdjustLevel > 0) {
2257  aLVC.m_zPartitions.push_back(-6100.);
2258  aLVC.m_zPartitionsType.push_back(0);
2259  }
2260  if (m_inertAdjustLevel > 0) {
2261  aLVC.m_zPartitions.push_back(-5503.);
2262  aLVC.m_zPartitionsType.push_back(1);
2263  } // BT
2264  if (m_inertAdjustLevel > 0) {
2265  aLVC.m_zPartitions.push_back(-4772.);
2266  aLVC.m_zPartitionsType.push_back(0);
2267  } //
2268  if (m_activeAdjustLevel > 0) {
2269  aLVC.m_zPartitions.push_back(-4300.);
2270  aLVC.m_zPartitionsType.push_back(0);
2271  } //
2272  aLVC.m_zPartitions.push_back(-4000.);
2273  aLVC.m_zPartitionsType.push_back(0); // outer envelope change
2274  if (m_inertAdjustLevel > 1) {
2275  aLVC.m_zPartitions.push_back(-3700.);
2276  aLVC.m_zPartitionsType.push_back(0);
2277  } //
2278  if (m_inertAdjustLevel > 1) {
2279  aLVC.m_zPartitions.push_back(-3300.);
2280  aLVC.m_zPartitionsType.push_back(0);
2281  } //
2282  if (m_activeAdjustLevel > 0) {
2283  aLVC.m_zPartitions.push_back(-2600.);
2284  aLVC.m_zPartitionsType.push_back(0);
2285  } //
2286  if (m_inertAdjustLevel > 0) {
2287  aLVC.m_zPartitions.push_back(-2078.);
2288  aLVC.m_zPartitionsType.push_back(1);
2289  } // BT
2290  if (m_inertAdjustLevel > 0) {
2291  aLVC.m_zPartitions.push_back(-1347.);
2292  aLVC.m_zPartitionsType.push_back(1);
2293  } // cryoring
2294  if (m_activeAdjustLevel > 0) {
2295  aLVC.m_zPartitions.push_back(-800.);
2296  aLVC.m_zPartitionsType.push_back(1);
2297  } // cryoring
2298  if (m_inertAdjustLevel > 1) {
2299  aLVC.m_zPartitions.push_back(-300.);
2300  aLVC.m_zPartitionsType.push_back(0);
2301  } //
2302  if (static_cast<int>(m_inertAdjustLevel) +
2303  static_cast<int>(m_activeAdjustLevel) <
2304  1) {
2305  aLVC.m_zPartitions.push_back(-0.7 * m_diskShieldZ);
2306  aLVC.m_zPartitionsType.push_back(0);
2307  } //
2308 
2309  unsigned int zSiz = aLVC.m_zPartitions.size();
2310  for (unsigned int i = 0; i < zSiz; i++) {
2311  aLVC.m_zPartitions.push_back(-aLVC.m_zPartitions[zSiz - 1 - i]);
2312  if (i < zSiz - 1)
2313  aLVC.m_zPartitionsType.push_back(
2314  aLVC.m_zPartitionsType[zSiz - 2 - i]);
2315  }
2316 }
2317 
2319  int mode, LocalVariablesContainer& aLVC) const {
2320  if (mode == 0) { // trivial
2321  aLVC.m_adjustedPhi.clear();
2322  aLVC.m_adjustedPhiType.clear();
2323  aLVC.m_adjustedPhi.push_back(0.);
2324  aLVC.m_adjustedPhiType.push_back(0);
2325 
2326  } else if (mode == 1) {
2327  int phiNum = 1;
2328  if (m_activeAdjustLevel > 0)
2329  phiNum = m_phiPartition;
2330  aLVC.m_adjustedPhi.resize(phiNum);
2331  aLVC.m_adjustedPhiType.resize(phiNum);
2332  aLVC.m_adjustedPhi[0] = 0.;
2333  aLVC.m_adjustedPhiType[0] = 0;
2334  int ic = 0;
2335  while (ic < phiNum - 1) {
2336  ic++;
2337  aLVC.m_adjustedPhi[ic] =
2338  aLVC.m_adjustedPhi[ic - 1] + 2. * M_PI / phiNum;
2339  aLVC.m_adjustedPhiType[ic] = 0;
2340  }
2341 
2342  } else if (mode == 2) { // barrel(BT)
2343  // hardcode for the moment
2344  aLVC.m_adjustedPhi.resize(16);
2345  aLVC.m_adjustedPhiType.resize(16);
2346 
2347  double phiSect[2];
2348  phiSect[0] = (M_PI / 8 - 0.105);
2349  phiSect[1] = 0.105;
2350 
2351  aLVC.m_adjustedPhi[0] = -phiSect[0];
2352  aLVC.m_adjustedPhiType[0] = 0;
2353  int ic = 0;
2354  int is = 1;
2355 
2356  while (ic < 15) {
2357  ic++;
2358  is = 1 - is;
2359  aLVC.m_adjustedPhi[ic] =
2360  aLVC.m_adjustedPhi[ic - 1] + 2 * phiSect[is];
2361  aLVC.m_adjustedPhiType[ic] = 1 - is;
2362  }
2363 
2364  } else if (mode == 3) { // ECT(+BT)
2365  // hardcode for the moment
2366  aLVC.m_adjustedPhi.resize(32);
2367  aLVC.m_adjustedPhiType.resize(32);
2368 
2369  double phiSect[3];
2370  phiSect[0] = 0.126;
2371  phiSect[2] = 0.105;
2372  phiSect[1] = 0.5 * (M_PI / 8. - phiSect[0] - phiSect[2]);
2373 
2374  aLVC.m_adjustedPhi[0] = -phiSect[0];
2375  aLVC.m_adjustedPhiType[0] = 0;
2376  aLVC.m_adjustedPhi[1] = aLVC.m_adjustedPhi[0] + 2 * phiSect[0];
2377  aLVC.m_adjustedPhiType[1] = 1;
2378  int ic = 1;
2379  int is = 0;
2380 
2381  while (ic < 31) {
2382  ic++;
2383  is = 2 - is;
2384  aLVC.m_adjustedPhi[ic] =
2385  aLVC.m_adjustedPhi[ic - 1] + 2 * phiSect[1];
2386  aLVC.m_adjustedPhiType[ic] = is;
2387  ic++;
2388  aLVC.m_adjustedPhi[ic] =
2389  aLVC.m_adjustedPhi[ic - 1] + 2 * phiSect[is];
2390  aLVC.m_adjustedPhiType[ic] = 1;
2391  }
2392  }
2393 }
2394 
2396  LocalVariablesContainer& aLVC) const {
2397  // hardcode for the moment
2398  aLVC.m_hPartitions.clear(); // barrel, inner endcap, outer endcap
2399 
2400  // 0: barrel 2x2
2401  // non BT sector
2402  std::vector<std::pair<int, float> > barrelZ0F0;
2403  barrelZ0F0.emplace_back(0, aLVC.m_innerBarrelRadius);
2404  if (m_activeAdjustLevel > 0) {
2405  barrelZ0F0.emplace_back(0, 4450.); // for DiskShieldingBackDisk
2406  barrelZ0F0.emplace_back(0, 6500.); // BI/BM
2407  barrelZ0F0.emplace_back(0, 8900.); // BM/BO
2408  barrelZ0F0.emplace_back(0, 13000.); // outer envelope
2409  }
2410  barrelZ0F0.emplace_back(0, aLVC.m_outerBarrelRadius);
2411 
2412  std::vector<std::pair<int, float> > barrelZ0F1;
2413  barrelZ0F1.emplace_back(0, aLVC.m_innerBarrelRadius);
2414  if (m_inertAdjustLevel > 0) {
2415  barrelZ0F1.emplace_back(1, 4500.);
2416  barrelZ0F1.emplace_back(1, 5900.);
2417  } else if (m_activeAdjustLevel > 0)
2418  barrelZ0F1.emplace_back(0, 4450.);
2419  if (m_activeAdjustLevel > 0)
2420  barrelZ0F1.emplace_back(0, 6500.);
2421  if (m_inertAdjustLevel > 0)
2422  barrelZ0F1.emplace_back(1, 8900.);
2423  else if (m_activeAdjustLevel > 0)
2424  barrelZ0F1.emplace_back(0, 8900.);
2425  if (m_inertAdjustLevel > 0)
2426  barrelZ0F1.emplace_back(1, 10100.);
2427  barrelZ0F1.emplace_back(0, 13000.); // outer envelope
2428  barrelZ0F1.emplace_back(0, aLVC.m_outerBarrelRadius);
2429 
2430  // BT sector
2431  std::vector<std::pair<int, float> > barrelZ1F0;
2432  barrelZ1F0.emplace_back(0, aLVC.m_innerBarrelRadius);
2433  if (static_cast<int>(m_activeAdjustLevel) +
2434  static_cast<int>(m_inertAdjustLevel) >
2435  0)
2436  barrelZ1F0.emplace_back(0, 4450.);
2437  if (m_inertAdjustLevel > 0) {
2438  barrelZ1F0.emplace_back(1, 5800.);
2439  barrelZ1F0.emplace_back(1, 6500.);
2440  } else if (m_activeAdjustLevel > 0)
2441  barrelZ1F0.emplace_back(0, 6500.);
2442  if (m_inertAdjustLevel > 0) {
2443  barrelZ1F0.emplace_back(1, 6750.);
2444  barrelZ1F0.emplace_back(1, 8400.);
2445  }
2446  if (m_activeAdjustLevel > 0)
2447  barrelZ1F0.emplace_back(0, 8770.); // adapted for cryoring (from 8900)
2448  if (m_inertAdjustLevel > 0)
2449  barrelZ1F0.emplace_back(1, 9850.); // adapted for cryoring (from 9600)
2450  barrelZ1F0.emplace_back(0, 13000.); // outer envelope
2451  barrelZ1F0.emplace_back(0, aLVC.m_outerBarrelRadius);
2452 
2453  std::vector<std::pair<int, float> > barrelZ1F1;
2454  barrelZ1F1.emplace_back(0, aLVC.m_innerBarrelRadius);
2455  if (m_inertAdjustLevel > 0) {
2456  barrelZ1F1.emplace_back(1, 4500.);
2457  barrelZ1F1.emplace_back(1, 6000.);
2458  } else if (m_activeAdjustLevel > 0)
2459  barrelZ1F1.emplace_back(0, 4450.);
2460  if (m_activeAdjustLevel > 0)
2461  barrelZ1F1.emplace_back(0, 6500.);
2462  if (m_inertAdjustLevel > 0)
2463  barrelZ1F1.emplace_back(1, 6800.);
2464  if (m_inertAdjustLevel > 0) {
2465  barrelZ1F1.emplace_back(1, 8900.);
2466  barrelZ1F1.emplace_back(1, 10100.);
2467  } else if (m_activeAdjustLevel > 0)
2468  barrelZ1F1.emplace_back(0, 8900.);
2469  barrelZ1F1.emplace_back(0, 13000.); // outer envelope
2470  barrelZ1F1.emplace_back(0, aLVC.m_outerBarrelRadius);
2471 
2472  std::vector<std::vector<std::vector<std::pair<int, float> > > > barrelZF(2);
2473  barrelZF[0].push_back(barrelZ0F0);
2474  barrelZF[0].push_back(barrelZ0F1);
2475  barrelZF[1].push_back(barrelZ1F0);
2476  barrelZF[1].push_back(barrelZ1F1);
2477 
2478  // small wheel 1x2 ( no z BT sector)
2479  // non BT sector
2480  std::vector<std::pair<int, float> > swZ0F0;
2481  swZ0F0.emplace_back(0, m_innerShieldRadius);
2482  if (m_activeAdjustLevel > 1) {
2483  swZ0F0.emplace_back(0, 2700.);
2484  }
2485  if (static_cast<int>(m_activeAdjustLevel) +
2486  static_cast<int>(m_inertAdjustLevel) >
2487  0)
2488  swZ0F0.emplace_back(0, 4450.);
2489  if (m_activeAdjustLevel > 0) {
2490  swZ0F0.emplace_back(0, 6560.); // BI/BM
2491  swZ0F0.emplace_back(0, 8900.); // BM/BO
2492  }
2493  swZ0F0.emplace_back(0, aLVC.m_outerBarrelRadius);
2494 
2495  // phi BT sector
2496  std::vector<std::pair<int, float> > swZ0F1;
2497  swZ0F1.emplace_back(0, m_innerShieldRadius);
2498  if (m_activeAdjustLevel > 1)
2499  swZ0F1.emplace_back(0, 2700.);
2500  if (static_cast<int>(m_inertAdjustLevel) +
2501  static_cast<int>(m_activeAdjustLevel) >
2502  0)
2503  swZ0F1.emplace_back(0, 4450.);
2504  if (m_inertAdjustLevel > 0)
2505  swZ0F1.emplace_back(1, 5900.);
2506  if (m_activeAdjustLevel > 0)
2507  swZ0F1.emplace_back(0, 6560.);
2508  if (m_inertAdjustLevel > 0) {
2509  swZ0F1.emplace_back(1, 8900.);
2510  swZ0F1.emplace_back(1, 10100.);
2511  } else if (m_activeAdjustLevel > 0)
2512  swZ0F1.emplace_back(0, 8900.);
2513  swZ0F1.emplace_back(0, aLVC.m_outerBarrelRadius);
2514 
2515  std::vector<std::vector<std::vector<std::pair<int, float> > > > swZF(1);
2516  swZF[0].push_back(swZ0F0);
2517  swZF[0].push_back(swZ0F1);
2518 
2519  // inner endcap/ECT 2x3
2520  // ect coil, non-BT z
2521  std::vector<std::pair<int, float> > innerZ0F0;
2522  innerZ0F0.emplace_back(0, m_innerShieldRadius);
2523  if (m_inertAdjustLevel > 0)
2524  innerZ0F0.emplace_back(0, 1100.);
2525  if (m_inertAdjustLevel > 1)
2526  innerZ0F0.emplace_back(1, 5150.);
2527  if (m_inertAdjustLevel > 0)
2528  innerZ0F0.emplace_back(1, 5300.);
2529  if (m_activeAdjustLevel > 0) {
2530  innerZ0F0.emplace_back(0, 6500.);
2531  innerZ0F0.emplace_back(0, 8900.);
2532  }
2533  innerZ0F0.emplace_back(0, aLVC.m_outerBarrelRadius);
2534 
2535  // coil gap, non-BT z
2536  std::vector<std::pair<int, float> > innerZ0F1;
2537  innerZ0F1.emplace_back(0, m_innerShieldRadius);
2538  if (m_inertAdjustLevel > 0)
2539  innerZ0F1.emplace_back(0, 1100.);
2540  if (m_inertAdjustLevel > 1) {
2541  innerZ0F1.emplace_back(1, 1400.);
2542  innerZ0F1.emplace_back(1, 1685.);
2543  }
2544  if (m_inertAdjustLevel > 0) {
2545  innerZ0F1.emplace_back(1, 4700.);
2546  innerZ0F1.emplace_back(1, 5900.);
2547  }
2548  if (m_activeAdjustLevel > 0) {
2549  innerZ0F1.emplace_back(0, 6500.);
2550  innerZ0F1.emplace_back(0, 8900.);
2551  }
2552  innerZ0F1.emplace_back(0, aLVC.m_outerBarrelRadius);
2553 
2554  // BT coil, no-BT z
2555  std::vector<std::pair<int, float> > innerZ0F2;
2556  innerZ0F2.emplace_back(0, m_innerShieldRadius);
2557  if (m_inertAdjustLevel > 0)
2558  innerZ0F2.emplace_back(0, 1100.);
2559  if (m_inertAdjustLevel > 1) {
2560  innerZ0F2.emplace_back(1, 1400.);
2561  innerZ0F2.emplace_back(1, 1685.);
2562  }
2563  if (m_inertAdjustLevel > 0) {
2564  innerZ0F2.emplace_back(1, 4450.);
2565  innerZ0F2.emplace_back(1, 5900.);
2566  }
2567  if (m_activeAdjustLevel > 0)
2568  innerZ0F2.emplace_back(0, 6500.);
2569  if (m_inertAdjustLevel > 0) {
2570  innerZ0F2.emplace_back(1, 8900.);
2571  innerZ0F2.emplace_back(1, 10100.);
2572  } else if (m_activeAdjustLevel > 0)
2573  innerZ0F2.emplace_back(0, 8900.);
2574  innerZ0F2.emplace_back(0, aLVC.m_outerBarrelRadius);
2575 
2576  // ect coil, z BT sector
2577  std::vector<std::pair<int, float> > innerZ1F0;
2578  innerZ1F0.emplace_back(0, m_innerShieldRadius);
2579  if (m_inertAdjustLevel > 0)
2580  innerZ1F0.emplace_back(0, 1100.);
2581  if (m_inertAdjustLevel > 1)
2582  innerZ1F0.emplace_back(1, 5150.);
2583  if (m_inertAdjustLevel > 0)
2584  innerZ1F0.emplace_back(1, 5300.);
2585  if (m_inertAdjustLevel > 0)
2586  innerZ1F0.emplace_back(1, 5800.);
2587  if (m_inertAdjustLevel > 0)
2588  innerZ1F0.emplace_back(1, 6750.);
2589  else if (m_activeAdjustLevel > 0)
2590  innerZ1F0.emplace_back(0, 6500.);
2591  if (m_inertAdjustLevel > 0) {
2592  innerZ1F0.emplace_back(1, 8400.);
2593  innerZ1F0.emplace_back(1, 9600.);
2594  } else if (m_activeAdjustLevel > 0)
2595  innerZ1F0.emplace_back(0, 8900.);
2596  innerZ1F0.emplace_back(0, aLVC.m_outerBarrelRadius);
2597 
2598  // coil gap, BT z sector
2599  std::vector<std::pair<int, float> > innerZ1F1;
2600  innerZ1F1.emplace_back(0, m_innerShieldRadius);
2601  if (m_inertAdjustLevel > 0)
2602  innerZ1F1.emplace_back(0, 1100.);
2603  if (m_inertAdjustLevel > 1) {
2604  innerZ1F1.emplace_back(1, 1400.);
2605  innerZ1F1.emplace_back(1, 1685.);
2606  }
2607  if (m_inertAdjustLevel > 0) {
2608  innerZ1F1.emplace_back(1, 4700.);
2609  innerZ1F1.emplace_back(1, 5800.);
2610  innerZ1F1.emplace_back(1, 6750.);
2611  } else if (m_activeAdjustLevel > 0)
2612  innerZ1F1.emplace_back(0, 6500.);
2613  if (m_inertAdjustLevel > 0) {
2614  innerZ1F1.emplace_back(1, 8400.);
2615  innerZ1F1.emplace_back(1, 9600.);
2616  } else if (m_activeAdjustLevel > 0)
2617  innerZ1F1.emplace_back(0, 8900.);
2618  innerZ1F1.emplace_back(0, aLVC.m_outerBarrelRadius);
2619 
2620  // BT coil, BT z sector
2621  std::vector<std::pair<int, float> > innerZ1F2;
2622  innerZ1F2.emplace_back(0, m_innerShieldRadius);
2623  if (m_inertAdjustLevel > 0)
2624  innerZ1F2.emplace_back(0, 1100.);
2625  if (m_inertAdjustLevel > 1) {
2626  innerZ1F2.emplace_back(1, 1400.);
2627  innerZ1F2.emplace_back(1, 1685.);
2628  }
2629  innerZ1F2.emplace_back(0, 4150.);
2630  if (m_inertAdjustLevel > 0) {
2631  innerZ1F2.emplace_back(1, 4700.);
2632  innerZ1F2.emplace_back(1, 5900.);
2633  innerZ1F2.emplace_back(1, 6800.);
2634  } else if (m_activeAdjustLevel > 0)
2635  innerZ1F2.emplace_back(0, 6500.);
2636  if (m_inertAdjustLevel > 0) {
2637  innerZ1F2.emplace_back(1, 8900.);
2638  innerZ1F2.emplace_back(1, 10100.);
2639  } else if (m_activeAdjustLevel > 0)
2640  innerZ1F2.emplace_back(0, 8900.);
2641  innerZ1F2.emplace_back(0, aLVC.m_outerBarrelRadius);
2642 
2643  std::vector<std::vector<std::vector<std::pair<int, float> > > > innerZF(2);
2644  innerZF[0].push_back(innerZ0F0);
2645  innerZF[0].push_back(innerZ0F1);
2646  innerZF[0].push_back(innerZ0F2);
2647  innerZF[1].push_back(innerZ1F0);
2648  innerZF[1].push_back(innerZ1F1);
2649  innerZF[1].push_back(innerZ1F2);
2650 
2651  // outer 1x1
2652  std::vector<std::pair<int, float> > outerZ0F0;
2653  outerZ0F0.emplace_back(0, m_outerShieldRadius);
2654  outerZ0F0.emplace_back(0, 2750.); // outer envelope
2655  outerZ0F0.emplace_back(0, 12650.); // outer envelope
2656  outerZ0F0.emplace_back(0, 13400.); // outer envelope
2657  outerZ0F0.emplace_back(0, aLVC.m_outerBarrelRadius);
2658 
2659  std::vector<std::pair<int, float> > outerZ0F1;
2660  outerZ0F1.emplace_back(0, m_outerShieldRadius);
2661  outerZ0F1.emplace_back(0, 2750.); // outer envelope
2662  if (m_activeAdjustLevel > 0) {
2663  outerZ0F1.emplace_back(0, 3600.);
2664  outerZ0F1.emplace_back(0, 5300.);
2665  outerZ0F1.emplace_back(0, 7000.);
2666  outerZ0F1.emplace_back(0, 8500.);
2667  outerZ0F1.emplace_back(0, 10000.);
2668  outerZ0F1.emplace_back(0, 12000.);
2669  }
2670  outerZ0F1.emplace_back(0, 12650.); // outer envelope
2671  outerZ0F1.emplace_back(0, 13400.); // outer envelope
2672  outerZ0F1.emplace_back(0, aLVC.m_outerBarrelRadius);
2673 
2674  std::vector<std::vector<std::vector<std::pair<int, float> > > > outerZF(2);
2675  outerZF[0].push_back(outerZ0F0);
2676  outerZF[0].push_back(outerZ0F0);
2677  outerZF[0].push_back(outerZ0F0);
2678  outerZF[1].push_back(outerZ0F1);
2679  outerZF[1].push_back(outerZ0F1);
2680  outerZF[1].push_back(outerZ0F1);
2681 
2682  // collect everything
2683  aLVC.m_hPartitions.push_back(barrelZF);
2684  aLVC.m_hPartitions.push_back(swZF);
2685  aLVC.m_hPartitions.push_back(innerZF);
2686  aLVC.m_hPartitions.push_back(outerZF);
2687 }
2688 
2690  LocalVariablesContainer& aLVC) const {
2691  aLVC.m_shieldZPart.resize(18);
2692 
2693  aLVC.m_shieldZPart[0] = -21900.; // elm2
2694  aLVC.m_shieldZPart[1] = -21500.; // elm1
2695  aLVC.m_shieldZPart[2] = -21000.; // octogon
2696  aLVC.m_shieldZPart[3] = -18000.; // tube
2697  aLVC.m_shieldZPart[4] = -12882.; // ect
2698  aLVC.m_shieldZPart[5] = -7930.; // ect
2699  aLVC.m_shieldZPart[6] = -7914.; // cone
2700  aLVC.m_shieldZPart[7] = -6941.; // disk
2701  aLVC.m_shieldZPart[8] = -6783.; //
2702  for (unsigned int i = 9; i < 18; i++)
2703  aLVC.m_shieldZPart[i] = -aLVC.m_shieldZPart[17 - i];
2704 
2705  aLVC.m_shieldHPart.clear();
2706 
2707  std::vector<std::pair<int, float> > outerShield;
2708  outerShield.emplace_back(0, m_beamPipeRadius);
2709  outerShield.emplace_back(0, 279.); // outer envelope
2710  outerShield.emplace_back(0, 436.7); // outer envelope
2711  outerShield.emplace_back(0, 1050.); // outer envelope
2712  outerShield.emplace_back(0, m_outerShieldRadius);
2713  aLVC.m_shieldHPart.push_back(outerShield);
2714 
2715  std::vector<std::pair<int, float> > innerShield;
2716  innerShield.emplace_back(0, m_beamPipeRadius);
2717  innerShield.emplace_back(0, 530.);
2718  innerShield.emplace_back(0, m_innerShieldRadius);
2719  aLVC.m_shieldHPart.push_back(innerShield);
2720 
2721  std::vector<std::pair<int, float> > diskShield;
2722  diskShield.emplace_back(0, 0.);
2723  diskShield.emplace_back(0, 540.);
2724  diskShield.emplace_back(0, 750.);
2725  diskShield.emplace_back(0, 2700.);
2726  diskShield.emplace_back(0, 4255.);
2727  aLVC.m_shieldHPart.push_back(diskShield);
2728 }
2729 
2731  LocalVariablesContainer& aLVC) const {
2732  // loop over map
2733  // std::map<const Trk::DetachedTrackingVolume*,std::vector<const
2734  // Trk::TrackingVolume*>* >::iterator mIter = m_blendMap.begin();
2735  for (const auto&[viter, vv] : aLVC.m_blendMap) {
2736  // find material source
2737  const Trk::Material* detMat = viter->trackingVolume();
2738  double csVol = m_volumeConverter.calculateVolume(*viter->trackingVolume());
2739  std::unique_ptr<const Trk::VolumeSpan> span{m_volumeConverter.findVolumeSpan(viter->trackingVolume()->volumeBounds(),
2740  viter->trackingVolume()->transform(), 0., 0.)};
2741  if (span && csVol > 0) {
2742  double enVol = 0.;
2743  // loop over frame volumes, check if confined
2744  std::vector<bool> fEncl;
2745  // blending factors can be saved, and not recalculated for each
2746  // clone
2747  for (const auto fIter : vv) {
2748  fEncl.push_back(enclosed(*fIter, *span, aLVC));
2749  if (fEncl.back())
2750  enVol += m_volumeConverter.calculateVolume(*fIter);
2751  }
2752  // diluting factor
2753  double dil = enVol > 0. ? csVol / enVol : 0.;
2754  if (dil > 0.) {
2755  for (auto fIter = vv.begin(); fIter != vv.end(); ++fIter) {
2756  if (fEncl[fIter - vv.begin()]) {
2757  Trk::TrackingVolume* vol = (*fIter);
2758  vol->addMaterial(*detMat, dil);
2759  if (m_colorCode == 0) {
2760  vol->registerColorCode(12);
2761  }
2762  ATH_MSG_VERBOSE((*fIter)->volumeName()
2763  << " acquires material from "
2764  << viter->name());
2765  }
2766  }
2767  ATH_MSG_VERBOSE("diluting factor:" << dil << " for "
2768  << viter->name()
2769  << ", blended ");
2770 
2771  } else {
2772  ATH_MSG_VERBOSE("diluting factor:" << dil << " for "
2773  << viter->name()
2774  << ", not blended ");
2775  }
2776  }
2777  }
2778 }
2779 }
PlotCalibFromCool.il
il
Definition: PlotCalibFromCool.py:381
Trk::TrackingVolume::glueVolumesDescriptor
GlueVolumesDescriptor & glueVolumesDescriptor()
Definition: TrackingVolume.cxx:1205
Muon::makeTransform
Amg::Transform3D * makeTransform(const Amg::Transform3D &trf)
Definition: MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/MuonTrackingGeometry/Utils.h:14
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer
Private struct to contain local variables we dont want to be global in this class.
Definition: MuonTrackingGeometryBuilderImpl.h:84
Muon::MuonTrackingGeometryBuilderImpl::processVolume
TrackingVolumePtr processVolume(const Trk::Volume &, int, int, const std::string &, LocalVariablesContainer &aLVC, bool hasStations) const
Private methods to define subvolumes and fill them with detached volumes.
Definition: MuonTrackingGeometryBuilderImpl.cxx:930
Muon::MuonTrackingGeometryBuilderImpl::m_alignTolerance
Gaudi::Property< double > m_alignTolerance
Definition: MuonTrackingGeometryBuilderImpl.h:214
CxxUtils::span
span(T *ptr, std::size_t sz) -> span< T >
A couple needed deduction guides.
Muon::MuonTrackingGeometryBuilderImpl::m_colorCode
Gaudi::Property< int > m_colorCode
Definition: MuonTrackingGeometryBuilderImpl.h:216
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
Trk::TrackingVolume::addMaterial
void addMaterial(const Material &mat, float fact=1.)
add Material
Definition: TrackingVolume.cxx:911
Muon::MuonTrackingGeometryBuilderImpl::VolumeSpanArray
std::array< std::vector< DetachedVolSpanPair >, 9 > VolumeSpanArray
Definition: MuonTrackingGeometryBuilderImpl.h:66
Trk::BevelledCylinderVolumeBounds
Definition: BevelledCylinderVolumeBounds.h:100
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Trk::VolumeConverter::calculateVolume
double calculateVolume(const Volume &vol, bool nonBooleanOnly=false, double precision=1.e-3) const
Volume calculation : by default return analytical solution only.
Definition: VolumeConverter.cxx:927
Muon::MuonTrackingGeometryBuilderImpl::m_blendInertMaterial
Gaudi::Property< bool > m_blendInertMaterial
Definition: MuonTrackingGeometryBuilderImpl.h:210
RZPairVector
std::vector< RZPair > RZPairVector
Definition: RZPair.h:18
Muon::MuonTrackingGeometryBuilderImpl::m_outerWheel
static constexpr double m_outerWheel
minimal extend in z of the outer wheel (EO)
Definition: MuonTrackingGeometryBuilderImpl.h:193
Trk::binZ
@ binZ
Definition: BinningType.h:49
DetectorZone::posEndcap
@ posEndcap
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_outerBarrelRadius
double m_outerBarrelRadius
Definition: MuonTrackingGeometryBuilderImpl.h:87
TRTCalib_cfilter.detector
detector
Definition: TRTCalib_cfilter.py:241
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
Muon::MuonTrackingGeometryBuilderImpl::m_loadMSentry
Gaudi::Property< bool > m_loadMSentry
Definition: MuonTrackingGeometryBuilderImpl.h:174
BinnedArray2D.h
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:55
BinnedArray.h
Muon::MuonTrackingGeometryBuilderImpl::DetachedVolVec
std::vector< DetachedVolPtr > DetachedVolVec
Definition: MuonTrackingGeometryBuilderImpl.h:63
Amg::getTranslateZ3D
Amg::Transform3D getTranslateZ3D(const double Z)
: Returns a shift transformation along the z-axis
Definition: GeoPrimitivesHelpers.h:285
Trk::globalSearch
@ globalSearch
Definition: TrackingGeometry.h:45
BinUtility.h
Trk::VolumeConverter::findVolumeSpan
std::unique_ptr< VolumeSpan > findVolumeSpan(const VolumeBounds &volBounds, const Amg::Transform3D &transform, double zTol, double phiTol) const
Estimation of the geometrical volume span.
Definition: VolumeConverter.cxx:424
Muon::TrackingVolumePtr
MuonTrackingGeometryBuilderImpl::TrackingVolumePtr TrackingVolumePtr
Definition: MuonTrackingGeometryBuilderImpl.cxx:56
Muon::VolumeSpanArray
MuonTrackingGeometryBuilderImpl::VolumeSpanArray VolumeSpanArray
Definition: MuonTrackingGeometryBuilderImpl.cxx:55
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_adjustedPhiType
std::vector< int > m_adjustedPhiType
Definition: MuonTrackingGeometryBuilderImpl.h:97
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_shieldHPart
std::vector< std::vector< std::pair< int, float > > > m_shieldHPart
Definition: MuonTrackingGeometryBuilderImpl.h:102
M_PI
#define M_PI
Definition: ActiveFraction.h:11
Muon::MuonTrackingGeometryBuilderImpl::m_entryVolume
Gaudi::Property< std::string > m_entryVolume
Definition: MuonTrackingGeometryBuilderImpl.h:220
Muon::MuonTrackingGeometryBuilderImpl::m_exitVolume
Gaudi::Property< std::string > m_exitVolume
Definition: MuonTrackingGeometryBuilderImpl.h:222
deg
#define deg
Definition: SbPolyhedron.cxx:17
Trk::closed
@ closed
Definition: BinningType.h:41
Muon::MuonTrackingGeometryBuilderImpl::blendMaterial
void blendMaterial(LocalVariablesContainer &aLVC) const
Private method to blend the inert material.
Definition: MuonTrackingGeometryBuilderImpl.cxx:2730
Trk::positiveFaceXY
@ positiveFaceXY
Definition: BoundarySurfaceFace.h:33
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
Muon::MuonTrackingGeometryBuilderImpl::m_activeAdjustLevel
Gaudi::Property< int > m_activeAdjustLevel
Definition: MuonTrackingGeometryBuilderImpl.h:217
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
Muon::MuonTrackingGeometryBuilderImpl::m_removeBlended
Gaudi::Property< bool > m_removeBlended
Definition: MuonTrackingGeometryBuilderImpl.h:212
Muon::MuonTrackingGeometryBuilderImpl::m_diskShieldZ
static constexpr double m_diskShieldZ
Definition: MuonTrackingGeometryBuilderImpl.h:198
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_innerEndcapZ
double m_innerEndcapZ
Definition: MuonTrackingGeometryBuilderImpl.h:88
Trk::TrackingVolume::registerColorCode
void registerColorCode(unsigned int icolor)
Register the color code.
Muon::MuonTrackingGeometryBuilderImpl::getHParts
void getHParts(LocalVariablesContainer &aLVC) const
Private method to retrieve h partition.
Definition: MuonTrackingGeometryBuilderImpl.cxx:2395
Muon::MuonTrackingGeometryBuilderImpl::m_innerEndcapEtaPartition
Gaudi::Property< int > m_innerEndcapEtaPartition
Definition: MuonTrackingGeometryBuilderImpl.h:201
Muon::MuonTrackingGeometryBuilderImpl::getZParts
void getZParts(LocalVariablesContainer &aLVC) const
Private method to retrieve z partition.
Definition: MuonTrackingGeometryBuilderImpl.cxx:2082
TrapezoidVolumeBounds.h
Trk::BeamPipe
@ BeamPipe
Definition: GeometrySignature.h:27
Muon::MuonTrackingGeometryBuilderImpl::m_adjustStatic
Gaudi::Property< bool > m_adjustStatic
Definition: MuonTrackingGeometryBuilderImpl.h:207
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_frameNum
unsigned int m_frameNum
Definition: MuonTrackingGeometryBuilderImpl.h:92
Amg::getRotateZ3D
Amg::Transform3D getRotateZ3D(double angle)
get a rotation transformation around Z-axis
Definition: GeoPrimitivesHelpers.h:270
PrismVolumeBounds.h
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_frameStat
unsigned int m_frameStat
Definition: MuonTrackingGeometryBuilderImpl.h:93
BinnedArray1D.h
GeoPrimitives.h
Muon::MuonTrackingGeometryBuilderImpl::getDetachedObjects
std::vector< Trk::DetachedTrackingVolume * > getDetachedObjects(const Trk::Volume &trkVol, std::vector< Trk::DetachedTrackingVolume * > &, LocalVariablesContainer &aLVC, int mode=0) const
Private method to find detached volumes.
Definition: MuonTrackingGeometryBuilderImpl.cxx:1805
GeometryStatics.h
CylinderVolumeBounds.h
Muon::MuonTrackingGeometryBuilderImpl::m_barrelEtaPartition
Gaudi::Property< int > m_barrelEtaPartition
Definition: MuonTrackingGeometryBuilderImpl.h:200
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Muon::MuonTrackingGeometryBuilderImpl::initialize
virtual StatusCode initialize() override
AlgTool initailize method.
Definition: MuonTrackingGeometryBuilderImpl.cxx:65
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Muon::MuonTrackingGeometryBuilderImpl::m_barrelZ
Gaudi::Property< double > m_barrelZ
maximal extend in z of the inner part of muon endcap
Definition: MuonTrackingGeometryBuilderImpl.h:186
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_static3d
bool m_static3d
Definition: MuonTrackingGeometryBuilderImpl.h:91
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_inertSpan
VolumeSpanArray m_inertSpan
Definition: MuonTrackingGeometryBuilderImpl.h:106
lumiFormat.i
int i
Definition: lumiFormat.py:85
Muon::MuonTrackingGeometryBuilderImpl::m_muonSimple
Gaudi::Property< bool > m_muonSimple
Definition: MuonTrackingGeometryBuilderImpl.h:173
Trk::tubeSectorNegativePhi
@ tubeSectorNegativePhi
Definition: BoundarySurfaceFace.h:41
Muon::MuonTrackingGeometryBuilderImpl::getPhiParts
void getPhiParts(int, LocalVariablesContainer &aLVC) const
Private method to retrieve phi partition.
Definition: MuonTrackingGeometryBuilderImpl.cxx:2318
beamspotman.n
n
Definition: beamspotman.py:731
Muon::DetachedVolVec
MuonTrackingGeometryBuilderImpl::DetachedVolVec DetachedVolVec
Definition: MuonTrackingGeometryBuilderImpl.cxx:53
Trk::GlueVolumesDescriptor::registerGlueVolumes
void registerGlueVolumes(BoundarySurfaceFace, std::vector< TrackingVolume * > &)
register the volumes
Definition: GlueVolumesDescriptor.cxx:28
beamspotman.posZ
posZ
Definition: beamspotman.py:1624
Muon::MuonTrackingGeometryBuilderImpl::m_outerEndcapEtaPartition
Gaudi::Property< int > m_outerEndcapEtaPartition
Definition: MuonTrackingGeometryBuilderImpl.h:203
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonR4::inverse
CalibratedSpacePoint::Covariance_t inverse(const CalibratedSpacePoint::Covariance_t &mat)
Inverts the parsed matrix.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/UtilFunctions.cxx:65
extractSporadic.h
list h
Definition: extractSporadic.py:97
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_zPartitionsType
std::vector< int > m_zPartitionsType
Definition: MuonTrackingGeometryBuilderImpl.h:95
BevelledCylinderVolumeBounds.h
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
checkFileSG.objs
list objs
Definition: checkFileSG.py:93
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
PixelAthClusterMonAlgCfg.zmax
zmax
Definition: PixelAthClusterMonAlgCfg.py:169
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Preparation.mode
mode
Definition: Preparation.py:94
Trk::negativeFaceXY
@ negativeFaceXY
Definition: BoundarySurfaceFace.h:32
Trk::Volume::center
const Amg::Vector3D & center() const
returns the center of the volume
Definition: Volume.h:86
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_blendMap
std::map< Trk::DetachedTrackingVolume *, std::vector< Trk::TrackingVolume * > > m_blendMap
Definition: MuonTrackingGeometryBuilderImpl.h:104
Muon::MuonTrackingGeometryBuilderImpl::m_phiPartition
Gaudi::Property< int > m_phiPartition
Definition: MuonTrackingGeometryBuilderImpl.h:205
Muon::MuonTrackingGeometryBuilderImpl::findVolumesSpan
VolumeSpanArray findVolumesSpan(const DetachedVolVec &objs, double zTol, double phiTol, const LocalVariablesContainer &aLVC) const
Private method to filter detached volumes in z span.
Definition: MuonTrackingGeometryBuilderImpl.cxx:850
SharedObject.h
Muon::MuonTrackingGeometryBuilderImpl::VolumeSpanPtr
std::shared_ptr< const Trk::VolumeSpan > VolumeSpanPtr
Definition: MuonTrackingGeometryBuilderImpl.h:64
Muon::MuonTrackingGeometryBuilderImpl::m_muonInert
Gaudi::Property< bool > m_muonInert
Definition: MuonTrackingGeometryBuilderImpl.h:176
GlobalUtilities.h
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_adjustedPhi
std::vector< float > m_adjustedPhi
Definition: MuonTrackingGeometryBuilderImpl.h:96
Trk::BinUtility
Definition: BinUtility.h:39
Muon::MuonTrackingGeometryBuilderImpl::DetachedVolPtr
std::unique_ptr< Trk::DetachedTrackingVolume > DetachedVolPtr
TrackingGeometry Interface method.
Definition: MuonTrackingGeometryBuilderImpl.h:62
grepfile.ic
int ic
Definition: grepfile.py:33
Trk::Cavern
@ Cavern
Definition: GeometrySignature.h:30
Muon::DetachedVolPtr
MuonTrackingGeometryBuilderImpl::DetachedVolPtr DetachedVolPtr
Definition: MuonTrackingGeometryBuilderImpl.cxx:52
Trk::CylinderVolumeBounds
Definition: CylinderVolumeBounds.h:70
Muon::MuonTrackingGeometryBuilderImpl::m_trackingVolumeArrayCreator
ToolHandle< Trk::ITrackingVolumeArrayCreator > m_trackingVolumeArrayCreator
Helper Tool to create TrackingVolume Arrays.
Definition: MuonTrackingGeometryBuilderImpl.h:154
IOVInfiniteRange.h
Trk::TrackingVolume::volumeName
const std::string & volumeName() const
Returns the VolumeName - for debug reason, might be depreciated later.
GlueVolumesDescriptor.h
Muon::MuonTrackingGeometryBuilderImpl::m_ectZ
static constexpr double m_ectZ
minimal extent in z of the ECT
Definition: MuonTrackingGeometryBuilderImpl.h:194
SimplePolygonBrepVolumeBounds.h
Trk::GlueVolumesDescriptor::glueVolumes
const std::vector< TrackingVolume * > & glueVolumes(BoundarySurfaceFace)
retrieve them again
Definition: GlueVolumesDescriptor.cxx:40
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_hPartitions
std::vector< std::vector< std::vector< std::vector< std::pair< int, float > > > > > m_hPartitions
Definition: MuonTrackingGeometryBuilderImpl.h:100
DoubleTrapezoidVolumeBounds.h
Muon::MuonTrackingGeometryBuilderImpl::m_outerEndcapZ
Gaudi::Property< double > m_outerEndcapZ
Definition: MuonTrackingGeometryBuilderImpl.h:190
Muon::MuonTrackingGeometryBuilderImpl::m_innerShieldRadius
static constexpr double m_innerShieldRadius
Definition: MuonTrackingGeometryBuilderImpl.h:196
Muon::MuonTrackingGeometryBuilderImpl::trackingGeometryImpl
std::unique_ptr< Trk::TrackingGeometry > trackingGeometryImpl(DetachedVolVec &&stations, DetachedVolVec &&inertObjs, Trk::TrackingVolume *tvol) const
Definition: MuonTrackingGeometryBuilderImpl.cxx:81
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_muonMaterial
Trk::Material m_muonMaterial
the (empty) material
Definition: MuonTrackingGeometryBuilderImpl.h:109
Muon::MuonTrackingGeometryBuilderImpl::m_innerEndcapZ
Gaudi::Property< double > m_innerEndcapZ
maximal extend in z of the outer part of muon endcap
Definition: MuonTrackingGeometryBuilderImpl.h:188
Trk::CylinderVolumeBounds::outerRadius
double outerRadius() const
This method returns the outer radius.
Definition: CylinderVolumeBounds.h:191
Trk::Volume::transform
const Amg::Transform3D & transform() const
Return methods for geometry transform.
Definition: Volume.h:81
Muon::MuonTrackingGeometryBuilderImpl::m_static3d
Gaudi::Property< bool > m_static3d
Definition: MuonTrackingGeometryBuilderImpl.h:208
Muon::MuonTrackingGeometryBuilderImpl::DetachedVolSpanPair
std::pair< Trk::DetachedTrackingVolume *, VolumeSpanPtr > DetachedVolSpanPair
Definition: MuonTrackingGeometryBuilderImpl.h:65
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::tubeSectorOuterCover
@ tubeSectorOuterCover
Definition: BoundarySurfaceFace.h:44
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_zPartitions
std::vector< double > m_zPartitions
Definition: MuonTrackingGeometryBuilderImpl.h:94
Trk::GlueVolumesDescriptor
Definition: GlueVolumesDescriptor.h:40
Muon::MuonTrackingGeometryBuilderImpl::m_beamPipeRadius
static constexpr double m_beamPipeRadius
Definition: MuonTrackingGeometryBuilderImpl.h:195
BoundarySurface.h
Trk::open
@ open
Definition: BinningType.h:40
Muon::MuonTrackingGeometryBuilderImpl::m_bigWheel
static constexpr double m_bigWheel
maximal extend in z of the big wheel
Definition: MuonTrackingGeometryBuilderImpl.h:192
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_adjustStatic
bool m_adjustStatic
Definition: MuonTrackingGeometryBuilderImpl.h:90
DetectorZone::negEndcap
@ negEndcap
TrackingVolume.h
BinnedArray1D1D1D.h
h
Muon::MuonTrackingGeometryBuilderImpl::processShield
TrackingVolumePtr processShield(const Trk::Volume &, int, const std::string &, LocalVariablesContainer &aLVC, bool hasStations) const
Definition: MuonTrackingGeometryBuilderImpl.cxx:1613
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DeMoScan.first
bool first
Definition: DeMoScan.py:536
Trk::Volume::volumeBounds
const VolumeBounds & volumeBounds() const
returns the volumeBounds()
Definition: Volume.h:97
Trk::cylinderCover
@ cylinderCover
Definition: BoundarySurfaceFace.h:38
Muon::MuonTrackingGeometryBuilderImpl::m_volumeConverter
Trk::VolumeConverter m_volumeConverter
Volume helper to find geometrical span of enclosed volumes.
Definition: MuonTrackingGeometryBuilderImpl.h:113
CombinedVolumeBounds.h
ReadCellNoiseFromCoolCompare.l0
l0
Definition: ReadCellNoiseFromCoolCompare.py:359
Trk::tubeSectorPositivePhi
@ tubeSectorPositivePhi
Definition: BoundarySurfaceFace.h:42
Muon::DetachedVolSpanPair
MuonTrackingGeometryBuilderImpl::DetachedVolSpanPair DetachedVolSpanPair
Definition: MuonTrackingGeometryBuilderImpl.cxx:54
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_stationSpan
VolumeSpanArray m_stationSpan
Definition: MuonTrackingGeometryBuilderImpl.h:105
Trk::tubeOuterCover
@ tubeOuterCover
Definition: BoundarySurfaceFace.h:40
Muon::MuonTrackingGeometryBuilderImpl::m_inertAdjustLevel
Gaudi::Property< int > m_inertAdjustLevel
Definition: MuonTrackingGeometryBuilderImpl.h:218
TrackingGeometry.h
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_outerEndcapZ
double m_outerEndcapZ
Definition: MuonTrackingGeometryBuilderImpl.h:89
Muon::MuonTrackingGeometryBuilderImpl::m_outerBarrelRadius
Gaudi::Property< double > m_outerBarrelRadius
maximal extend in z of the muon barrel
Definition: MuonTrackingGeometryBuilderImpl.h:183
Trk::VolumeSpan
Definition: VolumeConverter.h:33
Trk::Material
Definition: Material.h:116
Trk::tubeInnerCover
@ tubeInnerCover
Definition: BoundarySurfaceFace.h:39
Muon::MuonTrackingGeometryBuilderImpl::TrackingVolumePtr
std::unique_ptr< Trk::TrackingVolume > TrackingVolumePtr
Definition: MuonTrackingGeometryBuilderImpl.h:67
fitman.hz
def hz
Definition: fitman.py:516
AthAlgTool
Definition: AthAlgTool.h:26
python.PyAthena.obj
obj
Definition: PyAthena.py:132
Muon::MuonTrackingGeometryBuilderImpl::MuonTrackingGeometryBuilderImpl
MuonTrackingGeometryBuilderImpl(const std::string &, const std::string &, const IInterface *)
Definition: MuonTrackingGeometryBuilderImpl.cxx:58
Trk::Volume
Definition: Volume.h:35
MuonGM::buildString
std::string buildString(int i, int ncha)
Definition: GlobalUtilities.cxx:23
PlotCalibFromCool.vv
vv
Definition: PlotCalibFromCool.py:716
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_innerBarrelRadius
double m_innerBarrelRadius
Definition: MuonTrackingGeometryBuilderImpl.h:86
Trk::TrackingVolume
Definition: TrackingVolume.h:121
Material
@ Material
Definition: MaterialTypes.h:8
Muon::MuonTrackingGeometryBuilderImpl::m_innerBarrelRadius
Gaudi::Property< double > m_innerBarrelRadius
< minimal extend in radial dimension of the muon barrel
Definition: MuonTrackingGeometryBuilderImpl.h:180
Muon::MuonTrackingGeometryBuilderImpl::getShieldParts
void getShieldParts(LocalVariablesContainer &aLVC) const
Private method to retrieve shield partition.
Definition: MuonTrackingGeometryBuilderImpl.cxx:2689
Utils.h
MuonTrackingGeometryBuilderImpl.h
Trk::tubeSectorInnerCover
@ tubeSectorInnerCover
Definition: BoundarySurfaceFace.h:43
Muon::release
std::vector< ObjType * > release(std::vector< std::unique_ptr< ObjType >> &objVec)
Definition: MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/MuonTrackingGeometry/Utils.h:18
Muon::MuonTrackingGeometryBuilderImpl::m_enclosingEnvelopeSvc
ServiceHandle< IEnvelopeDefSvc > m_enclosingEnvelopeSvc
service to provide input volume size
Definition: MuonTrackingGeometryBuilderImpl.h:169
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_shieldZPart
std::vector< double > m_shieldZPart
Definition: MuonTrackingGeometryBuilderImpl.h:101
CuboidVolumeBounds.h
Material.h
Muon::MuonTrackingGeometryBuilderImpl::m_outerShieldRadius
static constexpr double m_outerShieldRadius
Definition: MuonTrackingGeometryBuilderImpl.h:197
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_msCutoutsIn
RZPairVector m_msCutoutsIn
Definition: MuonTrackingGeometryBuilderImpl.h:107
Muon::MuonTrackingGeometryBuilderImpl::enclosed
bool enclosed(const Trk::Volume &volume, const Trk::VolumeSpan &span, LocalVariablesContainer &aLVC) const
Private method to check if constituent enclosed.
Definition: MuonTrackingGeometryBuilderImpl.cxx:2005
Muon::MuonTrackingGeometryBuilderImpl::LocalVariablesContainer::m_msCutoutsOut
RZPairVector m_msCutoutsOut
Definition: MuonTrackingGeometryBuilderImpl.h:108
SubtractedVolumeBounds.h
Muon::MuonTrackingGeometryBuilderImpl::m_trackingVolumeHelper
ToolHandle< Trk::ITrackingVolumeHelper > m_trackingVolumeHelper
Helper Tool to create TrackingVolumes.
Definition: MuonTrackingGeometryBuilderImpl.h:163
Trk::binPhi
@ binPhi
Definition: BinningType.h:51