Import Geant4 8.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:44:26 +02:00
parent 8a51e0bc40
commit 216a75eeb1
8717 changed files with 360418 additions and 141343 deletions
@@ -0,0 +1,14 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 08:09:44 kmura Exp $
# $Name: geant4-08-01 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../config/config.gmk
# python module name
MODULE := G4event#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/install.gmk
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: pyG4ClassificationOfNewTrack.cc,v 1.4 2006/06/29 15:30:44 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// pyG4ClassificationOfNewTrack.cc
//
// 2005 Q
// ====================================================================
#include <boost/python.hpp>
#include "G4ClassificationOfNewTrack.hh"
using namespace boost::python;
// ====================================================================
// module definition
// ====================================================================
void export_G4ClassificationOfNewTrack()
{
enum_<G4ClassificationOfNewTrack>("G4ClassificationOfNewTrack")
.value("fUrgent", fUrgent)
.value("fWaiting", fWaiting)
.value("fPostpone", fPostpone)
.value("fKill", fKill)
.value("fWaiting_1", fWaiting_1)
.value("fWaiting_2", fWaiting_2)
.value("fWaiting_3", fWaiting_3)
.value("fWaiting_4", fWaiting_4)
.value("fWaiting_5", fWaiting_5)
.value("fWaiting_6", fWaiting_6)
.value("fWaiting_7", fWaiting_7)
.value("fWaiting_8", fWaiting_8)
.value("fWaiting_9", fWaiting_9)
.value("fWaiting_19", fWaiting_10)
;
}
@@ -0,0 +1,84 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: pyG4Event.cc,v 1.4 2006/06/29 15:31:29 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// pyG4Event.cc
//
// 2005 Q
// ====================================================================
#include <boost/python.hpp>
#include "G4Event.hh"
using namespace boost::python;
// ====================================================================
// thin wrappers
// ====================================================================
namespace pyG4Event {
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GetPrimaryVertex,
GetPrimaryVertex, 0, 1);
};
using namespace pyG4Event;
// ====================================================================
// module definition
// ====================================================================
void export_G4Event()
{
class_<G4Event, G4Event*>("G4Event", "event class")
.def(init<G4int>())
// ---
.def("Print", &G4Event::Print)
.def("Draw", &G4Event::Draw)
.def("SetEventID", &G4Event::SetEventID)
.def("GetEventID", &G4Event::GetEventID)
.def("SetEventAborted", &G4Event::SetEventAborted)
.def("IsAborted", &G4Event::IsAborted)
// ---
.def("AddPrimaryVertex", &G4Event::AddPrimaryVertex)
.def("GetNumberOfPrimaryVertex", &G4Event::GetNumberOfPrimaryVertex)
.def("GetPrimaryVertex", &G4Event::GetPrimaryVertex,
f_GetPrimaryVertex()[return_internal_reference<>()])
// ---
.def("GetTrajectoryContainer", &G4Event::GetTrajectoryContainer,
return_internal_reference<>())
.def("SetUserInformation", &G4Event::SetUserInformation)
.def("GetUserInformation", &G4Event::GetUserInformation,
return_internal_reference<>())
;
// reduced functionality...
//.def("SetHCofThisEvent", &G4Event::SetHCofThisEvent)
//.def("GetHCofThisEvent", &G4Event::SetHCofThisEvent,
// return_internal_reference<>())
//.def("SetDCofThisEvent", &G4Event::SetHCofThisEvent)
//.def("GetDCofThisEvent", &G4Event::SetHCofThisEvent,
// return_internal_reference<>())
}
@@ -0,0 +1,77 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: pyG4EventManager.cc,v 1.4 2006/06/29 15:31:34 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// pyG4EventManager.cc
//
// 2005 Q
// ====================================================================
#include <boost/python.hpp>
#include "G4EventManager.hh"
#include "G4Event.hh"
using namespace boost::python;
// ====================================================================
// module definition
// ====================================================================
void export_G4EventManager()
{
class_<G4EventManager, boost::noncopyable>
("G4EventManager", "event manager class")
.def("GetEventManager", &G4EventManager::GetEventManager,
return_value_policy<reference_existing_object>())
.staticmethod("GetEventManager")
// ---
.def("GetConstCurrentEvent", &G4EventManager::GetConstCurrentEvent,
return_internal_reference<>())
.def("GetNonconstCurrentEvent",
&G4EventManager::GetNonconstCurrentEvent,
return_internal_reference<>())
.def("AbortCurrentEvent", &G4EventManager::AbortCurrentEvent)
.def("SetNumberOfAdditionalWaitingStacks",
&G4EventManager::SetNumberOfAdditionalWaitingStacks)
.def("GetStackManager", &G4EventManager::GetStackManager,
return_value_policy<reference_existing_object>())
.def("GetTrackingManager", &G4EventManager::GetTrackingManager,
return_value_policy<reference_existing_object>())
.def("GetVerboseLevel", &G4EventManager::GetVerboseLevel)
.def("SetVerboseLevel", &G4EventManager::SetVerboseLevel)
.def("SetUserInformation", &G4EventManager::SetUserInformation)
.def("GetUserInformation", &G4EventManager::GetUserInformation,
return_value_policy<reference_existing_object>())
;
// Note that exposed items are limited,
// because this class object is mainly for internal uses.
// ProcessOneEvent
// SetUserAction
// GetUserXXXAction
// GetPrimaryTransformer
// SetPrimaryTransformer
}
@@ -0,0 +1,147 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: pyG4ParticleGun.cc,v 1.4 2006/06/29 15:31:36 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// pyG4ParticleGun.cc
//
// 2005 Q
// ====================================================================
#include <boost/python.hpp>
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4Event.hh"
using namespace boost::python;
// ====================================================================
// miscs
// ====================================================================
// What a hell!
////////////////////////////////////////////////////////
G4ParticleGun::G4ParticleGun(const G4ParticleGun &right)
////////////////////////////////////////////////////////
{
*this= right;
}
/////////////////////////////////////////////////////////////////////////
const G4ParticleGun& G4ParticleGun::operator=(const G4ParticleGun &right)
/////////////////////////////////////////////////////////////////////////
{
NumberOfParticlesToBeGenerated= right.NumberOfParticlesToBeGenerated;
particle_definition= right.particle_definition;
particle_momentum_direction= right.particle_momentum_direction;
particle_energy= right.particle_energy;
particle_charge= right.particle_charge;
particle_polarization= right.particle_polarization;
return *this;
}
/////////////////////////////////////////////////////////////////
G4int G4ParticleGun::operator==(const G4ParticleGun &right) const
/////////////////////////////////////////////////////////////////
{
return 0;
}
/////////////////////////////////////////////////////////////////
G4int G4ParticleGun::operator!=(const G4ParticleGun &right) const
/////////////////////////////////////////////////////////////////
{
return 0;
}
// ====================================================================
// thin wrappers
// ====================================================================
namespace pyG4ParticleGun {
////////////////////////////////////////////////////////////////////
void SetParticleByName(G4ParticleGun* gun, const std::string& pname)
////////////////////////////////////////////////////////////////////
{
G4ParticleTable* particleTable= G4ParticleTable::GetParticleTable();
G4ParticleDefinition* pd= particleTable-> FindParticle(pname);
if (pd != 0) {
gun-> SetParticleDefinition(pd);
} else {
G4cout << "*** \"" << pname << "\" is not registered "
<< "in available particle list" << G4endl;
}
}
/////////////////////////////////////////////////
std::string GetParticleByName(G4ParticleGun* gun)
/////////////////////////////////////////////////
{
const G4ParticleDefinition* pd= gun-> GetParticleDefinition();
return (pd-> GetParticleName()).c_str();
}
};
using namespace pyG4ParticleGun;
// ====================================================================
// module definition
// ====================================================================
void export_G4ParticleGun()
{
class_<G4ParticleGun>
("G4ParticleGun", "particle gun")
// constructor
.def(init<G4int>())
.def(init<G4ParticleDefinition*>())
.def(init<G4ParticleDefinition*, G4int>())
// ---
.def("GeneratePrimaryVertex", &G4ParticleGun::GeneratePrimaryVertex)
.def("SetParticleDefinition", &G4ParticleGun::SetParticleDefinition)
.def("GetParticleDefinition", &G4ParticleGun::GetParticleDefinition,
return_value_policy<reference_existing_object>())
.def("SetParticleMomentum", &G4ParticleGun::SetParticleMomentum)
.def("SetParticleMomentumDirection",
&G4ParticleGun::SetParticleMomentumDirection)
.def("GetParticleMomentumDirection",
&G4ParticleGun::GetParticleMomentumDirection)
.def("SetParticleEnergy", &G4ParticleGun::SetParticleEnergy)
.def("GetParticleEnergy", &G4ParticleGun::GetParticleEnergy)
.def("SetParticleCharge", &G4ParticleGun::SetParticleCharge)
.def("GetParticleCharge", &G4ParticleGun::GetParticleCharge)
.def("SetParticlePolarization", &G4ParticleGun::SetParticlePolarization)
.def("GetParticlePolarization", &G4ParticleGun::GetParticlePolarization)
.def("SetNumberOfParticles", &G4ParticleGun::SetNumberOfParticles)
.def("GetNumberOfParticles", &G4ParticleGun::GetNumberOfParticles)
.def("SetParticlePosition", &G4ParticleGun::SetParticlePosition)
.def("GetParticlePosition", &G4ParticleGun::GetParticlePosition)
.def("SetParticleTime", &G4ParticleGun::SetParticleTime)
.def("GetParticleTime", &G4ParticleGun::GetParticleTime)
.def("SetParticleByName", SetParticleByName)
.def("GetParticleByName", GetParticleByName)
;
}
@@ -0,0 +1,75 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: pyG4StackManager.cc,v 1.4 2006/06/29 15:31:38 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// pyG4StackManager.cc
//
// 2005 Q
// ====================================================================
#include <boost/python.hpp>
#include "G4StackManager.hh"
using namespace boost::python;
// ====================================================================
// thin wrappers
// ====================================================================
namespace pyG4StackManager {
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ClearWaitingStack,
ClearWaitingStack, 0, 1);
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GetNWaitingTrack,
GetNWaitingTrack, 0, 1);
};
using namespace pyG4StackManager;
// ====================================================================
// module definition
// ====================================================================
void export_G4StackManager()
{
class_<G4StackManager, boost::noncopyable>
("G4StackManager", "stack management class")
// ---
// Note that exposed items are limited, because this class object
// is mainly for internal uses.
.def("ReClassify", &G4StackManager::ReClassify)
.def("clear", &G4StackManager::clear)
.def("ClearUrgentStack", &G4StackManager::ClearUrgentStack)
.def("ClearWaitingStack", &G4StackManager::ClearWaitingStack,
f_ClearWaitingStack())
.def("ClearPostponeStack", &G4StackManager::ClearPostponeStack)
.def("GetNTotalTrack", &G4StackManager::GetNTotalTrack)
.def("GetNUrgentTrack", &G4StackManager::GetNUrgentTrack)
.def("GetNWaitingTrack", &G4StackManager::GetNWaitingTrack,
f_GetNWaitingTrack())
.def("SetVerboseLevel", &G4StackManager::SetVerboseLevel)
;
}
@@ -0,0 +1,77 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: pyG4UserEventAction.cc,v 1.6 2006/06/29 15:31:41 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// pyG4UserEventAction.cc
//
// 2005 Q
// ====================================================================
#include <boost/python.hpp>
#include "G4UserEventAction.hh"
#include "G4Event.hh"
using namespace boost::python;
// ====================================================================
// thin wrappers
// ====================================================================
struct CB_G4UserEventAction : G4UserEventAction,
wrapper<G4UserEventAction> {
// BeginOfEventAction
void BeginOfEventAction(const G4Event* anEvent) {
if(const override& f= get_override("BeginOfEventAction")) {
f(boost::ref(anEvent));
} else
G4UserEventAction::BeginOfEventAction(anEvent);
}
// EndOfEventAction
void EndOfEventAction(const G4Event* anEvent) {
if(const override& f= get_override("EndOfEventAction")) {
f(boost::ref(anEvent));
} else {
G4UserEventAction::EndOfEventAction(anEvent);
}
}
};
// ====================================================================
// module definition
// ====================================================================
void export_G4UserEventAction()
{
class_<CB_G4UserEventAction, CB_G4UserEventAction*, boost::noncopyable>
( "G4UserEventAction", "event action class")
.def("BeginOfEventAction", &G4UserEventAction::BeginOfEventAction,
&CB_G4UserEventAction::BeginOfEventAction)
.def("EndOfEventAction", &G4UserEventAction::EndOfEventAction,
&CB_G4UserEventAction::EndOfEventAction)
;
}
@@ -0,0 +1,93 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: pyG4UserStackingAction.cc,v 1.7 2006/06/29 15:31:44 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// pyG4UserStackingAction.cc
//
// 2005 Q
// ====================================================================
#include <boost/python.hpp>
#include "G4UserStackingAction.hh"
#include "G4Track.hh"
using namespace boost::python;
// ====================================================================
// thin wrappers
// ====================================================================
namespace pyG4UserStackingAction {
struct CB_G4UserStackingAction : G4UserStackingAction,
wrapper<G4UserStackingAction> {
// ClassifyNewTrack
G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack) {
if(const override& f= get_override("ClassifyNewTrack")) {
return f(boost::ref(aTrack));
} else
return G4UserStackingAction::ClassifyNewTrack(aTrack);
}
// NewState
void NewStage() {
if(const override& f= get_override("NewStage")) {
f();
} else
G4UserStackingAction::NewStage();
}
// PrepareNewEvent
void PrepareNewEvent() {
if(const override& f= get_override("PrepareNewEvent")) {
f();
} else
G4UserStackingAction::PrepareNewEvent();
}
};
};
using namespace pyG4UserStackingAction;
// ====================================================================
// module definition
// ====================================================================
void export_G4UserStackingAction()
{
class_<CB_G4UserStackingAction, CB_G4UserStackingAction*, boost::noncopyable>
("G4UserStackingAction", "stacking action class")
// ---
.def("ClassifyNewTrack", &G4UserStackingAction::ClassifyNewTrack,
&CB_G4UserStackingAction::ClassifyNewTrack)
.def("NewStage", &G4UserStackingAction::NewStage,
&CB_G4UserStackingAction::NewStage)
.def("PrepareNewEvent", &G4UserStackingAction::PrepareNewEvent,
&CB_G4UserStackingAction::PrepareNewEvent)
;
}
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: pymodG4event.cc,v 1.4 2006/06/29 15:31:47 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// pymodG4event.cc [Geant4Py module]
//
// 2005 Q
// ====================================================================
#include <boost/python.hpp>
using namespace boost::python;
// ====================================================================
// module definition
// ====================================================================
void export_G4EventManager();
void export_G4StackManager();
void export_G4Event();
void export_G4UserEventAction();
void export_G4UserStackingAction();
void export_G4ClassificationOfNewTrack();
void export_G4ParticleGun();
BOOST_PYTHON_MODULE(G4event)
{
export_G4EventManager();
export_G4StackManager();
export_G4Event();
export_G4UserEventAction();
export_G4UserStackingAction();
export_G4ClassificationOfNewTrack();
export_G4ParticleGun();
}