8 # ------------------------------------------------------------------------------------------
 
   10 #                 Utility script to test JMuonPath on Monte Carlo true muons.
 
   12 # ------------------------------------------------------------------------------------------
 
   14 if [ -z $JPP_DIR ]; then
 
   15     echo "Variable JPP_DIR undefined."
 
   19 source $JPP_DIR/setenv.sh $JPP_DIR
 
   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
 
   31     usage "$script <detector file> <input file> <output file> <option>"\
 
   32           "\nPossible options: run, plot, clean."
 
   35 if (( $# != 4 )); then
 
   36     fatal "Wrong number of arguments."
 
   39 set_variable  DETECTOR      $1
 
   40 set_variable  INPUT_FILE    $2
 
   41 set_variable  OUTPUT_FILE   $3
 
   42 set_variable  OPTION        $4
 
   44 if [[ ! "$OUTPUT_FILE" == *"%"* ]]; then
 
   45     fatal "The output file must have the wildcard % in the name, e.g. %.root"
 
   48 if [[ $OPTION != "run" && $OPTION != "plot" && $OPTION != "clean" ]]; then
 
   49     fatal "Invalid option $OPTION."
 
   52 if [[ $OPTION == "run" ]]; then
 
   56         -o ${OUTPUT_FILE/\%/mc}         \
 
   59     $JPP_DIR/examples/JReconstruction/JMuonPath \
 
   62         -f ${OUTPUT_FILE/\%/mc}         \
 
   63         -o ${OUTPUT_FILE/\%/path}       \
 
   72 if [[ $OPTION == "plot" ]]; then
 
   75         -f ${OUTPUT_FILE/\%/path}           \
 
   76         -o postfit\[path\].root             \
 
   81         -f postfit\[path\].root:hx          \
 
   83         -\^ "number of events [a.u.]"       \
 
   86         -o angle.$FORMAT                    $BATCH
 
   88     QUANTILES="0.33 0.5 0.66"
 
   91         -f postfit\[path\].root:h2          \
 
   93         -o quantiles\[path\].root
 
   96         -f quantiles\[path\].root:h21       \
 
   97         -> "number of modules"             \
 
   98         -\^ "resolution (reco muon) [deg]"  \
 
  102         -o resolution.$FORMAT               $BATCH
 
  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
 
  111     rm -f resolution.$FORMAT