1#include <boost/python.hpp>
16 "field module enables user to get the field at a point";
19 "Get the field value at a point in the field map.\n"
21 "The field lookup is performed against the last RINGDEFINITION that was\n"
22 "instantiated. This should be instantiated by calling\n"
23 "pyopal.parser.initialise_from_opal_file\n"
38 "The function returns a tuple containing 7 values:\n"
39 "out of bounds : int\n"
40 " 1 if the event was out of the field map boundary, else 0.\n"
42 " x magnetic field [T]\n"
44 " y magnetic field [T]\n"
46 " z magnetic field [T]\n"
52 " z electric field\n";
59 if (tracker == NULL) {
61 "ParallelCyclotronTracker was NULL"));
66 boost::python::tuple value = boost::python::make_tuple(outOfBounds,
67 B[0], B[1], B[2], E[0], E[1], E[2]);
81 if (trackerCycl !=
nullptr) {
85 "Could not find a ParallelCyclotronTracker"));
91 py::def(
"get_field_value",
93 py::args(
"x",
"y",
"z",
"t"),
void registerExceptions()
py::object get_field_value_cyclotron(double x, double y, double z, double t, ParallelCyclotronTracker *tracker)
BOOST_PYTHON_MODULE(field)
std::string field_docstring
py::object get_field_value(double x, double y, double z, double t)
std::string get_field_value_docstring
bool computeExternalFields_m(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &Efield, Vector_t &Bfield)
Calculate the field map at an arbitrary point.
static std::shared_ptr< Tracker > getTracker()
The base class for all OPAL exceptions.