12 from TrigValTools.TrigValSteering
import Test, CheckSteps
13 from TrigInDetValidation.TrigInDetArtSteps
import TrigInDetReco, TrigInDetAna, TrigCostStep, TrigInDetRdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
18 opts, args = getopt.getopt(sys.argv[1:],
"lcxptirmn:",[
"local",
"config"])
19 except getopt.GetoptError:
21 print(
"-l | --local run locally with input file from art eos grid-input")
22 print(
"-x don't run athena or post post-processing, only plotting")
23 print(
"-m run cost monitoring plotting, even if -x is set")
24 print(
"-r run only ntuple building stage")
25 print(
"-p run post-processing, even if -x is set")
26 print(
"-n N run only on N events per job")
27 print(
"-c | --config run with config_only and print to a pkl file")
28 print(
"-t test steering, dry run for all steps")
29 print(
"-i force the dry AbortDryRun flag to be False")
44 if "Art_type" not in locals(): Art_type =
'grid'
45 if "GridFiles" not in locals(): GridFiles=
False
46 if "Malloc" not in locals(): Malloc=
False
47 if "AbortDryRun" in locals(): abort_dry_run=AbortDryRun
50 if opt
in (
"-l",
"--local"):
62 if opt
in (
"-c",
"--config"):
69 vdry_run = os.environ.get(
'TRIGVALSTEERING_DRY_RUN')
75 if 'postinclude_file' in dir() :
76 if 'preinclude_file' in dir() :
77 rdo2aod = TrigInDetReco( postinclude_file=postinclude_file, preinclude_file=preinclude_file )
79 rdo2aod = TrigInDetReco( postinclude_file=postinclude_file )
81 if 'preinclude_file' in dir() :
82 rdo2aod = TrigInDetReco( preinclude_file=preinclude_file )
84 rdo2aod = TrigInDetReco()
88 rdo2aod.slices = Slices
89 rdo2aod.threads = Threads
90 rdo2aod.concurrent_events = Slots
91 rdo2aod.config_only = testconfig
92 if 'Release' in dir():
93 rdo2aod.release = Release
96 if "Args" not in locals() :
102 if Events_local != 0 :
103 rdo2aod.max_events = Events_local
105 rdo2aod.max_events = Events
108 rdo2aod.perfmon =
False
109 rdo2aod.costmon =
True
110 rdo2aod.timeout = 18*3600
111 rdo2aod.input = Input
115 rdo2aod.input = Input
118 rdo2aod.args +=
' --inputRDOFile=$ArtInFile '
121 from AthenaConfiguration.TestDefaults
import defaultConditionsTags
123 if "conditionsOverride" not in locals():
124 rdo2aod.args += f
' --conditionsTag "default:{defaultConditionsTags.RUN3_MC}"'
125 elif conditionsOverride ==
"Run4":
126 rdo2aod.args += f
' --conditionsTag "default:{defaultConditionsTags.RUN4_MC}"'
131 os.environ[
"MALLOC_CHECK_"] =
"3"
132 rdo2aod.malloc =
True
134 for a
in [
"preexec_trig",
"preexec_reco",
"preexec_all",
"postexec_trig",
"postexec_reco"]:
138 v0 = getattr (rdo2aod, a)
139 if v0
is None or v0 ==
"":
143 setattr (rdo2aod, a, v0)
148 test.art_type = Art_type
151 if 'ExtraAna' not in locals() :
153 aod_to_ntup = TrigInDetAna(extraArgs = ExtraAna)
156 rdo_to_cost = TrigCostStep()
164 test.exec_steps = [rdo2aod, aod_to_ntup, rdo_to_cost]
166 test.exec_steps = [aod_to_ntup]
167 test.check_steps = CheckSteps.default_check_steps(test)
171 if ((
not exclude)
or postproc ):
174 rdict = TrigInDetRdictStep( name=job[0], args=job[1], testbin=job[2], config=(testconfig
or dry_run) )
176 rdict = TrigInDetRdictStep( name=job[0], args=job[1], config=(testconfig
or dry_run) )
177 print(
"\n\033[0;32m TIDArdict "+job[1]+
" \033[0m" )
178 test.check_steps.append(rdict)
185 compstep = TrigInDetCompStep( name=_slice[0], slice=_slice[1], file=_slice[2], args=_slice[3] )
186 test.check_steps.append(compstep)
190 cputest = [ (
"CpuCostStep1",
" times ",
"expert-monitoring.root",
" --auto -p TIME" ),
191 (
"CpuCostStep2",
" times-FTF ",
"expert-monitoring.root",
" --auto -p TIME -d TrigFastTrackFinder_" ),
192 (
"CpuCostStep3",
" cost-perCall ",
"TrigCostRoot_Results.root",
" --auto -p _Time_perCall -d /Algorithm --logx " ),
193 (
"CpuCostStep4",
" cost-perEvent ",
"TrigCostRoot_Results.root",
" --auto -p _Time_perEvent -d /Algorithm --logx " ),
194 (
"CpuCostStep5",
" cost-perCall-chain ",
"TrigCostRoot_Results.root",
" --auto -p _Time_perCall -d /Chain_Algorithm --logx " ),
195 (
"CpuCostStep6",
" cost-perEvent-chain ",
"TrigCostRoot_Results.root",
" --auto -p _Time_perEvent -d /Chain_Algorithm --logx " ) ]
198 if ((
not exclude)
or postproc
or costplot ):
200 cpucost = TrigInDetCpuCostStep( name=job[0], outdir=job[1], infile=job[2], extra=job[3] )
201 test.check_steps.append(cpucost)