4 # -------------------------------------------------------------------------------------------- 
    6 # Steering script for the global-fit-of-global-fits procedure of the D0ARCA009 (94) detector. 
    8 # -------------------------------------------------------------------------------------------- 
   10 if [ -z $JPP_DIR ]; 
then 
   11     echo "Variable JPP_DIR undefined." 
   15 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/
null 
   18 set_array     
RUNS                   11342 11345 11347 11374 11376
 
   19 #set_variable: STAGES                 ACOUSTICS_STAGES   1 2 3 
   22     usage "$script [<detector file> <tripod file>] [user directory]"\
 
   23           "\nThe user directory should be specified when this script is submitted in a batch queue."\
 
   24           "\nThe optional detector file and tripod file correspond to a pre-calibrated sub-detector." 
   36     *)  fatal 
"Wrong number of arguments." 
   48 if [[ ! -
f $DETECTOR_INITIAL ]]; 
then 
   57 if [[ ! -
f $TRIPOD_INITIAL ]]; 
then 
   59     cat>$TRIPOD_INITIAL<<EOF
 
   60 # Very preliminary acoustic emitter positions from survey
 
   61 2  +256815.500 +4743395.000 -2436.677
 
   62 3  +257096.200 +4743636.000 -2439.354
 
   63 4  +256919.238 +4743354.178 -2439.354
 
   68 # Apply modifications to the 
detector and tripod 
file, 
if any.
 
   71     -
a $DETECTOR_INITIAL     \
 
   74 if [[ -
n "$DETECTOR" ]]; 
then 
   88 if [[ -
n "$TRIPOD" ]]; 
then 
   90     source JAcoustics.sh --
 
   96     typeset -
A TRIPODS_INITIAL
 
   98     get_tripods $TRIPOD_INITIAL TRIPODS_INITIAL
 
  100     cp -p  $TRIPOD_INITIAL  tripod.txt
 
  102     for ID in ${(@
k)TRIPODS_INITIAL}; 
do 
  103         if [[ -
n "$TRIPODS[$ID]" ]]; 
then 
  104             JEditTripod -
f tripod.txt -
T "$ID set $TRIPODS[$ID]" 
  111     cp -p  $TRIPOD_INITIAL  tripod.txt
 
  118 JAcoustics.sh $DETECTOR_ID
 
  133         for (( 
RUN = ${RANGE%%-*}; $RUN <= ${RANGE##*-}; 
RUN += 1 )); 
do 
  138     JAcoustics.sh $DETECTOR_ID
 
  151 unset_variable  ACOUSTICS_STRINGS
 
  152 unset_variable  ACOUSTICS_TRIPODS
 
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
 
then set_variable PMT_FILE set_variable DAQ_FILE set_variable OUTPUT_FILE set_variable DETECTOR else fatal Wrong number of arguments fi set_variable RUNBYRUN file
 
then JLigier sh continue fi cat
 
o $QUALITY_ROOT d $DEBUG!JPlot1D f
 
then usage $script[< detector file >< tripod file >][user directory] nThe user directory should be specified when this script is submitted in a batch queue nThe optional detector file and tripod file correspond to a pre calibrated sub detector fi set_variable WORKDIR pwd set_variable HOMEDIR $WORKDIR case set_variable HOMEDIR
 
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[*]
 
do for((RUN=${RANGE%%-*};$RUN<=${RANGE##*-};RUN+=1))
 
*fatal invalid stage $STAGE(possible stages:1, 2, 3, A, D)" 
 
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null if do_usage *then usage $script< detector identifier > fi case set_variable DETECTOR_ID
 
then fatal Detector file should be binary format fi eval JPrintDetector a $DETECTOR O IDENTIFIER typeset a INPUT_FILES for RANGE in $RUNS[*]
 
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
 
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR if do_usage *then usage $script[(input file)+] fi set_variable DEBUG set_variable WORKDIR TMPDIR
 
do set_variable OUTPUT_DIRECTORY $WORKDIR T
 
then rm i $OUTPUT_FILE fi let RUN
 
then usage $script< detector specific acoustics-fit script >< option > nAuxiliary script to make scan of pre stretching of detector strings(see JEditDetector)." "\nPossible options
 
set_variable NUMBER_OF_ITERATIONS set_variable EPSILON cat acoustics_fit_parameters txt<< EOF $CONFIGURATION[*]Nmin=3;sigma_s=100.0e-6;stdev=10.0;mestimator=0;fixStrings=0;EOF for STRING in $STRINGS[*];do#fit stretching and(z) position of given string set_variable DETECTOR_TMP ${TMPDIR:-/tmp}/detector_A.datx JEditDetector-a $DETECTOR-o $DETECTOR_TMP-r $STRING JEditDetector-a $DETECTOR-o $DETECTOR-k $STRING for MUL in 0.005 0.001;do DX_M=0.2 for((N=0;$N< $NUMBER_OF_ITERATIONS;++N));do CHI2[3]=$CHI2[1] fitPositionOfString $STRING Z $DX_M fitStretchingOfString $STRING $MUL if(($CHI2[3]-$CHI2[1]< $EPSILON));then break fi done if(($N >=$NUMBER_OF_ITERATIONS));then printf"warning: reached maximum number of iterations %d - converenge %7.3f\n"$N $(($CHI2[3]-$CHI2[1])) fi done JMergeDetector-a $DETECTOR-a $DETECTOR_TMP-o $DETECTOR rm-f $DETECTOR_TMP JConvertDetectorFormat-a $DETECTOR-o $DETECTOR-r-d 0 > &dev null done
 
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable DEBUG set_variable WORKDIR
 
then JConvertDetectorFormat a $DETECTOR[1] o
 
then set_variable MODULE getModule a $DETECTOR L $STRING $FLOOR JEditDetector a $DETECTOR M $MODULE add $X o $DETECTOR else echo No update of detector $DETECTOR
 
then error Missing CDF files error Run
 
do set_variable INPUT_FILE $WORKDIR KM3NeT_
 
do set_variable DETECTOR_TXT $WORKDIR detector
 
then fatal Not enough tripods
 
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
 
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
 
do echo Generating $dir eval D
 
then cat $TRIPOD_INITIAL<< EOF1 256877.5 4743716.7-2438.42 256815.5 4743395.0-2435.53 257096.2 4743636.0-2439.5EOFfiJEditDetector-a $DETECTOR_INITIAL-@"z = -2441.5"-s"-1 mul $MUL"-o $DETECTORcp-p $TRIPOD_INITIAL $TRIPODJAcoustics.sh $DETECTOR_IDJAcousticsEventBuilder.sh $DETECTOR $RUNS[*]cd $WORKDIRif[!$HOMEDIR-ef $WORKDIR];then cp-p $HOMEDIR/$TRIPOD $WORKDIR cp-p $HOMEDIR/$DETECTOR $WORKDIR for RANGE in $RUNS[*];do for((RUN=${RANGE%%-*};$RUN<=${RANGE##*-};RUN+=1));do cp-p $HOMEDIR/KM3NeT_ ${(l:8::0::0:) DETECTOR_ID}_ ${(l:8::0::0:) RUN}_event.root $WORKDIR done done JAcoustics.sh $DETECTOR_IDfifor STAGE in`echo $STAGES`;do $JPP_DIR/examples/JAcoustics/acoustics-fit.sh $DETECTOR $TRIPOD $STAGE $WORKDIR/KM3NeT_ ${(l:8::0::0:) DETECTOR_ID}_ *event.root > $HOMEDIR stage
 
then fatal Invalid tripod $TRIPOD
 
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null