DD4hep  1.28.0
Detector Description Toolkit for High Energy Physics
DetectorTools.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DD4HEP_DETECTORTOOLS_H
14 #define DD4HEP_DETECTORTOOLS_H
15 
16 // Framework include files
17 #include "DD4hep/DetElement.h"
18 
19 // Forward declarations
20 class TGeoHMatrix;
21 
23 namespace dd4hep {
24 
25  // Forward declarations
26  class Detector;
27 
28  namespace detail {
29 
31 
37  namespace tools {
38  typedef std::vector<DetElement> ElementPath;
39  typedef std::vector<PlacedVolume> PlacementPath;
40 
43 
45  std::string elementPath(DetElement element);
47  std::string elementPath(const ElementPath& nodes, bool reverse=true);
48 
52  DetElement findElement(const Detector& description, const std::string& path);
54  DetElement findDaughterElement(DetElement parent, const std::string& subpath);
56  bool isParentElement(DetElement parent, DetElement child);
57 
59  std::string placementPath(DetElement element);
61  std::string placementPath(const PlacementPath& nodes, bool reverse=true);
63  std::string placementPath(const std::vector<const TGeoNode*>& nodes, bool reverse=true);
64 
66  void placementPath(DetElement elt, PlacementPath& nodes);
68  void placementPath(DetElement parent, DetElement child, PlacementPath& nodes);
69 
71  PlacedVolume findNode(PlacedVolume top_place, const std::string& place);
73  void placementTrafo(const PlacementPath& nodes, bool inverse, TGeoHMatrix*& mat);
75  void placementTrafo(const PlacementPath& nodes, bool inverse, TGeoHMatrix& mat);
76 
77 
79  std::string toString(const PlacedVolume::VolIDs& ids);
81  std::string toString(const IDDescriptor& dsc, const PlacedVolume::VolIDs& ids, VolumeID code);
83  std::vector<std::string> pathElements(const std::string& path);
84  }
85  }
86 } /* End namespace dd4hep */
87 #endif // DD4HEP_DETECTORTOOLS_H
dd4hep::detail::tools::ElementPath
std::vector< DetElement > ElementPath
Definition: DetectorTools.h:38
dd4hep::PlacedVolume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:173
dd4hep::detail::tools::placementPath
std::string placementPath(DetElement element)
Assemble the placement path from a given detector element to the world volume.
Definition: DetectorTools.cpp:276
dd4hep::IDDescriptor
Class implementing the ID encoding of the detector response.
Definition: IDDescriptor.h:37
dd4hep::detail::tools::findDaughterElement
DetElement findDaughterElement(DetElement parent, const std::string &subpath)
Find DetElement as child of a parent by its relative or absolute path.
Definition: DetectorTools.cpp:219
dd4hep::detail::tools::findElement
DetElement findElement(const Detector &description, const std::string &path)
Find DetElement as child of the top level volume by its absolute path.
Definition: DetectorTools.cpp:214
dd4hep::detail::tools::placementTrafo
void placementTrafo(const PlacementPath &nodes, bool inverse, TGeoHMatrix *&mat)
Update cached matrix to transform to positions to an upper level Placement.
Definition: DetectorTools.cpp:310
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::PlacedVolumeExtension::VolIDs
Volume ID container.
Definition: Volumes.h:88
dd4hep::detail::tools::isParentElement
bool isParentElement(DetElement parent, DetElement child)
Find path between the child element and the parent element.
Definition: DetectorTools.cpp:57
detectors
DetectorMap detectors
Definition: AlignmentsCalculator.cpp:79
dd4hep::detail::tools::findNode
PlacedVolume findNode(PlacedVolume top_place, const std::string &place)
Find a given node in the hierarchy starting from the top node (absolute placement!...
Definition: DetectorTools.cpp:328
dd4hep::detail::tools::pathElements
std::vector< std::string > pathElements(const std::string &path)
Extract all the path elements from a path.
Definition: DetectorTools.cpp:397
VolumeID
dd4hep::DDSegmentation::VolumeID VolumeID
Definition: SegmentationDictionary.h:48
dd4hep::detail::tools::elementPath
std::string elementPath(DetElement element)
Assemble the path of a particular detector element.
Definition: DetectorTools.cpp:207
DetElement.h
dd4hep::detail::tools::topElement
DetElement topElement(DetElement child)
Determine top level element (=world) for any element walking up the detector element tree.
Definition: DetectorTools.cpp:240
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::detail::tools::toString
std::string toString(const PlacedVolume::VolIDs &ids)
Convert VolumeID to string.
Definition: DetectorTools.cpp:378
dd4hep::detail::tools::PlacementPath
std::vector< PlacedVolume > PlacementPath
Definition: DetectorTools.h:39
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90