12def JsonHist_builder( monTool, mypath, filename ) :
13
14 mpath = mypath + "/Json"
15
16
17
18
19
20
21
22
23
24
25 with open( filename , "r") as file:
26 data = json.load(file)
27
28
29
30
31
32
33
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
void print(char *figname, TCanvas *c1)