Jpp  master_rocky-43-ge265d140c
the software that should make you happy
JMuonPath.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 #
3 # \author mdejong
4 #
5 version=1.0
6 script=${0##*/}
7 
8 # ------------------------------------------------------------------------------------------
9 #
10 # Utility script to test JMuonPath on Monte Carlo true muons.
11 #
12 # ------------------------------------------------------------------------------------------
13 
14 if [ -z $JPP_DIR ]; then
15  echo "Variable JPP_DIR undefined."
16  exit
17 fi
18 
19 source $JPP_DIR/setenv.sh $JPP_DIR
20 
21 set_variable DEBUG 2
22 set_variable PDF $JPP_DATA/J%p.dat
23 set_variable: RATE_HZ RECONSTRUCTION_RATE_HZ 6.0e3
24 set_variable TTS_NS 2.0
25 set_variable E_GEV 1e3
26 set_variable ROAD_WIDTH_M 200
27 set_variable: FORMAT GRAPHICS_FORMAT gif
28 set_variable+ BATCH GRAPHICS_BATCH -B
29 
30 if do_usage $*; then
31  usage "$script <detector file> <input file> <output file> <option>"\
32  "\nPossible options: run, plot, clean."
33 fi
34 
35 if (( $# != 4 )); then
36  fatal "Wrong number of arguments."
37 fi
38 
39 set_variable DETECTOR $1
40 set_variable INPUT_FILE $2
41 set_variable OUTPUT_FILE $3
42 set_variable OPTION $4
43 
44 if [[ ! "$OUTPUT_FILE" == *"%"* ]]; then
45  fatal "The output file must have the wildcard % in the name, e.g. %.root"
46 fi
47 
48 if [[ $OPTION != "run" && $OPTION != "plot" && $OPTION != "clean" ]]; then
49  fatal "Invalid option $OPTION."
50 fi
51 
52 if [[ $OPTION == "run" ]]; then
53 
54  JMuonMCEvt \
55  -f $INPUT_FILE \
56  -o ${OUTPUT_FILE/\%/mc} \
57  -d ${DEBUG} --!
58 
59  $JPP_DIR/examples/JReconstruction/JMuonPath \
60  -a $DETECTOR \
61  -P $PDF \
62  -f ${OUTPUT_FILE/\%/mc} \
63  -o ${OUTPUT_FILE/\%/path} \
64  -N 1 \
65  -T ${TTS_NS} \
66  -B ${RATE_HZ} \
67  -E ${E_GEV} \
68  -R ${ROAD_WIDTH_M} \
69  -d ${DEBUG} --!
70 fi
71 
72 if [[ $OPTION == "plot" ]]; then
73 
74  JMuonPostfit \
75  -f ${OUTPUT_FILE/\%/path} \
76  -o postfit\[path\].root \
77  -A 1003 \
78  -O N
79 
80  JPlot1D \
81  -f postfit\[path\].root:hx \
82  -> "angle [deg]" \
83  -\^ "number of events [a.u.]" \
84  -XX \
85  -T "" \
86  -o angle.$FORMAT $BATCH
87 
88  QUANTILES="0.33 0.5 0.66"
89 
90  JQuantiles2D \
91  -f postfit\[path\].root:h2 \
92  -Q "$QUANTILES" \
93  -o quantiles\[path\].root
94 
95  JPlot1D \
96  -f quantiles\[path\].root:h21 \
97  -> "number of modules" \
98  -\^ "resolution (reco muon) [deg]" \
99  -y "1e-2 1e2" \
100  -Y \
101  -T "" \
102  -o resolution.$FORMAT $BATCH
103 fi
104 
105 if [[ $OPTION == "clean" ]]; then
106  rm -f ${OUTPUT_FILE/\%/mc}
107  rm -f ${OUTPUT_FILE/\%/path}
108  rm -f postfit\[path\].root
109  rm -f quantiles\[path\].root
110  rm -f angle.$FORMAT
111  rm -f resolution.$FORMAT
112 fi