1 #if !defined(__CINT__) || defined(__MAKECINT__) 15 #include <TDirectoryFile.h> 32 #include <TGraphErrors.h> 46 TString quantity =
"SMM02NoCut",
47 TString titleData =
"LHC11cd_EMC7",
53 const Int_t nparam = 10;
54 Double_t pbins[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
61 Float_t eBinsL[] = { 7.5, 9.5,11.5,13.5,15.5,17.5,19.5};
62 Float_t eBinsH[] = {17.5,19.5,24.5,29.5,34.5,39.5,49.5};
66 Int_t colorL[] = {1,4,2,6,8,9,kYellow-6,kCyan,kOrange+2,kViolet,kOrange-2};
67 Int_t colorH[] = {9,kOrange+2,kViolet,kOrange-2,kRed-3,kRed+3,kBlue-3,kBlue+3};
69 TFile* fileL = TFile::Open(Form(
"figures/%s/Chi2Distributions_%s_JJDecLow%s_PerSM_Ebin.root",
70 quantity.Data(),titleData.Data(),
opt.Data()));
71 TFile* fileH = TFile::Open(Form(
"figures/%s/Chi2Distributions_%s_JJDecHigh%s_PerSM_Ebin.root",
72 quantity.Data(),titleData.Data(),
opt.Data()));
74 printf(
"File JJ Low %p %s\n",fileL,fileL->GetName());
75 printf(
"File JJ High %p %s\n",fileH,fileH->GetName());
82 for(
Int_t ipbin = 0; ipbin < nparam; ipbin++)
84 gChi2LMin[ipbin] = (
TGraphErrors*) fileL->Get(Form(
"Chi2Min_SM%d",ipbin));
85 if( gChi2LMin[ipbin] )
87 gChi2LMin[ipbin]->SetMarkerStyle(20);
88 gChi2LMin[ipbin]->SetMarkerColor(4);
89 gChi2LMin[ipbin]->SetLineColor (4);
92 gChi2HMin[ipbin] = (
TGraphErrors*) fileH->Get(Form(
"Chi2Min_SM%d",ipbin));
93 if( gChi2HMin[ipbin] )
95 gChi2HMin[ipbin]->SetMarkerStyle(24);
96 gChi2HMin[ipbin]->SetMarkerColor(4);
97 gChi2HMin[ipbin]->SetLineColor (4);
103 gChi2L[iebin][ipbin] = (
TGraphErrors*) fileL->Get(Form(
"Chi2_SM%d_EBin%d",ipbin,iebin));
104 if(gChi2L[iebin][ipbin])
106 gChi2L[iebin][ipbin]->SetMarkerStyle(20);
107 gChi2L[iebin][ipbin]->SetMarkerSize(4);
108 gChi2L[iebin][ipbin]->SetMarkerColor(colorL[iebin]);
109 gChi2L[iebin][ipbin]->SetLineColor(colorL[iebin]);
112 gChi2H[iebin][ipbin] = (
TGraphErrors*)fileH->Get(Form(
"Chi2_SM%d_EBin%d",ipbin,iebin));
113 if(gChi2H[iebin][ipbin])
115 gChi2H[iebin][ipbin]->SetMarkerStyle(24);
116 gChi2H[iebin][ipbin]->SetMarkerSize(4);
117 gChi2H[iebin][ipbin]->SetMarkerColor(colorH[iebin]);
118 gChi2H[iebin][ipbin]->SetLineColor(colorH[iebin]);
125 TCanvas * gChi2graph =
new TCanvas(Form(
"cChi2_graph_%s",quantity.Data()),
126 Form(
"Chi2, %s",quantity.Data()),
127 ncol*1000,nrow*1000);
128 gChi2graph->Divide(ncol,nrow);
130 TLegend *lgchi2 =
new TLegend(0,0,1,1);
131 lgchi2->SetFillColor(0);
132 lgchi2->SetFillStyle(0);
133 lgchi2->SetLineColor(0);
134 lgchi2->SetBorderSize(0);
135 lgchi2->SetTextSize(0.07);
137 for(
Int_t ipbin = 0; ipbin < nparam; ipbin++)
139 gChi2graph->cd(ipbin+1);
147 for(
Int_t iebin = 0; iebin < 5; iebin++)
149 if(!gChi2L[iebin][ipbin])
continue;
151 gChi2L[iebin][ipbin]->GetHistogram()->SetTitleOffset(1.5,
"Y");
159 gChi2L[iebin][ipbin]->Draw(
"APL");
162 gChi2L[iebin][ipbin]->Draw(
"PL");
169 lgchi2->AddEntry(gChi2L[iebin][ipbin],
170 gChi2L[iebin][ipbin]->GetTitle(),
173 if(quantity.Contains(
"SM")) gChi2L[iebin][ipbin]->SetTitle(Form(
"SM %d",ipbin));
178 for(
Int_t iebin = 0; iebin < 2; iebin++)
180 if(!gChi2H[iebin][ipbin])
continue;
182 gChi2H[iebin][ipbin]->Draw(
"PL");
186 lgchi2->AddEntry(gChi2H[iebin][ipbin],
187 gChi2H[iebin][ipbin]->GetTitle(),
194 gChi2graph->cd(ncol*nrow-1);
197 gChi2graph->cd(ncol*nrow);
198 TLegend *legend2 =
new TLegend(0.,0.,0.9,0.9);
199 legend2->SetFillColor(0);
200 legend2->SetFillStyle(0);
201 legend2->SetLineColor(0);
202 legend2->SetBorderSize(0);
203 legend2->SetTextSize(0.07);
204 legend2->SetHeader(
"#chi^{2}/#nu of Data-MC");
205 legend2->AddEntry(
"",
"Data: LHC11c+d, EMC7",
"");
206 legend2->AddEntry(
"",
"MC:",
"");
207 legend2->AddEntry(gChi2L[0][0],
"#gammaJ+JJ #it{p}^{#gamma,EMC}_{T}>3.5 GeV/#it{c}",
"PL");
208 legend2->AddEntry(gChi2H[0][0],
"#gammaJ+JJ #it{p}^{#gamma,EMC}_{T}>7 GeV/#it{c}",
"PL");
212 TString fileName = Form(
"figures/%s/Comparison_Chi2_%s_JJDecLowHigh%s_PerSM_Ebin",
213 quantity.Data(),titleData.Data(),
opt.Data());
215 gChi2graph->Print(fileName);
217 gStyle->SetOptStat(0);
218 gStyle->SetOptTitle(1);
219 gStyle->SetPadTopMargin(0.01);
220 gStyle->SetPadRightMargin(0.01);
222 TCanvas * gChi2Mingraph =
new TCanvas(Form(
"cChi2Min_graph_%s",
227 gChi2Mingraph->Divide(ncol,nrow);
229 for(
Int_t ipbin = 0; ipbin < nparam; ipbin++)
231 gChi2Mingraph->cd(ipbin+1);
233 if(!gChi2LMin[ipbin])
continue;
240 TH1F* haxis=
new TH1F(Form(
"haxis%d",ipbin),Form(
"SM %d",ipbin),30,0.5,45.5);
241 haxis->SetYTitle(gChi2LMin[ipbin]->GetHistogram()->GetYaxis()->GetTitle());
242 haxis->SetXTitle(gChi2LMin[ipbin]->GetHistogram()->GetXaxis()->GetTitle());
243 haxis->SetTitle(Form(
"SM %d",ipbin));
244 haxis->SetMaximum(1.8);
245 haxis->SetMinimum(0.0);
253 gChi2LMin[ipbin]->Draw(
"PL");
254 gChi2HMin[ipbin]->Draw(
"PL");
258 TLegend *lgChi2Min = 0;
259 if(ipbin==3 ||ipbin==7) lgChi2Min=
new TLegend(0.15,0.20,0.98,0.43);
260 else lgChi2Min=
new TLegend(0.15,0.75,0.98,0.98);
261 lgChi2Min->SetFillColor(0);
262 lgChi2Min->SetFillStyle(0);
263 lgChi2Min->SetLineColor(0);
264 lgChi2Min->SetBorderSize(0);
265 lgChi2Min->SetTextSize(0.06);
266 lgChi2Min->SetHeader(Form(
"SM %d",ipbin));
272 gChi2HMin[ipbin]->Fit(
"pol0",
"QR",
"",16,30);
273 TF1* fun0 = gChi2HMin[ipbin]->GetFunction(
"pol0");
274 Float_t par0 = fun0->GetParameter(0);
275 printf(
"sm %d parameter0 %2.2f\n",ipbin,par0);
277 TF1* fun1 =
new TF1(
"plin1",
"[0]-x*[1]",2.5,16.);
278 fun1->SetParameters(par0,-1.1);
279 fun1->SetParLimits(0,par0*0.001,par0*5.1);
280 fun1->SetParLimits(1,0.07,0.1);
281 gChi2LMin[ipbin]->Fit(
"plin1",
"",
"",7.5,16.);
282 fun1->SetRange(0.5,16.0);
287 if(ipbin == 3 || ipbin == 7)
289 TF1* fun1 =
new TF1(
"plin1",
"2.2-x*0.09",0.5,16.);
290 TF1* fun0 =
new TF1(
"plin0",
"0.8",16,45);
293 fun0->SetLineColor(kViolet);
294 lgChi2Min->AddEntry(fun0,
"0.8%",
"L");
295 lgChi2Min->AddEntry(fun1,
"2.2% - #it{E}_{cluster} #times 0.09%",
"L");
298 else if(ipbin == 1 || ipbin == 2)
300 TF1* fun1 =
new TF1(
"plin1",
"1.5-x*0.08",0.5,13.);
301 TF1* fun0 =
new TF1(
"plin0",
"0.5",13,45);
304 fun0->SetLineColor(kViolet);
305 lgChi2Min->AddEntry(fun0,
"0.5%",
"L");
306 lgChi2Min->AddEntry(fun1,
"1.5% - #it{E}_{cluster} #times 0.08%",
"L");
310 TF1* fun1 =
new TF1(
"plin1",
"1.1-x*0.08",0.5,9);
311 TF1* fun0 =
new TF1(
"plin0",
"0.4",9,45);
314 fun0->SetLineColor(kViolet);
315 lgChi2Min->AddEntry(fun0,
"0.4%",
"L");
316 lgChi2Min->AddEntry(fun1,
"1.1% - #it{E}_{cluster} #times 0.08%",
"L");
323 gChi2Mingraph->cd(ncol*nrow);
325 TLegend *legend =
new TLegend(0.,0.,0.9,0.9);
326 legend->SetFillColor(0);
327 legend->SetFillStyle(0);
328 legend->SetLineColor(0);
329 legend->SetBorderSize(0);
330 legend->SetTextSize(0.07);
331 legend->SetHeader(
"Min of #chi^{2}/#nu of Data-MC");
332 legend->AddEntry(
"",
"Data: LHC11c+d, EMC7",
"");
333 legend->AddEntry(
"",
"MC:",
"");
334 legend->AddEntry(gChi2LMin[0],
"#gammaJ+JJ #it{p}^{#gamma,EMC}_{T}>3.5 GeV/#it{c}",
"PL");
335 legend->AddEntry(gChi2HMin[0],
"#gammaJ+JJ #it{p}^{#gamma,EMC}_{T}>7 GeV/#it{c}",
"PL");
339 fileName = Form(
"figures/%s/Comparison_Chi2Min_%s_JJDecLowHigh%s_PerSM_Ebin",
340 quantity.Data(),titleData.Data(),
opt.Data());
342 gChi2Mingraph->Print(fileName);
void AddChi2JJDecLowHighGraphs(TString quantity="SMM02NoCut", TString titleData="LHC11cd_EMC7", TString opt="", TString fileFormat=".eps")