int DEBUG = 0; void view1(int R, int MatchCut, int MCdata){ char inf[128]; sprintf(inf,"EFF/position_efficiency_%02d_run%06d.dat", MatchCut, R); if (MCdata){ sprintf(inf,"EFF/position_efficiency_MC_%02d_run%06d.dat", MatchCut, R); } ifstream INF(inf); cout<> binx >> biny >> x >> y >> iloc >> pos >> sig >> eff >> deff; if (iloc == 99){ continue; } if (iloc){ PositionY[biny][binx] = pos; SigmaY[biny][binx] = sig*0.1; EfficiencyY[biny][binx] = eff; dEfficiencyY[biny][binx] = deff; PosiY[biny][binx] = x; } else { PositionX[binx][biny] = pos; SigmaX[binx][biny] = sig*0.1; EfficiencyX[binx][biny] = eff; dEfficiencyX[binx][biny] = deff; PosiX[binx][biny] = y; } } TCanvas *c1 = new TCanvas("c1", "TOF data", 1000, 800); TGraphErrors *grXeff[82]; TGraphErrors *grYeff[82]; char gnam[128]; for (int k=0; k<82; k++){ c1->Clear(); c1->Divide(1,2); grYeff[k] = new TGraphErrors(82, PosiY[k], EfficiencyY[k], NULL, dEfficiencyY[k]); grYeff[k]->SetMarkerStyle(20); grYeff[k]->SetMarkerColor(4); sprintf(gnam,"grYeff%02d",k); grYeff[k]->SetName(gnam); grXeff[k] = new TGraphErrors(82, PosiX[k], EfficiencyX[k], NULL, dEfficiencyX[k]); grXeff[k]->SetMarkerStyle(20); grXeff[k]->SetMarkerColor(4); sprintf(gnam,"grXeff%02d",k); grXeff[k]->SetName(gnam); c1->cd(1); grYeff[k]->Draw(); grYeff[k]->GetYaxis()->SetRangeUser(0., 1.1); char tit1[128]; sprintf(tit1, "Efficiency =%7.1f (x_track-x_tof)",k*3.-123+1.5); grYeff[k]->SetTitle(tit1); grYeff[k]->GetXaxis()->SetTitle("x-position [cm]"); gPad->SetGrid(); c1->cd(2); grXeff[k]->Draw(); grXeff[k]->GetYaxis()->SetRangeUser(0., 1.1); sprintf(tit1, "Efficiency =%7.1f (y_track-y_tof)",k*3.-123+1.5); grXeff[k]->SetTitle(tit1); grXeff[k]->GetXaxis()->SetTitle("y-position [cm]"); gPad->SetGrid(); gPad->Update(); if (DEBUG){ getchar(); } } char OF[128]; sprintf(OF,"EFF/pos_eff_%02d_plots_run%06d.root", MatchCut, R); if (MCdata){ sprintf(OF,"EFF/pos_eff_MC_%02d_plots_run%06d.root", MatchCut, R); } TFile *RF = new TFile(OF,"RECREATE"); for (int k=0; k<82; k++){ grXeff[k]->Write(); grYeff[k]->Write(); } }