void plot_goodfits(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 6; Int_t ngen=10000; // input data set first point (actually -3) to -10 so that it is not plotted. // use offset on x-axis to make data visible. Double_t layers0[npts]={0,2,3,4,5,6}; Double_t layers1[npts]={0,2.1,3.1,4.1,5.1,6.1}; Double_t layers1a[npts]={0,1.9,2.9,3.9,4.9,5.9}; Double_t layers2[npts]={0,2.2,3.2,4.2,5.2,6.2}; Double_t layers3[npts]={0,2.3,3.3,4.3,5.3,6.3}; Double_t standard[npts]={0,40000,18344,16453,16156,16387}; Double_t shifted[npts]={0,40000,13689,12250,12703,13274}; Double_t shifted_eff[npts]={0,40000,12560,12470,12730,13250}; Double_t closepack[npts]={0,40000,12927,12023,13052,14797}; // Double_t closepack_eff[npts]={0,40000,19095,17103,21886,32569}; original eff (enlarging errors) Double_t closepack_eff[npts]={0,40000,11079,12365,13351,15048}; Double_t closepack_eff3[npts]={0,40000,9982,12367,13554,15046}; Double_t shifted_false[npts]={0,-1,0.228,0.088,0.052,.044}; Double_t closepack_false[npts]={0,-1,0.144,0.109,0.12,0.158}; Double_t closepack_false3[npts]={0,-1,0.582,0.174,0.187,0.208}; Double_t xmin=1; Double_t xmax=7; Double_t ymin=0; Double_t ymax=4; // normalize to number of generated events for (j=0;jSetBorderMode(0); c1->SetFillColor(0); c1->SetGridx(); c1->SetGridy(); c1->SetBorderMode(0); c1->SetFillColor(0); TGraph *stand = new TGraph (npts,layers1a,standard); TGraph *shift = new TGraph (npts,layers0,shifted); TGraph *shift_eff = new TGraph (npts,layers1,shifted_eff); TGraph *shift_false = new TGraph (npts,layers1,shifted_false); TGraph *packed = new TGraph (npts,layers2,closepack); TGraph *packed_eff = new TGraph (npts,layers2,closepack_eff); TGraph *packed_eff3 = new TGraph (npts,layers3,closepack_eff3); TGraph *packed_false = new TGraph (npts,layers2,closepack_false); TGraph *packed_false3 = new TGraph (npts,layers3,closepack_false3); TLegend *leg = new TLegend(0.35,0.60,0.85,0.9); leg->AddEntry(stand,"Standard","p"); leg->AddEntry(shift,"Shifted","p"); leg->AddEntry(shift_eff,"Shifted/thresh","p"); leg->AddEntry(shift_false,"FALSE Shifted/thresh","p"); leg->AddEntry(packed,"Close-pack/none","p"); leg->AddEntry(packed_eff,"Close-pack/geom","p"); leg->AddEntry(packed_eff3,"Close-pack/geom+thresh","p"); leg->AddEntry(packed_false,"FALSE Close-pack/geom","p"); leg->AddEntry(packed_false3,"FALSE Close-pack/geom+thresh","p"); stand->SetTitle(""); stand->GetXaxis()->SetRangeUser(xmin,xmax); stand->GetYaxis()->SetRangeUser(ymin,ymax); stand->GetXaxis()->SetTitleSize(0.04); stand->GetYaxis()->SetTitleSize(0.04); stand->GetYaxis()->SetTitleOffset(1.5); stand->GetXaxis()->SetTitle("Number of Layers"); stand->GetYaxis()->SetTitle("Number of segments per event (p>0.01)"); stand->SetMarkerColor(1); stand->SetMarkerStyle(21); stand->Draw("AP"); shift->SetMarkerColor(4); shift->SetMarkerStyle(21); shift->Draw("sameP"); shift_eff->SetMarkerColor(2); shift_eff->SetMarkerStyle(21); shift_eff->Draw("sameP"); shift_false->SetMarkerColor(2); shift_false->SetMarkerStyle(25); shift_false->Draw("sameP"); packed->SetMarkerColor(4); packed->SetMarkerStyle(22); packed->Draw("sameP"); packed_eff->SetMarkerColor(2); packed_eff->SetMarkerStyle(22); packed_eff->Draw("sameP"); packed_eff3->SetMarkerColor(2); packed_eff3->SetMarkerStyle(20); packed_eff3->Draw("sameP"); packed_false->SetMarkerColor(2); packed_false->SetMarkerStyle(26); packed_false->Draw("sameP"); packed_false3->SetMarkerColor(2); packed_false3->SetMarkerStyle(24); packed_false3->Draw("sameP"); leg->Draw(); // fit data to function /*TF1 *expon1 = new TF1("expon","expo",1,10); stand->Fit(expon1,"R"); Double_t A1=expon1->GetParameter(0); Double_t B1=expon1->GetParameter(1); expon1->SetLineColor(1); sprintf(string,"stand: Parameters A=%f,B=%f\n",exp(A1),B1); printf("string=%s\n",string);*/ /*sprintf(string,"Standard\n"); t1 = new TLatex(0.2,0.8,string); t1->SetTextColor(1); t1->SetNDC(); t1->SetTextSize(0.035); t1->Draw();*/ // c1->SaveAs("plot_goodfits.eps"); c1->SaveAs("plot_goodfits.gif"); }