1 |
benhoob |
1.1 |
Dear TMVA User,
|
2 |
|
|
|
3 |
|
|
this README contains three sections
|
4 |
|
|
|
5 |
|
|
+ Overview
|
6 |
|
|
+ How to run the example
|
7 |
|
|
+ The TMVA GUI
|
8 |
|
|
|
9 |
|
|
Overview
|
10 |
|
|
========
|
11 |
|
|
|
12 |
|
|
This directory contains two files that illustrate the usage of the
|
13 |
|
|
TMVA package to perform a MultiVariate Analysis. It also contains a
|
14 |
|
|
GUI for easy access to the training result.
|
15 |
|
|
|
16 |
|
|
An MV analysis is executed in two steps, the training of the MVA
|
17 |
|
|
methods, and the application of the best suited MVA method to your
|
18 |
|
|
dataset. These two steps are shown in the files TMVAClassification.C and
|
19 |
|
|
TMVAClassificationApplication.C, respectively.
|
20 |
|
|
|
21 |
|
|
The example uses some toy data (tmva_example.root) that comes with
|
22 |
|
|
the sourceforge distribution or is available on the ROOT web. The
|
23 |
|
|
example files contains a signal and a background tree with four
|
24 |
|
|
variables.
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
TMVA_HWW.C
|
28 |
|
|
-------------
|
29 |
|
|
|
30 |
|
|
TMVA_HWW.C explains the usage of the TMVA::Factory class, which
|
31 |
|
|
is the framework for the whole training process. The following steps
|
32 |
|
|
are taken:
|
33 |
|
|
|
34 |
|
|
1st: The factory is created (a name for the project is specified,
|
35 |
|
|
which will help with the bookkeeping of different training cycles)
|
36 |
|
|
|
37 |
|
|
2nd: The input data trees are made available to the factory ( one
|
38 |
|
|
can also use text files as input, also shown in this example ). The
|
39 |
|
|
sizes of the training and the testing data samples are also specified.
|
40 |
|
|
|
41 |
|
|
3rd: The variables that are selected to be used in the MVA are
|
42 |
|
|
declared to the factory
|
43 |
|
|
|
44 |
|
|
4th: The factory needs to transfer the input data into the local
|
45 |
|
|
data structure used for the training and testing
|
46 |
|
|
|
47 |
|
|
5th: Methods are than booked with the factory. For each method
|
48 |
|
|
number of options can be set that steer the training behavior. The
|
49 |
|
|
options are described in greater detail in the method classes and
|
50 |
|
|
can be looked at in the CVS web-viewer
|
51 |
|
|
|
52 |
|
|
6th: The training of all methods on the training data sample is run
|
53 |
|
|
by the factory. The training results for each method are stored in
|
54 |
|
|
the directory weights/
|
55 |
|
|
|
56 |
|
|
7th: The testing of all methods on the testing data sample is run by
|
57 |
|
|
the factory. The test results are stored in a root file (filename
|
58 |
|
|
specified in the Factory constructor)
|
59 |
|
|
|
60 |
|
|
8th: The performance of all methods is analyzed by the factory. The
|
61 |
|
|
performance results are stored in the root file (see last step)
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
Classify_HWW.C
|
65 |
|
|
----------------
|
66 |
|
|
|
67 |
|
|
TMVAClassificationApplication.C explains the usage of the TMVA::Reader class, which
|
68 |
|
|
is to be used to evaluate your data with the trained MVA
|
69 |
|
|
methods. The following steps are taken:
|
70 |
|
|
|
71 |
|
|
1st: The reader is created.
|
72 |
|
|
|
73 |
|
|
2nd: A set of local variables is created and declared to the reader.
|
74 |
|
|
|
75 |
|
|
3rd: The method(s) - which means the name of the weight files
|
76 |
|
|
created in the training process - are booked with the reader.
|
77 |
|
|
|
78 |
|
|
4th: Your event loop:
|
79 |
|
|
- The values of the local variables are set (either by assignment
|
80 |
|
|
of, as in the example, by setting the BranchAddresses of your
|
81 |
|
|
datatree)
|
82 |
|
|
- the reader is asked to evaluate the MVA, the result of which is
|
83 |
|
|
used to separate signal from background
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
How to run the example
|
87 |
|
|
======================
|
88 |
|
|
|
89 |
|
|
First, TMVA_HWW.C needs to be run to perform the training. You
|
90 |
|
|
can edit TMVA_HWW.C (boolean flags at the head of the file) to
|
91 |
|
|
enable (disable) the methods you would (not) like to use. Then run
|
92 |
|
|
|
93 |
|
|
> root TMVA_HWW.C
|
94 |
|
|
|
95 |
|
|
Add the end a file TMVA.root is written, and a GUI opens. Once
|
96 |
|
|
TMVA.root exists, the GUI can also be started via
|
97 |
|
|
|
98 |
|
|
> root TMVAGui.C
|
99 |
|
|
|
100 |
|
|
You can also run
|
101 |
|
|
|
102 |
|
|
> root Classify_HWW.C
|
103 |
|
|
|
104 |
|
|
which evaluates the methods on the signal data from the toy
|
105 |
|
|
tmva_example.root and writes the result to TMVApp.root. However,
|
106 |
|
|
TMVAClassificationApplication is more of a pedagogical example for
|
107 |
|
|
the usage of TMVA inside your own analysis framework.
|
108 |
|
|
|
109 |
|
|
The TMVA GUI
|
110 |
|
|
============
|
111 |
|
|
|
112 |
|
|
The GUI provides easy access to a large number of macros that plot
|
113 |
|
|
various distributions and correlations of the input data, the MVA
|
114 |
|
|
method output distributions and the performance comparison plot
|
115 |
|
|
(background rejection versus efficiency). It can be used once the
|
116 |
|
|
training is run, and is started with
|
117 |
|
|
|
118 |
|
|
> root TMVAGui.C
|
119 |
|
|
|
120 |
|
|
or
|
121 |
|
|
|
122 |
|
|
> root TMVAGui.C\(\"MyTMVA.root\"\)
|
123 |
|
|
|
124 |
|
|
in case you had directed your training output to a different root
|
125 |
|
|
file (2nd argument of the TMVA::Factory constructor)
|
126 |
|
|
|