From a8af547532e9deb7c2fe2909cd3796b8afae3f3b Mon Sep 17 00:00:00 2001 From: Tadej Novak <tadej.novak@cern.ch> Date: Wed, 23 Dec 2020 11:48:07 +0100 Subject: [PATCH] CP algs: Use POOL access for now and unify Athena tests --- .../share/EventAlgorithmsTest_jobOptions.py | 2 +- .../GeneratorAlgorithmsTest_jobOptions.py | 2 +- .../share/OverlapAlgorithmsTest_jobOptions.py | 2 +- ...EgammaAnalysisAlgorithmsTest_jobOptions.py | 2 +- .../FTagAnalysisAlgorithmsTest_jobOptions.py | 2 +- ...nalysisAlgorithmsTest_EMTopo_jobOptions.py | 2 +- ...AnalysisAlgorithmsTest_PFlow_jobOptions.py | 2 +- .../MetAnalysisAlgorithmsTest_jobOptions.py | 2 +- .../MuonAnalysisAlgorithmsTest_jobOptions.py | 68 +++++++------------ .../TauAnalysisAlgorithmsTest_jobOptions.py | 2 +- .../share/TriggerAlgorithmsTest_jobOptions.py | 2 +- 11 files changed, 33 insertions(+), 55 deletions(-) diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/EventAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/EventAlgorithmsTest_jobOptions.py index 6fd7280dd7e3..d75605f77b0c 100644 --- a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/EventAlgorithmsTest_jobOptions.py +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/EventAlgorithmsTest_jobOptions.py @@ -22,7 +22,7 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA', "afii": 'ASG_TEST_FILE_MC_AFII'} # Set up the reading of the input file: -import AthenaRootComps.ReadAthenaxAODHybrid +import AthenaPoolCnvSvc.ReadAthenaPool theApp.EvtMax = 500 testFile = os.getenv ( inputfile[dataType] ) svcMgr.EventSelector.InputCollections = [testFile] diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/GeneratorAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/GeneratorAlgorithmsTest_jobOptions.py index bae994afbe05..5bff87b56399 100644 --- a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/GeneratorAlgorithmsTest_jobOptions.py +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/GeneratorAlgorithmsTest_jobOptions.py @@ -21,7 +21,7 @@ inputfile = {"mc": 'ASG_TEST_FILE_MC', "afii": 'ASG_TEST_FILE_MC_AFII'} # Set up the reading of the input file: -import AthenaRootComps.ReadAthenaxAODHybrid +import AthenaPoolCnvSvc.ReadAthenaPool theApp.EvtMax = 500 testFile = os.getenv ( inputfile[dataType] ) svcMgr.EventSelector.InputCollections = [testFile] diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/OverlapAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/OverlapAlgorithmsTest_jobOptions.py index 607ba7885078..053cf2943532 100644 --- a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/OverlapAlgorithmsTest_jobOptions.py +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/OverlapAlgorithmsTest_jobOptions.py @@ -22,7 +22,7 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA', "afii": 'ASG_TEST_FILE_MC_AFII'} # Set up the reading of the input file: -import AthenaRootComps.ReadAthenaxAODHybrid +import AthenaPoolCnvSvc.ReadAthenaPool theApp.EvtMax = 500 testFile = os.getenv ( inputfile[dataType] ) svcMgr.EventSelector.InputCollections = [testFile] diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_jobOptions.py index a3124542462f..8f04fdf374a0 100644 --- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_jobOptions.py +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_jobOptions.py @@ -22,7 +22,7 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA', "afii": 'ASG_TEST_FILE_MC_AFII'} # Set up the reading of the input file: -import AthenaRootComps.ReadAthenaxAODHybrid +import AthenaPoolCnvSvc.ReadAthenaPool theApp.EvtMax = 500 testFile = os.getenv ( inputfile[dataType] ) svcMgr.EventSelector.InputCollections = [testFile] diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_jobOptions.py index d776511c9ce8..e6f6f0aeca8e 100644 --- a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_jobOptions.py +++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_jobOptions.py @@ -22,7 +22,7 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA', "afii": 'ASG_TEST_FILE_MC_AFII'} # Set up the reading of the input file: -import AthenaRootComps.ReadAthenaxAODHybrid +import AthenaPoolCnvSvc.ReadAthenaPool theApp.EvtMax = 500 testFile = os.getenv ( inputfile[dataType] ) svcMgr.EventSelector.InputCollections = [testFile] diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_jobOptions.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_jobOptions.py index aaaa35b50e71..f1a8f48865b2 100644 --- a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_jobOptions.py +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_jobOptions.py @@ -24,7 +24,7 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA', jetContainer = "AntiKt4EMTopoJets" # Set up the reading of the input file: -import AthenaRootComps.ReadAthenaxAODHybrid +import AthenaPoolCnvSvc.ReadAthenaPool theApp.EvtMax = 500 testFile = os.getenv ( inputfile[dataType] ) svcMgr.EventSelector.InputCollections = [testFile] diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_jobOptions.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_jobOptions.py index 3ad9c2a04f1a..de9ba9c43896 100644 --- a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_jobOptions.py +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_jobOptions.py @@ -24,7 +24,7 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA', jetContainer = "AntiKt4EMTopoJets" # Set up the reading of the input file: -import AthenaRootComps.ReadAthenaxAODHybrid +import AthenaPoolCnvSvc.ReadAthenaPool theApp.EvtMax = 500 testFile = os.getenv ( inputfile[dataType] ) svcMgr.EventSelector.InputCollections = [testFile] diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/share/MetAnalysisAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/share/MetAnalysisAlgorithmsTest_jobOptions.py index 0c13735ea0bf..6b949c02f98e 100644 --- a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/share/MetAnalysisAlgorithmsTest_jobOptions.py +++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/share/MetAnalysisAlgorithmsTest_jobOptions.py @@ -22,7 +22,7 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA', "afii": 'ASG_TEST_FILE_MC_AFII'} # Set up the reading of the input file: -import AthenaRootComps.ReadAthenaxAODHybrid +import AthenaPoolCnvSvc.ReadAthenaPool theApp.EvtMax = 500 testFile = os.getenv ( inputfile[dataType] ) svcMgr.EventSelector.InputCollections = [testFile] diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/share/MuonAnalysisAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/share/MuonAnalysisAlgorithmsTest_jobOptions.py index 1bf25efdc24a..de5537baa546 100644 --- a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/share/MuonAnalysisAlgorithmsTest_jobOptions.py +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/share/MuonAnalysisAlgorithmsTest_jobOptions.py @@ -1,47 +1,31 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # -# @author Nils Krumnack, Will Buttinger +# @author Nils Krumnack -#User options, which can be set from command line after a "-" character -#athena MuonAnalysisAlgorithmsTest_jobOptions.py - --myOption ... +# User options, which can be set from command line after a "-" character +# athena MuonAnalysisAlgorithmsTest_jobOptions.py - --myOption ... from AthenaCommon.AthArgumentParser import AthArgumentParser athArgsParser = AthArgumentParser() -athArgsParser.add_argument("--data-type",action="store",dest="data_type", - default="data", - help="Type of data to run over. Valid options are data, mc, afii") -athArgsParser.add_argument("--write-xaod",action="store",dest="write_xaod", - default=False, - help="Specify if you want xaod writing to happen (which means slower access mode for now)") +athArgsParser.add_argument("--data-type", action = "store", dest = "data_type", + default = "data", + help = "Type of input to run over. Valid options are 'data', 'mc', 'afii'") athArgs = athArgsParser.parse_args() - -if athArgs.write_xaod: - #currently we must use POOLAccess mode when writing an xAOD - jps.AthenaCommonFlags.AccessMode = "POOLAccess" -else: - #ClassAccess is much faster than POOLAccess - jps.AthenaCommonFlags.AccessMode = "ClassAccess" - dataType = athArgs.data_type +if not dataType in ["data", "mc", "afii"] : + raise Exception ("invalid data type: " + dataType) -# Set up a histogram/tree output file for the job: -jps.AthenaCommonFlags.HistOutputs = ["ANALYSIS:MuonAnalysisAlgorithmsTest." + dataType + ".hist.root"] -svcMgr.THistSvc.MaxFileSize=-1 #make job run faster by disabling file size check - -#set a default file and number of events to process -#can override with standard athena command line options (--evtMax and --filesInput) -jps.AthenaCommonFlags.EvtMax = 500 - -if dataType=="data": - testFile = os.getenv ('ASG_TEST_FILE_DATA') -elif dataType=="mc": - testFile = os.getenv ('ASG_TEST_FILE_MC') -elif dataType=="afii": - testFile = os.getenv ('ASG_TEST_FILE_MC_AFII') - -jps.AthenaCommonFlags.FilesInput = [testFile] +print("Running on data type: " + dataType) +inputfile = {"data": 'ASG_TEST_FILE_DATA', + "mc": 'ASG_TEST_FILE_MC', + "afii": 'ASG_TEST_FILE_MC_AFII'} +# Set up the reading of the input file: +import AthenaPoolCnvSvc.ReadAthenaPool +theApp.EvtMax = 500 +testFile = os.getenv ( inputfile[dataType] ) +svcMgr.EventSelector.InputCollections = [testFile] from MuonAnalysisAlgorithms.MuonAnalysisAlgorithmsTest import makeSequence algSeq = makeSequence (dataType) @@ -50,17 +34,11 @@ print (algSeq) # For debugging # Add all algorithms from the sequence to the job. athAlgSeq += algSeq -# Write a mini-xAOD if requested: -if athArgs.write_xaod: - from OutputStreamAthenaPool.MultipleStreamManager import MSMgr - minixAOD = MSMgr.NewPoolRootStream( 'AAOD_MUON', - FileName = 'MuonAnalysisAlgorithmsTest.AAOD_MUON.pool.root' ) - minixAOD.AddItem( - [ 'xAOD::EventInfo#EventInfo', - 'xAOD::EventAuxInfo#EventInfoAux.-', - 'xAOD::MuonContainer#AnalysisMuons_NOSYS', - 'xAOD::AuxContainerBase#AnalysisMuons_NOSYSAux.eta.phi.pt' ] ) - +# Set up a histogram output file for the job: +ServiceMgr += CfgMgr.THistSvc() +ServiceMgr.THistSvc.Output += [ + "ANALYSIS DATAFILE='MuonAnalysisAlgorithmsTest." + dataType + ".hist.root' OPT='RECREATE'" + ] # Reduce the printout from Athena: include( "AthAnalysisBaseComps/SuppressLogging.py" ) diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/share/TauAnalysisAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/share/TauAnalysisAlgorithmsTest_jobOptions.py index a83dc7c63755..d15a7339611f 100644 --- a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/share/TauAnalysisAlgorithmsTest_jobOptions.py +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/share/TauAnalysisAlgorithmsTest_jobOptions.py @@ -22,7 +22,7 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA', "afii": 'ASG_TEST_FILE_MC_AFII'} # Set up the reading of the input file: -import AthenaRootComps.ReadAthenaxAODHybrid +import AthenaPoolCnvSvc.ReadAthenaPool theApp.EvtMax = 500 testFile = os.getenv ( inputfile[dataType] ) svcMgr.EventSelector.InputCollections = [testFile] diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_jobOptions.py index 8bd9e31e5eb4..2131a772d2ab 100644 --- a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_jobOptions.py +++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_jobOptions.py @@ -22,7 +22,7 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA', "afii": 'ASG_TEST_FILE_MC_AFII'} # Set up the reading of the input file: -import AthenaRootComps.ReadAthenaxAODHybrid +import AthenaPoolCnvSvc.ReadAthenaPool theApp.EvtMax = 500 testFile = os.getenv ( inputfile[dataType] ) svcMgr.EventSelector.InputCollections = [testFile] -- GitLab