From d0af0a7eccfdbc510c6b1461518d56245c0c0f7f Mon Sep 17 00:00:00 2001 From: klendathu2k Date: Thu, 2 Nov 2023 14:12:33 -0400 Subject: [PATCH] Hide AgML library codes from the macros which load the geometry. Possible fix for issue #620. --- StarDb/AgMLGeometry/CreateGeometry.h | 19 ++++--------------- mgr/Dyson/Export/AgROOT.py | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/StarDb/AgMLGeometry/CreateGeometry.h b/StarDb/AgMLGeometry/CreateGeometry.h index 7deee16ed76..66da8858fa8 100644 --- a/StarDb/AgMLGeometry/CreateGeometry.h +++ b/StarDb/AgMLGeometry/CreateGeometry.h @@ -2,8 +2,6 @@ #if !defined(__CINT__) || defined(__CLING__) #include "StBFChain/StBFChain.h" -#include "StarVMC/StarAgmlLib/AgModule.h" -#include "StarVMC/StarAgmlLib/StarTGeoStacker.h" #include "StarVMC/StarGeometry/StarGeo.h" #endif @@ -33,27 +31,18 @@ TDataSet *CreateGeometry(const Char_t *name="y2011") { // Append geom.root to the extentionless filename filename+=".geom.root"; - // Detect second call to the system - if ( AgModule::Find("HALL") ) { - if ( chain->GetOption("Sti") || - chain->GetOption("StiCA") || - chain->GetOption("StiVMC") ){ - cout << "AgML geometry: HALL exists. Restore from cache file " - << filename.Data() << endl; + if ( gGeoManager ) { + if ( chain->GetOption("Sti") || chain->GetOption("StiCA") ) { gGeoManager = 0; - assert(0); + assert(0); // this assert should be called in our Sti reconstruction chains... why not? TGeoManager::Import( filename ); - assert(gGeoManager); } - return geom; } - cout << "AgML: Building geometry " << name << " " << endl; - // Create the geometry using TGeo - AgBlock::SetStacker( new StarTGeoStacker() ); Geometry *build = new Geometry(); + build->InitAgML( "StarTGeoStacker" ); // Suppress copious ROOT warnings Long_t save = gErrorIgnoreLevel; gErrorIgnoreLevel = 9999; diff --git a/mgr/Dyson/Export/AgROOT.py b/mgr/Dyson/Export/AgROOT.py index 50402b2f338..314ecc42791 100644 --- a/mgr/Dyson/Export/AgROOT.py +++ b/mgr/Dyson/Export/AgROOT.py @@ -688,6 +688,7 @@ class StarGeometry { static TDataSet* Construct( const char* name = "%s"); static bool List ( const char* name = "%s"); static void Whitelist( const char* name, int value=1 ){ whitelist[name]=value; } + static void InitAgML ( const char* stacker="StarTGeoStacker"); StarGeometry(){ /* nada */ }; virtual ~StarGeometry(){ /* nada */ } private: @@ -709,7 +710,7 @@ class Geometry : public StarGeometry { document.head(header) implement1 = """ -#include "StarVMC/StarGeometry/StarGeo.h" +#include "StarVMC/StarGeometry/StarGeo.h" #include "TObjectSet.h" #include "TGeoManager.h" #include @@ -744,7 +745,19 @@ class Geometry : public StarGeometry { output = ' if (all||tag=="%s") { %s::list(); found = true; }' %(name,name) document.impl( output, unit='global' ) document.impl( 'if ( 0==found ) LOG_INFO << tag << " not defined" << endm;', unit='global' ) - document.impl( 'return true;};', unit='global' ) + document.impl( 'return true;};', unit='global' ) + + implement1 = """ +#include "StarVMC/StarAgmlLib/StarNoStacker.h" +#include "StarVMC/StarAgmlLib/StarTGeoStacker.h" + void StarGeometry::InitAgML( const char* s ) { + std::string sname = s; + if ( sname=="StarNoStacker" ) AgBlock::SetStacker( new StarNoStacker ); + else AgBlock::SetStacker( new StarTGeoStacker ); + }; + """ + document.impl( implement1, unit='global' ) +