GeoModel - GeoModelCore
GeoTraversalState.h
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef GEOMODELKERNEL_GEOTRAVERSALSTATE_H
6 #define GEOMODELKERNEL_GEOTRAVERSALSTATE_H
7 
18 #include "GeoModelKernel/GeoNodePath.h"
19 #include "GeoModelKernel/GeoDefinitions.h"
20 #include <stack>
21 #include <string>
22 
24 {
25  public:
27  virtual ~GeoTraversalState();
28 
29  // Gets the transformation of the current node with respect
30  // to its parent.
31  const GeoTrf::Transform3D & getTransform () const;
32 
33  // Gets the name of the current node.
34  const std::string & getName () const;
35 
36  // Gets the default transformation of the current node with
37  // respect to its parent.
38  const GeoTrf::Transform3D & getDefTransform () const;
39 
40  // Gets the absolute name of the current node.
41  const std::string & getAbsoluteName () const;
42 
43  // Gets the default absolute transformation to the current
44  // node.
45  const GeoTrf::Transform3D & getDefAbsoluteTransform () const;
46 
47  // Gets the absolute transformation to the current node.
48  const GeoTrf::Transform3D & getAbsoluteTransform () const;
49 
50  // Sets the transform for the current node.
51  void setTransform (const GeoTrf::Transform3D &transform);
52 
53  // Sets the name for the current node.
54  void setName (const std::string &name);
55 
56  // Sets the default absolute transform for the current node.
57  void setDefTransform (const GeoTrf::Transform3D &transform);
58 
59  // Goes to the next level. Pushes the last absolute
60  // transform onto the stack so that it can be retreived
61  // when going back to the previous level.
62  void nextLevel (const GeoVPhysVol* pv);
63 
64  // Goes to the previous level. Pops the last absolute
65  // transform onto the stack, restoring the absolute
66  // transform to that of the previous level.
67  void previousLevel ();
68 
69  // Returns the path.
70  const GeoNodePath * getPath () const;
71 
72  // Sets the identifier for the current node.
73  void setId (const Query<int> &id);
74 
75  // Gets the id of the current node.
76  const Query<int> getId () const;
77 
78  private:
80  GeoTraversalState & operator=(const GeoTraversalState &right);
81 
82  // A list of tranformations for all nodes visited at all
83  // previous levels of traversal.
84  std::stack<GeoTrf::Transform3D> m_absTransformList;
85 
86  // A list of default tranformations for all nodes visited
87  // at all previous levels of traversal.
88  std::stack<GeoTrf::Transform3D> m_defAbsTransformList;
89 
90  // List of volume names.
91  std::stack<std::string> m_absNameList;
92 
93  // The absolute transform for the present volume.
94  GeoTrf::Transform3D m_absTransform;
95 
96  // The default absolute transform.
97  GeoTrf::Transform3D m_defAbsTransform;
98 
99  // The absolute name.
100  std::string m_absName;
101 
102  // The transform from parent to current.
103  GeoTrf::Transform3D m_transform;
104 
105  // The default transform from parent to current.
106  GeoTrf::Transform3D m_defTransform;
107 
108  // The relative name.
109  std::string m_name;
110 
111  // And identifier for this volume.
112  Query<int> m_id;
113 
114  // The path from the point at which the action started, to
115  // the current node.
116  GeoNodePath m_path;
117 
118 };
119 
120 #endif
This incorporates a traversal state, including the following information: