BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
dEdxVsEang.cxx File Reference

Go to the source code of this file.

Functions

void dEdxVsEang ()
 

Variables

TString old_file = "../../Eangle1DSec/eangle.root"
 
TString new_file = "eangle.root"
 

Function Documentation

◆ dEdxVsEang()

void dEdxVsEang ( )

Definition at line 5 of file dEdxVsEang.cxx.

6{
7 TFile *f=new TFile(old_file);
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 // TGraphErrors* gr = new TGraphErrors(100,eangle,dedx,eangle,err);
26 TGraph* gr = new TGraphErrors(100,eangle,dedx);
27 gr->SetMarkerColor(2);
28 gr->SetLineColor(2);
29 gr->Draw("A*");
30
31 // graph of check
32 f=new TFile(new_file);
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();
57 f->Close();
58}
TString new_file
Definition: dEdxVsEang.cxx:3
TString old_file
Definition: dEdxVsEang.cxx:2
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")

Variable Documentation

◆ new_file

TString new_file = "eangle.root"

Definition at line 3 of file dEdxVsEang.cxx.

Referenced by dEdxVsEang().

◆ old_file

TString old_file = "../../Eangle1DSec/eangle.root"

Definition at line 2 of file dEdxVsEang.cxx.

Referenced by dEdxVsEang().