10 from ROOT
import gSystem
13 gSystem.Load(
'libDataQualityUtils')
14 from ROOT
import dqutils
16 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)
18 from DataQualityUtils.hancool_histo_foldermap
import folderMapHisto
47 if (name.find(
'minutes10_') > -1):
48 t = name.split(
'minutes10_')
50 low_limit =
int((digit-1.0)*10.0/LBlength+1)-1
51 hi_limit =
int(digit*10.0/LBlength)
52 elif (name.find(
'minutes30_') > -1):
53 t = name.split(
'minutes30_')
55 low_limit =
int((digit-1.0)*30.0/LBlength+1)-1
56 hi_limit =
int(digit*30.0/LBlength)
60 return {
"since": low_limit,
"until": hi_limit}
65 rootFolder = file+
":"+rootFolder
67 result = of.getStringName(rootFolder)
72 rootFolder = file+
":"+rootFolder
74 info = of.getInfo(rootFolder)
82 the_result_histo =
"Undefined"
88 if line.find(
'run') > -1:
89 gg = line.split(
':')[1]
92 if res.find(channel) > -1:
93 the_result_histo = res
95 return the_result_histo
100 resultstrH = of.stringAllHistograms()
106 resultstr = of.stringAllDQAssessments()
112 resultstr = of.stringHistoAssessments()
113 g =
open(
'Allhisto.list',
'w')
119 t = channel.split(
'/')
121 histo_name = channel.split(
'/')[N]
126 t = channel.split(
'/')
128 list_name = channel.split(
'/')[0:N]
129 path_name =
'/'.
join(list_name)
137 def hancool_histo(inputFilePath="", input_run=-1, dbConnectionHisto="", dqmfOflHisto="", dbTagName=""):
139 if (input_run == -1):
142 if (len(inputFilePath) < 1):
143 inputFilePath =
"/afs/cern.ch/user/a/atlasdqm/dqmdisk1/han_results/tier0/FDR2b/1/physics_Express/"
144 if (inputFilePath.rfind(
"/") != (len(inputFilePath)-1)):
146 if (len(dbConnectionHisto) < 1):
147 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"
149 if (len(dqmfOflHisto) < 1):
150 dqmfOflHisto =
"/GLOBAL/DETSTATUS/DQMFOFLH"
151 if (len(dbTagName) < 1):
152 dbTagName =
"DetStatusDQMFOFLH-FDR2-02"
156 dbConnectionHisto, dqmfOflHisto, 0, 0, 0, 0)
159 filename =
"run_"+
str(run)+
"_han.root"
162 for pair
in folderMapHisto.items():
165 print(pair[0], pair[1])
170 while ((os.path.isfile(path+filename))
and (i < 2)):
171 while os.path.isfile(path+filename):
172 if (
getLimits(filename)[
"until"] == 4294967295):
173 modH.setIOV(run,
getLimits(filename)[
"since"],
176 xml =
'Allhisto.list'
178 print(the_result_histo)
180 if (the_result_histo ==
"Undefined"):
182 print(
" This histogram DOES NOT have a corresponding channel in the DB! ")
183 print(
" Info cannot be inserted ")
186 histo_nameonly = the_result_histo.split(
187 '/')[
int(len(the_result_histo.split(
'/')))-1]
188 print(histo_nameonly)
190 path+filename, pair[0]+
"_/Results/Status")
193 path+filename, pair[0]+
"_/Config/name")
196 path+filename, path_string, histo_string)
199 path+filename, pair[0]+
"_/Results")
208 if (algo.find(
'Bins_Diff_FromAvg') > -1
and mean_rms.find(
'null') < 0):
211 elif (algo.find(
'GatherData') > -1
and mean_rms.find(
'null') < 0):
212 if (mean_rms.find(
'Error') > -1):
220 elif (algo.find(
'Simple_pol1_Fit') > -1
and mean_rms.find(
'null') < 0):
223 elif (algo.find(
'Simple_gaus_Fit') > -1
and mean_rms.find(
'null') < 0):
227 elif (algo.find(
'SideBand') > -1
and mean_rms.find(
'null') < 0):
230 elif (algo.find(
'CheckHisto_Mean') > -1
and mean_rms.find(
'null') < 0):
233 elif (algo.find(
'CheckHisto_RMS') > -1
and mean_rms.find(
'null') < 0):
236 elif (algo.find(
'Bin') > -1)
and mean_rms.find(
'null') < 0
and ((algo.find(
'Threshold') > -1)
or (algo.find(
'ContentComp') > -1)):
239 if (len(output) > 1):
251 if (algo.find(
'CheckHisto_Mean') > -1
and algo.find(
'GatherData') > -1
and mean_rms.find(
'null') < 0):
252 comb_mean_rms = mean_rms.split(
'XMean: ')
253 if (comb_mean_rms[0].
find(
'Error') > -1):
265 if (algo.find(
'BinContentComp') > -1
and algo.find(
'GatherData') > -1
and mean_rms.find(
'null') < 0):
266 if (mean_rms.find(
'Error') > -1):
270 histo_nameonly, mean_rms)
277 histo_nameonly, mean_rms)
279 codeH = codeMap[resultH]
287 modH.insertH(pair[1], codeH,
str(algo),
int(entries),
float(
289 print(
"----------- global: Insertion successfull! --------------------")
292 modH.insertH(pair[1], codeH,
str(algo),
int(
293 entries), 0, 0, 0, 0, 0, dbTagName)
294 print(
'Could not upload parameters in DB, they are not numbers! Check the algorithm!')
297 filename =
"run_" + \
298 str(run)+intervalType[i]+
str(number)+
"_han.root"
301 filename =
"run_" + \
302 str(run)+intervalType[i]+
str(number)+
"_han.root"
303 filename =
"run_"+
str(run)+
"_han.root"
304 print(
"--------------------------------------")