Import Geant4 8.1.0 source tree
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4PyCoutDestination.cc,v 1.3 2006/06/29 15:33:03 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// G4PyCoutDistination.cc
|
||||
//
|
||||
// 2006 Q
|
||||
// ====================================================================
|
||||
#include <Python.h>
|
||||
#include "G4PyCoutDestination.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
//////////////////////////////////////////
|
||||
G4PyCoutDestination::G4PyCoutDestination()
|
||||
//////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////
|
||||
G4PyCoutDestination::~G4PyCoutDestination()
|
||||
///////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
G4int G4PyCoutDestination::ReceiveG4cout(G4String coutString)
|
||||
/////////////////////////////////////////////////////////////
|
||||
{
|
||||
PySys_WriteStdout("%s", coutString.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
G4int G4PyCoutDestination::ReceiveG4cerr(G4String cerrString)
|
||||
/////////////////////////////////////////////////////////////
|
||||
{
|
||||
PySys_WriteStderr("%s", cerrString.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4PyCoutDestination.hh,v 1.3 2006/06/29 15:33:06 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// G4PyCoutDestination.hh
|
||||
//
|
||||
// 2006 Q
|
||||
// ====================================================================
|
||||
#ifndef G4PY_COUT_DESTINATION_H
|
||||
#define G4PY_COUT_DESTINATION_H
|
||||
|
||||
#include "G4coutDestination.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
class G4PyCoutDestination : public G4coutDestination {
|
||||
|
||||
public:
|
||||
G4PyCoutDestination();
|
||||
~G4PyCoutDestination();
|
||||
|
||||
virtual G4int ReceiveG4cout(G4String coutString);
|
||||
virtual G4int ReceiveG4cerr(G4String cerrString);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,14 @@
|
||||
# $Id: GNUmakefile,v 1.2 2006/04/25 08:09:45 kmura Exp $
|
||||
# $Name: geant4-08-01 $
|
||||
# ===========================================================
|
||||
# Makefile for building Geant4Py modules
|
||||
# ===========================================================
|
||||
include ../../config/config.gmk
|
||||
|
||||
# python module name
|
||||
MODULE := G4global#
|
||||
|
||||
include $(G4PY_INSTALL)/config/g4py.gmk
|
||||
include $(G4PY_INSTALL)/config/module.gmk
|
||||
include $(G4PY_INSTALL)/config/install.gmk
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyG4ApplicationState.cc,v 1.4 2006/06/29 15:33:09 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// pyG4ApplicationState.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4ApplicationState.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
void export_G4ApplicationState()
|
||||
{
|
||||
enum_<G4ApplicationState>("G4APplicationState")
|
||||
.value("G4State_PreInit", G4State_PreInit)
|
||||
.value("G4State_Init", G4State_Init)
|
||||
.value("G4State_Idle", G4State_Idle)
|
||||
.value("G4State_GeomClosed", G4State_GeomClosed)
|
||||
.value("G4State_EventProc", G4State_EventProc)
|
||||
.value("G4State_Quit", G4State_Quit)
|
||||
.value("G4State_Abort", G4State_Abort)
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyG4RandomDirection.cc,v 1.4 2006/06/29 15:33:12 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// pyG4RandomDirection.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4RandomDirection.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_G4RandomDirection()
|
||||
{
|
||||
def("G4RandomDirection", G4RandomDirection);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyG4RotationMatrix.cc,v 1.4 2006/06/29 15:33:15 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// pyG4RotationMatrix.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
typedef G4RotationMatrix XXX; // ...
|
||||
|
||||
// ====================================================================
|
||||
// thin wrappers
|
||||
// ====================================================================
|
||||
namespace pyG4RotationMatrix {
|
||||
|
||||
XXX&(XXX::*f1_rotate)(G4double, const G4ThreeVector&)= &XXX::rotate;
|
||||
XXX&(XXX::*f2_rotate)(G4double, const G4ThreeVector*)= &XXX::rotate;
|
||||
|
||||
};
|
||||
|
||||
using namespace pyG4RotationMatrix;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_G4RotationMatrix()
|
||||
{
|
||||
class_<G4RotationMatrix>("G4RotationMatrix", "rotation matrix")
|
||||
// constructors
|
||||
.def(init<const XXX&>())
|
||||
|
||||
// property
|
||||
.add_property("xx", &XXX::xx)
|
||||
.add_property("xy", &XXX::xy)
|
||||
.add_property("xz", &XXX::xz)
|
||||
.add_property("yx", &XXX::yx)
|
||||
.add_property("yy", &XXX::yy)
|
||||
.add_property("yz", &XXX::yz)
|
||||
.add_property("zx", &XXX::zx)
|
||||
.add_property("zy", &XXX::zy)
|
||||
.add_property("zz", &XXX::zz)
|
||||
.def_readonly("IDENTITY", &XXX::IDENTITY)
|
||||
|
||||
// methods
|
||||
.def("colX", &XXX::colX)
|
||||
.def("colY", &XXX::colY)
|
||||
.def("colZ", &XXX::colZ)
|
||||
.def("rowX", &XXX::rowX)
|
||||
.def("rowY", &XXX::rowY)
|
||||
.def("rowZ", &XXX::rowZ)
|
||||
.def("getPhi", &XXX::getPhi)
|
||||
.def("getTheta", &XXX::getTheta)
|
||||
.def("getPsi", &XXX::getPsi)
|
||||
.def("phi", &XXX::phi)
|
||||
.def("theta", &XXX::theta)
|
||||
.def("psi", &XXX::psi)
|
||||
.def("getDelta", &XXX::getDelta)
|
||||
.def("getAxis", &XXX::getAxis)
|
||||
.def("delta", &XXX::axis)
|
||||
.def("axis", &XXX::delta)
|
||||
.def("phiX", &XXX::phiX)
|
||||
.def("phiY", &XXX::phiY)
|
||||
.def("phiZ", &XXX::phiZ)
|
||||
.def("thetaX", &XXX::thetaX)
|
||||
.def("thetaY", &XXX::thetaY)
|
||||
.def("thetaZ", &XXX::thetaZ)
|
||||
.def("setPhi", &XXX::setPhi)
|
||||
.def("setTheta", &XXX::setTheta)
|
||||
.def("setPsi", &XXX::setPsi)
|
||||
.def("setAxis", &XXX::setAxis)
|
||||
.def("setDelta", &XXX::setDelta)
|
||||
.def("isIdentity", &XXX::isIdentity)
|
||||
.def("rotateX", &XXX::rotateX,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("rotateY", &XXX::rotateY,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("rotateZ", &XXX::rotateZ,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("rotate", f1_rotate,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("rotate", f2_rotate,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("rotateAxes", &XXX::rotateAxes,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("inverse", &XXX::inverse)
|
||||
.def("invert", &XXX::invert,
|
||||
return_value_policy<reference_existing_object>())
|
||||
|
||||
// operators
|
||||
.def(self_ns::str(self))
|
||||
.def(self == self)
|
||||
.def(self != self)
|
||||
.def(self > self)
|
||||
.def(self < self)
|
||||
.def(self >= self)
|
||||
.def(self <= self)
|
||||
.def(self * self)
|
||||
.def(self * G4ThreeVector())
|
||||
.def(self *= self)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyG4StateManager.cc,v 1.4 2006/06/29 15:33:18 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// pyG4StateManager.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4StateManager.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_G4StateManager()
|
||||
{
|
||||
class_<G4StateManager, boost::noncopyable>
|
||||
("G4StateManager", "state manager", no_init)
|
||||
.def("GetStateManager", &G4StateManager::GetStateManager,
|
||||
"Get an instance of G4StateManager",
|
||||
return_value_policy<reference_existing_object>())
|
||||
.staticmethod("GetStateManager")
|
||||
// ---
|
||||
.def("GetCurrentState", &G4StateManager::GetCurrentState)
|
||||
.def("GetPreviousState", &G4StateManager::GetPreviousState)
|
||||
.def("GetStateString", &G4StateManager::GetStateString)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyG4String.cc,v 1.4 2006/06/29 15:33:21 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// pyG4String.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4String.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// thin wrappers
|
||||
// ====================================================================
|
||||
std::ostream& operator<<(std::ostream& ostr, const G4String& astr)
|
||||
{
|
||||
return ostr << astr.c_str();
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_G4String()
|
||||
{
|
||||
class_<G4String>("G4String", "string class")
|
||||
.def(init<const G4String&>())
|
||||
.def(init<const char*>())
|
||||
.def(self_ns::str(self))
|
||||
.def(self + self)
|
||||
.def(self += self)
|
||||
.def(self += other<const char*>())
|
||||
.def(self == self)
|
||||
.def(self == other<const char*>())
|
||||
.def(self != self)
|
||||
.def(self != other<const char*>())
|
||||
;
|
||||
|
||||
implicitly_convertible<G4String, const char*>();
|
||||
implicitly_convertible<const char* ,G4String>();
|
||||
|
||||
implicitly_convertible<G4String, std::string>();
|
||||
implicitly_convertible<std::string ,G4String>();
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyG4ThreeVector.cc,v 1.5 2006/06/29 15:33:24 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// pyG4ThreeVector.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
using namespace CLHEP;
|
||||
|
||||
typedef G4ThreeVector XXX; // ...
|
||||
|
||||
// ====================================================================
|
||||
// thin wrappers
|
||||
// ====================================================================
|
||||
namespace pyG4ThreeVector {
|
||||
|
||||
G4double(XXX::*f1_theta)() const= &XXX::theta;
|
||||
G4double(XXX::*f2_theta)(const XXX&) const = &XXX::theta;
|
||||
|
||||
G4double(XXX::*f1_cosTheta)() const= &XXX::cosTheta;
|
||||
G4double(XXX::*f2_cosTheta)(const XXX&) const = &XXX::cosTheta;
|
||||
|
||||
G4double(XXX::*f1_cos2Theta)() const= &XXX::cos2Theta;
|
||||
G4double(XXX::*f2_cos2Theta)(const XXX&) const = &XXX::cos2Theta;
|
||||
|
||||
G4double(XXX::*f1_perp2)() const= &XXX::perp2;
|
||||
G4double(XXX::*f2_perp2)(const XXX&) const = &XXX::perp2;
|
||||
|
||||
G4double(XXX::*f1_perp)() const= &XXX::perp;
|
||||
G4double(XXX::*f2_perp)(const XXX&) const = &XXX::perp;
|
||||
|
||||
G4double(XXX::*f1_angle)() const= &XXX::angle;
|
||||
G4double(XXX::*f2_angle)(const XXX&) const = &XXX::angle;
|
||||
|
||||
G4double(XXX::*f1_eta)() const= &XXX::eta;
|
||||
G4double(XXX::*f2_eta)(const XXX&) const = &XXX::eta;
|
||||
|
||||
XXX(XXX::*f1_project)() const= &XXX::project;
|
||||
XXX(XXX::*f2_project)(const XXX&) const = &XXX::project;
|
||||
|
||||
XXX(XXX::*f1_perpPart)() const= &XXX::perpPart;
|
||||
XXX(XXX::*f2_perpPart)(const XXX&) const = &XXX::perpPart;
|
||||
|
||||
G4double(XXX::*f1_rapidity)() const= &XXX::rapidity;
|
||||
G4double(XXX::*f2_rapidity)(const XXX&) const = &XXX::rapidity;
|
||||
|
||||
G4double(XXX::*f1_polarAngle)(const XXX&) const= &XXX::polarAngle;
|
||||
G4double(XXX::*f2_polarAngle)(const XXX&, const XXX&) const = &XXX::polarAngle;
|
||||
|
||||
G4double(XXX::*f1_azimAngle)(const XXX&) const= &XXX::azimAngle;
|
||||
G4double(XXX::*f2_azimAngle)(const XXX&, const XXX&) const = &XXX::azimAngle;
|
||||
|
||||
XXX&(XXX::*f1_rotate)(G4double, const XXX&)= &XXX::rotate;
|
||||
XXX&(XXX::*f2_rotate)(const XXX&, G4double)= &XXX::rotate;
|
||||
XXX&(XXX::*f3_rotate)(const HepAxisAngle&)= &XXX::rotate;
|
||||
XXX&(XXX::*f4_rotate)(const HepEulerAngles&)= &XXX::rotate;
|
||||
XXX&(XXX::*f5_rotate)(G4double, G4double, G4double)= &XXX::rotate;
|
||||
|
||||
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_isNear, isNear, 1, 2);
|
||||
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_isParallel, isParallel, 1, 2);
|
||||
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_isOrthogonal, isOrthogonal, 1, 2);
|
||||
|
||||
};
|
||||
|
||||
using namespace pyG4ThreeVector;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_G4ThreeVector()
|
||||
{
|
||||
class_<G4ThreeVector>("G4ThreeVector", "general 3-vector")
|
||||
// constructors
|
||||
.def(init<G4double>())
|
||||
.def(init<G4double, G4double>())
|
||||
.def(init<G4double, G4double, G4double>())
|
||||
.def(init<const XXX&>())
|
||||
|
||||
// property
|
||||
.add_property("x", &XXX::x, &XXX::setX)
|
||||
.add_property("y", &XXX::y, &XXX::setY)
|
||||
.add_property("z", &XXX::z, &XXX::setZ)
|
||||
|
||||
// methods
|
||||
.def("set", &XXX::set)
|
||||
.def("phi", &XXX::phi)
|
||||
.def("mag", &XXX::mag)
|
||||
.def("mag2", &XXX::mag2)
|
||||
.def("setPhi", &XXX::setPhi)
|
||||
.def("setTheta", &XXX::setTheta)
|
||||
.def("setMag", &XXX::setMag)
|
||||
.def("setPerp", &XXX::setPerp)
|
||||
.def("setCylTheta", &XXX::setCylTheta)
|
||||
.def("howNear", &XXX::howNear)
|
||||
.def("deltaR", &XXX::deltaR)
|
||||
.def("unit", &XXX::unit)
|
||||
.def("orthogonal", &XXX::orthogonal)
|
||||
.def("dot", &XXX::dot)
|
||||
.def("cross", &XXX::cross)
|
||||
.def("pseudoRapidity", &XXX::pseudoRapidity)
|
||||
.def("setEta", &XXX::setEta)
|
||||
.def("setCylEta",&XXX::setCylEta)
|
||||
.def("setRThetaPhi", &XXX::setRThetaPhi)
|
||||
.def("setREtaPhi", &XXX::setREtaPhi)
|
||||
.def("setRhoPhiZ", &XXX::setRhoPhiZ)
|
||||
.def("setRhoPhiEta", &XXX::setRhoPhiEta)
|
||||
.def("getX", &XXX::getX)
|
||||
.def("getY", &XXX::getY)
|
||||
.def("getZ", &XXX::getZ)
|
||||
.def("getR", &XXX::getR)
|
||||
.def("getTheta", &XXX::getTheta)
|
||||
.def("getPhi", &XXX::getPhi)
|
||||
.def("r", &XXX::r)
|
||||
.def("rho", &XXX::rho)
|
||||
.def("getRho", &XXX::getRho)
|
||||
.def("getEta", &XXX::getEta)
|
||||
.def("setR", &XXX::setR)
|
||||
.def("setRho", &XXX::setRho)
|
||||
.def("compare", &XXX::compare)
|
||||
.def("diff2", &XXX::diff2)
|
||||
.def("setTolerance", &XXX::setTolerance)
|
||||
.staticmethod("setTolerance")
|
||||
.def("getTolerance", &XXX::getTolerance)
|
||||
.staticmethod("getTolerance")
|
||||
.def("isNear", &XXX::isNear, f_isNear())
|
||||
.def("isParallel", &XXX::isParallel, f_isParallel())
|
||||
.def("isOrthogonal", &XXX::isOrthogonal, f_isOrthogonal())
|
||||
.def("howParallel", &XXX::howParallel)
|
||||
.def("howOrthogonal", &XXX::howOrthogonal)
|
||||
.def("beta", &XXX::beta)
|
||||
.def("gamma", &XXX::gamma)
|
||||
.def("deltaPhi", &XXX::deltaPhi)
|
||||
.def("coLinearRapidity", &XXX::coLinearRapidity)
|
||||
.def("theta", f1_theta)
|
||||
.def("theta", f2_theta)
|
||||
.def("cosTheta", f1_cosTheta)
|
||||
.def("cosTheta", f2_cosTheta)
|
||||
.def("cos2Theta", f1_cos2Theta)
|
||||
.def("cos2Theta", f2_cos2Theta)
|
||||
.def("perp2", f1_perp2)
|
||||
.def("perp2", f2_perp2)
|
||||
.def("angle", f1_angle)
|
||||
.def("angle", f2_angle)
|
||||
.def("eta", f1_eta)
|
||||
.def("eta", f2_eta)
|
||||
.def("project", f1_project)
|
||||
.def("project", f2_project)
|
||||
.def("perpPart", f1_perpPart)
|
||||
.def("perpPart", f2_perpPart)
|
||||
.def("rapidity", f1_rapidity)
|
||||
.def("rapidity", f2_rapidity)
|
||||
.def("polarAngle",f1_polarAngle)
|
||||
.def("polarAngle",f2_polarAngle)
|
||||
.def("azimAngle", f1_azimAngle)
|
||||
.def("azimAngle", f2_azimAngle)
|
||||
.def("rotateX", &XXX::rotateX,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("rotateY", &XXX::rotateY,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("rotateZ", &XXX::rotateZ,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("rotateUz", &XXX::rotateUz,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("transform",&XXX::transform,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("rotate", f1_rotate,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("rotate", f2_rotate,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("rotate", f5_rotate,
|
||||
return_value_policy<reference_existing_object>())
|
||||
|
||||
// operators
|
||||
.def(self_ns::str(self))
|
||||
.def(self == self)
|
||||
.def(self != self)
|
||||
.def(self += self)
|
||||
.def(self -= self)
|
||||
.def(self - self)
|
||||
.def(self + self)
|
||||
.def(self * self)
|
||||
.def(self * G4double())
|
||||
.def(self / G4double())
|
||||
.def(G4double() * self)
|
||||
.def(self *= G4double())
|
||||
.def(self /= G4double())
|
||||
.def(self > self)
|
||||
.def(self < self)
|
||||
.def(self >= self)
|
||||
.def(self <= self)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyG4Timer.cc,v 1.3 2006/06/29 15:33:27 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// pyG4Timer.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4Timer.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_G4Timer()
|
||||
{
|
||||
class_<G4Timer>("G4Timer", "Timer")
|
||||
// ---
|
||||
.def("Start", &G4Timer::Start)
|
||||
.def("Stop", &G4Timer::Stop)
|
||||
.def("IsValid", &G4Timer::IsValid)
|
||||
.def("GetRealElapsed", &G4Timer::GetRealElapsed)
|
||||
.def("GetSystemElapsed", &G4Timer::GetSystemElapsed)
|
||||
.def("GetUserElapsed", &G4Timer::GetUserElapsed)
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyG4Transform3D.cc,v 1.4 2006/06/29 15:33:30 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// pyG4Transform3D.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
typedef G4Transform3D XXX; // ...
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_G4Transform3D()
|
||||
{
|
||||
class_<G4Transform3D>("G4Transform3D", "geometrical 3D transformation")
|
||||
// constructors
|
||||
.def(init<const G4RotationMatrix&, const G4ThreeVector&>())
|
||||
.def(init<const XXX&>())
|
||||
|
||||
// property
|
||||
.add_property("xx", &XXX::xx)
|
||||
.add_property("xy", &XXX::xy)
|
||||
.add_property("xz", &XXX::xz)
|
||||
.add_property("yx", &XXX::yx)
|
||||
.add_property("yy", &XXX::yy)
|
||||
.add_property("yz", &XXX::yz)
|
||||
.add_property("zx", &XXX::zx)
|
||||
.add_property("zy", &XXX::zy)
|
||||
.add_property("zz", &XXX::zz)
|
||||
.add_property("dx", &XXX::dx)
|
||||
.add_property("dy", &XXX::dy)
|
||||
.add_property("dz", &XXX::dz)
|
||||
.def_readonly("Identity", &XXX::Identity)
|
||||
|
||||
// methods
|
||||
.def("inverse", &XXX::inverse)
|
||||
.def("getRotation" , &XXX::getRotation)
|
||||
.def("getTranslation", &XXX::getTranslation)
|
||||
|
||||
// operators
|
||||
.def(self == self)
|
||||
.def(self != self)
|
||||
.def(self * self)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyG4UnitsTable.cc,v 1.4 2006/06/29 15:33:33 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// pyG4UnitsTable.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "pyG4indexing.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_G4UnitsTable()
|
||||
{
|
||||
class_<G4UnitsTable>("G4UnitsTable", "Units Table")
|
||||
.def(vector_indexing_suite<G4UnitsTable>())
|
||||
;
|
||||
|
||||
class_<G4UnitsContainer>("G4UnitsContainer", "Units Container")
|
||||
.def(vector_indexing_suite<G4UnitsContainer>())
|
||||
;
|
||||
|
||||
class_<G4UnitDefinition, boost::noncopyable>
|
||||
("G4UnitDefinition", "Unit Definition", no_init)
|
||||
.def(init<const G4String&, const G4String&, const G4String&, G4double>())
|
||||
// ---
|
||||
.def("GetName", &G4UnitDefinition::GetName,
|
||||
return_value_policy<return_by_value>())
|
||||
.def("GetSymbol", &G4UnitDefinition::GetSymbol,
|
||||
return_value_policy<return_by_value>())
|
||||
.def("GetValue", &G4UnitDefinition::GetValue)
|
||||
.def("PrintDefinition", &G4UnitDefinition::PrintDefinition)
|
||||
// ---
|
||||
.def("BuildUnitsTable", &G4UnitDefinition::BuildUnitsTable)
|
||||
.staticmethod("BuildUnitsTable")
|
||||
.def("PrintUnitsTable", &G4UnitDefinition::PrintUnitsTable)
|
||||
.staticmethod("PrintUnitsTable")
|
||||
.def("GetUnitsTable", &G4UnitDefinition::GetUnitsTable,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.staticmethod("GetUnitsTable")
|
||||
// ---
|
||||
.def("GetValueOf", &G4UnitDefinition::GetValueOf)
|
||||
.staticmethod("GetValueOf")
|
||||
.def("GetCategory", &G4UnitDefinition::GetCategory)
|
||||
.staticmethod("GetCategory")
|
||||
;
|
||||
|
||||
class_<G4UnitsCategory, boost::noncopyable>
|
||||
("G4UnitsCategory", "Units Category", no_init)
|
||||
.def(init<const G4String&>())
|
||||
// ---
|
||||
.def("GetName", &G4UnitsCategory::GetName,
|
||||
return_value_policy<return_by_value>())
|
||||
.def("GetUnitsList", &G4UnitsCategory::GetUnitsList,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("GetNameMxLen", &G4UnitsCategory::GetNameMxLen)
|
||||
.def("GetSymbMxLen", &G4UnitsCategory::GetSymbMxLen)
|
||||
.def("UpdateNameMxLen", &G4UnitsCategory::UpdateNameMxLen)
|
||||
.def("UpdateSymbMxLen", &G4UnitsCategory::UpdateSymbMxLen)
|
||||
.def("PrintCategory", &G4UnitsCategory::PrintCategory)
|
||||
;
|
||||
|
||||
class_<G4BestUnit>("G4BestUnit", "present best unit", no_init)
|
||||
.def(init<G4double, const G4String&>())
|
||||
.def(init<const G4ThreeVector&, const G4String&>())
|
||||
// ---
|
||||
.def("GetCategory", &G4BestUnit::GetCategory,
|
||||
return_value_policy<return_by_value>())
|
||||
.def("GetIndexOfCategory", &G4BestUnit::GetIndexOfCategory)
|
||||
.def(self_ns::str(self))
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyG4UserLimits.cc,v 1.4 2006/06/29 15:33:36 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// pyG4UserLimits.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4UserLimits.hh"
|
||||
#include "G4Track.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_G4UserLimits()
|
||||
{
|
||||
class_<G4UserLimits, G4UserLimits*>
|
||||
("G4UserLimits", "user step limitations")
|
||||
// ---
|
||||
.def(init<G4double>())
|
||||
.def(init<G4double, G4double>())
|
||||
.def(init<G4double, G4double, G4double>())
|
||||
.def(init<G4double, G4double, G4double, G4double>())
|
||||
.def(init<G4double, G4double, G4double, G4double, G4double>())
|
||||
// ---
|
||||
.def(init<const G4String&>())
|
||||
.def(init<const G4String&, G4double>())
|
||||
.def(init<const G4String&, G4double, G4double>())
|
||||
.def(init<const G4String&, G4double, G4double, G4double>())
|
||||
.def(init<const G4String&, G4double, G4double, G4double, G4double>())
|
||||
.def(init<const G4String&, G4double, G4double, G4double,
|
||||
G4double, G4double>())
|
||||
// ---
|
||||
.def("GetUserMaxTrackLength", &G4UserLimits::GetUserMaxTrackLength)
|
||||
.def("GetUserMaxTime", &G4UserLimits::GetUserMaxTime)
|
||||
.def("GetUserMinEkine", &G4UserLimits::GetUserMinEkine)
|
||||
.def("GetUserMinRange", &G4UserLimits::GetUserMinRange)
|
||||
// ---
|
||||
.def("SetMaxAllowedStep", &G4UserLimits::SetMaxAllowedStep)
|
||||
.def("SetUserMaxTrackLength", &G4UserLimits::SetUserMaxTrackLength)
|
||||
.def("SetUserMaxTime", &G4UserLimits::SetUserMaxTime)
|
||||
.def("SetUserMinEkine", &G4UserLimits::SetUserMinEkine)
|
||||
.def("SetUserMinRange", &G4UserLimits::SetUserMinRange)
|
||||
// ---
|
||||
.def("GetType", &G4UserLimits::GetType,
|
||||
return_internal_reference<>())
|
||||
.def("SetType", &G4UserLimits::SetType)
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyRandomEngines.cc,v 1.4 2006/06/29 15:33:39 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// pyRandomEngines.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "CLHEP/Random/RandomEngine.h"
|
||||
#include "CLHEP/Random/JamesRandom.h"
|
||||
#include "CLHEP/Random/Ranlux64Engine.h"
|
||||
|
||||
using namespace boost::python;
|
||||
using namespace CLHEP;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_RandomEngines()
|
||||
{
|
||||
class_<HepRandomEngine, boost::noncopyable>
|
||||
("HepRandomEngine", "base class of random engine", no_init)
|
||||
;
|
||||
|
||||
class_<HepJamesRandom, bases<HepRandomEngine> >
|
||||
("HepJamesRandom", "HepJames random engine")
|
||||
;
|
||||
|
||||
class_<Ranlux64Engine, bases<HepRandomEngine> >
|
||||
("Ranlux64Engine", "Ranlux64 random engine")
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyRandomize.cc,v 1.4 2006/06/29 15:33:42 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// pyRandomize.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "Randomize.hh"
|
||||
#include <vector>
|
||||
|
||||
using namespace boost::python;
|
||||
using namespace CLHEP;
|
||||
|
||||
// ====================================================================
|
||||
// thin wrappers
|
||||
// ====================================================================
|
||||
namespace pyRandomize {
|
||||
|
||||
// problem with BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS for static method
|
||||
// setTheSeed
|
||||
void f1_setTheSeed(long seed)
|
||||
{
|
||||
HepRandom::setTheSeed(seed);
|
||||
}
|
||||
|
||||
void f2_setTheSeed(long seed, int lux)
|
||||
{
|
||||
HepRandom::setTheSeed(seed, lux);
|
||||
}
|
||||
|
||||
// setTheSeeds
|
||||
void f1_setTheSeeds(const list& seedList)
|
||||
{
|
||||
// check size...
|
||||
int idx=0;
|
||||
while(1) {
|
||||
long val= extract<long>(seedList[idx]);
|
||||
if(val==0) break;
|
||||
idx++;
|
||||
}
|
||||
int nsize= idx+1;
|
||||
|
||||
long* seedArray= new long[nsize]; // should not be deleted!!
|
||||
// (this is a problem with CLHEP.)
|
||||
for (int i=0; i< nsize; i++) {
|
||||
seedArray[i]= extract<long>(seedList[i]);
|
||||
}
|
||||
|
||||
HepRandom::setTheSeeds(seedArray);
|
||||
}
|
||||
|
||||
void f2_setTheSeeds(const list& seedList, int aux)
|
||||
{
|
||||
// check size...
|
||||
int idx=0;
|
||||
while(1) {
|
||||
long val= extract<long>(seedList[idx]);
|
||||
if(val==0) break;
|
||||
idx++;
|
||||
}
|
||||
int nsize= idx+1;
|
||||
|
||||
long* seedArray= new long[nsize];
|
||||
for (int i=0; i< nsize; i++) {
|
||||
seedArray[i]= extract<long>(seedList[i]);
|
||||
}
|
||||
|
||||
HepRandom::setTheSeeds(seedArray, aux);
|
||||
}
|
||||
|
||||
// getTheSeeds
|
||||
list f_getTheSeeds()
|
||||
{
|
||||
list seedList;
|
||||
const long* seeds= HepRandom::getTheSeeds();
|
||||
int idx=0;
|
||||
while(1) {
|
||||
if( seeds[idx]==0) break;
|
||||
seedList.append(seeds[idx]);
|
||||
idx++;
|
||||
}
|
||||
return seedList;
|
||||
}
|
||||
|
||||
// getTheTableSeeds
|
||||
list f_getTheTableSeeds(int index)
|
||||
{
|
||||
long seedPair[2];
|
||||
HepRandom::getTheTableSeeds(seedPair, index);
|
||||
|
||||
list seedList;
|
||||
seedList.append(seedPair[0]);
|
||||
seedList.append(seedPair[1]);
|
||||
|
||||
return seedList;
|
||||
}
|
||||
|
||||
|
||||
// saveEngineStatus
|
||||
void f1_saveEngineStatus()
|
||||
{
|
||||
HepRandom::saveEngineStatus();
|
||||
}
|
||||
|
||||
void f2_saveEngineStatus(const char* filename)
|
||||
{
|
||||
HepRandom::saveEngineStatus(filename);
|
||||
}
|
||||
|
||||
// restoreEngineStatus
|
||||
void f1_restoreEngineStatus()
|
||||
{
|
||||
HepRandom::restoreEngineStatus();
|
||||
}
|
||||
|
||||
void f2_restoreEngineStatus(const char* filename)
|
||||
{
|
||||
HepRandom::restoreEngineStatus(filename);
|
||||
}
|
||||
|
||||
// RandBit::shootBit
|
||||
int f1_RandBit_shootBit()
|
||||
{
|
||||
return RandBit::shootBit();
|
||||
}
|
||||
|
||||
// RandGaussQ::shoot
|
||||
double f1_RandGaussQ_shoot()
|
||||
{
|
||||
return RandGaussQ::shoot();
|
||||
}
|
||||
|
||||
double f2_RandGaussQ_shoot(double mean, double stdDev)
|
||||
{
|
||||
return RandGaussQ::shoot(mean, stdDev);
|
||||
}
|
||||
|
||||
|
||||
// G4UniformRand
|
||||
double f_G4UniformRand()
|
||||
{
|
||||
return G4UniformRand();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
using namespace pyRandomize;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_Randomize()
|
||||
{
|
||||
class_<HepRandom>("HepRandom", "generate random number")
|
||||
// ---
|
||||
.def(init<long>())
|
||||
.def(init<HepRandomEngine&>())
|
||||
.def(init<HepRandomEngine*>())
|
||||
// ---
|
||||
.def("setTheSeed", f1_setTheSeed)
|
||||
.def("setTheSeed", f2_setTheSeed)
|
||||
.staticmethod("setTheSeed")
|
||||
.def("getTheSeed", &HepRandom::getTheSeed)
|
||||
.staticmethod("getTheSeed")
|
||||
.def("setTheSeeds", f1_setTheSeeds)
|
||||
.def("setTheSeeds", f2_setTheSeeds)
|
||||
.staticmethod("setTheSeeds")
|
||||
.def("getTheSeeds", f_getTheSeeds)
|
||||
.staticmethod("getTheSeeds")
|
||||
.def("getTheTableSeeds", f_getTheTableSeeds)
|
||||
.staticmethod("getTheTableSeeds")
|
||||
// ---
|
||||
.def("getTheGenerator", &HepRandom::getTheGenerator,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.staticmethod("getTheGenerator")
|
||||
.def("setTheEngine", &HepRandom::setTheEngine)
|
||||
.staticmethod("setTheEngine")
|
||||
.def("getTheEngine", &HepRandom::getTheEngine,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.staticmethod("getTheEngine")
|
||||
.def("saveEngineStatus", f1_saveEngineStatus)
|
||||
.def("saveEngineStatus", f2_saveEngineStatus)
|
||||
.staticmethod("saveEngineStatus")
|
||||
.def("restoreEngineStatus", f1_restoreEngineStatus)
|
||||
.def("restoreEngineStatus", f2_restoreEngineStatus)
|
||||
.staticmethod("restoreEngineStatus")
|
||||
.def("showEngineStatus", &HepRandom::showEngineStatus)
|
||||
.staticmethod("showEngineStatus")
|
||||
.def("createInstance", &HepRandom::createInstance)
|
||||
.staticmethod("createInstance")
|
||||
;
|
||||
|
||||
// ---
|
||||
class_<RandBit, boost::noncopyable>
|
||||
("RandBit", "generate bit random number", no_init)
|
||||
.def("shootBit", f1_RandBit_shootBit)
|
||||
.staticmethod("shootBit")
|
||||
;
|
||||
|
||||
// ---
|
||||
class_<G4RandGauss, boost::noncopyable>
|
||||
("G4RandGauss", "generate gaussian random number", no_init)
|
||||
.def("shoot", f1_RandGaussQ_shoot)
|
||||
.def("shoot", f2_RandGaussQ_shoot)
|
||||
.staticmethod("shoot")
|
||||
;
|
||||
|
||||
// ---
|
||||
def("G4UniformRand", f_G4UniformRand);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pygeomdefs.cc,v 1.4 2006/06/29 15:33:45 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// pygeomdefs.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "geomdefs.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_geomdefs()
|
||||
{
|
||||
enum_<EAxis>("EAxis")
|
||||
.value("kXAxis", kXAxis)
|
||||
.value("kYAxis", kYAxis)
|
||||
.value("kZAxis", kZAxis)
|
||||
.value("kRho", kRho)
|
||||
.value("kRadial3D", kRadial3D)
|
||||
.value("kPhi", kPhi)
|
||||
.value("kUndefined", kUndefined)
|
||||
;
|
||||
|
||||
enum_<EInside>("EInside")
|
||||
.value("kOutside", kOutside)
|
||||
.value("kSurface", kSurface)
|
||||
.value("kInside", kInside)
|
||||
;
|
||||
|
||||
enum_<EVolume>("EVolume")
|
||||
.value("kNormal", kNormal)
|
||||
.value("kReplica", kReplica)
|
||||
.value("kParameterised", kParameterised)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyglobals.cc,v 1.4 2006/06/29 15:33:48 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// pyglobals.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4strstreambuf.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4PyCoutDestination.hh"
|
||||
#include "pyG4indexing.hh"
|
||||
#include <vector>
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
extern G4strstreambuf G4coutbuf;
|
||||
extern G4strstreambuf G4cerrbuf;
|
||||
|
||||
namespace pyglobals {
|
||||
|
||||
// G4cout/cerr are set to Python stdout
|
||||
void SetG4PyCoutDestination()
|
||||
{
|
||||
G4UImanager* UImgr= G4UImanager::GetUIpointer();
|
||||
G4PyCoutDestination* pycout= new G4PyCoutDestination();
|
||||
G4coutbuf.SetDestination(pycout);
|
||||
G4cerrbuf.SetDestination(pycout);
|
||||
}
|
||||
|
||||
void ResetG4PyCoutDestination()
|
||||
{
|
||||
G4UImanager* UImgr= G4UImanager::GetUIpointer();
|
||||
UImgr-> SetCoutDestination(0);
|
||||
}
|
||||
|
||||
typedef std::vector<G4int> G4intVector;
|
||||
typedef std::vector<G4double> G4doubleVector;
|
||||
typedef std::vector<G4String> G4StringVector;
|
||||
|
||||
};
|
||||
|
||||
using namespace pyglobals;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_globals()
|
||||
{
|
||||
def("SetG4PyCoutDestination", SetG4PyCoutDestination);
|
||||
def("ResetG4PyCoutDestination", ResetG4PyCoutDestination);
|
||||
|
||||
class_<G4intVector> ("G4intVector", "int vector")
|
||||
.def(vector_indexing_suite<G4intVector>())
|
||||
;
|
||||
|
||||
class_<G4doubleVector> ("G4doubleVector", "double vector")
|
||||
.def(vector_indexing_suite<G4doubleVector>())
|
||||
;
|
||||
|
||||
class_<G4StringVector> ("G4StringVector", "string vector")
|
||||
.def(vector_indexing_suite<G4StringVector>())
|
||||
;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pymodG4global.cc,v 1.4 2006/06/29 15:33:51 gunter Exp $
|
||||
// $Name: geant4-08-01 $
|
||||
// ====================================================================
|
||||
// pymodG4global.cc [Geant4Py module]
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
|
||||
void export_globals();
|
||||
void export_geomdefs();
|
||||
void export_G4StateManager();
|
||||
void export_G4ApplicationState();
|
||||
void export_G4String();
|
||||
void export_G4ThreeVector();
|
||||
void export_G4RotationMatrix();
|
||||
void export_G4Transform3D();
|
||||
void export_G4UnitsTable();
|
||||
void export_Randomize();
|
||||
void export_RandomEngines();
|
||||
void export_G4RandomDirection();
|
||||
void export_G4UserLimits();
|
||||
void export_G4Timer();
|
||||
|
||||
BOOST_PYTHON_MODULE(G4global)
|
||||
{
|
||||
export_globals();
|
||||
export_geomdefs();
|
||||
export_G4StateManager();
|
||||
export_G4ApplicationState();
|
||||
export_G4String();
|
||||
export_G4ThreeVector();
|
||||
export_G4RotationMatrix();
|
||||
export_G4Transform3D();
|
||||
export_G4UnitsTable();
|
||||
export_Randomize();
|
||||
export_RandomEngines();
|
||||
export_G4RandomDirection();
|
||||
export_G4UserLimits();
|
||||
export_G4Timer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user