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
GeoHandler.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 #ifndef DD4HEP_GEOHANDLER_H
14 #define DD4HEP_GEOHANDLER_H
15 
16 #include "DD4hep/LCDD.h"
17 #include <set>
18 #include <map>
19 #include <vector>
20 
21 // Forward declarations
22 class TGeoMatrix;
23 class TGeoVolume;
24 class TGeoMedium;
25 class TGeoShape;
26 class TGeoNode;
27 
29 namespace DD4hep {
30 
31  // Forward declarations
32  class NamedObject;
33 
35  namespace Geometry {
36 
37  class LCDD;
38  class Volume;
39  class PlacedVolume;
40  class DetElement;
41  class SensitiveDetector;
42  class VisAttrObject;
43 
45 
51  public:
52  typedef std::set<Volume> VolumeSet;
53  typedef std::vector<Volume> VolumeVector;
54  typedef std::set<const TGeoVolume*> ConstVolumeSet;
55  typedef std::vector<std::pair<std::string, TGeoMatrix*> > TransformSet;
56  typedef std::set<TGeoShape*> SolidSet;
57  typedef std::set<Material> MaterialSet;
58  typedef std::map<SensitiveDetector, ConstVolumeSet> SensitiveVolumes;
59  typedef std::map<Region, ConstVolumeSet> RegionVolumes;
60  typedef std::map<LimitSet, ConstVolumeSet> LimitVolumes;
61  typedef std::map<int, std::set<const TGeoNode*> > Data;
62  typedef std::set<VisAttr> VisRefs;
63  typedef std::set<SensitiveDetector> SensitiveDetectorSet;
64  typedef std::set<Region> RegionSet;
65  typedef std::set<LimitSet> LimitSetSet;
66  typedef std::set<Ref_t> Fields;
67  typedef std::set<TNamed*> ObjectSet;
69 
71 
76  class GeometryInfo {
77  public:
85  std::set<TGeoMedium*> media;
86  std::set<TGeoElement*> elements;
87  };
88  };
89 
91 
102  class GeoHandler: public GeoHandlerTypes {
103 
104  protected:
107 
109  GeoHandler& i_collect(const TGeoNode* node, int level, Region rg, LimitSet ls);
110 
111  private:
114  }
117  return *this;
118  }
119 
120  public:
122  GeoHandler();
124  GeoHandler(Data* ptr);
126  virtual ~GeoHandler();
128  bool setPropagateRegions(bool value);
132  GeoHandler& collect(DetElement top, GeometryInfo& info);
134  Data* release();
135  };
136 
138 
143  class GeoScan {
144  protected:
147  public:
151  GeoScan(DetElement e, bool propagateRegions);
153  virtual ~GeoScan();
155  virtual GeoScan& operator()();
156  };
157  } // End namespace Geometry
158 } // End namespace DD4hep
159 
160 #endif // DD4HEP_GEOHANDLER_H
std::set< LimitSet > LimitSetSet
Definition: GeoHandler.h:65
bool setPropagateRegions(bool value)
Propagate regions. Returns the previous value.
Definition: GeoHandler.cpp:74
std::set< Volume > VolumeSet
Definition: GeoHandler.h:52
std::set< SensitiveDetector > SensitiveDetectorSet
Definition: GeoHandler.h:63
GeoScan(DetElement e)
Initializing constructor.
Definition: GeoHandler.cpp:152
Defintion of the object types used by generic geometry handlers.
Definition: GeoHandler.h:50
GeoHandler()
Default constructor.
Definition: GeoHandler.cpp:51
GeoHandler & i_collect(const TGeoNode *node, int level, Region rg, LimitSet ls)
Internal helper to collect geometry information from traversal.
Definition: GeoHandler.cpp:122
std::set< TGeoShape * > SolidSet
Definition: GeoHandler.h:56
std::set< Material > MaterialSet
Definition: GeoHandler.h:57
return e
Definition: Volumes.cpp:297
GeoHandler(const GeoHandler &)
Never call Copy constructor.
Definition: GeoHandler.h:113
std::map< Region, ConstVolumeSet > RegionVolumes
Definition: GeoHandler.h:59
std::set< VisAttr > VisRefs
Definition: GeoHandler.h:62
DD4hep::Geometry::DetElement DetElement
std::vector< std::pair< std::string, TGeoMatrix * > > TransformSet
Definition: GeoHandler.h:55
GeoHandler & collect(DetElement top)
Collect geometry information from traversal.
Definition: GeoHandler.cpp:80
virtual ~GeoScan()
Default destructor.
Definition: GeoHandler.cpp:164
The base class for all DD4hep geometry crawlers.
Definition: GeoHandler.h:102
std::map< SensitiveDetector, ConstVolumeSet > SensitiveVolumes
Definition: GeoHandler.h:58
virtual ~GeoHandler()
Default destructor.
Definition: GeoHandler.cpp:61
Data * release()
Access to collected node list.
Definition: GeoHandler.cpp:67
virtual GeoScan & operator()()
Work callback.
Definition: GeoHandler.cpp:171
GeoHandler::Data * m_data
Data holder.
Definition: GeoHandler.h:146
std::vector< Volume > VolumeVector
Definition: GeoHandler.h:53
std::set< const TGeoVolume * > ConstVolumeSet
Definition: GeoHandler.h:54
std::map< LimitSet, ConstVolumeSet > LimitVolumes
Definition: GeoHandler.h:60
DD4hep::Geometry::SensitiveDetector SensitiveDetector
std::set< Region > RegionSet
Definition: GeoHandler.h:64
Geometry scanner (handle object)
Definition: GeoHandler.h:143
GeoHandler & operator=(const GeoHandler &)
Never call assignment operator.
Definition: GeoHandler.h:116
std::map< int, std::set< const TGeoNode * > > Data
Definition: GeoHandler.h:61
std::set< TNamed * > ObjectSet
Definition: GeoHandler.h:67
Handle class describing a detector element.
Definition: Detector.h:172
Handle class describing a set of limits as they are used for simulation.
Definition: Objects.h:475
Handle class describing a region as used in simulation.
Definition: Objects.h:516
std::map< std::string, NamedHandle > HandleMap
Definition: LCDD.h:87