20#include "GaudiKernel/MsgStream.h"
37 std::make_move_iterator(garbageVec.begin()),
38 std::make_move_iterator(garbageVec.end()));
42 std::make_move_iterator(garbageVec.begin()),
43 std::make_move_iterator(garbageVec.end()));
51 while (currentVolume != searchVolume && searchVolume) {
52 currentVolume = searchVolume;
55 return (currentVolume);
58std::vector<const Trk::DetachedTrackingVolume*>
75 while (currentVolume != searchVolume && searchVolume) {
76 currentVolume = searchVolume;
80 return (currentVolume);
89 std::string indent =
"";
90 for (
int l = 0; l < lvl; ++l){
97 if (confinedVolumes) {
98 std::span<Trk::TrackingVolume* const> volumes = confinedVolumes->
arrayObjects();
99 for (
const auto& volumesIter : volumes){
107 if (!confinedDenseVolumes.empty()) {
108 for (
const auto& volumesIter : confinedDenseVolumes){
116 if (!confinedDetachedVolumes.empty()) {
117 for (
const auto& volumesIter : confinedDetachedVolumes){
119 tvol.
inside(volumesIter->trackingVolume()->center(), 0.)){
127 for (
const auto & bound : bounds) {
139 <<
"====== Calling TrackingGeometry::compactify() ===== " << std::endl;
141 size_t cSurfaces = 0;
142 size_t tSurfaces = 0;
146 msg << MSG::VERBOSE <<
" --> set TG ownership of " << cSurfaces <<
" out of "
147 << tSurfaces << std::endl;
149 bLayerIter.first->surfaceRepresentation().setOwner(
Trk::TGOwn);
152 <<
" boundary layers." << std::endl;
168 return checkoutVolume;
174 msg <<
"TrackingGeometry Summary : " << std::endl;
187 int sublevel = lvl + 1;
189 for (
int indent = 0; indent < sublevel; ++indent)
191 msg <<
"TrackingVolume ( at : " << (&tvol) <<
") name: " << tvol.
volumeName()
195 if (confinedLayers) {
196 std::span<Trk::Layer const* const> layers =
198 for (
int indent = 0; indent < sublevel; ++indent)
200 msg <<
"- found : " << layers.size() <<
" confined Layers" << std::endl;
205 if (confinedVolumes) {
206 std::span<Trk::TrackingVolume const* const> volumes =
209 for (
int indent = 0; indent < sublevel; ++indent)
211 msg <<
"- found : " << volumes.size() <<
" confined TrackingVolumes"
214 for (
const auto& volumesIter : volumes)
221 if (!confinedDenseVolumes.empty()) {
222 for (
int indent = 0; indent < sublevel; ++indent) {
225 msg <<
"- found : " << confinedDenseVolumes.size()
226 <<
" confined unordered (dense) TrackingVolumes" << std::endl;
228 for (
const auto& volumesIter : (confinedDenseVolumes))
238 m_world->indexContainedStaticLayers(geosit, offset);
239 m_world->indexContainedMaterialLayers(geosit, offset);
248 bool isAtBoundary =
false;
252 for (
size_t ib = 0; ib < bounds.size(); ++ib) {
253 const Trk::Surface& surf = bounds[ib]->surfaceRepresentation();
269 bool isAtBoundary =
false;
274 for (
size_t ib = 0; ib < bounds.size(); ++ib) {
275 const Trk::Surface& surf = bounds[ib]->surfaceRepresentation();
279 bounds[ib]->attachedVolume(gp, mom, dir);
280 if (!nextVol && attachedVol)
281 nextVol = attachedVol;
292 out <<
head <<
" [" << bound_layers.second <<
"] ";
296 for (
const std::pair<const std::string, const TrackingVolume*>& volume :
m_trackingVolumes) {
297 out <<
head <<
" [" << counter++ <<
"] " << volume.first <<
" volumeBound=";
298 volume.second->volumeBounds().dump(out);
301 volume.second->confinedArbitraryLayers();
302 if (!confArbLayers.empty()) {
304 for (
const Layer* confined_layer : confArbLayers) {
305 out <<
head <<
" [" << counter++ <<
"] " << volume.first
306 <<
" confinedArbitrary layer " << j++ <<
" ";
310 if (volume.second->confinedLayers()) {
312 for (
const Layer* confined_layer :
313 volume.second->confinedLayers()->arrayObjects()) {
314 out <<
head <<
" [" << counter++ <<
"] " << volume.first
315 <<
" confined layer" << j++ <<
" ";
324 const std::string&
head,
330 out <<
head << layer->layerIndex().value() <<
" [t=" << layer->layerType()
331 <<
"] d=" << layer->thickness();
332 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)
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.
std::unique_ptr< TrackingVolume > m_world
The known world - and the beam.
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