LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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>

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.

References getMaterialTable(), getParticleTable(), and DetectorConstruction::SetMaterial().

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
boost::python::list getMaterialTable()
Definition: pytestem0.cc:67
TConfigurablePhysicsList< ModularPhysicsList > PhysicsList
Definition: PhysicsList.h:86
boost::python::list getMaterialTable ( )

Definition at line 67 of file pytestem0.cc.

Referenced by BOOST_PYTHON_MODULE().

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
73  G4MaterialTable materialList = *G4Material::GetMaterialTable();
74 
76  for(itVectorData = materialList.begin(); itVectorData != materialList.end(); itVectorData++) {
77  materialTableList->append ( (std::string)(*(itVectorData))->GetName()) ;
78 
79  }
80  return *materialTableList;
81 }
intermediate_table::iterator iterator
boost::python::list getParticleTable ( )

Definition at line 51 of file pytestem0.cc.

Referenced by BOOST_PYTHON_MODULE().

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
57  G4ParticleTable *g4ParticleList = G4ParticleTable::GetParticleTable();
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 }