Belle II Software  release-08-01-10
SVDDefaultDetectorConfigurationImporter.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
11 """
12 SVD Default Detecotr Configuration importer.
13 """
14 
15 import basf2 as b2
16 from ROOT import Belle2
17 from basf2 import conditions as b2conditions
18 import datetime
19 
20 now = datetime.datetime.now()
21 
22 # default values
23 # local config
24 calibrationTimeUnits = '2' # in RFC units, it is a string as the xml field where it is written
25 calibDate = '20190314'
26 injCharge = 22500
27 
28 # global config
29 latency = 158
30 maskFilter = 7
31 zeroSuppress = 3
32 apvClockTimeUnits = '16' # in RFC units, it is a string as the xml field where it is written
33 hv = 50
34 relativeShift = 0
35 nrFrames = 6
36 
37 
39  '''default importer for the detector configuration'''
40 
41  def beginRun(self):
42  '''begin run'''
43 
45 
46  local_payload = Belle2.SVDLocalConfigParameters(
47  "LocalConfiguration_default_" + str(now.isoformat()) +
48  "_INFO:_injCharge=" + str(injCharge) + "_calTimeUnits=" + str(calibrationTimeUnits))
49 
50  global_payload = Belle2.SVDGlobalConfigParameters(
51  "GlobalConfiguration_default_" + str(now.isoformat()) +
52  "_INFO:_latency=" + str(latency) +
53  "_maskFilter=" + str(maskFilter) + "_ZS=" + str(zeroSuppress) +
54  "_apvClkUnits=" + str(apvClockTimeUnits))
55 
56  local_payload.setCalibrationTimeInRFCUnits(calibrationTimeUnits)
57  local_payload.setCalibDate(calibDate)
58  local_payload.setInjectedCharge(injCharge)
59  global_payload.setLatency(latency)
60  global_payload.setZeroSuppression(zeroSuppress)
61  global_payload.setMaskFilter(maskFilter)
62  global_payload.setAPVClockInRFCUnits(apvClockTimeUnits)
63  global_payload.setHV(hv)
64  global_payload.setRelativeTimeShift(relativeShift)
65  global_payload.setNrFrames(nrFrames)
66 
67  Belle2.Database.Instance().storeData("SVDLocalConfigParameters", local_payload, iov)
68  Belle2.Database.Instance().storeData("SVDGlobalConfigParameters", global_payload, iov)
69 
70 
71 b2conditions.prepend_globaltag("svd_onlySVDinGeoConfiguration")
72 
73 main = b2.create_path()
74 
75 # Event info setter - execute single event
76 eventinfosetter = b2.register_module('EventInfoSetter')
77 eventinfosetter.param({'evtNumList': [1], 'expList': 0, 'runList': 0})
78 main.add_module(eventinfosetter)
79 
80 main.add_module("Gearbox")
81 main.add_module("Geometry")
82 
83 main.add_module(defaultSVDConfigParametersImporter())
84 
85 # Show progress of processing
86 progress = b2.register_module('Progress')
87 main.add_module(progress)
88 
89 # Process events
90 b2.process(main)
static IntervalOfValidity always()
Function that returns an interval of validity that is always valid, c.f.
This class defines the payload which stores to the central DB the SVD global configuring parameters,...
This class defines the payload which stores to the central DB the SVD local configuring parameters,...
static Database & Instance()
Instance of a singleton Database.
Definition: Database.cc:42