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