DD4hep  1.37.0
Detector Description Toolkit for High Energy Physics
PyDDG4.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // \author Markus Frank
11 // \date 2015-11-03
12 //
13 //==========================================================================
14 
15 // Framework include files
16 #include <DD4hep/Detector.h>
17 #include <DDG4/Python/PyDDG4.h>
18 #include <DDG4/Python/DDPython.h>
19 #include <DDG4/Geant4Kernel.h>
20 
21 int PyDDG4::runAll(Kernel& kernel) {
22  int ret;
24  if ( 1 != (ret=kernel.configure()) )
25  return ret;
26  else if ( 1 != (ret=kernel.initialize()) )
27  return ret;
28  else if ( 1 != (ret=kernel.run()) )
29  return ret;
30  else if ( 1 != (ret=kernel.terminate()) )
31  return ret;
32  //dd4hep::DDPython::shutdown();
33  return ret;
34 }
35 
36 int PyDDG4::configure(Kernel& kernel) {
37  int ret;
39  if ( 1 != (ret=kernel.configure()) )
40  return ret;
41  return ret;
42 }
43 
44 int PyDDG4::initialize(Kernel& kernel) {
45  int ret;
47  if ( 1 != (ret=kernel.initialize()) )
48  return ret;
49  return ret;
50 }
51 
52 int PyDDG4::run(Kernel& kernel) {
53  int ret;
55  if ( 1 != (ret=kernel.run()) )
56  return ret;
57  return ret;
58 }
59 
60 int PyDDG4::terminate(Kernel& kernel) {
61  int ret;
63  if ( 1 != (ret=kernel.terminate()) )
64  return ret;
65  return ret;
66 }
67 
70  return run(k);
71 }
72 
73 int PyDDG4::process(const char* fname) {
74  return dd4hep::DDPython::instance().runFile(fname);
75 }
76 
77 int PyDDG4::run(const char* fname) {
78  int ret = dd4hep::DDPython::instance().runFile(fname);
79  if ( 1 != ret ) return ret;
80  return execute();
81 }
dd4hep::sim::Geant4Kernel::configure
virtual int configure()
Run the simulation: Configure Geant4.
Definition: Geant4Kernel.cpp:395
Detector.h
dd4hep::sim::Geant4Kernel
Class, which allows all Geant4Action derivatives to access the DDG4 kernel structures.
Definition: Geant4Kernel.h:64
PyDDG4::terminate
static int terminate(Kernel &kernel)
Definition: PyDDG4.cpp:60
PyDDG4::configure
static int configure(Kernel &kernel)
Definition: PyDDG4.cpp:36
PyDDG4::run
static int run(Kernel &kernel)
Definition: PyDDG4.cpp:52
dd4hep::Detector::getInstance
static Detector & getInstance(const std::string &name="default")
—Factory method----—
Definition: DetectorImp.cpp:132
PyDDG4.h
DDPython.h
dd4hep::sim::Geant4Kernel::initialize
virtual int initialize()
Run the simulation: Initialize Geant4.
Definition: Geant4Kernel.cpp:406
dd4hep::sim::Geant4Kernel::instance
static Geant4Kernel & instance(Detector &description)
Instance accessor.
Definition: Geant4Kernel.cpp:163
dd4hep::sim::Geant4Kernel::run
virtual int run()
Run the simulation: Simulate the number of events given by the property "NumEvents".
Definition: Geant4Kernel.cpp:417
dd4hep::DDPython::instance
static DDPython instance()
Object instantiator.
Definition: DDPython.cpp:190
dd4hep::DDPython::runFile
int runFile(const std::string &fname) const
Definition: DDPython.cpp:248
Geant4Kernel.h
PyDDG4::initialize
static int initialize(Kernel &kernel)
Definition: PyDDG4.cpp:44
PyDDG4::execute
static int execute()
Definition: PyDDG4.cpp:68
PyDDG4::process
static int process(const char *fname)
Definition: PyDDG4.cpp:73
PyDDG4::runAll
static int runAll(Kernel &kernel)
Definition: PyDDG4.cpp:21
dd4hep::DDPython::AllowThreads
Definition: DDPython.h:51
dd4hep::sim::Geant4Kernel::terminate
virtual int terminate() override
Run the simulation: Terminate Geant4.
Definition: Geant4Kernel.cpp:438