Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pytestem0.cc File Reference
#include "DetectorConstruction.hh"
#include "RunAction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4ParticleTable.hh"
#include <boost/python.hpp>
#include <boost/python/list.hpp>
#include <vector>
#include <string>
Include dependency graph for pytestem0.cc:

Go to the source code of this file.

Functions

boost::python::list getParticleTable ()
 
boost::python::list getMaterialTable ()
 
 BOOST_PYTHON_MODULE (testem0)
 

Function Documentation

BOOST_PYTHON_MODULE ( testem0  )

Definition at line 88 of file pytestem0.cc.

88  {
89 
90  def ("getMaterialTable", getMaterialTable);
91 
92  def ("getParticleTable", getParticleTable);
93 
94  class_<DetectorConstruction, DetectorConstruction*,
95  bases<G4VUserDetectorConstruction> >
96  ("DetectorConstruction", "testEm0 detector")
97  .def("SetMaterial",&DetectorConstruction::SetMaterial)
98  ;
99 
100  class_<PrimaryGeneratorAction, PrimaryGeneratorAction*,
101  bases<G4VUserPrimaryGeneratorAction> >
102  ("PrimaryGeneratorAction", init<DetectorConstruction*>())
103  ;
104 
105  class_<RunAction, RunAction*,
106  bases<G4UserRunAction> >
107  ("RunAction", init<DetectorConstruction*, PrimaryGeneratorAction*>())
108  ;
109 
110  class_<PhysicsList, PhysicsList*,
111  bases<G4VUserPhysicsList> >
112  ("PhysicsList", "testEm0 physics list")
113  ;
114 }
boost::python::list getParticleTable()
Definition: pytestem0.cc:51
The primary generator action class with particle gun.
boost::python::list getMaterialTable()
Definition: pytestem0.cc:67
Detector construction class to define materials and geometry.
Run action class.
Definition: RunAction.hh:45
Physics list class.
Definition: PhysicsList.hh:47

Here is the call graph for this function:

boost::python::list getMaterialTable ( )

Definition at line 67 of file pytestem0.cc.

68  {
69  // Create a list on heap which will be return to python
70  boost::python::list *materialTableList = new boost::python::list();
71 
72  // Get material list fron G4Material
74 
75  std::vector<G4Material*>::iterator itVectorData;
76  for(itVectorData = materialList.begin(); itVectorData != materialList.end(); itVectorData++) {
77  materialTableList->append ( (std::string)(*(itVectorData))->GetName()) ;
78 
79  }
80  return *materialTableList;
81 }
tuple materialList
Definition: demo.py:39
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:587
std::vector< G4Material * > G4MaterialTable

Here is the call graph for this function:

Here is the caller graph for this function:

boost::python::list getParticleTable ( )

Definition at line 51 of file pytestem0.cc.

52 {
53  // Create a list on heap which will be return to python
54  boost::python::list *particleList = new boost::python::list();
55 
56  // Get particle list fron G4ParticleTable
58 
59  // Fill python list from g4ParticleList
60  for ( int index = 0 ; index <= g4ParticleList->size() ; index++ ) {
61  particleList->append ( (std::string) g4ParticleList->GetParticleName(index) );
62  }
63 
64  return *particleList;
65 }
const G4String & GetParticleName(G4int index) const
static MCGIDI_particle * particleList
static G4ParticleTable * GetParticleTable()
G4int size() const

Here is the call graph for this function:

Here is the caller graph for this function: