Skip to content
Snippets Groups Projects
Commit 7fa1e26b authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

TrigMissingETHypo: Make python code flake8 compliant

Fix python warnings and add flake8 unit test.
parent 0f74a9e2
No related branches found
No related tags found
No related merge requests found
......@@ -25,11 +25,16 @@ atlas_add_component( TrigMissingETHypo
INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
LINK_LIBRARIES ${CLHEP_LIBRARIES} TrigInterfacesLib TrigTimeAlgsLib xAODTrigMissingET GaudiKernel TrigMissingEtEvent DecisionHandling )
atlas_add_test( TrigMissingETHypoConfigMT SCRIPT python -m TrigMissingETHypo.TrigMissingETHypoConfigMT
PROPERTIES TIMEOUT 300
POST_EXEC_SCRIPT nopost.sh )
# Install files from the package:
atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/TriggerConfig_*.py )
# Unit tests:
atlas_add_test( TrigMissingETHypoConfigMT SCRIPT python -m TrigMissingETHypo.TrigMissingETHypoConfigMT
PROPERTIES TIMEOUT 300
POST_EXEC_SCRIPT nopost.sh )
# Check Python syntax:
atlas_add_test( flake8
SCRIPT flake8 --select=ATL,F,E7,E9,W6 --enable-extension=ATL900,ATL901 ${CMAKE_CURRENT_SOURCE_DIR}/python
POST_EXEC_SCRIPT nopost.sh )
# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
from TrigMissingETHypo.TrigMissingETHypoConf import TrigEFMissingETHypo
......@@ -21,11 +21,11 @@ class EFMissingETHypoBase (TrigEFMissingETHypo):
def onlineMonitoring(self, full=False):
if "TrigEFMissingETHypoOnlineMonitoring" not in [t.name() for t in self.AthenaMonTools]:
from TrigMissingETHypo.TrigMissingETHypoMonitoring import TrigEFMissingETHypoOnlineMonitoring, TrigEFMissingETHypoFullOnlineMonitoring
from TrigMissingETHypo.TrigMissingETHypoMonitoring import TrigEFMissingETHypoOnlineMonitoring
online = TrigEFMissingETHypoOnlineMonitoring()
self.AthenaMonTools += [ online ]
if full == True and "TrigEFMissingETHypoFullOnlineMonitoring" not in [t.name() for t in self.AthenaMonTools]:
if full is True and "TrigEFMissingETHypoFullOnlineMonitoring" not in [t.name() for t in self.AthenaMonTools]:
from TrigMissingETHypo.TrigMissingETHypoMonitoring import TrigEFMissingETHypoFullOnlineMonitoring
onlineFull = TrigEFMissingETHypoFullOnlineMonitoring()
self.AthenaMonTools += [ onlineFull ]
......
......@@ -2,9 +2,6 @@
from TrigMissingETHypo.TrigMissingETHypoConf import TrigMissingETHypoAlgMT, TrigMissingETHypoToolMT
from AthenaCommon.SystemOfUnits import GeV
class MissingETHypoAlgMT(TrigMissingETHypoAlgMT):
__slots__ = []
def __init__(self, name, hTools=[], metKey=""):
......@@ -77,9 +74,6 @@ def TrigMETPufitHypoToolFromName(name, conf):
return MissingETHypoToolMT(name, alg='pufit')
def TrigMETPufitHypoToolFromName(name, conf):
return MissingETHypoToolMT(name, alg='pufit')
def TrigMETJetHypoToolFromName(name, conf):
return MissingETHypoToolMT(name, alg='mht')
......
......@@ -9,29 +9,26 @@ class TrigMissingETHypoMonitoringToolBase(GenericMonitoringTool):
self.Histograms = []
hEx_log = defineHistogram('Hypo_MEx_log', type='TH1F', path='EXPERT', title="Missing E_{x};sgn(ME_{x}) log_{10}(ME_{x}/GeV)", xbins=41, xmin=-5.075, xmax=5.075)
hEy_log = defineHistogram('Hypo_MEy_log', type='TH1F', path='EXPERT', title="Missing E_{y};sgn(ME_{y}) log_{10}(ME_{y}/GeV)", xbins=41, xmin=-5.075, xmax=5.075)
hEz_log = defineHistogram('Hypo_MEz_log', type='TH1F', path='EXPERT', title="Missing E_{z};sgn(ME_{z}) log_{10}(ME_{z}/GeV)", xbins=41, xmin=-5.075, xmax=5.075)
hMET_log = defineHistogram('Hypo_MET_log', type='TH1F', path='EXPERT', title="|Missing E_{T}|;log_{10}(ME_{T}/GeV)", xbins=35, xmin=-1.875, xmax=5.375)
hSumEt_log = defineHistogram('Hypo_SumEt_log', type='TH1F', path='EXPERT', title="Sum |E_{T}|;log_{10}(SumE_{T}/GeV)", xbins=35, xmin=-1.875, xmax=5.125)
self.hEx_log = defineHistogram('Hypo_MEx_log', type='TH1F', path='EXPERT', title="Missing E_{x};sgn(ME_{x}) log_{10}(ME_{x}/GeV)", xbins=41, xmin=-5.075, xmax=5.075)
self.hEy_log = defineHistogram('Hypo_MEy_log', type='TH1F', path='EXPERT', title="Missing E_{y};sgn(ME_{y}) log_{10}(ME_{y}/GeV)", xbins=41, xmin=-5.075, xmax=5.075)
self.hEz_log = defineHistogram('Hypo_MEz_log', type='TH1F', path='EXPERT', title="Missing E_{z};sgn(ME_{z}) log_{10}(ME_{z}/GeV)", xbins=41, xmin=-5.075, xmax=5.075)
self.hMET_log = defineHistogram('Hypo_MET_log', type='TH1F', path='EXPERT', title="|Missing E_{T}|;log_{10}(ME_{T}/GeV)", xbins=35, xmin=-1.875, xmax=5.375)
self.hSumEt_log = defineHistogram('Hypo_SumEt_log', type='TH1F', path='EXPERT', title="Sum |E_{T}|;log_{10}(SumE_{T}/GeV)", xbins=35, xmin=-1.875, xmax=5.125)
hEx_lin = defineHistogram('Hypo_MEx_lin', type='TH1F', path='EXPERT', title="Missing E_{x};ME_{x} (GeV)", xbins=199, xmin=-298.5, xmax=298.5)
hEy_lin = defineHistogram('Hypo_MEy_lin', type='TH1F', path='EXPERT', title="Missing E_{y};ME_{y} (GeV)", xbins=199, xmin=-298.5, xmax=298.5)
hEz_lin = defineHistogram('Hypo_MEz_lin', type='TH1F', path='EXPERT', title="Missing E_{z};ME_{z} (GeV)", xbins=199, xmin=-298.5, xmax=298.5)
hMET_lin = defineHistogram('Hypo_MET_lin', type='TH1F', path='EXPERT', title="|Missing E_{T}|;ME_{T} (GeV)", xbins=105, xmin=-13.5, xmax=301.5)
hSumEt_lin = defineHistogram('Hypo_SumEt_lin', type='TH1F', path='EXPERT', title="Sum |E_{T}|;SumE_{T} (GeV)", xbins=155, xmin=-27., xmax=2000.)
self.hEx_lin = defineHistogram('Hypo_MEx_lin', type='TH1F', path='EXPERT', title="Missing E_{x};ME_{x} (GeV)", xbins=199, xmin=-298.5, xmax=298.5)
self.hEy_lin = defineHistogram('Hypo_MEy_lin', type='TH1F', path='EXPERT', title="Missing E_{y};ME_{y} (GeV)", xbins=199, xmin=-298.5, xmax=298.5)
self.hEz_lin = defineHistogram('Hypo_MEz_lin', type='TH1F', path='EXPERT', title="Missing E_{z};ME_{z} (GeV)", xbins=199, xmin=-298.5, xmax=298.5)
self.hMET_lin = defineHistogram('Hypo_MET_lin', type='TH1F', path='EXPERT', title="|Missing E_{T}|;ME_{T} (GeV)", xbins=105, xmin=-13.5, xmax=301.5)
self.hSumEt_lin = defineHistogram('Hypo_SumEt_lin', type='TH1F', path='EXPERT', title="Sum |E_{T}|;SumE_{T} (GeV)", xbins=155, xmin=-27., xmax=2000.)
hMETPhi = defineHistogram('Hypo_MET_phi', type='TH1F', path='EXPERT', title="MET #phi;#phi (rad)", xbins=32, xmin=-3.1416, xmax=3.1416)
hXS = defineHistogram('Hypo_XS', type='TH1F', path='EXPERT', title="EF Significance; (XS/GeV^{1/2})", xbins=40, xmin=-0.025, xmax=20.025)
hXS2 = defineHistogram('Hypo_XS2', type='TH1F', path='EXPERT', title="EF Significance 2; (XS2/GeV^{1/2})", xbins=40, xmin=-0.025, xmax=20.025)
self.hMETPhi = defineHistogram('Hypo_MET_phi', type='TH1F', path='EXPERT', title="MET #phi;#phi (rad)", xbins=32, xmin=-3.1416, xmax=3.1416)
self.hXS = defineHistogram('Hypo_XS', type='TH1F', path='EXPERT', title="EF Significance; (XS/GeV^{1/2})", xbins=40, xmin=-0.025, xmax=20.025)
self.hXS2 = defineHistogram('Hypo_XS2', type='TH1F', path='EXPERT', title="EF Significance 2; (XS2/GeV^{1/2})", xbins=40, xmin=-0.025, xmax=20.025)
class TrigMissingETHypoMonitoringTool(TrigMissingETHypoMonitoringToolBase):
def __init__ (self, name="TrigMissingETHypoMonitoringTool"):
super(TrigMissingETHypoMonitoringTool, self).__init__(name)
self.defineTarget("Validation")
# self.Histograms = [ hCuts ]
self.Histograms += [ hEx_log, hEy_log, hEz_log, hMET_log, hSumEt_log ]
self.Histograms += [ hEx_lin, hEy_lin, hEz_lin, hMET_lin, hSumEt_lin, hMETPhi, hXS, hXS2 ]
self.Histograms += [ self.hEx_log, self.hEy_log, self.hEz_log, self.hMET_log, self.hSumEt_log ]
self.Histograms += [ self.hEx_lin, self.hEy_lin, self.hEz_lin, self.hMET_lin, self.hSumEt_lin, self.hMETPhi, self.hXS, self.hXS2 ]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment