ATLAS Offline Software
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 
4 from 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  return IDTPMparser.parse_args()
22 
23 
24 MyArgs = GetCustomAthArgs()
25 
26 #from AthenaConfiguration.Enums import LHCPeriod
27 from AthenaConfiguration.AllConfigFlags import initConfigFlags
28 flags = initConfigFlags()
29 
30 
31 flags.Input.Files = []
32 for path in MyArgs.inputFileNames.split( ',' ):
33  flags.Input.Files += glob( path )
34 
35 
36 if MyArgs.debug:
37  from AthenaCommon.Constants import DEBUG
38  flags.Exec.OutputLevel = DEBUG
39 
40 from InDetTrackPerfMon.InDetTrackPerfMonFlags import initializeIDTPMConfigFlags, initializeIDTPMTrkAnaConfigFlags
41 
42 # initialize general IDTPM job flags
43 flags = initializeIDTPMConfigFlags( flags )
44 flags.PhysVal.IDTPM.DirName = MyArgs.dirName
45 flags.PhysVal.IDTPM.outputFilePrefix = MyArgs.outputFilePrefix
46 flags.PhysVal.IDTPM.plotsDefFormat = MyArgs.plotsDefFormat
47 flags.PhysVal.IDTPM.plotsDefFileList = MyArgs.plotsDefFileList
48 flags.PhysVal.IDTPM.plotsCommonValuesFile = MyArgs.plotsCommonValuesFile
49 flags.PhysVal.IDTPM.sortPlotsByChain = MyArgs.sortPlotsByChain
50 flags.PhysVal.IDTPM.trkAnaCfgFile = MyArgs.trkAnaCfgFile
51 flags.Output.doWriteAOD_IDTPM = MyArgs.writeAOD_IDTPM
52 flags.PhysVal.IDTPM.unpackTrigChains = MyArgs.unpackTrigChains
53 
54 # initialize individual TrkAnalises flags (and output file names)
55 flags = initializeIDTPMTrkAnaConfigFlags( flags )
56 
57 flags.PhysVal.doExample = False
58 
59 flags.lock()
60 flags.dump()
61 
62 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
63 acc = MainServicesCfg(flags)
64 
65 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
66 acc.merge( PoolReadCfg(flags) )
67 
68 from InDetTrackPerfMon.InDetTrackPerfMonConfig import InDetTrackPerfMonCfg
69 acc.merge( InDetTrackPerfMonCfg(flags) )
70 
71 acc.printConfig( withDetails=True )
72 
73 # Execute and finish
74 sc = acc.run( maxEvents=MyArgs.maxEvents )
75 
76 # Success should be 0
77 import sys
78 sys.exit( not sc.isSuccess() )
runIDTPM.GetCustomAthArgs
def GetCustomAthArgs()
Definition: runIDTPM.py:6
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
Constants
some useful constants -------------------------------------------------—
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
InDetTrackPerfMonFlags.initializeIDTPMConfigFlags
def initializeIDTPMConfigFlags(flags)
General config flag category for IDTPM tool job configuration.
Definition: InDetTrackPerfMonFlags.py:151
InDetTrackPerfMonFlags.initializeIDTPMTrkAnaConfigFlags
def initializeIDTPMTrkAnaConfigFlags(flags)
Create flags category and corresponding set of flags.
Definition: InDetTrackPerfMonFlags.py:161
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
InDetTrackPerfMonConfig.InDetTrackPerfMonCfg
def InDetTrackPerfMonCfg(flags)
Definition: InDetTrackPerfMonConfig.py:243