-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTMVAClassificationApplication.C
More file actions
489 lines (399 loc) · 22 KB
/
TMVAClassificationApplication.C
File metadata and controls
489 lines (399 loc) · 22 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
/**********************************************************************************
* Project : TMVA - a Root-integrated toolkit for multivariate data analysis *
* Package : TMVA *
* Exectuable: TMVAClassificationApplication *
* *
* This macro provides a simple example on how to use the trained classifiers *
* within an analysis module *
**********************************************************************************/
#include <cstdlib>
#include <vector>
#include <iostream>
#include <map>
#include <string>
#include "TFile.h"
#include "TTree.h"
#include "TString.h"
#include "TSystem.h"
#include "TROOT.h"
#include "TStopwatch.h"
//#include "TMVAGui.C"
#if not defined(__CINT__) || defined(__MAKECINT__)
#include "TMVA/Tools.h"
#include "TMVA/Reader.h"
#include "TMVA/MethodCuts.h"
#endif
TH1F *t1 = new TH1F("InvMass_Kshort","InvMass_Kshort",1000,0,1);
using namespace TMVA;
void TMVAClassificationApplication( TString myMethodList = "" )
{
#ifdef __CINT__
gROOT->ProcessLine( ".O0" ); // turn off optimization in CINT
#endif
//---------------------------------------------------------------
// This loads the library
TMVA::Tools::Instance();
// Default MVA methods to be trained + tested
std::map<std::string,int> Use;
// --- Cut optimisation
Use["Cuts"] = 1;
Use["CutsD"] = 1;
Use["CutsPCA"] = 0;
Use["CutsGA"] = 0;
Use["CutsSA"] = 0;
//
// --- 1-dimensional likelihood ("naive Bayes estimator")
Use["Likelihood"] = 1;
Use["LikelihoodD"] = 0; // the "D" extension indicates decorrelated input variables (see option strings)
Use["LikelihoodPCA"] = 1; // the "PCA" extension indicates PCA-transformed input variables (see option strings)
Use["LikelihoodKDE"] = 0;
Use["LikelihoodMIX"] = 0;
//
// --- Mutidimensional likelihood and Nearest-Neighbour methods
Use["PDERS"] = 1;
Use["PDERSD"] = 0;
Use["PDERSPCA"] = 0;
Use["PDEFoam"] = 1;
Use["PDEFoamBoost"] = 0; // uses generalised MVA method boosting
Use["KNN"] = 1; // k-nearest neighbour method
//
// --- Linear Discriminant Analysis
Use["LD"] = 1; // Linear Discriminant identical to Fisher
Use["Fisher"] = 0;
Use["FisherG"] = 0;
Use["BoostedFisher"] = 0; // uses generalised MVA method boosting
Use["HMatrix"] = 0;
//
// --- Function Discriminant analysis
Use["FDA_GA"] = 1; // minimisation of user-defined function using Genetics Algorithm
Use["FDA_SA"] = 0;
Use["FDA_MC"] = 0;
Use["FDA_MT"] = 0;
Use["FDA_GAMT"] = 0;
Use["FDA_MCMT"] = 0;
//
// --- Neural Networks (all are feed-forward Multilayer Perceptrons)
Use["MLP"] = 0; // Recommended ANN
Use["MLPBFGS"] = 0; // Recommended ANN with optional training method
Use["MLPBNN"] = 1; // Recommended ANN with BFGS training method and bayesian regulator
Use["CFMlpANN"] = 0; // Depreciated ANN from ALEPH
Use["TMlpANN"] = 0; // ROOT's own ANN
//
// --- Support Vector Machine
Use["SVM"] = 1;
//
// --- Boosted Decision Trees
Use["BDT"] = 1; // uses Adaptive Boost
Use["BDTG"] = 0; // uses Gradient Boost
Use["BDTB"] = 0; // uses Bagging
Use["BDTD"] = 0; // decorrelation + Adaptive Boost
//
// --- Friedman's RuleFit method, ie, an optimised series of cuts ("rules")
Use["RuleFit"] = 1;
// ---------------------------------------------------------------
Use["Plugin"] = 0;
Use["Category"] = 0;
Use["SVM_Gauss"] = 0;
Use["SVM_Poly"] = 0;
Use["SVM_Lin"] = 0;
std::cout << std::endl;
std::cout << "==> Start TMVAClassificationApplication" << std::endl;
// Select methods (don't look at this code - not of interest)
if (myMethodList != "") {
for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) it->second = 0;
std::vector<TString> mlist = gTools().SplitString( myMethodList, ',' );
for (UInt_t i=0; i<mlist.size(); i++) {
std::string regMethod(mlist[i]);
if (Use.find(regMethod) == Use.end()) {
std::cout << "Method \"" << regMethod
<< "\" not known in TMVA under this name. Choose among the following:" << std::endl;
for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) {
std::cout << it->first << " ";
}
std::cout << std::endl;
return;
}
Use[regMethod] = 1;
}
}
// --------------------------------------------------------------------------------------------------
// --- Create the Reader object
TMVA::Reader *reader = new TMVA::Reader( "!Color:!Silent" );
// Create a set of variables and declare them to the reader
// - the variable names MUST corresponds in name and type to those given in the weight file(s) used
//Float_t var1, var2;
//Float_t var3, var4;
Float_t ks_agl, ks_dlos, ks_dau1_dzos, ks_dau1_dxyos, ks_dau2_dzos, ks_dau2_dxyos;
Float_t ks_vtxChi2, ks_dau1_nhit, ks_dau2_nhit;
reader->AddVariable( "ks_agl", &ks_agl );
reader->AddVariable( "ks_dlos", &ks_dlos );
reader->AddVariable( "ks_dau1_dzos", &ks_dau1_dzos );
reader->AddVariable( "ks_dau2_dzos",&ks_dau2_dzos);
reader->AddVariable( "ks_dau1_dxyos", &ks_dau1_dxyos );
reader->AddVariable( "ks_dau2_dxyos",&ks_dau2_dxyos);
reader->AddVariable( "ks_vtxChi2",&ks_vtxChi2);
reader->AddVariable( "ks_dau1_nhit",&ks_dau1_nhit);
reader->AddVariable( "ks_dau2_nhit",&ks_dau2_nhit);
// Spectator variables declared in the training have to be added to the reader, too
Float_t ks_mass;
reader->AddSpectator( "ks_mass", &ks_mass );
//reader->AddSpectator( "spec2 := var1*3", &spec2 );
/*
Float_t Category_cat1, Category_cat2, Category_cat3;
if (Use["Category"]){
// Add artificial spectators for distinguishing categories
reader->AddSpectator( "Category_cat1 := var3<=0", &Category_cat1 );
reader->AddSpectator( "Category_cat2 := (var3>0)&&(var4<0)", &Category_cat2 );
reader->AddSpectator( "Category_cat3 := (var3>0)&&(var4>=0)", &Category_cat3 );
}
*/
// --- Book the MVA methods
TString dir = "weights/";
TString prefix = "TMVAClassification";
// Book method(s)
for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) {
if (it->second) {
TString methodName = TString(it->first) + TString(" method");
TString weightfile = dir + prefix + TString("_") + TString(it->first) + TString(".weights.xml");
reader->BookMVA( methodName, weightfile );
}
}
// Book output histograms
UInt_t nbin = 100;
TH1F *histLk(0), *histLkD(0), *histLkPCA(0), *histLkKDE(0), *histLkMIX(0), *histPD(0), *histPDD(0);
TH1F *histPDPCA(0), *histPDEFoam(0), *histPDEFoamErr(0), *histPDEFoamSig(0), *histKNN(0), *histHm(0);
TH1F *histFi(0), *histFiG(0), *histFiB(0), *histLD(0), *histNn(0),*histNnbfgs(0),*histNnbnn(0);
TH1F *histNnC(0), *histNnT(0), *histBdt(0), *histBdtG(0), *histBdtD(0), *histRf(0), *histSVMG(0);
TH1F *histSVMP(0), *histSVML(0), *histFDAMT(0), *histFDAGA(0), *histCat(0), *histPBdt(0);
if (Use["Likelihood"]) histLk = new TH1F( "MVA_Likelihood", "MVA_Likelihood", nbin, -1, 1 );
if (Use["LikelihoodD"]) histLkD = new TH1F( "MVA_LikelihoodD", "MVA_LikelihoodD", nbin, -1, 0.9999 );
if (Use["LikelihoodPCA"]) histLkPCA = new TH1F( "MVA_LikelihoodPCA", "MVA_LikelihoodPCA", nbin, -1, 1 );
if (Use["LikelihoodKDE"]) histLkKDE = new TH1F( "MVA_LikelihoodKDE", "MVA_LikelihoodKDE", nbin, -0.00001, 0.99999 );
if (Use["LikelihoodMIX"]) histLkMIX = new TH1F( "MVA_LikelihoodMIX", "MVA_LikelihoodMIX", nbin, 0, 1 );
if (Use["PDERS"]) histPD = new TH1F( "MVA_PDERS", "MVA_PDERS", nbin, 0, 1 );
if (Use["PDERSD"]) histPDD = new TH1F( "MVA_PDERSD", "MVA_PDERSD", nbin, 0, 1 );
if (Use["PDERSPCA"]) histPDPCA = new TH1F( "MVA_PDERSPCA", "MVA_PDERSPCA", nbin, 0, 1 );
if (Use["KNN"]) histKNN = new TH1F( "MVA_KNN", "MVA_KNN", nbin, 0, 1 );
if (Use["HMatrix"]) histHm = new TH1F( "MVA_HMatrix", "MVA_HMatrix", nbin, -0.95, 1.55 );
if (Use["Fisher"]) histFi = new TH1F( "MVA_Fisher", "MVA_Fisher", nbin, -4, 4 );
if (Use["FisherG"]) histFiG = new TH1F( "MVA_FisherG", "MVA_FisherG", nbin, -1, 1 );
if (Use["BoostedFisher"]) histFiB = new TH1F( "MVA_BoostedFisher", "MVA_BoostedFisher", nbin, -2, 2 );
if (Use["LD"]) histLD = new TH1F( "MVA_LD", "MVA_LD", nbin, -2, 2 );
if (Use["MLP"]) histNn = new TH1F( "MVA_MLP", "MVA_MLP", nbin, -1.25, 1.5 );
if (Use["MLPBFGS"]) histNnbfgs = new TH1F( "MVA_MLPBFGS", "MVA_MLPBFGS", nbin, -1.25, 1.5 );
if (Use["MLPBNN"]) histNnbnn = new TH1F( "MVA_MLPBNN", "MVA_MLPBNN", nbin, -1.25, 1.5 );
if (Use["CFMlpANN"]) histNnC = new TH1F( "MVA_CFMlpANN", "MVA_CFMlpANN", nbin, 0, 1 );
if (Use["TMlpANN"]) histNnT = new TH1F( "MVA_TMlpANN", "MVA_TMlpANN", nbin, -1.3, 1.3 );
if (Use["BDT"]) histBdt = new TH1F( "MVA_BDT", "MVA_BDT", nbin, -0.8, 0.8 );
if (Use["BDTD"]) histBdtD = new TH1F( "MVA_BDTD", "MVA_BDTD", nbin, -0.8, 0.8 );
if (Use["BDTG"]) histBdtG = new TH1F( "MVA_BDTG", "MVA_BDTG", nbin, -1.0, 1.0 );
if (Use["RuleFit"]) histRf = new TH1F( "MVA_RuleFit", "MVA_RuleFit", nbin, -2.0, 2.0 );
if (Use["SVM_Gauss"]) histSVMG = new TH1F( "MVA_SVM_Gauss", "MVA_SVM_Gauss", nbin, 0.0, 1.0 );
if (Use["SVM_Poly"]) histSVMP = new TH1F( "MVA_SVM_Poly", "MVA_SVM_Poly", nbin, 0.0, 1.0 );
if (Use["SVM_Lin"]) histSVML = new TH1F( "MVA_SVM_Lin", "MVA_SVM_Lin", nbin, 0.0, 1.0 );
if (Use["FDA_MT"]) histFDAMT = new TH1F( "MVA_FDA_MT", "MVA_FDA_MT", nbin, -2.0, 3.0 );
if (Use["FDA_GA"]) histFDAGA = new TH1F( "MVA_FDA_GA", "MVA_FDA_GA", nbin, -2.0, 3.0 );
if (Use["Category"]) histCat = new TH1F( "MVA_Category", "MVA_Category", nbin, -2., 2. );
if (Use["Plugin"]) histPBdt = new TH1F( "MVA_PBDT", "MVA_BDT", nbin, -0.8, 0.8 );
// PDEFoam also returns per-event error, fill in histogram, and also fill significance
if (Use["PDEFoam"]) {
histPDEFoam = new TH1F( "MVA_PDEFoam", "MVA_PDEFoam", nbin, 0, 1 );
histPDEFoamErr = new TH1F( "MVA_PDEFoamErr", "MVA_PDEFoam error", nbin, 0, 1 );
histPDEFoamSig = new TH1F( "MVA_PDEFoamSig", "MVA_PDEFoam significance", nbin, 0, 10 );
}
// Book example histogram for probability (the other methods are done similarly)
TH1F *probHistFi(0), *rarityHistFi(0);
if (Use["Fisher"]) {
probHistFi = new TH1F( "MVA_Fisher_Proba", "MVA_Fisher_Proba", nbin, 0, 1 );
rarityHistFi = new TH1F( "MVA_Fisher_Rarity", "MVA_Fisher_Rarity", nbin, 0, 1 );
}
// Prepare input tree (this must be replaced by your data source)
// in this example, there is a toy tree with signal and one with background events
// we'll later on use only the "signal" events for the test in this example.
//
TFile *input(0);
TString fname = "./tmva_example.root";
if (!gSystem->AccessPathName( fname ))
input = TFile::Open( fname ); // check if file in local directory exists
else
input = TFile::Open( "~/2014Research/ROOT_file/V0reco_PbPb/MCPbPb_data.root" ); // if not: download from ROOT server
if (!input) {
std::cout << "ERROR: could not open data file" << std::endl;
exit(1);
}
std::cout << "--- TMVAClassificationApp : Using input file: " << input->GetName() << std::endl;
// --- Event loop
// Prepare the event tree
// - here the variable names have to corresponds to your tree
// - you can use the same variables as above which is slightly faster,
// but of course you can use different ones and copy the values inside the event loop
//
std::cout << "--- Select signal sample" << std::endl;
TTree* theTree = (TTree*)input->Get("ana/v0_Kshort");
//Float_t userVar1, userVar2;
theTree->SetBranchAddress( "ks_agl", &ks_agl );
theTree->SetBranchAddress( "ks_dlos", &ks_dlos );
theTree->SetBranchAddress( "ks_dau1_dzos", &ks_dau1_dzos );
theTree->SetBranchAddress( "ks_dau1_dxyos", &ks_dau1_dxyos );
theTree->SetBranchAddress( "ks_dau2_dzos",&ks_dau2_dzos);
theTree->SetBranchAddress( "ks_dau2_dxyos",&ks_dau2_dxyos);
theTree->SetBranchAddress( "ks_vtxChi2",&ks_vtxChi2);
theTree->SetBranchAddress( "ks_dau1_nhit",&ks_dau1_nhit);
theTree->SetBranchAddress( "ks_dau2_nhit",&ks_dau2_nhit);
theTree->SetBranchAddress( "ks_mass", &ks_mass );
// Efficiency calculator for cut method
Int_t nSelCutsGA = 0;
Double_t effS = 0.7;
std::vector<Float_t> vecVar(4); // vector for EvaluateMVA tests
std::cout << "--- Processing: " << theTree->GetEntries() << " events" << std::endl;
TStopwatch sw;
sw.Start();
TFile *target = new TFile( "TMVApp.root","RECREATE" );
TNtuple *n1 = new TNtuple("n1","n1","Ks_mass:MVA");
for (Long64_t ievt=0; ievt < theTree->GetEntries();ievt++) {
if (ievt%1000 == 0) std::cout << "--- ... Processing event: " << ievt << std::endl;
theTree->GetEntry(ievt);
// --- Return the MVA outputs and fill into histograms
if (Use["CutsGA"]) {
// Cuts is a special case: give the desired signal efficienciy
Bool_t passed = reader->EvaluateMVA( "CutsGA method", effS );
if (passed) nSelCutsGA++;
}
if (Use["Likelihood" ]) histLk ->Fill( reader->EvaluateMVA( "Likelihood method" ) );
if (Use["LikelihoodD" ]) histLkD ->Fill( reader->EvaluateMVA( "LikelihoodD method" ) );
if (Use["LikelihoodPCA"]) histLkPCA ->Fill( reader->EvaluateMVA( "LikelihoodPCA method" ) );
if (Use["LikelihoodKDE"]) histLkKDE ->Fill( reader->EvaluateMVA( "LikelihoodKDE method" ) );
if (Use["LikelihoodMIX"]) histLkMIX ->Fill( reader->EvaluateMVA( "LikelihoodMIX method" ) );
if (Use["PDERS" ]) histPD ->Fill( reader->EvaluateMVA( "PDERS method" ) );
if (Use["PDERSD" ]) histPDD ->Fill( reader->EvaluateMVA( "PDERSD method" ) );
if (Use["PDERSPCA" ]) histPDPCA ->Fill( reader->EvaluateMVA( "PDERSPCA method" ) );
if (Use["KNN" ]) histKNN ->Fill( reader->EvaluateMVA( "KNN method" ) );
if (Use["HMatrix" ]) histHm ->Fill( reader->EvaluateMVA( "HMatrix method" ) );
if (Use["Fisher" ]) histFi ->Fill( reader->EvaluateMVA( "Fisher method" ) );
if (Use["FisherG" ]) histFiG ->Fill( reader->EvaluateMVA( "FisherG method" ) );
if (Use["BoostedFisher"]) histFiB ->Fill( reader->EvaluateMVA( "BoostedFisher method" ) );
if (Use["LD" ]) histLD ->Fill( reader->EvaluateMVA( "LD method" ) );
if (Use["MLP" ]) histNn ->Fill( reader->EvaluateMVA( "MLP method" ) );
if (Use["MLPBFGS" ]) histNnbfgs ->Fill( reader->EvaluateMVA( "MLPBFGS method" ) );
if (Use["MLPBNN" ]) histNnbnn ->Fill( reader->EvaluateMVA( "MLPBNN method" ) );
if (Use["CFMlpANN" ]) histNnC ->Fill( reader->EvaluateMVA( "CFMlpANN method" ) );
if (Use["TMlpANN" ]) histNnT ->Fill( reader->EvaluateMVA( "TMlpANN method" ) );
if (Use["BDT" ]) {
double Ks_mass = ks_mass;
histBdt ->Fill( reader->EvaluateMVA( "BDT method" ) );
double MVA = 0.0;
MVA = reader->EvaluateMVA("BDT method");
n1->Fill(Ks_mass,MVA);
}
if (Use["BDTD" ]) {
double Ks_mass = ks_mass;
histBdtD ->Fill( reader->EvaluateMVA( "BDTD method" ) );
double MVA = 0.0;
MVA = reader->EvaluateMVA( "BDTD method" );
n1->Fill(Ks_mass,MVA);
}
if (Use["BDTG" ]) {
double Ks_mass = ks_mass;
histBdtG ->Fill( reader->EvaluateMVA( "BDTG method" ) );
double MVA = 0.0;
MVA = reader->EvaluateMVA( "BDTG method" );
n1->Fill(Ks_mass,MVA);
}
if (Use["RuleFit" ]) histRf ->Fill( reader->EvaluateMVA( "RuleFit method" ) );
if (Use["SVM_Gauss" ]) histSVMG ->Fill( reader->EvaluateMVA( "SVM_Gauss method" ) );
if (Use["SVM_Poly" ]) histSVMP ->Fill( reader->EvaluateMVA( "SVM_Poly method" ) );
if (Use["SVM_Lin" ]) histSVML ->Fill( reader->EvaluateMVA( "SVM_Lin method" ) );
if (Use["FDA_MT" ]) histFDAMT ->Fill( reader->EvaluateMVA( "FDA_MT method" ) );
if (Use["FDA_GA" ]) histFDAGA ->Fill( reader->EvaluateMVA( "FDA_GA method" ) );
if (Use["Category" ]) histCat ->Fill( reader->EvaluateMVA( "Category method" ) );
if (Use["Plugin" ]) histPBdt ->Fill( reader->EvaluateMVA( "P_BDT method" ) );
// Retrieve also per-event error
if (Use["PDEFoam"]) {
Double_t val = reader->EvaluateMVA( "PDEFoam method" );
Double_t err = reader->GetMVAError();
histPDEFoam ->Fill( val );
histPDEFoamErr->Fill( err );
if (err>1.e-50) histPDEFoamSig->Fill( val/err );
}
// Retrieve probability instead of MVA output
if (Use["Fisher"]) {
probHistFi ->Fill( reader->GetProba ( "Fisher method" ) );
rarityHistFi->Fill( reader->GetRarity( "Fisher method" ) );
}
}
// Get elapsed time
sw.Stop();
std::cout << "--- End of event loop: "; sw.Print();
// Get efficiency for cuts classifier
if (Use["CutsGA"]) std::cout << "--- Efficiency for CutsGA method: " << double(nSelCutsGA)/theTree->GetEntries()
<< " (for a required signal efficiency of " << effS << ")" << std::endl;
if (Use["CutsGA"]) {
// test: retrieve cuts for particular signal efficiency
// CINT ignores dynamic_casts so we have to use a cuts-secific Reader function to acces the pointer
TMVA::MethodCuts* mcuts = reader->FindCutsMVA( "CutsGA method" ) ;
if (mcuts) {
std::vector<Double_t> cutsMin;
std::vector<Double_t> cutsMax;
mcuts->GetCuts( 0.7, cutsMin, cutsMax );
std::cout << "--- -------------------------------------------------------------" << std::endl;
std::cout << "--- Retrieve cut values for signal efficiency of 0.7 from Reader" << std::endl;
for (UInt_t ivar=0; ivar<cutsMin.size(); ivar++) {
std::cout << "... Cut: "
<< cutsMin[ivar]
<< " < \""
<< mcuts->GetInputVar(ivar)
<< "\" <= "
<< cutsMax[ivar] << std::endl;
}
std::cout << "--- -------------------------------------------------------------" << std::endl;
}
}
// --- Write histograms
if (Use["Likelihood" ]) histLk ->Write();
if (Use["LikelihoodD" ]) histLkD ->Write();
if (Use["LikelihoodPCA"]) histLkPCA ->Write();
if (Use["LikelihoodKDE"]) histLkKDE ->Write();
if (Use["LikelihoodMIX"]) histLkMIX ->Write();
if (Use["PDERS" ]) histPD ->Write();
if (Use["PDERSD" ]) histPDD ->Write();
if (Use["PDERSPCA" ]) histPDPCA ->Write();
if (Use["KNN" ]) histKNN ->Write();
if (Use["HMatrix" ]) histHm ->Write();
if (Use["Fisher" ]) histFi ->Write();
if (Use["FisherG" ]) histFiG ->Write();
if (Use["BoostedFisher"]) histFiB ->Write();
if (Use["LD" ]) histLD ->Write();
if (Use["MLP" ]) histNn ->Write();
if (Use["MLPBFGS" ]) histNnbfgs ->Write();
if (Use["MLPBNN" ]) histNnbnn ->Write();
if (Use["CFMlpANN" ]) histNnC ->Write();
if (Use["TMlpANN" ]) histNnT ->Write();
if (Use["BDT" ]){
histBdt ->Write();
n1->Write();
}
if (Use["BDTD" ]) {
histBdtD ->Write();
n1->Write();
}
if (Use["BDTG" ]) {
histBdtG ->Write();
n1->Write();
}
if (Use["RuleFit" ]) histRf ->Write();
if (Use["SVM_Gauss" ]) histSVMG ->Write();
if (Use["SVM_Poly" ]) histSVMP ->Write();
if (Use["SVM_Lin" ]) histSVML ->Write();
if (Use["FDA_MT" ]) histFDAMT ->Write();
if (Use["FDA_GA" ]) histFDAGA ->Write();
if (Use["Category" ]) histCat ->Write();
if (Use["Plugin" ]) histPBdt ->Write();
// Write also error and significance histos
if (Use["PDEFoam"]) { histPDEFoam->Write(); histPDEFoamErr->Write(); histPDEFoamSig->Write(); }
// Write also probability hists
if (Use["Fisher"]) { if (probHistFi != 0) probHistFi->Write(); if (rarityHistFi != 0) rarityHistFi->Write(); }
target->Close();
std::cout << "--- Created root file: \"TMVApp.root\" containing the MVA output histograms" << std::endl;
delete reader;
std::cout << "==> TMVAClassificationApplication is done!" << endl << std::endl;
}