ATLAS Offline Software
testPileupReweightingAlgConfig.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 """
4 Test to run PileupReweightingToolCfg
5 """
6 
7 _input_help = "with no inputs use ASG_TEST_FILE_MC"
8 
9 from argparse import ArgumentParser
10 import os
11 
12 from GaudiKernel.Configurable import DEBUG
13 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
14 from AthenaConfiguration.ComponentFactory import CompFactory
15 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
16 from AthenaConfiguration.AllConfigFlags import initConfigFlags
17 from AsgAnalysisAlgorithms.PileupReweightingAlgConfig import (
18  PileupReweightingAlgCfg
19 )
20 
21 def get_parser():
22  parser = ArgumentParser(description=__doc__)
23  parser.add_argument('input_files', nargs='*', help=_input_help)
24  parser.add_argument('-m', '--max-events', type=int, const=10, nargs='?')
25  parser.add_argument('-d', '--debug-logs', action='store_true')
26  return parser.parse_args()
27 
28 def run():
29  args = get_parser()
30  flags = initConfigFlags()
31  flags.Input.Files = args.input_files or [os.environ['ASG_TEST_FILE_MC']]
32  if args.debug_logs:
33  flags.Exec.OutputLevel = DEBUG
34  if args.max_events:
35  flags.Exec.MaxEvents = args.max_events
36  ca = MainServicesCfg(flags)
37  ca.merge(PoolReadCfg(flags))
38 
39  ca.merge(PileupReweightingAlgCfg(flags))
40 
41  ca.run()
42 
43 if __name__ == '__main__':
44  run()
testPileupReweightingAlgConfig.run
def run()
Definition: testPileupReweightingAlgConfig.py:28
python.PileupReweightingAlgConfig.PileupReweightingAlgCfg
def PileupReweightingAlgCfg(flags, name="PileupReweightingAlg", **kwargs)
Definition: PileupReweightingAlgConfig.py:39
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
testPileupReweightingAlgConfig.get_parser
def get_parser()
Definition: testPileupReweightingAlgConfig.py:21
run
Definition: run.py:1
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69