11#include "GaudiKernel/MsgStream.h"
51 std::unique_ptr<Amg::Transform3D> htrans,
52 std::shared_ptr<VolumeBounds> volbounds,
53 std::unique_ptr<LayerArray> subLayers,
54 std::unique_ptr<TrackingVolumeArray> subVolumes,
71 std::unique_ptr<LayerArray> subLayers,
72 std::unique_ptr<TrackingVolumeArray> subVolumes,
87 std::unique_ptr<Amg::Transform3D> htrans,
88 std::shared_ptr<VolumeBounds> volbounds,
90 std::unique_ptr<LayerArray> subLayers,
91 std::unique_ptr<TrackingVolumeArray> subVolumes,
106 std::unique_ptr<Amg::Transform3D> htrans,
107 std::shared_ptr<VolumeBounds> volbounds,
109 std::unique_ptr<std::vector<DetachedTrackingVolume*>> detachedSubVolumes,
123 std::unique_ptr<std::vector<DetachedTrackingVolume*>> detachedSubVolumes,
135 std::unique_ptr<Amg::Transform3D> htrans,
136 std::shared_ptr<VolumeBounds> volbounds,
138 std::unique_ptr<
const std::vector<TrackingVolume*>> unorderedSubVolumes,
152 std::unique_ptr<
const std::vector<TrackingVolume*>> unorderedSubVolumes,
164 std::unique_ptr<Amg::Transform3D> htrans,
165 std::shared_ptr<VolumeBounds> volbounds,
167 std::unique_ptr<
const std::vector<Layer*>> layers,
180 std::unique_ptr<
const std::vector<Layer*>> layers,
192 std::unique_ptr<Amg::Transform3D> htrans,
193 std::shared_ptr<VolumeBounds> volbounds,
194 std::unique_ptr<
const std::vector<Layer*>> layers,
195 std::unique_ptr<
const std::vector<TrackingVolume*>> unorderedSubVolumes,
210 std::unique_ptr<
const std::vector<Layer*>> layers,
211 std::unique_ptr<
const std::vector<TrackingVolume*>> unorderedSubVolumes,
237 in = trVol.
boundarySurfaces()[ib]->insideVolume() == &trVol ? this :
nullptr;
238 out = in ==
nullptr ? this :
nullptr;
272 std::span<Trk::Layer const* const> layers =
confinedLayers->arrayObjects();
273 std::vector<std::shared_ptr<Trk::Layer>> layerOrder;
274 layerOrder.reserve(layers.size());
275 for (
const auto *layer : layers) {
279 layerOrder.push_back(std::shared_ptr<Trk::Layer>(newlay));
287 std::vector<std::shared_ptr<Trk::Layer>>(layerOrder),
297 std::vector<Trk::Layer*> uLayers;
298 uLayers.reserve(confinedArbitraryLayers.size());
299 for (const auto *confinedArbitraryLayer : confinedArbitraryLayers) {
300 const Trk::SubtractedPlaneLayer* slayer =
301 dynamic_cast<const Trk::SubtractedPlaneLayer*>(
302 confinedArbitraryLayer);
303 const Trk::SubtractedCylinderLayer* sclayer =
304 dynamic_cast<const Trk::SubtractedCylinderLayer*>(
305 confinedArbitraryLayer);
306 const Trk::PlaneLayer* layer =
307 dynamic_cast<const Trk::PlaneLayer*>(confinedArbitraryLayer);
308 const Trk::CylinderLayer* clayer =
309 dynamic_cast<const Trk::CylinderLayer*>(confinedArbitraryLayer);
312 Trk::SubtractedPlaneLayer* lay = new Trk::SubtractedPlaneLayer(*slayer, transform);
313 uLayers.push_back(lay);
315 Trk::PlaneLayer* lay = new Trk::PlaneLayer(*layer, transform);
316 uLayers.push_back(lay);
317 } else if (sclayer) {
318 Trk::SubtractedCylinderLayer* lay = new Trk::SubtractedCylinderLayer(*sclayer, transform);
319 uLayers.push_back(lay);
321 Trk::CylinderLayer* lay = new Trk::CylinderLayer(*clayer, transform);
322 uLayers.push_back(lay);
330 trVol.confinedVolumes();
331 if (confinedVolumes) {
333 std::span<Trk::TrackingVolume const * const > volumes =
335 std::vector<std::shared_ptr<Trk::TrackingVolume>> volOrder;
336 volOrder.reserve(volumes.size());
337 for (
const auto *volume : volumes) {
339 volOrder.push_back(std::shared_ptr<TrackingVolume>(vol));
345 m_confinedVolumes = std::make_unique<Trk::NavBinnedArray1D<Trk::TrackingVolume>>(
347 std::vector<std::shared_ptr<Trk::TrackingVolume>>(volOrder),
353 trVol.confinedDenseVolumes();
354 if (!confinedDenseVolumes.empty()) {
355 std::vector<Trk::TrackingVolume*> newVol;
356 newVol.reserve(confinedDenseVolumes.size());
358 for (const auto *confinedDenseVolume : confinedDenseVolumes) {
359 Trk::TrackingVolume* vol = new Trk::TrackingVolume(*confinedDenseVolume, transform);
360 newVol.push_back(vol);
362 m_confinedDenseVolumes = std::make_unique<
const std::vector<Trk::TrackingVolume*>>(newVol);
371 delete confinedDenseVolume;
376 delete confinedArbitraryLayer;
391 if (confinedArbitraryLayer->isOnLayer(gp)){
392 return confinedArbitraryLayer;
409 if (confinedArbitraryLayer->isOnLayer(gp)){
410 return confinedArbitraryLayer;
420 bool associatedResult,
421 bool skipNavLayer)
const
451 std::vector<const Layer*> layerCandidates;
456 for (
size_t ib = 0; ib < bSurfaces.size(); ++ib) {
457 if (bSurfaces[ib]->surfaceRepresentation().materialLayer()){
458 layerCandidates.push_back(bSurfaces[ib]->surfaceRepresentation().materialLayer());
476 if (previousMatLayer){
477 layerCandidates.push_back(previousMatLayer);
480 layerCandidates.push_back(nextMatLayer);
483 layerCandidates.push_back(assocLayer);
490 if (!layerCandidates.empty()) {
491 const Layer* cLayer =
nullptr;
493 for (
auto& lcIter : layerCandidates) {
499 (*lcIter).surfaceRepresentation().straightLineIntersection(
500 gp, dirScalor * dir, forceDir, bchk);
504 laySurfIntersection = sfI;
523 return (nVolume && nVolume !=
this)
526 laySurfIntersection,
nullptr,
nullptr,
nullptr, pDir);
538 if (confinedDetachedVolume->trackingVolume()->inside(gp, 0.001)){
539 return confinedDetachedVolume->trackingVolume();
546 if (confinedDenseVolume->inside(gp, 0.001)){
547 return confinedDenseVolume;
564 if (confinedDetachedVolume->trackingVolume()->inside(gp, 0.001)){
565 return confinedDetachedVolume->trackingVolume();
572 if (confinedDenseVolume->inside(gp, 0.001)){
573 return confinedDenseVolume;
593 double pathLength = 10e10;
596 for (
size_t ib = 0; ib < bSurfaces.size(); ++ib) {
599 bSurfaces[ib]->surfaceRepresentation().straightLineIntersection(
600 gp, cDir, forceDir,
true);
607 nVolume = bSurfaces[ib]->attachedVolume(gp, cDir, attachedDir);
623std::vector<const Trk::DetachedTrackingVolume*>
627 auto currVols = std::vector<const Trk::DetachedTrackingVolume*>();
631 if (!detVols.empty()) {
632 for (
const auto *detVol : detVols) {
633 if (detVol->trackingVolume()->inside(gp, tol)){
634 currVols.push_back(detVol);
649 std::span<Trk::Layer* const> layers =
confinedLayers()->arrayObjects();
653 if (layerptr && layerptr->layerIndex().value() < 0) {
656 layerptr->layerMaterialProperties()
661 layerptr->registerLayerIndex(layIndex);
668 for (
const auto& bsIter : bSurfaces) {
680 std::span<Trk::TrackingVolume* const > volumes =
confinedVolumes()->arrayObjects();
681 for (
const auto& volumesIter : volumes) {
683 volumesIter->indexContainedStaticLayers(geoSig, offset);
696 std::span<Trk::Layer * const> layers =
confinedLayers()->arrayObjects();
703 std::span<Trk::Surface * const> layerSurfaces = surfArray->
arrayObjects();
727 std::span<Trk::TrackingVolume * const> volumes =
confinedVolumes()->arrayObjects();
730 volumesIter->indexContainedMaterialLayers(geoSig, offset);
739 float flin =
pow(fact, 0.33);
741 double invX0 =
X0 > 0. ? 1. /
X0 : 0.;
742 double sum_invX0 = invX0 + flin / mprop.
X0;
745 double invL0 =
L0 > 0. ? 1. /
L0 : 0.;
746 double sum_invL0 = invL0 + flin / mprop.
L0;
752 float n1 =
Z > 0. ? rho1 /
Z : 0.;
753 float n2 = fact * mprop.
rho / mprop.
Z;
756 n1 =
A > 0. ? rho1 /
A : 0.;
757 n2 = fact * mprop.
rho / mprop.
A;
778 std::span<Trk::TrackingVolume* const> volumes =
780 for (
const auto& volumesIter : volumes){
782 volumesIter->sign(geosign, geotype);
789 if (!confDetachedVolumes.empty()) {
790 for (
const auto& volumesIter : confDetachedVolumes) {
792 volumesIter->sign(geosign, geotype);
799 if (!confDenseVolumes.empty()) {
800 for (
const auto& volumesIter : confDenseVolumes) {
802 volumesIter->sign(geosign, geotype);
808std::vector<std::shared_ptr<Trk::BoundarySurface<Trk::TrackingVolume>>>&
832 std::vector<std::shared_ptr<Trk::BoundarySurface<Trk::TrackingVolume>>>();
834 std::vector<std::unique_ptr<Trk::Surface>> surfaces =
836 auto surfIter = surfaces.begin();
839 unsigned int sfCounter = 0;
840 unsigned int sfNumber = surfaces.size();
852 bool subtr = (subtrVol) ? 1 : 0;
853 bool comb = (combVol) ? 1 : 0;
855 if (!subtr && !comb) {
860 for (; surfIter != surfaces.end(); ++surfIter) {
873 if (spbVol && sfCounter == 1) {
902 (sfCounter == 4 && sfNumber > 3) ?
nullptr :
this;
910 (sfCounter == 4 && sfNumber > 3) ?
nullptr :
this;
914 inner, outer, *csf));
920 const std::vector<bool> bOrient =
923 for (; surfIter != surfaces.end(); ++surfIter) {
973 std::span<Trk::Layer* const>::iterator layerIter = layers.begin();
974 for (; layerIter != layers.end(); ++layerIter) {
980 (**layerIter).setPreviousLayer(lastLayer);
982 (**layerIter).encloseTrackingVolume(*
this);
984 lastLayer = (*layerIter);
988 layerIter = layers.end();
990 for (;; --layerIter) {
992 (**layerIter).setNextLayer(lastLayer);
994 lastLayer = (*layerIter);
995 if (layerIter == layers.begin()) {
1006 return checkoutLayers;
1038 this->m_transform = std::make_unique<Amg::Transform3D>(transf);
1040 this->
m_transform = std::make_unique<Amg::Transform3D>(shift);
1053 first.surfaceRepresentation().straightLineDistanceEstimate(pos, dir);
1055 second.surfaceRepresentation().straightLineDistanceEstimate(pos, dir);
1078 if (!confArbLayers.empty()){
1095 if (!confDenseVolumes.empty())
1110 if (clay->surfaceRepresentation().type() ==
1112 !(
center().isApprox(clay->surfaceRepresentation().center()))) {
1118 msgstream << MSG::WARNING
1119 <<
" ---> found 0 pointer to layer in Volume [ "
1125 for (
const auto& cVolumesIter : confVolumes->
arrayObjects())
1126 cVolumesIter->synchronizeLayers(msgstream, envelope);
1136 std::span<Trk::Layer* const> layers = confLayers->
arrayObjects();
1137 for (
const auto& clayIter : layers) {
1138 if (&(*clayIter) !=
nullptr){
1139 clayIter->compactify(cSurfaces, tSurfaces);
1142 std::cout <<
"WARNING: Attempt to compactify nullptr layer in volume : "
1149 if (!confArbLayers.empty()) {
1150 for (
const auto& calayIter : confArbLayers) {
1151 if (calayIter !=
nullptr) {
1152 calayIter->compactify(cSurfaces, tSurfaces);
1154 std::cout <<
"WARNING: Attempt to compactify nullptr layer."
1162 std::span<Trk::TrackingVolume* const> volumes =
1164 for (
const auto& cVolumesIter : volumes) {
1165 cVolumesIter->compactify(cSurfaces, tSurfaces);
1170 if (!confDenseVolumes.empty()){
1171 for (
const auto& cVolumesIter : (confDenseVolumes)) {
1172 cVolumesIter->compactify(cSurfaces, tSurfaces);
1179 cdVolumesIter->compactify(cSurfaces, tSurfaces);
1187 msg <<
"[[ Trk::TrackingVolume ]] called: " <<
volumeName() << std::endl;
1188 msg <<
'\t' <<
'\t' <<
"# position (x,y,z) : " <<
center().x() <<
", "
#define TRKDETDESCR_GEOMETRYSIGNATUREWEIGHT
constexpr int pow(int base, int exp) noexcept
A generic symmetric BinUtility, for fully symmetric binning in terms of binning grid and binning type...
BinningValue binningValue(size_t ba=0) const
The type/value of the binning.
Binned Array for avoiding map searches/.
virtual std::span< T *const > arrayObjects()=0
Return all objects of the Array non-const we can still modify the T.
The BoundaryCheck class allows to steer the way surface boundaries are used for inside/outside checks...
BoundaryCylinderSurface description inside the tracking realm, Extends the Surface description to mak...
BoundaryDiscSurface description inside the tracking realm, it extends the DiscSurface description to ...
BoundaryPlaneSurface description inside the tracking realm, it extends the PlaneSurface description t...
BoundarySubtractedCylinderSurface description inside the tracking realm, it extends the Surface descr...
BoundarySubtractedPlaneSurface description inside the tracking realm, it extends the SubtractedPlaneS...
Description of a BoundarySurface inside the tracking realm, it extends the Surface description to mak...
Bounds for a generic combined volume, the decomposeToSurfaces method creates a vector of n surfaces (...
const std::vector< bool > & boundsOrientation() const
This method returns bounds orientation.
Class for a CylinderSurface in the ATLAS detector.
Class for a DiscSurface in the ATLAS detector.
Access to distance solutions.
double absClosest() const
Absolute Distance to closest solution.
Descriptor class to hold GlueVolumes of a TrackingGeometry object.
LayerIndex for the identification of layers in a simplified detector geometry of Cylinders and Discs.
int value() const
layerIndex expressed in an integer
Base Class for a Detector Layer in the Tracking realm.
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
const Layer * previousLayer(bool skipNavLayer=false) const
getting what's stored to be the previous Layer, boolean to skip navigation layers
const Layer * nextLayer(const Amg::Vector3D &gp, const Amg::Vector3D &udir) const
getting the next/previous Layer if registered - unit for direction vector required
const LayerMaterialProperties * layerMaterialProperties() const
getting the LayerMaterialProperties including full/pre/post update
void registerLayerIndex(const LayerIndex &lIdx)
const LayerIndex & layerIndex() const
get the layerIndex
A material layer is a simple helper class to attach material information to a boundary surface.
virtual const Surface & surfaceRepresentation() const override=0
Transforms the layer into a Surface representation for extrapolation.
A common object to be contained by.
Material()
Default Constructor needed for POOL.
Avoiding a map search, the templated BinnedArray class can help ordereing geometrical objects by prov...
Class to be used for gaps in Volumes as a navigational link.
Class to describe a planar detector layer for tracking, it inhertis from both, Layer base class and P...
Class for a planaer rectangular or trapezoidal surface in the ATLAS detector.
Bounds for the exact transcript of the GeoSimplePolygonBrep; volume defined by combination of symm....
Class for a cylinder subtracted/shared surface in the ATLAS detector.
Class for a planar subtracted/shared surface in the ATLAS detector.
Bounds for a generic subtracted volume, the decomposeToSurfaces method creates a vector of n surfaces...
const std::vector< bool > & boundsOrientation() const
This method returns bounds orientation.
Abstract Base Class for tracking surfaces.
const Trk::MaterialLayer * materialLayer() const
return the material Layer
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
const LayerArray * confinedLayers() const
Return the subLayer array.
const TrackingVolume * nextVolume(const Amg::Vector3D &gp, const Amg::Vector3D &dir, PropDirection pDir=alongMomentum) const
Return the next volume along the navigation stream.
LayerIntersection< Amg::Vector3D > closestMaterialLayer(const Amg::Vector3D &gp, const Amg::Vector3D &dir, PropDirection pDir=alongMomentum, const BoundaryCheck &bchk=true) const
Return the closest layer with material description.
void moveTV(Amg::Transform3D &transform)
move the Tracking Volume
void indexContainedMaterialLayers(GeometrySignature geoSig, int &offset)
reIndex the material layers of the TrackingVolume
const TrackingVolume * nextSubVolume(const Amg::Vector3D &gp, const Amg::Vector3D &dir) const
Return the next sub Volume if existing, returns THIS if no subVolume exists.
std::unique_ptr< LayerAttemptsCalculator > m_layerAttemptsCalculator
defines how the Extrapolator propagates through this
TrackingVolume()=default
Default Constructor.
const Layer * associatedLayer(const Amg::Vector3D &gp) const
Return the associated Layer.
unsigned int m_colorCode
Color code for displaying.
const LayerArray * checkoutConfinedLayers() const
Return the subLayerarray including the ownership.
const TrackingVolumeArray * confinedVolumes() const
Return the subLayer array.
std::vector< const DetachedTrackingVolume * > assocDetachedSubVolumes(const Amg::Vector3D &gp, double tol) const
Return the associated detached subvolumes.
std::unique_ptr< const std::vector< TrackingVolume * > > m_confinedDenseVolumes
Additionally, Unordered Layers inside the Volume (we own the elements)
const TrackingVolume * associatedSubVolume(const Amg::Vector3D &gp) const
Return the associated sub Volume, returns THIS if no subVolume exists.
void indexContainedStaticLayers(GeometrySignature geoSig, int &offset)
reIndex the static layers of the TrackingVolume
std::vector< std::shared_ptr< BoundarySurface< TrackingVolume > > > & boundarySurfaces()
Method to return the BoundarySurfaces.
const std::string & volumeName() const
Returns the VolumeName - for debug reason, might be depreciated later.
std::unique_ptr< const std::vector< DetachedTrackingVolume * > > m_confinedDetachedVolumes
Additionally, Unordered subvolumes (we own the elements)
std::unique_ptr< LayerArray > m_confinedLayers
Array of Volumes inside the Volume.
const Layer * nextLayer(const Amg::Vector3D &gp, const Amg::Vector3D &mom, bool asres=true, bool skipNavLayer=false) const
Return the next Layer if existing, NULL if no next layer corresponds.
std::unique_ptr< TrackingVolumeArray > m_confinedVolumes
Detached subvolumes.
std::string m_name
Volume name for debug reasons.
void registerOutsideGlueVolumes(GlueVolumesDescriptor *gvd)
Register the outside glue volumes - ordering is in the TrackingVolume Frame:
void addMaterial(const Material &mat, float fact=1.)
add Material
void interlinkLayers()
Register Next - Previous for Layers, set volumelink.
void synchronizeLayers(MsgStream &msgstream, double envelope=1.)
method to synchronize the layers with potentially updated volume bounds:
void moveVolume(Amg::Transform3D &shift)
move Volume
CxxUtils::CachedUniquePtrT< GlueVolumesDescriptor > m_outsideGlueVolumes
provided the number of layer attempts
ArraySpan< DetachedTrackingVolume const *const > confinedDetachedVolumes() const
Return detached subVolumes - not the ownership.
void sign(GeometrySignature signat, GeometryType gtype=Static)
sign the volume - the geometry builder has to do that
void compactify(size_t &rSurfaces, size_t &tSurfaces)
compactify the memory usage in the event by setting ownership to TackingGeometry the referenced types...
const TrackingVolume * m_motherVolume
boundary Surfaces, they can be shared between volumes
std::vector< std::shared_ptr< BoundarySurface< TrackingVolume > > > m_boundarySurfaces
GeometryType m_geometryType
The Signature done by the GeometryBuilder.
void createLayerAttemptsCalculator()
Create Layer Attempts Caluclator.
std::unique_ptr< const std::vector< Layer * > > m_confinedArbitraryLayers
void screenDump(MsgStream &msg) const
GlueVolumesDescriptor & glueVolumesDescriptor()
const BoundarySurface< TrackingVolume > * boundarySurface(const ObjectAccessor::value_type &oa) const
Get the BoundarySurface to the appointed Accessor state.
static const Layer * closest(const Amg::Vector3D &pos, const Amg::Vector3D &dir, const Layer &first, const Layer &second)
Helper method - find closest of two layers.
ArraySpan< Layer const *const > confinedArbitraryLayers() const
Return the confined subLayer array.
void createBoundarySurfaces()
Create Boundary Surface.
ArraySpan< TrackingVolume const *const > confinedDenseVolumes() const
Return unordered subVolumes - not the ownership.
virtual ~TrackingVolume() override
Destructor.
GeometrySignature m_geometrySignature
virtual std::vector< std::unique_ptr< Trk::Surface > > decomposeToSurfaces(const Amg::Transform3D &transform)=0
Method to decompose the Bounds into Surfaces, the Volume can turn them into BoundarySurfaces.
Volume()=default
Defaults copies are special due ot unique ptr data member.
const Amg::Vector3D & center() const
returns the center of the volume
const Amg::Transform3D & transform() const
Return methods for geometry transform.
const VolumeBounds & volumeBounds() const
returns the volumeBounds()
Amg::Vector3D m_center
center position of the surface
std::unique_ptr< Amg::Transform3D > m_transform
Transform3D (optional)
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
PropDirection
PropDirection, enum for direction of the propagation.
BinnedArray< Layer > LayerArray
simply for the eye
BinnedArray< Surface > SurfaceArray
FullIntersection< Layer, Surface, T > LayerIntersection