Skip to content
Snippets Groups Projects
Commit 2a4fdd53 authored by Andre Sailer's avatar Andre Sailer Committed by MarkusFrankATcernch
Browse files

SurfaceHelper/IDDecoder: avoid multiple instantiations of the VolumeManager

pick the VolumeManager from lcdd, and create it if necessary instead of creating a static one in SurfaceHelper
This is necessary in case someone needs a volumemanger before surfaceHelper is called.
parent 4c76b0e5
No related branches found
No related tags found
No related merge requests found
......@@ -461,6 +461,7 @@ DECLARE_APPLY(DD4hepXMLProcessor,process_xml_doc)
* \date 01/04/2014
*/
static long load_volmgr(LCDD& lcdd, int, char**) {
printout(INFO,"DD4hepVolumeManager","**** running plugin DD4hepVolumeManager ! " );
try {
LCDDImp* imp = dynamic_cast<LCDDImp*>(&lcdd);
if ( imp ) {
......
......@@ -34,7 +34,8 @@ IDDecoder::IDDecoder() {
LCDD& lcdd = LCDD::getInstance();
_volumeManager = lcdd.volumeManager();
if (not _volumeManager.isValid()) {
_volumeManager = VolumeManager(lcdd, "volman", lcdd.world(), Readout(), VolumeManager::TREE);
lcdd.apply("DD4hepVolumeManager",0,0);
_volumeManager = lcdd.volumeManager();
}
_tgeoMgr = lcdd.world().volume()->GetGeoManager();
}
......
......@@ -27,7 +27,13 @@ namespace DD4hep {
// have to populate the volume manager once in order to have
// the volumeIDs attached to the DetElements
LCDD& lcdd = LCDD::getInstance();
static VolumeManager volMgr( lcdd , "volMan" , lcdd.world() ) ;
VolumeManager volMgr = lcdd.volumeManager();
if(not volMgr.isValid()) {
// VolumeManager initialised by DD4hepVolumeManager plugin
lcdd.apply("DD4hepVolumeManager",0,0);
volMgr = lcdd.volumeManager();
}
//------------------ breadth first tree traversal ---------
......
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