int quit=0; void handler(int){quit=1;} void scan_offset(){ signal(SIGINT,handler); for(int i=0; i<=23; i++) { TFile *f = new TFile(Form("results_run12_noflip_anodeoffset%d.root",i)); //TH2F *h2 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int")); TH2F *h2 = (TH2F*)(f->Get("pcz_vs_sx3z")); // TH2F *h2 = (TH2F*)(f->Get("hPCQQQ/PC_XY_Projection_QQQ2")); if(!h2) continue; h2->SetTitle(Form("case%d",i)); h2->Draw("colz"); gPad->Modified(); gPad->Update(); while(gPad->WaitPrimitive()); f->Close(); if(i==23) i=0; if(quit) break; } }