Skip to content
Snippets Groups Projects
Commit eb14a567 authored by Markus Frank's avatar Markus Frank Committed by MarkusFrankATcernch
Browse files

Roll-back GeoHandler

parent b5ff351c
No related branches found
No related tags found
No related merge requests found
...@@ -48,6 +48,17 @@ namespace dd4hep { ...@@ -48,6 +48,17 @@ namespace dd4hep {
*/ */
class GeoHandlerTypes { class GeoHandlerTypes {
public: 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 /// Data container to store information obtained during the geometry scan
/** /**
* \author M.Frank * \author M.Frank
...@@ -90,8 +101,6 @@ namespace dd4hep { ...@@ -90,8 +101,6 @@ namespace dd4hep {
GeoHandler& i_collect(const TGeoNode* parent, GeoHandler& i_collect(const TGeoNode* parent,
const TGeoNode* node, const TGeoNode* node,
int level, Region rg, LimitSet ls); int level, Region rg, LimitSet ls);
/// Assemble summary of the current node
void i_collect_node(const TGeoNode* node, GeometryInfo& info);
private: private:
/// Never call Copy constructor /// Never call Copy constructor
......
...@@ -87,48 +87,39 @@ GeoHandler& GeoHandler::collect(DetElement element) { ...@@ -87,48 +87,39 @@ GeoHandler& GeoHandler::collect(DetElement element) {
return i_collect(par_node, element.placement().ptr(), 0, Region(), LimitSet()); 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) { GeoHandler& GeoHandler::collect(DetElement element, GeometryInfo& info) {
DetElement par = element.parent();
DetElement par = element.parent();
TGeoNode* place = element.placement().ptr();
TGeoNode* par_node = par.isValid() ? par.placement().ptr() : nullptr; TGeoNode* par_node = par.isValid() ? par.placement().ptr() : nullptr;
m_data->clear(); m_data->clear();
i_collect_node(place, info); i_collect(par_node, element.placement().ptr(), 0, Region(), LimitSet());
i_collect(par_node, place, 0, Region(), LimitSet());
for (auto i = m_data->rbegin(); i != m_data->rend(); ++i) { for (auto i = m_data->rbegin(); i != m_data->rend(); ++i) {
const auto& mapped = (*i).second; const auto& mapped = (*i).second;
for (const TGeoNode* n : mapped ) { 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; return *this;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment