31 |
|
|
32 |
|
using namespace TMVA; |
33 |
|
|
34 |
+ |
//-------------------------------------------------------------------- |
35 |
+ |
|
36 |
+ |
void fillUnderOverFlow(TH1F *h1, float value, float weight = 1) |
37 |
+ |
{ |
38 |
+ |
float min = h1->GetXaxis()->GetXmin(); |
39 |
+ |
float max = h1->GetXaxis()->GetXmax(); |
40 |
+ |
|
41 |
+ |
if (value > max) value = h1->GetBinCenter(h1->GetNbinsX()); |
42 |
+ |
if (value < min) value = h1->GetBinCenter(1); |
43 |
+ |
|
44 |
+ |
h1->Fill(value, weight); |
45 |
+ |
} |
46 |
+ |
|
47 |
+ |
//-------------------------------------------------------------------- |
48 |
+ |
|
49 |
|
void Classify_HWW( TString myMethodList = "" ) |
50 |
|
{ |
51 |
|
#ifdef __CINT__ |
52 |
|
gROOT->ProcessLine( ".O0" ); // turn off optimization in CINT |
53 |
|
#endif |
54 |
|
|
55 |
+ |
//-------------------------------------------------------------------- |
56 |
+ |
// path to weights dir (this is where MVA training info is stored) |
57 |
+ |
// output root file will be stored at [path]/output |
58 |
+ |
//-------------------------------------------------------------------- |
59 |
+ |
|
60 |
+ |
//TString path = "Trainings/H130_WJetsFO3_tight_4vars/"; |
61 |
+ |
TString path = "./"; |
62 |
+ |
|
63 |
+ |
//----------------------------------- |
64 |
+ |
// select samples to run over |
65 |
+ |
//----------------------------------- |
66 |
+ |
|
67 |
+ |
char* babyPath = "/tas/cerati/HtoWWmvaBabies/latest"; |
68 |
+ |
|
69 |
+ |
vector<char*> samples; |
70 |
+ |
samples.push_back("WWTo2L2Nu"); |
71 |
+ |
samples.push_back("GluGluToWWTo4L"); |
72 |
+ |
samples.push_back("WZ"); |
73 |
+ |
samples.push_back("ZZ"); |
74 |
+ |
samples.push_back("TTJets"); |
75 |
+ |
samples.push_back("tW"); |
76 |
+ |
samples.push_back("WJetsToLNu"); |
77 |
+ |
samples.push_back("DY"); |
78 |
+ |
samples.push_back("Higgs130"); |
79 |
+ |
samples.push_back("WJetsFO3"); |
80 |
+ |
// samples.push_back("Higgs160"); |
81 |
+ |
// samples.push_back("Higgs200"); |
82 |
+ |
|
83 |
+ |
//-------------------------------------------------------------------------------- |
84 |
+ |
// IMPORTANT: set the following variables to the same set used for MVA training!!! |
85 |
+ |
//-------------------------------------------------------------------------------- |
86 |
+ |
|
87 |
+ |
std::map<std::string,int> mvaVar; |
88 |
+ |
mvaVar[ "lephard_pt" ] = 1; |
89 |
+ |
mvaVar[ "lepsoft_pt" ] = 1; |
90 |
+ |
mvaVar[ "dil_dphi" ] = 1; |
91 |
+ |
mvaVar[ "dil_mass" ] = 1; |
92 |
+ |
mvaVar[ "event_type" ] = 0; |
93 |
+ |
mvaVar[ "met_projpt" ] = 0; |
94 |
+ |
mvaVar[ "met_pt" ] = 0; |
95 |
+ |
mvaVar[ "mt_lephardmet" ] = 0; |
96 |
+ |
mvaVar[ "mt_lepsoftmet" ] = 0; |
97 |
+ |
mvaVar[ "dphi_lephardmet" ] = 0; |
98 |
+ |
mvaVar[ "dphi_lepsoftmet" ] = 0; |
99 |
+ |
mvaVar[ "lepsoft_fbrem" ] = 0; |
100 |
+ |
mvaVar[ "lepsoft_eOverPIn" ] = 0; |
101 |
+ |
mvaVar[ "lepsoft_qdphi" ] = 0; |
102 |
+ |
|
103 |
|
//--------------------------------------------------------------- |
104 |
|
|
105 |
|
// This loads the library |
196 |
|
|
197 |
|
// -------------------------------------------------------------------------------------------------- |
198 |
|
|
136 |
– |
//----------------------------------- |
137 |
– |
//select samples to run over |
138 |
– |
//----------------------------------- |
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"); |
150 |
– |
// samples.push_back("Higgs160"); |
151 |
– |
// samples.push_back("Higgs200"); |
152 |
– |
|
199 |
|
const unsigned int nsamples = samples.size(); |
200 |
< |
|
200 |
> |
|
201 |
|
for( unsigned int i = 0 ; i < nsamples ; ++i ){ |
202 |
|
|
203 |
|
// --- Create the Reader object |
217 |
|
Float_t lepsoft_pt; |
218 |
|
Float_t dil_dphi; |
219 |
|
Float_t dil_mass; |
220 |
< |
|
221 |
< |
reader->AddVariable( "lephard_pt" , &lephard_pt ); |
222 |
< |
reader->AddVariable( "lepsoft_pt" , &lepsoft_pt ); |
223 |
< |
reader->AddVariable( "dil_dphi" , &dil_dphi ); |
224 |
< |
reader->AddVariable( "dil_mass" , &dil_mass ); |
220 |
> |
Float_t event_type; |
221 |
> |
Float_t met_projpt; |
222 |
> |
Float_t met_pt; |
223 |
> |
Float_t mt_lephardmet; |
224 |
> |
Float_t mt_lepsoftmet; |
225 |
> |
Float_t dphi_lephardmet; |
226 |
> |
Float_t dphi_lepsoftmet; |
227 |
> |
Float_t lepsoft_fbrem; |
228 |
> |
Float_t lepsoft_eOverPIn; |
229 |
> |
Float_t lepsoft_qdphi; |
230 |
> |
|
231 |
> |
if( mvaVar["lephard_pt"]) reader->AddVariable( "lephard_pt" , &lephard_pt ); |
232 |
> |
if( mvaVar["lepsoft_pt"]) reader->AddVariable( "lepsoft_pt" , &lepsoft_pt ); |
233 |
> |
if( mvaVar["dil_dphi"]) reader->AddVariable( "dil_dphi" , &dil_dphi ); |
234 |
> |
if( mvaVar["dil_mass"]) reader->AddVariable( "dil_mass" , &dil_mass ); |
235 |
> |
if( mvaVar["event_type"]) reader->AddVariable( "event_type" , &event_type ); |
236 |
> |
if( mvaVar["met_projpt"]) reader->AddVariable( "met_projpt" , &met_pt ); |
237 |
> |
if( mvaVar["met_pt"]) reader->AddVariable( "met_pt" , &met_pt ); |
238 |
> |
if( mvaVar["mt_lephardmet"]) reader->AddVariable( "mt_lephardmet" , &mt_lephardmet ); |
239 |
> |
if( mvaVar["mt_lepsoftmet"]) reader->AddVariable( "mt_lepsoftmet" , &mt_lepsoftmet ); |
240 |
> |
if( mvaVar["dphi_lephardmet"]) reader->AddVariable( "dphi_lephardmet" , &dphi_lephardmet ); |
241 |
> |
if( mvaVar["dphi_lepsoftmet"]) reader->AddVariable( "dphi_lepsoftmet" , &dphi_lepsoftmet ); |
242 |
> |
if( mvaVar["lepsoft_fbrem"]) reader->AddVariable( "lepsoft_fbrem" , &lepsoft_fbrem ); |
243 |
> |
if( mvaVar["lepsoft_eOverPIn"]) reader->AddVariable( "lepsoft_eOverPIn" , &lepsoft_eOverPIn ); |
244 |
> |
if( mvaVar["lepsoft_qdphi"]) reader->AddVariable( "lepsoft_q * lepsoft_dPhiIn" , &lepsoft_qdphi ); |
245 |
> |
|
246 |
|
|
247 |
|
// Spectator variables declared in the training have to be added to the reader, too |
248 |
|
// Float_t spec1,spec2; |
265 |
|
// and the output root file is written to [path]/[output] |
266 |
|
//-------------------------------------------------------------------------------------- |
267 |
|
|
201 |
– |
//TString dir = "weights/"; |
202 |
– |
//TString path = "Trainings/H130_WWTo2L2Nu/"; |
203 |
– |
//TString path = "Trainings/H130_WWTo2L2Nu_WJetsToLNu/"; |
204 |
– |
TString path = "Trainings/H130_allbkg/"; |
268 |
|
TString dir = path + "weights/"; |
269 |
|
TString outdir = path + "output/"; |
207 |
– |
|
270 |
|
TString prefix = "TMVAClassification"; |
271 |
|
|
272 |
|
// Book method(s) |
286 |
|
TH1F *histNnC(0), *histNnT(0), *histBdt(0), *histBdtG(0), *histBdtD(0), *histRf(0), *histSVMG(0); |
287 |
|
TH1F *histSVMP(0), *histSVML(0), *histFDAMT(0), *histFDAGA(0), *histCat(0), *histPBdt(0); |
288 |
|
|
289 |
< |
if (Use["Likelihood"]) histLk = new TH1F( "MVA_Likelihood", "MVA_Likelihood", nbin, -1, 1 ); |
289 |
> |
if (Use["Likelihood"]) histLk = new TH1F( "MVA_Likelihood", "MVA_Likelihood", nbin, -1, 1 ); |
290 |
|
if (Use["LikelihoodD"]) histLkD = new TH1F( "MVA_LikelihoodD", "MVA_LikelihoodD", nbin, -1, 0.9999 ); |
291 |
|
if (Use["LikelihoodPCA"]) histLkPCA = new TH1F( "MVA_LikelihoodPCA", "MVA_LikelihoodPCA", nbin, -1, 1 ); |
292 |
|
if (Use["LikelihoodKDE"]) histLkKDE = new TH1F( "MVA_LikelihoodKDE", "MVA_LikelihoodKDE", nbin, -0.00001, 0.99999 ); |
305 |
|
if (Use["MLPBNN"]) histNnbnn = new TH1F( "MVA_MLPBNN", "MVA_MLPBNN", nbin, -1.25, 1.5 ); |
306 |
|
if (Use["CFMlpANN"]) histNnC = new TH1F( "MVA_CFMlpANN", "MVA_CFMlpANN", nbin, 0, 1 ); |
307 |
|
if (Use["TMlpANN"]) histNnT = new TH1F( "MVA_TMlpANN", "MVA_TMlpANN", nbin, -1.3, 1.3 ); |
308 |
< |
if (Use["BDT"]) histBdt = new TH1F( "MVA_BDT", "MVA_BDT", nbin, -0.8, 0.8 ); |
308 |
> |
if (Use["BDT"]) histBdt = new TH1F( "MVA_BDT", "MVA_BDT", nbin, -1. , 1. ); |
309 |
|
if (Use["BDTD"]) histBdtD = new TH1F( "MVA_BDTD", "MVA_BDTD", nbin, -0.8, 0.8 ); |
310 |
|
if (Use["BDTG"]) histBdtG = new TH1F( "MVA_BDTG", "MVA_BDTG", nbin, -1.0, 1.0 ); |
311 |
|
if (Use["RuleFit"]) histRf = new TH1F( "MVA_RuleFit", "MVA_RuleFit", nbin, -2.0, 2.0 ); |
317 |
|
if (Use["Category"]) histCat = new TH1F( "MVA_Category", "MVA_Category", nbin, -2., 2. ); |
318 |
|
if (Use["Plugin"]) histPBdt = new TH1F( "MVA_PBDT", "MVA_BDT", nbin, -0.8, 0.8 ); |
319 |
|
|
320 |
+ |
if (Use["Likelihood"]) histLk ->Sumw2(); |
321 |
+ |
if (Use["LikelihoodD"]) histLkD ->Sumw2(); |
322 |
+ |
if (Use["LikelihoodPCA"]) histLkPCA ->Sumw2(); |
323 |
+ |
if (Use["LikelihoodKDE"]) histLkKDE ->Sumw2(); |
324 |
+ |
if (Use["LikelihoodMIX"]) histLkMIX ->Sumw2(); |
325 |
+ |
if (Use["PDERS"]) histPD ->Sumw2(); |
326 |
+ |
if (Use["PDERSD"]) histPDD ->Sumw2(); |
327 |
+ |
if (Use["PDERSPCA"]) histPDPCA ->Sumw2(); |
328 |
+ |
if (Use["KNN"]) histKNN ->Sumw2(); |
329 |
+ |
if (Use["HMatrix"]) histHm ->Sumw2(); |
330 |
+ |
if (Use["Fisher"]) histFi ->Sumw2(); |
331 |
+ |
if (Use["FisherG"]) histFiG ->Sumw2(); |
332 |
+ |
if (Use["BoostedFisher"]) histFiB ->Sumw2(); |
333 |
+ |
if (Use["LD"]) histLD ->Sumw2(); |
334 |
+ |
if (Use["MLP"]) histNn ->Sumw2(); |
335 |
+ |
if (Use["MLPBFGS"]) histNnbfgs ->Sumw2(); |
336 |
+ |
if (Use["MLPBNN"]) histNnbnn ->Sumw2(); |
337 |
+ |
if (Use["CFMlpANN"]) histNnC ->Sumw2(); |
338 |
+ |
if (Use["TMlpANN"]) histNnT ->Sumw2(); |
339 |
+ |
if (Use["BDT"]) histBdt ->Sumw2(); |
340 |
+ |
if (Use["BDTD"]) histBdtD ->Sumw2(); |
341 |
+ |
if (Use["BDTG"]) histBdtG ->Sumw2(); |
342 |
+ |
if (Use["RuleFit"]) histRf ->Sumw2(); |
343 |
+ |
if (Use["SVM_Gauss"]) histSVMG ->Sumw2(); |
344 |
+ |
if (Use["SVM_Poly"]) histSVMP ->Sumw2(); |
345 |
+ |
if (Use["SVM_Lin"]) histSVML ->Sumw2(); |
346 |
+ |
if (Use["FDA_MT"]) histFDAMT ->Sumw2(); |
347 |
+ |
if (Use["FDA_GA"]) histFDAGA ->Sumw2(); |
348 |
+ |
if (Use["Category"]) histCat ->Sumw2(); |
349 |
+ |
if (Use["Plugin"]) histPBdt ->Sumw2(); |
350 |
+ |
|
351 |
|
// PDEFoam also returns per-event error, fill in histogram, and also fill significance |
352 |
|
if (Use["PDEFoam"]) { |
353 |
|
histPDEFoam = new TH1F( "MVA_PDEFoam", "MVA_PDEFoam", nbin, 0, 1 ); |
367 |
|
// we'll later on use only the "signal" events for the test in this example. |
368 |
|
// |
369 |
|
|
370 |
< |
char* prefix = "babies/v3"; |
370 |
> |
|
371 |
|
TChain *ch = new TChain("Events"); |
372 |
|
|
373 |
|
if( strcmp( samples.at(i) , "DY" ) == 0 ){ |
374 |
< |
ch -> Add( Form("%s/DYToMuMuM20_PU_testFinal_baby.root",prefix) ); |
375 |
< |
ch -> Add( Form("%s/DYToMuMuM10To20_PU_testFinal_baby.root",prefix) ); |
376 |
< |
ch -> Add( Form("%s/DYToEEM20_PU_testFinal_baby.root",prefix) ); |
377 |
< |
ch -> Add( Form("%s/DYToEEM10To20_PU_testFinal_baby.root",prefix) ); |
378 |
< |
ch -> Add( Form("%s/DYToTauTauM20_PU_testFinal_baby.root",prefix) ); |
379 |
< |
ch -> Add( Form("%s/DYToTauTauM10To20_PU_testFinal_baby.root",prefix) ); |
374 |
> |
ch -> Add( Form("%s/DYToMuMuM20_PU_testFinal_baby.root",babyPath) ); |
375 |
> |
ch -> Add( Form("%s/DYToMuMuM10To20_PU_testFinal_baby.root",babyPath) ); |
376 |
> |
ch -> Add( Form("%s/DYToEEM20_PU_testFinal_baby.root",babyPath) ); |
377 |
> |
ch -> Add( Form("%s/DYToEEM10To20_PU_testFinal_baby.root",babyPath) ); |
378 |
> |
ch -> Add( Form("%s/DYToTauTauM20_PU_testFinal_baby.root",babyPath) ); |
379 |
> |
ch -> Add( Form("%s/DYToTauTauM10To20_PU_testFinal_baby.root",babyPath) ); |
380 |
> |
} |
381 |
> |
if( strcmp( samples.at(i) , "WJetsFO3" ) == 0 ){ |
382 |
> |
ch -> Add( Form("%s/WJetsToLNu_FOv3_PU_testFinal_baby.root",babyPath) ); |
383 |
> |
ch -> Add( Form("%s/WToLNu_FOv3_testFinal_baby.root",babyPath) ); |
384 |
|
} |
385 |
|
else if( strcmp( samples.at(i) , "Higgs130" ) == 0 ){ |
386 |
< |
ch -> Add( Form("%s/HToWWTo2L2NuM130_PU_testFinal_baby.root",prefix) ); |
387 |
< |
ch -> Add( Form("%s/HToWWToLNuTauNuM130_PU_testFinal_baby.root",prefix) ); |
388 |
< |
ch -> Add( Form("%s/HToWWTo2Tau2NuM130_PU_testFinal_baby.root",prefix) ); |
386 |
> |
ch -> Add( Form("%s/HToWWTo2L2NuM130_PU_testFinal_baby.root",babyPath) ); |
387 |
> |
ch -> Add( Form("%s/HToWWToLNuTauNuM130_PU_testFinal_baby.root",babyPath) ); |
388 |
> |
ch -> Add( Form("%s/HToWWTo2Tau2NuM130_PU_testFinal_baby.root",babyPath) ); |
389 |
|
} |
390 |
|
else if( strcmp( samples.at(i) , "Higgs160" ) == 0 ){ |
391 |
< |
ch -> Add( Form("%s/HToWWTo2L2NuM160_PU_testFinal_baby.root",prefix) ); |
392 |
< |
ch -> Add( Form("%s/HToWWToLNuTauNuM160_PU_testFinal_baby.root",prefix) ); |
393 |
< |
ch -> Add( Form("%s/HToWWTo2Tau2NuM160_PU_testFinal_baby.root",prefix) ); |
391 |
> |
ch -> Add( Form("%s/HToWWTo2L2NuM160_PU_testFinal_baby.root",babyPath) ); |
392 |
> |
ch -> Add( Form("%s/HToWWToLNuTauNuM160_PU_testFinal_baby.root",babyPath) ); |
393 |
> |
ch -> Add( Form("%s/HToWWTo2Tau2NuM160_PU_testFinal_baby.root",babyPath) ); |
394 |
|
} |
395 |
|
else if( strcmp( samples.at(i) , "Higgs200" ) == 0 ){ |
396 |
< |
ch -> Add( Form("%s/HToWWTo2L2NuM200_PU_testFinal_baby.root",prefix) ); |
397 |
< |
ch -> Add( Form("%s/HToWWToLNuTauNuM200_PU_testFinal_baby.root",prefix) ); |
398 |
< |
ch -> Add( Form("%s/HToWWTo2Tau2NuM200_PU_testFinal_baby.root",prefix) ); |
396 |
> |
ch -> Add( Form("%s/HToWWTo2L2NuM200_PU_testFinal_baby.root",babyPath) ); |
397 |
> |
ch -> Add( Form("%s/HToWWToLNuTauNuM200_PU_testFinal_baby.root",babyPath) ); |
398 |
> |
ch -> Add( Form("%s/HToWWTo2Tau2NuM200_PU_testFinal_baby.root",babyPath) ); |
399 |
|
} |
400 |
|
else{ |
401 |
< |
ch -> Add( Form("%s/%s_PU_testFinal_baby.root",prefix,samples.at(i)) ); |
401 |
> |
ch -> Add( Form("%s/%s_PU_testFinal_baby.root",babyPath,samples.at(i)) ); |
402 |
|
} |
403 |
|
|
307 |
– |
|
308 |
– |
|
404 |
|
// --- Event loop |
405 |
|
|
406 |
|
// Prepare the event tree |
423 |
|
|
424 |
|
Float_t lephard_pt_; |
425 |
|
Float_t lepsoft_pt_; |
426 |
+ |
Float_t lepsoft_fr_; |
427 |
|
Float_t dil_dphi_; |
428 |
|
Float_t dil_mass_; |
429 |
< |
Int_t event_type_; |
429 |
> |
Float_t event_type_; |
430 |
|
Float_t met_projpt_; |
431 |
|
Int_t jets_num_; |
432 |
|
Int_t extralep_num_; |
433 |
|
Int_t lowptbtags_num_; |
434 |
|
Int_t softmu_num_; |
435 |
|
Float_t event_scale1fb_; |
436 |
< |
|
437 |
< |
theTree->SetBranchAddress( "lephard_pt_" , &lephard_pt_ ); |
438 |
< |
theTree->SetBranchAddress( "lepsoft_pt_" , &lepsoft_pt_ ); |
439 |
< |
theTree->SetBranchAddress( "dil_dphi_" , &dil_dphi_ ); |
440 |
< |
theTree->SetBranchAddress( "dil_mass_" , &dil_mass_ ); |
441 |
< |
theTree->SetBranchAddress( "event_type_" , &event_type_ ); |
442 |
< |
theTree->SetBranchAddress( "met_projpt_" , &met_projpt_ ); |
443 |
< |
theTree->SetBranchAddress( "jets_num_" , &jets_num_ ); |
444 |
< |
theTree->SetBranchAddress( "extralep_num_" , &extralep_num_ ); |
445 |
< |
theTree->SetBranchAddress( "lowptbtags_num_" , &lowptbtags_num_ ); |
446 |
< |
theTree->SetBranchAddress( "softmu_num_" , &softmu_num_ ); |
447 |
< |
theTree->SetBranchAddress( "event_scale1fb_" , &event_scale1fb_ ); |
436 |
> |
Float_t met_pt_; |
437 |
> |
Int_t lepsoft_passTighterId_; |
438 |
> |
Float_t mt_lephardmet_; |
439 |
> |
Float_t mt_lepsoftmet_; |
440 |
> |
Float_t dphi_lephardmet_; |
441 |
> |
Float_t dphi_lepsoftmet_; |
442 |
> |
Float_t lepsoft_fbrem_; |
443 |
> |
Float_t lepsoft_eOverPIn_; |
444 |
> |
Float_t lepsoft_q_; |
445 |
> |
Float_t lepsoft_dPhiIn_; |
446 |
> |
|
447 |
> |
theTree->SetBranchAddress( "lephard_pt_" , &lephard_pt_ ); |
448 |
> |
theTree->SetBranchAddress( "lepsoft_pt_" , &lepsoft_pt_ ); |
449 |
> |
theTree->SetBranchAddress( "lepsoft_fr_" , &lepsoft_fr_ ); |
450 |
> |
theTree->SetBranchAddress( "dil_dphi_" , &dil_dphi_ ); |
451 |
> |
theTree->SetBranchAddress( "dil_mass_" , &dil_mass_ ); |
452 |
> |
theTree->SetBranchAddress( "event_type_" , &event_type_ ); |
453 |
> |
theTree->SetBranchAddress( "met_projpt_" , &met_projpt_ ); |
454 |
> |
theTree->SetBranchAddress( "jets_num_" , &jets_num_ ); |
455 |
> |
theTree->SetBranchAddress( "extralep_num_" , &extralep_num_ ); |
456 |
> |
theTree->SetBranchAddress( "lowptbtags_num_" , &lowptbtags_num_ ); |
457 |
> |
theTree->SetBranchAddress( "softmu_num_" , &softmu_num_ ); |
458 |
> |
theTree->SetBranchAddress( "event_scale1fb_" , &event_scale1fb_ ); |
459 |
> |
theTree->SetBranchAddress( "lepsoft_passTighterId_" , &lepsoft_passTighterId_ ); |
460 |
> |
theTree->SetBranchAddress( "met_pt_" , &met_pt_ ); |
461 |
> |
theTree->SetBranchAddress( "mt_lephardmet_" , &mt_lephardmet_ ); |
462 |
> |
theTree->SetBranchAddress( "mt_lepsoftmet_" , &mt_lepsoftmet_ ); |
463 |
> |
theTree->SetBranchAddress( "dphi_lephardmet_" , &dphi_lephardmet_ ); |
464 |
> |
theTree->SetBranchAddress( "dphi_lepsoftmet_" , &dphi_lepsoftmet_ ); |
465 |
> |
theTree->SetBranchAddress( "lepsoft_fbrem_" , &lepsoft_fbrem_ ); |
466 |
> |
theTree->SetBranchAddress( "lepsoft_eOverPIn_" , &lepsoft_eOverPIn_ ); |
467 |
> |
theTree->SetBranchAddress( "lepsoft_q_" , &lepsoft_q_ ); |
468 |
> |
theTree->SetBranchAddress( "lepsoft_dPhiIn_" , &lepsoft_dPhiIn_ ); |
469 |
|
|
470 |
|
// Efficiency calculator for cut method |
471 |
|
Int_t nSelCutsGA = 0; |
477 |
|
TStopwatch sw; |
478 |
|
sw.Start(); |
479 |
|
|
480 |
< |
int npass = 0; |
481 |
< |
|
480 |
> |
int npass = 0; |
481 |
> |
float yield = 0.; |
482 |
> |
|
483 |
|
for (Long64_t ievt=0; ievt<theTree->GetEntries();ievt++) { |
484 |
|
|
485 |
|
if (ievt%1000 == 0) std::cout << "--- ... Processing event: " << ievt << std::endl; |
491 |
|
//------------------------------------------------------- |
492 |
|
|
493 |
|
//em |
494 |
< |
if( event_type_ == 1 || event_type == 2 ){ |
494 |
> |
if( event_type_ > 0.5 && event_type_ < 2.5 ){ |
495 |
|
if( met_projpt_ < 20. ) continue; |
496 |
|
} |
497 |
|
//ee/mm |
498 |
< |
if( event_type_ == 0 || event_type == 3 ){ |
498 |
> |
if( event_type_ < 0.5 || event_type_ > 2.5 ){ |
499 |
|
if( met_projpt_ < 35. ) continue; |
500 |
|
} |
501 |
|
|
502 |
< |
if( lephard_pt_ < 20. ) continue; |
503 |
< |
//if( lepsoft_pt_ < 10. ) continue; |
504 |
< |
if( lepsoft_pt_ < 20. ) continue; |
505 |
< |
if( jets_num_ > 0 ) continue; |
506 |
< |
if( extralep_num_ > 0 ) continue; |
507 |
< |
if( lowptbtags_num_ > 0 ) continue; |
508 |
< |
if( softmu_num_ > 0 ) continue; |
509 |
< |
if( dil_mass_ < 12. ) continue; |
510 |
< |
|
511 |
< |
float weight = event_scale1fb_ * 0.0355; |
512 |
< |
|
513 |
< |
lephard_pt = lephard_pt_; |
514 |
< |
lepsoft_pt = lepsoft_pt_; |
515 |
< |
dil_mass = dil_mass_; |
516 |
< |
dil_dphi = dil_dphi_; |
502 |
> |
if( lephard_pt_ < 20. ) continue; |
503 |
> |
if( lepsoft_pt_ < 10. ) continue; |
504 |
> |
//if( lepsoft_pt_ < 20. ) continue; |
505 |
> |
if( jets_num_ > 0 ) continue; |
506 |
> |
if( extralep_num_ > 0 ) continue; |
507 |
> |
if( lowptbtags_num_ > 0 ) continue; |
508 |
> |
if( softmu_num_ > 0 ) continue; |
509 |
> |
if( dil_mass_ < 12. ) continue; |
510 |
> |
if( lepsoft_passTighterId_ == 0 ) continue; |
511 |
> |
if( event_type_ < 1.5 ) continue; |
512 |
> |
if( dil_mass_ > 90. ) continue; |
513 |
> |
|
514 |
> |
float weight = event_scale1fb_ * lepsoft_fr_ * 0.5; |
515 |
> |
|
516 |
> |
//-------------------------------------------------------- |
517 |
> |
// important: here we associate branches to MVA variables |
518 |
> |
//-------------------------------------------------------- |
519 |
> |
|
520 |
> |
lephard_pt = lephard_pt_; |
521 |
> |
lepsoft_pt = lepsoft_pt_; |
522 |
> |
dil_mass = dil_mass_; |
523 |
> |
dil_dphi = dil_dphi_; |
524 |
> |
event_type = event_type_; |
525 |
> |
met_pt = met_pt_; |
526 |
> |
met_projpt = met_projpt_; |
527 |
> |
mt_lephardmet = mt_lephardmet_; |
528 |
> |
mt_lepsoftmet = mt_lepsoftmet_; |
529 |
> |
dphi_lephardmet = dphi_lephardmet_; |
530 |
> |
dphi_lepsoftmet = dphi_lepsoftmet_; |
531 |
> |
lepsoft_fbrem = lepsoft_fbrem_; |
532 |
> |
lepsoft_eOverPIn = lepsoft_eOverPIn_; |
533 |
> |
lepsoft_qdphi = lepsoft_q_ * lepsoft_dPhiIn_; |
534 |
|
|
535 |
|
npass++; |
536 |
+ |
yield+=weight; |
537 |
+ |
|
538 |
|
// var1 = userVar1 + userVar2; |
539 |
|
// var2 = userVar1 - userVar2; |
540 |
|
|
593 |
|
} |
594 |
|
} |
595 |
|
|
596 |
< |
std::cout << npass << " events passing selection" << std::endl; |
596 |
> |
std::cout << npass << " events passing selection, yield " << yield << std::endl; |
597 |
|
|
598 |
|
// Get elapsed time |
599 |
|
sw.Stop(); |