File indexing completed on 2025-01-30 09:16:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef DD4HEP_GEOHANDLER_H
0014 #define DD4HEP_GEOHANDLER_H
0015
0016
0017 #include <DD4hep/Detector.h>
0018
0019
0020 #include <set>
0021 #include <map>
0022 #include <vector>
0023
0024
0025 class TGeoMatrix;
0026 class TGeoVolume;
0027 class TGeoMedium;
0028 class TGeoShape;
0029 class TGeoNode;
0030
0031
0032 namespace dd4hep {
0033
0034
0035 class Detector;
0036 class NamedObject;
0037 class DetElement;
0038 class SensitiveDetector;
0039 class VisAttrObject;
0040 class Volume;
0041 class PlacedVolume;
0042
0043
0044 namespace detail {
0045
0046
0047
0048
0049
0050
0051
0052 class GeoHandlerTypes {
0053 public:
0054
0055
0056
0057
0058
0059
0060 class GeometryInfo {
0061 public:
0062 std::vector<TGeoShape*> solids;
0063 std::set<TGeoShape*> solid_set;
0064 std::set<Volume> volumeSet;
0065 std::vector<Volume> volumes;
0066 std::set<VisAttr> vis;
0067 std::set<Ref_t> fields;
0068 std::set<Material> materials;
0069 std::set<TGeoMedium*> media;
0070 std::set<TGeoElement*> elements;
0071 std::vector<std::pair<std::string, TGeoMatrix*> > trafos;
0072 };
0073 };
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087 class GeoHandler: public GeoHandlerTypes {
0088
0089 protected:
0090 bool m_propagateRegions { false };
0091
0092
0093 std::map<int, std::vector<const TGeoNode*> >* m_data { nullptr };
0094
0095 std::map<int, std::set<const TGeoNode*> >* m_set_data { nullptr };
0096
0097 std::map<const TGeoNode*, std::vector<TGeoNode*> >* m_daughters { nullptr };
0098
0099 GeoHandler& i_collect(const TGeoNode* parent,
0100 const TGeoNode* node,
0101 int level, Region rg, LimitSet ls);
0102
0103 private:
0104
0105 GeoHandler(const GeoHandler&) {
0106 }
0107
0108 GeoHandler& operator=(const GeoHandler&) {
0109 return *this;
0110 }
0111
0112 public:
0113
0114 GeoHandler();
0115
0116 GeoHandler(std::map<int, std::vector<const TGeoNode*> >* ptr,
0117 std::map<int, std::set<const TGeoNode*> >* ptr_set,
0118 std::map<const TGeoNode*, std::vector<TGeoNode*> >* daus = nullptr);
0119
0120 virtual ~GeoHandler();
0121
0122 bool setPropagateRegions(bool value);
0123
0124 GeoHandler& collect(DetElement top);
0125
0126 GeoHandler& collect(DetElement top, GeometryInfo& info);
0127
0128 std::map<int, std::vector<const TGeoNode*> >* release();
0129 };
0130
0131
0132
0133
0134
0135
0136
0137 class GeoScan {
0138 protected:
0139
0140 std::map<int, std::vector<const TGeoNode*> >* m_data;
0141 public:
0142
0143 GeoScan(DetElement e);
0144
0145 GeoScan(DetElement e, bool propagateRegions);
0146
0147 virtual ~GeoScan();
0148
0149 virtual GeoScan& operator()();
0150 };
0151 }
0152 }
0153
0154 #endif