Belle II Software light-2406-ragdoll
create_magneticfield_payloads_constant.py
1#!/usr/bin/env python3
2
3
10
11import math
12from ROOT import Belle2
13
14if __name__ == "__main__":
15 # parameters for the field
16 b_field = (0, 0, 0)
17 range_r = (0, math.inf)
18 range_z = (-math.inf, math.inf)
19
20 # and for the payload
22 # iov = Belle2.IntervalOfValidity(5,0,-1,-1)
23
24 # create field map instance
25 field = Belle2.MagneticField()
26 # and if we have a non-zero field, add it as component
27 if max(abs(e) for e in b_field) > 0:
28 field_vector = Belle2.B2Vector3D(*(e * Belle2.Unit.T for e in b_field))
29 field.addComponent(Belle2.MagneticFieldComponentConstant(field_vector, *range_r, *range_z))
30
31 # and save in localdb/, ready for upload
32 Belle2.Database.Instance().storeData("MagneticField", field, iov)
static IntervalOfValidity always()
Function that returns an interval of validity that is always valid, c.f.
Describe one component of the Geometry.
Magnetic field map.
Definition: MagneticField.h:32
static Database & Instance()
Instance of a singleton Database.
Definition: Database.cc:42