Skip to content

Commit

Permalink
Hide AgML library codes from the macros which load the geometry. (#623)
Browse files Browse the repository at this point in the history
Possible fix for issue #620.
  • Loading branch information
klendathu2k authored Dec 1, 2023
1 parent 55b469b commit a351285
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
19 changes: 4 additions & 15 deletions StarDb/AgMLGeometry/CreateGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
Expand Down
17 changes: 15 additions & 2 deletions mgr/Dyson/Export/AgROOT.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 <string>
Expand Down Expand Up @@ -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' )




Expand Down

0 comments on commit a351285

Please sign in to comment.