//---------------------------------------------------- // Macro made by Rachid Nouicer // to plot survey data for the Ring Counter // macro made in November 25, 2002 //---------------------------------------------------- #include #include void read_survey_data_ring() { //gROOT->Reset(); gROOT->SetStyle("Plain"); gStyle->SetOptStat(kFALSE); gStyle->SetOptStat(kFALSE); //gStyle->SetOptTitle(kFALSE); Float_t RingCounter; cout << " which Ring Counter 4 (+1Z) or 5 (+2Z) or 6 (+3) " <>RingCounter; if(RingCounter ==4) FILE *RingCounter4 = fopen("R4NV2002_analysis.dat", "r"); if(RingCounter ==5) FILE *RingCounter5 = fopen("R5NV2002_analysis.dat", "r"); if(RingCounter ==6) FILE *RingCounter6 = fopen("R6NV2002_analysis.dat", "r"); Float_t x, z, y, ex, ez, ey; Char_t namesoft[10], namehard[10], ring[10], module[10]; Char_t line[300]; Float_t x1[33],y1[33],ex1[33],ey1[33]; Int_t i; TCanvas *c1= new TCanvas("c1", "survey data ring counter ", 10, 10, 600, 600); TH1F *frame = c1->DrawFrame(-.13,-.13,.13,.13); frame->GetYaxis()->SetNdivisions(509); frame->GetXaxis()->SetNdivisions(509); frame->GetYaxis()->SetTitleOffset(1.3); frame->GetYaxis()->SetTitleSize(.04); frame->GetYaxis()->SetLabelSize(.05); frame->GetYaxis()->SetLabelOffset(.01); frame->GetYaxis()->SetTitle("y (m)"); frame->GetXaxis()->SetTitle("x (m)"); if(RingCounter ==4) { while((fgets(line, 120, RingCounter4) > 0)) { sscanf(line," %d %s %s %f %f %f %f %f %f \n",&i,&namesoft,&namehard,&x,&z,&y,&ex,&ez,&ey); x1[i-1]=x; y1[i-1]=y; ex1[i-1]=ex; ey1[i-1]=ey; Int_t i1=i-1; cout << i1 <<" " << x1[i-1] <<" " << y1[i-1] << endl; } //hframe->Draw("a"); TGraphErrors *gre = new TGraphErrors(32,x1,y1,ex1,ey1); frame->SetTitle("Ring Counter 4"); frame->Draw(); gre->SetMarkerStyle(24); gre->SetMarkerColor(4); gre->SetMarkerSize(0.4); gre->Draw("P"); } if(RingCounter ==5) { while((fgets(line, 120, RingCounter5) > 0)) { sscanf(line," %d %s %s %f %f %f %f %f %f \n",&i,&namesoft,&namehard,&x,&z,&y,&ex,&ez,&ey); x1[i-1]=x; y1[i-1]=y; ex1[i-1]=ex; ey1[i-1]=ey; Int_t i1=i-1; cout << i1 <<" " << x1[i-1] <<" " << y1[i-1] << endl; } TGraphErrors *gre = new TGraphErrors(32,x1,y1,ex1,ey1); frame->SetTitle("Ring Counter 5"); frame->Draw(); gre->SetMarkerStyle(24); gre->SetMarkerColor(4); gre->SetMarkerSize(0.4); gre->Draw("P"); } if(RingCounter ==6) { while((fgets(line, 120, RingCounter6) > 0)) { sscanf(line," %d %s %s %f %f %f %f %f %f \n",&i,&namesoft,&namehard,&x,&z,&y,&ex,&ez,&ey); x1[i-1]=x; y1[i-1]=y; ex1[i-1]=ex; ey1[i-1]=ey; Int_t i1=i-1; cout << i1 <<" " << x1[i-1] <<" " << y1[i-1] << endl; } TGraphErrors *gre = new TGraphErrors(32,x1,y1,ex1,ey1); frame->SetTitle("Ring Counter 6"); frame->Draw(); gre->SetMarkerStyle(24); gre->SetMarkerColor(4); gre->SetMarkerSize(0.4); gre->Draw("P"); } }