ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/LJMet/MultivariateAnalysis/macros/TMVApplication_wjets_electron.C
Revision: 1.4
Committed: Thu May 21 16:37:16 2009 UTC (15 years, 11 months ago) by jindal
Content type: text/plain
Branch: MAIN
CVS Tags: V00-03-01, ZMorph_BASE_20100408, gak040610_morphing, V00-02-02, gak011410, gak010310, ejterm2010_25nov2009, V00-02-01, V00-02-00, gak112409, CMSSW_22X_branch_base, segala101609, V00-01-15, HEAD
Branch point for: ZMorph-V00-03-01, CMSSW_22X_branch
Changes since 1.3: +129 -36 lines
Error occurred while calculating annotation data.
Log Message:
update

File Contents

# Content
1 /**********************************************************************************
2 * Project : TMVA - a Root-integrated toolkit for multivariate data analysis *
3 * Package : TMVA *
4 * Exectuable: TMVApplication *
5 * *
6 * This macro provides a simple example on how to use the trained classifiers *
7 * within an analysis module *
8 * *
9 * ------------------------------------------------------------------------------ *
10 * see also the alternative (slightly faster) way to retrieve the MVA values in *
11 * examples/TMVApplicationAlternative.cxx *
12 * ------------------------------------------------------------------------------ *
13 **********************************************************************************/
14
15 #include <iostream>
16
17 #include "TCut.h"
18 #include "TFile.h"
19 #include "TSystem.h"
20 #include "TTree.h"
21 #include "TStopwatch.h"
22 // requires links
23 #include "TMVA/Factory.h"
24 #include "TMVA/Tools.h"
25 #include "TMVA/Config.h"
26 #include "TMVA/Reader.h"
27
28 // ---------------------------------------------------------------
29 // choose MVA methods to be applied
30 Bool_t Use_Cuts = 0;
31 Bool_t Use_CutsD = 0;
32 Bool_t Use_CutsGA = 1;
33 Bool_t Use_Likelihood = 1;
34 Bool_t Use_LikelihoodD = 0; // the "D" extension indicates decorrelated input variables (see option strings)
35 Bool_t Use_LikelihoodPCA = 1; // the "PCA" extension indicates PCA-transformed input variables (see option strings)
36 Bool_t Use_PDERS = 1;
37 Bool_t Use_PDERSD = 0;
38 Bool_t Use_PDERSPCA = 0;
39 Bool_t Use_KNN = 1;
40 Bool_t Use_HMatrix = 1;
41 Bool_t Use_Fisher = 1;
42 Bool_t Use_FDA_GA = 0;
43 Bool_t Use_FDA_MT = 1;
44 Bool_t Use_MLP = 1; // this is the recommended ANN
45 Bool_t Use_CFMlpANN = 0;
46 Bool_t Use_TMlpANN = 0;
47 Bool_t Use_SVM_Gauss = 1;
48 Bool_t Use_SVM_Poly = 0;
49 Bool_t Use_SVM_Lin = 0;
50 Bool_t Use_BDT = 1;
51 Bool_t Use_BDTD = 0;
52 Bool_t Use_RuleFit = 1;
53 // ---------------------------------------------------------------
54
55 void TMVApplication( TString myMethodList = "" )
56 {
57 cout << endl;
58 cout << "==> start TMVApplication" << endl;
59
60 if (myMethodList != "") {
61 Use_CutsGA = Use_CutsD = Use_Cuts
62 = Use_LikelihoodPCA = Use_LikelihoodD = Use_Likelihood
63 = Use_PDERSPCA = Use_PDERSD = Use_PDERS
64 = Use_KNN
65 = Use_MLP = Use_CFMlpANN = Use_TMlpANN
66 = Use_HMatrix = Use_Fisher = Use_BDTD = Use_BDT = Use_RuleFit
67 = Use_SVM_Gauss = Use_SVM_Poly = Use_SVM_Lin
68 = Use_FDA_GA = Use_FDA_MT
69 = 0;
70
71 TList* mlist = TMVA::Tools::ParseFormatLine( myMethodList, " :," );
72
73 if (mlist->FindObject( "Cuts" ) != 0) Use_Cuts = 1;
74 if (mlist->FindObject( "CutsD" ) != 0) Use_CutsD = 1;
75 if (mlist->FindObject( "CutsGA" ) != 0) Use_CutsGA = 1;
76 if (mlist->FindObject( "Likelihood" ) != 0) Use_Likelihood = 1;
77 if (mlist->FindObject( "LikelihoodD" ) != 0) Use_LikelihoodD = 1;
78 if (mlist->FindObject( "LikelihoodPCA" ) != 0) Use_LikelihoodPCA = 1;
79 if (mlist->FindObject( "PDERS" ) != 0) Use_PDERS = 1;
80 if (mlist->FindObject( "PDERSD" ) != 0) Use_PDERSD = 1;
81 if (mlist->FindObject( "PDERSPCA" ) != 0) Use_PDERSPCA = 1;
82 if (mlist->FindObject( "KNN" ) != 0) Use_KNN = 1;
83 if (mlist->FindObject( "HMatrix" ) != 0) Use_HMatrix = 1;
84 if (mlist->FindObject( "Fisher" ) != 0) Use_Fisher = 1;
85 if (mlist->FindObject( "MLP" ) != 0) Use_MLP = 1;
86 if (mlist->FindObject( "CFMlpANN" ) != 0) Use_CFMlpANN = 1;
87 if (mlist->FindObject( "TMlpANN" ) != 0) Use_TMlpANN = 1;
88 if (mlist->FindObject( "BDTD" ) != 0) Use_BDTD = 1;
89 if (mlist->FindObject( "BDT" ) != 0) Use_BDT = 1;
90 if (mlist->FindObject( "RuleFit" ) != 0) Use_RuleFit = 1;
91 if (mlist->FindObject( "SVM_Gauss" ) != 0) Use_SVM_Gauss = 1;
92 if (mlist->FindObject( "SVM_Poly" ) != 0) Use_SVM_Poly = 1;
93 if (mlist->FindObject( "SVM_Lin" ) != 0) Use_SVM_Lin = 1;
94 if (mlist->FindObject( "FDA_MT" ) != 0) Use_FDA_MT = 1;
95 if (mlist->FindObject( "FDA_GA" ) != 0) Use_FDA_GA = 1;
96
97 delete mlist;
98 }
99
100 //
101 // create the Reader object
102 //
103 TMVA::Reader *reader = new TMVA::Reader("!Color");
104
105 // create a set of variables and declare them to the reader
106 // - the variable names must corresponds in name and type to
107 // those given in the weight file(s) that you use
108 //////
109 Float_t _jet4_pt;
110 reader->AddVariable("jet4_pt", &_jet4_pt);
111 Float_t _jet3_pt;
112 reader->AddVariable("jet3_pt", &_jet3_pt);
113 Float_t _jet2_pt;
114 reader->AddVariable("jet2_pt", &_jet2_pt);
115 Float_t _met_pt;
116 reader->AddVariable("met_pt", &_met_pt);
117 Float_t _getHt2;
118 reader->AddVariable("getHt2", &_getHt2);
119 Float_t _metHtPlusLepton;
120 reader->AddVariable("metHtPlusLepton", &_metHtPlusLepton);
121 Float_t _getAplMu;
122 reader->AddVariable("getAplMu", &_getAplMu);
123 Float_t _getHt3;
124 reader->AddVariable("getHt3", &_getHt3);
125 Float_t _getHt;
126 reader->AddVariable("getHt", &_getHt);
127 Float_t _lepton_eta;
128 reader->AddVariable("lepton_eta", &_lepton_eta);
129 // Float_t _dPhiLMet;
130 // reader->AddVariable("dPhiLMet", &_dPhiLMet);
131 // Float_t _W_Pt;
132 // reader->AddVariable("W_Pt", &_W_Pt);
133 // Float_t _W_MT;
134 // reader->AddVariable("W_MT", &_W_MT);
135 // Float_t _lepton_eta;
136 // reader->AddVariable("lepton_eta", &_lepton_eta);
137 // Float_t _getMwRec;
138 // reader->AddVariable("getMwRec", &_getMwRec);
139 // Float_t _sphericity;
140 // reader->AddVariable("sphericity", &_sphericity);
141 // Float_t _jet1_pt;
142 // reader->AddVariable("jet1_pt", &_jet1_pt);
143 // Float_t _htPlusLepton;
144 // reader->AddVariable("htPlusLepton", &_htPlusLepton);
145 // Float_t _DphiJMET;
146 // reader->AddVariable("DphiJMET", &_DphiJMET);
147 //
148
149 //
150 // book the MVA methods
151 //
152 string dir = "weights/";
153 string prefix = "TMVAnalysis";
154
155 if (Use_Cuts) reader->BookMVA( "Cuts method", dir + prefix + "_Cuts.weights.txt" );
156 if (Use_CutsD) reader->BookMVA( "CutsD method", dir + prefix + "_CutsD.weights.txt" );
157 if (Use_CutsGA) reader->BookMVA( "CutsGA method", dir + prefix + "_CutsGA.weights.txt" );
158 if (Use_Likelihood) reader->BookMVA( "Likelihood method", dir + prefix + "_Likelihood.weights.txt" );
159 if (Use_LikelihoodD) reader->BookMVA( "LikelihoodD method", dir + prefix + "_LikelihoodD.weights.txt" );
160 if (Use_LikelihoodPCA) reader->BookMVA( "LikelihoodPCA method", dir + prefix + "_LikelihoodPCA.weights.txt" );
161 if (Use_PDERS) reader->BookMVA( "PDERS method", dir + prefix + "_PDERS.weights.txt" );
162 if (Use_PDERSD) reader->BookMVA( "PDERSD method", dir + prefix + "_PDERSD.weights.txt" );
163 if (Use_PDERSPCA) reader->BookMVA( "PDERSPCA method", dir + prefix + "_PDERSPCA.weights.txt" );
164 if (Use_KNN) reader->BookMVA( "KNN method", dir + prefix + "_KNN.weights.txt" );
165 if (Use_HMatrix) reader->BookMVA( "HMatrix method", dir + prefix + "_HMatrix.weights.txt" );
166 if (Use_Fisher) reader->BookMVA( "Fisher method", dir + prefix + "_Fisher.weights.txt" );
167 if (Use_MLP) reader->BookMVA( "MLP method", dir + prefix + "_MLP.weights.txt" );
168 if (Use_CFMlpANN) reader->BookMVA( "CFMlpANN method", dir + prefix + "_CFMlpANN.weights.txt" );
169 if (Use_TMlpANN) reader->BookMVA( "TMlpANN method", dir + prefix + "_TMlpANN.weights.txt" );
170 if (Use_BDT) reader->BookMVA( "BDT method", dir + prefix + "_BDT.weights.txt" );
171 if (Use_BDTD) reader->BookMVA( "BDTD method", dir + prefix + "_BDTD.weights.txt" );
172 if (Use_RuleFit) reader->BookMVA( "RuleFit method", dir + prefix + "_RuleFitTMVA.weights.txt" );
173 if (Use_SVM_Gauss) reader->BookMVA( "SVM_Gauss method", dir + prefix + "_SVM_Gauss.weights.txt" );
174 if (Use_SVM_Poly) reader->BookMVA( "SVM_Poly method", dir + prefix + "_SVM_Poly.weights.txt" );
175 if (Use_SVM_Lin) reader->BookMVA( "SVM_Lin method", dir + prefix + "_SVM_Lin.weights.txt" );
176 if (Use_FDA_MT) reader->BookMVA( "FDA_MT method", dir + prefix + "_FDA_MT.weights.txt" );
177 if (Use_FDA_GA) reader->BookMVA( "FDA_GA method", dir + prefix + "_FDA_GA.weights.txt" );
178
179 // book output histograms
180 UInt_t nbin = 100;
181 //
182 //_____ output file __________________________________________________
183 //
184 // TFile *target = new TFile( "TMVApp-qcd-electron-18may2009.root","RECREATE" );
185 TFile *target = new TFile( "TMVApp-data-electron-orthogonalqcd-18may2009.root","RECREATE" );
186 // TFile *target = new TFile( "TMVApp-data-electron_wzfastsim-18may2009.root","RECREATE" );
187 TH1F *histLk, *histLkD, *histLkPCA, *histPD, *histPDD, *histPDPCA, *histKNN, *histHm, *histFi;
188 TH1F *histNn, *histNnC, *histNnT, *histBdt, *histBdtD, *histRf;
189 TH1F *histSVMG, *histSVMP, *histSVML;
190 TH1F *histFDAMT, *histFDAGA;
191
192 if (Use_Likelihood) histLk = new TH1F( "MVA_Likelihood", "MVA_Likelihood", nbin, 0, 1 );
193 TTree * _tree = new TTree("classifier","classifier");
194 Double_t _ll = -1.0;
195 TBranch * b_ll = _tree->Branch("MVA_Likelihood", &_ll, "classifier/D");
196 Double_t _bdtc = -1.0;
197 TBranch * b_bdtc = _tree->Branch("MVA_BDT", &_bdtc, "classifier/D");
198 if (Use_LikelihoodD) histLkD = new TH1F( "MVA_LikelihoodD", "MVA_LikelihoodD", nbin, 0.000001, 0.9999 );
199 if (Use_LikelihoodPCA) histLkPCA = new TH1F( "MVA_LikelihoodPCA", "MVA_LikelihoodPCA", nbin, 0, 1 );
200 if (Use_PDERS) histPD = new TH1F( "MVA_PDERS", "MVA_PDERS", nbin, 0, 1 );
201 if (Use_PDERSD) histPDD = new TH1F( "MVA_PDERSD", "MVA_PDERSD", nbin, 0, 1 );
202 if (Use_PDERSPCA) histPDPCA = new TH1F( "MVA_PDERSPCA", "MVA_PDERSPCA", nbin, 0, 1 );
203 if (Use_KNN) histKNN = new TH1F( "MVA_KNN", "MVA_KNN", nbin, 0, 1 );
204 if (Use_HMatrix) histHm = new TH1F( "MVA_HMatrix", "MVA_HMatrix", nbin, -0.95, 1.55 );
205 if (Use_Fisher) histFi = new TH1F( "MVA_Fisher", "MVA_Fisher", nbin, -4, 4 );
206 if (Use_MLP) histNn = new TH1F( "MVA_MLP", "MVA_MLP", nbin, -0.25, 1.5 );
207 if (Use_CFMlpANN) histNnC = new TH1F( "MVA_CFMlpANN", "MVA_CFMlpANN", nbin, 0, 1 );
208 if (Use_TMlpANN) histNnT = new TH1F( "MVA_TMlpANN", "MVA_TMlpANN", nbin, -1.3, 1.3 );
209 if (Use_BDT) histBdt = new TH1F( "MVA_BDT", "MVA_BDT", nbin, -0.8, 0.8 );
210 if (Use_BDTD) histBdtD = new TH1F( "MVA_BDTD", "MVA_BDTD", nbin, -0.4, 0.6 );
211 if (Use_RuleFit) histRf = new TH1F( "MVA_RuleFitTMVA", "MVA_RuleFitTMVA", nbin, -2.0, 2.0 );
212 if (Use_SVM_Gauss) histSVMG = new TH1F( "MVA_SVM_Gauss", "MVA_SVM_Gauss", nbin, 0.0, 1.0 );
213 if (Use_SVM_Poly) histSVMP = new TH1F( "MVA_SVM_Poly", "MVA_SVM_Poly", nbin, 0.0, 1.0 );
214 if (Use_SVM_Lin) histSVML = new TH1F( "MVA_SVM_Lin", "MVA_SVM_Lin", nbin, 0.0, 1.0 );
215 if (Use_FDA_MT) histFDAMT = new TH1F( "MVA_FDA_MT", "MVA_FDA_MT", nbin, -2.0, 3.0 );
216 if (Use_FDA_GA) histFDAGA = new TH1F( "MVA_FDA_GA", "MVA_FDA_GA", nbin, -2.0, 3.0 );
217
218 // book examsple histogram for probability (the other methods are done similarly)
219 TH1F *probHistFi, *rarityHistFi;
220 if (Use_Fisher) {
221 probHistFi = new TH1F( "PROBA_MVA_Fisher", "PROBA_MVA_Fisher", nbin, 0, 1 );
222 rarityHistFi = new TH1F( "RARITY_MVA_Fisher", "RARITY_MVA_Fisher", nbin, 0, 1 );
223 }
224
225 // Prepare input tree (this must be replaced by your data source)
226 // in this example, there is a toy tree with signal and one with background events
227 // we'll later on use only the "signal" events for the test in this example.
228 //
229 TFile *input(0);
230 //
231 //_____ input file ___________________________________________________
232 //
233 //TString fname = "electron_jets_training-wzfastsim-summer08-06may2009.root";
234 //TString fname = "electron_jets_training-wzfastsim-summer08-06may2009.root";
235 //TString fname = "electron_jets_fake_data_20pb-summer08-01may2009.root";
236 //TString fname = "electron_jets_fake_data_20pb-summer08-08may2009.root";
237 //TString fname = "/uscms_data/d2/lpcljm/MVA/Summer08/fake_data/electron_jets_fake_data_wzfastsim_20pb-summer08-08may2009.root";
238 // TString fname = "/uscms_data/d2/lpcljm/MVA/Summer08/fake_data/electron_jets_fake_data_20pb-summer08-15may2009.root";
239 TString fname = "/uscms_data/d2/lpcljm/MVA/Summer08/fake_data/electron_jets_fake_data_20pb-qcd-orthogonalsample-summer08-18may2009.root";
240 //TString fname = "/uscms_data/d2/lpcljm/MVA/Summer08/training/electron_jets_training-wzfastsim-summer08-15may2009.root";
241 if (!gSystem->AccessPathName( fname )) {
242 // first we try to find tmva_example.root in the local directory
243 cout << "--- accessing data file: " << fname << endl;
244 input = TFile::Open( fname );
245 }
246 else {
247 // second we try accessing the file via the web from
248 // http://root.cern.ch/files/tmva_example.root
249 cout << "--- accessing tmva_example.root file from http://root.cern.ch/files" << endl;
250 cout << "--- for faster startup you may consider downloading it into you local directory" << endl;
251 input = TFile::Open("http://root.cern.ch/files/tmva_example.root");
252 }
253
254 if (!input) {
255 std::cout << "ERROR: could not open data file: " << fname << std::endl;
256 exit(1);
257 }
258
259 //
260 // prepare the tree
261 // - here the variable names have to corresponds to your tree
262 // - you can use the same variables as above which is slightly faster,
263 // but of course you can use different ones and copy the values inside the event loop
264 //
265 //_____ input tree name ______________________________________________
266 //
267 //TTree* theTree = (TTree*)input->Get("qcd");
268 TTree* theTree = (TTree*)input->Get("data");
269 cout << "--- select signal sample" << endl;
270 //Float_t userVar1, userVar2;
271 //
272 /*
273
274 //top qcd variable list
275 Double_t metHtPlusLepton;
276 theTree->SetBranchAddress("metHtPlusLepton", &metHtPlusLepton);
277 Double_t lepton_pt;
278 theTree->SetBranchAddress("lepton_pt", &lepton_pt);
279 Double_t getAplMu;
280 theTree->SetBranchAddress("getAplMu", &getAplMu);
281 Double_t dPhiLMet;
282 theTree->SetBranchAddress("dPhiLMet", &dPhiLMet);
283 Double_t W_Pt;
284 theTree->SetBranchAddress("W_Pt", &W_Pt);
285 Double_t met_pt;
286 theTree->SetBranchAddress("met_pt", &met_pt);
287 Double_t W_MT;
288 theTree->SetBranchAddress("W_MT", &W_MT);
289 Double_t lepton_eta;
290 theTree->SetBranchAddress("lepton_eta", &lepton_eta);
291 Double_t getMwRec;
292 theTree->SetBranchAddress("getMwRec", &getMwRec);
293 Double_t sphericity;
294 theTree->SetBranchAddress("sphericity", &sphericity);
295 Double_t jet1_pt;
296 theTree->SetBranchAddress("jet1_pt", &jet1_pt);
297 Double_t htPlusLepton;
298 theTree->SetBranchAddress("htPlusLepton", &htPlusLepton);
299 Double_t DphiJMET;
300 theTree->SetBranchAddress("DphiJMET", &DphiJMET);
301 Double_t getHt3;
302 theTree->SetBranchAddress("getHt3", &getHt3);
303 */
304 Double_t jet4_pt;
305 theTree->SetBranchAddress("jet4_pt", &jet4_pt);
306 Double_t jet3_pt;
307 theTree->SetBranchAddress("jet3_pt", &jet3_pt);
308 Double_t jet2_pt;
309 theTree->SetBranchAddress("jet2_pt", &jet2_pt);
310 Double_t met_pt;
311 theTree->SetBranchAddress("met_pt", &met_pt);
312 Double_t getHt2;
313 theTree->SetBranchAddress("getHt2", &getHt2);
314 Double_t metHtPlusLepton;
315 theTree->SetBranchAddress("metHtPlusLepton", &metHtPlusLepton);
316 Double_t getAplMu;
317 theTree->SetBranchAddress("getAplMu", &getAplMu);
318 Double_t getHt3;
319 theTree->SetBranchAddress("getHt3", &getHt3);
320 Double_t getHt;
321 theTree->SetBranchAddress("getHt", &getHt);
322 Double_t lepton_eta;
323 theTree->SetBranchAddress("lepton_eta", &lepton_eta);
324
325 /*
326 Double_t jet3_pt;
327 theTree->SetBranchAddress("jet3_pt", &jet3_pt);
328 Double_t jet4_pt;
329 theTree->SetBranchAddress("jet4_pt", &jet4_pt);
330 Double_t jet2_pt;
331 theTree->SetBranchAddress("jet2_pt", &jet2_pt);
332 Double_t met_pt;
333 theTree->SetBranchAddress("met_pt", &met_pt);
334 Double_t metHtPlusLepton;
335 theTree->SetBranchAddress("metHtPlusLepton", &metHtPlusLepton);
336 Double_t getHt;
337 theTree->SetBranchAddress("getHt", &getHt);
338 Double_t htPlusLepton;
339 theTree->SetBranchAddress("htPlusLepton", &htPlusLepton);
340 Double_t jet1_pt;
341 theTree->SetBranchAddress("jet1_pt", &jet1_pt);
342 Double_t getHt3;
343 theTree->SetBranchAddress("getHt3", &getHt3);
344 Double_t getHt2;
345 theTree->SetBranchAddress("getHt2", &getHt2);
346 Double_t sphericity;
347 theTree->SetBranchAddress("sphericity", &sphericity);
348 Double_t getAplMu;
349 theTree->SetBranchAddress("getAplMu", &getAplMu);
350 Double_t getHt2p;
351 theTree->SetBranchAddress("getHt2p", &getHt2p);
352 Double_t dPhiLMet;
353 theTree->SetBranchAddress("dPhiLMet", &dPhiLMet);
354 */
355 // efficiency calculator for cut method
356 Int_t nSelCuts = 0, nSelCutsD = 0, nSelCutsGA = 0;
357 Double_t effS = 0.7;
358
359 cout << "--- processing: " << theTree->GetEntries() << " events" << endl;
360 TStopwatch sw;
361 sw.Start();
362 for (Long64_t ievt=0; ievt<theTree->GetEntries();ievt++) {
363
364 if (ievt%1000 == 0)
365 cout << "--- ... processing event: " << ievt << endl;
366
367 theTree->GetEntry(ievt);
368 /*
369 _jet3_pt = (Float_t)jet3_pt;
370 _jet4_pt = (Float_t)jet4_pt;
371 _jet2_pt = (Float_t)jet2_pt;
372 _met_pt = (Float_t)met_pt;
373 _metHtPlusLepton = (Float_t)metHtPlusLepton;
374 _getHt = (Float_t)getHt;
375 _htPlusLepton = (Float_t)htPlusLepton;
376 _jet1_pt = (Float_t)jet1_pt;
377 _getHt3 = (Float_t)getHt3;
378 _getHt2 = (Float_t)getHt2;
379 _sphericity = (Float_t)sphericity;
380 _getAplMu = (Float_t)getAplMu;
381 _getHt2p = (Float_t)getHt2p;
382 _dPhiLMet = (Float_t)dPhiLMet;
383 */
384 _jet4_pt = (Float_t)jet4_pt;
385 _jet3_pt = (Float_t)jet3_pt;
386 _jet2_pt = (Float_t)jet2_pt;
387 _met_pt = (Float_t)met_pt;
388 _getHt2 = (Float_t)getHt2;
389 _metHtPlusLepton = (Float_t)metHtPlusLepton;
390 _getAplMu = (Float_t)getAplMu;
391 _getHt3 = (Float_t)getHt3;
392 _getHt = (Float_t)getHt;
393 _lepton_eta =(Float_t)lepton_eta;
394
395
396
397
398 /*
399 //top qcd var list
400 _metHtPlusLepton = (Float_t)metHtPlusLepton;
401 _lepton_pt = (Float_t)lepton_pt;
402 _jet4_pt = (Float_t)jet4_pt;
403 _getAplMu = (Float_t)getAplMu;
404 _dPhiLMet = (Float_t)dPhiLMet;
405 _W_Pt = (Float_t)W_Pt;
406 _met_pt = (Float_t)met_pt;
407 _W_MT = (Float_t)W_MT;
408 _lepton_eta =(Float_t)lepton_eta;
409 _getMwRec = (Float_t)getMwRec;
410 _sphericity =(Float_t)sphericity;
411 _jet1_pt = (Float_t)jet1_pt;
412 _htPlusLepton =(Float_t)htPlusLepton;
413 _DphiJMET = (Float_t)DphiJMET;
414 _getHt3 = (Float_t)getHt3;
415
416 */
417 //
418 // return the MVAs and fill to histograms
419 //
420 if (Use_Cuts) {
421 // Cuts is a special case: give the desired signal efficienciy
422 Bool_t passed = reader->EvaluateMVA( "Cuts method", effS );
423 if (passed) nSelCuts++;
424 }
425 if (Use_CutsD) {
426 // Cuts is a special case: give the desired signal efficienciy
427 Bool_t passed = reader->EvaluateMVA( "CutsD method", effS );
428 if (passed) nSelCutsD++;
429 }
430 if (Use_CutsGA) {
431 // Cuts is a special case: give the desired signal efficienciy
432 Bool_t passed = reader->EvaluateMVA( "CutsGA method", effS );
433 if (passed) nSelCutsGA++;
434 }
435
436 if (Use_Likelihood ){
437 _ll = (Double_t)(reader->EvaluateMVA("Likelihood method") );
438 histLk ->Fill( reader->EvaluateMVA( "Likelihood method" ) );
439 _tree ->Fill();
440 }
441 if (Use_LikelihoodD ) histLkD ->Fill( reader->EvaluateMVA( "LikelihoodD method" ) );
442 if (Use_LikelihoodPCA) histLkPCA ->Fill( reader->EvaluateMVA( "LikelihoodPCA method" ) );
443 if (Use_PDERS ) histPD ->Fill( reader->EvaluateMVA( "PDERS method" ) );
444 if (Use_PDERSD ) histPDD ->Fill( reader->EvaluateMVA( "PDERSD method" ) );
445 if (Use_PDERSPCA ) histPDPCA ->Fill( reader->EvaluateMVA( "PDERSPCA method" ) );
446 if (Use_KNN ) histKNN ->Fill( reader->EvaluateMVA( "KNN method" ) );
447 if (Use_HMatrix ) histHm ->Fill( reader->EvaluateMVA( "HMatrix method" ) );
448 if (Use_Fisher ) histFi ->Fill( reader->EvaluateMVA( "Fisher method" ) );
449 if (Use_MLP ) histNn ->Fill( reader->EvaluateMVA( "MLP method" ) );
450 if (Use_CFMlpANN ) histNnC ->Fill( reader->EvaluateMVA( "CFMlpANN method" ) );
451 if (Use_TMlpANN ) histNnT ->Fill( reader->EvaluateMVA( "TMlpANN method" ) );
452 if (Use_BDT ){
453 _bdtc = (Double_t)(reader->EvaluateMVA("BDT method") );
454 histBdt ->Fill( reader->EvaluateMVA( "BDT method" ) );
455 _tree ->Fill();
456 }
457 if (Use_BDTD ) histBdtD ->Fill( reader->EvaluateMVA( "BDTD method" ) );
458 if (Use_RuleFit ) histRf ->Fill( reader->EvaluateMVA( "RuleFit method" ) );
459 if (Use_SVM_Gauss ) histSVMG ->Fill( reader->EvaluateMVA( "SVM_Gauss method" ) );
460 if (Use_SVM_Poly ) histSVMP ->Fill( reader->EvaluateMVA( "SVM_Poly method" ) );
461 if (Use_SVM_Lin ) histSVML ->Fill( reader->EvaluateMVA( "SVM_Lin method" ) );
462 if (Use_FDA_MT ) histFDAMT ->Fill( reader->EvaluateMVA( "FDA_MT method" ) );
463 if (Use_FDA_GA ) histFDAGA ->Fill( reader->EvaluateMVA( "FDA_GA method" ) );
464
465 // retrieve probability instead of MVA output
466 if (Use_Fisher ) {
467 probHistFi ->Fill( reader->GetProba ( "Fisher method" ) );
468 rarityHistFi->Fill( reader->GetRarity( "Fisher method" ) );
469 }
470 }
471 sw.Stop();
472 cout << "--- end of event loop: "; sw.Print();
473 // get elapsed time
474 if (Use_Cuts) cout << "--- efficiency for Cuts method : " << double(nSelCuts)/theTree->GetEntries()
475 << " (for a required signal efficiency of " << effS << ")" << endl;
476 if (Use_CutsD) cout << "--- efficiency for CutsD method : " << double(nSelCutsD)/theTree->GetEntries()
477 << " (for a required signal efficiency of " << effS << ")" << endl;
478 if (Use_CutsGA) cout << "--- efficiency for CutsGA method: " << double(nSelCutsGA)/theTree->GetEntries()
479 << " (for a required signal efficiency of " << effS << ")" << endl;
480
481 /*************************
482 //
483 // write histograms
484 //
485 TFile *target = new TFile( "TMVApp.root","RECREATE" );
486 if (Use_Likelihood ) histLk ->Write();
487 if (Use_LikelihoodD ) histLkD ->Write();
488 if (Use_LikelihoodPCA) histLkPCA ->Write();
489 if (Use_PDERS ) histPD ->Write();
490 if (Use_PDERSD ) histPDD ->Write();
491 if (Use_PDERSPCA ) histPDPCA ->Write();
492 if (Use_KNN ) histKNN ->Write();
493 if (Use_HMatrix ) histHm ->Write();
494 if (Use_Fisher ) histFi ->Write();
495 if (Use_MLP ) histNn ->Write();
496 if (Use_CFMlpANN ) histNnC ->Write();
497 if (Use_TMlpANN ) histNnT ->Write();
498 if (Use_BDT ) histBdt ->Write();
499 if (Use_BDTD ) histBdtD ->Write();
500 if (Use_RuleFit ) histRf ->Write();
501 if (Use_SVM_Gauss ) histSVMG ->Write();
502 if (Use_SVM_Poly ) histSVMP ->Write();
503 if (Use_SVM_Lin ) histSVML ->Write();
504 if (Use_FDA_MT ) histFDAMT ->Write();
505 if (Use_FDA_GA ) histFDAGA ->Write();
506
507 if (Use_Fisher ) { probHistFi->Write(); rarityHistFi->Write(); }
508
509 target->Close();
510 *******************************/
511
512 target->cd();
513 target->Write();
514 delete target;
515
516 cout << "--- created root file: \"TMVApp-XXX.root\" containing the MVA output histograms" << endl;
517
518 delete reader;
519
520 cout << "==> TMVApplication is done!" << endl << endl;
521
522 }