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 if (TGeoManager::GetDefaultUnits() != TGeoManager::kRootUnits )
52 cout << __PRETTY_FUNCTION__ <<
" TGeoManager was not constructed with RootUnits, which potentially leads to unit mismatch with Fun4All. This is considered a fatal error."
59 UpdateIONode(topNode);
67 TGeoManager *tgeo = GetTGeoManager(topNode);
71 tgeo->Export(geometry_file.c_str());
77 PHGeomTGeo *dst_geom = GetGeomTGeoNode(topNode);
82 TGeoManager::SetVerboseLevel(GetVerbosity());
85 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,23,2)
86 TGeoManager::LockDefaultUnits(kFALSE);
87 TGeoManager::SetDefaultUnits( TGeoManager::kRootUnits );
88 TGeoManager::LockDefaultUnits(kTRUE);
90 TGeoManager::SetDefaultRootUnits();
93 dst_geom->
SetGeometry(TGeoManager::Import(geometry_file.c_str()));
97 cout << __PRETTY_FUNCTION__ <<
"failed to import " << geometry_file
102 UpdateIONode(topNode);
109 PHGeomTGeo *dst_geom = GetGeomTGeoNode(topNode);
117 TGeoManager::SetVerboseLevel(GetVerbosity());
130 "PHCompositeNode",
"PAR"));
134 serr << __PRETTY_FUNCTION__ <<
": PAR Node missing, request aborting.";
135 cout << serr.str() << endl;
137 throw runtime_error(serr.str());
142 PHGeomTGeo *dst_geom = findNode::getClass<PHGeomTGeo>(parNode,
144 if (!dst_geom and build_new)
148 GetDSTNodeName(),
"PHObject");
149 parNode->addNode(GeomNode);
163 "PHCompositeNode",
"RUN"));
167 serr << __PRETTY_FUNCTION__ <<
": RUN Node missing, request aborting.";
168 cout << serr.str() << endl;
170 throw runtime_error(serr.str());
175 PHGeomIOTGeo *dst_geom = findNode::getClass<PHGeomIOTGeo>(runNode,
177 if (!dst_geom and build_new)
181 GetDSTIONodeName(),
"PHObject");
182 runNode->addNode(GeomNode);
196 uuid_unparse(uu, uuid);
198 file << mg_GenerateGeometryFileNameBase <<
"/"
199 <<
"PHGeomUtility_geom_file_" << uuid <<
"."
200 << filename_extension;
215 if (
remove(file_name.c_str()) != 0)
217 cout << __PRETTY_FUNCTION__ <<
" - Error - can not remove file "
218 << file_name << endl;
233 PHGeomTGeo *dst_geom = GetGeomTGeoNode(topNode,
false);
237 cout << __PRETTY_FUNCTION__
238 <<
" - ERROR - failed to update PHGeomIOTGeo node RUN/GEOMETRY_IO due to missing PHGeomTGeo node at RUN/GEOMETRY"
242 if (not dst_geom->isValid())
244 cout << __PRETTY_FUNCTION__
245 <<
" - ERROR - failed to update PHGeomIOTGeo node RUN/GEOMETRY_IO due to invalid PHGeomTGeo node at RUN/GEOMETRY"
250 PHGeomIOTGeo *dst_geom_io = GetGeomIOTGeoNode(topNode,
true);
253 dst_geom_io->
SetGeometry(dst_geom->GetGeometry()->GetTopVolume());
263 PHGeomIOTGeo *dst_geom_io = GetGeomIOTGeoNode(topNode,
false);
267 cout << __PRETTY_FUNCTION__
268 <<
" - ERROR - failed to update PHGeomTGeo node RUN/GEOMETRY due to missing PHGeomIOTGeo node at RUN/GEOMETRY_IO"
272 if (not dst_geom_io->isValid())
274 cout << __PRETTY_FUNCTION__
275 <<
" - ERROR - failed to update PHGeomTGeo node RUN/GEOMETRY due to invalid PHGeomIOTGeo node at RUN/GEOMETRY_IO"
281 TGeoManager::SetVerboseLevel(GetVerbosity());
282 TGeoManager *tgeo = dst_geom_io->ConstructTGeoManager();
283 tgeo->CloseGeometry();
285 PHGeomTGeo *dst_geom = GetGeomTGeoNode(topNode,
true);
303 if (rc->
FlagExist(
"PHGEOMETRY_VERBOSITY"))