@@ -6,14 +6,15 @@ RMIN=100.
66WRITER_PATH=$DELPHESO2_ROOT /lut/
77OUT_PATH=.
88OUT_TAG=
9+ PARALLEL_JOBS=1
910PARTICLES=" 0 1 2 3 4"
1011
1112# Get the options
1213while getopts " :t:B:R:p:o:T:P:h" option; do
1314 case $option in
1415 h) # display Help
1516 echo " Script to generate LUTs from LUT writer, arguments:"
16- echo " Syntax: ./create_luts.sh [-h|t|B|R|p|o|T|P]"
17+ echo " Syntax: ./create_luts.sh [-h|t|B|R|p|o|T|P|j ]"
1718 echo " options:"
1819 echo " -t tag of the LUT writer [default]"
1920 echo " -B Magnetic field in T [0.5]"
@@ -22,6 +23,7 @@ while getopts ":t:B:R:p:o:T:P:h" option; do
2223 echo " -o Output path where to write the LUTs [.]"
2324 echo " -T Tag to append to LUTs [\"\" ]"
2425 echo " -P Particles to consider [\" 0 1 2 3 4\" ]"
26+ echo " -j Number of parallel processes to use [1]"
2527 echo " -h Show this help"
2628 exit
2729 ;;
@@ -68,15 +70,19 @@ function do_copy() {
6870}
6971
7072do_copy " ${WRITER_PATH} /lutWrite.$WHAT .cc" " lut writer"
73+ do_copy " ${WRITER_PATH} /DetectorK/HistoManager.h"
7174do_copy " ${WRITER_PATH} /DetectorK/DetectorK.cxx"
7275do_copy " ${WRITER_PATH} /DetectorK/DetectorK.h"
7376do_copy " ${WRITER_PATH} /lutWrite.cc"
74- do_copy " ${WRITER_PATH} /lutCovm.hh"
75- cp -r " ${WRITER_PATH} /fwdRes" .
77+ if [[ -z ${DELPHESO2_ROOT} ]]; then
78+ do_copy " ${WRITER_PATH} /lutCovm.hh"
79+ fi
80+ cp -r " ${WRITER_PATH} /fwdRes" .
7681
7782echo " --- creating LUTs: config = ${WHAT} , field = ${FIELD} T, min tracking radius = ${RMIN} cm"
7883
79- for i in $PARTICLES ; do
84+ function do_lut_for_particle() {
85+ i=${1}
8086 root -l -b << EOF
8187 .L DetectorK.cxx+
8288 .L lutWrite.${WHAT} .cc
@@ -105,8 +111,20 @@ for i in $PARTICLES; do
105111 }
106112
107113EOF
114+
115+ }
116+
117+ root -l -b << EOF
118+ .L DetectorK.cxx+
119+ EOF
120+
121+ for i in ${PARTICLES} ; do
122+ (( i= i% PARALLEL_JOBS)) ; (( i++== 0 )) && wait
123+ do_lut_for_particle " ${i} " &
108124done
109125
126+ wait
127+
110128# Checking that the output LUTs are OK
111129NullSize=" "
112130P=(el mu pi ka pr de tr he3)
0 commit comments