12from argparse
import ArgumentParser
13from AthenaCommon.Logging
import logging
14log = logging.getLogger(
"runIDTPM_Offl.py" )
17 def exit( self, status=0, message=None ):
18 if message:
print(message, end=
'')
20 print(
"\n\nStandard runIDTPM.py options:" )
21 oldhelp = subprocess.run( [
"runIDTPM.py",
"-h"], capture_output=
True, text=
True ).stdout
24 for line
in oldhelp.splitlines():
26 if "trkAnaCfgFile" in line
or "track analysis setup" in line:
continue
27 newhelp_list.append(line)
28 elif "options:" in line: keep =
True
29 newhelp =
"\n".join( newhelp_list )
31 super().
exit( status )
34 myparser =
MyParser( description =
'runIDTPM_Offl.py options:',
35 usage =
'runIDTPM_Offl.py [runIDTPM_Offl.py options] [Standard runIDTPM.py options]' )
36 myparser.add_argument(
"-j",
"--jsonName", help=
"json Config file name for IDTPM to write", default=
"IDTPMconfig.json" )
37 myparser.add_argument(
"-d",
"--debug", help=
'set debug level printout', action=
'store_true', default=
False )
38 myparser.add_argument(
"--doTightPrimary", help=
"Also schedule trackAnalysis with TightPrimary offline selection", action=
"store_true", default=
False )
40 return myparser.parse_known_args()
42if __name__ ==
"__main__":
45 if MyArgs.debug : log.setLevel( logging.DEBUG )
51 "TestType" :
"Offline",
53 "MatchingType" :
"TruthMatch",
54 "unlinkedAsFakes" :
False,
55 "_comment" :
"unlinkedAsFakes=false is used for comparisons with IDPVM but the recommended default is true"
60 if MyArgs.doTightPrimary:
61 log.debug(
"Adding TrkAnaOffl_TightPrimary" )
62 trkAnaDict = IDPTM_json_config[
"TrkAnaOffl"].copy()
63 trkAnaDict[
"OfflineQualityWP"] =
"TightPrimary"
64 trkAna_tightPrimary = {
"TrkAnaOffl_TightPrimary" : trkAnaDict }
65 IDPTM_json_config.update( trkAna_tightPrimary )
68 with open( MyArgs.jsonName,
"w", encoding=
"utf-8" )
as f:
69 json.dump( IDPTM_json_config, f, indent=4, ensure_ascii=
False )
70 log.info( f
"IDTPM config file {MyArgs.jsonName} with content" )
71 subprocess.run( [
"jq",
".", MyArgs.jsonName ] )
74 cmd = [
'runIDTPM.py',
75 '--trkAnaCfgFile', MyArgs.jsonName ] + otherArgs
76 log.debug(
"Running: "+(
' '.join( cmd )) )
77 subprocess.run( cmd, check=
True )
void print(char *figname, TCanvas *c1)
exit(self, status=0, message=None)