Jpp  17.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SN_timecalib.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 script=${0##*/}
3 
4 if [ -z $JPP_DIR ]; then
5  echo "Variable JPP_DIR undefined."
6  exit
7 fi
8 
9 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
10 
11 if do_usage $*; then
12  usage "$script <DEETECTOR_ID> <input detector file> <output detector file> <first run> <last run> <name suffix> <output directory> <data directory>"
13 fi
14 
16 DETECTOR_IN=$2
17 DETECTOR_OUT=$3
18 RUNFIRST=$4
19 RUNSECOND=$5
20 EXT=$6
21 OUTDIR=$7
22 DATADIR=$8
23 
24 #--- copy detector
25 
26 JConvertDetectorFormat -a $DETECTOR_IN -o $DETECTOR_OUT
27 
28 #--- remove the base modules
29 
30 eval `JPrintDetector -a $DETECTOR_OUT -O SUMMARY`
31 
32 
33 for STRING in $STRINGS; do
34 
35  JEditDetector -a $DETECTOR_OUT -o $DETECTOR_OUT -D "$STRING 0"
36 
37 done
38 
39 #--- sort modules 1-18
40 JEditDetector -a $DETECTOR_OUT -o $DETECTOR_OUT -O 2
41 
42 #--- remove here malfunctioning strings if present in the detector file
43 
44 #JEditDetector -a $DETECTOR_OUT -o $DETECTOR_OUT -r 18
45 #JEditDetector -a $DETECTOR_OUT -o $DETECTOR_OUT -r 19
46 
47 #--- loop over data files
48 
49 rm $OUTDIR/${EXT}.root
50 
51 for RUN_IN in `seq $RUNFIRST $RUNSECOND`; do
52 
53 RUN=$(printf %08d $RUN_IN)
54 INFILE=$DATADIR/KM3NeT_000000${DETECTOR_ID}_${RUN}.root
55 
56 #---- process JMonitorL1dt
57 
58 $JPP_DIR/examples/JCalibrate/JMonitorL1dt -a $DETECTOR_OUT -C JDAQTimesliceSN -f $INFILE -o $OUTDIR/temp.root
59 
60 if [ -f "$OUTDIR/${EXT}.root" ]
61 then
62 echo "JMonitorL1dt output added to previous results"
63  hadd $OUTDIR/sum.root $OUTDIR/temp.root $OUTDIR/${EXT}.root
64  mv $OUTDIR/sum.root $OUTDIR/${EXT}.root
65 else
66  echo "No previous output from JMonitorL1dt found, new output file created"
67  mv $OUTDIR/temp.root $OUTDIR/${EXT}.root
68 fi
69 
70 
71 done
72 
73 #--- determine time offsets between DU pairs (for 1-8 neighboured levels)
74 
75 $JPP_DIR/examples/JCalibrate/JOffset_extract -a $DETECTOR_OUT -f $OUTDIR/${EXT}.root -m 0 -n 8 > $OUTDIR/${EXT}.txt
76 
77 #--- evaluate best inter-DU offsets
78 #
79 # The argument "-m 5.5" needs to be tuned to the amount of data used, for 30 hours of ARCA a value of 5.5 was found reasonable,
80 # for 6 hours of ORCA a value of 20 is suggested
81 #
82 
83 file=$OUTDIR/offsets_${EXT}.txt
84 $JPP_DIR/examples/JCalibrate/JMatrix_sol -a $DETECTOR_OUT -f $OUTDIR/${EXT}.txt -m 5.5 -r 0 > $file
85 
86 #--- adapt detector file
87 
88 while read line; do
89  read -r a b <<< $line
90  if [ $a -gt 0 ]
91  then
92  JEditDetector -a $DETECTOR_OUT -S "$a add $b" -o $DETECTOR_OUT --!
93  fi
94 done < $file
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null if do_usage *then usage $script< DEETECTOR_ID >< inputdetectorfile >< outputdetectorfile >< firstrun >< lastrun >< namesuffix >< outputdirectory >< datadirectory > fi DETECTOR_ID
Definition: SN_timecalib.sh:15
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
*fatal Wrong number of arguments esac check_input_file $INPUT_FILE for TIMESLICE in JDAQTimeslice JDAQTimesliceL0 JDAQTimesliceL1 JDAQTimesliceL2 JDAQTimesliceSN
clean eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY set_variable STRING
do JEditDetector a $DETECTOR_OUT o $DETECTOR_OUT D $STRING done JEditDetector a $DETECTOR_OUT o $DETECTOR_OUT O rm $OUTDIR
Definition: SN_timecalib.sh:49
o $QUALITY_ROOT d $DEBUG!JPlot1D f
Definition: JDataQuality.sh:66
exit
Definition: JPizza.sh:36
data_type r[M+1]
Definition: JPolint.hh:758
then echo
do JCanberra a $DETECTOR f $INPUT_FILE o $WORKDIR canberra[${EMITTER}\] root T $WORKDIR tripod txt V $WORKDIR sound_velocity txt M $WORKDIR mechanics txt H $WORKDIR hydrophone txt E $EMITTER $DISABLE d $DEBUG!done kill_child_processes_at_exit attach getModule a $DETECTOR typeset Z STRING typeset Z FLOOR for STRING in $STRINGS[*]
Definition: JCanberra.sh:68
static const double C
Physics constants.
const int n
Definition: JPolint.hh:676
then rm i $OUTPUT_FILE fi let RUN
* usage
then JConvertDetectorFormat a $DETECTOR[1] o
do set_variable SIGMA_NS set_variable OUTLIERS set_variable OUTPUT_FILE matrix[${ALPHA_DEG}\deg\] root $JPP JMatrixNZ a $DETECTOR f $INPUT_FILE o $OUTPUT_FILE S
Definition: JMatrixNZ.sh:58
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
then JCalibrateToT a
Definition: JTuneHV.sh:116
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
script
Definition: JAcoustics.sh:2
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null
esac done
Definition: JAddHDE.sh:21