ATLAS Offline Software
BeamPipeBuilderImpl.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 // Amg
9 // Trk inlcude
12 //#include "TrkDetDescrGeoModelCnv/GeoShapeConverter.h"
19 // GeoModel include
21 #include "GeoModelKernel/GeoTube.h"
22 
23 // Athena standard methods
24 // initialize
26 {
27  if (m_beamPipeFromDb) {
29  ATH_MSG_DEBUG("Successfully retrieved BeamPipe detector manager '" << m_beamPipeMgrName << "'." );
30  }
31  ATH_MSG_DEBUG( "initialize()" );
32  return StatusCode::SUCCESS;
33 }
34 
35 std::unique_ptr<const std::vector<Trk::CylinderLayer*> > InDet::BeamPipeBuilderImpl::cylindricalLayersImpl() const
36 {
37  auto beamPipe = std::make_unique<std::vector<Trk::CylinderLayer*> >();
38 
39  // the geometry
40  Amg::Transform3D beamPipeTransform;
41  beamPipeTransform.setIdentity();
42 
43  double beamPipeRadius = m_beamPipeRadius;
44 
45  if (m_beamPipeMgr) {
46  // get the central top volume
47  PVConstLink beamPipeTopVolume = m_beamPipeMgr->getTreeTop(0);
48  if (m_beamPipeMgr->getNumTreeTops()==1) {
49  // Beampipe implementation using assembly volume has only one tree top instead of 3 in the default case(union of a central and two forward beampipes)
50  beamPipeTopVolume = m_beamPipeMgr->getTreeTop(0)->getChildVol(0)->getChildVol(0);
51  //the BeamPipeCentral volume is the child of the child volume of the top volume in this case
52  }
53  beamPipeTransform = Amg::Translation3D(beamPipeTopVolume->getX().translation().x(),
54  beamPipeTopVolume->getX().translation().y(),
55  beamPipeTopVolume->getX().translation().z());
56  const GeoLogVol* beamPipeLogVolume = beamPipeTopVolume->getLogVol();
57  const GeoTube* beamPipeTube = nullptr;
58  if (beamPipeLogVolume) {
59  // get the geoShape and translate
60  //Trk::GeoShapeConverter geoShaper;
61  beamPipeTube = dynamic_cast<const GeoTube*>(beamPipeLogVolume->getShape());
62  if (beamPipeTube) {
63  for(unsigned int i=0;i<beamPipeTopVolume->getNChildVols();i++) {
64  if(beamPipeTopVolume->getNameOfChildVol(i)=="SectionC03"){
65  PVConstLink childTopVolume = beamPipeTopVolume->getChildVol(i);
66  const GeoLogVol* childLogVolume = childTopVolume->getLogVol();
67  const GeoTube* childTube = nullptr;
68  if (childLogVolume) {
69  childTube = dynamic_cast<const GeoTube*>(childLogVolume->getShape());
70  if (childTube) {
71  beamPipeRadius = 0.5 * (childTube->getRMax()+childTube->getRMin());
72  }
73  }
74  break; //Exit loop after SectionC03 is found
75  }
76  } // Loop over child volumes
77  }
78  }
79  ATH_MSG_VERBOSE("BeamPipe constructed from Database: translation (yes) - radius "<< ( beamPipeTube ? "(yes)" : "(no)") << " - r = " << beamPipeRadius );
80  } else {
81  beamPipeTransform = Amg::Translation3D(m_beamPipeOffsetX, m_beamPipeOffsetY, 0.);
82  }
83 
84  ATH_MSG_VERBOSE("BeamPipe shift estimated as : "
85  << beamPipeTransform.translation().x() << ", "
86  << beamPipeTransform.translation().y() << ","
87  << beamPipeTransform.translation().y());
88 
89  Trk::CylinderBounds* beamPipeBounds = new Trk::CylinderBounds(beamPipeRadius, m_beamPipeHalflength);
90  ATH_MSG_VERBOSE("BeamPipe bounds constructed as : " << (*beamPipeBounds) );
91 
92  // the material
99 
100  // binned layer material for the beam pipe possible
101  Trk::CylinderLayer * pThisCylinderLayer{};
102  if (m_beamPipeBinsZ == 1u) {
103  const auto &beamPipeLayerMaterial = Trk::HomogeneousLayerMaterial(beamPipeMaterial, 1.0);
104  pThisCylinderLayer = new Trk::CylinderLayer(beamPipeTransform,
105  beamPipeBounds,
106  beamPipeLayerMaterial,
108 
109  } else {
111  const auto &beamPipeLayerMaterial = Trk::BinnedLayerMaterial(layerBinUtility);
112  pThisCylinderLayer = new Trk::CylinderLayer(beamPipeTransform,
113  beamPipeBounds,
114  beamPipeLayerMaterial,
116  }
117  beamPipe->push_back(pThisCylinderLayer);
118  return beamPipe;
119 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
InDet::BeamPipeBuilderImpl::m_beamPipeMgrName
StringProperty m_beamPipeMgrName
the name of the beam pipe manager to be configured
Definition: BeamPipeBuilderImpl.h:57
InDet::BeamPipeBuilderImpl::m_beamPipeRho
DoubleProperty m_beamPipeRho
averageRho of the beam pipe
Definition: BeamPipeBuilderImpl.h:70
MaterialProperties.h
Trk::binZ
@ binZ
Definition: BinningType.h:49
InDet::BeamPipeBuilderImpl::cylindricalLayersImpl
std::unique_ptr< const std::vector< Trk::CylinderLayer * > > cylindricalLayersImpl() const
Definition: BeamPipeBuilderImpl.cxx:35
BinUtility.h
BeamPipeDetectorManager::getNumTreeTops
virtual unsigned int getNumTreeTops() const
Definition: BeamPipeDetectorManager.cxx:15
InDet::BeamPipeBuilderImpl::m_beamPipeThickness
DoubleProperty m_beamPipeThickness
thickness of the beam pipe
Definition: BeamPipeBuilderImpl.h:64
HomogeneousLayerMaterial.h
InDet::BeamPipeBuilderImpl::m_beamPipeL0
double m_beamPipeL0
X0 of the beam pipe.
Definition: BeamPipeBuilderImpl.h:66
InDet::BeamPipeBuilderImpl::m_beamPipeX0
DoubleProperty m_beamPipeX0
X0 of the beam pipe.
Definition: BeamPipeBuilderImpl.h:65
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
InDet::BeamPipeBuilderImpl::m_beamPipeMgr
const BeamPipeDetectorManager * m_beamPipeMgr
the beam pipe manager
Definition: BeamPipeBuilderImpl.h:56
InDet::BeamPipeBuilderImpl::m_beamPipeHalflength
DoubleProperty m_beamPipeHalflength
halflength of the beampipe
Definition: BeamPipeBuilderImpl.h:63
BeamPipeDetectorManager::getTreeTop
virtual PVConstLink getTreeTop(unsigned int i) const
Definition: BeamPipeDetectorManager.cxx:20
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
InDet::BeamPipeBuilderImpl::m_beamPipeOffsetY
DoubleProperty m_beamPipeOffsetY
beam pipe offset in y
Definition: BeamPipeBuilderImpl.h:61
InDet::BeamPipeBuilderImpl::m_beamPipeRadius
DoubleProperty m_beamPipeRadius
radius of the beam pipe
Definition: BeamPipeBuilderImpl.h:62
BeamPipeDetectorManager.h
GeoPrimitives.h
GeometryStatics.h
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Trk::CylinderBounds
Definition: CylinderBounds.h:46
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
InDet::BeamPipeBuilderImpl::m_beamPipeOffsetX
DoubleProperty m_beamPipeOffsetX
beam pipe offset in x
Definition: BeamPipeBuilderImpl.h:60
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CylinderLayer.h
BinnedLayerMaterial.h
InDet::BeamPipeBuilderImpl::m_beamPipeZ
DoubleProperty m_beamPipeZ
averageZ of the beam pipe
Definition: BeamPipeBuilderImpl.h:69
Trk::BinnedLayerMaterial
Definition: BinnedLayerMaterial.h:33
Trk::BinUtility
Definition: BinUtility.h:39
Trk::CylinderLayer
Definition: CylinderLayer.h:43
InDet::BeamPipeBuilderImpl::m_beamPipeFromDb
BooleanProperty m_beamPipeFromDb
steer beam pipe parameters from DataBase
Definition: BeamPipeBuilderImpl.h:55
Trk::open
@ open
Definition: BinningType.h:40
CylinderBounds.h
Trk::MaterialProperties
Definition: MaterialProperties.h:40
InDet::BeamPipeBuilderImpl::m_beamPipeA
DoubleProperty m_beamPipeA
averageA of the beam pipe
Definition: BeamPipeBuilderImpl.h:68
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
InDet::BeamPipeBuilderImpl::initialize
virtual StatusCode initialize() override
AlgTool initialize method.
Definition: BeamPipeBuilderImpl.cxx:25
Trk::HomogeneousLayerMaterial
Definition: HomogeneousLayerMaterial.h:53
BeamPipeBuilderImpl.h
LayerMaterialProperties.h
InDet::BeamPipeBuilderImpl::m_beamPipeBinsZ
UnsignedIntegerProperty m_beamPipeBinsZ
number of bins in the beam pipe
Definition: BeamPipeBuilderImpl.h:72