2{
3 TFile *
f=
new TFile(
"../../Eangle1DSec/eangle.root");
4 ostringstream strout;
5 strout<<"ddgcalib";
6 TTree *tree =
f->Get(strout.str().c_str());
7 double dedx[100],eangle[100];
8 tree->SetBranchAddress("truncgain",dedx);
9 tree->SetBranchAddress("eangle",eangle);
10 tree->GetEntry(0);
11
12 TFile *f_new=new TFile("eangle.root");
13 TTree *tree_new = f_new->Get(strout.str().c_str());
14 double dedx_new[100],eangle_new[100];
15 tree_new->SetBranchAddress("truncgain",dedx_new);
16 tree_new->SetBranchAddress("eangle",eangle_new);
17 tree_new->GetEntry(0);
18
19 double step = 0.5/100;
21 for(int i=0; i<100; i++) x[i] = -0.25 + i*step;
22 TGraph *g_old = new TGraph(100, x, dedx);
23 g_old->SetMarkerColor(2);
24 g_old->SetLineColor(2);
25 g_old->SetMarkerSize(1.0);
26 g_old->SetMarkerStyle(20);
27 TGraph *g_new = new TGraph(100, x, dedx_new);
28 g_new->SetMarkerColor(4);
29 g_new->SetLineColor(4);
30 g_new->SetMarkerSize(1.0);
31 g_new->SetMarkerStyle(20);
32 TCanvas *c1 = new TCanvas("c1","dE/dx vs entra-angle", 10,10,800,642);
33 g_old->Draw("ap");
34 g_new->Draw("p,same");
35 TLegend *l_old = new TLegend(.65, .35, .89, .50);
36 l_old->AddEntry(g_old, "old", "pl");
37 TLegend *l_new = new TLegend(.65, .20, .89, .35);
38 l_new->AddEntry(g_new, "new", "pl");
39 l_old->Draw();
40 l_new->Draw();
41 c1->SaveAs("figs/eangle_slope.eps");
42}
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")