ATLAS Offline Software
Loading...
Searching...
No Matches
runIDTPM.py
Go to the documentation of this file.
1#!/usr/bin/env python
2# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
4from glob import glob
5
7 from argparse import ArgumentParser
8 IDTPMparser = ArgumentParser( description='Parser for IDTPM configuration' )
9 IDTPMparser.add_argument( "--inputFileNames", help="Comma-separated list of input files", required=True)
10 IDTPMparser.add_argument( "--maxEvents", help="Limit number of events. Default: all input events", default=-1, type=int )
11 IDTPMparser.add_argument( "--debug", help="Enable debugging messages", action="store_true", default=False )
12 IDTPMparser.add_argument( "--dirName", help="Main directory name for storing plots", default="InDetTrackPerfMonPlots/" )
13 IDTPMparser.add_argument( "--outputFilePrefix", help='Name of output file', default="myIDTPM_out" )
14 IDTPMparser.add_argument( "--writeAOD_IDTPM", help="Write output file for reprocessing", action="store_true", default=False )
15 IDTPMparser.add_argument( "--trkAnaCfgFile", help='File with track analysis setup (.json format)', default='Default' )
16 IDTPMparser.add_argument( "--unpackTrigChains", help="Run each configured trigger chain in a separate track analysis", action="store_true", default=False )
17 IDTPMparser.add_argument( "--plotsDefFormat", help='Format of the plots definition file', default="JSON" )
18 IDTPMparser.add_argument( "--plotsDefFileList", help='Plain txt file containing the list of .json file names with the plots definitions', default="InDetTrackPerfMon/PlotsDefFileList_default.txt" )
19 IDTPMparser.add_argument( "--plotsCommonValuesFile", help='JSON file listing all the default values to be used in plots', default="" )
20 IDTPMparser.add_argument( "--sortPlotsByChain", help="Arrange plots first in subdirectories named after the current chain", action="store_true", default=False )
21 IDTPMparser.add_argument( "--commonTrkAnaFlags", help="Common flags to be overridden for all track Analises in the format flag_name=value", nargs='*', default=[] )
22 return IDTPMparser.parse_args()
23
24
26
27#from AthenaConfiguration.Enums import LHCPeriod
28from AthenaConfiguration.AllConfigFlags import initConfigFlags
29flags = initConfigFlags()
30
31
32flags.Input.Files = []
33for path in MyArgs.inputFileNames.split( ',' ):
34 fileList = glob( path )
35 if not fileList:
36 raise RuntimeError( f"Input file {path} not found" )
37 flags.Input.Files += fileList
38
39
40if MyArgs.debug:
41 from AthenaCommon.Constants import DEBUG
42 flags.Exec.OutputLevel = DEBUG
43
44from InDetTrackPerfMon.InDetTrackPerfMonFlags import initializeIDTPMConfigFlags, initializeIDTPMTrkAnaConfigFlags
45
46# initialize general IDTPM job flags
47flags = initializeIDTPMConfigFlags( flags )
48flags.PhysVal.IDTPM.DirName = MyArgs.dirName
49flags.PhysVal.IDTPM.outputFilePrefix = MyArgs.outputFilePrefix
50flags.PhysVal.IDTPM.plotsDefFormat = MyArgs.plotsDefFormat
51flags.PhysVal.IDTPM.plotsDefFileList = MyArgs.plotsDefFileList
52flags.PhysVal.IDTPM.plotsCommonValuesFile = MyArgs.plotsCommonValuesFile
53flags.PhysVal.IDTPM.sortPlotsByChain = MyArgs.sortPlotsByChain
54flags.PhysVal.IDTPM.trkAnaCfgFile = MyArgs.trkAnaCfgFile
55flags.Output.doWriteAOD_IDTPM = MyArgs.writeAOD_IDTPM
56flags.PhysVal.IDTPM.unpackTrigChains = MyArgs.unpackTrigChains
57flags.PhysVal.IDTPM.commonTrkAnaFlags = MyArgs.commonTrkAnaFlags
58
59# initialize individual TrkAnalises flags (and output file names)
60flags = initializeIDTPMTrkAnaConfigFlags( flags )
61
62flags.PhysVal.doExample = False
63
64flags.lock()
65flags.dump()
66
67from AthenaConfiguration.MainServicesConfig import MainServicesCfg
68acc = MainServicesCfg(flags)
69
70from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
71acc.merge( PoolReadCfg(flags) )
72
73from InDetTrackPerfMon.InDetTrackPerfMonConfig import InDetTrackPerfMonCfg
74acc.merge( InDetTrackPerfMonCfg(flags) )
75
76acc.printConfig( withDetails=True )
77
78# Execute and finish
79sc = acc.run( maxEvents=MyArgs.maxEvents )
80
81# Success should be 0
82import sys
83sys.exit( not sc.isSuccess() )
GetCustomAthArgs()
Definition runIDTPM.py:6