Belle II Software development
eclCreateUnpackerParams.py
1#!/usr/bin/env python3
2
3
10
11import ROOT
12from ROOT import Belle2
13
14"""
15Create and fill ECLChannelMap class.
16Can be used for creating run-dependent ECLUnpacker parameters.
17"""
18
19FIRST_EXP = 12
20FIRST_RUN = 2251
21LAST_EXP = 12
22LAST_RUN = 2366
23DBOBJECT_NAME = 'ECLUnpackingParameters'
24
25
26def getValue(crate, shaper, channel):
27 """
28 Edit this function according to your current use-case.
29 If you are preparing ECLUnpackingParameters, see
30 ECLUnpackerModule::ECLUnpack for bit definitions.
31 """
32 if crate == 32 and shaper == 9:
33 return 7
34 return 0
35
36
37
38
39def main():
40 """
41 """
42 coefs_bar = []
43 coefs_fwd = []
44 coefs_bwd = []
45
46 for crate in range(1, 52 + 1):
47 if crate < 37:
48 sh_count = 12
49 elif crate < 45:
50 sh_count = 10
51 else:
52 sh_count = 8
53 for shaper in range(1, sh_count + 1):
54 for channel in range(1, 16 + 1):
55 val = getValue(crate, shaper, channel)
56 if crate < 37:
57 coefs_bar.append(val)
58 elif crate < 45:
59 coefs_fwd.append(val)
60 else:
61 coefs_bwd.append(val)
62
63 vec_bar = ROOT.std.vector('int')()
64 vec_bar += coefs_bar
65 vec_fwd = ROOT.std.vector('int')()
66 vec_fwd += coefs_fwd
67 vec_bwd = ROOT.std.vector('int')()
68 vec_bwd += coefs_bwd
69
70 coefs = Belle2.ECLChannelMap()
71 coefs.setMappingVectors(vec_bar, vec_fwd, vec_bwd)
72
74 iov = Belle2.IntervalOfValidity(FIRST_EXP, FIRST_RUN, LAST_EXP, LAST_RUN)
75 db.storeData(DBOBJECT_NAME, coefs, iov)
76
77
78if __name__ == '__main__':
79 main()
DB object to store correspondence table of type (Crate id, ShaperDSP id, Channel id) <-> (ECL CellID)
Definition: ECLChannelMap.h:51
A class that describes the interval of experiments/runs for which an object in the database is valid.
static Database & Instance()
Instance of a singleton Database.
Definition: Database.cc:42
Definition: main.py:1