forked from konush/PFClusterCalib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runall.sh
executable file
·99 lines (73 loc) · 2.41 KB
/
runall.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
#!/bin/bash
#
# Run all PFCluster calibration steps in one shot.
# This script also serves as a source of documentation.
#
# Input root files must be produced with ncuAnalysis/PFClusterCalib CMSSW
# module and are expected to be found inside input/.
#
# NOTE: files input/ntuple_photongun_*.root were obtained with CMSSW_7_2_3_patch1.
# NOTE: in this script, there is a place with hardcoded "ntuple_photongun_nopu".
#
# NOTE: in this script, the execution of rootlogon.C is enforced.
#
# stop on first error
set -e
# draw/save distributions of input variables + deltaR + pfE/mcE + MC truth variables
python draw_inputs.py &
# draw/save fractions of various PFCluster sizes vs pT
python auxiliary/draw_pfsize.py &
# draw/save evolution of fitting function parameters with pT
python auxiliary/draw_fit_params.py &
wait
ntuples=`ls input/*.root`
mkdir -p output
echo "Training semi-parametric MVAs with GBRLikelihood:" 1>&2
for infile in $ntuples; do
# extract file name without extension
fname="${infile##*/}"
fname="${fname%.root}"
# do not use nVtx as input for the no-pileup MC
useNumVtx=true
[ "${fname%_rereco}" == "ntuple_photongun_nopu" ] && useNumVtx=false
# remove previous result, if any
rm -f output/training_results_${fname}.root
echo "
.x rootlogon.C
.x train.cc+(\"${infile}\", \"output/training_results_${fname}.root\", ${useNumVtx})
.q" | root -b -l >output/train_${fname}.log
done
echo "Evaluating outputs from semi-parametric MVAs:" 1>&2
# compile eval_one.cc
echo "
.x rootlogon.C
.L eval.cc+
.q" | root -b -l
# prepare common CINT commands for the next "for" block
cmd="vector<string> fnames"$'\n'
for name in $ntuples; do
name="${name##*/}"
cmd="${cmd}fnames.push_back(\"${name%.root}\")"$'\n'
done
for infile in $ntuples; do
# extract file name without extension
fname="${infile##*/}"
fname="${fname%.root}"
echo " ${infile} ..." 1>&2
echo "
.x rootlogon.C
$cmd
.x eval.cc+(\"${infile}\", \"output/friend_${fname}.root\", fnames)
.q" | root -b -l &
done
wait
# draw/save distributions with achieved energy resolutions
python draw_results.py &
# draw/save some slices with achieved energy resolutions
python draw_slices.py &
# draw/save some train vs test slices
python draw_overtraining.py &
# draw/save real vs estimated energy resolutions.
python draw_mva_pars.py &
wait
echo "Finished."