Newer
Older
Markus Frank
committed
//==========================================================================
// AIDA Detector description implementation for LCD
Markus Frank
committed
//--------------------------------------------------------------------------
// Copyright (C) Organisation européenne pour la Recherche nucléaire (CERN)
// All rights reserved.
Markus Frank
committed
// For the licensing terms see $DD4hepINSTALL/LICENSE.
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
Markus Frank
committed
// Author : M.Frank
//
//==========================================================================
// Framework include files
Markus Frank
committed
#include "run_plugin.h"
//______________________________________________________________________________
namespace {
void usage() {
Markus Frank
committed
cout << "geoPluginRun -opt [-opt] \n"
" -plugin <name> [REQUIRED] Plugin to be executed and applied. \n"
Markus Frank
committed
" -input <file> [OPTIONAL] Specify geometry input file. \n";
print_default_args() << endl;
exit(EINVAL);
}
}
//______________________________________________________________________________
int main(int argc,char** argv) {
string plugin;
Args arguments;
vector<const char*> options;
options.push_back(plugin_runner);
for(int i=1; i<argc;++i) {
if ( argv[i][0]=='-' ) {
if ( arguments.handle(i,argc,argv) )
Markus Frank
committed
continue;
else if ( strncmp(argv[i],"-plugin",2)==0 )
plugin = argv[++i];
else
Markus Frank
committed
options.push_back(argv[i]);
Markus Frank
committed
if ( plugin.empty() )
Markus Frank
committed
options.push_back(0);
LCDD& lcdd = dd4hep_instance();
Markus Frank
committed
// Load compact files if required by plugin
if ( !arguments.geo_files.empty() ) {
load_compact(lcdd, arguments);
}
else {
cout << "geoPluginRun: No geometry input supplied. No geometry will be loaded." << endl;
}
Markus Frank
committed
// Create volume manager and populate it required
if ( arguments.volmgr ) run_plugin(lcdd,"DD4hepVolumeManager",0,0);
Markus Frank
committed
// Execute plugin
run_plugin(lcdd,plugin.c_str(),(int)(options.size()-1),(char**)&options[0]);
if ( arguments.destroy ) delete &lcdd;
Markus Frank
committed
return 0;