Belle II Software
release-05-01-25
create_magneticfield_payloads_constant.py
1
#!/usr/bin/env python3
2
3
import
math
4
from
ROOT
import
Belle2
5
6
if
__name__ ==
"__main__"
:
7
# parameters for the field
8
b_field = (0, 0, 0)
9
range_r = (0, math.inf)
10
range_z = (-math.inf, math.inf)
11
12
# and for the payload
13
iov =
Belle2.IntervalOfValidity.always
()
14
# iov = Belle2.IntervalOfValidity(5,0,-1,-1)
15
16
# create field map instance
17
field =
Belle2.MagneticField
()
18
# and if we have a non-zero field, add it as component
19
if
max(abs(e)
for
e
in
b_field) > 0:
20
field_vector =
Belle2.B2Vector3D
(*(e * Belle2.Unit.T
for
e
in
b_field))
21
field.addComponent(
Belle2.MagneticFieldComponentConstant
(field_vector, *range_r, *range_z))
22
23
# and save in localdb/, ready for upload
24
Belle2.Database.Instance
().storeData(
"MagneticField"
, field, iov)
Belle2::IntervalOfValidity::always
static IntervalOfValidity always()
Function that returns an interval of validity that is always valid, c.f.
Definition:
IntervalOfValidity.h:72
Belle2::B2Vector3< double >
Belle2::MagneticField
Magnetic field map.
Definition:
MagneticField.h:43
Belle2::Database::Instance
static Database & Instance()
Instance of a singleton Database.
Definition:
Database.cc:54
Belle2::MagneticFieldComponentConstant
Describe one component of the Geometry.
Definition:
MagneticFieldComponentConstant.h:29
geometry
examples
create_magneticfield_payloads_constant.py
Generated on Fri Nov 5 2021 03:54:27 for Belle II Software by
1.8.17