136 def getCalibDBParams(flags, finder, mainparam, input, onlyCellWeight=False, isMC=False):
137 """ Retrieves calibration DB parameters from jet finder specs, returns a triplet (key,folder,tag)
138 """
139
140 input = input.replace('H1','')
141 param = editParm(mainparam)
142 if param == '7':
143 param = ''
144
145 caldict = H1Calibration.calibration_dict(flags)
146
147 calibtype = finder+param+input
148
149 if calibtype in caldict:
150 key = 'H1Weights' + calibtype
151 tag = caldict[calibtype]
152 if isMC:
153 folder = '/CALO/Ofl/'
154 tag = "CALOOfl"+tag[4:]
155 else:
156 folder = '/CALO/'
157 folder += 'H1Weights/' + key
158 key = folder
159 return (key,folder,tag)
160
161 else:
162 if onlyCellWeight:
163
164
165 if 'Topo' in input: return H1Calibration.getCalibDBParams(flags,'Cone',0.4,'H1Topo',onlyCellWeight,isMC)
166 else: return H1Calibration.getCalibDBParams(flags,'Cone',0.4,'H1Tower',onlyCellWeight,isMC)
167
168 _logger.warning("getCalibDBParams: no dedicated calibration for %s %s %s", finder,mainparam,input)
169 if finder not in [ 'Kt', 'Cone' ] : finder = 'Cone'
170 if input not in [ 'Topo', 'Tower' ] : input = 'Tower'
171 if finder == 'Kt' : l = [ 0.4, 0.6 ]
172 else: l = [ 0.4, 0.7 ]
173 (m,mainparam) =
min( [ (abs(p-mainparam),p)
for p
in l ] )
174 _logger.warning("getCalibDBParams: defaulted calibration to %s %s %s", finder,mainparam,input)
175 return H1Calibration.getCalibDBParams(flags,finder,mainparam,input,onlyCellWeight,isMC)
176