Skip to content

Commit 19f3dd5

Browse files
committed
Merge remote-tracking branch 'origin/main' into v3
2 parents 778d5c7 + 2abd017 commit 19f3dd5

3 files changed

Lines changed: 51 additions & 11 deletions

File tree

bin/hipo-check.sh

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,33 @@ set -e
44
set -u
55
source $(dirname $0)/environ.sh
66

7+
# default options
8+
rm_bad=false
9+
hipoFiles=()
10+
711
# arguments
812
if [ $# -lt 1 ]; then
9-
printError "no HIPO files specified for $(basename $0)"
1013
echo """
11-
USAGE: $0 [HIPO_FILE(S)]...
14+
USAGE: $0 [OPTIONS]... [HIPO_FILE(S)]...
1215
1316
Checks each [HIPO_FILE] for corruption, etc.
17+
18+
OPTIONS
19+
--rm-bad delete (rm) bad HIPO files
1420
""" >&2
1521
exit 101
1622
fi
17-
hipoFiles=$@
23+
for arg in "$@"; do
24+
if [[ $arg =~ ^- ]]; then
25+
case $arg in
26+
--rm-bad) rm_bad=true ;;
27+
*) printError "unknown option $arg" && exit 100 ;;
28+
esac
29+
else
30+
hipoFiles+=($arg)
31+
fi
32+
done
33+
[ ${#hipoFiles[@]} -lt 1 ] && printError "no HIPO files specified for $(basename $0)" && exit 100
1834

1935
# minimum file size for a valid HIPO file
2036
# - seems to be 192 bytes, but setting the threshold slightly higher may be safer
@@ -56,5 +72,12 @@ if [ ${#badFiles[@]} -gt 0 ]; then
5672
for badFile in ${badFiles[@]}; do
5773
echo " - $badFile" >&2
5874
done
75+
# remove bad HIPO files
76+
if $rm_bad; then
77+
printError "These HIPO files will now be REMOVED!"
78+
for badFile in ${badFiles[@]}; do
79+
rm -v $badFile >&2
80+
done
81+
fi
5982
exit 100
6083
fi

bin/run-detectors-timelines.sh

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ if ${modes['focus-all']} || ${modes['focus-timelines']}; then
228228
echo "PREMATURE EXIT, since --debug option was used"
229229
exit
230230
else
231-
#sleep 1
232-
java $TIMELINE_JAVA_OPTS $run_analysis_script $timelineObj $inputDir > $logFile.out 2> $logFile.err || touch $logFile.fail &
231+
java $TIMELINE_JAVA_OPTS $run_analysis_script $timelineObj $inputDir > $logFile.out 2> $logFile.err || touch $logFile.fail &
233232
job_ids+=($!)
234233
job_names+=($timelineObj)
235234
fi
@@ -265,9 +264,13 @@ if ${modes['focus-all']} || ${modes['focus-timelines']}; then
265264
esac
266265
done
267266

268-
# check timelines
267+
# check timelines; remove and complain about any bad ones
268+
echo ">>> running hipo-check on timeline HIPO files..."
269269
outputFiles=$(find . -name "*.hipo")
270-
[ -n "$outputFiles" ] && $TIMELINESRC/bin/hipo-check.sh $outputFiles
270+
if [ -n "$outputFiles" ]; then
271+
logFile=$logDir/hipo-check
272+
$TIMELINESRC/bin/hipo-check.sh --rm-bad $outputFiles > $logFile.out 2> $logFile.err || touch $logFile.fail
273+
fi
271274

272275
# remove any empty directories
273276
echo ">>> removing any empty directories..."
@@ -312,31 +315,44 @@ $logDir/*.err
312315

313316
# exit nonzero if any jobs exitted nonzero
314317
failedJobs=($(find $logDir -name "*.fail" | xargs -I{} basename {} .fail))
318+
somethingFailed=false
315319
if [ ${#failedJobs[@]} -gt 0 ]; then
316320
for failedJob in ${failedJobs[@]}; do
317321
echo $sep
318322
printError "job '$failedJob' returned non-zero exit code; error log dump:"
319323
cat $logDir/$failedJob.err
324+
if [ "$failedJob" = "hipo-check" ]; then
325+
printWarning "These HIPO files are TIMELINE files; if this '$failedJob' job is the ONLY failed job, you may proceed with timeline deployment, but these failed timelines will not be deployed."
326+
fi
320327
done
321328
if [ -z "$singleTimeline" -a ${modes['focus-qa']} = false ]; then
322329
echo $sep
323330
echo "To re-run only the failed timelines, for debugging, try one of the following commands:"
324331
for failedJob in ${failedJobs[@]}; do
325332
if [ "$failedJob" = "qa" ]; then
326333
echo " $0 $@ --focus-qa"
334+
elif [ "$failedJob" = "hipo-check" ]; then
335+
echo " $0 $@ --focus-timelines -t [BAD_TIMELINE]"
336+
echo " where [BAD_TIMELINE] is any timeline that failed 'hipo-check'"
327337
else
328338
echo " $0 $@ --focus-timelines -t $failedJob"
329339
fi
330340
done
331341
fi
332-
exit 100
342+
somethingFailed=true
333343
else
334344
echo "All jobs exitted normally"
335345
fi
336346

337347
# grep for suspicious things in error logs
338348
errPattern="error:|exception:|warning"
339-
echo """To look for any quieter errors, running \`grep -iE '$errPattern'\` on *.err files:
349+
echo """Now scanning for any quieter errors, by running \`grep -iE '$errPattern'\` on *.err files:
340350
$sep"""
341351
grep -iE --color "$errPattern" $logDir/*.err || echo "Good news: grep found no errors, but you still may want to take a look yourself..."
342352
echo $sep
353+
354+
# exit nonzero if something failed
355+
if $somethingFailed; then
356+
printWarning "At least one job had issues; look above or in the log files to see what's wrong."
357+
exit 100
358+
fi

src/main/java/org/jlab/clas/timeline/fitter/HTCCFitter.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ class HTCCFitter{
2828

2929
f1.setParameter(0, h1.getMax());
3030
f1.setParameter(1, maxV);
31+
def absolute_min_sigma = 0.2
3132
if(iqr > 0) {
3233
f1.setParameter(2, Math.max(iqr / 2.0, 0.1));
33-
f1.setParLimits(2, Math.max(iqr / 5.0, 0.05), Math.min(iqr * 5.0, h1.getAxis().getBinCenter(h1.getAxis().getNBins()-1)));
34+
f1.setParLimits(2, Math.max(iqr / 5.0, absolute_min_sigma), Math.min(iqr * 5.0, h1.getAxis().getBinCenter(h1.getAxis().getNBins()-1)));
3435
} else {
3536
f1.setParameter(2, 0.1);
36-
f1.setParLimits(2, 0.05, h1.getAxis().getBinCenter(h1.getAxis().getNBins()-1));
37+
f1.setParLimits(2, absolute_min_sigma, h1.getAxis().getBinCenter(h1.getAxis().getNBins()-1));
3738
}
3839

3940
DataFitter.fit(f1, h1, "");

0 commit comments

Comments
 (0)