// make rate plot #include #include using namespace std; void mkrplt(int P){ char cmd[128]; sprintf(cmd,"./genlist.py -V ver2 -P %d",P); system(cmd); float bc[2][200]; ifstream INF1("beam_currents.dat"); int k1 = 0; while (!INF1.eof()){ INF1>>bc[0][k1]>>bc[1][k1]; k1++; } INF1.close(); ifstream INF("rate.dat"); float data[4][200]; float edata[4][200]; int cnt = 0; float rnum; while (!INF.eof()){ INF>>rnum; if (rnum>0) { data[0][cnt] =rnum; INF>>data[1][cnt]>>edata[0][cnt]>>data[2][cnt]>>edata[1][cnt]; for (int k=0;kSetTitle("Padd. Efficiency vs. beam current"); h1->GetXaxis()->SetTitle("beam current [nA]"); h1->GetYaxis()->SetTitle("Efficiency"); for (int k=0;kFill(data[3][k],data[2][k]); } TH2F *h2 = new TH2F("h2","Efficiency vs. Beam Current",30,0., 220.,20,0.,1.); h2->SetTitle("Padd. Efficiency vs. beam current"); h2->GetXaxis()->SetTitle("beam current [nA]"); h2->GetYaxis()->SetTitle("Efficiency"); for (int k=0;kFill(data[3][k],data[1][k]); } g1->SetMarkerStyle(20); g2->SetMarkerStyle(21); g1->SetMarkerColor(2); g2->SetMarkerColor(4); char txt1[128]; sprintf(txt1,"Paddle %d (red V-plane, blue H-plane)",P); TMultiGraph *mg = new TMultiGraph(); mg->SetTitle(txt1); char nam[128]; sprintf(nam,"paddle %d",P); TCanvas *c1 = new TCanvas("c1",nam,200,10,700,500); //c1->Divide(1,3); //c1->cd(1); gStyle->SetOptStat(0); mg->Add(g1); mg->Add(g2); mg->Draw("AP"); gPad->SetGrid(); mg->GetXaxis()->SetTitle("run number"); mg->GetYaxis()->SetTitle("Efficiency"); mg->SetMinimum(0.); mg->SetMaximum(1.2); c1->Modified(); gPad->Update(); //c1->cd(2); //h1->Draw("colz"); //c1->cd(3); //h2->Draw("colz"); //gPad->Update(); sprintf(nam,"plots/paddle_eff_run%d_ver2.gif",P); c1->SaveAs(nam); sprintf(nam,"plots/paddle_eff_run%d_ver2.pdf",P); c1->SaveAs(nam); }