#!/bin/sh

alias fat-reader=../../fat-reader/scripts/fat-reader.sh

fat-reader -i --mode=5 --topo=3:500:30:1000:8:40000:10000:2:500 --text=4 --dsat=31 alldata_highE.keys.i3.gz |
awk 'BEGIN {FS="([ =(),]|+-)*"; n=1} /run/ {r=$3} /event/ {e=$3} /dom/ {s=$2; o=$3; if(s>=1 && s<=86 && o>=1 && o<=60) print s, o, $9, $(13) > "dat."r"_"e"."n} /^$/ {n++}'

fat-reader -i --mode=5 --topo=3:500:30:1000:8:40000:10000:2:500 --text=4 --dsat=31 alldata_lowE.keys.i3.gz |
awk 'BEGIN {FS="([ =(),]|+-)*"; n=4} /run/ {r=$3} /event/ {e=$3} /dom/ {s=$2; o=$3; if(s>=1 && s<=86 && o>=1 && o<=60) print s, o, $9, $(13) > "dat."r"_"e"."n} /^$/ {n++}'

# awk 'BEGIN {while(0<getline<"ic40") a[$1]++} $6 in a && $7<=60 {print}' ../../fat-reader/geo-f2k > geo-f2k.ic40
