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()
28 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
32 flags.Input.Files = []
33 for path
in MyArgs.inputFileNames.split(
',' ):
34 fileList = glob( path )
36 raise RuntimeError( f
"Input file {path} not found" )
37 flags.Input.Files += fileList
42 flags.Exec.OutputLevel = DEBUG
44 from InDetTrackPerfMon.InDetTrackPerfMonFlags
import initializeIDTPMConfigFlags, initializeIDTPMTrkAnaConfigFlags
48 flags.PhysVal.IDTPM.DirName = MyArgs.dirName
49 flags.PhysVal.IDTPM.outputFilePrefix = MyArgs.outputFilePrefix
50 flags.PhysVal.IDTPM.plotsDefFormat = MyArgs.plotsDefFormat
51 flags.PhysVal.IDTPM.plotsDefFileList = MyArgs.plotsDefFileList
52 flags.PhysVal.IDTPM.plotsCommonValuesFile = MyArgs.plotsCommonValuesFile
53 flags.PhysVal.IDTPM.sortPlotsByChain = MyArgs.sortPlotsByChain
54 flags.PhysVal.IDTPM.trkAnaCfgFile = MyArgs.trkAnaCfgFile
55 flags.Output.doWriteAOD_IDTPM = MyArgs.writeAOD_IDTPM
56 flags.PhysVal.IDTPM.unpackTrigChains = MyArgs.unpackTrigChains
57 flags.PhysVal.IDTPM.commonTrkAnaFlags = MyArgs.commonTrkAnaFlags
62 flags.PhysVal.doExample =
False
67 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
70 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
73 from InDetTrackPerfMon.InDetTrackPerfMonConfig
import InDetTrackPerfMonCfg
76 acc.printConfig( withDetails=
True )
79 sc = acc.run( maxEvents=MyArgs.maxEvents )
83 sys.exit(
not sc.isSuccess() )