ATLAS Offline Software
T2VertexBeamSpotMonitoring.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
4 
5 # Default set opt histogram options to use for per-LBN histograms
6 _LBN_OPTIONS = "kLBNHistoryDepth=1 kAlwaysCreate"
7 
8 
10  """Base class which defines few useful methods to cope with defineHistogram
11  madness.
12  """
13  def __init__(self, flags, name):
14  self.monTool = GenericMonitoringTool(flags, name)
15 
16  def makeHisto1D(self, name, type, xbins, xmin, xmax, title, path='EXPERT', opt=None, alias=None, **kw):
17  if alias is not None:
18  name = f"{name};{alias}"
20  name, path=path, type=type, title=title, opt=opt,
21  xbins=xbins, xmin=xmin, xmax=xmax, **kw
22  )
23 
24  def makeLBNHisto1D(self, name, type, xbins, xmin, xmax, title, path='EXPERT', opt="", **kw):
25  opt = _LBN_OPTIONS + " " + opt if opt else _LBN_OPTIONS
26  self.makeHisto1D(
27  name, type, xbins, xmin, xmax, title, path=path, opt=opt, **kw,
28  )
29 
30  def makeHisto2D(self, nameX, nameY, type, xbins, xmin, xmax,
31  ybins, ymin, ymax, title, path='EXPERT', opt=None, alias=None, **kw):
32  name = ", ".join([nameX, nameY])
33  if alias is not None:
34  name = f"{name};{alias}"
36  name, path=path, type=type, title=title, opt=opt,
37  xbins=xbins, xmin=xmin, xmax=xmax,
38  ybins=ybins, ymin=ymin, ymax=ymax,
39  **kw
40  )
41 
42  def makeLBNHisto2D(self, nameX, nameY, type, xbins, xmin, xmax,
43  ybins, ymin, ymax, title, path='EXPERT', opt="", **kw):
44  opt = _LBN_OPTIONS + " " + opt if opt else _LBN_OPTIONS
45  self.makeHisto2D(
46  nameX, nameY, type, xbins, xmin, xmax, ybins, ymin, ymax, title,
47  path=path, opt=opt, **kw,
48  )
49 
50  def makeProfile(self, nameX, nameY, xbins, xmin, xmax, title, path='EXPERT', opt=None, alias=None, **kw):
51  name = ", ".join([nameX, nameY])
52  if alias is not None:
53  name = f"{name};{alias}"
55  name, path=path, type="TProfile", title=title, opt=opt,
56  xbins=xbins, xmin=xmin, xmax=xmax, **kw,
57  )
58 
59  def makeLBNProfile(self, nameX, nameY, xbins, xmin, xmax, title, path='EXPERT', opt="", **kw):
60  opt = _LBN_OPTIONS + " " + opt if opt else _LBN_OPTIONS
61  self.makeProfile(
62  nameX, nameY, xbins, xmin, xmax, title, path=path, opt=opt, **kw,
63  )
64 
65 
67  def __init__ (self, flags, name="T2VertexBeamSpotMonitoring"):
68  super(T2VertexBeamSpotMonitoring, self).__init__(flags, name)
69 
70  # monitored variables for updateBS():
71  # - TIME_TotalTime
72 
73  # --------------- Timing histograms -----------------
74  timers = ["TotalTime"]
75  for timer in timers:
76  self.makeHisto1D(f'TIME_{timer}', 'TH1I', 50, 0, 25000,
77  title=f"Timing {timer}; time [#mus];")
78 
79 
81  def __init__ (self, flags, name="T2VertexBeamSpotToolMonitoring", detail=2):
82  """
83  Parameters
84  ----------
85  detail : int
86  Selects which level of detail to monitor. 0 will produce minimal
87  set of histograms. 1 will make a reasonable set of histograms for
88  online running. 2 (default) will make all possible histograms,
89  this should be suitable for offline.
90  """
91  super(T2VertexBeamSpotToolMonitoring, self).__init__(flags, name)
92 
93  # monitored variables for execute():
94  # - nTotalTracks
95  # - nTotalPassedTracks
96  # - nTotalHighPTTracks
97  self.makeHisto1D('nTotalTracks', 'TH1F', 100, 0., 2000.,
98  title="nTotalTracks; N all tracks per event; Number of events")
99 
100  self.makeHisto1D('nTotalPassedTracks', 'TH1F', 100, 0., 1000.,
101  title="nTotalPassedTracks; N selected tracks per event; Number of events")
102 
103  self.makeHisto1D('nTotalHighPTTracks', 'TH1F', 100, 0., 1000.,
104  title="nTotalHighPTTracks; N high-P_{t} tracks per event; Number of events")
105 
106  self.defineTimingHistos(detail)
107  self.defineClusterHistos(detail)
108  self.defineVertexHistos(detail)
109  self.defineSplitVertexHistos(detail)
110 
111  def defineTimingHistos(self, detail):
112  # monitored timers:
113  # - TIME_SelectingTracks
114  # - TIME_SplitVertexReconstruction
115  # - TIME_toSortSplitTracks
116  # - TIME_toSortTracks
117  # - TIME_toVertexFitSplit
118  # - TIME_toZCluster
119  # - TIME_toZClusterSplit
120  # - TIME_VertexReconstruction
121 
122  timers = [
123  ("SelectingTracks", 10000.),
124  ("SplitVertexReconstruction", 10000.),
125  ("toSortSplitTracks", 10000.),
126  ("toSortTracks", 1000.),
127  ("toVertexFitSplit", 10000.),
128  ("toZCluster", 100.),
129  ("toZClusterSplit", 100.),
130  ("VertexReconstruction", 20000.),
131  ]
132  for timer, xmax in timers:
133  self.makeHisto1D('TIME_' + timer, 'TH1I', 50, 0., xmax,
134  title="Timing " + timer + "; time [#mus];")
135 
136  def defineClusterHistos(self, detail):
137  # cluster-related variables:
138  # - NClusters
139  # - ClusterZ
140  # - ClusterNTracks
141  # - ClusterNTracksUnused
142  # - ClusterDeltaZ0
143  # - ClusterZ0Pull
144 
145  if detail >= 2:
146  self.makeHisto1D('NClusters', 'TH1I', 30, 0., 60.,
147  title="NClusters; Number of clusters per event; Number of events")
148  self.makeHisto1D('ClusterNTracks', 'TH1I', 100, 0.0, 100.0,
149  title="ClusterNTracks; Number tracks per cluster; Number of events")
150  self.makeHisto1D('ClusterNTracksUnused', 'TH1I', 100, 0.0, 400.0,
151  title="ClusterNTracksUnused; Number of unused tracks per cluster; Number of events")
152  self.makeHisto2D('ClusterNTracks', 'ClusterNTracksUnused', 'TH2I', 50, 0.0, 50.0, 50, 0.0, 400.0,
153  title="Number of tracks in cluster unused vs used; Number of tracks per cluster; Number of unused tracks per cluster")
154  self.makeHisto1D('ClusterZ', 'TH1I', 100, -250.0, 250.0,
155  title="ClusterZ; Cluster Z position [mm]; Number of clusters")
156  self.makeHisto1D('ClusterDeltaZ0', 'TH1I', 100, -2.0, 2.0,
157  title="ClusterDeltaZ0; Delta of track Z0 and cluster Z position [mm]; Number of tracks")
158  self.makeHisto1D('ClusterZ0Pull', 'TH1I', 100, -10.0, 10.0,
159  title="ClusterZ0Pull; Pull of track Z0 with respect to cluster Z position; Number of tracks")
160  self.makeHisto1D('ClusterClusterDeltaZ0', 'TH1I', 200, -100.0, 100.0,
161  title="ClusterClusterDeltaZ0; Delta of cluster-cluster Z position [mm]; Number of clusters")
162 
163  def defineVertexHistos(self, detail):
164 
165  # vertex-related variables:
166  # - Nvtx
167  # - NvtxPass
168  # - NvtxPassBCID
169  # - ClusterDeltaVertexZ
170  # - Vertex<param>, where <param> is one of
171  # - NTrks SumPt SumPt2 Mass Qual Chi2Prob X Y Z XZoom YZoom ZZoom Xerr Yerr Zerr XY Pull NTrksInVtx
172  # - Vertex<param>Pass, with the same <param>
173  # - Vertex<param>PassBCID, with the same <param>
174 
175  # Number of vertices
176  self.makeHisto1D('Nvtx', 'TH1F', 50, 0.0, 100.0,
177  title="Nvtx; N vertices per event; Number of events")
178  # per-LB
179  self.makeLBNHisto1D('NvtxPass', 'TH1I', 50, 0.0, 50.0,
180  title="NvtxPass; N accepted vertices per event; Number of events")
181 
182  if detail > 1:
183  self.makeHisto1D('ClusterDeltaVertexZ', 'TH1F', 100, -10.0, 10.0,
184  title="ClusterDeltaVertexZ; Delta of cluster Z position and Vertex Z position [mm]; Number of vertices")
185 
186  if detail >= 0:
187  # Beam position in X, Y, Z: provides mean position and can extract width (convoluted with vertexing precision)
188  # Total number of bins: 2500
189  # 10 um bins in X and Y
190  # 5 mm bins in Z
191  self.makeLBNHisto1D('VertexXPass','TH1F', 1000, -5.0, 5.0,
192  title="Acc. Vertex X; Vertex x [mm]; Number of vertices")
193  self.makeLBNHisto1D('VertexYPass','TH1F', 1000, -5.0, 5.0,
194  title="Acc. Vertex Y; Vertex y [mm]; Number of vertices")
195  self.makeLBNHisto1D('VertexZPass','TH1F', 500, -500.0, 500.0,
196  title="Acc. Vertex Z; Vertex z [mm]; Number of vertices")
197 
198  # Beam position in X, Y, Z with respect to the nominal position
199  # Total number of bins: 300
200  # 10 um bins in X and Y
201  # 5 mm bins in Z
202  self.makeLBNHisto1D('VertexXZoomPass','TH1F', 100, -0.500, 0.500,
203  title="Acc. Vertex X-X_{nominal}; Vertex X-X_{nominal} [mm]; Number of vertices")
204  self.makeLBNHisto1D('VertexYZoomPass','TH1F', 100, -0.500, 0.500,
205  title="Acc. Vertex Y-Y_{nominal}; Vertex Y-Y_{nominal} [mm]; Number of vertices")
206  self.makeLBNHisto1D('VertexZZoomPass','TH1F', 100, -250.0, 250.0,
207  title="Acc. Vertex Z-Z_{nominal}; Vertex Z-Z_{nominal} [mm]; Number of vertices")
208 
209  if detail >= 1:
210 
211  # Beam profile plots: X-Y, X-Z, Y-Z
212  # Total number of bins: 2700
213  # 100 um bins in X and Y
214  self.makeLBNHisto2D('VertexXPass', 'VertexYPass', 'TH2F', 50, -2.5, 2.5, 50, -2.5, 2.5,
215  title="Acc. Vertex Y vs X; Vertex X [mm]; Vertex Y [mm]")
216  self.makeLBNProfile('VertexZPass', 'VertexXPass', 100, -250.0, 250.0,
217  title="Acc. Vertex X vs Z; Vertex Z [mm]; Vertex X [mm]")
218  self.makeLBNProfile('VertexZPass', 'VertexYPass', 100, -250.0, 250.0,
219  title="Acc. Vertex Y vs Z; Vertex Z [mm]; Vertex Y [mm]")
220 
221  # Beam profile w.r.t. the nominal position: X - X_nominal , etc
222  # Total number of bins: 2700
223  # 50 um bins in X and Y
224  self.makeLBNHisto2D('VertexXZoomPass', 'VertexYZoomPass', 'TH2F', 50, -1.25, 1.25, 50, -1.25, 1.25,
225  title="Acc. Vertex Y-Y_{nominal} vs X-X_{nominal}; Vertex X-X_{nominal} [mm]; Vertex Y-Y_{nominal} [mm]")
226  self.makeLBNProfile('VertexZZoomPass', 'VertexXZoomPass', 100, -250.0, 250.0,
227  title="Acc. Vertex X-X_{nominal} vs Z-Z_{nominal}; Vertex Z-Z_{nominal} [mm]; Vertex X-X_{nominal} [mm]")
228  self.makeLBNProfile('VertexZZoomPass', 'VertexYZoomPass', 100, -250.0, 250.0,
229  title="Acc. Vertex Y-Y_{nominal} vs Z-Z_{nominal}; Vertex Z-Z_{nominal} [mm]; Vertex Y-Y_{nominal} [mm]")
230 
231  # Beam position in X, Y, Z vs. Ntrk in vertex: allows to correct width for each vertex multiplicity
232  # Total number of bins: 85,000 -> 105,000
233  # 10 um bins in X and Y
234  # 2 mm bins in Z
235  self.makeLBNHisto2D('VertexNTrksPass', 'VertexXPass', 'TH2F', 100, 0.0, 100.0, 400, -2.00, 2.00,
236  title="Acc. Vertex X vs. NTrks; N trk per vertex; Vertex x [mm]")
237  self.makeLBNHisto2D('VertexNTrksPass', 'VertexYPass', 'TH2F', 100, 0.0, 100.0, 400, -2.00, 2.00,
238  title="Acc. Vertex Y vs. NTrks; N trk per vertex; Vertex y [mm]")
239  self.makeLBNHisto2D('VertexNTrksPass', 'VertexZPass', 'TH2F', 100, 0.0, 100.0, 250, -250.0, 250.0,
240  title="Acc. Vertex Z vs. NTrks; N trk per vertex; Vertex z [mm]")
241 
242  self.makeProfile('VertexZPass', 'VertexNTrksPass', 100, -250.0, 250.0,
243  title="Acc. Vertex NTrks vs. Vertex Z; Vertex Z [mm]; N trk per vertex")
244  self.makeProfile('VertexZPass', 'VertexXerrPass', 100, -250.0, 250.0,
245  title="Vertex Xerr vs Z; Vertex Z [mm]; Vertex Xerr [mm]")
246  self.makeProfile('VertexZPass', 'VertexYerrPass', 100, -250.0, 250.0,
247  title="Vertex Yerr vs Z; Vertex Z [mm]; Vertex Yerr [mm]")
248 
249  self.makeProfile('VertexNTrksPass', 'VertexXerrPass', 100, 0.0, 100.0,
250  title="Acc. Vertex Xerr vs NTrks; Vertex N trks; Vertex Xerr [mm]")
251  self.makeProfile('VertexNTrksPass', 'VertexYerrPass', 100, 0.0, 100.0,
252  title="Acc. Vertex Yerr vs NTrks; Vertex N trks; Vertex Yerr [mm]")
253  self.makeProfile('VertexNTrksPass', 'VertexZerrPass', 100, 0.0, 100.0,
254  title="Acc. Vertex Zerr vs NTrks; Vertex N trks; Vertex Zerr [mm]")
255 
256  #---------------------------------------
257  # Per BCID, per luminosity block histograms
258  #---------------------------------------
259  # Total number of per-BCID, per-LBN bins:
260  # 552,420
261  #---------------------------------------
262 
263  if detail >= 1:
264 
265  # Bunch-to-bunch luminosity and bunch-profile information
266  # Total number of bins: 17,820 (5*3,564)
267  self.makeLBNProfile('BCID', 'TotalTracksPass', 3564, 0, 3564,
268  title="Acc. N Tracks vs BCID; BCID; N tracks vertices")
269  self.makeLBNProfile('BCID', 'NvtxPassBCID', 3564, 0, 3564,
270  title="Acc. N Vertices vs BCID; BCID; N accepted vertices")
271  self.makeLBNProfile('BCID', 'VertexXPassBCID', 3564, 0, 3564,
272  title="Acc. Vertex X vs BCID (profile); BCID; Vertex X [mm]")
273  self.makeLBNProfile('BCID', 'VertexYPassBCID', 3564, 0, 3564,
274  title="Acc. Vertex Y vs BCID (profile); BCID; Vertex Y [mm]")
275  self.makeLBNProfile('BCID', 'VertexZPassBCID', 3564, 0, 3564,
276  title="Acc. Vertex Z vs BCID (profile); BCID; Vertex Z [mm]")
277 
278  if detail >= 2:
279  # Bunch-to-bunch 2D histograms
280  # Total number of bins: 534,600 ((50+50+50) * 3,564)
281  # 20 um bins in X and Y (compared to 10 um for 1D version)
282  # 10 mm bins in Z (compared to 5 mm bins for 1D version)
283  self.makeLBNHisto2D('BCID', 'VertexXZoomPassBCID', 'TH2F', 3564, 0, 3564, 50, -0.5, 0.5,
284  title="Acc. Vertex X-X_{nominal} vs. BCID; BCID; Vertex X-X_{nominal} [mm]")
285  self.makeLBNHisto2D('BCID', 'VertexYZoomPassBCID', 'TH2F', 3564, 0, 3564, 50, -0.5, 0.5,
286  title="Acc. Vertex Y-Y_{nominal} vs. BCID; BCID; Vertex Y-Y_{nominal} [mm]")
287  self.makeLBNHisto2D('BCID', 'VertexZZoomPassBCID', 'TH2F', 3564, 0, 3564, 50, -250.0, 250.0,
288  title="Acc. Vertex Z-Z_{nominal} vs. BCID; BCID; Vertex Z-Z_{nominal} [mm]")
289 
290  if detail >= 3:
291 
292  # All Vertices parameters
293  #-------------------------------------------------------------------------------------------------
294  #Number of all vertices in an events
295  self.makeHisto1D('VertexNTrks', 'TH1F', 100, 0., 100.,
296  title="Vertex NTrks; N trk per vertex; Number of vertices")
297  self.makeHisto1D('VertexSumPt', 'TH1F', 100, 0., 100.,
298  title="Vertex SumPt; Vertex sum p_{T} [GeV]; Number of vertices")
299  self.makeHisto1D('VertexSumPt2', 'TH1F', 100, 0., 100.,
300  title="Vertex SumPt^2; Vertex sum p_{T}^{2} [GeV^{2}]; Number of vertices")
301  self.makeHisto1D('VertexQual', 'TH1F', 50, 0., 50.,
302  title="Vertex Qual; Vertex #chi^{2}/ndf; Number of vertices")
303  self.makeHisto1D('VertexMass', 'TH1F', 300, 0., 3000.,
304  title="Vertex mass; Vertex Mass; Number of vertices")
305  self.makeHisto1D('VertexChi2Prob', 'TH1F', 70, -0.2, 1.2,
306  title="Vertex Probability; Vertex #chi^{2} probability; Number of vertices")
307 
308  # Beam position in X, Y, Z: before vertex cleaning cuts
309  # Total number of bins: 1500
310  self.makeHisto1D('VertexX', 'TH1F', 500, -5.0, 5.0,
311  title="Vertex X; Vertex X [mm]; Number of vertices")
312  self.makeHisto1D('VertexXerr', 'TH1F', 50, 0., 0.5,
313  title="Vertex Xerr; Vertex x error [mm]; Number of vertices")
314  self.makeHisto1D('VertexY', 'TH1F', 500, -5.0, 5.0,
315  title="Vertex Y; Vertex Y [mm]; Number of vertices")
316  self.makeHisto1D('VertexYerr', 'TH1F', 50, 0., 0.5,
317  title="Vertex Yerr; Vertex y error [mm]; Number of vertices")
318  self.makeHisto1D('VertexZ', 'TH1F', 500, -250.0, 250.0,
319  title="Vertex Z; Vertex Z [mm]; Number of vertices")
320  self.makeHisto1D('VertexZerr', 'TH1F', 100, 0., 1.,
321  title="Vertex Zerr; Vertex z error [mm]; Number of vertices")
322 
323  self.makeHisto1D('VertexXZoom', 'TH1F', 100, -0.250, 0.250,
324  title="Vertex X-X_{nominal}; Vertex X-X_{nominal} [mm]; Number of vertices")
325  self.makeHisto1D('VertexYZoom', 'TH1F', 100, -0.250, 0.250,
326  title="Vertex Y-Y_{nominal}; Vertex Y-Y_{nominal} [mm]; Number of vertices")
327  self.makeHisto1D('VertexZZoom', 'TH1F', 100, -250., 250.,
328  title="Vertex Z-Z_{nominal}; Vertex Z-Z_{nominal} [mm]; Number of vertices")
329 
330  self.makeHisto1D('VertexPull', 'TH1F', 100, -5.0, 5.0,
331  title="Vertex 'pull'; Vertex Z_{PV} - Z_{seed} [mm]; Number of vertices")
332 
333  self.makeLBNHisto1D('VertexNTrksInVtx', 'TH1F', 50, 0, 50,
334  title="Acc. NTrks in vertex; Vertex number of tracks; Number of tracks in vertex track list")
335 
336  if detail >=3:
337 
338  # Passed Vertices parameters
339  #-------------------------------------------------------------------------------------------------
340 
341  self.makeLBNHisto1D('VertexNTrksPass', 'TH1F', 100, 0, 100,
342  title="Vertex NTrks; N trk per vertex; Number of vertices")
343  self.makeHisto1D('VertexSumPtPass', 'TH1F', 100, 0., 100.,
344  title="Vertex SumPt; Vertex sum p_{T} [GeV]; Number of vertices")
345  self.makeHisto1D('VertexSumPt2Pass', 'TH1F', 100, 0., 100.,
346  title="Vertex SumPt^2; Vertex sum p_{T}^{2} [GeV^{2}]; Number of vertices")
347  self.makeHisto1D('VertexQualPass', 'TH1F', 50, 0., 50.,
348  title="Vertex Qual; Vertex #chi^{2}/ndf; Number of vertices")
349  self.makeHisto1D('VertexMassPass', 'TH1F', 100, 0., 3000.,
350  title="Vertex mass; Vertex Mass; Number of vertices")
351  self.makeHisto1D('VertexChi2ProbPass', 'TH1F', 70, -0.2, 1.2,
352  title="Vertex Probability; Vertex #chi^{2} probability; Number of vertices")
353 
354  # Beam position in X, Y, Z: before vertex cleaning cuts
355  # Total number of bins: 1500
356  # self.makeHisto1D('VertexXPass', 'TH1F', 500, -5.0, 5.0,
357  # title="Vertex X; Vertex X [mm]; Number of vertices")
358  self.makeHisto1D('VertexXerrPass', 'TH1F', 50, 0., 0.5,
359  title="Vertex Xerr; Vertex x error [mm]; Number of vertices")
360  # self.makeHisto1D('VertexYPass', 'TH1F', 500, -5.0, 5.0,
361  # title="Vertex Y; Vertex Y [mm]; Number of vertices")
362  self.makeHisto1D('VertexYerrPass', 'TH1F', 50, 0., 0.5,
363  title="Vertex Yerr; Vertex y error [mm]; Number of vertices")
364  # self.makeHisto1D('VertexZPass', 'TH1F', 500, -250.0, 250.0,
365  # title="Vertex Z; Vertex Z [mm]; Number of vertices")
366  self.makeHisto1D('VertexZerrPass', 'TH1F', 100, 0., 1.,
367  title="Vertex Zerr; Vertex z error [mm]; Number of vertices")
368 
369  self.makeHisto1D('VertexXZoomPass', 'TH1F', 100, -0.250, 0.250,
370  title="Vertex X-X_{nominal}; Vertex X-X_{nominal} [mm]; Number of vertices")
371  self.makeHisto1D('VertexYZoomPass', 'TH1F', 100, -0.250, 0.250,
372  title="Vertex Y-Y_{nominal}; Vertex Y-Y_{nominal} [mm]; Number of vertices")
373  self.makeHisto1D('VertexZZoomPass', 'TH1F', 100, -250., 250.,
374  title="Vertex Z-Z_{nominal}; Vertex Z-Z_{nominal} [mm]; Number of vertices")
375 
376  self.makeHisto1D('VertexPullPass', 'TH1F', 100, -5.0, 5.0,
377  title="Vertex 'pull'; Vertex Z_{PV} - Z_{seed} [mm]; Number of vertices")
378 
379  self.makeLBNHisto1D('VertexNTrksInVtxPass', 'TH1F', 50, 0, 50,
380  title="Acc. NTrks in vertex; Vertex number of tracks; Number of tracks in vertex track list")
381 
382  #-------------------------------------------------------------------------------------------------
383 
384  if detail >= 3:
385 
386  # 2D Histos
387  self.makeHisto2D('VertexX', 'VertexY', 'TH2F', 50, -5.0, 5.0, 50, -5.0, 5.0,
388  title="Vertex Y vs X; Vertex X [mm]; Vertex Y [mm]")
389  self.makeHisto2D('VertexZ', 'VertexX', 'TH2F', 500, -250.0, 250.0, 50, -5.0, 5.0,
390  title="Vertex X vs Z; Vertex Z [mm]; Vertex X [mm]")
391  self.makeHisto2D('VertexZ', 'VertexY', 'TH2F', 500, -250.0, 250.0, 50, -5.0, 5.0,
392  title="Vertex Y vs Z; Vertex Z [mm]; Vertex Y [mm]")
393  self.makeHisto2D('VertexXZoom', 'VertexYZoom', 'TH2F', 100, -0.250, 0.250, 100, -0.250, 0.250,
394  title="Vertex Y-Y_{nominal} vs X-X_{nominal}; Vertex X-X_{nominal} [mm]; Vertex Y-Y_{nominal} [mm]")
395 
396  self.makeHisto2D('VertexZ', 'VertexXerr', 'TH2F', 500, -250.0, 250.0, 100, 0.0, 1.0,
397  title="Vertex Xerr vs Z; Vertex Z [mm]; Vertex Xerr [mm]")
398  self.makeHisto2D('VertexZ', 'VertexYerr', 'TH2F', 500, -250.0, 250.0, 100, 0.0, 1.0,
399  title="Vertex Yerr vs Z; Vertex Z [mm]; Vertex Yerr [mm]")
400 
401  if detail >= 2:
402  # X(Y) vs Xerr(Yerr) for Bayesian Inference method
403  self.makeHisto2D('VertexXZoomPass', 'VertexXerrPass', 'TH2F', 400, -0.200, 0.200, 100, 0.0, 0.100,
404  title="Vertex Xerr vs X-X_{nominal}; Vertex X-X_{nominal} [mm]; Vertex Xerr [mm]")
405  self.makeHisto2D('VertexYZoomPass', 'VertexYerrPass', 'TH2F', 400, -0.200, 0.200, 100, 0.0, 0.100,
406  title="Vertex Yerr vs Y-Y_{nominal}; Vertex Y-Y_{nominal} [mm]; Vertex Yerr [mm]")
407 
408  if detail >= 3:
409  # former validation
410  self.makeHisto2D('VertexNTrks', 'VertexXerr', 'TH2F', 25, 5.0, 30.0, 100, 0.0, 1.0,
411  title="Vertex Xerr vs NTrks; Vertex N trks; Vertex Xerr [mm]")
412  self.makeHisto2D('VertexNTrks', 'VertexYerr', 'TH2F', 25, 5.0, 30.0, 100, 0.0, 1.0,
413  title="Vertex Yerr vs NTrks; Vertex N trks; Vertex Yerr [mm]")
414  self.makeHisto2D('VertexNTrks', 'VertexZerr', 'TH2F', 50, 0.0, 50.0, 100, 0.0, 1.0,
415  title="Vertex Zerr vs NTrks; Vertex N trks; Vertex Zerr [mm]")
416 
417 
418  def defineSplitVertexHistos(self, detail):
419  # split vertex-related variables:
420  # - SplitVertex1<param>Pass, where <param> is one of
421  # - NTrks X Y Z Xerr Yerr Zerr
422  # - SplitVertex2<param>Pass, same set of params
423  # - SplitVertexD<param>Pass, where <param> is one of
424  # - NTrks X Y Z Xerr Yerr Zerr Xpull Ypull Zpull
425 
426  if detail >= 1:
427  # Delta between the Split Vertex positions in X, Y, Z vs. Ntrk in vertex:
428  # allows to correct width for each vertex multiplicity
429  # Total number of bins: 150,000 -> 75,000
430  # 10 um bins in X and Y
431  # 2 mm bins in Z
432  self.makeLBNHisto2D('SplitVertexDNTrksPass', 'SplitVertexDXPass', 'TH2F', 100, 0.0, 50.0, 250, -1.25, 1.25,
433  title="Split Vertex DX vs. NTrks; N trk per split vertex; #Deltax between split vertices [mm]")
434  self.makeLBNHisto2D('SplitVertexDNTrksPass', 'SplitVertexDYPass', 'TH2F', 100, 0.0, 50.0, 250, -1.25, 1.25,
435  title="Split Vertex DY vs. NTrks; N trk per split vertex; #Deltay between split vertices [mm]")
436  self.makeLBNHisto2D('SplitVertexDNTrksPass', 'SplitVertexDZPass', 'TH2F', 100, 0.0, 50.0, 250, -2.5, 2.5,
437  title="Split Vertex DZ vs. NTrks; N trk per split vertex; #Deltaz between split vertices [mm]")
438  # same histograms, per run
439  self.makeHisto2D('SplitVertexDNTrksPass', 'SplitVertexDXPass', 'TH2F', 100, 0.0, 50.0, 250, -1.25, 1.25,
440  title="Split Vertex DX vs. NTrks (runsummary); N trk per split vertex; #Deltax between split vertices [mm]",
441  alias="SplitVertexDXPass_vs_SplitVertexDNTrksPass_runsummary")
442  self.makeHisto2D('SplitVertexDNTrksPass', 'SplitVertexDYPass', 'TH2F', 100, 0.0, 50.0, 250, -1.25, 1.25,
443  title="Split Vertex DY vs. NTrks (runsummary); N trk per split vertex; #Deltay between split vertices [mm]",
444  alias="SplitVertexDYPass_vs_SplitVertexDNTrksPass_runsummary")
445  self.makeHisto2D('SplitVertexDNTrksPass', 'SplitVertexDZPass', 'TH2F', 100, 0.0, 50.0, 250, -2.5, 2.5,
446  title="Split Vertex DZ vs. NTrks (runsummary); N trk per split vertex; #Deltaz between split vertices [mm]",
447  alias="SplitVertexDZPass_vs_SplitVertexDNTrksPass_runsummary")
448 
449  # Pull in X, Y, Z vs. Ntrk in split vertices: Monitors quality of tracking information
450  # Total number of bins: 30,000
451  # 0.1 sigma bins
452  self.makeHisto2D('SplitVertexDNTrksPass', 'SplitVertexDXpullPass', 'TH2F',
453  100, 0.0, 100.0, 100, -5.0, 5.0,
454  title="Acc. Split Vertex D X Pull vs. NTrks; N trk per vertex; Split Vertex x Pull")
455  self.makeHisto2D('SplitVertexDNTrksPass', 'SplitVertexDYpullPass', 'TH2F',
456  100, 0.0, 100.0, 100, -5.0, 5.0,
457  title="Acc. Split Vertex D Y Pull vs. NTrks; N trk per vertex; Split Vertex y Pull")
458  self.makeHisto2D('SplitVertexDNTrksPass', 'SplitVertexDZpullPass', 'TH2F',
459  100, 0.0, 100.0, 100, -5.0, 5.0,
460  title="Acc. Split Vertex D Z Pull vs. NTrks; N trk per vertex; Split Vertex z Pull")
461 
462  # Split vertex properties
463  self.makeHisto2D('SplitVertex2NTrksPass', 'SplitVertex1NTrksPass', 'TH2F',
464  50, 0, 50, 50, 0, 50,
465  title="Split Vertex 2 NTrks vs Split Vertex 1 NTrks")
466 
467 
469  """Monitoring for T2BSTrackFilter tool
470 
471  Variables defined by tool:
472  - TIME_TrackFilter
473  - TIME_TrackFilterBS
474  - TracksInput
475  - TrackRejectReason
476  - Tracks{filter}
477  - TrackPt{filter}
478  - TrackEta{filter}
479  - TrackPhi{filter}
480  - TrackZ0{filter}
481  - TrackD0{filter}
482  - TrackZ0Err{filter}
483  - TrackD0Err{filter}
484  - TrackNDF{filter}
485  - TrackQual{filter}
486  - TrackChi2Prob{filter}
487  - TrackSiHits{filter}
488  - TrackPIXHits{filter}
489  - TrackSCTHits{filter}
490  - TrackTRTHits{filter}
491 
492  where {filter} is one of "Filter" or "FilterBS"
493  """
494  def __init__ (self, flags, name="T2BSTrackFilterToolMonitoring", detail=1):
495  super(T2BSTrackFilterToolMonitoring, self).__init__(flags, name)
496 
497  self.makeHisto1D('TIME_TrackFilter', 'TH1I', 100, 0, 10000,
498  title="Timing of filter method; time [#mus];")
499  self.makeHisto1D('TIME_TrackFilterBS', 'TH1I', 100, 0, 10000,
500  title="Timing of filterBS method; time [#mus];")
501 
502  self.makeHisto1D('TracksInput', 'TH1F', 100, 0., 2000.,
503  title="Number of input tracks; Number of tracks; N events")
504  # labels correspond to T2TrackBeamSpotImpl::TrackRejectReason (number of reasons is numRejectResons)
505  self.makeLBNHisto1D('TrackRejectReason', 'TH1I', 15, xmin=0, xmax=15,
506  opt='kVec', title="TrackRejectReason ; Reason ; # of tracks",
507  xlabels=['PT', 'SiHits', 'PIXHits', 'SCTHits', 'TRTHits',
508  'NDF', 'D0', 'Z0', 'D0err', 'Z0err',
509  'Eta', 'MinQual', 'MaxQual', 'Chi2Prob', 'D0Chi2'])
510 
511  for filter in ("Filter", "FilterBS"):
512 
513  self.makeHisto1D(f'Tracks{filter}', 'TH1F', 100, 0., 400.,
514  title="Number of tracks filtered tracks; N accepted tracks; N events")
515 
516  # Track d0 vs phi: another method for extracting the beam position on average
517  # Total number of bins: 70
518  self.makeLBNHisto2D(f'TrackPhi{filter}', f'TrackD0{filter}', 'TH2I',
519  50, -3.5, 3.5, 50, -2, 2,
520  title="Selected Track d_{0} vs #phi; Track #phi; Track d_{0}")
521 
522  # ACCEPTED Tracks parameters
523  #-------------------------------------------------------------------------------------------------
524  self.makeHisto1D(f'TrackPt{filter}', 'TH1F', 50, 0.0, 50.0,
525  title="Acc. Track Pt; p_{t} [GeV]; Number of tracks")
526  self.makeHisto1D(f'TrackEta{filter}', 'TH1F', 60, -3.0, 3.0,
527  title="Acc. Track Eta; #eta; Number of tracks")
528  self.makeHisto1D(f'TrackPhi{filter}', 'TH1F', 70, -3.5, 3.5,
529  title="Acc. Track Phi; #phi; Number of tracks")
530  self.makeHisto1D(f'TrackZ0{filter}', 'TH1F', 100, -200.0, 200.0,
531  title="Acc. Track Z0; Track z0 [mm]; Number of tracks")
532  self.makeHisto1D(f'TrackD0{filter}', 'TH1F', 100, -10.0, 10.0,
533  title="Acc. Track D0; Track d0 [mm]; Number of tracks")
534  self.makeHisto1D(f'TrackZ0err{filter}', 'TH1F', 100, 0., 5.,
535  title="Acc. Track Z0err; Track z0 error [mm]; Number of tracks")
536  self.makeHisto1D(f'TrackD0err{filter}', 'TH1F', 100, 0., 5.,
537  title="Acc. Track D0err; Track d0 error [mm]; Number of tracks")
538  self.makeHisto1D(f'TrackNDF{filter}', 'TH1F', 10, -0.5, 19.5,
539  title="Acc. Track NDF; Track NDF; Number of tracks")
540  self.makeHisto1D(f'TrackQual{filter}', 'TH1F', 50, 0., 10.,
541  title="Acc. Track Qual; Track #chi^{2}/ndf; Number of tracks")
542  self.makeHisto1D(f'TrackChi2Prob{filter}', 'TH1F', 70, -0.2, 1.2,
543  title="Acc. Track #chi^{2} probability; Track #chi^{2} probability; Number of tracks")
544  #Accepted Track hits in ID
545  self.makeHisto1D(f'TrackSiHits{filter}', 'TH1I', 12, 0, 12,
546  title="Acc. Track Silicon hits; N Si hits; Number of tracks")
547  self.makeHisto1D(f'TrackTRTHits{filter}', 'TH1I', 50, 0, 50,
548  title="Acc. Track TRT hits; N TRT hits; Number of tracks")
549  self.makeHisto1D(f'TrackPIXHits{filter}', 'TH1I', 7, 0, 7,
550  title="Acc. Track PIX hits; N PIX hits; Number of tracks")
551  self.makeHisto1D(f'TrackSCTHits{filter}', 'TH1I', 9, 0, 9,
552  title="Acc. Track SCT hits; N SCT hits; Number of tracks")
553 
554 
556  """Monitoring for T2TrackBeamSpot tool
557 
558  Variables defined by tool:
559  - BeamLSMatrices
560  - BeamLSMatricesBCID
561  - TrackLLPolyCoeff
562  """
563  def __init__ (self, flags, name="T2TrackBeamSpotToolMonitoring", detail=1):
564  super(T2TrackBeamSpotToolMonitoring, self).__init__(flags, name)
565 
566  self.makeHisto1D('TIME_updateBS', 'TH1I', 100, 0, 10000,
567  title="Timing beamspot update; time [#mus];")
568 
569  self.makeLBNHisto1D('BeamLSMatrices', 'TH1D', 18, 0, 18, opt='kVec',
570  title="BeamLSMatrices ; Element ; Value",
571  xlabels=['A_x_x', 'A_x_y', 'A_y_y', 'A_x_tx', 'A_y_tx',
572  'A_tx_tx', 'A_x_ty', 'A_y_ty', 'A_tx_ty', 'A_ty_ty',
573  'B_x', 'B_y', 'B_tx', 'B_ty', 'd0^2',
574  'z0', 'z0^2', '#'])
575 
576  self.makeLBNHisto1D('BeamLSMatricesBCID', 'TH1D', 3564*8, 0, 3564*8, opt='kVec',
577  title="BeamLSMatricesBCID ; Element ; Value")
578 
579  # for number of bins see T2TrackBSLLPoly::nbins()
580  self.makeLBNHisto1D('TrackLLPolyCoeff', 'TH1D', 100, 0, 100, opt='kVec',
581  title="TrackLLPolyCoeff ; Coefficient ; Value")
T2VertexBeamSpotMonitoring.T2VertexBeamSpotToolMonitoring.defineSplitVertexHistos
def defineSplitVertexHistos(self, detail)
Definition: T2VertexBeamSpotMonitoring.py:418
T2VertexBeamSpotMonitoring.T2VertexBeamSpotMonitoring.__init__
def __init__(self, flags, name="T2VertexBeamSpotMonitoring")
Definition: T2VertexBeamSpotMonitoring.py:67
T2VertexBeamSpotMonitoring.T2VertexBeamSpotToolMonitoring.defineVertexHistos
def defineVertexHistos(self, detail)
Definition: T2VertexBeamSpotMonitoring.py:163
T2VertexBeamSpotMonitoring.BaseMonitoringTool
Definition: T2VertexBeamSpotMonitoring.py:9
T2VertexBeamSpotMonitoring.BaseMonitoringTool.makeHisto2D
def makeHisto2D(self, nameX, nameY, type, xbins, xmin, xmax, ybins, ymin, ymax, title, path='EXPERT', opt=None, alias=None, **kw)
Definition: T2VertexBeamSpotMonitoring.py:30
T2VertexBeamSpotMonitoring.BaseMonitoringTool.makeLBNHisto2D
def makeLBNHisto2D(self, nameX, nameY, type, xbins, xmin, xmax, ybins, ymin, ymax, title, path='EXPERT', opt="", **kw)
Definition: T2VertexBeamSpotMonitoring.py:42
T2VertexBeamSpotMonitoring.T2BSTrackFilterToolMonitoring
Definition: T2VertexBeamSpotMonitoring.py:468
T2VertexBeamSpotMonitoring.BaseMonitoringTool.makeLBNHisto1D
def makeLBNHisto1D(self, name, type, xbins, xmin, xmax, title, path='EXPERT', opt="", **kw)
Definition: T2VertexBeamSpotMonitoring.py:24
T2VertexBeamSpotMonitoring.T2VertexBeamSpotToolMonitoring
Definition: T2VertexBeamSpotMonitoring.py:80
T2VertexBeamSpotMonitoring.BaseMonitoringTool.makeLBNProfile
def makeLBNProfile(self, nameX, nameY, xbins, xmin, xmax, title, path='EXPERT', opt="", **kw)
Definition: T2VertexBeamSpotMonitoring.py:59
T2VertexBeamSpotMonitoring.T2BSTrackFilterToolMonitoring.__init__
def __init__(self, flags, name="T2BSTrackFilterToolMonitoring", detail=1)
Definition: T2VertexBeamSpotMonitoring.py:494
T2VertexBeamSpotMonitoring.T2VertexBeamSpotMonitoring
Definition: T2VertexBeamSpotMonitoring.py:66
T2VertexBeamSpotMonitoring.BaseMonitoringTool.makeProfile
def makeProfile(self, nameX, nameY, xbins, xmin, xmax, title, path='EXPERT', opt=None, alias=None, **kw)
Definition: T2VertexBeamSpotMonitoring.py:50
T2VertexBeamSpotMonitoring.T2VertexBeamSpotToolMonitoring.defineTimingHistos
def defineTimingHistos(self, detail)
Definition: T2VertexBeamSpotMonitoring.py:111
T2VertexBeamSpotMonitoring.BaseMonitoringTool.monTool
monTool
Definition: T2VertexBeamSpotMonitoring.py:14
T2VertexBeamSpotMonitoring.T2VertexBeamSpotToolMonitoring.defineClusterHistos
def defineClusterHistos(self, detail)
Definition: T2VertexBeamSpotMonitoring.py:136
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
T2VertexBeamSpotMonitoring.T2TrackBeamSpotToolMonitoring.__init__
def __init__(self, flags, name="T2TrackBeamSpotToolMonitoring", detail=1)
Definition: T2VertexBeamSpotMonitoring.py:563
GenericMonitoringTool
Definition: GenericMonitoringTool.py:1
T2VertexBeamSpotMonitoring.BaseMonitoringTool.__init__
def __init__(self, flags, name)
Definition: T2VertexBeamSpotMonitoring.py:13
T2VertexBeamSpotMonitoring.BaseMonitoringTool.makeHisto1D
def makeHisto1D(self, name, type, xbins, xmin, xmax, title, path='EXPERT', opt=None, alias=None, **kw)
Definition: T2VertexBeamSpotMonitoring.py:16
GenericMonitoringTool.defineHistogram
def defineHistogram(flags, varname, type='TH1F', path=None, title=None, weight=None, xbins=100, xmin=0, xmax=1, xlabels=None, ybins=None, ymin=None, ymax=None, ylabels=None, zmin=None, zmax=None, zlabels=None, opt=None, convention=None, cutmask=None, treedef=None, merge=None)
Generate histogram definition string for the GenericMonitoringTool.Histograms property.
Definition: GenericMonitoringTool.py:306
T2VertexBeamSpotMonitoring.T2TrackBeamSpotToolMonitoring
Definition: T2VertexBeamSpotMonitoring.py:555
T2VertexBeamSpotMonitoring.T2VertexBeamSpotToolMonitoring.__init__
def __init__(self, flags, name="T2VertexBeamSpotToolMonitoring", detail=2)
Definition: T2VertexBeamSpotMonitoring.py:81