16 #include <boost/python.hpp>
31 "field module enables user to get the field at a point";
34 "Get the field value at a point in the field map.\n"
35 "Only available in Cyclotron mode.\n"
37 "The field lookup is performed against the last RINGDEFINITION that was\n"
38 "instantiated. This should be instantiated by calling\n"
39 "pyopal.parser.initialise_from_opal_file\n"
54 "The function returns a tuple containing 7 values:\n"
55 "out of bounds : int\n"
56 " 1 if the event was out of the field map boundary, else 0.\n"
58 " x magnetic field [T]\n"
60 " y magnetic field [T]\n"
62 " z magnetic field [T]\n"
68 " z electric field\n";
75 if (tracker ==
nullptr) {
77 "ParallelCyclotronTracker was nullptr"));
82 boost::python::tuple value = boost::python::make_tuple(outOfBounds,
83 B[0], B[1], B[2], E[0], E[1], E[2]);
92 if (trackerCycl !=
nullptr) {
96 "Could not find a ParallelCyclotronTracker - get_field_value only works in OPAL-CYCL mode"));
106 if (ring ==
nullptr) {
108 "Internal PyOpal error - failed to cast to a Ring object");
115 "Return a string holding the name of the i^th element [m].\n\n";
119 if (component ==
nullptr) {
121 "Internal PyOpal error - failed to cast to a Component");
127 "Return a tuple holding the start position of the element (x, y, z) [m].\n\n";
132 return boost::python::make_tuple(pos[0], pos[1], pos[2]);
136 "Return a tuple holding the end position of the element (x, y, z) [m].\n\n";
140 return boost::python::make_tuple(pos[0], pos[1], pos[2]);
144 "Return a tuple holding the vector (x, y, z) normal to the face of the\n"
145 "element start, pointing towards the element and having length 1.\n\n";
149 return boost::python::make_tuple(dir[0], dir[1], dir[2]);
153 "Return a tuple holding the vector (x, y, z) normal to the face of the\n"
154 "element end, pointing towards the next element and having length 1.\n\n";
158 return boost::python::make_tuple(dir[0], dir[1], dir[2]);
162 "Return an integer corresponding to the number of elements stored in the Ring\n"
163 "If this is 0, check that the track has been executed - the element\n"
164 "placements are done during Track setup.\n\n";
174 py::def(
"get_field_value",
176 py::args(
"x",
"y",
"z",
"t"),
179 py::def(
"get_number_of_elements",
182 py::def(
"get_element_start_position",
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.
boost::python::object getElementStartPosition(int i)
py::object get_field_value_cyclotron(double x, double y, double z, double t, ParallelCyclotronTracker *tracker)
py::object get_field_value(double x, double y, double z, double t)
item[EANGLE] Entrance edge counterclockwise This enables to obtain skew at each point along the its radius is computed such that the reference trajectory always remains in the centre of the magnet In the body of the magnet the radius is set from the LENGTH and ANGLE attributes It is then continuously changed to be proportional to the dipole field on the reference trajectory while entering the end fields This attribute is only to be set TRUE for a non zero dipole component(Default:FALSE)\item[VARSTEP] The step size(meters) used in calculating the reference trajectory for VARRARDIUS
std::string num_elements_docstring
static std::shared_ptr< Tracker > getTracker()
std::string element_name_docstring
boost::python::object getElementEndPosition(int i)
size_t getNumberOfElements()
virtual const std::string & getName() const
Get element name.
BOOST_PYTHON_MODULE(field)
Vector_t getStartPosition() const
size_t getNumberOfRingSections() const
std::string start_norm_docstring
void registerExceptions()
Vector_t getStartNormal() const
std::string get_field_value_docstring
RingSection * getSection(int i) const
The base class for all OPAL exceptions.
Component placement handler in ring geometry.
Vector_t getEndNormal() const
std::string getElementName(int i)
Component * getComponent() const
boost::python::object getElementStartNormal(int i)
std::string field_docstring
std::string start_pos_docstring
std::string end_pos_docstring
Tps< T > sec(const Tps< T > &x)
Secant.
Ring describes a ring type geometry for tracking.
Interface for a single beam element.
std::string end_norm_docstring
Vector_t getEndPosition() const
boost::python::object getElementEndNormal(int i)