11 from TileCalibBlobPython
import TileCalibTools
12 from TileCalibBlobObjs.Classes
import TileCalibUtils
16 from TileCalibBlobPython.TileCalibLogger
import getLogger
19 log.setLevel(logging.DEBUG)
24 until=(TileCalibTools.MAXRUN, TileCalibTools.MAXLBK)):
27 folderTclas = TileCalibTools.getTilePrefix(
True,
True)+
"TIME/CHANNELOFFSET/LAS"
31 default = cppyy.gbl.std.vector(
'float')()
37 tclasWriter = TileCalibTools.TileBlobWriter(db,folderTclas,
'Flt')
38 tclasWriter.setComment(os.getlogin(),fileTclas)
39 parserTclas = TileCalibTools.TileASCIIParser(fileTclas,
"Tclas")
40 defTclas = cppyy.gbl.std.vector(
'std::vector<float>')()
41 defTclas.push_back(default)
42 defTclas.push_back(default)
46 flt = tclasWriter.zeroBlob(ros,mod)
47 flt = tclasWriter.getDrawer(0, 0)
48 flt.init(defTclas,1,0)
50 for ros
in range(1,5):
53 tclasWriter.zeroBlob(ros,mod)
55 tclas = parserTclas.getData(ros,mod,chn)
57 log.warning(
"%i/%2i/%2i/x: No value found in file", ros,mod,chn)
60 calibDrawer = tclasWriter.getDrawer(ros,mod)
61 if not calibDrawer.getNObjs():
62 log.info(
"Initializing drawer %i/%2i\t%i", ros,mod,calibDrawer.getNObjs())
63 calibDrawer.init(defTclas,48,0)
66 val =
float(tclas[adc])
67 log.debug(
"%i/%2i/%2i/%i: tclas = %f", ros,mod,chn,adc, val)
68 calibDrawer.setData(chn,adc,0,val)
71 tclasWriter.setComment(os.getlogin(),
"Timing update for all partitions")
72 tclasWriter.register(since, until, folderTag)
78 until=(TileCalibTools.MAXRUN, TileCalibTools.MAXLBK)):
81 folderTdlas = TileCalibTools.getTilePrefix(
True,
True)+
"TIME/DRAWEROFFSET/LAS"
85 default = cppyy.gbl.std.vector(
'float')()
91 tdlasWriter = TileCalibTools.TileBlobWriter(db,folderTdlas,
'Flt')
92 tdlasWriter.setComment(os.getlogin(),fileTdlas)
93 parserTdlas = TileCalibTools.TileASCIIParser(fileTdlas,
"Tdlas")
94 defTdlas = cppyy.gbl.std.vector(
'std::vector<float>')()
95 defTdlas.push_back(default)
99 flt = tdlasWriter.zeroBlob(ros,mod)
100 flt = tdlasWriter.getDrawer(0, 0)
101 flt.init(defTdlas,1,0)
103 for ros
in range(1,5):
104 for mod
in range(64):
106 tdlasWriter.zeroBlob(ros,mod)
107 tdlas = parserTdlas.getData(ros,mod,0)
109 log.warning(
"(ros,mod)=(%i,%2i): No value found in file", ros,mod)
111 defTdlas[0][0] =
float(tdlas[0])
112 log.debug(
"(ros,mod)=(%i,%2i): tdlas = %f", ros,mod,defTdlas[0][0])
113 calibDrawer = tdlasWriter.getDrawer(ros,mod)
114 calibDrawer.init(defTdlas,1,0)
117 tdlasWriter.setComment(os.getlogin(),
"Timing update for all partitions")
118 tdlasWriter.register(since, until, folderTag)
133 db = TileCalibTools.openDb(
'SQLITE',
'CONDBR2',
'UPDATE')
135 tag =
"RUN2-HLT-UPD1-00"
136 for directory
in sorted(timingDict.keys()):
137 since = timingDict[directory]
138 fileTclas = directory+
"/Tile.tclas"