Jpp  master_rocky-43-ge265d140c
the software that should make you happy
JMergeRunAnalyzer.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 
3 version=1.0
4 script=${0##*/}
5 
6 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
7 
8 if do_usage $*; then
9  usage "$script <input_files> <output_file(.root)> [only_directory_path]"
10 fi
11 
12 set_variable: ONLY_DIR INPUT_DIR 0
13 set_variable: WORKDIR WORKDIR `pwd`
14 set_variable: FORMAT GRAPHICS_FORMAT pdf
15 
16 case $# in
17  3) set_variable ONLY_DIR $3;&
18  2) set_variable OUT_FILE $2
19  set_variable JRA_FILES $1;;
20  *) fatal "Wrong number of arguments"
21 esac
22 
23 set_variable INPUT_FILES ${JRA_FILES}
24 
25 if [[ ${ONLY_DIR} != 0 ]]
26 then
27 set_variable INPUT_FILES `echo ${JRA_FILES}/*`
28 fi
29 
30 set_variable OUT_PATH `readlink -f $(dirname ${OUT_FILE})`
31 set_variable JRA_DIR ${JPP_DIR}/software/JRunAnalyzer
32 set_variable FILEPREFIX "plot"
33 
34 if [ ! -d ${OUT_PATH} ]
35 then
36  mkdir -p ${OUT_PATH}
37 fi
38 
39 time ${JRA_DIR}/JMergeRunAnalyzer \
40  -f $INPUT_FILES \
41  -o $OUT_FILE --!
42 
43 #****** Create Profiling and Projection of the TH2Ds *******#
44 
45 JProfile2D \
46  -f ${OUT_FILE}:h_pmt_rate_distribution \
47  -f ${OUT_FILE}:h_Triggered_hits \
48  -f ${OUT_FILE}:h_Snapshot_hits \
49  -f ${OUT_FILE}:h_Number_of_overlays \
50  -o px_${OUT_FILE} \
51  -P "X" \
52  -O "g" --!
53 
54 JProject2D \
55  -f ${OUT_FILE}:h_Triggered_over_Snapshot_hits \
56  -o pjx_${OUT_FILE} \
57  -P "X" \
58  -y "0 0.5" --!
59 
60 JPlot1D \
61  -w 900x600 \
62  -f px_${OUT_FILE}:h_pmt_rate_distribution_px \
63  -o $WORKDIR/${FILEPREFIX}_pmt_rate_distribution.${FORMAT} \
64  -^ "Mean PMT rate" \
65  -B \
66  -T "%" --!
67 
68 convert -define pdf:use-cropbox=true -density 400 -resample 200 \
69  ${FILEPREFIX}_pmt_rate_distribution.${FORMAT} ${FILEPREFIX}_pmt_rate_distribution.png
70 
71 JPlot1D \
72  -w 900x600 \
73  -f px_${OUT_FILE}:h_Triggered_hits_px \
74  -f px_${OUT_FILE}:h_Triggered_hits_3dmuon_px \
75  -o $WORKDIR/${FILEPREFIX}_triggered_hits.${FORMAT} \
76  -^ "Number of triggered hits (red = JTrigger3DMuon)" \
77  -B \
78  -T "%" --!
79 
80 convert -define pdf:use-cropbox=true -density 400 -resample 200 \
81  ${FILEPREFIX}_triggered_hits.${FORMAT} ${FILEPREFIX}_triggered_hits.png
82 
83 JPlot1D \
84  -w 900x600 \
85  -f px_${OUT_FILE}:h_Snapshot_hits_px \
86  -o $WORKDIR/${FILEPREFIX}_snapshot_hits.${FORMAT} \
87  -^ "Number of snapshot hits" \
88  -B \
89  -T "%" --!
90 
91 convert -define pdf:use-cropbox=true -density 400 -resample 200 \
92  ${FILEPREFIX}_snapshot_hits.${FORMAT} ${FILEPREFIX}_snapshot_hits.png
93 
94 JPlot1D \
95  -w 900x600 \
96  -f px_${OUT_FILE}:h_Number_of_overlays_px \
97  -o $WORKDIR/${FILEPREFIX}_number_overlays.${FORMAT} \
98  -y "0 30" \
99  -^ "Number of overlays" \
100  -B \
101  -T "%" --!
102 
103 convert -define pdf:use-cropbox=true -density 400 -resample 200 \
104  ${FILEPREFIX}_number_overlays.${FORMAT} ${FILEPREFIX}_number_overlays.png
105 
106 JPlot1D \
107  -w 900x600 \
108  -f pjx_${OUT_FILE}:h_Triggered_over_Snapshot_hits_px \
109  -o $WORKDIR/${FILEPREFIX}_number_slices.${FORMAT} \
110  -^ "Number of slices" \
111  -Y \
112  -B \
113  -T "%" --!
114 
115 convert -define pdf:use-cropbox=true -density 400 -resample 200 \
116  ${FILEPREFIX}_number_slices.${FORMAT} ${FILEPREFIX}_number_slices.png
117 
118 JPlot2D \
119  -w 900x600 \
120  -f ${OUT_FILE}:h_event_duration \
121  -o $WORKDIR/${FILEPREFIX}_event_duration.${FORMAT} \
122  -Y \
123  -Z \
124  -B \
125  -O "colz" \
126  -p "57" \
127  -T "%" --!
128 
129 convert -define pdf:use-cropbox=true -density 400 -resample 200 \
130  ${FILEPREFIX}_event_duration.${FORMAT} ${FILEPREFIX}_event_duration.png
131 
132 # Check whether ghostscript is installed, and if, combine all plots
133 
134 if (( $+commands[gs] )); then
135  convert ${FILEPREFIX}_*.${FORMAT} ${FILEPREFIX}_JMRA.${FORMAT}
136  gs -dNOPAUSE -SDEVICE=pdfwrite -sOUTPUTFILE=${FILEPREFIX}_JMRA.${FORMAT} -dBATCH ${FILEPREFIX}_*.${FORMAT}
137  /bin/ls ${FILEPREFIX}_*.${FORMAT} | grep -v ${FILEPREFIX}_JMRA.${FORMAT} | xargs -0 -d '\n' rm
138 fi
139 
140 rm px_${OUT_FILE}
141 rm pjx_${OUT_FILE}
142 
143 CHECK_EXIT_CODE