void ErgResn() { TCanvas *c1(new TCanvas()); ofstream fout("ErgResn.txt"); Double_t p[15],q[15]; int e[16]={1,2,3,4,6,10,20,30,40,60,100,200,300,400,600,1000}; for(unsigned i(0);i<16;i++) { if(i== 0) TFile::Open("SimAnalysisLayerTracks900066.root"); if(i== 1) TFile::Open("SimAnalysisLayerTracks900067.root"); if(i== 2) TFile::Open("SimAnalysisLayerTracks900068.root"); if(i== 3) TFile::Open("SimAnalysisLayerTracks900069.root"); if(i== 4) TFile::Open("SimAnalysisLayerTracks900070.root"); if(i== 5) TFile::Open("SimAnalysisLayerTracks900071.root"); if(i== 6) TFile::Open("SimAnalysisLayerTracks900057.root"); if(i== 7) TFile::Open("SimAnalysisLayerTracks900054.root"); if(i== 8) TFile::Open("SimAnalysisLayerTracks900051.root"); if(i== 9) TFile::Open("SimAnalysisLayerTracks900048.root"); if(i==10) TFile::Open("SimAnalysisLayerTracks900045.root"); if(i==11) TFile::Open("SimAnalysisLayerTracks900046.root"); if(i==12) TFile::Open("SimAnalysisLayerTracks900049.root"); if(i==13) TFile::Open("SimAnalysisLayerTracks900052.root"); if(i==14) TFile::Open("SimAnalysisLayerTracks900055.root"); if(i==15) TFile::Open("SimAnalysisLayerTracks900058.root"); TH1F *hD(DNaiveEnergy); hD->Fit("gaus","",""); hD->GetFunction("gaus")->GetParameters(p); hD->Fit("gaus","","",p[1]-1.5*p[2],p[1]+2.5*p[2]); hD->GetFunction("gaus")->GetParameters(p); q[0]=hD->GetFunction("gaus")->GetParError(0); q[1]=hD->GetFunction("gaus")->GetParError(1); q[2]=hD->GetFunction("gaus")->GetParError(2); c1->Update(); TH1F *hA(ANaiveEnergy); hA->Fit("gaus"); hA->GetFunction("gaus")->GetParameters(p+3); hA->Fit("gaus","","",p[4]-1.5*p[5],p[4]+2.0*p[5]); hA->GetFunction("gaus")->GetParameters(p+3); q[3]=hA->GetFunction("gaus")->GetParError(0); q[4]=hA->GetFunction("gaus")->GetParError(1); q[5]=hA->GetFunction("gaus")->GetParError(2); c1->Update(); hD=DEnergy; hD->Fit("gaus","",""); hD->GetFunction("gaus")->GetParameters(p+6); hD->Fit("gaus","","",p[7]-1.5*p[8],p[7]+2.5*p[8]); hD->GetFunction("gaus")->GetParameters(p+6); q[6]=hD->GetFunction("gaus")->GetParError(0); q[7]=hD->GetFunction("gaus")->GetParError(1); q[8]=hD->GetFunction("gaus")->GetParError(2); c1->Update(); hA=AEnergy; hA->Fit("gaus"); hA->GetFunction("gaus")->GetParameters(p+9); hA->Fit("gaus","","",p[10]-1.5*p[11],p[10]+2.0*p[11]); hA->GetFunction("gaus")->GetParameters(p+9); q[ 9]=hA->GetFunction("gaus")->GetParError(0); q[10]=hA->GetFunction("gaus")->GetParError(1); q[11]=hA->GetFunction("gaus")->GetParError(2); c1->Update(); hD=DReOptEnergy; hD->Fit("gaus","",""); hD->GetFunction("gaus")->GetParameters(p+12); hD->Fit("gaus","","",p[13]-1.5*p[14],p[13]+2.5*p[14]); hD->GetFunction("gaus")->GetParameters(p+12); q[12]=hD->GetFunction("gaus")->GetParError(0); q[13]=hD->GetFunction("gaus")->GetParError(1); q[14]=hD->GetFunction("gaus")->GetParError(2); c1->Update(); cout << e[i]; fout << e[i]; for(unsigned j(0);j<15;j++) { cout << " " << p[j] << " " << q[j]; fout << " " << p[j] << " " << q[j]; } cout << endl; fout << endl; } }