DD4hep  1.30.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::run(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 
38  return run(k);
39 }
40 
41 int PyDDG4::process(const char* fname) {
42  return dd4hep::DDPython::instance().runFile(fname);
43 }
44 
45 int PyDDG4::run(const char* fname) {
46  int ret = dd4hep::DDPython::instance().runFile(fname);
47  if ( 1 != ret ) return ret;
48  return execute();
49 }
dd4hep::sim::Geant4Kernel::configure
virtual int configure()
Run the simulation: Configure Geant4.
Definition: Geant4Kernel.cpp:385
Detector.h
dd4hep::sim::Geant4Kernel
Class, which allows all Geant4Action derivatives to access the DDG4 kernel structures.
Definition: Geant4Kernel.h:64
PyDDG4::run
static int run(Kernel &kernel)
Definition: PyDDG4.cpp:21
dd4hep::Detector::getInstance
static Detector & getInstance(const std::string &name="default")
—Factory method----—
Definition: DetectorImp.cpp:150
PyDDG4.h
DDPython.h
dd4hep::sim::Geant4Kernel::initialize
virtual int initialize()
Run the simulation: Initialize Geant4.
Definition: Geant4Kernel.cpp:396
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:407
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::execute
static int execute()
Definition: PyDDG4.cpp:36
PyDDG4::process
static int process(const char *fname)
Definition: PyDDG4.cpp:41
dd4hep::DDPython::AllowThreads
Definition: DDPython.h:51
dd4hep::sim::Geant4Kernel::terminate
virtual int terminate() override
Run the simulation: Terminate Geant4.
Definition: Geant4Kernel.cpp:428