3 # Runs a fast simulation + reconstruction chain for test purposes
6 #############################################################################
7 ### Tests to be executed in chain:
10 'prod_eminus_0.1_0.9_sbnd'
12 'standard_detsim_sbnd'
13 'standard_reco_sbnd_basic'
15 #############################################################################
23 if [[ -
z "${FAKE//0}" ]]; then
24 if [[ -
n "$LogFile" ]]; then
25 "${Cmd[@]}" >&
"$LogFile"
27 if [[ $res != 0 ]]; then
35 echo
" (skipped in dry run mode)"
46 echo
"\$ ${Cmd[@]}${LogFile:+ >& ${LogFile}}"
47 ExecBase
"$LogFile" "${Cmd[@]}"
51 function ExecCommand() {
53 local CommandFile=
"$2"
56 \$ $(<
"$CommandFile")${LogFile:+
" >& ${LogFile}"}
57 ---------------------------------------------------------------------
59 ExecBase
"$LogFile" 'sh' "$CommandFile"
63 function GetWorkDir() {
71 mkdir "$DirName" &&
cd "$DirName"
78 if [[ -d
"$Target" ]]; then
79 Target=
"${Target%/}/$(basename "$Source
")"
82 [[ -
h "$Target" ]] && rm
"$Target"
83 ln -
s "$Source" "$Target"
87 function MakeCommandFile() {
88 local CommandFile=
"$1"
93 for Token
in "$@" ;
do
94 [[ -
n "$Command" ]] && Command+=
' '
97 echo
"$Command" >
"$CommandFile"
102 # number of events to be generated
106 # clean up from previous tests
108 for TestName
in "${TestNames[@]}" ;
do
110 [[ -d
"$WorkDir" ]] ||
continue
111 Exec
'' rm -
r "${WorkDir%/}/"
118 declare -ir NTests=
"${#TestNames[@]}"
119 for TestName in
"${TestNames[@]}" ;
do
122 # - test name: <TestName>
123 # - working directory: <TestName>
124 # - configuration: <TestName>.fcl
125 # - input file: from the previous job
126 # - output files: <TestName>-art.root (art events)
127 # <TestName>-hist.root (TFileService)
128 # - log file: <TestName>.out
129 # - command run: run_<TestName>.cmd
131 # A link to the output file is placed into the base directory
137 # move into a directory specific to the job
139 WorkDir=
"$(GetWorkDir "$TestName
")"
140 Exec
'' chdir
"$WorkDir" ||
exit $?
143 =====================================================================
144 [${iTest}/${NTests}] Starting
test: ${TestName}
145 =====================================================================
149 ### prepare the command
151 declare -
a Cmd=(
'lar' '--rethrow-all' )
153 ConfigFile=
"${TestName}.fcl"
154 ConfigDumpFile=
"${ConfigFile%.fcl}.cfg"
155 Cmd=(
"${Cmd[@]}" '--config' "$ConfigFile" '--config-out' "$ConfigDumpFile" )
158 if [[ -
n "$OutputTreeFile" ]]; then
159 InputFile=
"$OutputTreeFile"
160 Cmd=(
"${Cmd[@]}" '--source' "../${InputFile}" )
162 Cmd=(
"${Cmd[@]}" '--nevts' "$NEvents" )
165 OutputTreeFile=
"${TestName}-art.root"
166 OutputHistFile=
"${TestName}-hist.root"
167 Cmd=(
"${Cmd[@]}" '--output' "$OutputTreeFile" '--TFileName' "$OutputHistFile" )
173 LogFile=
"${TestName}.out"
174 CommandFile=
"run_${TestName}.cmd"
175 MakeCommandFile
"$CommandFile" "${Cmd[@]}"
176 ExecCommand
"$LogFile" "$CommandFile"
179 if [[ $res != 0 ]]; then
181 *********************************************************************
182 *** [${iTest}/${NTests}]
Test '${TestName}' FAILED!!! (
exit code: ${res})
183 *********************************************************************
191 Exec
'' Link
"${WorkDir}/${OutputTreeFile}" "${BaseDir%/}/"
193 # go back to base
dir
198 =====================================================================
199 *** All ${NTests} tests succeeded.
200 =====================================================================
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