16 #include <TGeoManager.h>
18 #include <uuid/uuid.h>
35 PHGeomTGeo *dst_geom = GetGeomTGeoNode(topNode,
true);
38 cout << __PRETTY_FUNCTION__
39 <<
" - Error - Can NOT construct geometry node." << endl;
47 dst_geom = LoadFromIONode(topNode);
50 UpdateIONode(topNode);
56 const std::string &geometry_file)
58 TGeoManager *tgeo = GetTGeoManager(topNode);
62 tgeo->Export(geometry_file.c_str());
66 const std::string &geometry_file)
68 PHGeomTGeo *dst_geom = GetGeomTGeoNode(topNode);
73 TGeoManager::SetVerboseLevel(GetVerbosity());
74 dst_geom->
SetGeometry(TGeoManager::Import(geometry_file.c_str()));
78 cout << __PRETTY_FUNCTION__ <<
"failed to import " << geometry_file
83 UpdateIONode(topNode);
90 PHGeomTGeo *dst_geom = GetGeomTGeoNode(topNode);
96 assert(not dst_geom->
isValid());
98 TGeoManager::SetVerboseLevel(GetVerbosity());
111 "PHCompositeNode",
"PAR"));
115 serr << __PRETTY_FUNCTION__ <<
": PAR Node missing, request aborting.";
116 cout << serr.str() << endl;
118 throw runtime_error(serr.str());
123 PHGeomTGeo *dst_geom = findNode::getClass<PHGeomTGeo>(parNode,
125 if (!dst_geom and build_new)
129 GetDSTNodeName(),
"PHObject");
130 parNode->addNode(GeomNode);
144 "PHCompositeNode",
"RUN"));
148 serr << __PRETTY_FUNCTION__ <<
": RUN Node missing, request aborting.";
149 cout << serr.str() << endl;
151 throw runtime_error(serr.str());
156 PHGeomIOTGeo *dst_geom = findNode::getClass<PHGeomIOTGeo>(runNode,
158 if (!dst_geom and build_new)
162 GetDSTIONodeName(),
"PHObject");
163 runNode->addNode(GeomNode);
177 uuid_unparse(uu, uuid);
179 file << mg_GenerateGeometryFileNameBase <<
"/"
180 <<
"PHGeomUtility_geom_file_" << uuid <<
"."
181 << filename_extension;
196 if (
remove(file_name.c_str()) != 0)
198 cout << __PRETTY_FUNCTION__ <<
" - Error - can not remove file "
199 << file_name << endl;
214 PHGeomTGeo *dst_geom = GetGeomTGeoNode(topNode,
false);
218 cout << __PRETTY_FUNCTION__
219 <<
" - ERROR - failed to update PHGeomIOTGeo node RUN/GEOMETRY_IO due to missing PHGeomTGeo node at RUN/GEOMETRY"
223 if (not dst_geom->isValid())
225 cout << __PRETTY_FUNCTION__
226 <<
" - ERROR - failed to update PHGeomIOTGeo node RUN/GEOMETRY_IO due to invalid PHGeomTGeo node at RUN/GEOMETRY"
231 PHGeomIOTGeo *dst_geom_io = GetGeomIOTGeoNode(topNode,
true);
234 dst_geom_io->
SetGeometry(dst_geom->GetGeometry()->GetTopVolume());
244 PHGeomIOTGeo *dst_geom_io = GetGeomIOTGeoNode(topNode,
false);
248 cout << __PRETTY_FUNCTION__
249 <<
" - ERROR - failed to update PHGeomTGeo node RUN/GEOMETRY due to missing PHGeomIOTGeo node at RUN/GEOMETRY_IO"
253 if (not dst_geom_io->isValid())
255 cout << __PRETTY_FUNCTION__
256 <<
" - ERROR - failed to update PHGeomTGeo node RUN/GEOMETRY due to invalid PHGeomIOTGeo node at RUN/GEOMETRY_IO"
262 TGeoManager::SetVerboseLevel(GetVerbosity());
263 TGeoManager *tgeo = dst_geom_io->ConstructTGeoManager();
264 tgeo->CloseGeometry();
266 PHGeomTGeo *dst_geom = GetGeomTGeoNode(topNode,
true);
284 if (rc->
FlagExist(
"PHGEOMETRY_VERBOSITY"))