File indexing completed on 2025-10-20 08:07:00
0001
0002
0003 #include "TCanvas.h"
0004 #include "TFile.h"
0005 #include "TH1D.h"
0006 #include "THStack.h"
0007 #include "TLegend.h"
0008 #include "TString.h"
0009
0010 TCanvas* cmpL()
0011 {
0012
0013 TString dataDir("./");
0014
0015 TString dataFile[2];
0016 dataFile[0] = "gflash00.root";
0017 dataFile[1] = "gflash01.root";
0018
0019 TFile* f[2];
0020 TProfile* p[2];
0021
0022 UInt_t col[] = {kRed, kGreen, kBlue, kViolet};
0023
0024 UInt_t mark[] = {20, 21, 32, 22};
0025
0026 THStack* hs = new THStack("hs", "");
0027
0028 for (UInt_t i = 0; i < 2; i++) {
0029 TString tmp = dataDir + dataFile[i];
0030 f[i] = TFile::Open(tmp);
0031 if (!f[i]) return 0;
0032 p[i] = (TProfile*)(f[i])->Get("p0");
0033
0034
0035 p[i]->SetFillColor(col[i]);
0036 p[i]->SetLineStyle(i + 2);
0037 p[i]->SetLineColor(col[i]);
0038 p[i]->SetLineWidth(2);
0039 p[i]->SetMarkerStyle(mark[i]);
0040 p[i]->SetMarkerColor(col[i]);
0041 p[i]->SetMarkerSize(1.5);
0042 hs->Add(p[i]);
0043 }
0044 TCanvas* cst = new TCanvas("cst", "stacked hists", 10, 10, 800, 700);
0045
0046 hs->Draw("p,nostack");
0047 hs->SetTitle("Longitudinal Profile");
0048 hs->GetXaxis()->SetTitle("Depth (RadLen)");
0049 hs->GetYaxis()->SetTitle("E/E_{tot} (%) / RadLen");
0050
0051 cst->RedrawAxis();
0052 cst->Update();
0053
0054 TLegend* legend = new TLegend(0.79, 0.84, 0.94, 0.94);
0055 legend->AddEntry(p[0], "full ", "p");
0056 legend->AddEntry(p[1], "gflash", "p");
0057 legend->Draw();
0058 cst->Update();
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071 return cst;
0072 }