LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
pyParticleGun.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
// pyParticleGun.cc
28
//
29
// [ParticleGun]
30
// a site-module of Geant4Py
31
//
32
// primary generator action with particle gun
33
//
34
// 2005 Q
35
// ====================================================================
36
#include <boost/python.hpp>
37
#include "
ParticleGunAction.hh
"
38
#include "G4ParticleGun.hh"
39
#include "G4RunManager.hh"
40
41
using namespace
boost::python
;
42
43
// ====================================================================
44
// thin wrappers
45
// ====================================================================
46
namespace
pyParticleGun
{
47
48
G4ParticleGun*
Construct
()
49
{
50
G4RunManager* runMgr= G4RunManager::GetRunManager();
51
52
ParticleGunAction
* pga=
new
ParticleGunAction
;
53
runMgr-> SetUserAction(pga);
54
55
return
pga-> GetParticleGun();
56
}
57
58
}
59
60
using namespace
pyParticleGun
;
61
62
// ====================================================================
63
// Expose to Python
64
// ====================================================================
65
66
BOOST_PYTHON_MODULE
(ParticleGun) {
67
class_<
ParticleGunAction
, ParticleGunAction*,
68
bases<G4VUserPrimaryGeneratorAction> >
69
(
"ParticleGunAction"
,
"primary generator action with particle gun"
)
70
.def(
"GetParticleGun"
, &
ParticleGunAction::GetParticleGun
,
71
return_internal_reference<>())
72
;
73
74
// ---
75
def(
"Construct"
,
Construct
,
76
return_value_policy<reference_existing_object>());
77
78
}
79
ParticleGunAction
Definition:
ParticleGunAction.hh:43
ParticleGunAction::GetParticleGun
G4ParticleGun * GetParticleGun() const
Definition:
ParticleGunAction.hh:60
pyParticleGun::Construct
G4ParticleGun * Construct()
Definition:
pyParticleGun.cc:48
boost::python
Definition:
container_utils.hpp:14
BOOST_PYTHON_MODULE
BOOST_PYTHON_MODULE(ParticleGun)
Definition:
pyParticleGun.cc:66
pyParticleGun
Definition:
pyParticleGun.cc:46
ParticleGunAction.hh
geant4.10.06.p01
environments
g4py
site-modules
primaries
ParticleGun
pyParticleGun.cc
Generated on Thu May 2 2024 20:59:32 for LArSoft by
1.8.11