Belle II Software development
writeTTDOffsetsToDB.py
1#!/usr/bin/env python3
2
3
10
11from ROOT import Belle2
12
13
14def writeTTDOffsetsToDB(iovList=(0, 0, 0, 0), injectionDelay=(0, 0), triggeredBunchOffset=(0, 0)):
15 """
16 run this script to create db file storing the payload information of the TTDOffsets
17 see `mdst/dbobjects/include/TTDOffsets.h` for definition of the parameters
18 Parameters `injectionDelay` and `triggeredBunchOffset` are tuples for (HER, LER)
19 """
20
21 # just a few small sanity checks, e.g. iovList=(expLow, runLow, expHigh, runHigh)
22 if len(iovList) != 4:
23 return
24 if len(injectionDelay) != 2:
25 return
26 if len(triggeredBunchOffset) != 2:
27 return
28
29 # create the iov
30 iov = Belle2.IntervalOfValidity(*iovList)
31 # and the payload object
32 dbobj = Belle2.TTDOffsets()
33 # then set the parameters it contains
34 dbobj.setInjectionDelayHER(injectionDelay[0])
35 dbobj.setInjectionDelayLER(injectionDelay[1])
36 dbobj.setTriggeredBunchOffsetHER(triggeredBunchOffset[0])
37 dbobj.setTriggeredBunchOffsetLER(triggeredBunchOffset[1])
38
39 # write db object to 'localdb/'
40 Belle2.Database.Instance().storeData("TTDOffsets", dbobj, iov)
41
42
43if __name__ == "__main__":
44 writeTTDOffsetsToDB((0, 0, -1, -1), (0, 0), (0, 0))
A class that describes the interval of experiments/runs for which an object in the database is valid.
This class contains information to correct the information obtained from the TTD (simple offsets)
Definition: TTDOffsets.h:18
static Database & Instance()
Instance of a singleton Database.
Definition: Database.cc:42