24 def fillPed(filePed, tag, comment, since,
25 until=(TileCalibTools.MAXRUN, TileCalibTools.MAXLBK)):
28 folder = TileCalibTools.getTilePrefix(
True,
True)+
"NOISE/SAMPLE"
37 defaultLo = cppyy.gbl.std.vector(
'float')()
38 defaultLo.push_back(pedDef[0])
39 defaultLo.push_back(loGainDef)
40 defaultLo.push_back(0.0)
41 defaultLo.push_back(loGainDef)
42 defaultLo.push_back(0.0)
43 defaultLo.push_back(0.0)
44 defaultHi = cppyy.gbl.std.vector(
'float')()
45 defaultHi.push_back(pedDef[1])
46 defaultHi.push_back(hiGainDef)
47 defaultHi.push_back(0.0)
48 defaultHi.push_back(hiGainDef)
49 defaultHi.push_back(0.0)
50 defaultHi.push_back(0.0)
51 defVec = cppyy.gbl.std.vector(
'std::vector<float>')()
52 defVec.push_back(defaultLo)
53 defVec.push_back(defaultHi)
58 writer = TileCalibTools.TileBlobWriter(db,folder,
'Flt')
59 writer.setComment(os.getlogin(),comment)
60 parser = TileCalibTools.TileASCIIParser2(filePed,
"")
62 for ros
in range(0,5):
66 writer.zeroBlob(ros,mod)
68 calibDrawer = writer.getDrawer(ros,mod)
69 if not calibDrawer.getNObjs():
70 log.info(
"Initializing drawer %i/%2i\t%i", ros,mod,calibDrawer.getNObjs())
71 calibDrawer.init(defVec,48,0)
75 calibDrawer.setData(chn,adc,0,pedDef[adc]+(chn+1)/48.)
76 values = parser.getData(ros,mod,chn,adc)
78 log.warning(
"%i/%2i/%2i/%i: No value found in file", ros,mod,chn,adc)
79 values = parser.getData(0,ros*4,chn,adc)
81 log.warning(
"No default per partition available")
82 values = parser.getData(0,0,chn,adc)
84 log.warning(
"No global default available - give up")
87 log.warning(
"Using global default")
89 log.warning(
"Using default per partition")
91 lvl =
float(values[0])
92 hfn =
float(values[1])
93 lfn =
float(values[2])
94 hfn1=
float(values[3])
95 hfn2=
float(values[4])
96 norm=
float(values[5])
97 log.debug(
"%i/%2i/%2i/%i: pedLvl=%f\thfn=%f\tlfn=%f\thfn1=%f\thfn2=%f\tnorm=%f", ros,mod,chn,adc, lvl,hfn,lfn,hfn1,hfn2,norm)
98 calibDrawer.setData(chn,adc,0,lvl)
99 calibDrawer.setData(chn,adc,1,hfn)
100 calibDrawer.setData(chn,adc,2,lfn)
101 calibDrawer.setData(chn,adc,3,hfn1)
102 calibDrawer.setData(chn,adc,4,hfn2)
103 calibDrawer.setData(chn,adc,5,norm)
105 writer.register(since, until, folderTag)