-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_emi.sh
101 lines (90 loc) · 5.13 KB
/
run_emi.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
#####################################################################################
# EXTERNAL MUON IDENTIFICATION SCRIPT #
#####################################################################################
# #
# #
# #
# #
# #
# #
# #
# #
# #
# #
# #
# #
#####################################################################################
#example commad: source run_emi.sh N -yall
#####################################################################################
# Main script starts
main ()
{
# checking if environment is set correctly
if [[ "${script_dir}" != *"dune"* ]]
then
# setting environmental variables
echo -e "\e[31mPlease set the environment vars first by sourcing set_env.sh in the main dir.\e[0m"
return 1
fi
# right executable directory check
if [[ "$(pwd)" != *"${script_dir}"* ]]
then
echo -e "\e[31m Error: must be run from: \"${script_dir}\"!"
echo -e " Exiting...\e[0m"
else
echo -e "\e[96m";
echo " Loading NN cut values..."
echo " source ${script_dir}/nn_config.sh"
source ${script_dir}/nn_config.sh
# entering the build directory
cd $build_dir;
nfiles="$1";
t_stamp=$(date +"%Y%m%d%H%M%S");
tag="${t_stamp}_${nfiles}_files"; #try to give a time tag
root_file="out30_chi100_${tag}_EXTMUID.root"
output="${nn_input_dir}${root_file}";
echo " Build dir : ${build_dir}";
echo " Source dir: ${source_dir}";
echo " Output : $output"
sleep 2;
echo $output >> "${script_dir}/misc/out_list.txt"
sleep 1;
echo " Target file: $output"
echo " ./runMuID_EXTMUID_NN \"${script_dir}input/$file_list\" $nfiles \"${output}\" \"${ecal_cut}\" \"${emi_cut}\""
./runMuID_EXTMUID_NN "${script_dir}/input/$file_list" "$nfiles" "${output}" "${ecal_cut}" "${emi_cut}"
echo -e "\e[32m "
if [[ "$@" != *"yall"* ]]
then
while true; do
read -p " Do you wish to train the ANN? " yn
case $yn in
[Yy]* ) echo " Compiling the ANN code first, so that a change in architexture doesn't go un-updated...";
echo " g++ ${source_dir}/runNN_EXTMUID.cpp `root-config --glibs --cflags` -lTreePlayer -lMLP -lXMLIO -o ${build_dir}/runNN_EXTMUID";
g++ ${source_dir}/runNN_EXTMUID.cpp `root-config --glibs --cflags` -lTreePlayer -lMLP -lXMLIO -o ${build_dir}/runNN_EXTMUID;
echo " ./runNN_EXTMUID \"${nn_input_dir}\" \"${root_file}\" \"${nn_output_dir}\"";
./runNN_EXTMUID "${nn_input_dir}" "${root_file}" "${nn_output_dir}";
break;;
[Nn]* ) " Ok! Skipping the training..."; return 0;;
* ) echo -e "\e[0m"; echo -e "\e[93m Please answer y/n:\e[0m ";;
esac
done
else
echo " Compiling the ANN code first, so that a change in architexture doesn't go un-updated...";
echo " g++ ${source_dir}/runNN_EXTMUID.cpp `root-config --glibs --cflags` -lTreePlayer -lMLP -lXMLIO -o ${build_dir}/runNN_EXTMUID";
g++ ${source_dir}/runNN_EXTMUID.cpp `root-config --glibs --cflags` -lTreePlayer -lMLP -lXMLIO -o ${build_dir}/runNN_EXTMUID;
echo -e "\e[32m Training the ANN...";
echo " ./runNN_EXTMUID \"${nn_input_dir}\" \"${root_file}\" \"${nn_output_dir}\"";
./runNN_EXTMUID "${nn_input_dir}" "${root_file}" "${nn_output_dir}";
fi
echo -e "\e[96m "
fi #SCRIPT DIRECTORY CHECK IF CONDITION ENDS
cd $script_dir;
echo -e "\e[96m Took $SECONDS for \"main\" to finish..."
echo -e " Exiting...\e[0m"
return 0;
}
# Main script ends
#####################################################################################
# inputs to main
main "$@"