16def _th1(m,n):
return f
"{m};{n}"
17def _tprof(m,n):
return f
"{m},{m}_weight;{n}"
18def _txy(m,n):
return f
"{m}__x,{m}__y;{n}"
19def _tyx(m,n):
return f
"{m}__y,{m}__x;{n}"
40 if namespace : mname = f
"{namespace}_{name}"
42 htype = str(args.get(
"type",
"")).
strip()
48 formatter = _FORMATTERS.get(htype, _th1)
49 pname = formatter(mname, name)
52 args[
"opt"] =
"kAlwaysCreate"
54 montool.defineHistogram(pname, **args)
62def resplot( montool, namespace, path, label, xbins=0, xmin=None, xmax=None, ybins=0, ymin=None, ymax=None):
64 vxbins =
_getbins( namespace, xbins, xmin, xmax )
65 vybins =
_getbins( namespace, ybins, ymin, ymax )
67 subpath = f
"{path}/{namespace}"
69 defineHisto( montool,
"2D", namespace=namespace, path=subpath, type=
"TH2F", title=f
"2D ({label})", xbins=vxbins, ybins=vybins )
71 defineHisto( montool,
"1D", path=subpath, type=
"TH1F", title=f
"1D ({label})", xbins=vybins )
72 defineHisto( montool,
"mean", path=subpath, type=
"TH1F", title=f
"mean {label}", xbins=vxbins )
73 defineHisto( montool,
"sigma", path=subpath, type=
"TH1F", title=f
"sigma {label}", xbins=vxbins )
78def _getbins( name, xbins, xmin=None, xmax=None ):
80 if isinstance(xbins,list):
return xbins
82 if xmin >= xmax :
print( name,
"BINS OUT OF RANGE !", xbins, xmin, xmax )
83 width = (xmax - xmin) / xbins
85 for i
in range(xbins):
86 limits.append( xmin + i*width )
100 from TrigInDetAnalysisExample.chainString
import chainString
102 chain = chainString( analysis_chain )
106 if chain.head ==
"" : mg =
"/Fullscan"
107 else : mg =
"/"+chain.head
111 if chain.roi : mg +=
"_"+chain.roi
112 if chain.vtx : mg +=
"_"+chain.vtx
113 if chain.element : mg +=
"_" + chain.element
114 if chain.extra : mg +=
"_" + chain.extra
115 if chain.passed : mg +=
"/DTE"
127ptbins_mb = [ 0.2, 0.4, 0.6, 0.8,
128 1, 1.20226, 1.44544, 1.7378, 2.0893, 2.51189, 3.01995, 3.63078, 4.36516, 5.24807, 6.30957,
129 7.58578, 9.12011, 10.9648, 13.1826, 15.8489, 19.0546, 22.9087, 27.5423, 33.1131, 39.8107,
130 47.863, 57.544, 69.1831, 83.1764, 100 ]
132ptbins_default = [ 1, 1.20226, 1.44544, 1.7378, 2.0893, 2.51189, 3.01995, 3.63078, 4.36516, 5.24807, 6.30957,
133 7.58578, 9.12011, 10.9648, 13.1826, 15.8489, 19.0546, 22.9087, 27.5423, 33.1131, 39.8107,
134 47.863, 57.544, 69.1831, 83.1764, 100 ]
138 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5,
139 13.5, 14.5, 15.5, 17.5, 18.5, 19.5, 21.5, 23.5, 24.5, 26.5, 28.5, 30.5, 32.5,
140 35.5, 37.5, 40.5, 43.5, 46.5, 50.5, 53.5, 57.5, 61.5, 66.5, 71.5, 76.5, 81.5,
141 87.5, 93.5, 100.5, 107.5, 114.5, 123.5, 131.5, 141.5, 150.5, 161.5, 172.5, 185.5, 198.5,
142 211.5, 226.5, 242.5, 259.5, 277.5, 297.5,
143 317.5, 340.5, 363.5, 389.5, 416.5, 445.5, 476.5, 509.5,
144 544.5, 582.5, 623.5, 666.5, 713.5, 762.5, 815.5, 872.5, 933.5, 998.5, 1067.5,
145 1141.5, 1221.5, 1305.5, 1396.5, 1493.5, 1597.5,
146 1708.5, 1827.5, 1953.5, 2089.5 ]
151 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5,
152 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 17.5, 18.5, 19.5,
153 21.5, 23.5, 24.5, 26.5, 28.5,
154 30.5, 32.5, 35.5, 37.5,
161 100.5, 107.5, 114.5, 123.5, 131.5, 141.5, 150.5, 161.5, 172.5, 185.5, 198.5,
162 211.5, 226.5, 242.5, 259.5, 277.5, 297.5,
163 317.5, 340.5, 363.5, 389.5,
174d0bins_default = [ -5.0, -4.0, -3.0, -2.5,
175 -2.0, -1.8, -1.6, -1.4, -1.2,
176 -1.05, -0.95, -0.85, -0.75, -0.65, -0.55, -0.45, -0.35, -0.25, -0.15, -0.05,
177 0.05, 0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95, 1.05,
178 1.2, 1.4, 1.6, 1.8, 2.0,
181d0bins_lrt = [ -100.5, -97.5, -93.5, -90.5,
184 -69.5, -66.5, -63.5, -61.5,
185 -59.5, -57.5, -54.5, -52.5, -50.5,
186 -49.5, -47.5, -45.5, -43.5, -42.5, -40.5,
187 -39.5, -37.5, -36.5, -34.5, -33.5, -32.5, -31.5,
188 -29.5, -28.5, -27.5, -26.5, -25.5, -24.5, -23.5, -22.5, -21.5, -20.5,
189 -19.5, -18.5, -17.5, -16.5, -15.5, -14.5, -13.5, -12.5, -11.5, -10.5,
190 -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5,
191 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5,
192 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5,
193 20.5, 21.5, 22.5, 23.5, 24.5, 25.5, 26.5, 27.5, 28.5, 29.5,
194 31.5, 32.5, 33.5, 34.5, 36.5, 37.5, 39.5,
195 40.5, 42.5, 43.5, 45.5, 47.5, 49.5,
196 50.5, 52.5, 54.5, 57.5, 59.5,
197 61.5, 63.5, 66.5, 69.5,
void print(char *figname, TCanvas *c1)
resplot(montool, namespace, path, label, xbins=0, xmin=None, xmax=None, ybins=0, ymin=None, ymax=None)
_getbins(name, xbins, xmin=None, xmax=None)
defineHisto(montool, name, namespace="", **args)