//generating functions converting channel into voltage, //using file pksx.txt //and save parameters into outputx.txt void fitGr(const bool left,TGraphErrors *ger,char parout[30]){//fit & save graph of 0 & 2 const short npol=5; char fcnform[10]; sprintf(fcnform,"pol%d",npol);//form of fitting function TF1 *fcn=new TF1("",fcnform,0,4500.); fcn->SetParameter(0,-5e-2); fcn->SetParameter(1,1.e-3); if(npol>=2) fcn->SetParameter(2,-5.e-9); if(npol>=3) fcn->SetParameter(3, 0.); if(npol>=4) fcn->SetParameter(4, 0.); if(npol==5) fcn->SetParameter(5, 0.); if(left) ger->SetName("gl");//left side else if(!left) ger->SetName("gr");//right side gStyle->SetOptFit(0000); gStyle->SetOptStat(0); ger->Fit(fcn,"WQN"); // "initial pre-fit" ger->Fit(fcn,"EMQ+");//fit ofstream fout(parout,ios::app); if(left) fout<<"left "; else if(!left) fout<<"right "; for(short i=0;i<=npol;i++){ fout<GetParameter(i)<<"\t"<GetParError(i); if(i>y>>detID>>detID>>x>>xerr; for(short i=0;ithresholdl){ gers[0][detID]->SetPoint(gers[0][detID]->GetN(),x,y); gers[0][detID]->SetPointError(gers[0][detID]->GetN()-1, xerr,yerr); } getline(fin, line); ss.clear(); ss.str(line); ss>>y>>detID>>detID>>x>>xerr; } for(short i=0;ithresholdr){ gers[1][detID]->SetPoint(gers[1][detID]->GetN(),x,y); gers[1][detID]->SetPointError(gers[1][detID]->GetN()-1, xerr,yerr); } if(i==ncol-1) break; getline(fin, line); ss.clear(); ss.str(line); ss>>y>>detID>>detID>>x>>xerr; } } fin.close(); char parout[30]="outputx.txt"; ofstream fout(parout); fout<<"Q = [0] + [1]*ch+..."<