ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetValidation
InDetTrackPerfMon
scripts
runIDTPM_Offl.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
4
9
10
import
json
11
import
subprocess
12
from
argparse
import
ArgumentParser
13
from
AthenaCommon.Logging
import
logging
14
log = logging.getLogger(
"runIDTPM_Offl.py"
)
15
16
class
MyParser
( ArgumentParser ):
17
def
exit
( self, status=0, message=None ):
18
if
message:
print
(message, end=
''
)
# print default help message
19
# Add runIDTPM.py standard help message
20
print
(
"\n\nStandard runIDTPM.py options:"
)
21
oldhelp = subprocess.run( [
"runIDTPM.py"
,
"-h"
], capture_output=
True
, text=
True
).stdout
22
keep =
False
23
newhelp_list = []
24
for
line
in
oldhelp.splitlines():
25
if
keep :
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 )
30
print
( f
"{newhelp}"
)
31
super().
exit
( status )
32
33
def
GetCustomAthArgs
() :
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
)
39
# TODO - add here other flags for specific use cases
40
return
myparser.parse_known_args()
41
42
if
__name__ ==
"__main__"
:
43
44
MyArgs, otherArgs =
GetCustomAthArgs
()
45
if
MyArgs.debug : log.setLevel( logging.DEBUG )
46
47
48
IDPTM_json_config = {
49
"TrkAnaOffl"
: {
50
"enabled"
:
True
,
51
"TestType"
:
"Offline"
,
52
"RefType"
:
"Truth"
,
53
"MatchingType"
:
"TruthMatch"
,
54
"unlinkedAsFakes"
:
False
,
55
"_comment"
:
"unlinkedAsFakes=false is used for comparisons with IDPVM but the recommended default is true"
56
}
57
}
58
59
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 )
66
67
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 ] )
72
73
74
cmd = [
'runIDTPM.py'
,
75
'--trkAnaCfgFile'
, MyArgs.jsonName ] + otherArgs
76
log.debug(
"Running: "
+(
' '
.join( cmd )) )
77
subprocess.run( cmd, check=
True
)
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
runIDTPM_Offl.MyParser
Definition
runIDTPM_Offl.py:16
runIDTPM_Offl.MyParser.exit
exit(self, status=0, message=None)
Definition
runIDTPM_Offl.py:17
runIDTPM_Offl.GetCustomAthArgs
GetCustomAthArgs()
Definition
runIDTPM_Offl.py:33
Generated on
for ATLAS Offline Software by
1.17.0