20 #include <TGeoManager.h>
21 #include <TGeoCompositeShape.h>
22 #include <TGeoBoolNode.h>
33 void collectSolid(detail::GeoHandler::GeometryInfo& geo,
34 const std::string& name,
35 const std::string& node,
39 if ( 0 == ::strncmp(shape->GetName(),
"TGeo", 4) ) {
40 shape->SetName(name.c_str());
42 if ( shape->IsA() == TGeoCompositeShape::Class() ) {
43 const TGeoCompositeShape* s = (
const TGeoCompositeShape*) shape;
44 const TGeoBoolNode*
boolean = s->GetBoolNode();
45 collectSolid(geo, name +
"_left", name +
"_left", boolean->GetLeftShape(), boolean->GetLeftMatrix());
46 collectSolid(geo, name +
"_right", name +
"_right", boolean->GetRightShape(), boolean->GetRightMatrix());
48 if(geo.solid_set.emplace(shape).second) {
49 geo.solids.push_back(shape);
51 geo.trafos.emplace_back(node, matrix);
57 m_data =
new std::map<int, std::vector<const TGeoNode*> >();
58 m_set_data =
new std::map<int, std::set<const TGeoNode*> >();
63 std::map<
int, std::set<const TGeoNode*> >* ptr_set,
64 std::map<
const TGeoNode*, std::vector<TGeoNode*> >* daus)
65 : m_data(ptr), m_set_data(ptr_set), m_daughters(daus)
82 std::map<int, std::vector<const TGeoNode*> >* d = m_data;
96 bool old = m_propagateRegions;
97 m_propagateRegions = value;
115 for (
auto i = m_data->rbegin(); i != m_data->rend(); ++i ) {
116 const auto& mapped = (*i).second;
117 for (
const TGeoNode* n : mapped ) {
118 TGeoVolume*
v = n->GetVolume();
123 if (
info.volumeSet.find(vol) ==
info.volumeSet.end() ) {
124 info.volumeSet.emplace(vol);
125 info.volumes.emplace_back(vol);
128 info.materials.emplace(mat);
136 info.vis.emplace(vis);
141 collectSolid(
info,
v->GetName(), n->GetName(),
v->GetShape(), n->GetMatrix());
149 const TGeoNode* current,
152 TGeoVolume* vol = current->GetVolume();
153 TObjArray* nodes = vol->GetNodes();
158 if ( m_propagateRegions ) {
170 if ( (*m_set_data)[level].emplace(current).second ) {
171 (*m_data)[level].push_back(current);
173 int num = nodes ? nodes->GetEntriesFast() : 0;
174 for (
int i = 0; i < num; ++i)
175 i_collect(current, (TGeoNode*)nodes->At(i), level + 1, region, limits);
177 if ( m_daughters && m_daughters->find(current) == m_daughters->end() ) {
178 auto [idau,success] = m_daughters->emplace(current, std::vector<TGeoNode*>());
179 for (
int i = 0; i < num; ++i)
180 idau->second.push_back((TGeoNode*)nodes->At(i));