-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathg4FromXML.cpp
51 lines (46 loc) · 1.49 KB
/
g4FromXML.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//==========================================================================
// AIDA Detector description implementation
//--------------------------------------------------------------------------
// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
// All rights reserved.
//
// For the licensing terms see $DD4hepINSTALL/LICENSE.
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
//
// Author : M.Frank
//
//==========================================================================
// Framework include files
#include "DDG4/Geant4Config.h"
// C/C++ include files
#include <stdexcept>
#include <iostream>
#include <cerrno>
using namespace dd4hep::sim::Setup;
int setupG4_XML() {
dd4hep::Detector& description = dd4hep::Detector::getInstance();
Kernel& kernel = Kernel::instance(description);
kernel.loadGeometry("file:../DD4hep.trunk/DDExamples/CLICSiD/compact/compact.xml");
kernel.loadXML("DDG4_field.xml");
kernel.loadXML("sequences.xml");
kernel.loadXML("physics.xml");
kernel.configure();
kernel.initialize();
kernel.run();
std::cout << "Successfully executed application .... " << std::endl;
kernel.terminate();
return 1;
}
/// Main entry point as a program
int main(int, char**) {
try {
return setupG4_XML();
}
catch(const std::exception& e) {
std::cout << "Got uncaught exception: " << e.what() << std::endl;
}
catch (...) {
std::cout << "Got UNKNOWN uncaught exception." << std::endl;
}
return EINVAL;
}