Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 27 additions & 30 deletions release_tests/lookuptable-testing/test_tables.sh
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
#!/bin/bash
# testing lookup tables by analysis
# a run and see if the table tests are
# survived at the start of the run
# (look at the log files for the lines after
# " lookup table file sanity check"
#

VERSION=$(cat $VERITAS_EVNDISP_AUX_DIR/IRFVERSION)

TFV6=$(find $VERITAS_EVNDISP_AUX_DIR/Tables/ -name "*.root")

TESTFILE="$VERITAS_USER_DATA_DIR/analysis/Results/${VERSION}/Crab/evndisp/64080.root"

for T in ${TFV6}
do
echo "Running mscw analysis for $T"
TB=$(basename $T .root)

ODIR="$VERITAS_USER_DATA_DIR/analysis/Results/${VERSION}/table-tests/"
mkdir -p ${ODIR}
OFIL="test.$TB.mscw"

echo $TB $OFIL $ODIR

rm -f ${ODIR}/${OFIL}.log
${EVNDISPSYS}/bin/mscw_energy -tablesfile ${T} -noshorttree -maxnevents=10 -arrayrecid=0 \
-inputfile ${TESTFILE} \
-writeReconstructedEventsOnly=1 -outputfile ${ODIR}/${OFIL}.root > ${ODIR}/${OFIL}.log
# (not interested in the root file with events)
rm -f ${ODIR}/${OFIL}.root
# Supply a reference observation matched to the tables under test.
VERSION=$(cat "$VERITAS_EVNDISP_AUX_DIR/IRFVERSION") || exit 1
TESTFILE=${1:-${TESTFILE:-}}
[[ -s $TESTFILE ]] || { echo "Usage: $0 <reference evndisp ROOT file> (or set TESTFILE)" >&2; exit 1; }
Comment thread
GernotMaier marked this conversation as resolved.
ODIR="$VERITAS_USER_DATA_DIR/analysis/Results/$VERSION/table-tests"
mkdir -p "$ODIR" || exit 1
mapfile -t TABLES < <(find "$VERITAS_EVNDISP_AUX_DIR/Tables" -type f -name "${TABLE_PATTERN:-*.root}")
((${#TABLES[@]})) || { echo "No lookup tables found" >&2; exit 1; }
failed=0
for T in "${TABLES[@]}"; do
TB=$(basename "$T" .root)
OFIL="$ODIR/test.$TB.mscw"
echo "TEST reference=$TESTFILE table=$T"
rm -f "$OFIL.root"
if ! "$EVNDISPSYS/bin/mscw_energy" -tablesfile "$T" -noshorttree -maxnevents=10 -arrayrecid=0 \
-inputfile "$TESTFILE" -writeReconstructedEventsOnly=1 -outputfile "$OFIL.root" > "$OFIL.log" 2>&1; then
echo "FAILED executable: $T" >&2
failed=$((failed+1))
elif [[ ! -s $OFIL.root ]] || ! grep -q 'survived test of table file!' "$OFIL.log"; then
echo "FAILED missing output/sanity marker: $T" >&2
failed=$((failed+1))
else
echo "PASSED table sanity: $T"
rm -f "$OFIL.root"
fi
done
echo "Lookup coverage: ${#TABLES[@]} tested; $failed failed"
((failed == 0))
44 changes: 27 additions & 17 deletions release_tests/montecarlo/irf_plotting/irf_plotting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@ if [ ! -n "$1" ]; then
exit
fi

#### TEMP FIXED VALUES
CUT="NTel3-PointSource-Hard-TMVA-BDT"
CUT="NTel2-PointSource-Soft-TMVA-BDT"
CUT="NTel2-PointSource-Moderate-TMVA-BDT"
CUT="NTel2-PointSource-Moderate"
echo "WARNING: CUT is hardwired to $CUT (for now)"
# Comparison plots - version and simtype hardwired
COMPAREVERSION="v492"
COMPARESIMTYPE="CARE_202404"
COMPARECUT="NTel2-PointSource-ModerateXGB"
#### (END TEMP FIXED VALUES)

# Optional comparison is explicit in the invocation environment.
COMPAREVERSION=${COMPAREVERSION:-}
COMPARESIMTYPE=${COMPARESIMTYPE:-}
COMPARECUT=${COMPARECUT:-}
mapfile -t CUTLIST < <(awk '$1 == "*" && $2 == "CUT" {print $3}' "$1")
((${#CUTLIST[@]})) || { echo "No CUT entries in $1" >&2; exit 1; }
TESTED=0
SKIPPED=0
# Analysis type
ANATYPE="${VERITAS_ANALYSIS_TYPE:0:2}"
# Eventdisplay version
Expand Down Expand Up @@ -55,11 +51,10 @@ if [[ ! -z $VERITAS_ANALYSIS_TYPE ]]; then
fi
fi

ODIR="../../../../EventDisplay_Release_${VERSION}/irf_plotting/${ANALYSISTYPE}${DIRRECOTYPE}/${SIMTYPE}/${CUT}_ATM${ATMO}"
mkdir -p ${ODIR}

DDIR="$VERITAS_IRFPRODUCTION_DIR/${VERSION}/${ANATYPE}/${SIMTYPE}"
DDIR="$VERITAS_IRFPRODUCTION_DIR/${VERSION}/${ANALYSISTYPE}/${SIMTYPE}"

for CUT in "${CUTLIST[@]}"; do
PLOT_BASE_DIR="${RELEASE_OUTPUT_DIR:-../../../../EventDisplay_Release_${VERSION}/irf_plotting}/${ANALYSISTYPE}${DIRRECOTYPE}/${SIMTYPE}/${CUT}"
for Z in "${MCZE[@]}"
do
for W in "${MCWOFF[@]}"
Expand All @@ -73,12 +68,23 @@ do
fi
for A in "${ATMO[@]}"
do
if [[ ${E} == "V6_2016_2017" ]] && [[ ${A} == "61" ]]; then
ODIR="$PLOT_BASE_DIR/${E}_ATM${A}"
mkdir -p "$ODIR"
if true; then
IRFDIR="${DDIR}/${E}_ATM${A}_gamma/EffectiveAreas_Cut-${CUT}_DISP"
IRFFILE="EffArea-${SIMTYPE}-${E}-ID0-Ze${Z}deg-${W}wob-${N}-Cut-${CUT}"
echo "IRFDIR $IRFDIR"
echo "IRFFILE $IRFFILE"
if [[ ! -s "$IRFDIR/$IRFFILE.root" ]]; then
echo "SKIPPED missing $E ATM$A $CUT Ze$Z Woff$W NSB$N: $IRFDIR/$IRFFILE.root"
SKIPPED=$((SKIPPED+1))
continue
fi
echo "TESTED $E ATM$A $CUT Ze$Z Woff$W NSB$N"
TESTED=$((TESTED+1))
if [[ -n $COMPAREVERSION ]]; then
COMPARESIMTYPE=${COMPARESIMTYPE:-$SIMTYPE}
COMPARECUT=${COMPARECUT:-$CUT}
Comment thread
GernotMaier marked this conversation as resolved.
COMP_IRFDIR=${IRFDIR//"$VERSION"/"$COMPAREVERSION"}
COMP_IRFDIR=${COMP_IRFDIR//"$SIMTYPE"/"$COMPARESIMTYPE"}
COMP_IRFFILE=${IRFFILE//"$SIMTYPE"/"$COMPARESIMTYPE"}
Expand All @@ -97,3 +103,7 @@ do
done
done
done

done
echo "IRF coverage: $TESTED tested; $SKIPPED missing combinations skipped"
((TESTED > 0)) || exit 1
Loading