diff --git a/DDCore/include/DD4hep/GeoHandler.h b/DDCore/include/DD4hep/GeoHandler.h index 61d9c04c15f1f852e5bd513cc0f7138c0c1e4f20..976ecbd9690a77873267ff9a899849b73d3636a4 100644 --- a/DDCore/include/DD4hep/GeoHandler.h +++ b/DDCore/include/DD4hep/GeoHandler.h @@ -48,6 +48,17 @@ namespace dd4hep { */ class GeoHandlerTypes { public: +#if 0 + typedef std::set<const TGeoVolume*> ConstVolumeSet; + typedef std::map<SensitiveDetector, ConstVolumeSet> SensitiveVolumes; + typedef std::map<Region, ConstVolumeSet> RegionVolumes; + typedef std::map<LimitSet, ConstVolumeSet> LimitVolumes; + typedef std::map<int, std::set<const TGeoNode*> > Data; + typedef std::set<SensitiveDetector> SensitiveDetectorSet; + typedef std::set<Region> RegionSet; + typedef std::set<LimitSet> LimitSetSet; + typedef std::set<TNamed*> ObjectSet; +#endif /// Data container to store information obtained during the geometry scan /** * \author M.Frank @@ -90,8 +101,6 @@ namespace dd4hep { GeoHandler& i_collect(const TGeoNode* parent, const TGeoNode* node, int level, Region rg, LimitSet ls); - /// Assemble summary of the current node - void i_collect_node(const TGeoNode* node, GeometryInfo& info); private: /// Never call Copy constructor diff --git a/DDCore/src/GeoHandler.cpp b/DDCore/src/GeoHandler.cpp index 3133eadbe53e338396558dcc34be41878e63de88..61a7b746afae180bef1d2d84ca5f32079ec84703 100644 --- a/DDCore/src/GeoHandler.cpp +++ b/DDCore/src/GeoHandler.cpp @@ -87,48 +87,39 @@ GeoHandler& GeoHandler::collect(DetElement element) { return i_collect(par_node, element.placement().ptr(), 0, Region(), LimitSet()); } -/// Assemble summary of the current node -void GeoHandler::i_collect_node(const TGeoNode* n, GeometryInfo& info) { - TGeoVolume* v = n->GetVolume(); - if (v) { - Material mat(v->GetMedium()); - Volume vol(v); - // Note : assemblies and the world do not have a real volume nor a material - if (info.volumeSet.find(vol) == info.volumeSet.end()) { - info.volumeSet.emplace(vol); - info.volumes.emplace_back(vol); - } - if ( mat.isValid() ) - info.materials.emplace(mat); - if (dynamic_cast<Volume::Object*>(v)) { - VisAttr vis = vol.visAttributes(); - //Region reg = vol.region(); - //LimitSet lim = vol.limitSet(); - //SensitiveDetector det = vol.sensitiveDetector(); - - if (vis.isValid()) - info.vis.emplace(vis); - //if ( lim.isValid() ) info.limits[lim.ptr()].emplace(v); - //if ( reg.isValid() ) info.regions[reg.ptr()].emplace(v); - //if ( det.isValid() ) info.sensitives[det.ptr()].emplace(v); - } - collectSolid(info, v->GetName(), n->GetName(), v->GetShape(), n->GetMatrix()); - } -} - GeoHandler& GeoHandler::collect(DetElement element, GeometryInfo& info) { - - DetElement par = element.parent(); - TGeoNode* place = element.placement().ptr(); + DetElement par = element.parent(); TGeoNode* par_node = par.isValid() ? par.placement().ptr() : nullptr; - m_data->clear(); - i_collect_node(place, info); - i_collect(par_node, place, 0, Region(), LimitSet()); + i_collect(par_node, element.placement().ptr(), 0, Region(), LimitSet()); for (auto i = m_data->rbegin(); i != m_data->rend(); ++i) { const auto& mapped = (*i).second; for (const TGeoNode* n : mapped ) { - i_collect_node(n, info); + TGeoVolume* v = n->GetVolume(); + if (v) { + Material mat(v->GetMedium()); + Volume vol(v); + // Note : assemblies and the world do not have a real volume nor a material + if (info.volumeSet.find(vol) == info.volumeSet.end()) { + info.volumeSet.emplace(vol); + info.volumes.emplace_back(vol); + } + if ( mat.isValid() ) + info.materials.emplace(mat); + if (dynamic_cast<Volume::Object*>(v)) { + VisAttr vis = vol.visAttributes(); + //Region reg = vol.region(); + //LimitSet lim = vol.limitSet(); + //SensitiveDetector det = vol.sensitiveDetector(); + + if (vis.isValid()) + info.vis.emplace(vis); + //if ( lim.isValid() ) info.limits[lim.ptr()].emplace(v); + //if ( reg.isValid() ) info.regions[reg.ptr()].emplace(v); + //if ( det.isValid() ) info.sensitives[det.ptr()].emplace(v); + } + collectSolid(info, v->GetName(), n->GetName(), v->GetShape(), n->GetMatrix()); + } } } return *this;