ATLAS Offline Software
TrackingVolumeHelper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TrackingVolumeHelper.h, (c) ATLAS Detector software
8 
9 #ifndef TRKDETDESCRTOOLS_TRACKINGVOLUMEHELPER_H
10 #define TRKDETDESCRTOOLS_TRACKINGVOLUMEHELPER_H
11 
12 #ifndef TRKDETDESCR_TAKESMALLERBIGGER
13 #define TRKDETDESCR_TAKESMALLERBIGGER
14 #define takeSmaller(current, test) current = current < test ? current : test
15 #define takeBigger(current, test) current = current > test ? current : test
16 #define takeSmallerBigger(cSmallest, cBiggest, test) \
17  takeSmaller(cSmallest, test); \
18  takeBigger(cBiggest, test)
19 #endif
20 // Trk
23 // Amg
25 // Gaudi & Athena
27 #include "GaudiKernel/SystemOfUnits.h"
28 #include "GaudiKernel/ToolHandle.h"
29 // STL
30 #include <algorithm>
31 #include <fstream>
32 #include <string>
33 
35 namespace Trk {
36 
37 class ILayerArrayCreator;
38 class ITrackingVolumeArrayCreator;
39 class TrackingVolume;
40 class VolumeBounds;
41 class CylinderVolumeBounds;
42 class Material;
43 class LayerMaterialProperties;
44 
54  : public AthAlgTool
56  , virtual public ITrackingVolumeHelper
57 {
58 
59 public:
61  TrackingVolumeHelper(const std::string&,
62  const std::string&,
63  const IInterface*);
66 
68  StatusCode initialize() override;
69 
80  void glueTrackingVolumes(TrackingVolume& firstVol,
81  BoundarySurfaceFace firstFace,
82  TrackingVolume& secondVol,
83  BoundarySurfaceFace secondFace,
84  bool buildBoundaryLayer = false) const override;
85 
96  void glueTrackingVolumes(TrackingVolume& firstVol,
97  BoundarySurfaceFace firstFace,
98  const std::vector<TrackingVolume*>& secondVolumes,
99  BoundarySurfaceFace secondFace,
100  bool buildBoundaryLayer = false,
101  bool boundaryFaceExchange = false) const override;
102 
116  void glueTrackingVolumes(const std::vector<TrackingVolume*>& firstVolumes,
117  BoundarySurfaceFace firstFace,
118  const std::vector<TrackingVolume*>& secondVolumes,
119  BoundarySurfaceFace secondFace,
120  bool buildBoundaryLayer = false,
121  bool boundaryFaceExchange = false) const override;
122 
138  BoundarySurfaceFace firstFace,
139  TrackingVolume& secondVol,
140  BoundarySurfaceFace secondFace,
141  std::string name) const override;
142 
143  std::unique_ptr<Trk::TrackingVolume> glueTrackingVolumeArrays(std::shared_ptr<TrackingVolume> firstVol,
144  BoundarySurfaceFace firstFace,
145  std::shared_ptr<TrackingVolume> secondVol,
146  BoundarySurfaceFace secondFace,
147  const std::string& name) const override;
148 
159  BoundarySurfaceFace face,
160  TrackingVolume* insidevol) const override;
161 
172  TrackingVolume& tvol,
173  BoundarySurfaceFace face,
174  BinnedArray<TrackingVolume>* insidevolarray) const override;
175 
177  TrackingVolume& tvol,
178  BoundarySurfaceFace face,
179  SharedObject<BinnedArray<TrackingVolume>> insidevolarray) const override;
180 
191  BoundarySurfaceFace face,
192  TrackingVolume* outsidevol) const override;
193 
200  TrackingVolume& tvol,
201  BoundarySurfaceFace face,
202  BinnedArray<TrackingVolume>* outsidevolarray) const override;
203 
205  TrackingVolume& tvol,
206  BoundarySurfaceFace face,
207  SharedObject<BinnedArray<TrackingVolume>> outsidevolarray) const override;
208 
209 private:
211  std::unique_ptr<Trk::LayerMaterialProperties> layerMaterialProperties(const Trk::Surface& sf) const;
212 
221  static void fillGlueVolumes(const std::vector<TrackingVolume*>& topLevelVolumes,
222  const std::vector<TrackingVolume*>& envelopeFaceVolumes,
223  BoundarySurfaceFace glueFace,
224  std::vector<Trk::TrackingVolume*>& glueVols);
225 
226  static void fillGlueVolumes(const std::vector<std::shared_ptr<TrackingVolume>>& topLevelVolumes,
227  const std::vector<std::shared_ptr<TrackingVolume>>& envelopeFaceVolumes,
228  BoundarySurfaceFace glueFace,
229  std::vector<Trk::TrackingVolume*>& glueVols);
230 
231 
233  void glueTrackingVolumes(const std::vector<std::shared_ptr<TrackingVolume>>& glueVols,
234  BoundarySurfaceFace glueFace,
235  BoundarySurfaceFace secondFace) const;
236 
237  void glueTrackingVolumes(const std::vector<TrackingVolume*>& glueVols,
238  BoundarySurfaceFace glueFace,
239  BoundarySurfaceFace secondFace) const;
240  PublicToolHandle<ILayerArrayCreator>
241  m_layerArrayCreator{this, "LayerArrayCreator", "Trk::LayerArrayCreator/LayerArrayCreator"};
242  ToolHandle<ITrackingVolumeArrayCreator>
243  m_trackingVolumeArrayCreator{this, "TrackingVolumeArrayCreator", "Trk::TrackingVolumeArrayCreator/TrackingVolumeArrayCreator"};
244 
246  Gaudi::Property<int> m_barrelLayerBinsZ{this, "BarrelLayerBinsZ", 1};
247  Gaudi::Property<int> m_barrelLayerBinsPhi{this, "BarrelLayerBinsPhi", 1};
248  Gaudi::Property<int> m_endcapLayerBinsR{this, "EndcapLayerBinsR", 1};
249  Gaudi::Property<int> m_endcapLayerBinsPhi{this, "EndcapLayerBinsPhi", 1};
250 
251  static constexpr double s_layerThickness =
252  1. * Gaudi::Units::mm;
253 };
254 
255 }
256 
257 #endif
258 
Trk::TrackingVolumeManipulator
Definition: TrackingVolumeManipulator.h:32
Trk::TrackingVolumeHelper::setOutsideTrackingVolumeArray
void setOutsideTrackingVolumeArray(TrackingVolume &tvol, BoundarySurfaceFace face, SharedObject< BinnedArray< TrackingVolume >> outsidevolarray) const override
Trk::TrackingVolumeHelper::setOutsideTrackingVolumeArray
void setOutsideTrackingVolumeArray(TrackingVolume &tvol, BoundarySurfaceFace face, BinnedArray< TrackingVolume > *outsidevolarray) const override
protected method to set outside VolumeArray of a BoundarySurface: input:
Definition: TrackingVolumeHelper.cxx:921
Trk::TrackingVolumeHelper::m_barrelLayerBinsPhi
Gaudi::Property< int > m_barrelLayerBinsPhi
material bins in Phi
Definition: TrackingVolumeHelper.h:247
Trk::TrackingVolumeHelper::m_barrelLayerBinsZ
Gaudi::Property< int > m_barrelLayerBinsZ
material bins in Z
Definition: TrackingVolumeHelper.h:246
Trk::TrackingVolumeHelper::setOutsideTrackingVolume
void setOutsideTrackingVolume(TrackingVolume &tvol, BoundarySurfaceFace face, TrackingVolume *outsidevol) const override
protected method to set outside Volume of a BoundarySurface: input:
Definition: TrackingVolumeHelper.cxx:912
Trk::TrackingVolumeHelper::m_layerArrayCreator
PublicToolHandle< ILayerArrayCreator > m_layerArrayCreator
A Tool for coherent LayerArray creation.
Definition: TrackingVolumeHelper.h:241
Trk::TrackingVolumeHelper::m_endcapLayerBinsPhi
Gaudi::Property< int > m_endcapLayerBinsPhi
material bins in Phi
Definition: TrackingVolumeHelper.h:249
Trk::TrackingVolumeHelper::fillGlueVolumes
static void fillGlueVolumes(const std::vector< TrackingVolume * > &topLevelVolumes, const std::vector< TrackingVolume * > &envelopeFaceVolumes, BoundarySurfaceFace glueFace, std::vector< Trk::TrackingVolume * > &glueVols)
Private method - it takes the full vector of given volumes to create the supervolume,...
Definition: TrackingVolumeHelper.cxx:707
Trk::TrackingVolumeHelper
Definition: TrackingVolumeHelper.h:57
Trk::BoundarySurfaceFace
BoundarySurfaceFace
Definition: BoundarySurfaceFace.h:31
Trk::TrackingVolumeHelper::glueTrackingVolumeArrays
Trk::TrackingVolume * glueTrackingVolumeArrays(TrackingVolume &firstVol, BoundarySurfaceFace firstFace, TrackingVolume &secondVol, BoundarySurfaceFace secondFace, std::string name) const override
Method to glue two VolumeArrays together (at navigation level)
Definition: TrackingVolumeHelper.cxx:409
GeoPrimitives.h
Trk::TrackingVolumeHelper::setInsideTrackingVolumeArray
void setInsideTrackingVolumeArray(TrackingVolume &tvol, BoundarySurfaceFace face, BinnedArray< TrackingVolume > *insidevolarray) const override
protected method to set inside VolumeArray of a BoundarySurface: input:
Definition: TrackingVolumeHelper.cxx:896
Trk::TrackingVolumeHelper::setInsideTrackingVolume
void setInsideTrackingVolume(TrackingVolume &tvol, BoundarySurfaceFace face, TrackingVolume *insidevol) const override
protected method to set inside Volume of a BoundarySurface: input:
Definition: TrackingVolumeHelper.cxx:888
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::TrackingVolumeHelper::~TrackingVolumeHelper
virtual ~TrackingVolumeHelper()
Destructor.
AthAlgTool.h
Trk::TrackingVolumeHelper::s_layerThickness
static constexpr double s_layerThickness
standard layer thickness
Definition: TrackingVolumeHelper.h:251
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrackingVolumeManipulator.h
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
Trk::TrackingVolumeHelper::layerMaterialProperties
std::unique_ptr< Trk::LayerMaterialProperties > layerMaterialProperties(const Trk::Surface &sf) const
< helper method to construct barrel material
Definition: TrackingVolumeHelper.cxx:843
Trk::SharedObject
std::shared_ptr< T > SharedObject
Definition: SharedObject.h:24
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
Trk::TrackingVolumeHelper::TrackingVolumeHelper
TrackingVolumeHelper(const std::string &, const std::string &, const IInterface *)
Constructor.
Definition: TrackingVolumeHelper.cxx:50
Trk::TrackingVolumeHelper::m_endcapLayerBinsR
Gaudi::Property< int > m_endcapLayerBinsR
material bins in R
Definition: TrackingVolumeHelper.h:248
Trk::TrackingVolumeHelper::initialize
StatusCode initialize() override
AlgTool initialize method.
Definition: TrackingVolumeHelper.cxx:60
Trk::BinnedArray
Definition: BinnedArray.h:38
AthAlgTool
Definition: AthAlgTool.h:26
Trk::ITrackingVolumeHelper
Definition: ITrackingVolumeHelper.h:42
Trk::TrackingVolumeHelper::setInsideTrackingVolumeArray
void setInsideTrackingVolumeArray(TrackingVolume &tvol, BoundarySurfaceFace face, SharedObject< BinnedArray< TrackingVolume >> insidevolarray) const override
Trk::TrackingVolumeHelper::glueTrackingVolumes
void glueTrackingVolumes(TrackingVolume &firstVol, BoundarySurfaceFace firstFace, TrackingVolume &secondVol, BoundarySurfaceFace secondFace, bool buildBoundaryLayer=false) const override
Method to glue two Volumes together input:
Definition: TrackingVolumeHelper.cxx:70
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
checker_macros.h
Define macros for attributes used to control the static checker.
Trk::TrackingVolume
Definition: TrackingVolume.h:121
Material
@ Material
Definition: MaterialTypes.h:8
Trk::TrackingVolumeHelper::m_trackingVolumeArrayCreator
ToolHandle< ITrackingVolumeArrayCreator > m_trackingVolumeArrayCreator
Helper Tool to create TrackingVolume.
Definition: TrackingVolumeHelper.h:243
ITrackingVolumeHelper.h