diff --git a/Trigger/TrigAlgorithms/TrigT2BeamSpot/python/T2VertexBeamSpotConfig.py b/Trigger/TrigAlgorithms/TrigT2BeamSpot/python/T2VertexBeamSpotConfig.py index 457a087203eaf71b11733ef95fa31818a6b896c7..2d4655e8ee4ec3a1fd704163a65890641dbced3c 100644 --- a/Trigger/TrigAlgorithms/TrigT2BeamSpot/python/T2VertexBeamSpotConfig.py +++ b/Trigger/TrigAlgorithms/TrigT2BeamSpot/python/T2VertexBeamSpotConfig.py @@ -19,7 +19,7 @@ bsAlgMonitoring = T2VertexBeamSpotMonitoring() # track filter tool used by vertex tool trackFilterForVertex = PESA__T2BSTrackFilterTool( name = "TrackFilterVtx", - MonTool = filtermon, + MonTool = filtermon(), TrackMinPt = 0.5, # Minimum track pT to be considered for vertexing TrackMaxEta = 2.5, # Maximum absolute value of eta TrackMaxZ0 = 200.0, # Maximum track Z0 to be considered for vertexing @@ -42,7 +42,7 @@ trackFilterForVertex = PESA__T2BSTrackFilterTool( # track filter tool used by track tool trackFilterForTrack = PESA__T2BSTrackFilterTool( name = "TrackFilterTrk", - MonTool = filtermon, + MonTool = filtermon(), TrackMinPt = 0.5, # Minimum track pT to be considered for vertexing TrackMaxEta = 2.5, # Maximum absolute value of eta TrackMaxZ0 = 200.0, # Maximum track Z0 to be considered for vertexing @@ -65,7 +65,7 @@ trackFilterForTrack = PESA__T2BSTrackFilterTool( #TODO: create an instance which can be called and adjusted InDetTrigMTBeamSpotTool = PESA__T2VertexBeamSpotTool( name = "T2VertexBeamSpotTool", - MonTool = bsToolMonitoring, + MonTool = bsToolMonitoring(), TrackFilter = trackFilterForVertex, PrimaryVertexFitter = primaryVertexFitter, @@ -93,7 +93,7 @@ InDetTrigMTBeamSpotTool = PESA__T2VertexBeamSpotTool( InDetTrigMTTrackBeamSpotTool = PESA__T2TrackBeamSpotTool( name = "T2TrackBeamSpotTool", TrackFilter = trackFilterForTrack, - MonTool = trackBSmon, + MonTool = trackBSmon(), doLeastSquares = True, doLogLikelihood = True, beamSizeLS = 0.01, # Approximate beam size, mm @@ -106,7 +106,7 @@ class T2VertexBeamSpot_Fex ( PESA__T2VertexBeamSpot ) : self.doTrackBeamSpot = True # run track-based calibration tool self.TrackBeamSpotTool = InDetTrigMTTrackBeamSpotTool self.BeamSpotTool = InDetTrigMTBeamSpotTool - self.MonTool = bsAlgMonitoring + self.MonTool = bsAlgMonitoring() # Setup for relaxed cuts at 900 GeV LHC center-of-mass class T2VertexBeamSpot_loose ( T2VertexBeamSpot_Fex ) : diff --git a/Trigger/TrigAlgorithms/TrigT2BeamSpot/python/T2VertexBeamSpotMonitoring.py b/Trigger/TrigAlgorithms/TrigT2BeamSpot/python/T2VertexBeamSpotMonitoring.py index 37c3f72ceeeca099650af6f819f1a999fa2cf712..bca834c78b3f911897c205dfaefa15c335a519e7 100644 --- a/Trigger/TrigAlgorithms/TrigT2BeamSpot/python/T2VertexBeamSpotMonitoring.py +++ b/Trigger/TrigAlgorithms/TrigT2BeamSpot/python/T2VertexBeamSpotMonitoring.py @@ -1,18 +1,25 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration -from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool +from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram -class BaseMonitoringTool(GenericMonitoringTool): +class BaseMonitoringTool: """Base class which defines few useful methods to cope with defineHistogram madness. """ + def __init__(self, name): + self.name = name + self.histograms = [] + + def __call__(self): + """Creates the actual monitoring tool instance""" + return GenericMonitoringTool(self.name, Histograms = self.histograms) def makeHisto1D(self, name, type, xbins, xmin, xmax, title, path='EXPERT', opt=None, **kw): - self.defineHistogram( + self.histograms += [defineHistogram( name, path=path, type=type, title=title, opt=opt, xbins=xbins, xmin=xmin, xmax=xmax, **kw - ) + )] def makeLBNHisto1D(self, name, type, xbins, xmin, xmax, title, path='EXPERT', opt="", **kw): opt = "kLBNHistoryDepth=1 " + opt if opt else "kLBNHistoryDepth=1" @@ -23,12 +30,12 @@ class BaseMonitoringTool(GenericMonitoringTool): def makeHisto2D(self, nameX, nameY, type, xbins, xmin, xmax, ybins, ymin, ymax, title, path='EXPERT', opt=None, **kw): name = ", ".join([nameX, nameY]) - self.defineHistogram( + self.histograms += [defineHistogram( name, path=path, type=type, title=title, opt=opt, xbins=xbins, xmin=xmin, xmax=xmax, ybins=ybins, ymin=ymin, ymax=ymax, **kw - ) + )] def makeLBNHisto2D(self, nameX, nameY, type, xbins, xmin, xmax, ybins, ymin, ymax, title, path='EXPERT', opt="", **kw): @@ -40,10 +47,10 @@ class BaseMonitoringTool(GenericMonitoringTool): def makeProfile(self, nameX, nameY, xbins, xmin, xmax, title, path='EXPERT', opt=None, **kw): name = ", ".join([nameX, nameY]) - self.defineHistogram( + self.histograms += [defineHistogram( name, path=path, type="TProfile", title=title, opt=opt, xbins=xbins, xmin=xmin, xmax=xmax, **kw, - ) + )] def makeLBNProfile(self, nameX, nameY, xbins, xmin, xmax, title, path='EXPERT', opt="", **kw): opt = "kLBNHistoryDepth=1 " + opt if opt else "kLBNHistoryDepth=1"