◆ __init__()
def python.physvalPostProcessingTools.ResolutionComputation.__init__ |
( |
|
self, |
|
|
|
histogram_name |
|
) |
| |
◆ __call__()
def python.physvalPostProcessingTools.ResolutionComputation.__call__ |
( |
|
self, |
|
|
|
root_file |
|
) |
| |
Definition at line 166 of file physvalPostProcessingTools.py.
166 def __call__(self, root_file):
167 hist =
find_histo(root_file, self.histogram_name)
170 raise RuntimeError(f
"Histogram '{self.histogram_name}' not found.")
172 logging.error(f
"Histogram '{self.histogram_name}' not found.")
176 cum = [hist.GetBinContent(i)
for i
in range(0, hist.GetNbinsX() + 2)]
177 for i
in range(1, len(cum)):
179 total = cum[-1]
or 1.0
180 cum = [x / total
for x
in cum]
183 s68 = self._compute_s(hist, cum, 0.683)
184 s90 = self._compute_s(hist, cum, 0.90)
186 logging.info(f
"Resolution widths for {self.histogram_name} -> s68: {s68:.4f}, s90: {s90:.4f}")
187 logging.info(
"Todo: Take a 2D histo, take the quantity say xaxis, make its small intervals %s",
"and then compute the Resolution widths and then save as a 1D histo with quantity on xaxis and Resolution widths on yaxis")
◆ _compute_s()
def python.physvalPostProcessingTools.ResolutionComputation._compute_s |
( |
|
self, |
|
|
|
hist, |
|
|
|
cum, |
|
|
|
prob |
|
) |
| |
|
private |
Definition at line 189 of file physvalPostProcessingTools.py.
189 def _compute_s(self, hist, cum, prob):
191 min_width =
float(
"inf")
193 for i
in range(len(cum)):
194 target = cum[i] + prob
197 for j
in range(i + 1, len(cum)):
199 width = hist.GetBinCenter(j) - hist.GetBinCenter(i)
200 if width < min_width:
204 return 0.5 * (hist.GetBinCenter(best[1]) - hist.GetBinCenter(best[0]))
◆ from_yaml()
def python.physvalPostProcessingTools.ResolutionComputation.from_yaml |
( |
|
fragment | ) |
|
|
static |
Definition at line 207 of file physvalPostProcessingTools.py.
207 def from_yaml(fragment):
208 return ResolutionComputation(
209 histogram_name=fragment[
"histogram"]
◆ histogram_name
python.physvalPostProcessingTools.ResolutionComputation.histogram_name |
The documentation for this class was generated from the following file: