ATLAS Offline Software
JetAnalysisAlgorithmsTest_PFlow_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 Nils Krumnack, Teng Jian Khoo
4 
5 # User options, which can be set from command line after a "-" character
6 # athena EgammaAlgorithmsTest_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 = "data",
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 jetContainer = "AntiKt4EMPFlowJets"
25 
26 # Set up the reading of the input file:
27 import AthenaPoolCnvSvc.ReadAthenaPool
28 theApp.EvtMax = 500
29 testFile = os.getenv ( inputfile[dataType] )
30 svcMgr.EventSelector.InputCollections = [testFile]
31 
32 from JetAnalysisAlgorithms.JetAnalysisAlgorithmsTest import makeSequence
33 algSeq = makeSequence (dataType, jetContainer)
34 print (algSeq) # For debugging
35 
36 # Add all algorithms from the sequence to the job.
37 athAlgSeq += algSeq
38 
39 # Set up a histogram output file for the job:
40 ServiceMgr += CfgMgr.THistSvc()
41 ServiceMgr.THistSvc.Output += [
42  "ANALYSIS DATAFILE='JetAnalysisAlgorithmsTestPFlow." + dataType + ".hist.root' OPT='RECREATE'"
43  ]
44 
45 # Workaround for running the event selection algs on MC with multiple event weights
46 from AthenaConfiguration.AllConfigFlags import initConfigFlags
47 from AthenaConfiguration.ComponentAccumulator import CAtoGlobalWrapper
48 from EventBookkeeperTools.EventBookkeeperToolsConfig import CutFlowSvcCfg
49 flags = initConfigFlags()
50 flags.Input.Files = [testFile]
51 flags.lock()
52 CAtoGlobalWrapper(CutFlowSvcCfg, flags)
53 
54 # Reduce the printout from Athena:
55 include( "AthAnalysisBaseComps/SuppressLogging.py" )
python.ComponentAccumulator.CAtoGlobalWrapper
def CAtoGlobalWrapper(*args, **kwargs)
Definition: ComponentAccumulator.py:1262
python.Include.include
include
Definition: Include.py:319
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28