6{
8 ostringstream strout;
9 strout<<"ddgcalib";
10 TTree *tree = (TTree*)
f->Get(strout.str().c_str());
11 double dedx[100],eangle[100], err[100];
12 tree->SetBranchAddress("gain",dedx);
13 tree->SetBranchAddress("eangle",eangle);
14 tree->SetBranchAddress("fitmeanerr", err);
15 tree->GetEntry(0);
16 double sum=0;
17 for(int i=0;i<100;i++)
18 {
19 sum+=dedx[i];
20 err[i] = err[i]/550;
21 }
22 sum = sum/100;
23 gStyle->SetOptFit(0111);
24 TCanvas *c1 = new TCanvas("c1","c1",10,10,800,642);
25
26 TGraph*
gr =
new TGraphErrors(100,eangle,dedx);
27 gr->SetMarkerColor(2);
30
31
33 tree = (TTree*)
f->Get(strout.str().c_str());
34 double dedx2[100],eangle2[100], err2[100];
35 tree->SetBranchAddress("gain",dedx2);
36 tree->SetBranchAddress("eangle",eangle2);
37 tree->SetBranchAddress("fitmeanerr", err2);
38 tree->GetEntry(0);
39 double sum=0;
40 for(int i=0;i<100;i++)
41 {
42 sum+=dedx[i];
43 err[i] = err[i]/550;
44 }
45 sum = sum/100;
46 TGraph* gr2 = new TGraphErrors(100,eangle2,dedx2);
47 gr2->Draw("*,same");
48
49 TLegend* leg = new TLegend(.65, .75, .89, .89);
50 leg->AddEntry(
gr,
"ori",
"p");
51 leg->AddEntry(gr2,"cor","p");
52 leg->Draw();
53
54 TFile f_save("dEdxVsEang.root","recreate");
55 c1->Write();
56 f_save.Close();
58}
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")