void trig_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 nptsm 2; #define npts5 1; // 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 current[npts]={0,10,30,36,40}; Double_t xerr[npts]={0.1,0.1,0.1,0.1,0.1}; // first rates are for 4tracks and 3 sectors Double_t Lrate[npts]={-1,0.115,0.090,0.075,-1}; Double_t Lrate_err[npts]={1,0.005,0.005,0.005,1}; Double_t Merr[nptsm]={0.1,0.1}; Double_t Mrate_err[nptsm]={0.005,0.005}; Double_t Mcurrent[nptsm]={5,30}; Double_t Mrate[nptsm]={0.125,0.115}; Double_t B5err[npts5]={0.1}; Double_t B5rate_err[npts5]={0.01}; Double_t B5current[npts5]={0}; Double_t B5rate[npts5]={0.125}; // rates are for 4tracks and 4 sectors Double_t L4rate[npts]={-1,0.055,0.050,0.045,-1}; Double_t L4rate_err[npts]={1,0.005,0.005,0.005,1}; Double_t M4rate_err[nptsm]={0.005,0.005}; Double_t M4rate[nptsm]={0.065,0.060}; Double_t B54rate_err[nptsm]={0.01,0.01}; Double_t B54rate[nptsm]={0.065,0.060}; // rates are for 3tracks and 3 sectors Double_t L3rate[npts]={-1,0.17,0.13,0.12,-1}; Double_t L3rate_err[npts]={1,0.005,0.005,0.005,1}; Double_t M3rate_err[nptsm]={0.005,0.005}; Double_t M3rate[nptsm]={0.20,0.18}; Double_t B53rate_err[nptsm]={0.01,0.01}; Double_t B53rate[nptsm]={0.20,0.18}; Double_t xmin=0; Double_t xmax=40; Double_t ymin=0; Double_t ymax=0.4; // TCanvas *c1 = new TCanvas("c1","Rate of Lambda Production vs Beam Current",200,10,700,700); c1->SetBorderMode(0); c1->SetFillColor(0); c1->SetGridx(); c1->SetGridy(); c1->SetBorderMode(0); c1->SetFillColor(0); TGraphErrors *l4t_3s = new TGraphErrors (npts,current,Lrate,xerr,Lrate_err); TGraphErrors *m4t_3s = new TGraphErrors (nptsm,Mcurrent,Mrate,Merr,Mrate_err); TGraphErrors *B54t_3s = new TGraphErrors (npts5,B5current,B5rate,B5err,B5rate_err); TLegend *leg = new TLegend(0.15,0.60,0.7,0.9); leg->AddEntry(l4t_3s,"4 Tracks, 3 Sectors Asynch=ST*MOR","p"); leg->AddEntry(m4t_3s,"4 Tracks, 3 Sectors Asynch=MOR","p"); leg->AddEntry(B54t_3s,"4 Tracks, 3 Sectors Asynch=ST*MOR Bit 5","p"); TGraphErrors *l4t_4s = new TGraphErrors (npts,current,L4rate,xerr,L4rate_err); TGraphErrors *m4t_4s = new TGraphErrors (nptsm,Mcurrent,M4rate,Merr,M4rate_err); TGraphErrors *B54t_4s = new TGraphErrors (npts5,B5current,B54rate,B5err,B54rate_err); leg->AddEntry(l4t_4s,"4 Tracks, 4 Sectors Asynch=ST*MOR","p"); leg->AddEntry(m4t_4s,"4 Tracks, 4 Sectors Asynch=MOR","p"); leg->AddEntry(B54t_4s,"4 Tracks, 4 Sectors Asynch=ST*MOR Bit 5","p"); TGraphErrors *l3t_3s = new TGraphErrors (npts,current,L3rate,xerr,L3rate_err); TGraphErrors *m3t_3s = new TGraphErrors (nptsm,Mcurrent,M3rate,Merr,M3rate_err); TGraphErrors *B53t_3s = new TGraphErrors (npts5,B5current,B53rate,B5err,B53rate_err); leg->AddEntry(l3t_3s,"3 Tracks, 3 Sectors Asynch=ST*MOR","p"); leg->AddEntry(m3t_3s,"3 Tracks, 3 Sectors Asynch=MOR","p"); leg->AddEntry(B53t_3s,"3 Tracks, 3 Sectors Asynch=ST*MOR Bit 5","p"); l4t_3s->SetTitle(""); l4t_3s->GetXaxis()->SetRangeUser(xmin,xmax); l4t_3s->GetYaxis()->SetRangeUser(ymin,ymax); l4t_3s->GetXaxis()->SetTitleSize(0.04); l4t_3s->GetYaxis()->SetTitleSize(0.04); l4t_3s->GetYaxis()->SetTitleOffset(1.5); l4t_3s->GetXaxis()->SetTitle("Electron Beam Current (nA)"); l4t_3s->GetYaxis()->SetTitle("Normalized #Lambda rate"); l4t_3s->GetXaxis()->SetNdivisions(5); l4t_3s->SetMarkerColor(1); l4t_3s->SetMarkerStyle(20); l4t_3s->Draw("AP"); m4t_3s->SetMarkerColor(1); m4t_3s->SetMarkerStyle(24); m4t_3s->Draw("P"); B54t_3s->SetMarkerColor(1); B54t_3s->SetMarkerStyle(21); B54t_3s->Draw("P"); l4t_4s->SetMarkerColor(2); l4t_4s->SetMarkerStyle(20); l4t_4s->Draw("P"); m4t_4s->SetMarkerColor(2); m4t_4s->SetMarkerStyle(24); m4t_4s->Draw("P"); B54t_4s->SetMarkerColor(2); B54t_4s->SetMarkerStyle(21); B54t_4s->Draw("P"); l3t_3s->SetMarkerColor(4); l3t_3s->SetMarkerStyle(20); l3t_3s->Draw("P"); m3t_3s->SetMarkerColor(4); m3t_3s->SetMarkerStyle(24); m3t_3s->Draw("P"); B53t_3s->SetMarkerColor(4); B53t_3s->SetMarkerStyle(21); B53t_3s->Draw("P"); leg->Draw(); l4t_3s->Fit("pol1","","",0,40); TF1 *p1 = l4t_3s->GetFunction("pol1"); p1->SetLineColor(1); p1->Draw("same"); m4t_3s->Fit("pol1","","",0,40); TF1 *p2 = m4t_3s->GetFunction("pol1"); p2->SetLineColor(1); p2->Draw("same"); l4t_4s->Fit("pol1","","",0,40); TF1 *p3 = l4t_4s->GetFunction("pol1"); p3->SetLineColor(2); p3->Draw("same"); m4t_4s->Fit("pol1","","",0,40); TF1 *p4 = m4t_4s->GetFunction("pol1"); p4->SetLineColor(2); p4->Draw("same"); l3t_3s->Fit("pol1","","",0,40); TF1 *p5 = l3t_3s->GetFunction("pol1"); p5->SetLineColor(4); p5->Draw("same"); m3t_3s->Fit("pol1","","",0,40); TF1 *p6 = m3t_3s->GetFunction("pol1"); p6->SetLineColor(4); p6->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("trig_efficiency.eps"); c1->SaveAs("trig_efficiency.gif"); } 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; }