Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
seaTimeCalibration.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2#
3#
4# \author acreusot
5#
6version=1.0
7script=${0##*/}
8
9# ------------------------------------------------------------------------------------------
10#
11# Utility script to test sea time calibration.
12#
13# ------------------------------------------------------------------------------------------
14# all data related to intradom time calibration have to be set in the same directory
15#
16# When performing a time calibration between DOMs, some PMT time offsets must be kept fixed.
17# for standard sea time calibration, the time offsets kept fixed are those of the
18# reference PMTs. The identity of the reference PMT can be given in argument as an integer
19# (since all DOMs are supposed to have the same reference PMT, 7 or 15 most of the time).
20#
21# In case of a time calibration after a threshold tuning, or in case of different
22# reference PMT identity for each DOM, a file can be given as an argument. The file
23# contains a list of DOM and PMT identities that must have a fix time offset.
24
25if [ -z $JPP_DIR ]; then
26 echo "Variable JPP_DIR undefined."
27 exit
28fi
29
30source $JPP_DIR/setenv.sh $JPP_DIR
31
32set_variable DEBUG 1
33
34if do_usage $*; then
35 usage "$script <working directory> <detector file> <intra data directory> <reference PMTs>"
36fi
37
38case $# in
39 4) set_variable PMT $4;
40 set_variable INTRADIR $3;
41 set_variable DETX $2;
42 set_variable WORKDIR $1;;
43 *) fatal "wrong number of arguments!";;
44esac
45
46if [[ ${PMT} =~ ^[+-]?[0-9]+$ ]]; then
47 set_variable pmtList "-1 ${PMT}"
48 set_variable pmtName ${PMT}
49else
50 set_variable pmtList "`cat ${WORKDIR}/${PMT}`"
51 set_variable pmtName "Mixed"
52fi
53
54FILELISTINTRA1=()
55for FILEPATH in $(ls ${WORKDIR}/${INTRADIR}/); do
56 FILELISTINTRA1+=("${WORKDIR}/${INTRADIR}/${FILEPATH}")
57done
58set_variable FILELISTINTRA2 ${FILELISTINTRA1}
59set_variable BASENAME ${DETX%.detx}
60
61JCalibrateK40 \
62 -d $DEBUG \
63 -f ${FILELISTINTRA2} \
64 -a ${WORKDIR}/${DETX} \
65 -o calibrateK40_sea.root \
66 -b rates \
67 -C JDAQTimesliceL1 \
68 -V0+1e5 \
69 -M2+31
70
71JMergeCalibrateK40 \
72 -d $DEBUG \
73 -f calibrateK40_sea.root \
74 -o mergecalibrateK40_sea.root
75
76JConvertDetectorFormat -a ${WORKDIR}/${DETX} -o ${WORKDIR}/${BASENAME}_seaCalibration_pmt${pmtName}.detx
77
78JFitK40 \
79 -d $DEBUG \
80 -f mergecalibrateK40_sea.root \
81 -a ${WORKDIR}/${BASENAME}_seaCalibration_pmt${pmtName}.detx \
82 -o fitK40_pmt${pmtName}_sea.root \
83 -! ${pmtList} \
84 -A \
85 -w