| 242 | | |
| 243 | | |
| | 242 | == Plotting Result == |
| | 243 | |
| | 244 | {{{#!Spoiler |
| | 245 | {{{#!cpp |
| | 246 | #include <fstream> |
| | 247 | #include <TH2.h> |
| | 248 | #include <TF1.h> |
| | 249 | #include <TGraph.h> |
| | 250 | #include <TCanvas.h> |
| | 251 | |
| | 252 | void readsim() |
| | 253 | { |
| | 254 | TH2F h2svse ("H_SvsE", "", 26*3, 2.2, 4.8, 3*30, 1.3, 4.3); |
| | 255 | TH2F h2est ("H_EstVsMC", "", 26*3, 2.2, 4.8, 26*3, 2.2, 4.8); |
| | 256 | TH2F h2bias ("H_BiasLog", "", 26*3, 2.2, 4.8, 100, -1, 1); |
| | 257 | TH2F h2lin ("H_BiasLin", "", 26*3, 2.2, 4.8, 100, -1, 2); |
| | 258 | |
| | 259 | TH2F h2size ("H_ResSize", "", 26*3, 2.2, 4.8, 100, -1, 1); |
| | 260 | TH2F h2dist ("H_ResDist", "", 50, 0, 2.5, 100, -1, 1); |
| | 261 | TH2F h2slope("H_ResSlope", "", 50, -10, 10, 100, -1, 1); |
| | 262 | TH2F h2zd ("H_ResZd", "", 90, 0, 90, 100, -1, 1); |
| | 263 | |
| | 264 | ifstream fin0("sim-test-cuts.csv"); |
| | 265 | ifstream fin1("sim-test-results-cuts.csv"); |
| | 266 | |
| | 267 | TString str; |
| | 268 | str.ReadLine(fin0); |
| | 269 | str.ReadLine(fin1); |
| | 270 | |
| | 271 | while (1) |
| | 272 | { |
| | 273 | if (!fin0 || !fin1) |
| | 274 | break; |
| | 275 | |
| | 276 | double Emc, Size, Zd, Dist, Disp, Slope, M3L, Leakage, Width, Length, Eest; |
| | 277 | fin0 >> Emc >> Size >> Zd >> Dist >> Disp >> Slope >> M3L >> Leakage >> Width >> Length; |
| | 278 | fin1 >> Eest; |
| | 279 | |
| | 280 | h2svse.Fill(Emc, Size); |
| | 281 | h2est.Fill( Emc, Eest); |
| | 282 | h2bias.Fill(Eest, Eest-Emc); |
| | 283 | h2lin.Fill( Eest, (pow(10, Eest)-pow(10, Emc))/pow(10, Emc)); |
| | 284 | |
| | 285 | h2size.Fill( Size, Eest-Emc); |
| | 286 | h2dist.Fill( Dist, Eest-Emc); |
| | 287 | h2slope.Fill(Slope, Eest-Emc); |
| | 288 | h2zd.Fill( Zd, Eest-Emc); |
| | 289 | } |
| | 290 | |
| | 291 | |
| | 292 | TF1 fx("f", "x", -100, 100); |
| | 293 | TF1 f0("f", "0", -100, 100); |
| | 294 | |
| | 295 | TCanvas *canv = new TCanvas("Canvas", "Energy estimation", 800, 900); |
| | 296 | canv->Divide(2,4); |
| | 297 | |
| | 298 | canv->cd(1); |
| | 299 | gPad->SetTopMargin(0.005); |
| | 300 | gPad->SetGridy(); |
| | 301 | h2size.SetStats(kFALSE); |
| | 302 | h2size.SetXTitle("lg(E_{mc}/GeV)"); |
| | 303 | h2size.SetYTitle("lg(E_{est}/GeV)-lg(E_{mc}/GeV)"); |
| | 304 | h2size.DrawCopy("colz"); |
| | 305 | f0.DrawCopy("same"); |
| | 306 | |
| | 307 | canv->cd(3); |
| | 308 | gPad->SetTopMargin(0.005); |
| | 309 | gPad->SetGridy(); |
| | 310 | h2dist.SetStats(kFALSE); |
| | 311 | h2dist.SetXTitle("Dist / degree"); |
| | 312 | h2dist.SetYTitle("lg(E_{est}/GeV)-lg(E_{mc}/GeV)"); |
| | 313 | h2dist.DrawCopy("colz"); |
| | 314 | f0.DrawCopy("same"); |
| | 315 | |
| | 316 | canv->cd(5); |
| | 317 | gPad->SetTopMargin(0.005); |
| | 318 | gPad->SetGridy(); |
| | 319 | h2slope.SetStats(kFALSE); |
| | 320 | h2slope.SetXTitle("Slope / ns/degree"); |
| | 321 | h2slope.SetYTitle("lg(E_{est}/GeV)-lg(E_{mc}/GeV)"); |
| | 322 | h2slope.DrawCopy("colz"); |
| | 323 | f0.DrawCopy("same"); |
| | 324 | |
| | 325 | canv->cd(7); |
| | 326 | gPad->SetTopMargin(0.005); |
| | 327 | gPad->SetGridy(); |
| | 328 | h2zd.SetStats(kFALSE); |
| | 329 | h2zd.SetXTitle("Zenith Distance / degree"); |
| | 330 | h2zd.SetYTitle("lg(E_{est}/GeV)-lg(E_{mc}/GeV)"); |
| | 331 | h2zd.DrawCopy("colz"); |
| | 332 | f0.DrawCopy("same"); |
| | 333 | |
| | 334 | canv->cd(2); |
| | 335 | gPad->SetTopMargin(0.005); |
| | 336 | gPad->SetGridy(); |
| | 337 | h2svse.SetStats(kFALSE); |
| | 338 | h2svse.SetXTitle("lg(Size)"); |
| | 339 | h2svse.SetYTitle("lg(E_{mc}/GeV)"); |
| | 340 | h2svse.DrawCopy("colz"); |
| | 341 | fx.DrawCopy("same"); |
| | 342 | |
| | 343 | canv->cd(4); |
| | 344 | gPad->SetTopMargin(0.005); |
| | 345 | gPad->SetGridy(); |
| | 346 | h2est.SetStats(kFALSE); |
| | 347 | h2est.SetXTitle("lg(E_{mc})"); |
| | 348 | h2est.SetYTitle("lg(E_{est}/GeV)"); |
| | 349 | h2est.DrawCopy("colz"); |
| | 350 | fx.DrawCopy("same"); |
| | 351 | |
| | 352 | canv->cd(6); |
| | 353 | gPad->SetTopMargin(0.005); |
| | 354 | gPad->SetGridy(); |
| | 355 | h2bias.SetStats(kFALSE); |
| | 356 | h2bias.SetXTitle("lg(E_{est}/GeV)"); |
| | 357 | h2bias.SetYTitle("lg(E_{est}/GeV)-lg(E_{mc}/GeV)"); |
| | 358 | h2bias.DrawCopy("colz"); |
| | 359 | f0.DrawCopy("same"); |
| | 360 | |
| | 361 | |
| | 362 | canv->cd(8); |
| | 363 | gPad->SetTopMargin(0.005); |
| | 364 | gPad->SetGridy(); |
| | 365 | |
| | 366 | TGraph grlin; |
| | 367 | TGraph grlog; |
| | 368 | |
| | 369 | for (int x=1; x<h2bias.GetNbinsX(); x++) |
| | 370 | { |
| | 371 | TH1D *p = h2bias.ProjectionY("_py", x, x); |
| | 372 | if (p->GetRMS()>0) |
| | 373 | grlog.SetPoint(grlog.GetN(), h2bias.GetXaxis()->GetBinCenter(x), pow(10, p->GetRMS())-1); |
| | 374 | delete p; |
| | 375 | |
| | 376 | p = h2lin.ProjectionY("_py", x, x); |
| | 377 | if (p->GetRMS()>0) |
| | 378 | grlin.SetPoint(grlin.GetN(), h2lin.GetXaxis()->GetBinCenter(x), p->GetRMS()); |
| | 379 | delete p; |
| | 380 | } |
| | 381 | |
| | 382 | grlog.SetMarkerColor(kBlue); |
| | 383 | grlin.SetMinimum(0); |
| | 384 | grlin.GetHistogram()->SetXTitle("log(E_{est}/GeV)"); |
| | 385 | grlin.GetHistogram()->SetYTitle("RMS"); |
| | 386 | grlin.DrawClone("A*"); |
| | 387 | grlog.DrawClone("*"); |
| | 388 | } |
| | 389 | }}} |
| | 390 | }}} |
| | 391 | |
| | 392 | |