ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Jeng/scripts/ikstest.cc
Revision: 1.7
Committed: Wed Sep 8 04:51:35 2010 UTC (14 years, 7 months ago) by jengbou
Content type: text/plain
Branch: MAIN
Changes since 1.6: +175 -102 lines
Log Message:
Update to include non Wjets contributions

File Contents

# Content
1 #include "ikstest.h"
2 #include "TopStyle/CMSTopStyle.cc"
3
4 //=================================
5 // Program to run IKS test
6 // * Input directories:
7 // * Data: skimmed_Data_x.xxpb-1
8 // => default selection : Data_<suffix>.root
9 // => n-1 selection : Data_<suffix>_<invName>.root
10 // * MC : skimmed_MC {QCD,WJets,TTbar...}
11 // => default selection : QCD_<suffix>.root
12 // => n-1 selection : Data_<suffix>_<invName>.root
13 // * Upmost output dir specified by <desDir>
14 // subdirectory created according to <useInv> and <realData>
15 // => <desDir'><xyz><suffix>.pdf (.txt)
16 // * e.g. to do KS test on data with MC QCD shape in signal region:
17 // useInv=false; realData=true
18 //=================================
19
20 using namespace std;
21
22 //define the constants: 2.88/pb
23 const Double_t weight_[5] = {0.0524313, //QCD
24 0.0089567, //WJets
25 0.000306, //TTbar
26 0.0080911, //ZJets
27 0.000114 //STtch
28 };
29 const Double_t procQCD = 1.46;
30 const Double_t procWJets = 1.03;
31 const Double_t procTTbar = 1.;
32 const Double_t procZJets = 1.;
33 const Double_t procSTtch = 1.;
34
35 // Output directory
36 TString baseDir = "Results_2.88pb-1_NEW/";
37 // User defined parameters
38 bool useInv = false; // whether to use n-1 QCD template
39 bool realData = false;
40 // Ntuples to use
41 TString suffix = "Sel0"; // Suffix of selection
42 TString invNames[2] = {"RelIsogt0p1","D0gt0p02"};
43 map<TString,TCanvas*> cvs; // map of usual histogram
44 bool debug_ = false;
45
46 //=================================
47 // Main program
48 //=================================
49 void ikstest() {
50 CMSTopStyle style;
51 gROOT->SetStyle("CMS");
52 TLatex *latex = new TLatex();
53 latex->SetNDC();
54
55 int size_ninv = (useInv ? 2 : 1);
56 for (int ninv = 0;ninv < size_ninv; ++ninv) {
57 TString invName = invNames[ninv];
58 TString desDir;
59 if (!useInv) {
60 if (!realData) desDir = baseDir + "MC/";
61 else desDir = baseDir + "Data_MC/";
62 } else {
63 if (!realData) desDir = baseDir + "MC_"+invName+"/";
64 else desDir = baseDir + "Data_"+invName+"/";
65 }
66 struct stat stDir;
67 if (!stat(desDir,&stDir)){
68 cout << "Output folder exists! Continues? (enter to continue; 'q' for quit)" << endl;
69 char incmd;
70 cin.get(incmd);
71 if (incmd == 'q') return;
72 } else {
73 cout << "Creating folder : " << desDir << endl;
74 if (mkdir(desDir,0755) == -1){
75 std::cerr << "Error creating folder" << endl;
76 return;
77 }
78 }
79
80 ofstream outprint(TString(desDir+"Results_"+suffix+".txt"));
81 //open the files with histograms
82 map<string,TFile*> mfile;
83 mfile.clear();
84 mfile["Data"] = TFile::Open(TString("skimmed_Data_2.88pb-1/Data_"+suffix+".root"));
85 // n-1 cuts
86 if (useInv) {
87 if (realData)
88 mfile["InvSel"] = TFile::Open(TString("skimmed_Data_2.88pb-1/Data_"+suffix+"_"+invName+".root"));
89 else
90 mfile["InvSel"] = TFile::Open(TString("skimmed_MC/v5/QCD_"+suffix+"_"+invName+".root"));
91 }
92 // RefSel MC
93 mfile["0"] = TFile::Open(TString("skimmed_MC/v5/QCD_"+suffix+".root"));
94 mfile["1"] = TFile::Open(TString("skimmed_MC/v5/WJets_"+suffix+".root"));
95 mfile["2"] = TFile::Open(TString("skimmed_MC/v5/TTbar_"+suffix+".root"));
96 mfile["3"] = TFile::Open(TString("skimmed_MC/v5/ZJets_"+suffix+".root"));
97 mfile["4"] = TFile::Open(TString("skimmed_MC/v5/STtch_"+suffix+".root"));
98
99 //define histograms and related parameters
100 string histoName[3] = {"h_mu_pt_calo","h_met_calo","h_mt_calo"};
101 string histoLabelX[3] = {"p_{T}^{#mu} [GeV/c]", "#slash{E}_{T} [GeV/c]", "M_{T}^{W} [GeV/c^{2}]"};
102 Int_t xbins[3] = {20,20,40};
103 Double_t xlow[3] = {0.,0.,0.};
104 Double_t xhigh[3] = {100.,100.,200.};
105 string sample[5] = {"QCD","WJets","TTbar","ZJets","STtch"};
106
107 TH1F* hMC_[5][3]; // MC histograms
108 TH1F* hData_[3]; // Data or mix MC
109 TH1F* hQCD_NEW[3]; // InvSel QCD shape
110 TH1F* hKSres_[3];
111 TH1F* hKSvalues_[3];
112 TH1F* hQCD_KS[3];
113 TH1F* hWJets_KS[3];
114
115 //load the histograms from the root files
116 for (int vi = 0; vi < 3; ++vi) {// 3 variables
117 //cout << "file[" << vi << "] : " << endl;
118 string nameNewHisto = "mix_"+histoName[vi];
119 string nameNewHistoSFKS = "finalSF_"+histoName[vi];
120 string nameNewHistoKSvalues = "KSvalues_"+histoLabelX[vi];
121
122 hData_[vi] = new TH1F(nameNewHisto.c_str(),"",xbins[vi],xlow[vi],xhigh[vi]);
123 hKSres_[vi] = new TH1F(nameNewHistoSFKS.c_str(),"",xbins[vi],xlow[vi],xhigh[vi]);
124 hKSvalues_[vi] = new TH1F(nameNewHistoKSvalues.c_str(),"",2./stepsize, stepsize, 2.+stepsize);
125
126 ostringstream ssc;
127 ssc << vi;
128
129 if (!useInv) {//use QCD MC sample
130 hQCD_NEW[vi] = (TH1F*) mfile["0"]->Get(TString(histoName[vi]))->Clone();
131 hQCD_NEW[vi] -> Scale(weight_[0]);
132 hQCD_NEW[vi] -> SetName(TString("InvSel_"+histoName[vi]+"_"+ssc.str()));
133 }
134 else {
135 hQCD_NEW[vi] = (TH1F*) mfile["InvSel"]->Get(TString(histoName[vi]))->Clone();
136 if (!realData) hQCD_NEW[vi] -> Scale(weight_[0]);
137 hQCD_NEW[vi] -> SetName(TString("InvSel_"+histoName[vi]+"_"+ssc.str()));
138 }
139 if (debug_) cout << "hQCD_NEW[" << vi << "] @ " << hQCD_NEW[vi] << endl;
140
141 hData_[vi] -> Sumw2();
142 hKSres_[vi] -> Sumw2();
143 hKSvalues_[vi] -> Sumw2();
144 }
145
146 for (int n = 0; n < 5; ++n) {// 3 MC samples
147 for (int ihisto = 0; ihisto < 3; ihisto++) {// 3 variables
148 //cout << "Variable[" << ihisto << "]" << endl;
149 string histo_name = histoName[ihisto]+sample[n];
150 ostringstream ss;
151 ss << n;
152 hMC_[n][ihisto] = (TH1F*) mfile[ss.str()]->Get(TString(histoName[ihisto]))->Clone();
153 if (debug_) {
154 cout << "File[" << n << "] @" << mfile[ss.str()]
155 << "; histo[" << ihisto << "] @ " << mfile[ss.str()]->Get(TString(histoName[ihisto]))
156 <<"; hMC_[" << n << "][" << ihisto << "] raw evts = "
157 << setw(12) << hMC_[n][ihisto]->Integral();
158 }
159 hMC_[n][ihisto] -> Scale(weight_[n]);
160 hMC_[n][ihisto] -> SetName(TString("MC_"+sample[n]+"_"+histoName[ihisto]));
161 if (debug_) cout << "; weighted num evts = " << setw(8) << hMC_[n][ihisto]->Integral() << endl;
162 }
163 }
164
165 //create the mixed samples = "data"
166 TString cvsName0 = "Data";
167 if (useInv) {
168 cvsName0 += "_";
169 cvsName0 += invName;
170 }
171 cvs[cvsName0] = new TCanvas(cvsName0,"Data distributions",600,700);
172 cvs[cvsName0]->Divide(3,1);
173 for (int i = 0; i < 3; i++) {
174 cvs[cvsName0]->cd(i+1);
175 if (!realData) {
176 hData_[i] -> Add(hMC_[0][i],hMC_[1][i], procQCD,procWJets);
177 hData_[i] -> Add(hMC_[2][i], procTTbar);
178 hData_[i] -> Add(hMC_[3][i], procZJets);
179 hData_[i] -> Add(hMC_[4][i], procSTtch);
180 }
181 else {
182 TH1F *htmp = (TH1F*) mfile["Data"]->Get(TString(histoName[i]));
183 hData_[i] -> Add(htmp,1.);
184 }
185 hData_[i]->GetXaxis()->SetTitle(histoLabelX[i].c_str());
186 hData_[i]->GetYaxis()->SetTitle("Entries");
187 hData_[i]->DrawClone();
188 }
189 cvs[cvsName0]->SaveAs(TString(desDir+"Data_distributions.pdf"));
190
191 //Calculate num of events for each sample
192 vector<double> vNev_;
193
194 double NevData = hData_[2]->Integral();
195 double corr_NevQCD = hMC_[0][2]->Integral();
196 double corr_NevQCD_NEW = hQCD_NEW[2]->Integral();
197 double corr_NevWJets = hMC_[1][2]->Integral();
198 double corr_NevTTbar = hMC_[2][2]->Integral();
199 double corr_NevZJets = hMC_[3][2]->Integral();
200 double corr_NevSTtch = hMC_[4][2]->Integral();
201 cout << "corr_NevSTtch = " << corr_NevSTtch << endl;
202 // double corr_Nevmix = procQCD*corr_NevQCD + procWJets*corr_NevWJets
203 // + procTTbar*corr_NevTTbar+procZJets*corr_NevZJets + procSTtch*corr_NevSTtch;//should equal NevData for MC
204 // store nev in a vector
205 vNev_.push_back(NevData);
206 vNev_.push_back((useInv ? corr_NevQCD_NEW : corr_NevQCD));
207 vNev_.push_back(corr_NevWJets);
208
209 // Non WJets (use MC expected values):
210 if (procTTbar > 0.) vNev_.push_back(corr_NevTTbar*procTTbar);
211 if (procZJets > 0.) vNev_.push_back(corr_NevZJets*procZJets);
212 if (procSTtch > 0.) vNev_.push_back(corr_NevSTtch*procSTtch);
213
214 outprint << "Events in Data = " << NevData << endl;
215 outprint << "Events QCD sample = " << corr_NevQCD << endl;
216 outprint << "Events InvSel sample = " << corr_NevQCD_NEW << endl;
217 outprint << "---------------------------" << endl;
218 outprint << "Events WJets sample = " << corr_NevWJets << endl;
219 outprint << "Events TTbar sample = " << corr_NevTTbar << endl;
220 outprint << "Events ZJets sample = " << corr_NevZJets << endl;
221 outprint << "Events STtch sample = " << corr_NevSTtch << endl;
222
223 //define the containers for chosen numbers (coressponding to the max KStest result)
224 testMC maxProb[3];
225
226 //define the scale factors calculated using information obtained from all parameters
227 Double_t SFbackg = 0.0;
228 Double_t sumSFbackg = 0.0;
229 Double_t SFsample = 0.0;
230 Double_t sumSFsample = 0.0;
231 Double_t allKS = 0.0;
232
233 //do the KS test by varying the scale factors
234 for (int i = 0; i < 3; i++) { // 3 variables
235 TH1F *data = (TH1F*)hData_[i]->Clone("data");
236 data -> SetName("dataClone");
237 map<string,TH1F*> mHisto_;
238 mHisto_.clear();
239 mHisto_["Data"] = data;
240 mHisto_["QCD"] = (useInv ? (TH1F*)hQCD_NEW[i]->Clone() : (TH1F*)hMC_[0][i]->Clone());
241 mHisto_["WJets"] = (TH1F*)hMC_[1][i]->Clone();//WJets
242 if (procTTbar > 0.) mHisto_["TTbar"] = (TH1F*)hMC_[2][i]->Clone();//TTbar
243 if (procZJets > 0.) mHisto_["ZJets"] = (TH1F*)hMC_[3][i]->Clone();//ZJets
244 if (procSTtch > 0.) mHisto_["STtch"] = (TH1F*)hMC_[4][i]->Clone();//STtch
245
246 //data -> Scale(1./data->Integral());
247 vector<testMC> resultsKS = doKStest(vNev_,mHisto_);
248 testMC tksmax = getMax(resultsKS);
249 maxProb[i] = tksmax;
250 outprint << "\nFor the plot " << histoLabelX[i] << " the results are:"<< endl;
251 outprint << "\tmax Probability = " << maxProb[i].prob << endl;
252 outprint << "\tproc_background = " << maxProb[i].scaleF_backg << endl;
253 outprint << "\tproc_sample = " << maxProb[i].scaleF_sample << endl;
254
255 outprint << "\n\tpercent_B of Data = "
256 << maxProb[i].scaleF_backg*corr_NevQCD_NEW*100/NevData << endl;
257 outprint << "\tpercent_S of Data = "
258 << maxProb[i].scaleF_sample*corr_NevWJets*100/NevData << endl;
259 outprint << "---------------------------" << endl;
260
261 //create the mixed samples with KS test results
262 sumSFbackg += maxProb[i].prob*maxProb[i].scaleF_backg;
263 sumSFsample += maxProb[i].prob*maxProb[i].scaleF_sample;
264 allKS += maxProb[i].prob;
265
266 //fill a histogram with the results from the KS test for each variable
267 for (unsigned int jiter = 0; jiter < resultsKS.size(); jiter++) {
268 if (resultsKS.at(jiter).prob == 1.)
269 cout << "variable [" << i << "]: prob[" << jiter << "]= " << resultsKS.at(jiter).prob << endl;
270 hKSvalues_[i]->SetBinContent(jiter,resultsKS.at(jiter).prob);
271 }
272 delete data;
273 }
274
275 //calculate the final scale factors
276 SFbackg = sumSFbackg/allKS;
277 SFsample = sumSFsample/allKS;
278 outprint << "allKS = " << allKS << "\tbackground = " << SFbackg << "\tsample = " << SFsample << endl;
279 outprint << "==> Scale Factor for QCD MC = " << SFbackg*corr_NevQCD_NEW/corr_NevQCD << endl;
280 outprint << "\tcombined percent_B of Data = "
281 << SFbackg*corr_NevQCD_NEW*100/NevData << endl;
282 outprint << "\tcombined percent_S of Data = "
283 << SFsample*corr_NevWJets*100/NevData << endl;
284 outprint << "\n" << endl;
285 outprint << "=================================" << endl;
286 outprint << "\n" << endl;
287
288
289 //=================================
290 // Plots
291 //=================================
292 for (int i = 0; i < 3; i++) {// 3 variables
293 hKSres_[i] -> Add((TH1F*)hQCD_NEW[i]->Clone(),(TH1F*)hMC_[1][i]->Clone(),SFbackg,SFsample);
294 hKSres_[i] -> Add((TH1F*)hMC_[2][i]->Clone(),procTTbar);
295 hKSres_[i] -> Add((TH1F*)hMC_[3][i]->Clone(),procZJets);
296 hKSres_[i] -> Add((TH1F*)hMC_[4][i]->Clone(),procSTtch);
297
298 outprint << "hKSres->Integral() = " << hKSres_[i]->Integral() << endl;
299 outprint << "Data->Integral() = " << hData_[i]->Integral() << endl;
300
301 hData_[i]->Rebin(2);
302 hQCD_NEW[i]->Rebin(2);
303 hMC_[0][i]->Rebin(2);
304 hMC_[1][i]->Rebin(2);
305 hKSres_[i]->Rebin(2);
306 //hKSvalues_[i]->Rebin(2);
307
308 // Stack Wjets and QCD after scaled by KS factors
309 hQCD_KS[i] = (TH1F*) hQCD_NEW[i]->Clone();
310 hQCD_KS[i]->Scale(SFbackg);
311 hQCD_KS[i]->SetLineColor(style.QCDColor);
312 hQCD_KS[i]->SetFillColor(style.QCDColor);
313 hQCD_KS[i]->SetFillStyle(style.QCDFill);
314
315 hWJets_KS[i] = (TH1F*) hMC_[1][i]->Clone();
316 hWJets_KS[i]->Scale(SFsample);
317 hWJets_KS[i]->SetLineColor(style.WJetsColor);
318 hWJets_KS[i]->SetFillColor(style.WJetsColor);
319 hWJets_KS[i]->SetFillStyle(style.WJetsFill);
320
321 if (procTTbar > 0.) {
322 hMC_[2][i]->Rebin(2);
323 hMC_[2][i]->SetLineColor(style.TtbarColor);
324 hMC_[2][i]->SetFillColor(style.TtbarColor);
325 hMC_[2][i]->SetFillStyle(style.TtbarFill);
326 }
327 if (procZJets > 0.) {
328 hMC_[3][i]->Rebin(2);
329 hMC_[3][i]->SetLineColor(style.DYZJetsColor);
330 hMC_[3][i]->SetFillColor(style.DYZJetsColor);
331 hMC_[3][i]->SetFillStyle(style.DYZJetsFill);
332 }
333 if (procSTtch > 0.) {
334 hMC_[4][i]->Rebin(2);
335 hMC_[4][i]->SetLineColor(style.ST_t_sColor);
336 hMC_[4][i]->SetFillColor(style.ST_t_sColor);
337 hMC_[4][i]->SetFillStyle(style.ST_t_sFill);
338 }
339 THStack *hst = new THStack(invName,invName);
340 hst->Add((TH1F*)hQCD_KS[i]->Clone());
341 if (procSTtch > 0) hst->Add((TH1F*)hMC_[4][i]->Clone());
342 if (procZJets > 0) hst->Add((TH1F*)hMC_[3][i]->Clone());
343 hst->Add((TH1F*)hWJets_KS[i]->Clone());
344 if (procTTbar > 0) hst->Add((TH1F*)hMC_[2][i]->Clone());
345
346 // Set plotting parameters
347 hData_[i] ->SetLineColor(1);
348 hQCD_NEW[i] ->SetLineColor(2);
349 hMC_[0][i] ->SetLineColor(4);
350 hMC_[1][i] ->SetLineColor(3);
351 hKSres_[i] ->SetLineColor(2);
352 hKSvalues_[i]->SetLineColor(i+1);
353
354 hData_[i] ->SetMarkerColor(1);
355 hQCD_NEW[i] ->SetMarkerColor(2);
356 hMC_[0][i] ->SetMarkerColor(4);
357 hMC_[1][i] ->SetMarkerColor(3);
358 hKSres_[i] ->SetMarkerColor(2);
359 hKSvalues_[i]->SetMarkerColor(i+1);
360
361 hData_[i] ->SetMarkerStyle(24);
362 hQCD_NEW[i] ->SetMarkerStyle(20);
363 hMC_[0][i] ->SetMarkerStyle(20);
364 hMC_[1][i] ->SetMarkerStyle(20);
365 hKSres_[i] ->SetMarkerStyle(20);
366 hKSvalues_[i]->SetMarkerStyle(20);
367
368 hData_[i] ->SetMarkerSize(1.4);
369 hQCD_NEW[i] ->SetMarkerSize(1.1);
370 hMC_[0][i] ->SetMarkerSize(1.1);
371 hMC_[1][i] ->SetMarkerSize(1.1);
372 hKSres_[i] ->SetMarkerSize(0.9);
373 hKSvalues_[i]->SetMarkerSize(1.1);
374
375 hData_[i] ->SetStats(0);
376 hQCD_NEW[i] ->SetStats(0);
377 hMC_[0][i] ->SetStats(0);
378 hMC_[1][i] ->SetStats(0);
379 hKSres_[i] ->SetStats(0);
380 hKSvalues_[i]->SetStats(0);
381 hQCD_KS[i] ->SetStats(0);
382 hWJets_KS[i] ->SetStats(0);
383
384 hKSres_[i]->GetXaxis()->SetTitle(histoLabelX[i].c_str());
385 hKSres_[i]->GetYaxis()->SetTitle("Entries");
386 hKSvalues_[i]->GetXaxis()->SetTitle("iteration #");
387 hKSvalues_[i]->GetYaxis()->SetTitle("KS test values");
388 hMC_[0][i]->GetXaxis()->SetTitle(histoLabelX[i].c_str());
389 hMC_[0][i]->GetYaxis()->SetTitle("A.U.");
390
391
392 TString nameCanvas1 = desDir+histoName[i]+"_QCD_"+suffix+".pdf";
393 TString cvsName1 = histoName[i]+"_QCD";
394 if(useInv) cvsName1 = cvsName1 + "_" + invName;
395 cvs[cvsName1] = new TCanvas(cvsName1,"",600,700);
396 hQCD_NEW[i] -> Scale(1./hQCD_NEW[i]->Integral());
397 hMC_[0][i] -> Scale(1./hMC_[0][i]->Integral());
398 hMC_[1][i] -> Scale(1./hMC_[1][i]->Integral());
399 outprint << "For " << histoName[i] << " , the KStest result btw MC_QCD/InvSel is = "
400 << hMC_[0][i] -> KolmogorovTest(hQCD_NEW[i],"") << endl;
401 hMC_[0][i]->DrawCopy("P");
402 if (useInv)
403 hQCD_NEW[i]->DrawCopy("sameP");
404 hMC_[1][i]->DrawCopy("sameP");
405 TLegend *legend1 = new TLegend(0.7, 0.65, 0.9, 0.85);
406 legend1->AddEntry(hMC_[0][i], "QCD");
407 if (useInv)
408 legend1->AddEntry(hQCD_NEW[i], "QCD - InvSel");
409 legend1->AddEntry(hMC_[1][i], style.WJetsText);
410 legend1->Draw();
411 legend1->SetFillColor(kWhite);
412 //latex->DrawLatex(0.22,0.91,histoName[i].c_str());
413 //cvs[cvsName1]->SetLogy();
414 cvs[cvsName1]->SaveAs(nameCanvas1);
415
416
417 TString nameCanvas2 = desDir+histoName[i]+"_dataKS_"+suffix+".pdf";
418 TString cvsName2 = histoName[i]+"_dataKS";
419 if(useInv) cvsName2 = cvsName2 + "_" + invName;
420 cvs[cvsName2] = new TCanvas(cvsName2,"",600,700);
421 hst->Draw("hist");
422 hKSres_[i]->Draw("sameP");
423 hData_[i]->Draw("sameP");
424
425 TLegend *legend2 = new TLegend(0.7, 0.65, 0.9, 0.85);
426 legend2->AddEntry(hData_[i], "Data");
427 legend2->AddEntry(hKSres_[i], "KS result");
428 if (procTTbar > 0.) legend2->AddEntry(hMC_[2][i], style.TtbarText);
429 legend2->AddEntry(hWJets_KS[i], style.WJetsText);
430 if (procZJets > 0.) legend2->AddEntry(hMC_[3][i], style.DYZJetsText);
431 if (procSTtch > 0.) legend2->AddEntry(hMC_[4][i], style.ST_t_sText);
432 legend2->AddEntry(hQCD_KS[i], style.QCDText);
433 legend2->Draw();
434 legend2->SetFillColor(kWhite);
435 //latex->DrawLatex(0.22,0.91,histoName[i].c_str());
436 //cvs[cvsName2]->SetLogy();
437 cvs[cvsName2]->SaveAs(nameCanvas2);
438
439 }
440
441 TString cvsName3 = "KStestValues";
442 if(useInv) cvsName3 = cvsName3 + "_" + invName;
443 cvs[cvsName3] = new TCanvas(cvsName3,"",600,700);
444 if (!realData) hKSvalues_[0]->GetXaxis()->SetRangeUser(0.9,1.2);
445 hKSvalues_[0]->GetYaxis()->SetRangeUser(1e-36,1.2);
446 hKSvalues_[0]->Draw();
447 hKSvalues_[1]->Draw("same");
448 hKSvalues_[2]->Draw("same");
449 TLegend *legend3 = new TLegend(0.7, 0.70, 0.9, 0.85);
450 legend3->AddEntry(hKSvalues_[0], "muon_pT");
451 legend3->AddEntry(hKSvalues_[1], "MET");
452 legend3->AddEntry(hKSvalues_[2], "W_mT");
453 legend3->Draw();
454 legend3->SetFillColor(kWhite);
455 //latex->DrawLatex(0.22,0.91,"KS test values");
456 cvs[cvsName3]->SetLogy();
457 TString nameCanvas3 = desDir+"KStestValues_newQCD"+suffix+".pdf";
458 cvs[cvsName3]->SaveAs(nameCanvas3);
459 }
460 }