void gap_efficiency(void) { // // plot the number of fits to a cdc segment that result in prob > prob_cut (currently set to 0.01). // // #include #include gROOT->Reset(); //TTree *Bfield = (TTree *) gROOT->FindObject("Bfield"); gStyle->SetPalette(1,0); gStyle->SetOptStat(kFALSE); gStyle->SetOptFit(kFALSE); // gStyle->SetOptFit(1111); gStyle->SetPadRightMargin(0.15); gStyle->SetPadLeftMargin(0.15); gStyle->SetPadBottomMargin(0.15); gStyle->SetFillColor(0); // char string[256]; Int_t j,jj; #define npts 5; #define npts5 2; // input data set first point (actually -1) to -10 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 air_gap1[npts]={-1,0.02,0.1,0.2,1}; Double_t air_gap2[npts]={-1,0.02,0.1,0.2,1}; Double_t air_gap12[npts]={-1,0.02,0.1,0.2,1}; Double_t lucite_gap[npts5]={0.02,0.2}; Double_t air_eff1[npts]={-1,0.598,0.525,0.449,-1}; Double_t air_eff2[npts]={-1,0.796,0.691,0.557,-1}; Double_t air_eff12[npts]={-1,0.475,0.366,0.249,-1}; Double_t lucite_eff[npts5]={0.884,0.871}; Double_t xmin=0; Double_t xmax=0.2; Double_t ymin=0; Double_t ymax=1; // TCanvas *c1 = new TCanvas("c1","Efficiency vs gap size",200,10,700,700); c1->SetBorderMode(0); c1->SetFillColor(0); c1->SetGridx(); c1->SetGridy(); c1->SetBorderMode(0); c1->SetFillColor(0); TGraph *air2= new TGraph (npts,air_gap2,air_eff2); TGraph *air1= new TGraph (npts,air_gap1,air_eff1); TGraph *air12 = new TGraph (npts,air_gap12,air_eff12); TGraph *lucite = new TGraph (npts5,lucite_gap,lucite_eff); TLegend *leg = new TLegend(0.2,0.20,0.6,0.35); leg->AddEntry(lucite,"Lucite Gap1 and Gap2","p"); leg->AddEntry(air2,"Air Gap2 only","p"); leg->AddEntry(air1,"Air Gap1 only","p"); leg->AddEntry(air12,"Air Gap1 and Gap2","p"); air1->SetTitle(""); air1->GetXaxis()->SetRangeUser(xmin,xmax); air1->GetYaxis()->SetRangeUser(ymin,ymax); air1->GetXaxis()->SetTitleSize(0.04); air1->GetYaxis()->SetTitleSize(0.04); air1->GetYaxis()->SetTitleOffset(1.5); air1->GetXaxis()->SetTitle("Gap (cm)"); air1->GetYaxis()->SetTitle("Efficiency"); air1->GetXaxis()->SetNdivisions(5); air1->SetMarkerColor(2); air1->SetMarkerSize(1.5); air1->SetMarkerStyle(20); air1->Draw("AP"); air2->SetMarkerColor(4); air2->SetMarkerSize(1.5); air2->SetMarkerStyle(21); air2->Draw("Psame"); air12->SetMarkerColor(1); air12->SetMarkerSize(1.5); air12->SetMarkerStyle(22); air12->Draw("Psame"); lucite->SetMarkerColor(1); lucite->SetMarkerSize(1.5); lucite->SetMarkerStyle(24); lucite->Draw("Psame"); leg->Draw(); /*air->Fit("pol1","","",0,40); TF1 *p1 = air->GetFunction("pol1"); p1->SetLineColor(1); p1->Draw("same");*/ sprintf(string,"#Lambda rate vs beam current\n"); t1 = new TLatex(0.45,0.8,string); t1->SetTextColor(1); t1->SetNDC(); t1->SetTextSize(0.035); // t1->Draw(); // c1->SaveAs("gap_efficiency.eps"); c1->SaveAs("gap_efficiency.png"); } Double_t tradeoff (Double_t *x, Double_t *par) { Double_t b=par[0]; Double_t c=par[1]; Double_t DeE=par[2]; Double_t E=par[3]; Double_t x1=x[0]/100; char string[256]; Double_t P = b*b/(DeE*DeE*E); Double_t pde = P/2 + sqrt(P*P/4 + x1*c*c/(DeE*DeE*E*E)); /*sprintf (string,"tradeoff=%f b=%f c=%f DeE=%f E=%f\n",pde,b,c,DeE,E); printf ("string=%s",string);*/ return pde; }