2 from __future__
import print_function
11 from ROOT
import gSystem
14 gSystem.Load(
'libDataQualityUtils')
15 from ROOT
import dqutils
17 from DataQualityUtils.hancool_histo_algdef
import (ExtractNEntries, ExtractAverage, ExtractNBins, ExtractMean, ExtractEMean, ExtractRMS, ExtractERMS, ExtractPol0, ExtractPol1, ExtractMeanG, ExtractRMSG, ExtractConstG, ExtractSideBands, ExtractTotInt, ExtractXMean, ExtractYMean, ExtractXRMS, ExtractYRMS, ExtractOnlyNBins)
19 from DataQualityUtils.hancool_histo_foldermap
import folderMapHisto
48 if (name.find(
'minutes10_') > -1):
49 t = name.split(
'minutes10_')
51 low_limit =
int((digit-1.0)*10.0/LBlength+1)-1
52 hi_limit =
int(digit*10.0/LBlength)
53 elif (name.find(
'minutes30_') > -1):
54 t = name.split(
'minutes30_')
56 low_limit =
int((digit-1.0)*30.0/LBlength+1)-1
57 hi_limit =
int(digit*30.0/LBlength)
61 return {
"since": low_limit,
"until": hi_limit}
66 rootFolder = file+
":"+rootFolder
68 result = of.getStringName(rootFolder)
73 rootFolder = file+
":"+rootFolder
75 info = of.getInfo(rootFolder)
83 the_result_histo =
"Undefined"
89 if line.find(
'run') > -1:
90 gg = line.split(
':')[1]
93 if res.find(channel) > -1:
94 the_result_histo = res
96 return the_result_histo
101 resultstrH = of.stringAllHistograms()
107 resultstr = of.stringAllDQAssessments()
113 resultstr = of.stringHistoAssessments()
114 g =
open(
'Allhisto.list',
'w')
120 t = channel.split(
'/')
122 histo_name = channel.split(
'/')[N]
127 t = channel.split(
'/')
129 list_name = channel.split(
'/')[0:N]
130 path_name =
'/'.
join(list_name)
138 def hancool_histo(inputFilePath="", input_run=-1, dbConnectionHisto="", dqmfOflHisto="", dbTagName=""):
140 if (input_run == -1):
143 if (len(inputFilePath) < 1):
144 inputFilePath =
"/afs/cern.ch/user/a/atlasdqm/dqmdisk1/han_results/tier0/FDR2b/1/physics_Express/"
145 if (inputFilePath.rfind(
"/") != (len(inputFilePath)-1)):
147 if (len(dbConnectionHisto) < 1):
148 dbConnectionHisto =
"sqlite://;schema=/afs/cern.ch/user/a/atlasdqm/w0/users/onofrio/DQMF_08112008/14.2.10/WorkArea/python/MyCOOL_histo_FDR2c.db;dbname=OFLP200"
150 if (len(dqmfOflHisto) < 1):
151 dqmfOflHisto =
"/GLOBAL/DETSTATUS/DQMFOFLH"
152 if (len(dbTagName) < 1):
153 dbTagName =
"DetStatusDQMFOFLH-FDR2-02"
157 dbConnectionHisto, dqmfOflHisto, 0, 0, 0, 0)
160 filename =
"run_"+
str(run)+
"_han.root"
163 for pair
in folderMapHisto.items():
166 print(pair[0], pair[1])
171 while ((os.path.isfile(path+filename))
and (i < 2)):
172 while os.path.isfile(path+filename):
173 if (
getLimits(filename)[
"until"] == 4294967295):
174 modH.setIOV(run,
getLimits(filename)[
"since"],
177 xml =
'Allhisto.list'
179 print(the_result_histo)
181 if (the_result_histo ==
"Undefined"):
183 print(
" This histogram DOES NOT have a corresponding channel in the DB! ")
184 print(
" Info cannot be inserted ")
187 histo_nameonly = the_result_histo.split(
188 '/')[
int(len(the_result_histo.split(
'/')))-1]
189 print(histo_nameonly)
191 path+filename, pair[0]+
"_/Results/Status")
194 path+filename, pair[0]+
"_/Config/name")
197 path+filename, path_string, histo_string)
200 path+filename, pair[0]+
"_/Results")
209 if (algo.find(
'Bins_Diff_FromAvg') > -1
and mean_rms.find(
'null') < 0):
212 elif (algo.find(
'GatherData') > -1
and mean_rms.find(
'null') < 0):
213 if (mean_rms.find(
'Error') > -1):
221 elif (algo.find(
'Simple_pol1_Fit') > -1
and mean_rms.find(
'null') < 0):
224 elif (algo.find(
'Simple_gaus_Fit') > -1
and mean_rms.find(
'null') < 0):
228 elif (algo.find(
'SideBand') > -1
and mean_rms.find(
'null') < 0):
231 elif (algo.find(
'CheckHisto_Mean') > -1
and mean_rms.find(
'null') < 0):
234 elif (algo.find(
'CheckHisto_RMS') > -1
and mean_rms.find(
'null') < 0):
237 elif (algo.find(
'Bin') > -1)
and mean_rms.find(
'null') < 0
and ((algo.find(
'Threshold') > -1)
or (algo.find(
'ContentComp') > -1)):
240 if (len(output) > 1):
252 if (algo.find(
'CheckHisto_Mean') > -1
and algo.find(
'GatherData') > -1
and mean_rms.find(
'null') < 0):
253 comb_mean_rms = mean_rms.split(
'XMean: ')
254 if (comb_mean_rms[0].
find(
'Error') > -1):
266 if (algo.find(
'BinContentComp') > -1
and algo.find(
'GatherData') > -1
and mean_rms.find(
'null') < 0):
267 if (mean_rms.find(
'Error') > -1):
271 histo_nameonly, mean_rms)
278 histo_nameonly, mean_rms)
280 codeH = codeMap[resultH]
288 modH.insertH(pair[1], codeH,
str(algo),
int(entries),
float(
290 print(
"----------- global: Insertion successfull! --------------------")
293 modH.insertH(pair[1], codeH,
str(algo),
int(
294 entries), 0, 0, 0, 0, 0, dbTagName)
295 print(
'Could not upload parameters in DB, they are not numbers! Check the algorithm!')
298 filename =
"run_" + \
299 str(run)+intervalType[i]+
str(number)+
"_han.root"
302 filename =
"run_" + \
303 str(run)+intervalType[i]+
str(number)+
"_han.root"
304 filename =
"run_"+
str(run)+
"_han.root"
305 print(
"--------------------------------------")