LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
pyG4VisManager.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // ====================================================================
27 // pyG4VisManager.cc
28 //
29 // 2005 Q
30 // ====================================================================
31 #include <boost/python.hpp>
32 #include "G4VisManager.hh"
33 #include "G4TrajectoryModelFactories.hh"
34 
35 using namespace boost::python;
36 
37 // ====================================================================
38 // wrappers
39 // ====================================================================
40 class PyG4VisManager : public G4VisManager {
41 public:
42  PyG4VisManager() { SetVerboseLevel(quiet); }
44 
46  return dynamic_cast<PyG4VisManager*>(fpConcreteInstance);
47  }
48 
49  virtual void RegisterGraphicsSystems() { }
50 
51  virtual void RegisterModelFactories() {
52  RegisterModelFactory(new G4TrajectoryDrawByChargeFactory());
53  RegisterModelFactory(new G4TrajectoryDrawByParticleIDFactory());
54  }
55 };
56 
57 // ====================================================================
58 // thin wrappers
59 // ====================================================================
60 namespace pyG4VisManager {
61 
63  = &PyG4VisManager::SetVerboseLevel;
65  = &PyG4VisManager::SetVerboseLevel;
67  = &PyG4VisManager::SetVerboseLevel;
68 
69 }
70 
71 using namespace pyG4VisManager;
72 
73 // ====================================================================
74 // module definition
75 // ====================================================================
77 {
78  scope in_PyG4VisManager =
79  class_<PyG4VisManager, boost::noncopyable>
80  ("G4VisManager", "visualization manager")
81  // ---
82  .def("GetConcreteInstance", &PyG4VisManager::_get_concrete_instance,
83  "Get an instance of G4VisManager",
84  return_value_policy<reference_existing_object>())
85  .staticmethod("GetConcreteInstance")
86  // ---
87  .def("SetVerboseLevel", f1_SetVerboseLevel)
88  .def("SetVerboseLevel", f2_SetVerboseLevel)
89  .def("SetVerboseLevel", f3_SetVerboseLevel)
90  .def("GetVerbosity", &PyG4VisManager::GetVerbosity)
91  .staticmethod("GetVerbosity")
92  .def("Initialize", &PyG4VisManager::Initialize)
93  .def("RegisterGraphicsSystem", &PyG4VisManager::RegisterGraphicsSystem)
94  ;
95 
96  // enum LineStyle
97  enum_<G4VisManager::Verbosity>("Verbosity")
98  .value("quiet", G4VisManager::quiet)
99  .value("startup", G4VisManager::startup)
100  .value("errors", G4VisManager::errors)
101  .value("warnings", G4VisManager::warnings)
102  .value("confirmations", G4VisManager::confirmations)
103  .value("parameters", G4VisManager::parameters)
104  .value("all", G4VisManager::all)
105  ;
106 }
107 
virtual void RegisterModelFactories()
void(PyG4VisManager::* f2_SetVerboseLevel)(const G4String &)
Verbosity
Definition: Verbosity.h:5
void Initialize()
Definition: errprop.cc:100
void(PyG4VisManager::* f3_SetVerboseLevel)(G4VisManager::Verbosity)
virtual void RegisterGraphicsSystems()
static PyG4VisManager * _get_concrete_instance()
double value
Definition: spectrum.C:18
void(PyG4VisManager::* f1_SetVerboseLevel)(G4int)
void export_G4VisManager()