diff --git a/DDCore/src/XML/XMLTags.cpp b/DDCore/src/XML/XMLTags.cpp index 3a34fc60e25d0a2a7159d078c43cd17a9a5f2c9f..049dd6063d99072d759135c63ca3c00ec9898400 100644 --- a/DDCore/src/XML/XMLTags.cpp +++ b/DDCore/src/XML/XMLTags.cpp @@ -263,6 +263,8 @@ namespace DD4hep { namespace XML { ATTR(zhalf); // LCDD + TAG(lcdd); + TAG(lccdd); TAG(barrel); TAG(endcap); TAG(cartesian_grid_xy); @@ -274,11 +276,9 @@ namespace DD4hep { namespace XML { TAG(fields); TAG(gdml); TAG(grid_xyz); - TAG(header); TAG(iddict); TAG(idfield); TAG(idspec); - TAG(lcdd); TAG(limits); TAG(materials); TAG(gdmlFile); @@ -363,6 +363,13 @@ namespace DD4hep { namespace XML { TAG(generator); TAG(comment); TAG(author); + ATTR(status); + ATTR(author); + TAG(title); + ATTR(title); + TAG(name); + ATTR(url); + TAG(header); TAG(info); ATTR(file); ATTR(checksum); diff --git a/DDExamples/CLICSiDDisplay/main.cpp b/DDExamples/CLICSiDDisplay/main.cpp index a4c37d1c6a2b2c5cad8883d03baeb5b229edff6e..81e9c6a215286313bded449a0c2d64502ed0851f 100644 --- a/DDExamples/CLICSiDDisplay/main.cpp +++ b/DDExamples/CLICSiDDisplay/main.cpp @@ -2,58 +2,76 @@ //#include "TGDMLWrite.h" #include "TGeoManager.h" #include <iostream> +#include <cstdlib> #include <vector> #include <string> - +#include "TRint.h" using namespace std; using namespace DD4hep; -Geometry::LCDD& compact2geo(int argc, char **argv) { - string input; -#ifdef _WIN32 - input = "file:../cmt/compact.xml"; -#else - //input = "file:/afs/cern.ch/user/f/frankb/scratch0/ONLINE/ONLINE_HEAD/Online/GeoTest/cmt/compact.xml"; - - input = "compact.xml"; - //input = "file://../cmt/compact.xml"; - //input = "http://www.cern.ch/frankm/compact.xml"; - -#endif - if ( argc>1 ) { - input = argv[1]; - } - //Geometry::LCDDImp *lcdd = new Geometry::LCDDImp; - Geometry::LCDD& lcdd = Geometry::LCDD::getInstance(); - cout << argc << " Input file : " << input << endl; - lcdd.fromCompact(input); - return lcdd; +//______________________________________________________________________________ +void usage() { + cout << "<exe> -opt [-opt] \n" + " -compact <file> Compact geometry file \n" + " At least one compact geo file is required!\n" + " -gdml <file> GDML output file of the compact geometry \n" + " Flag switches display off. \n" + " -display Reenable display when writing GDML file. \n" + << endl; + exit(1); } -#include "TRint.h" //______________________________________________________________________________ int run_interpreter(int argc, char **argv) { - vector<char*> args; - - for(int i=0; i<argc;++i) args.push_back((char*)argv[i]); - - // Create an interactive ROOT application - int r_argc = 0; - char** r_argv = 0; - TRint *theApp = new TRint("Rint", &r_argc, r_argv); - - Geometry::LCDD& lcdd = compact2geo((int)args.size(),&args[0]); - for(size_t j=1; j<args.size()-1; ++j) - compact2geo((int)(args.size()-j),&args[j]); - - lcdd.dump(); - //TGDMLWrite wr; - //wr.WriteGDMLfile(gGeoManager,"ILCEx.gdml",""); + bool run_display = true; + bool run_gdml = false; + string gdml_file; + vector<char*> geo_files; + for(int i=1; i<argc;++i) { + if ( argv[i][0]=='-' ) { + if ( strncmp(argv[i],"-compact",5)==0 ) { + geo_files.push_back((char*)argv[++i]); + } + else if ( strncmp(argv[i],"-gdml",5)==0 ) { + gdml_file = argv[++i]; + run_display = false; + run_gdml = true; + } + else if ( strncmp(argv[i],"-display",5)==0 ) { + run_display = true; + } + } + else { // This is the default + geo_files.push_back((char*)argv[i]); + } + } + if ( !geo_files.size() > 0 ) { + usage(); + } - // and enter the event loop... - theApp->Run(); - delete theApp; + Geometry::LCDD& lcdd = Geometry::LCDD::getInstance(); + for(size_t j=0; j<geo_files.size(); ++j) { + string input = geo_files[j]; + cout << "Input file : " << input << endl; + lcdd.fromCompact(input); + } + if ( run_gdml ) { + char* args[] = {(char*)gdml_file.c_str(),0}; + lcdd.apply("gdml_converter",1,args); + } + if ( run_display ) { + // Create an interactive ROOT application + int r_argc = 0; + char** r_argv = 0; + TRint *theApp = new TRint("Rint", &r_argc, r_argv); + lcdd.dump(); + //TGDMLWrite wr; + //wr.WriteGDMLfile(gGeoManager,"ILCEx.gdml",""); + // and enter the event loop... + theApp->Run(); + delete theApp; + } return 0; }