Jpp
JRA_projections.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 # _________ ___ _
4 # |_ | ___ \ / _ \ | |
5 # | | |_/ / _ _ __ / /_\ \_ __ __ _| |_ _ _______ _ __
6 # | | / | | | '_ \| _ | '_ \ / _` | | | | |_ / _ \ '__|
7 # /\__/ / |\ \ |_| | | | | | | | | | | (_| | | |_| |/ / __/ |
8 # \____/\_| \_\__,_|_| |_\_| |_/_| |_|\__,_|_|\__, /___\___|_|
9 # __/ |
10 # |___/
11 
12 script=${0##*/}
13 
14 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
15 
16 if ( do_usage $* ); then
17  usage "$script [jra file string floor out dir]"
18 fi
19 
20 set_variable WORKDIR ${PWD}
21 
22 set_variable JRA_FILE ${WORKDIR}/out/JRA_4237.root
23 
24 set_variable OUT_DIR ${WORKDIR}/out/JRA_Project
25 
26 set_variable STRING 1
27 
28 set_variable FLOOR 4
29 
30 set_variable PMT 16
31 
32 case $# in
33 
34  4)
35  OUT_DIR=$4
36  ;&
37  3)
38  FLOOR=$3
39  ;&
40  2)
41  STRING=$2
42  ;;
43  1)
44  JRA_FILE=$1
45  ;;
46  0)
47  :
48  ;;
49  *)
50  echo "Too many arguments"
51  exit
52  ;;
53 esac
54 
55 #######################################
56 #Variables that we will need to define#
57 #######################################
58 
59 if [ ! -d ${OUT_DIR} ]
60 then
61  mkdir -p ${OUT_DIR}
62 fi
63 
64 # Parse the detector file name from the complete path, and format it so that it compiles in latex.
65 
66 ####################################################################
67 # Use JFitToT to fit the ToT distributions for each PMT in the DOM #
68 ####################################################################
69 
70 if [[ ${JRA_FILE} =~ 'JRA_'(.*)(.root) ]]; then
71 RUN_NUMBER="${BASH_REMATCH[1]}"
72 fi
73 
74 N_PMTS=31
75 
76 SLICES=""
77 
78 for((j=0;j<N_PMTS;j++)); do
79  SLICES=$SLICES" $(echo ${j} - 0.5 | bc -l | sed -e 's/^\./0./' -e 's/^-\./-0./') $(echo ${j} + 0.5 | bc)"
80 done
81 
82 JProject2D -f "${JRA_FILE}:Detector/DU${STRING}/F${FLOOR}/h_pmt_rate_distributions_TimesliceL1" -P x -y "${SLICES}" -o "${OUT_DIR}/JRA_proj_${RUN_NUMBER}_S${STRING}F${FLOOR}_TSL1.root"
83 
84 JProject2D -f "${JRA_FILE}:Detector/DU${STRING}/F${FLOOR}/h_pmt_rate_distributions_Summaryslice" -P x -y "${SLICES}" -o "${OUT_DIR}/JRA_proj_${RUN_NUMBER}_S${STRING}F${FLOOR}_Summary.root"
85 
86 JProject2D -f "${JRA_FILE}:Detector/DU${STRING}/F${FLOOR}/h_fifo_almost_full" -P x -y "${SLICES}" -o "${OUT_DIR}/JRA_proj_${RUN_NUMBER}_S${STRING}F${FLOOR}_FIFO.root"
87 
88 JProject2D -f "${JRA_FILE}:Detector/DU${STRING}/F${FLOOR}/h_hrv" -P x -y "${SLICES}" -o "${OUT_DIR}/JRA_proj_${RUN_NUMBER}_S${STRING}F${FLOOR}_HRV.root"
89 
90 JProject2D -f "${JRA_FILE}:Detector/DU${STRING}/F${FLOOR}/h_rate_vs_time_Summaryslice" -P x -y "${SLICES}" -o "${OUT_DIR}/JRA_proj_${RUN_NUMBER}_S${STRING}F${FLOOR}_summary_rate_vs_t.root"
91 
92 JProject2D -f "${JRA_FILE}:Detector/DU${STRING}/F${FLOOR}/h_rate_vs_time_TimesliceL1" -P x -y "${SLICES}" -o "${OUT_DIR}/JRA_proj_${RUN_NUMBER}_S${STRING}F${FLOOR}_L1_rate_vs_t.root"
93 
94 
95 JPlot1D -f "${OUT_DIR}/JRA_proj_${RUN_NUMBER}_S${STRING}F${FLOOR}_TSL1.root:h_pmt_rate_distributions_TimesliceL1_px\\[$(echo ${PMT} - 0.5 | bc -l | sed -e 's/^\./0./' -e 's/^-\./-0./')" -x "1e-3 1e1" -X -y "1e-1 1e6" -O "hist" -Y -G "[X][Y]" -T "TimesliceL1 S${STRING}F${FLOOR}PMT${PMT}" -o "${OUT_DIR}/rateL1_PMT_${PMT}.png" -B
96 
97 JPlot1D -f "${OUT_DIR}/JRA_proj_${RUN_NUMBER}_S${STRING}F${FLOOR}_Summary.root:h_pmt_rate_distributions_Summaryslice_px\\[$(echo ${PMT} - 0.5 | bc -l | sed -e 's/^\./0./' -e 's/^-\./-0./')" -x "1e-3 1e3" -X -y "1e-1 1e6" -Y -O "hist" -G "[X][Y]" -T "Summaryslice S${STRING}F${FLOOR}PMT${PMT}" -o "${OUT_DIR}/rateSummary_PMT_${PMT}.png" -B
98 
99 JPlot1D -f "${OUT_DIR}/JRA_proj_${RUN_NUMBER}_S${STRING}F${FLOOR}_summary_rate_vs_t.root:h_rate_vs_time_Summaryslice_px\\[$(echo ${PMT} - 0.5 | bc -l | sed -e 's/^\./0./' -e 's/^-\./-0./')" -y "1e-1 1e6" -Y -G "[X][Y]" -T "Summaryslice S${STRING}F${FLOOR}PMT${PMT}" -O "hist" -o "${OUT_DIR}/rateSummary_t_PMT_${PMT}.png" -B
100 
101 JPlot1D -f "${OUT_DIR}/JRA_proj_${RUN_NUMBER}_S${STRING}F${FLOOR}_L1_rate_vs_t.root:h_rate_vs_time_TimesliceL1_px\\[$(echo ${PMT} - 0.5 | bc -l | sed -e 's/^\./0./' -e 's/^-\./-0./')" -y "1e-1 1e6" -Y -G "[X][Y]" -T "TimesliceL1 S${STRING}F${FLOOR}PMT${PMT}" -O "hist" -o "${OUT_DIR}/rateL1_t_PMT_${PMT}.png" -B
102 
103 JPlot1D -f "${OUT_DIR}/JRA_proj_${RUN_NUMBER}_S${STRING}F${FLOOR}_FIFO.root:h_fifo_almost_full_px\\[$(echo ${PMT} - 0.5 | bc -l | sed -e 's/^\./0./' -e 's/^-\./-0./')" -y "0 2" -T "FIFO S${STRING}F${FLOOR}PMT${PMT}" -O "hist" -o "${OUT_DIR}/FIFO_${PMT}.png" -B
104 
105 JPlot1D -f "${OUT_DIR}/JRA_proj_${RUN_NUMBER}_S${STRING}F${FLOOR}_HRV.root:h_hrv_px\\[$(echo ${PMT} - 0.5 | bc -l | sed -e 's/^\./0./' -e 's/^-\./-0./')" -y "0 2" -T "HRV S${STRING}F${FLOOR}PMT${PMT}" -O "hist" -o "${OUT_DIR}/HRV_${PMT}.png" -B