139 |
|
|
140 |
|
vector<char*> samples; |
141 |
|
samples.push_back("WWTo2L2Nu"); |
142 |
< |
// samples.push_back("GluGluToWWTo4L"); |
143 |
< |
// samples.push_back("WZ"); |
144 |
< |
// samples.push_back("ZZ"); |
145 |
< |
// samples.push_back("TTJets"); |
146 |
< |
// samples.push_back("tW"); |
147 |
< |
// samples.push_back("WJetsToLNu"); |
148 |
< |
// samples.push_back("DY"); |
149 |
< |
// samples.push_back("Higgs130"); |
142 |
> |
samples.push_back("GluGluToWWTo4L"); |
143 |
> |
samples.push_back("WZ"); |
144 |
> |
samples.push_back("ZZ"); |
145 |
> |
samples.push_back("TTJets"); |
146 |
> |
samples.push_back("tW"); |
147 |
> |
samples.push_back("WJetsToLNu"); |
148 |
> |
samples.push_back("DY"); |
149 |
> |
samples.push_back("Higgs130"); |
150 |
|
// samples.push_back("Higgs160"); |
151 |
|
// samples.push_back("Higgs200"); |
152 |
|
|
193 |
|
// --- Book the MVA methods |
194 |
|
|
195 |
|
//TString dir = "weights/"; |
196 |
< |
TString path = "Trainings/H130_WWTo2L2Nu/"; |
196 |
> |
//TString path = "Trainings/H130_WWTo2L2Nu/"; |
197 |
> |
//TString path = "Trainings/H130_WWTo2L2Nu_WJetsToLNu/"; |
198 |
> |
TString path = "Trainings/H130_allbkg/"; |
199 |
|
TString dir = path + "weights/"; |
200 |
|
TString outdir = path + "output/"; |
201 |
|
|
211 |
|
} |
212 |
|
|
213 |
|
// Book output histograms |
214 |
< |
UInt_t nbin = 100; |
214 |
> |
UInt_t nbin = 1000; |
215 |
|
TH1F *histLk(0), *histLkD(0), *histLkPCA(0), *histLkKDE(0), *histLkMIX(0), *histPD(0), *histPDD(0); |
216 |
|
TH1F *histPDPCA(0), *histPDEFoam(0), *histPDEFoamErr(0), *histPDEFoamSig(0), *histKNN(0), *histHm(0); |
217 |
|
TH1F *histFi(0), *histFiG(0), *histFiB(0), *histLD(0), *histNn(0),*histNnbfgs(0),*histNnbnn(0); |
267 |
|
// in this example, there is a toy tree with signal and one with background events |
268 |
|
// we'll later on use only the "signal" events for the test in this example. |
269 |
|
// |
268 |
– |
// TFile *input(0); |
269 |
– |
// TString fname = "./tmva_example.root"; |
270 |
– |
// if (!gSystem->AccessPathName( fname )) |
271 |
– |
// input = TFile::Open( fname ); // check if file in local directory exists |
272 |
– |
// else |
273 |
– |
// input = TFile::Open( "http://root.cern.ch/files/tmva_class_example.root" ); // if not: download from ROOT server |
274 |
– |
|
275 |
– |
// if (!input) { |
276 |
– |
// std::cout << "ERROR: could not open data file" << std::endl; |
277 |
– |
// exit(1); |
278 |
– |
// } |
279 |
– |
// std::cout << "--- TMVAClassificationApp : Using input file: " << input->GetName() << std::endl; |
280 |
– |
|
270 |
|
|
271 |
|
char* iter = "v2"; |
272 |
|
TChain *ch = new TChain("Events"); |
299 |
|
} |
300 |
|
|
301 |
|
|
313 |
– |
// TChain *chbackground = new TChain("Events"); |
314 |
– |
// if( sample == "WW" ) chbackground->Add(Form("babies/%s/WWTo2L2Nu_PU_testFinal_baby.root",iter)); |
315 |
– |
// chbackground->Add(Form("babies/%s/GluGluToWWTo4L_PU_testFinal_baby.root",iter)); |
316 |
– |
// chbackground->Add(Form("babies/%s/WZ_PU_testFinal_baby.root",iter)); |
317 |
– |
// chbackground->Add(Form("babies/%s/ZZ_PU_testFinal_baby.root",iter)); |
318 |
– |
// chbackground->Add(Form("babies/%s/TTJets_PU_testFinal_baby.root",iter)); |
319 |
– |
// chbackground->Add(Form("babies/%s/tW_PU_testFinal_baby.root",iter)); |
320 |
– |
// chbackground->Add(Form("babies/%s/WJetsToLNu_PU_testFinal_baby.root",iter)); |
321 |
– |
// chbackground->Add(Form("babies/%s/DYToMuMuM20_PU_testFinal_baby.root",iter) ); |
322 |
– |
// chbackground->Add(Form("babies/%s/DYToMuMuM10To20_PU_testFinal_baby.root",iter) ); |
323 |
– |
// chbackground->Add(Form("babies/%s/DYToEEM20_PU_testFinal_baby.root",iter) ); |
324 |
– |
// chbackground->Add(Form("babies/%s/DYToEEM10To20_PU_testFinal_baby.root",iter) ); |
325 |
– |
// chbackground->Add(Form("babies/%s/DYToTauTauM20_PU_testFinal_baby.root",iter) ); |
326 |
– |
// chbackground->Add(Form("babies/%s/DYToTauTauM10To20_PU_testFinal_baby.root",iter) ); |
327 |
– |
|
328 |
– |
// int mH = 130; |
329 |
– |
// //int mH = 160; |
330 |
– |
// //int mH = 200; |
331 |
– |
|
332 |
– |
// TChain *chsignal = new TChain("Events"); |
333 |
– |
|
334 |
– |
// if( mH == 130 ){ |
335 |
– |
// chsignal->Add(Form("babies/%s/HToWWTo2L2NuM130_PU_testFinal_baby.root",iter)); |
336 |
– |
// chsignal->Add(Form("babies/%s/HToWWToLNuTauNuM130_PU_testFinal_baby.root",iter)); |
337 |
– |
// chsignal->Add(Form("babies/%s/HToWWTo2Tau2NuM130_PU_testFinal_baby.root",iter)); |
338 |
– |
// } |
339 |
– |
// else if( mH == 160 ){ |
340 |
– |
// chsignal->Add(Form("babies/%s/HToWWTo2L2NuM160_PU_testFinal_baby.root",iter)); |
341 |
– |
// chsignal->Add(Form("babies/%s/HToWWToLNuTauNuM160_PU_testFinal_baby.root",iter)); |
342 |
– |
// chsignal->Add(Form("babies/%s/HToWWTo2Tau2NuM160_PU_testFinal_baby.root",iter)); |
343 |
– |
// } |
344 |
– |
// else if( mH == 200 ){ |
345 |
– |
// chsignal->Add(Form("babies/%s/HToWWTo2L2NuM200_PU_testFinal_baby.root",iter)); |
346 |
– |
// chsignal->Add(Form("babies/%s/HToWWToLNuTauNuM200_PU_testFinal_baby.root",iter)); |
347 |
– |
// chsignal->Add(Form("babies/%s/HToWWTo2Tau2NuM200_PU_testFinal_baby.root",iter)); |
348 |
– |
// } |
349 |
– |
// else{ |
350 |
– |
// std::cout << "Error, unrecognized higgs mass " << mH << " GeV, quitting" << std::endl; |
351 |
– |
// exit(0); |
352 |
– |
//} |
353 |
– |
|
354 |
– |
|
355 |
– |
|
302 |
|
|
303 |
|
// --- Event loop |
304 |
|
|
308 |
|
// but of course you can use different ones and copy the values inside the event loop |
309 |
|
// |
310 |
|
|
365 |
– |
|
366 |
– |
|
367 |
– |
|
368 |
– |
// TTree* theTree = (TTree*)input->Get("TreeS"); |
369 |
– |
// Float_t userVar1, userVar2; |
370 |
– |
// theTree->SetBranchAddress( "var1", &userVar1 ); |
371 |
– |
// theTree->SetBranchAddress( "var2", &userVar2 ); |
372 |
– |
// theTree->SetBranchAddress( "var3", &var3 ); |
373 |
– |
// theTree->SetBranchAddress( "var4", &var4 ); |
374 |
– |
|
311 |
|
TTree *theTree = (TTree*) ch; |
312 |
|
|
313 |
|
std::cout << "--- Using input files: -------------------" << std::endl; |
320 |
|
std::cout << currentFile->GetTitle() << std::endl; |
321 |
|
} |
322 |
|
|
387 |
– |
//TTree *theTree = (TTree*) chsignal; |
388 |
– |
//TTree *theTree = (TTree*) chbackground; |
323 |
|
Float_t lephard_pt_; |
324 |
|
Float_t lepsoft_pt_; |
325 |
|
Float_t dil_dphi_; |
365 |
|
if( event_type_ == 2 && met_projpt_ < 20. ) continue; |
366 |
|
if( event_type_ != 2 && met_projpt_ < 35. ) continue; |
367 |
|
if( lephard_pt_ < 20. ) continue; |
368 |
< |
if( lepsoft_pt_ < 10. ) continue; |
368 |
> |
//if( lepsoft_pt_ < 10. ) continue; |
369 |
> |
if( lepsoft_pt_ < 20. ) continue; |
370 |
|
if( jets_num_ > 0 ) continue; |
371 |
|
if( extralep_num_ > 0 ) continue; |
372 |
|
if( lowptbtags_num_ > 0 ) continue; |