diff --git a/DDExamples/CLICSiDDisplay/CMakeLists.txt b/DDExamples/CLICSiDDisplay/CMakeLists.txt deleted file mode 100644 index 0d69c9c854bbeeebf85abd6d38323e70aa1af5f5..0000000000000000000000000000000000000000 --- a/DDExamples/CLICSiDDisplay/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR) - -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/DDCore/include - ${ROOT_INCLUDE_DIR} - ${XERCESC_INCLUDE_DIR}) - -add_executable(CLICSiDtest main.cpp) -target_link_libraries(CLICSiDtest CLICSiD ILDEx DD4hepCore ${ROOT_LIBRARIES} Rint Reflex) diff --git a/DDExamples/CLICSiDDisplay/main.cpp b/DDExamples/CLICSiDDisplay/main.cpp deleted file mode 100644 index 4fcc807977a8fb5a075cffdd6cc9b8cedda4bc22..0000000000000000000000000000000000000000 --- a/DDExamples/CLICSiDDisplay/main.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "DD4hep/LCDD.h" -//#include "TGDMLWrite.h" -#include "TGeoManager.h" -#include <iostream> -#include <cstdlib> -#include <vector> -#include <string> -#include "TRint.h" - -using namespace std; -using namespace DD4hep; - -//______________________________________________________________________________ -void usage() { - cout << "<exe> -opt [-opt] \n" - " -compact <file> Compact geometry file \n" - " At least one compact geo file is required!\n" - " -lcdd <file> LCDD output file of the compact geometry \n" - " Flag switches display off. \n" - " -display Reenable display when writing GDML file. \n" - << endl; - exit(1); -} - -//______________________________________________________________________________ -int run_interpreter(int argc, char **argv) { - bool run_display = true; - bool run_lcdd = false; - string lcdd_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],"-lcdd",5)==0 ) { - lcdd_file = argv[++i]; - run_display = false; - run_lcdd = true; - } - else if ( strncmp(argv[i],"-display",5)==0 ) { - run_display = true; - } - else { - usage(); - } - } - else { // This is the default - geo_files.push_back((char*)argv[i]); - } - } - if ( !geo_files.size() > 0 ) { - usage(); - } - - 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_lcdd ) { - char* args[] = {(char*)lcdd_file.c_str(),0}; - lcdd.apply("lcdd_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; -} - -int main(int argc,char** argv) { - return run_interpreter(argc,argv); -} diff --git a/DDExamples/ILDExDisplay/CMakeLists.txt b/DDExamples/ILDExDisplay/CMakeLists.txt deleted file mode 100644 index e8c9bbd1e1bcc28774bf5914a8fa4787e0f5488d..0000000000000000000000000000000000000000 --- a/DDExamples/ILDExDisplay/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR) - - -include_directories( ${CMAKE_SOURCE_DIR}/DDCore/include - ${ROOT_INCLUDE_DIR}) - -add_executable(ILDExDisplay src/display.cpp) -target_link_libraries(ILDExDisplay DD4hepCore ILDEx ${ROOT_LIBRARIES} Rint) - diff --git a/DDExamples/ILDExDisplay/src/display.cpp b/DDExamples/ILDExDisplay/src/display.cpp deleted file mode 100644 index e2f8e6c682c7f24c8c46295aba1f0e76fcc7c34f..0000000000000000000000000000000000000000 --- a/DDExamples/ILDExDisplay/src/display.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// -// pymain.cpp -// -// -// Created by Pere Mato on 20/1/12. -// Copyright 2012 __MyCompanyName__. All rights reserved. -// - -#include "DD4hep/LCDD.h" -#include <iostream> -#include <vector> -#include <string> -#include "TRint.h" - -using namespace std; -using namespace DD4hep; -using namespace Geometry; - -//______________________________________________________________________________ -int run_interpreter(int argc, char **argv) { - vector<char*> args; - - for(int i=0; i<argc;++i) args.push_back((char*)argv[i]); - argc = 0; - - // Create an interactive ROOT application - TRint *theApp = new TRint("Rint", &argc, argv, 0, 0, kTRUE); - - LCDD& lcdd = LCDD::getInstance(); - lcdd.fromCompact(args[1]); - lcdd.dump(); - - // and enter the event loop... - theApp->Run(); - delete theApp; - return 0; -} - -int main(int argc,char** argv) { - return run_interpreter(argc,argv); -} diff --git a/DDExamples/UtilityApps/CMakeLists.txt b/DDExamples/UtilityApps/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..24291b8395d93aeec407dad9baa3c2471495c8c1 --- /dev/null +++ b/DDExamples/UtilityApps/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR) + +include_directories( ${CMAKE_SOURCE_DIR}/DDCore/include + ${ROOT_INCLUDE_DIR}) + +add_executable(displayGeo src/display.cpp) +target_link_libraries(displayGeo DD4hepCore) + +add_executable(geoConverter src/converter.cpp) +target_link_libraries(geoConverter DD4hepCore) diff --git a/DDExamples/UtilityApps/src/converter.cpp b/DDExamples/UtilityApps/src/converter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..52e43aef9721c630699ca7440032626a07578a2c --- /dev/null +++ b/DDExamples/UtilityApps/src/converter.cpp @@ -0,0 +1,74 @@ +// $Id:$ +//==================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------- +// +// Generic ROOT based geometry display program +// +// Author : M.Frank +// +//==================================================================== + +// Framework include files +#include "DD4hep/LCDD.h" + +// C/C++ include files +#include <iostream> +#include <cstdlib> +#include <vector> +#include <cerrno> +#include <string> + +using namespace std; +using namespace DD4hep::Geometry; + +//______________________________________________________________________________ +namespace { + void usage() { + cout << "<exe> -opt [-opt] \n" + " -compact <file> Specify the compact geometry file \n" + " At least one compact geo file is required!\n" + " -load_only Dry-run to only load geometry without \n" + " starting the dispay. \n" + << endl; + exit(EINVAL); + } +} + +//______________________________________________________________________________ +int main(int argc,char** argv) { + bool dry_run = false; + vector<char*> geo_files; + for(int i=1; i<argc;++i) { + if ( argv[i][0]=='-' ) { + if ( strncmp(argv[i],"-compact",2)==0 ) + geo_files.push_back(argv[++i]); + else if ( strncmp(argv[i],"-load_only",2)==0 ) + dry_run = true; + else + usage(); + } + else { // This is the default + geo_files.push_back(argv[i]); + } + } + if ( geo_files.empty() ) + usage(); + + try { + pair<int, char**> args(0,0); + LCDD& lcdd = LCDD::getInstance(); + // Load all compact files + lcdd.apply("DD4hepCompactLoader",int(geo_files.size()),&geo_files[0]); + // Create an interactive ROOT application + lcdd.apply("DD4hepGeometryConverter",args.first,args.second); + return 0; + } + catch(const exception& e) { + cout << "Exception:" << e.what() << endl; + } + catch(...) { + cout << "UNKNOWN Exception" << endl; + } + return EINVAL; +} diff --git a/DDExamples/UtilityApps/src/display.cpp b/DDExamples/UtilityApps/src/display.cpp new file mode 100644 index 0000000000000000000000000000000000000000..333cdcb389f3dfffd89810547c263659db553742 --- /dev/null +++ b/DDExamples/UtilityApps/src/display.cpp @@ -0,0 +1,82 @@ +// $Id:$ +//==================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------- +// +// Generic ROOT based geometry display program +// +// Author : M.Frank +// +//==================================================================== + +// Framework include files +#include "DD4hep/LCDD.h" +#include "TRint.h" + +// C/C++ include files +#include <iostream> +#include <cstdlib> +#include <vector> +#include <cerrno> +#include <string> + +using namespace std; +using namespace DD4hep::Geometry; + +//______________________________________________________________________________ +namespace { + void usage() { + cout << "<exe> -opt [-opt] \n" + " -compact <file> Specify the compact geometry file \n" + " At least one compact geo file is required!\n" + " -load_only Dry-run to only load geometry without \n" + " starting the dispay. \n" + << endl; + exit(EINVAL); + } +} + +//______________________________________________________________________________ +int main(int argc,char** argv) { + bool dry_run = false; + vector<char*> geo_files; + for(int i=1; i<argc;++i) { + if ( argv[i][0]=='-' ) { + if ( strncmp(argv[i],"-compact",2)==0 ) + geo_files.push_back(argv[++i]); + else if ( strncmp(argv[i],"-load_only",2)==0 ) + dry_run = true; + else + usage(); + } + else { // This is the default + geo_files.push_back(argv[i]); + } + } + if ( geo_files.empty() ) + usage(); + + try { + pair<int, char**> args(0,0); + LCDD& lcdd = LCDD::getInstance(); + // Load all compact files + lcdd.apply("DD4hepCompactLoader",int(geo_files.size()),&geo_files[0]); + // Create an interactive ROOT application + if ( !dry_run ) { + TRint app("DD4hepGeometryDisplay", &args.first, args.second); + lcdd.apply("DD4hepGeometryDisplay",args.first,args.second); + app.Run(); + } + else { + cout << "The geometry was loaded. Application now exiting." << endl; + } + return 0; + } + catch(const exception& e) { + cout << "Exception:" << e.what() << endl; + } + catch(...) { + cout << "UNKNOWN Exception" << endl; + } + return EINVAL; +}