BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
Eangle1D/Fit.cxx
Go to the documentation of this file.
1//This code is to fit graph gain vs eangle and get the slope
2
3void Fit()
4{
5 TFile *f=new TFile("eangle.root");
6 ostringstream strout;
7 strout<<"ddgcalib";
8 TTree *tree = f->Get(strout.str().c_str());
9 double dedx[100],eangle[100], fitmean[100], fitmeanerr[100];
10 tree->SetBranchAddress("gain",dedx);
11 tree->SetBranchAddress("eangle",eangle);
12 // tree->SetBranchAddress("fitmean",fitmean);
13 // tree->SetBranchAddress("fitmeanerr",fitmeanerr);
14 tree->SetBranchAddress("mean",fitmean);
15 tree->SetBranchAddress("sigma",fitmeanerr);
16
17 cout<<"Entries: "<<tree->GetEntries()<<endl;
18 tree->GetEntry(0);
19
20 double sum=0;
21 for(int i=0;i<100;i++)
22 {
23 sum+=dedx[i];
24 }
25 sum = sum/100;
26
27 gStyle->SetOptFit(0111);
28
29 TGraphErrors* gr = new TGraphErrors(100,eangle,fitmean,0,fitmeanerr);
30
31 gr->Draw("A*");
32 gr->Fit("pol1","r");
33}
TGraph * gr
void Fit()
Definition: Eangle1D/Fit.cxx:3
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")