ATLAS Offline Software
EventAlgorithmsTest_jobOptions.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2 #
3 # @author Tadej Novak
4 
5 # User options, which can be set from command line after a "-" character
6 # athena EventAlgorithmsTest_jobOptions.py - --myOption ...
7 from AthenaCommon.AthArgumentParser import AthArgumentParser
8 athArgsParser = AthArgumentParser()
9 athArgsParser.add_argument("--data-type", action = "store", dest = "data_type",
10  default = "mc",
11  help = "Type of input to run over. Valid options are 'data', 'mc', 'afii'")
12 athArgs = athArgsParser.parse_args()
13 
14 dataType = athArgs.data_type
15 if not dataType in ["data", "mc", "afii"] :
16  raise Exception ("invalid data type: " + dataType)
17 
18 print("Running on data type: " + dataType)
19 
20 inputfile = {"data": 'ASG_TEST_FILE_DATA',
21  "mc": 'ASG_TEST_FILE_MC',
22  "afii": 'ASG_TEST_FILE_MC_AFII'}
23 
24 # Set up the reading of the input file:
25 import AthenaPoolCnvSvc.ReadAthenaPool
26 theApp.EvtMax = 500
27 testFile = os.getenv ( inputfile[dataType] )
28 svcMgr.EventSelector.InputCollections = [testFile]
29 
30 # Needed for filtering, Athena only for now
31 from EventBookkeeperTools.CutFlowHelpers import CreateCutFlowSvc
32 CreateCutFlowSvc(seq=athAlgSeq, addMetaDataToAllOutputFiles=False)
33 
34 from AsgAnalysisAlgorithms.AsgAnalysisAlgorithmsTest import makeEventAlgorithmsSequence
35 algSeq = makeEventAlgorithmsSequence (dataType)
36 print( algSeq ) # For debugging
37 
38 # Add all algorithms from the sequence to the job.
39 athAlgSeq += algSeq
40 
41 # Set up a histogram output file for the job:
42 ServiceMgr += CfgMgr.THistSvc()
43 ServiceMgr.THistSvc.Output += [
44  "ANALYSIS DATAFILE='EventAlgorithmsTest." + dataType + ".hist.root' OPT='RECREATE'"
45  ]
46 
47 # Reduce the printout from Athena:
48 include( "AthAnalysisBaseComps/SuppressLogging.py" )
python.CutFlowHelpers.CreateCutFlowSvc
def CreateCutFlowSvc(seq=None, addMetaDataToAllOutputFiles=True)
Definition: CutFlowHelpers.py:30
python.Include.include
include
Definition: Include.py:319
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28