void size_studies(void) { // // plot studies of acceptance as a function of light guide dimensions to optimize final production guide dimensions. // ES June 3, 2011 // // #include #include gROOT->Reset(); //TTree *Bfield = (TTree *) gROOT->FindObject("Bfield"); gStyle->SetPalette(1,0); gStyle->SetOptStat(kFALSE); gStyle->SetOptFit(kTRUE); gStyle->SetOptFit(1111); gStyle->SetPadRightMargin(0.15); gStyle->SetPadLeftMargin(0.15); gStyle->SetPadBottomMargin(0.15); gStyle->SetFillColor(0); // char string[256]; char filename[80]; Int_t j,jj; #define npts 3; #define mpts 9; #define xpts 5; #define max 201; // input data set first point (actually -100) to 100 so that it is not plotted. // use offset on x-axis to make data visible and give negative y-values for reference (not plotted) Double_t dummyx[npts]={-1,0,5}; Double_t dummyy[npts]={-1,-1,-1}; // Computed light guide acceptances using geant3 // To keep fixed lengths, use negative values for unmeasured parameters. Double_t acc_factor[mpts]={1.5*1.2,1.3*1.2,1.2*1.2,1.1*1.2,1.05*1.2,1.0*1.2,0.95*1.2,0.9*1.2,0.8*1.2}; Double_t acc_g1[mpts]= { 0.473, 0.637, 0.73, 0.748, 0.721, 0.671, 0.603, 0.541, 0.420}; Double_t acc_g2[mpts]= { -1, -1, -1, 0.723, -1, -1, -1, -1, -1}; Double_t acc_g3[mpts]= { -1, -1, -1, 0.701, -1, -1, -1, -1, -1}; Double_t acc_g4[mpts]= { -1, -1, 0.683, 0.683, 0.653, 0.612, -1, -1, -1}; Double_t acc_g5[mpts]= { -1, -1, -1, 0.662, -1, -1, -1, -1, -1}; Double_t acc_g6[mpts]= { -1, 0.494, 0.647, 0.643, 0.620, 0.579, -1, -1, -1}; Double_t acc_g7[mpts]= { -1, -1, -1, 0.516, -1, -1, -1, -1, -1}; Double_t acc_g8[mpts]= { -1, -1, -1, 0.503, -1, -1, -1, -1, -1}; Double_t acc_g9[mpts]= { -1, -1, -1, 0.488, -1, -1, -1, -1, -1}; Double_t acc_g10[mpts]= { -1, 0.492, 0.49, 0.477, -1, 0.477, -1, -1, -1}; // TCanvas *c1 = new TCanvas("c1","c1 size_studies",200,10,700,700); c1->SetGridx(); c1->SetGridy(); c1->SetBorderMode(0); c1->SetFillColor(0); // c1->SetLogx(); // c1->SetLogy(); Double_t xmin=1; Double_t xmax=2; // Double_t xmin=0.1; // Double_t xmax=0.5; Double_t ymin=0; Double_t ymax=1.0; // dummy to draw axes TGraph *dummy = new TGraph (npts,dummyx,dummyy); TLegend *leg = new TLegend(0.7,0.5,0.85,0.9); dummy->SetMarkerColor(1); dummy->SetMarkerStyle(21); dummy->SetTitle(""); dummy->GetXaxis()->SetRangeUser(xmin,xmax); dummy->GetYaxis()->SetRangeUser(ymin,ymax); dummy->GetXaxis()->SetTitleSize(0.04); dummy->GetYaxis()->SetTitleSize(0.04); dummy->GetYaxis()->SetTitleOffset(1.5); dummy->GetXaxis()->SetTitle("Height (cm)"); dummy->GetYaxis()->SetTitle("Acceptance"); dummy->Draw("Ap"); // dummy->GetXaxis()->SetNdivisions(505); // plot data TGraph *ag1 = new TGraph (mpts,acc_factor,acc_g1); ag1->SetMarkerColor(2); ag1->SetMarkerStyle(20); ag1->Draw("Samep"); sprintf (string,"Guide 1\n"); leg->AddEntry(ag1,string,"p"); TGraph *ag2 = new TGraph (mpts,acc_factor,acc_g2); ag2->SetMarkerColor(1); ag2->SetMarkerStyle(21); ag2->Draw("Samep"); sprintf (string,"Guide 2\n"); leg->AddEntry(ag2,string,"p"); TGraph *ag3 = new TGraph (mpts,acc_factor,acc_g3); ag3->SetMarkerColor(3); ag3->SetMarkerStyle(22); ag3->Draw("Samep"); sprintf (string,"Guide 3\n"); leg->AddEntry(ag3,string,"p"); TGraph *ag4 = new TGraph (mpts,acc_factor,acc_g4); ag4->SetMarkerColor(4); ag4->SetMarkerStyle(23); ag4->Draw("Samep"); sprintf (string,"Guide 4\n"); leg->AddEntry(ag4,string,"p"); TGraph *ag5 = new TGraph (mpts,acc_factor,acc_g5); ag5->SetMarkerColor(2); ag5->SetMarkerStyle(24); ag5->Draw("Samep"); sprintf (string,"Guide 5\n"); leg->AddEntry(ag5,string,"p"); TGraph *ag6 = new TGraph (mpts,acc_factor,acc_g6); ag6->SetMarkerColor(1); ag6->SetMarkerStyle(25); ag6->Draw("Samep"); sprintf (string,"Guide 6\n"); leg->AddEntry(ag6,string,"p"); TGraph *ag7 = new TGraph (mpts,acc_factor,acc_g7); ag7->SetMarkerColor(3); ag7->SetMarkerStyle(26); ag7->Draw("Samep"); sprintf (string,"Guide 7\n"); leg->AddEntry(ag7,string,"p"); TGraph *ag8 = new TGraph (mpts,acc_factor,acc_g8); ag8->SetMarkerColor(4); ag8->SetMarkerStyle(27); ag8->Draw("Samep"); sprintf (string,"Guide 8\n"); leg->AddEntry(ag8,string,"p"); TGraph *ag9 = new TGraph (mpts,acc_factor,acc_g9); ag9->SetMarkerColor(2); ag9->SetMarkerStyle(28); ag9->Draw("Samep"); sprintf (string,"Guide 9\n"); leg->AddEntry(ag9,string,"p"); TGraph *ag10 = new TGraph (mpts,acc_factor,acc_g10); ag10->SetMarkerColor(1); ag10->SetMarkerStyle(29); ag10->Draw("Samep"); sprintf (string,"Guide 10\n"); leg->AddEntry(ag10,string,"p"); leg->Draw(); sprintf (string,"Title\n"); t1 = new TLatex(0.6,0.88,string); t1->SetTextColor(1); t1->SetNDC(); t1->SetTextSize(0.025); // t1->Draw(); TLine *line = new TLine (1.27,ymin,1.27,ymax); // line->SetLineStyle(2); line->SetLineColor(2); line->SetLineWidth(2); line->Draw(); sprintf(filename,"size_studies_c1.eps"); c1->SaveAs(filename); sprintf(filename,"size_studies_c1.png"); c1->SaveAs(filename); }