6 TFile *
f=
new TFile(
"wiregain.root");
26 wiregcalib->GetEntry(0);
29 gStyle->SetOptFit(1111);
33 TFile* g =
new TFile(
"wiregain_new.root",
"RECREATE");
34 TCanvas c1(
"c1",
"canvas", 800, 642);
35 c1.Print(
"wiregain_new.root.ps[");
39 strout<<
"dEdx_Wire_"<<i;
40 h=(TH1F*)
f->Get(strout.str().c_str());
41 if(h->Integral()>100 && (chisq[i]>2 || chisq[i]<0.5)){
42 cout<<
"Fit hisogram "<<strout.str().c_str()<<endl;
43 if(h->Integral((
int)(fitmean[i]-1.0*fitsigma[i]-h->GetBinLowEdge(1))/h->GetBinWidth(1),(int)(fitmean[i]+1.0*fitsigma[i]-h->GetBinLowEdge(1))/h->GetBinWidth(1))>100) h->Fit(
"gaus",
"rq",
"",fitmean[i]-1.0*(fitsigma[i]),fitmean[i]+1.0*(fitsigma[i]));
44 chisq[i] = h->GetFunction(
"gaus")->GetChisquare()/(h->GetFunction(
"gaus")->GetNDF());
46 fitmean[i] = h->GetBinCenter(h->GetMaximumBin());
50 fitmean[i] = h->GetFunction(
"gaus")->GetParameter(1);
51 fitsigma[i] = h->GetFunction(
"gaus")->GetParameter(2);
53 wireg[i] = fitmean[i]/
m_norm;
56 c1.Print(
"wiregain_new.root.ps");
60 c1.Print(
"wiregain_new.root.ps]");
62 TTree* wiregain =
new TTree(
"wiregcalib",
"wiregcalib");
63 wiregain ->
Branch(
"wireg", wireg,
"wireg[6796]/D");
64 wiregain ->
Branch(
"mean", mean,
"mean[6796]/D");
65 wiregain ->
Branch(
"sigma",
sigma,
"sigma[6796]/D");
66 wiregain ->
Branch(
"chisq", chisq,
"chisq[6796]/D");
67 wiregain ->
Branch(
"entryNo", entryNo,
"entryNo[6796]/D");
68 wiregain ->
Branch(
"wire", wire,
"wire[6796]/D");
69 wiregain ->
Branch(
"fitmean", fitmean,
"fitmean[6796]/D");
70 wiregain ->
Branch(
"fitsigma", fitsigma,
"fitsigma[6796]/D");
77 TFile *
f1 =
new TFile(
"wiregain.root");
78 TTree *t1 = (TTree*)
f1->Get(
"wiregcalib");
79 TFile *f2 =
new TFile(
"wiregain_new.root");
80 TTree *t2 = (TTree*)f2->Get(
"wiregcalib");
81 Double_t
x[6796], g_old[6796], g_new[6796],
y[6796];
82 t1->SetBranchAddress(
"wire",
x);
83 t1->SetBranchAddress(
"wireg", g_old);
85 t2->SetBranchAddress(
"wireg", g_new);
89 for(
int i=0; i<6796; i++){
91 y[i] = g_new[i]/g_old[i];
92 if(i<600) { m_add + =
y[i]; m_count ++; }
96 cout <<
"i " << i <<
" wireg " << g_old[i] << endl;
99 cout <<
"ave diff before 600 wire: " << m_add/m_count << endl;
101 TGraph *gra =
new TGraph(6796,
x,
y);
102 gra->SetTitle(
"ratio of wireg_new/wireg_old");
103 TCanvas *c2 =
new TCanvas(
"wiregain",
"ratio of wireg_new/wireg_old", 10,10,800,642);
105 c2->SaveAs(
"compare_fit.eps");
curve Branch("CurveSize",&CurveSize,"CurveSize/I")
data SetBranchAddress("time",&time)
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")