File indexing completed on 2025-01-30 09:17:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 #include <DDG4/Geant4Config.h>
0029 #include <iostream>
0030 #include <ctime>
0031
0032 using namespace std;
0033 using namespace dd4hep::sim::Setup;
0034
0035 int setupG4_XML(bool interactive) {
0036 string install_dir = getenv("DD4hepExamplesINSTALL");
0037 string det_dir = getenv("DD4hepINSTALL");
0038 string prefix = "file:"+install_dir+"/examples/";
0039 Kernel& kernel = Kernel::instance(dd4hep::Detector::getInstance());
0040 kernel.loadGeometry((det_dir+"/DDDetectors/compact/SiD.xml").c_str());
0041 kernel.loadXML((prefix+"CLICSiD/sim/field.xml").c_str());
0042 kernel.loadXML((prefix+"CLICSiD/sim/sequences.xml").c_str());
0043 kernel.loadXML((prefix+"CLICSiD/sim/physics.xml").c_str());
0044 if ( interactive ) {
0045 kernel.property("UI") = "UI";
0046 }
0047 else {
0048 kernel.property("NumEvents") = 4;
0049 }
0050 Action rndm(kernel, "Geant4Random/Random");
0051 rndm["Seed"] = ::time(0);
0052 kernel.registerGlobalAction(rndm);
0053
0054 EventAction out(kernel,"Geant4Output2ROOT/RootOutput");
0055 out["Output"] = is_aclick() ? "CLICSiD.xml_aclick.root" : "CLICSiD.xml_exe.root";
0056 kernel.eventAction().adopt(out);
0057
0058 kernel.configure();
0059 kernel.initialize();
0060 kernel.run();
0061 cout << "Successfully executed application .... " << endl;
0062 kernel.terminate();
0063 cout << "TEST_PASSED" << endl;
0064 return 0;
0065 }
0066
0067 int CLICSiDXML() {
0068 return setupG4_XML(false);
0069 }
0070
0071 #if not(defined(G__DICTIONARY) || defined(__CLING__) || defined(__CINT__) || defined(__MAKECINT__))
0072 int main(int, char**)
0073 {
0074 std::cout << "Running CLICSiDXML as standalone executable...." << std::endl;
0075 return CLICSiDXML();
0076 }
0077 #endif
0078
0079