ATLAS Offline Software
hancool_histo_algdef.py
Go to the documentation of this file.
1 #!/bin/env python
2 
3 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4 
5 import os
6 CWD = os.getcwd()
7 from ROOT import gSystem
8 
9 
10 gSystem.Load('libDataQualityUtils')
11 from ROOT import dqutils
12 os.chdir(CWD)
13 
14 def ExtractMean( mean_rms ):
15  global mean
16  mean=""
17  h=mean_rms.split('Mean: ')
18  if (mean_rms.find('Error')>-1):
19  m=h[1].split('MeanError: ')
20  mean=m[0]
21  elif (mean_rms.find('Error')<0):
22  m=h[1].split('RMS: ')
23  if (m[0].find('NBins')>-1):
24  n=m[0].split('NBins: ')
25  mean=n[0]
26  else:
27  mean=m[0]
28  return mean
29 
30 def ExtractEMean( mean_rms ):
31  global EMean
32  EMean=""
33  h=mean_rms.split('Mean: ')
34  if (mean_rms.find('Error')>-1):
35  m=h[1].split('MeanError: ')
36  if (mean_rms.find('NBins')>-1):
37  n=m[1].split('NBins: ')
38  elif (mean_rms.find('NBins')<0):
39  n=m[1].split('RMS: ')
40  EMean=n[0]
41  return EMean
42 
43 def ExtractRMS( mean_rms ):
44  global RMS
45  RMS=""
46  h=mean_rms.split('Mean: ')
47  if (mean_rms.find('Error')>-1):
48  m=h[1].split('MeanError: ')
49  if (mean_rms.find('NBins')>-1):
50  n=m[1].split('NBins: ')
51  j = n[1].split('RMS: ')
52  jj = j[1].split('RMSError: ')
53  elif (mean_rms.find('NBins')<0):
54  n=m[1].split('RMS: ')
55  jj=n[1].split('RMSError: ')
56  RMS=jj[0]
57  elif (mean_rms.find('Error')<0):
58  m=h[1].split('RMS: ')
59  RMS=m[1]
60  return RMS
61 
62 def ExtractERMS( mean_rms ):
63  global ERMS
64  ERMS=""
65  h=mean_rms.split('Mean: ')
66  if (mean_rms.find('Error')>-1):
67  m=h[1].split('MeanError: ')
68  if (mean_rms.find('NBins')>-1):
69  n=m[1].split('NBins: ')
70  j = n[1].split('RMS: ')
71  jj = j[1].split('RMSError: ')
72  elif (mean_rms.find('NBins')<0):
73  n=m[1].split('RMS: ')
74  jj=n[1].split('RMSError: ')
75  ERMS=jj[1]
76  return ERMS
77 
78 def ExtractAverage( mean_rms ):
79  global Average
80  h=mean_rms.split('Average: ')
81  m=h[1].split('NBins: ')
82  Average=m[0]
83  return Average
84 
85 def ExtractNBins( mean_rms ):
86  global NBins
87  h=mean_rms.split('Average: ')
88  m=h[1].split('NBins: ')
89  NBins=m[1]
90  return NBins
91 
92 # CheckHisto_RMS
93 def ExtractXRMS( mean_rms ):
94  global xrms
95  h=mean_rms.split('XRMS: ')
96  m=h[1].split('YRMS: ')
97  xrms=m[0]
98  return xrms
99 
100 def ExtractYRMS( mean_rms ):
101  global yrms
102  h=mean_rms.split('XRMS: ')
103  m=h[1].split('YRMS: ')
104  yrms=m[1]
105  return yrms
106 
107 # CheckHisto_Mean
108 def ExtractXMean( mean_rms ):
109  global xmean
110  if (mean_rms.find('XMean: ')>-1):
111  h=mean_rms.split('XMean: ')
112  m=h[1].split('YMean: ')
113  else:
114  h=mean_rms
115  m=h.split('YMean: ')
116  xmean=m[0]
117  return xmean
118 
119 def ExtractYMean( mean_rms ):
120  global ymean
121  if (mean_rms.find('XMean: ')>-1):
122  h=mean_rms.split('XMean: ')
123  m=h[1].split('YMean: ')
124  else:
125  h=mean_rms
126  m=h.split('YMean: ')
127  ymean=m[1]
128  return ymean
129 
130 # Sidebands_Absolute, Sidebands_Relative
131 def ExtractSideBands( mean_rms ):
132  global sideb
133  h=mean_rms.split('SideBands: ')
134  m=h[1].split('TotalIntegral: ')
135  sideb=m[0]
136  return sideb
137 
138 def ExtractTotInt( mean_rms ):
139  global totint
140  h=mean_rms.split('SideBands: ')
141  m=h[1].split('TotalIntegral: ')
142  totint=m[1]
143  return totint
144 
145 # simple_pol1_fit
146 def ExtractPol0( mean_rms ):
147  global pol0
148  h=mean_rms.split('pol1[0]: ')
149  m=h[1].split('pol1[1]: ')
150  pol0=m[0]
151  return pol0
152 
153 def ExtractPol1( mean_rms ):
154  global pol1
155  h=mean_rms.split('pol1[0]: ')
156  m=h[1].split('pol1[1]: ')
157  pol1=m[1]
158  return pol1
159 
160 # simple_gaus_fit
161 def ExtractConstG( mean_rms ):
162  global constant
163  h=mean_rms.split('Constant: ')
164  m=h[1].split('Mean: ')
165  constant=m[0]
166  return constant
167 
168 def ExtractMeanG( mean_rms ):
169  global meang
170  h=mean_rms.split('Constant: ')
171  m=h[1].split('Mean: ')
172  n = m[1].split('Sigma: ')
173  meang=n[0]
174  return meang
175 
176 def ExtractRMSG( mean_rms ):
177  global rmsg
178  h=mean_rms.split('Constant: ')
179  m=h[1].split('Mean: ')
180  n = m[1].split('Sigma: ')
181  rmsg=n[1]
182  return rmsg
183 
184 # binContentComp, Bins_LessThan_Threshold, Bins_LessThanEqual_Threshold, Bins_GreaterThan_Threshold, Bins_GreaterThanEqual_Threshold
185 def ExtractOnlyNBins( histo_nameonly, mean_rms ):
186  global contbins
187  global bin_inf1
188  global bin_inf2
189  global bin_inf3
190  global bin_inf4
191  h=mean_rms.split('NBins: ')
192  if (len(h)>1):
193  if (h[1].find('RMS')>-1):
194  n=h[1].split('RMS: ')
195  contbins=n[0]
196  elif (h[1].find(histo_nameonly.strip())>-1):
197  reading = h[1].split(histo_nameonly.strip())
198  contbins = reading[0]
199  for i in range(1,len(reading)):
200  if (reading[i].find('(0.0000')>-1):
201  bin_inf1 = reading[i].split(':')[1]
202  break
203  else:
204  bin_inf1 = '-0.0001'
205  for i in range(1,len(reading)):
206  if (reading[i].find('(1.0000')>-1):
207  bin_inf2 = reading[i].split(':')[1]
208  break
209  else:
210  bin_inf2 = '-0.0001'
211  for i in range(1,len(reading)):
212  if (reading[i].find('(2.0000')>-1):
213  bin_inf3 = reading[i].split(':')[1]
214  break
215  else:
216  bin_inf3 = '-0.0001'
217  for i in range(1,len(reading)):
218  if (reading[i].find('(3.0000')>-1):
219  bin_inf4 = reading[i].split(':')[1]
220  break
221  else:
222  bin_inf4 = '-0.0001'
223  else:
224  contbins=h[1]
225  bin_inf1 = '0'
226  bin_inf2 = '0'
227  bin_inf3 = '0'
228  bin_inf4 = '0'
229 
230  if (len(h)==1):
231  if not h[0]:
232  contbins=0
233  bin_inf1 = '0'
234  bin_inf2 = '0'
235  bin_inf3 = '0'
236  bin_inf4 = '0'
237  else:
238  contbins=h[0]
239  bin_inf1 = '0'
240  bin_inf2 = '0'
241  bin_inf3 = '0'
242  bin_inf4 = '0'
243 
244  return (contbins, bin_inf1, bin_inf2, bin_inf3, bin_inf4)
245 
246 def ExtractAlgo( file, rootFolder ):
247  rootFolder =file+":"+rootFolder
248  of = dqutils.HanOutputFile( file )
249  algo = of.getAlgorithm(rootFolder)
250  return algo
251 
252 def ExtractNEntries( file, rootFolder , histo_string):
253  nentries='0'
254  rootFolder =file+":"+rootFolder
255  of = dqutils.HanOutputFile( file )
256  nentries = of.getNEntries(rootFolder, histo_string)
257  return nentries
258 
python.hancool_histo_algdef.ExtractEMean
def ExtractEMean(mean_rms)
Definition: hancool_histo_algdef.py:30
python.hancool_histo_algdef.ExtractYRMS
def ExtractYRMS(mean_rms)
Definition: hancool_histo_algdef.py:100
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
python.hancool_histo_algdef.ExtractERMS
def ExtractERMS(mean_rms)
Definition: hancool_histo_algdef.py:62
python.hancool_histo_algdef.ExtractYMean
def ExtractYMean(mean_rms)
Definition: hancool_histo_algdef.py:119
python.hancool_histo_algdef.ExtractXRMS
def ExtractXRMS(mean_rms)
Definition: hancool_histo_algdef.py:93
python.hancool_histo_algdef.ExtractMean
def ExtractMean(mean_rms)
Definition: hancool_histo_algdef.py:14
python.hancool_histo_algdef.ExtractRMSG
def ExtractRMSG(mean_rms)
Definition: hancool_histo_algdef.py:176
python.hancool_histo_algdef.ExtractAverage
def ExtractAverage(mean_rms)
Definition: hancool_histo_algdef.py:78
python.hancool_histo_algdef.ExtractNBins
def ExtractNBins(mean_rms)
Definition: hancool_histo_algdef.py:85
dqutils::HanOutputFile
Definition: HanOutputFile.h:32
python.hancool_histo_algdef.ExtractOnlyNBins
def ExtractOnlyNBins(histo_nameonly, mean_rms)
Definition: hancool_histo_algdef.py:185
python.hancool_histo_algdef.ExtractNEntries
def ExtractNEntries(file, rootFolder, histo_string)
Definition: hancool_histo_algdef.py:252
python.hancool_histo_algdef.ExtractRMS
def ExtractRMS(mean_rms)
Definition: hancool_histo_algdef.py:43
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.hancool_histo_algdef.ExtractPol0
def ExtractPol0(mean_rms)
Definition: hancool_histo_algdef.py:146
python.hancool_histo_algdef.ExtractPol1
def ExtractPol1(mean_rms)
Definition: hancool_histo_algdef.py:153
python.hancool_histo_algdef.ExtractMeanG
def ExtractMeanG(mean_rms)
Definition: hancool_histo_algdef.py:168
python.hancool_histo_algdef.ExtractTotInt
def ExtractTotInt(mean_rms)
Definition: hancool_histo_algdef.py:138
python.hancool_histo_algdef.ExtractAlgo
def ExtractAlgo(file, rootFolder)
Definition: hancool_histo_algdef.py:246
python.hancool_histo_algdef.ExtractConstG
def ExtractConstG(mean_rms)
Definition: hancool_histo_algdef.py:161
python.hancool_histo_algdef.ExtractSideBands
def ExtractSideBands(mean_rms)
Definition: hancool_histo_algdef.py:131
python.hancool_histo_algdef.ExtractXMean
def ExtractXMean(mean_rms)
Definition: hancool_histo_algdef.py:108
Trk::split
@ split
Definition: LayerMaterialProperties.h:38