--- /dev/null
+
+if test -z "$1"; then
+ echo "usage: ./check_tot2.sh filename"
+ exit
+fi
+
+NN=100
+#typeset -i events=0
+typeset -i minevt=1500000
+#while [ "$events" -lt "$minevt" ]; do
+# echo "while"
+daq_anal -x <<EOF $1 >& daq_anal.dat
+
+EOF
+
+
+ events1=$(cat daq_anal.dat | grep events | cut -c 13-32 | tr -d ' ')
+ echo "davor"
+# events=$( awk '{print events1}' )
+ echo "danach"
+# events=$((0 + $events1))
+ echo $events1
+ echo "$(($events1))"
+
+#done
+
+
+
+# this is the famous Carsten programming style...
+
+# Trailing no TOT
+hldprint <<EOF $1 -raw -num $NN -onlytdc 0x2000 | grep 'sing:0' | grep -v 'tot' | wc -l > check_tot2.dat
+
+EOF
+
+# Trailing & TOT
+hldprint <<EOF $1 -raw -num $NN -onlytdc 0x2000 | grep 'sing:0' | grep 'tot' | wc -l >> check_tot2.dat
+
+EOF
+
+# Leading & TOT
+hldprint <<EOF $1 -raw -num $NN -onlytdc 0x2000 | grep 'sing:1' | wc -l >> check_tot2.dat
+
+EOF
+
+
+# ~/trbsoft/daqtools/users/gsi_dirc/check_tot2
+