3 # Runs a fast simulation + reconstruction chain for test purposes
6 #############################################################################
7 ### Tests to be executed in chain:
11 standard_reco_sbnd_basic
13 #############################################################################
21 if [[ -
z "${FAKE//0}" ]]; then
22 if [[ -
n "$LogFile" ]]; then
23 "${Cmd[@]}" >&
"$LogFile"
25 if [[ $res != 0 ]]; then
33 echo
" (skipped in dry run mode)"
44 echo
"\$ ${Cmd[@]}${LogFile:+ >& ${LogFile}}"
45 ExecBase
"$LogFile" "${Cmd[@]}"
49 function ExecCommand() {
51 local CommandFile=
"$2"
54 \$ $(<
"$CommandFile")${LogFile:+
" >& ${LogFile}"}
55 ---------------------------------------------------------------------
57 ExecBase
"$LogFile" 'sh' "$CommandFile"
61 function GetWorkDir() {
69 mkdir "$DirName" &&
cd "$DirName"
76 if [[ -d
"$Target" ]]; then
77 Target=
"${Target%/}/$(basename "$Source
")"
80 [[ -
h "$Target" ]] && rm
"$Target"
81 ln -
s "$Source" "$Target"
85 function MakeCommandFile() {
86 local CommandFile=
"$1"
91 for Token
in "$@" ;
do
92 [[ -
n "$Command" ]] && Command+=
' '
95 echo
"$Command" >
"$CommandFile"
100 # number of events to be generated
104 # clean up from previous tests
106 for TestName
in "${TestNames[@]}" ;
do
108 [[ -d
"$WorkDir" ]] ||
continue
109 Exec
'' rm -
r "${WorkDir%/}/"
116 declare -ir NTests=
"${#TestNames[@]}"
117 for TestName in
"${TestNames[@]}" ;
do
120 # - test name: <TestName>
121 # - working directory: <TestName>
122 # - configuration: <TestName>.fcl
123 # - input file: from the previous job
124 # - output files: <TestName>-art.root (art events)
125 # <TestName>-hist.root (TFileService)
126 # - log file: <TestName>.out
127 # - command run: run_<TestName>.cmd
129 # A link to the output file is placed into the base directory
135 # move into a directory specific to the job
137 WorkDir=
"$(GetWorkDir "$TestName
")"
138 Exec
'' chdir
"$WorkDir" ||
exit $?
141 =====================================================================
142 [${iTest}/${NTests}] Starting
test: ${TestName}
143 =====================================================================
147 ### prepare the command
149 declare -
a Cmd=(
'lar' '--rethrow-all' )
151 ConfigFile=
"${TestName}.fcl"
152 ConfigDumpFile=
"${ConfigFile%.fcl}.cfg"
153 Cmd=(
"${Cmd[@]}" '--config' "$ConfigFile" '--config-out' "$ConfigDumpFile" )
156 if [[ -
n "$OutputTreeFile" ]]; then
157 InputFile=
"$OutputTreeFile"
158 Cmd=(
"${Cmd[@]}" '--source' "../${InputFile}" )
160 Cmd=(
"${Cmd[@]}" '--nevts' "$NEvents" )
163 OutputTreeFile=
"${TestName}-art.root"
164 OutputHistFile=
"${TestName}-hist.root"
165 Cmd=(
"${Cmd[@]}" '--output' "$OutputTreeFile" '--TFileName' "$OutputHistFile" )
171 LogFile=
"${TestName}.out"
172 CommandFile=
"run_${TestName}.cmd"
173 MakeCommandFile
"$CommandFile" "${Cmd[@]}"
174 ExecCommand
"$LogFile" "$CommandFile"
177 if [[ $res != 0 ]]; then
179 *********************************************************************
180 *** [${iTest}/${NTests}]
Test '${TestName}' FAILED!!! (
exit code: ${res})
181 *********************************************************************
189 Exec
'' Link
"${WorkDir}/${OutputTreeFile}" "${BaseDir%/}/"
191 # go back to base
dir
196 =====================================================================
197 *** All ${NTests} tests succeeded.
198 =====================================================================
process_name opflash particleana ie ie ie z
process_name opflash particleana ie x
void Test(TFile *pFile=nullptr, bool statChecks=true)
then echo Work directory not specified exit fi echo Work directory
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
then echo File list $list not found else cat $list while read file do echo $file sed s
BEGIN_PROLOG sequence::SlidingWindowTriggerPatternsOppositeWindows END_PROLOG simSlidingORM6O6 effSlidingORW output
BEGIN_PROLOG hitmakerfive clustermakerfour pfparticlemakerthree showermakertwo END_PROLOG hitmakerfive clustermakerfour pfparticlemakerthree sequence::inline_paths sequence::inline_paths sequence::inline_paths showermakers test