ATLAS Offline Software
RunRDOAnalysis.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 """Run RDOAnalysis
3 
4 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 """
6 import sys
7 from argparse import ArgumentParser
8 
9 from AthenaConfiguration.AllConfigFlags import initConfigFlags
10 from AthenaConfiguration.Enums import ProductionStep
11 
12 # Argument parsing
13 parser = ArgumentParser("RunRDOAnalysis.py")
14 parser.add_argument("detectors", metavar="detectors", type=str, nargs="*",
15  help="Specify the list of detectors")
16 parser.add_argument("--localgeo", default=False, action="store_true",
17  help="Use local geometry XML files")
18 parser.add_argument("-n", "--maxEvents", default=-1, type=int,
19  help="The number of events to run. -1 runs all events.")
20 parser.add_argument("-i", "--input",
21  help="The input RDO file to use")
22 parser.add_argument("-p", "--presampling", default=False, action="store_true",
23  help="Run on presampling RDO")
24 args = parser.parse_args()
25 
26 
27 # Some info about the job
28 print("----RDOAnalysis----")
29 print()
30 if args.localgeo:
31  print("Using local Geometry XML files")
32 print(f"Input file: {args.input}")
33 if not args.detectors:
34  print("Running complete detector")
35 else:
36  print("Running with: {}".format(", ".join(args.detectors)))
37 print()
38 
39 # Configure
40 flags = initConfigFlags()
41 flags.Input.Files = [args.input]
42 if args.localgeo:
43  flags.ITk.Geometry.AllLocal = True
44 if args.presampling:
45  flags.Common.ProductionStep = ProductionStep.PileUpPresampling
46 flags.Output.HISTFileName = 'RDOAnalysis.root'
47 
48 from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
49 setupDetectorFlags(flags, args.detectors, use_metadata=True, toggle_geometry=True)
50 
51 flags.lock()
52 
53 # Construct our accumulator to run
54 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
55 acc = MainServicesCfg(flags)
56 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
57 acc.merge(PoolReadCfg(flags))
58 from RDOAnalysis.RDOAnalysisConfig import RDOAnalysisCfg
59 acc.merge(RDOAnalysisCfg(flags))
60 
61 # Execute and finish
62 sc = acc.run(maxEvents=args.maxEvents)
63 
64 # Success should be 0
65 sys.exit(not sc.isSuccess())
vtune_athena.format
format
Definition: vtune_athena.py:14
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.RDOAnalysisConfig.RDOAnalysisCfg
def RDOAnalysisCfg(flags)
Definition: RDOAnalysisConfig.py:218
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.DetectorConfigFlags.setupDetectorFlags
def setupDetectorFlags(flags, custom_list=None, use_metadata=False, toggle_geometry=False, validate_only=False, keep_beampipe=False)
Definition: DetectorConfigFlags.py:289
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69