20#include "GaudiKernel/MsgStream.h"
38 std::make_move_iterator(garbageVec.begin()),
39 std::make_move_iterator(garbageVec.end()));
43 std::make_move_iterator(garbageVec.begin()),
44 std::make_move_iterator(garbageVec.end()));
52 while (currentVolume != searchVolume && searchVolume) {
53 currentVolume = searchVolume;
56 return (currentVolume);
59std::vector<const Trk::DetachedTrackingVolume*>
76 while (currentVolume != searchVolume && searchVolume) {
77 currentVolume = searchVolume;
81 return (currentVolume);
90 std::string indent =
"";
91 for (
int l = 0; l < lvl; ++l){
98 if (confinedVolumes) {
99 std::span<Trk::TrackingVolume* const> volumes = confinedVolumes->
arrayObjects();
100 for (
const auto& volumesIter : volumes){
108 if (!confinedDenseVolumes.empty()) {
109 for (
const auto& volumesIter : confinedDenseVolumes){
117 if (!confinedDetachedVolumes.empty()) {
118 for (
const auto& volumesIter : confinedDetachedVolumes){
120 tvol.
inside(volumesIter->trackingVolume()->center(), 0.)){
128 for (
const auto & bound : bounds) {
140 <<
"====== Calling TrackingGeometry::compactify() ===== " << std::endl;
142 size_t cSurfaces = 0;
143 size_t tSurfaces = 0;
147 msg << MSG::VERBOSE <<
" --> set TG ownership of " << cSurfaces <<
" out of "
148 << tSurfaces << std::endl;
150 bLayerIter.first->surfaceRepresentation().setOwner(
Trk::TGOwn);
153 <<
" boundary layers." << std::endl;
170 return checkoutVolume;
176 msg <<
"TrackingGeometry Summary : " << std::endl;
189 int sublevel = lvl + 1;
191 for (
int indent = 0; indent < sublevel; ++indent)
193 msg <<
"TrackingVolume ( at : " << (&tvol) <<
") name: " << tvol.
volumeName()
197 if (confinedLayers) {
198 std::span<Trk::Layer const* const> layers =
200 for (
int indent = 0; indent < sublevel; ++indent)
202 msg <<
"- found : " << layers.size() <<
" confined Layers" << std::endl;
207 if (confinedVolumes) {
208 std::span<Trk::TrackingVolume const* const> volumes =
211 for (
int indent = 0; indent < sublevel; ++indent)
213 msg <<
"- found : " << volumes.size() <<
" confined TrackingVolumes"
216 for (
const auto& volumesIter : volumes)
223 if (!confinedDenseVolumes.empty()) {
224 for (
int indent = 0; indent < sublevel; ++indent) {
227 msg <<
"- found : " << confinedDenseVolumes.size()
228 <<
" confined unordered (dense) TrackingVolumes" << std::endl;
230 for (
const auto& volumesIter : (confinedDenseVolumes))
240 m_world->indexContainedStaticLayers(geosit, offset);
241 m_world->indexContainedMaterialLayers(geosit, offset);
250 bool isAtBoundary =
false;
254 for (
size_t ib = 0; ib < bounds.size(); ++ib) {
255 const Trk::Surface& surf = bounds[ib]->surfaceRepresentation();
271 bool isAtBoundary =
false;
276 for (
size_t ib = 0; ib < bounds.size(); ++ib) {
277 const Trk::Surface& surf = bounds[ib]->surfaceRepresentation();
281 bounds[ib]->attachedVolume(gp, mom, dir);
282 if (!nextVol && attachedVol)
283 nextVol = attachedVol;
294 out <<
head <<
" [" << bound_layers.second <<
"] ";
298 for (
const std::pair<const std::string, const TrackingVolume*>& volume :
m_trackingVolumes) {
299 out <<
head <<
" [" << counter++ <<
"] " << volume.first <<
" volumeBound=";
300 volume.second->volumeBounds().dump(out);
303 volume.second->confinedArbitraryLayers();
304 if (!confArbLayers.empty()) {
306 for (
const Layer* confined_layer : confArbLayers) {
307 out <<
head <<
" [" << counter++ <<
"] " << volume.first
308 <<
" confinedArbitrary layer " << j++ <<
" ";
312 if (volume.second->confinedLayers()) {
314 for (
const Layer* confined_layer :
315 volume.second->confinedLayers()->arrayObjects()) {
316 out <<
head <<
" [" << counter++ <<
"] " << volume.first
317 <<
" confined layer" << j++ <<
" ";
326 const std::string&
head,
332 out <<
head << layer->layerIndex().value() <<
" [t=" << layer->layerType()
333 <<
"] d=" << layer->thickness();
334 out << layer->surfaceRepresentation();
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.
Base Class for a Detector Layer in the Tracking realm.
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.
Abstract Base Class for tracking surfaces.
virtual bool isOnSurface(const Amg::Vector3D &glopo, const BoundaryCheck &bchk=true, double tol1=0., double tol2=0.) const
This method returns true if the GlobalPosition is on the Surface for both, within or without check of...
const Trk::MaterialLayer * materialLayer() const
return the material Layer
std::vector< const Trk::DetachedTrackingVolume * > lowestDetachedTrackingVolumes(const Amg::Vector3D &gp) const
return the vector of lowest detached tracking Volume(->overlaps)
virtual ~TrackingGeometry()
Destructor.
void addToGarbage(std::vector< std::unique_ptr< Trk::DetachedTrackingVolume > > &&garbageVec)
TrackingVolume * m_world
The known world - and the beam.
void dump(MsgStream &out, const std::string &head) const
static bool atVolumeBoundary(const Amg::Vector3D &gp, const TrackingVolume *vol, double tol)
check position at volume boundary
std::map< Layer *, int > m_boundaryLayers
The unique boundary Layers.
static void dumpLayer(MsgStream &out, const std::string &head, const Layer *layer)
void registerTrackingVolumes(TrackingVolume &tvol, TrackingVolume *mvol=nullptr, int lvl=0)
private method to register recursively the tracking volumes
const TrackingVolume * highestTrackingVolume() const
return the world
std::vector< std::unique_ptr< DetachedTrackingVolume > > m_detachedVolGarbage
In some cases the Tracking Geometry needs to keep certain objectss alive delete them at the end of it...
std::vector< std::unique_ptr< TrackingVolume > > m_trkVolumeGarbage
void indexStaticLayers(GeometrySignature geosit, int offset=0)
indexLayers : method to re-set the index of the layers, depending on geometrySignature
void compactify(MsgStream &msgstream, TrackingVolume *vol=nullptr)
Geometry Builder busineess: set all contained surfaces TG owned - this should save memory and avoid s...
const TrackingVolume * lowestTrackingVolume(const Amg::Vector3D &gp) const
return the lowest tracking Volume
const TrackingVolume * lowestStaticTrackingVolume(const Amg::Vector3D &gp) const
return the lowest static tracking Volume
void synchronizeLayers(MsgStream &msgstream, TrackingVolume *vol=nullptr)
Geometry Builder business: synchronize all layers to enclosed volume dimensions.
void printVolumeInformation(MsgStream &msgstream, const TrackingVolume &tvol, int lvl) const
print VolumeInformation with Level
NavigationLevel m_navigationLevel
The Navigation level for identification.
void printVolumeHierarchy(MsgStream &msgstream) const
Print the summary of volume Hierarchy of the TrackingGeometry.
TrackingVolume * checkoutHighestTrackingVolume()
private method to be called from GeometryBuilder: return the world with ownership
std::map< const std::string, const TrackingVolume * > m_trackingVolumes
The Volumes in a map for later finding.
TrackingGeometry(TrackingVolume *highestVolume, NavigationLevel navlevel=globalSearch)
Constructor.
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
void setMotherVolume(const TrackingVolume *mvol)
set the MotherVolume
const LayerArray * confinedLayers() const
Return the subLayer array.
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.
const TrackingVolume * associatedSubVolume(const Amg::Vector3D &gp) const
Return the associated sub Volume, returns THIS if no subVolume exists.
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.
void synchronizeLayers(MsgStream &msgstream, double envelope=1.)
method to synchronize the layers with potentially updated volume bounds:
ArraySpan< DetachedTrackingVolume const *const > confinedDetachedVolumes() const
Return detached subVolumes - not the ownership.
void compactify(size_t &rSurfaces, size_t &tSurfaces)
compactify the memory usage in the event by setting ownership to TackingGeometry the referenced types...
ArraySpan< TrackingVolume const *const > confinedDenseVolumes() const
Return unordered subVolumes - not the ownership.
bool inside(const Amg::Vector3D &gp, double tol=0.) const
Inside() method for checks.
std::string head(std::string s, const std::string &pattern)
head of a string
Eigen::Matrix< double, 3, 1 > Vector3D
PropDirection
PropDirection, enum for direction of the propagation.
NavigationLevel
destinguishes an association TrackingGeometry with one for global search
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)