ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigMonitoring
TrigIDR4Monitoring
python
JsonConfig.py
Go to the documentation of this file.
1
#
2
# create all the histograms for the track parameters - this will
3
# get called once for each tool for configured chain
4
#
5
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
6
#
7
8
from
TrigInDetAnalysisExample.TIDAMonTool
import
defineHisto
9
10
import
json
11
12
def
JsonHist_builder
( monTool, mypath, filename ) :
13
14
mpath = mypath +
"/Json"
15
16
# from HistUtils import ptbins_default
17
# ptbins = ptbins_default
18
19
# from HistUtils import d0bins_default
20
# d0bins = d0bins_default
21
22
# get histograms from json and create them properly ...
23
# NB: need to sort out what to do with these variable ?
24
25
with
open( filename ,
"r"
)
as
file:
26
data = json.load(file)
27
28
# for shte, dck in data.items():
29
30
# print( f"{shte} :" )
31
32
# for cnt, sck in dck.items():
33
# print( f" {cnt} {sck}" )
34
35
for
name, hist
in
data.items():
36
37
htype = hist.get(
"type"
,
""
)
38
39
xaxis = hist.get(
"xAxis"
, {})
40
yaxis = hist.get(
"yAxis"
, {})
41
42
xbins = int(xaxis.get(
"nBins"
, 0))
43
xmin = float(xaxis.get(
"low"
, 0))
44
xmax = float(xaxis.get(
"high"
, 0))
45
46
xtitle = xaxis.get(
"title"
,
""
)
47
ytitle = yaxis.get(
"title"
,
""
)
48
49
ybins = -1
50
51
if
htype ==
"TH2F"
:
52
ybins = int(yaxis.get(
"nBins"
, 0))
53
ymin = float(yaxis.get(
"low"
, 0))
54
ymax = float(yaxis.get(
"high"
, 0))
55
if
ymin >= ymax :
print
( f
"y axis range error {name}"
)
56
57
print
(f
" name : {name} type: {htype} xbins: {xbins} lo: {xmin} hi: {xmax}"
)
58
defineHisto( monTool, name, path=mpath, type=htype, title=f
"{name};{xtitle};{ytitle}"
, xbins=xbins, xmin=xmin, xmax=xmax, ybins=ybins, ymin=ymin, ymax=ymax )
59
else
:
60
if
xmin >= xmax :
print
( f
"x axis range error {name}"
)
61
print
(f
" name : {name} type: {htype} xbins: {xbins} lo: {xmin} hi: {xmax}"
)
62
defineHisto( monTool, name, path=mpath, type=htype, title=f
"{name};{xtitle};{ytitle}"
, xbins=xbins, xmin=xmin, xmax=xmax )
63
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
python.JsonConfig.JsonHist_builder
JsonHist_builder(monTool, mypath, filename)
Definition
JsonConfig.py:12
Generated on
for ATLAS Offline Software by
1.17.0