DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DetectorTools.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation for LCD
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 
14 #ifndef DD4HEP_GEOMETRY_DETECTORTOOLS_H
15 #define DD4HEP_GEOMETRY_DETECTORTOOLS_H
16 
17 // Framework include files
18 #include "DD4hep/Detector.h"
19 
20 // Forward declarations
21 class TGeoHMatrix;
22 
24 namespace DD4hep {
25 
27  namespace Geometry {
28 
29  // Forward declarations
30  class LCDD;
31 
33 
39  namespace DetectorTools {
40  typedef std::vector<DetElement> ElementPath;
41  typedef std::vector<PlacedVolume> PlacementPath;
42 
45 
47  std::string elementPath(DetElement element);
49  std::string elementPath(const ElementPath& nodes, bool reverse=true);
50 
52  void elementPath(DetElement elt, ElementPath& detectors);
54  DetElement findElement(LCDD& lcdd, const std::string& path);
56  DetElement findDaughterElement(DetElement parent, const std::string& subpath);
58  bool isParentElement(DetElement parent, DetElement child);
59 
61  std::string placementPath(DetElement element);
63  std::string placementPath(const PlacementPath& nodes, bool reverse=true);
65  std::string placementPath(const std::vector<const TGeoNode*>& nodes, bool reverse=true);
66 
68  void placementPath(DetElement elt, PlacementPath& nodes);
70  void placementPath(DetElement parent, DetElement child, PlacementPath& nodes);
71 
73  PlacedVolume findNode(PlacedVolume top_place, const std::string& place);
75  void placementTrafo(const PlacementPath& nodes, bool inverse, TGeoHMatrix*& mat);
77  void placementTrafo(const PlacementPath& nodes, bool inverse, TGeoHMatrix& mat);
78 
79 
81  std::string toString(const PlacedVolume::VolIDs& ids);
83  std::string toString(const IDDescriptor& dsc, const PlacedVolume::VolIDs& ids, VolumeID code);
84 
85  }
86 
87  } /* End namespace Geometry */
88 } /* End namespace DD4hep */
89 #endif /* DD4HEP_GEOMETRY_DETECTORTOOLS_H */
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:135
void placementTrafo(const PlacementPath &nodes, bool inverse, TGeoHMatrix *&mat)
Update cached matrix to transform to positions to an upper level Placement.
std::vector< DetElement > ElementPath
Definition: DetectorTools.h:40
bool isParentElement(DetElement parent, DetElement child)
Find path between the child element and the parent element.
std::vector< PlacedVolume > PlacementPath
Definition: DetectorTools.h:41
std::string placementPath(DetElement element)
Assemble the placement path from a given detector element to the world volume.
DetElement findDaughterElement(DetElement parent, const std::string &subpath)
Find DetElement as child of a parent by it's relative or absolute path.
DetElement findElement(LCDD &lcdd, const std::string &path)
Find DetElement as child of the top level volume by it's absolute path.
PlacedVolume findNode(PlacedVolume top_place, const std::string &place)
Find a given node in the hierarchy starting from the top node (absolute placement!) ...
Handle class describing a detector element.
Definition: Detector.h:172
std::string elementPath(const PlacementPath &nodes, bool reverse)
Assemble the path of the PlacedVolume selection.
long long int VolumeID
Definition: Primitives.h:35
The main interface to the DD4hep detector description package.
Definition: LCDD.h:82
DetElement topElement(DetElement child)
Determine top level element (=world) for any element walking up the detector element tree...
Class implementing the ID encoding of detector response.
Definition: IDDescriptor.h:40
std::string toString(const PlacedVolume::VolIDs &ids)
Convert VolumeID to string.