|
ATLAS Offline Software
|
Go to the documentation of this file.
19 #include "GaudiKernel/MsgStream.h"
25 m_world(highestVolume),
26 m_navigationLevel(navLev) {
33 if (m_world)
delete m_world;
36 std::copy_if(std::make_move_iterator(garbageVec.begin()), std::make_move_iterator(garbageVec.end()),
37 std::back_inserter(m_detachedVolGarbage),
38 [](
const std::unique_ptr<DetachedTrackingVolume>&
ptr){
39 return ptr.get () != nullptr;
44 std::copy_if(std::make_move_iterator(garbageVec.begin()), std::make_move_iterator(garbageVec.end()),
45 std::back_inserter(m_trkVolumeGarbage),
46 [](
const std::unique_ptr<TrackingVolume>&
ptr){
47 return ptr.get () != nullptr;
57 while (currentVolume != searchVolume && searchVolume) {
58 currentVolume = searchVolume;
61 return (currentVolume);
64 std::vector<const Trk::DetachedTrackingVolume*>
81 while (currentVolume != searchVolume && searchVolume) {
82 currentVolume = searchVolume;
86 return (currentVolume);
96 for (
int l = 0;
l < lvl; ++
l,
indent +=
" ")
100 m_trackingVolumes[tvol.
volumeName()] = (&tvol);
103 if (confinedVolumes) {
106 for (
const auto& volumesIter : volumes)
108 registerTrackingVolumes(*volumesIter, &tvol, sublvl);
113 if (!confinedDenseVolumes.empty()) {
114 for (
const auto& volumesIter : confinedDenseVolumes)
116 registerTrackingVolumes(*volumesIter, &tvol, sublvl);
121 if (!confinedDetachedVolumes.empty()) {
122 for (
const auto& volumesIter : confinedDetachedVolumes)
124 tvol.
inside(volumesIter->trackingVolume()->center(), 0.))
125 registerTrackingVolumes(
126 *(volumesIter->trackingVolume()), &tvol, sublvl);
131 for (
const auto & bound : bounds) {
135 int& layerCount{m_boundaryLayers[bLayer]};
144 <<
"====== Calling TrackingGeometry::compactify() ===== " << std::endl;
146 size_t cSurfaces = 0;
147 size_t tSurfaces = 0;
151 msg <<
MSG::VERBOSE <<
" --> set TG ownership of " << cSurfaces <<
" out of "
152 << tSurfaces << std::endl;
153 for (
const auto& bLayerIter : m_boundaryLayers) {
154 bLayerIter.first->surfaceRepresentation().setOwner(
Trk::TGOwn);
156 msg <<
MSG::VERBOSE <<
" --> set TG ownership of " << m_boundaryLayers.size()
157 <<
" boundary layers." << std::endl;
173 m_boundaryLayers.clear();
174 return checkoutVolume;
180 msg <<
"TrackingGeometry Summary : " << std::endl;
184 printVolumeInformation(
msg, *highestVolume,
level);
193 int sublevel = lvl + 1;
197 msg <<
"TrackingVolume ( at : " << (&tvol) <<
") name: " << tvol.
volumeName()
201 if (confinedLayers) {
206 msg <<
"- found : " <<
layers.size() <<
" confined Layers" << std::endl;
211 if (confinedVolumes) {
217 msg <<
"- found : " << volumes.size() <<
" confined TrackingVolumes"
220 for (
const auto& volumesIter : volumes)
222 printVolumeInformation(
msg, *volumesIter, sublevel);
227 if (!confinedDenseVolumes.empty()) {
231 msg <<
"- found : " << confinedDenseVolumes.size()
232 <<
" confined unordered (dense) TrackingVolumes" << std::endl;
234 for (
const auto& volumesIter : (confinedDenseVolumes))
236 printVolumeInformation(
msg, *volumesIter, sublevel);
244 m_world->indexContainedStaticLayers(geosit,
offset);
245 m_world->indexContainedMaterialLayers(geosit,
offset);
254 bool isAtBoundary =
false;
258 for (
size_t ib = 0;
ib < bounds.size(); ++
ib) {
275 bool isAtBoundary =
false;
280 for (
size_t ib = 0;
ib < bounds.size(); ++
ib) {
285 bounds[
ib]->attachedVolume(gp,
mom,
dir);
286 if (!nextVol && attachedVol)
287 nextVol = attachedVol;
297 for (
const auto& bound_layers : m_boundaryLayers) {
298 out <<
head <<
" [" << bound_layers.second <<
"] ";
299 dumpLayer(
out,
"", bound_layers.first);
302 for (
const std::pair<const std::string, const TrackingVolume*>& volume :
304 out <<
head <<
" [" <<
counter++ <<
"] " << volume.first <<
" volumeBound=";
305 volume.second->volumeBounds().dump(
out);
308 volume.second->confinedArbitraryLayers();
309 if (!confArbLayers.empty()) {
311 for (
const Layer* confined_layer : confArbLayers) {
313 <<
" confinedArbitrary layer " << j++ <<
" ";
314 dumpLayer(
out,
"", confined_layer);
317 if (volume.second->confinedLayers()) {
319 for (
const Layer* confined_layer :
320 volume.second->confinedLayers()->arrayObjects()) {
322 <<
" confined layer" << j++ <<
" ";
323 dumpLayer(
out,
"", confined_layer);
331 const std::string&
head,
338 <<
"] d=" <<
layer->thickness();
339 out <<
layer->surfaceRepresentation();
TrackingVolume * m_world
The known world - and the beam.
static bool atVolumeBoundary(const Amg::Vector3D &gp, const TrackingVolume *vol, double tol)
check position at volume boundary
bool inside(const Amg::Vector3D &gp, double tol=0.) const
Inside() method for checks.
void dump(MsgStream &out, const std::string &head) const
std::vector< SharedObject< BoundarySurface< TrackingVolume > > > & boundarySurfaces()
Method to return the BoundarySurfaces.
const TrackingVolume * associatedSubVolume(const Amg::Vector3D &gp) const
Return the associated sub Volume, returns THIS if no subVolume exists.
void registerTrackingVolumes(TrackingVolume &tvol, TrackingVolume *mvol=nullptr, int lvl=0)
private method to register recursively the tracking volumes
ArraySpan< DetachedTrackingVolume const *const > confinedDetachedVolumes() const
Return detached subVolumes - not the ownership.
virtual ~TrackingGeometry()
Destructor.
void synchronizeLayers(MsgStream &msgstream, TrackingVolume *vol=nullptr)
Geometry Builder business: synchronize all layers to enclosed volume dimensions.
const LayerArray * confinedLayers() const
Return the subLayer array.
static void dumpLayer(MsgStream &out, const std::string &head, const Layer *layer)
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...
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
std::vector< const DetachedTrackingVolume * > assocDetachedSubVolumes(const Amg::Vector3D &gp, double tol) const
Return the associated detached subvolumes.
ArraySpan< TrackingVolume const *const > confinedDenseVolumes() const
Return unordered subVolumes - not the ownership.
const TrackingVolume * lowestStaticTrackingVolume(const Amg::Vector3D &gp) const
return the lowest static tracking Volume
void synchronizeLayers(MsgStream &msgstream, double envelope=1.)
method to synchronize the layers with potentially updated volume bounds:
Out copy_if(In first, const In &last, Out res, const Pred &p)
void addToGarbage(std::vector< std::unique_ptr< Trk::DetachedTrackingVolume >> &&garbageVec)
const Trk::Layer * materialLayer() const
return the material Layer
void compactify(MsgStream &msgstream, TrackingVolume *vol=nullptr)
Geometry Builder busineess: set all contained surfaces TG owned - this should save memory and avoid s...
void indexStaticLayers(GeometrySignature geosit, int offset=0)
indexLayers : method to re-set the index of the layers, depending on geometrySignature
std::string head(std::string s, const std::string &pattern)
head of a string
const std::string & volumeName() const
Returns the VolumeName - for debug reason, might be depreciated later.
TrackingGeometry(TrackingVolume *highestVolume, NavigationLevel navlevel=globalSearch)
Constructor.
virtual BinnedArraySpan< T *const > arrayObjects()=0
Return all objects of the Array non-const we can still modify the T.
void printVolumeHierarchy(MsgStream &msgstream) const
Print the summary of volume Hierarchy of the TrackingGeometry.
Eigen::Matrix< double, 3, 1 > Vector3D
std::vector< const Trk::DetachedTrackingVolume * > lowestDetachedTrackingVolumes(const Amg::Vector3D &gp) const
return the vector of lowest detached tracking Volume(->overlaps)
const TrackingVolumeArray * confinedVolumes() const
Return the subLayer array.
void setMotherVolume(const TrackingVolume *mvol)
set the MotherVolume
void compactify(size_t &rSurfaces, size_t &tSurfaces)
compactify the memory usage in the event by setting ownership to TackingGeometry the referenced types...
TrackingVolume * checkoutHighestTrackingVolume()
private method to be called from GeometryBuilder: return the world with ownership
const TrackingVolume * lowestTrackingVolume(const Amg::Vector3D &gp) const
return the lowest tracking Volume
void printVolumeInformation(MsgStream &msgstream, const TrackingVolume &tvol, int lvl) const
print VolumeInformation with Level
std::span< T > BinnedArraySpan