ATLAS Offline Software
Loading...
Searching...
No Matches
python.hancool_histo_mod Namespace Reference

Functions

 getLimits (name)
 stringGetResult (file, rootFolder)
 stringGetInfo (file, rootFolder)
 ListHistoAssessments (xml, channel)
 AllHistograms (file)
 AllDQAssessments (file)
 MakeHistoAssessmentsFile (file)
 NameHisto_Splitting (channel)
 NamePath_Splitting (channel)
 hancool_histo (inputFilePath="", input_run=-1, dbConnectionHisto="", dqmfOflHisto="", dbTagName="")

Variables

 CWD = os.getcwd()
float LBlength = 1.0
dict codeMap
dict intervalType

Function Documentation

◆ AllDQAssessments()

python.hancool_histo_mod.AllDQAssessments ( file)

Definition at line 104 of file hancool_histo_mod.py.

104def AllDQAssessments(file):
105 of = dqutils.HanOutputFile(file)
106 resultstr = of.stringAllDQAssessments()
107 return resultstr
108
109

◆ AllHistograms()

python.hancool_histo_mod.AllHistograms ( file)

Definition at line 98 of file hancool_histo_mod.py.

98def AllHistograms(file):
99 of = dqutils.HanOutputFile(file)
100 resultstrH = of.stringAllHistograms()
101 return resultstrH
102
103

◆ getLimits()

python.hancool_histo_mod.getLimits ( name)

Definition at line 44 of file hancool_histo_mod.py.

44def getLimits(name):
45 global low_limit
46 global hi_limit
47 if (name.find('minutes10_') > -1):
48 t = name.split('minutes10_')
49 digit = float(((t[len(t)-1]).split('_'))[0])
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_')
54 digit = float(((t[len(t)-1]).split('_'))[0])
55 low_limit = int((digit-1.0)*30.0/LBlength+1)-1
56 hi_limit = int(digit*30.0/LBlength)
57 else:
58 low_limit = 0
59 hi_limit = 4294967295
60 return {"since": low_limit, "until": hi_limit}
61
62
63# Looks up the result in the HanOutputFile
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177

◆ hancool_histo()

python.hancool_histo_mod.hancool_histo ( inputFilePath = "",
input_run = -1,
dbConnectionHisto = "",
dqmfOflHisto = "",
dbTagName = "" )

Definition at line 137 of file hancool_histo_mod.py.

137def hancool_histo(inputFilePath="", input_run=-1, dbConnectionHisto="", dqmfOflHisto="", dbTagName=""):
138
139 if (input_run == -1):
140 input_run = 52280
141
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)):
145 inputFilePath += "/"
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"
148
149 if (len(dqmfOflHisto) < 1):
150 dqmfOflHisto = "/GLOBAL/DETSTATUS/DQMFOFLH"
151 if (len(dbTagName) < 1):
152 dbTagName = "DetStatusDQMFOFLH-FDR2-02"
153
154 # pdb.set_trace()
156 dbConnectionHisto, dqmfOflHisto, 0, 0, 0, 0)
157 path = inputFilePath
158 run = int(input_run)
159 filename = "run_"+str(run)+"_han.root"
160
161 # filling OFLH DB for histos (global run)
162 for pair in folderMapHisto.items():
163 i = 0
164 number = 0
165 print(pair[0], pair[1])
166 # print("--------------------------------------")
167 histo_string = NameHisto_Splitting(pair[0])
168 path_string = NamePath_Splitting(pair[0])
169 # print("--------------------------------------")
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"],
174 run, getLimits(filename)["until"])
175 MakeHistoAssessmentsFile(path+filename)
176 xml = 'Allhisto.list'
177 the_result_histo = ListHistoAssessments(xml, pair[0])
178 print(the_result_histo)
179
180 if (the_result_histo == "Undefined"):
181
182 print(" This histogram DOES NOT have a corresponding channel in the DB! ")
183 print(" Info cannot be inserted ")
184
185 else:
186 histo_nameonly = the_result_histo.split(
187 '/')[int(len(the_result_histo.split('/')))-1]
188 print(histo_nameonly)
189 resultH = stringGetResult(
190 path+filename, pair[0]+"_/Results/Status")
191 print(resultH)
192 algo = stringGetResult(
193 path+filename, pair[0]+"_/Config/name")
194 print(algo)
195 entries = ExtractNEntries(
196 path+filename, path_string, histo_string)
197 print(entries)
198 mean_rms = stringGetInfo(
199 path+filename, pair[0]+"_/Results")
200 print(mean_rms)
201
202 par1 = '0'
203 par2 = '0'
204 par3 = '0'
205 par4 = '0'
206 par5 = '0'
207
208 if (algo.find('Bins_Diff_FromAvg') > -1 and mean_rms.find('null') < 0):
209 par1 = ExtractAverage(mean_rms)
210 par2 = ExtractNBins(mean_rms)
211 elif (algo.find('GatherData') > -1 and mean_rms.find('null') < 0):
212 if (mean_rms.find('Error') > -1): # new GatherData
213 par1 = ExtractMean(mean_rms)
214 par2 = ExtractEMean(mean_rms)
215 par3 = ExtractRMS(mean_rms)
216 par4 = ExtractERMS(mean_rms)
217 else: # old GatherData
218 par1 = ExtractMean(mean_rms)
219 par2 = ExtractRMS(mean_rms)
220 elif (algo.find('Simple_pol1_Fit') > -1 and mean_rms.find('null') < 0):
221 par1 = ExtractPol0(mean_rms)
222 par2 = ExtractPol1(mean_rms)
223 elif (algo.find('Simple_gaus_Fit') > -1 and mean_rms.find('null') < 0):
224 par1 = ExtractMeanG(mean_rms)
225 par2 = ExtractRMSG(mean_rms)
226 par3 = ExtractConstG(mean_rms)
227 elif (algo.find('SideBand') > -1 and mean_rms.find('null') < 0):
228 par1 = ExtractSideBands(mean_rms)
229 par2 = ExtractTotInt(mean_rms)
230 elif (algo.find('CheckHisto_Mean') > -1 and mean_rms.find('null') < 0):
231 par1 = ExtractXMean(mean_rms)
232 par2 = ExtractYMean(mean_rms)
233 elif (algo.find('CheckHisto_RMS') > -1 and mean_rms.find('null') < 0):
234 par1 = ExtractXRMS(mean_rms)
235 par2 = ExtractYRMS(mean_rms)
236 elif (algo.find('Bin') > -1) and mean_rms.find('null') < 0 and ((algo.find('Threshold') > -1) or (algo.find('ContentComp') > -1)):
237 output = ExtractOnlyNBins(histo_nameonly, mean_rms)
238 par1 = output[0]
239 if (len(output) > 1):
240 par2 = output[1]
241 par3 = output[2]
242 par4 = output[3]
243 par5 = output[4]
244 else:
245 par2 = '0'
246 else:
247 par1 = '0'
248 par2 = '0'
249# combined algorithms:
250 # CheckHisto_Mean&GatherData
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): # new GatherData
254 par1 = ExtractMean(comb_mean_rms[0])
255 par2 = ExtractEMean(comb_mean_rms[0])
256 par3 = ExtractRMS(comb_mean_rms[0])
257 par4 = ExtractERMS(comb_mean_rms[0])
258 par5 = ExtractXMean(comb_mean_rms[1])
259 else: # old GatherData
260 par1 = ExtractMean(comb_mean_rms[0])
261 par2 = ExtractRMS(comb_mean_rms[0])
262 par3 = ExtractXMean(comb_mean_rms[1])
263 par4 = ExtractYMean(comb_mean_rms[1])
264 # BinContentComp&GatherData
265 if (algo.find('BinContentComp') > -1 and algo.find('GatherData') > -1 and mean_rms.find('null') < 0):
266 if (mean_rms.find('Error') > -1): # new GatherData
267 par1 = ExtractMean(mean_rms)
268 par2 = ExtractEMean(mean_rms)
269 par3 = ExtractOnlyNBins(
270 histo_nameonly, mean_rms)
271 par4 = ExtractRMS(mean_rms)
272 par5 = ExtractERMS(mean_rms)
273 else: # old GatherData
274 par1 = ExtractMean(mean_rms)
275 par2 = ExtractRMS(mean_rms)
276 par3 = ExtractOnlyNBins(
277 histo_nameonly, mean_rms)
278
279 codeH = codeMap[resultH]
280
281 try:
282 float(par1)
283 float(par2)
284 float(par3)
285 float(par4)
286 float(par5)
287 modH.insertH(pair[1], codeH, str(algo), int(entries), float(
288 par1), float(par2), float(par3), float(par4), float(par5), dbTagName)
289 print("----------- global: Insertion successfull! --------------------")
290 print(dbTagName)
291 except Exception:
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!')
295
296 number = number+1
297 filename = "run_" + \
298 str(run)+intervalType[i]+str(number)+"_han.root"
299 number = 1
300 i = i+1
301 filename = "run_" + \
302 str(run)+intervalType[i]+str(number)+"_han.root"
303 filename = "run_"+str(run)+"_han.root"
304 print("--------------------------------------")
void print(char *figname, TCanvas *c1)
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138

◆ ListHistoAssessments()

python.hancool_histo_mod.ListHistoAssessments ( xml,
channel )

Definition at line 81 of file hancool_histo_mod.py.

81def ListHistoAssessments(xml, channel):
82 the_result_histo = "Undefined"
83 g = open(xml, 'r')
84 while True:
85 line = g.readline()
86 if not line:
87 break
88 if line.find('run') > -1:
89 gg = line.split(':')[1]
90 ww = gg.split(' ')
91 res = ''.join(ww)
92 if res.find(channel) > -1:
93 the_result_histo = res
94 g.close()
95 return the_result_histo
96
97

◆ MakeHistoAssessmentsFile()

python.hancool_histo_mod.MakeHistoAssessmentsFile ( file)

Definition at line 110 of file hancool_histo_mod.py.

110def MakeHistoAssessmentsFile(file):
111 of = dqutils.HanOutputFile(file)
112 resultstr = of.stringHistoAssessments()
113 g = open('Allhisto.list', 'w')
114 g.write(resultstr)
115 g.close()
116
117

◆ NameHisto_Splitting()

python.hancool_histo_mod.NameHisto_Splitting ( channel)

Definition at line 118 of file hancool_histo_mod.py.

118def NameHisto_Splitting(channel):
119 t = channel.split('/')
120 N = int(len(t)-1)
121 histo_name = channel.split('/')[N]
122 return histo_name
123
124

◆ NamePath_Splitting()

python.hancool_histo_mod.NamePath_Splitting ( channel)

Definition at line 125 of file hancool_histo_mod.py.

125def NamePath_Splitting(channel):
126 t = channel.split('/')
127 N = int(len(t)-1)
128 list_name = channel.split('/')[0:N]
129 path_name = '/'.join(list_name)
130 return path_name
131
132# -------------------------------------------------------------
133# hancool_histo()
134# -------------------------------------------------------------
135
136

◆ stringGetInfo()

python.hancool_histo_mod.stringGetInfo ( file,
rootFolder )

Definition at line 71 of file hancool_histo_mod.py.

71def stringGetInfo(file, rootFolder):
72 rootFolder = file+":"+rootFolder
73 of = dqutils.HanOutputFile(file)
74 info = of.getInfo(rootFolder)
75 if (len(info) > 0):
76 return info
77 else:
78 return 'null result'
79
80

◆ stringGetResult()

python.hancool_histo_mod.stringGetResult ( file,
rootFolder )

Definition at line 64 of file hancool_histo_mod.py.

64def stringGetResult(file, rootFolder):
65 rootFolder = file+":"+rootFolder
66 of = dqutils.HanOutputFile(file)
67 result = of.getStringName(rootFolder)
68 return result
69
70

Variable Documentation

◆ codeMap

dict python.hancool_histo_mod.codeMap
Initial value:
1= {
2 "Undefined": 0,
3 "Red": 1,
4 "Yellow": 2,
5 "Green": 3
6}

Definition at line 27 of file hancool_histo_mod.py.

◆ CWD

python.hancool_histo_mod.CWD = os.getcwd()

Definition at line 6 of file hancool_histo_mod.py.

◆ intervalType

dict python.hancool_histo_mod.intervalType
Initial value:
1= {
2 0: "_minutes30_",
3 1: "_minutes10_",
4 2: "ERROR"
5}

Definition at line 35 of file hancool_histo_mod.py.

◆ LBlength

float python.hancool_histo_mod.LBlength = 1.0

Definition at line 24 of file hancool_histo_mod.py.