void dof1(int run, int loc){ int DEBUG = 0; char file[128]; if (loc==0) { sprintf(file,"localdir/run%d/tofmon.root",run); } else { sprintf(file,"genroot/hists/%06d/tofmon.root",run); } TFile *fil = new TFile(file); TF1 *f1 = new TF1("f1", "[0]+[1] * ( pow(x,[2]))",180.,5000.); char hist[128]; ofstream outf; sprintf(file,"walk_fitresults_run%06d.dat",run); outf.open(file); for (int k=0;k<176;k++){ sprintf(hist,"TOFmon/TWalk%d",k); TH2F *h = (TH2F*)fil->Get(hist); if (h->GetEntries()>10) { f1->SetLineColor(2); f1->SetParameter(0,15.); f1->SetParameter(1, 5000.); f1->SetParameter(2, -1.3); f1->SetParLimits(0,-10.,2000.); f1->SetParLimits(1, 1., 1000000.); f1->SetParLimits(2, -2.9, -0.25); h->Fit(f1,"","R",180.,4095.); h->Draw("colz"); gPad->Update(); float p[3]; for (int n=0;n<3;n++){ TF1 *func = h->GetFunction("f1"); p[n] = func->GetParameter(n); outf<