ATLAS Offline Software
TIDAMonTool.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 #
4 # create all the histograms for each analysis - this will get called once for each
5 # configured chain - we can set the HistPath either already here, or from the c++
6 # code
7 
8 
9 # actually create the monTool to go along with a specific chain
10 # stores the histogram, binning, creates all the histograms etc
11 
12 def createMonTool( flags, slicetag, chain ) :
13 
14  from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
15  monTool = GenericMonitoringTool( flags, chain )
16 
17  histpath = slicetag + monGroup(chain)
18 
19  from TrigInDetAnalysisExample.chainString import chainString
20  cs = chainString( chain )
21 
22  # monTool.HistPath would this be better set in the c++ code ?
23 
24  if flags is None:
25  mypath = "EXPERT"
26  monTool.HistPath = histpath
27  else:
28  # mypath = flags.DQ.FileKey
29  # can't set the "path" in the histograms as that gets apended
30  # to the histogram name when using the official monitoring
31  # framework and we absolutely don't want that
32  mypath = ""
33  monTool.HistPath = "/" + flags.DQ.FileKey + "/" + histpath
34 
35 # do we need this ?
36 # monTool.UseCache = True
37 
38  monTool.convention = 'OFFLINE'
39  monTool.defaultDuration = 'run'
40 
41  # print( "TIDAMonTool.py CreateMonTool ", chain, " path:", monTool.HistPath )
42 
43  if "mb" in chain :
44  ptbins = [ 0.2, 0.4, 0.6, 0.8,
45  1, 1.20226, 1.44544, 1.7378, 2.0893, 2.51189, 3.01995, 3.63078, 4.36516, 5.24807, 6.30957,
46  7.58578, 9.12011, 10.9648, 13.1826, 15.8489, 19.0546, 22.9087, 27.5423, 33.1131, 39.8107,
47  47.863, 57.544, 69.1831, 83.1764, 100 ]
48  else:
49  ptbins = [ 1, 1.20226, 1.44544, 1.7378, 2.0893, 2.51189, 3.01995, 3.63078, 4.36516, 5.24807, 6.30957,
50  7.58578, 9.12011, 10.9648, 13.1826, 15.8489, 19.0546, 22.9087, 27.5423, 33.1131, 39.8107,
51  47.863, 57.544, 69.1831, 83.1764, 100 ]
52 
53 
54  vnbins = [
55  -0.5,
56  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,
57  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,
58  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,
59  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,
60  211.5, 226.5, 242.5, 259.5, 277.5, 297.5,
61  317.5, 340.5, 363.5, 389.5, 416.5, 445.5, 476.5, 509.5,
62  544.5, 582.5, 623.5, 666.5, 713.5, 762.5, 815.5, 872.5, 933.5, 998.5, 1067.5,
63  1141.5, 1221.5, 1305.5, 1396.5, 1493.5, 1597.5,
64  1708.5, 1827.5, 1953.5, 2089.5,
65  2234.5, 2389.5, 2555.5,
66  2733.5, 2923.5, 3125.5,
67  3342.5, 3574.5,
68  3823.5, 4088.5,
69  4372.5, 4675.5,
70  5000.5
71  ]
72 
73  d0bins = [ -5.0, -4.0, -3.0, -2.5,
74  -2.0, -1.8, -1.6, -1.4, -1.2,
75  -1.05, -0.95, -0.85, -0.75, -0.65, -0.55, -0.45, -0.35, -0.25, -0.15, -0.05,
76  0.05, 0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95, 1.05,
77  1.2, 1.4, 1.6, 1.8, 2.0,
78  2.5, 3.0, 4.0, 5.0 ]
79 
80  if "LRT" in chain :
81  d0bins = [ -100.5, -97.5, -93.5, -90.5,
82  -86.5, -83.5, -80.5,
83  -77.5, -74.5, -71.5,
84  -69.5, -66.5, -63.5, -61.5,
85  -59.5, -57.5, -54.5, -52.5, -50.5,
86  -49.5, -47.5, -45.5, -43.5, -42.5, -40.5,
87  -39.5, -37.5, -36.5, -34.5, -33.5, -32.5, -31.5,
88  -29.5, -28.5, -27.5, -26.5, -25.5, -24.5, -23.5, -22.5, -21.5, -20.5,
89  -19.5, -18.5, -17.5, -16.5, -15.5, -14.5, -13.5, -12.5, -11.5, -10.5,
90  -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5,
91  0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5,
92  10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5,
93  20.5, 21.5, 22.5, 23.5, 24.5, 25.5, 26.5, 27.5, 28.5, 29.5,
94  31.5, 32.5, 33.5, 34.5, 36.5, 37.5, 39.5,
95  40.5, 42.5, 43.5, 45.5, 47.5, 49.5,
96  50.5, 52.5, 54.5, 57.5, 59.5,
97  61.5, 63.5, 66.5, 69.5,
98  71.5, 74.5, 77.5,
99  80.5, 83.5, 86.5,
100  90.5, 93.5, 97.5,
101  100.5 ]
102 
103 # use a rounded up float(M_PI) values to overcome edge effects of using float
104 # values - will math.pi be appropriate ? double(float(M_PI)) > M_PI so it would
105 # depend on whether floats or double are used for the histogram limits in the
106 # histograms in defineHistogram
107 # pi = 3.14159265359
108  pi = 3.14159275
109 
110  binlabels = [ "Nrois", "Nevents", "N ref tracks", "N matched tracks", "N total test tracks" ]
111 
112 
113  defineHisto( monTool, "Chain", weight="Chain_weight", path=mypath, type="TH1F", title=chain, xlabels=binlabels, xbins=5, xmin=0, xmax=5 )
114 
115 
116  defineHisto( monTool, "roi_eta", path=mypath, type="TH1F", title="Roi eta", xbins=25, xmin=-2.5, xmax=2.5 )
117 
118  defineHisto( monTool, "reftrk_N", path=mypath, type="TH1F", title="Reference tracks", xbins=vnbins )
119 
120  defineHisto( monTool, "reftrk_pT", path=mypath, type="TH1F", title="Reference track pT", xbins=ptbins )
121  defineHisto( monTool, "reftrk_phi", path=mypath, type="TH1F", title="Reference track Phi", xbins=25, xmin=-pi, xmax=pi )
122  defineHisto( monTool, "reftrk_eta", path=mypath, type="TH1F", title="Reference track Eta", xbins=25, xmin=-2.5, xmax=2.5 )
123 
124  if "LRT" in chain:
125  defineHisto( monTool, "reftrk_d0", path=mypath, type="TH1F", title="Reference track d0", xbins=201, xmin=-100.0, xmax=100.0 )
126  else:
127  defineHisto( monTool, "reftrk_d0", path=mypath, type="TH1F", title="Reference track d0", xbins=101, xmin=-5.0, xmax=5.0 )
128 
129  defineHisto( monTool, "reftrk_z0", path=mypath, type="TH1F", title="Reference track z0", xbins=50, xmin=-225., xmax=225. )
130  defineHisto( monTool, "reftrk_dd0", path=mypath, type="TH1F", title="Reference track sigma(d0)", xbins=50, xmin=0, xmax=0.5 )
131  defineHisto( monTool, "reftrk_dz0", path=mypath, type="TH1F", title="Reference track sigma(z0)", xbins=50, xmin=0, xmax=2.5 )
132  defineHisto( monTool, "reftrk_d0sig", path=mypath, type="TH1F", title="Reference track d0 significance", xbins= 101, xmin=-5., xmax=5. )
133 
134  defineHisto( monTool, "testtrk_N", path=mypath, type="TH1F", title="Test tracks", xbins=vnbins )
135 
136  defineHisto( monTool, "testtrk_pT", path=mypath, type="TH1F", title="Test track pT", xbins=ptbins )
137  defineHisto( monTool, "testtrk_phi", path=mypath, type="TH1F", title="Test track Phi", xbins=25, xmin=-pi, xmax=pi )
138  defineHisto( monTool, "testtrk_eta", path=mypath, type="TH1F", title="Test track Eta", xbins=25, xmin=-2.5, xmax=2.5 )
139 
140  if "LRT" in chain:
141  defineHisto( monTool, "testtrk_d0", path=mypath, type="TH1F", title="Test track d0", xbins=201, xmin=-100.0, xmax=100.0 )
142  else:
143  defineHisto( monTool, "testtrk_d0", path=mypath, type="TH1F", title="Test track d0", xbins=101, xmin=-5.0, xmax=5.0 )
144 
145  defineHisto( monTool, "testtrk_z0", path=mypath, type="TH1F", title="Test track z0", xbins=50, xmin=-225., xmax=225. )
146  defineHisto( monTool, "testtrk_dd0", path=mypath, type="TH1F", title="Test track sigma(d0)", xbins=50, xmin=0, xmax=0.5 )
147  defineHisto( monTool, "testtrk_dz0", path=mypath, type="TH1F", title="Test track sigma(z0)", xbins=50, xmin=0, xmax=2.5 )
148  defineHisto( monTool, "testtrk_d0sig", path=mypath, type="TH1F", title="Test track d0 significance", xbins=101, xmin=-5.0, xmax=5.0 )
149 
150  defineHisto( monTool, "layer_rec", path=mypath, type="TH1F", title="hit layers", xbins=32, xmin=-0.5, xmax=31.5 )
151  defineHisto( monTool, "layer", path=mypath, type="TH1F", title="hit layers", xbins=32, xmin=-0.5, xmax=31.5 )
152 
153  defineHisto( monTool, "residual_pT", path=mypath, type="TH1F", title="track pT residual", xbins=201, xmin=-100.0, xmax=100.0 )
154  defineHisto( monTool, "residual_ipT", path=mypath, type="TH1F", title="track ipT residual", xbins=55, xmin=-5.5, xmax=5.5 )
155  defineHisto( monTool, "residual_phi", path=mypath, type="TH1F", title="track Phi residual", xbins=50, xmin=-0.02, xmax=0.02 )
156  defineHisto( monTool, "residual_eta", path=mypath, type="TH1F", title="track Eta residual", xbins=50, xmin=-0.02, xmax=0.02 )
157  defineHisto( monTool, "residual_d0", path=mypath, type="TH1F", title="track d0 residual ", xbins=251, xmin=-2.5, xmax=2.5 )
158  defineHisto( monTool, "residual_z0", path=mypath, type="TH1F", title="track z0 residual", xbins=401, xmin=-20.0, xmax=20.0 )
159  defineHisto( monTool, "residual_dd0", path=mypath, type="TH1F", title="track sigma d0 residual ", xbins=251, xmin=-0.5, xmax=0.5 )
160  defineHisto( monTool, "residual_dz0", path=mypath, type="TH1F", title="track sigma z0 residual", xbins= 401, xmin=-1.0, xmax=1.0 )
161 
162  defineHisto( monTool, "npix", path=mypath, type="TH1F", title="npix", xbins=26, xmin=-0.5, xmax=25.5 )
163  defineHisto( monTool, "npix_rec", path=mypath, type="TH1F", title="npix_rec", xbins=26, xmin=-0.5, xmax=25.5 )
164 
165  defineHisto( monTool, "nsct", path=mypath, type="TH1F", title="nsct", xbins=31, xmin=-0.5, xmax=30.5 )
166  defineHisto( monTool, "nsct_rec", path=mypath, type="TH1F", title="nsct_rec", xbins=31, xmin=-0.5, xmax=30.5 )
167 
168  defineHisto( monTool, "nsiHits", path=mypath, type="TH1F", title="nsiHits", xbins=41, xmin=-0.5, xmax=40.5 )
169  defineHisto( monTool, "nsiHits_rec", path=mypath, type="TH1F", title="nsiHits_rec", xbins=41, xmin=-0.5, xmax=40.5 )
170 
171  defineHisto( monTool, "ntrt", path=mypath, type="TH1F", title="ntrt", xbins=91, xmin=-0.5, xmax=91.5 )
172  defineHisto( monTool, "ntrt_rec", path=mypath, type="TH1F", title="ntrt_rec", xbins=91, xmin=-0.5, xmax=91.5 )
173 
174  defineHisto( monTool, "chi2dof", path=mypath, type="TH1F", title="chi2dof", xbins=75, xmin=-0, xmax=15 )
175  defineHisto( monTool, "chi2dof_rec", path=mypath, type="TH1F", title="chi2dof_rec", xbins=75, xmin=-0, xmax=15 )
176 
177 
178  defineHisto( monTool, "Eff_overall", path=mypath, type="TProfile", title="total efficiency", xbins=1, xmin=0., xmax=1. )
179 
180  defineHisto( monTool, "Eff_pT", path=mypath, type="TProfile", title="pT efficiency", xbins=ptbins )
181  defineHisto( monTool, "Eff_Eta", path=mypath, type="TProfile", title="eta efficiency", xbins=25, xmin=-2.5, xmax=2.5 )
182  defineHisto( monTool, "Eff_Phi", path=mypath, type="TProfile", title="phi efficiency", xbins=25, xmin=-pi, xmax=pi )
183  defineHisto( monTool, "Eff_d0", path=mypath, type="TProfile", title="d0 efficiency", xbins=d0bins )
184  defineHisto( monTool, "Eff_z0", path=mypath, type="TProfile", title="z0 efficiency", xbins=50, xmin=-225., xmax=225. )
185  defineHisto( monTool, "Eff_nVtx", path=mypath, type="TProfile", title="nVtx efficiency", xbins=101, xmin=-0.5, xmax=100.5 )
186  defineHisto( monTool, "Eff_lb", path=mypath, type="TProfile", title="efficinecy vs lumiblock", xbins=3010, xmin=-0.5, xmax=3009.5 )
187 
188  defineHisto( monTool, "trkvtx_x_vs_lb", path=mypath, type="TProfile", title="track vertex x vs lumiblock", xbins=301, xmin=-0.5, xmax=3009.5 )
189  defineHisto( monTool, "trkvtx_y_vs_lb", path=mypath, type="TProfile", title="track vertex y vs lumiblock", xbins=301, xmin=-0.5, xmax=3009.5 )
190  defineHisto( monTool, "trkvtx_z_vs_lb", path=mypath, type="TProfile", title="track vertex z vs lumiblock", xbins=3010, xmin=-0.5, xmax=3009.5 )
191 
192  defineHisto( monTool, "npix_vs_eta", path=mypath, type="TProfile", title="offline npix vs eta;offline #eta; mean number of offline pixel hits", xbins=30, xmin=-2.5, xmax=2.5 )
193  defineHisto( monTool, "npix_vs_eta_rec", path=mypath, type="TProfile", title="trigger npix vs eta;offline #eta; mean number of trigger pixel hits", xbins=30, xmin=-2.5, xmax=2.5 )
194  defineHisto( monTool, "nsct_vs_eta", path=mypath, type="TProfile", title="offline nsct vs eta;offline #eta; mean number of offline sct hits", xbins=30, xmin=-2.5, xmax=2.5 )
195  defineHisto( monTool, "nsct_vs_eta_rec", path=mypath, type="TProfile", title="trigger nsct vs eta;offline #eta; mean number of trigger sct hits", xbins=30, xmin=-2.5, xmax=2.5 )
196  defineHisto( monTool, "ntrt_vs_eta", path=mypath, type="TProfile", title="offline ntrt vs eta;offline #eta; mean number of offline trt hits", xbins=30, xmin=-2.5, xmax=2.5 )
197  defineHisto( monTool, "ntrt_vs_eta_rec", path=mypath, type="TProfile", title="trigger ntrt vs eta;offline #eta; mean number of trigger trt hits", xbins=30, xmin=-2.5, xmax=2.5 )
198 
199  defineHisto( monTool, "npix_vs_phi", path=mypath, type="TProfile", title="offline npix vs phi;offline #phi; mean number of offline pixel hits", xbins=30, xmin=-pi, xmax=pi )
200  defineHisto( monTool, "npix_vs_phi_rec", path=mypath, type="TProfile", title="trigger npix vs phi;offline #phi; mean number of trigger pixel hits", xbins=30, xmin=-pi, xmax=pi )
201  defineHisto( monTool, "nsct_vs_phi", path=mypath, type="TProfile", title="offline nsct vs phi;offline #phi; mean number of offline sct hits", xbins=30, xmin=-pi, xmax=pi )
202  defineHisto( monTool, "nsct_vs_phi_rec", path=mypath, type="TProfile", title="trigger nsct vs phi;offline #phi; mean number of trigger sct hits", xbins=30, xmin=-pi, xmax=pi )
203  defineHisto( monTool, "ntrt_vs_phi", path=mypath, type="TProfile", title="offline ntrt vs phi;offline #phi; mean number of offline trt hits", xbins=30, xmin=-pi, xmax=pi )
204  defineHisto( monTool, "ntrt_vs_phi_rec", path=mypath, type="TProfile", title="trigger ntrt vs phi;offline #phi; mean number of trigger trt hits", xbins=30, xmin=-pi, xmax=pi )
205 
206  defineHisto( monTool, "npix_vs_d0", path=mypath, type="TProfile", title="offline npix vs d0;offline #d0; mean number of offline pixel hits", xbins=d0bins )
207  defineHisto( monTool, "npix_vs_d0_rec", path=mypath, type="TProfile", title="trigger npix vs d0;offline #d0; mean number of trigger pixel hits", xbins=d0bins )
208  defineHisto( monTool, "nsct_vs_d0", path=mypath, type="TProfile", title="offline nsct vs d0;offline #d0; mean number of offline sct hits", xbins=d0bins )
209  defineHisto( monTool, "nsct_vs_d0_rec", path=mypath, type="TProfile", title="trigger nsct vs d0;offline #d0; mean number of trigger sct hits", xbins=d0bins )
210  defineHisto( monTool, "npix_vs_pT", path=mypath, type="TProfile", title="offline npix vs pT;offline #p_{T}; mean number of offline pixel hits", xbins=ptbins )
211  defineHisto( monTool, "npix_vs_pT_rec", path=mypath, type="TProfile", title="trigger npix vs pT;offline #p_{T}; mean number of trigger pixel hits", xbins=ptbins )
212  defineHisto( monTool, "nsct_vs_pT", path=mypath, type="TProfile", title="offline nsct vs pT;offline #p_{T} [GeV]; mean number of offline pixel hits", xbins=ptbins )
213  defineHisto( monTool, "nsct_vs_pT_rec", path=mypath, type="TProfile", title="trigger nsct vs pT;offline #p_{T} [GeV]; mean number of trigger pixel hits", xbins=ptbins )
214  defineHisto( monTool, "nsihits_lb", path=mypath, type="TProfile", title="offline n sihits vs lumiblock", xbins=301, xmin=-0.5, xmax=3009.5 )
215  defineHisto( monTool, "nsihits_lb_rec", path=mypath, type="TProfile", title="trigger n sihits vs lumiblock", xbins=301, xmin=-0.5, xmax=3009.5 )
216 
217  defineHisto( monTool, "Res_pT", path=mypath, type="TProfile", title="pT residual;#eta_{ref};pT_{trig}-pT_{ref} [GeV]", xbins=25, xmin=-2.5, xmax=2.5 )
218  defineHisto( monTool, "Res_ipT", path=mypath, type="TProfile", title="ipT residual;#eta_{ref};1/pT_{trig}-1/pT_{ref} [GeV^{-1}]", xbins=25, xmin=-2.5, xmax=2.5 )
219  defineHisto( monTool, "Res_eta", path=mypath, type="TProfile", title="Eta residual;#eta_{ref};eta_{trig}-#eta_{ref}", xbins=25, xmin=-2.5, xmax=2.5 )
220  defineHisto( monTool, "Res_phi", path=mypath, type="TProfile", title="Phi residual;#eta_{ref};phi_{trig}-#phi_{ref}", xbins=25, xmin=-2.5, xmax=2.5 )
221  defineHisto( monTool, "Res_d0", path=mypath, type="TProfile", title="d0 residual;#eta_{ref};Delta d0 [mm]", xbins=25, xmin=-2.5, xmax=2.5 )
222  defineHisto( monTool, "Res_z0", path=mypath, type="TProfile", title="z0 residual;#eta_{ref};Delta z0 [mm]", xbins=25, xmin=-2.5, xmax=2.5 )
223 
224  defineHisto( monTool, "d0_vs_phi_prof", path=mypath, type="TProfile", title="d0 vs phi_prof", xbins=25, xmin=-pi, xmax=pi )
225  defineHisto( monTool, "d0_vs_phi_rec_prof", path=mypath, type="TProfile", title="d0 vs phi_rec_prof", xbins=25, xmin=-pi, xmax=pi )
226 
227  if "probe" in cs.extra:
228  defineHisto( monTool, "invmass", path=mypath, type="TH1F", title="invariant mass;mass [GeV]", xbins=320, xmin=0, xmax=200 )
229  defineHisto( monTool, "invmass_obj", path=mypath, type="TH1F", title="invariant mass;mass [GeV]", xbins=320, xmin=0, xmax=200 )
230 
231 
232  if cs.vtx != "" :
233 
234  vnbins_short = [
235  -0.5,
236  0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5,
237  10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 17.5, 18.5, 19.5,
238  21.5, 23.5, 24.5, 26.5, 28.5,
239  30.5, 32.5, 35.5, 37.5,
240  40.5, 43.5, 46.5,
241  50.5, 53.5, 57.5,
242  61.5, 66.5,
243  71.5, 76.5,
244  81.5, 87.5,
245  93.5,
246  100.5, 107.5, 114.5, 123.5, 131.5, 141.5, 150.5, 161.5, 172.5, 185.5, 198.5,
247  211.5, 226.5, 242.5, 259.5, 277.5, 297.5,
248  317.5, 340.5, 363.5, 389.5,
249  416.5, 445.5, 476.5,
250  509.5, 544.5, 582.5,
251  623.5, 666.5,
252  713.5, 762.5,
253  815.5, 872.5,
254  933.5, 998.5,
255  1067.5
256  ]
257 
258  defineHisto( monTool, "vx_nvtx", path=mypath, type="TH1F", title=";number of vertices", xbins=101, xmin=-0.5, xmax=100.5 )
259  defineHisto( monTool, "vx_zed", path=mypath, type="TH1F", title=";vtx z [mm]", xbins=100, xmin=-250, xmax=250 )
260  defineHisto( monTool, "vx_x", path=mypath, type="TH1F", title=";vtx x [mm]", xbins=200, xmin=-1.2, xmax=1.2 )
261  defineHisto( monTool, "vx_y", path=mypath, type="TH1F", title=";vtx y [mm]", xbins=200, xmin=-1.2, xmax=1.2 )
262  defineHisto( monTool, "vx_ntrax", path=mypath, type="TH1F", title=";number of tracks", xbins=vnbins )
263 
264  defineHisto( monTool, "vx_nvtx_rec", path=mypath, type="TH1F", title=";number of vertices", xbins=101, xmin=-0.5, xmax=100.5 )
265  defineHisto( monTool, "vx_zed_rec", path=mypath, type="TH1F", title=";vtx z [mm]", xbins=100, xmin=-250, xmax=250 )
266  defineHisto( monTool, "vx_x_rec", path=mypath, type="TH1F", title=";vtx x [mm]", xbins=200, xmin=-1.2, xmax=1.2 )
267  defineHisto( monTool, "vx_y_rec", path=mypath, type="TH1F", title=";vtx y [mm]", xbins=200, xmin=-1.2, xmax=1.2 )
268  defineHisto( monTool, "vx_ntrax_rec", path=mypath, type="TH1F", title=";number of tracks", xbins=vnbins )
269 
270  defineHisto( monTool, "vx_zed_res", path=mypath, type="TH1F", title="Delta z [mm]", xbins=400, xmin=-5, xmax=5 )
271  defineHisto( monTool, "vx_x_res", path=mypath, type="TH1F", title="Delta x [mm]", xbins=400, xmin=-0.1, xmax=0.1 )
272  defineHisto( monTool, "vx_y_res", path=mypath, type="TH1F", title="Delta y [mm]", xbins=400, xmin=-0.1, xmax=0.1 )
273 
274 
275  defineHisto( monTool, "vx_rdz_vs_zed", path=mypath, type="TProfile", title="rdz_vs_zed; vtx z [mm];z residual [mm]", xbins=100, xmin=-250, xmax=250 )
276  defineHisto( monTool, "vx_rdz_vs_ntrax", path=mypath, type="TProfile", title="rdz_vs_ntrax;number of tracks;z residual [mm]", xbins=vnbins_short )
277  defineHisto( monTool, "vx_rdz_vs_nvtx", path=mypath, type="TProfile", title="rdz_vs_nvtx;number of vertices;z residual [mm]", xbins=51, xmin=-0.125, xmax=50.125 )
278 
279  # defineHistogram( monTool, "rdz_vs_mu", 30, 0, 30, 400, -20, 20 );
280 
281  defineHisto( monTool, "vx_zed_eff", path=mypath, type="TProfile", title="zed_eff;efficiency;offline vtx z [mm]", xbins=50, xmin=-250, xmax=250 )
282  defineHisto( monTool, "vx_ntrax_eff", path=mypath, type="TProfile", title="ntrax_eff;number of tracks;efficiency", xbins=vnbins )
283  defineHisto( monTool, "vx_nvtx_eff", path=mypath, type="TProfile", title="nvtx_eff;number of vertices;efficiency", xbins=101, xmin=-0.5, xmax=100.5 )
284  defineHisto( monTool, "vx_mu_eff", path=mypath, type="TProfile", title="mu_eff;<#mu>;efficiency", xbins=101, xmin=-0.5, xmax=100.5 )
285  defineHisto( monTool, "vx_lb_eff", path=mypath, type="TProfile", title="lb_eff;lumi block;efficiency", xbins=151, xmin=-0.5, xmax=3019.5 )
286 
287 
288 
289  return monTool
290 
291 
292 
293 # generate the mongroup hist path from the analysis string
294 
295 def monGroup( analysis_chain ) :
296 
297  from TrigInDetAnalysisExample.chainString import chainString
298 
299  chain = chainString( analysis_chain )
300 
301  mg = ""
302 
303  if chain.head == "" :
304  mg = "/Fullscan"
305  else :
306  mg = "/"+chain.head
307 
308  mg += "/"+chain.tail
309 
310  if chain.roi != "" :
311  mg += "_"+chain.roi
312 
313  if chain.vtx != "" :
314  mg += "_"+chain.vtx
315 
316  if chain.element != "" :
317  mg += "_" + chain.element
318 
319  if chain.extra != "" :
320  mg += "_" + chain.extra
321 
322  if chain.passed :
323  mg += "/DTE"
324 
325  return mg
326 
327 
328 # wrapper around montool.defineHistogram to simplify the required histogram names
329 # eg for a TProfile, automatically add the second variable, and create the histogram
330 # alias to avoid having to write pages of tedious boiler plate functions
331 
332 def defineHisto( montool, name, **args ) :
333 
334  if "type" in args and args["type"] == "TProfile" :
335  name = name + "," + name + "_weight;" + name
336 
337  # make sure that the histogram is created, even it is is never filled
338  args['opt'] = 'kAlwaysCreate'
339 
340  montool.defineHistogram( name, **args )
341 
342 
python.TIDAMonTool.monGroup
def monGroup(analysis_chain)
Definition: TIDAMonTool.py:295
GenericMonitoringTool
Definition: GenericMonitoringTool.h:53
python.TIDAMonTool.defineHisto
def defineHisto(montool, name, **args)
Definition: TIDAMonTool.py:332
python.TIDAMonTool.createMonTool
def createMonTool(flags, slicetag, chain)
Definition: TIDAMonTool.py:12