markerwarning.C

Go to the documentation of this file.
00001 // This script illustrates the danger of using asymmetric symbols.
00002 // Non-symmetric symbols should be used carefully in plotting.
00003 // These two graphs show how misleading a careless use of symbols can be.
00004 // The two plots represent the same data sets but because of a bad symbol 
00005 // choice, the two plots on the top appear further apart than for the bottom 
00006 // example.
00007 //Author: Olivier Couet
00008    
00009 void markerwarning()
00010 {
00011    const int Nph = 14;
00012    double np_ph[Nph]  = {353.4,300.2,254.3,215.2,181.0,151.3,125.2,102.7, 
00013       83.3, 66.7, 52.5, 40.2, 30.2, 22.0};
00014    double nc_ph[Nph]  = {3.890,3.734,3.592,3.453,3.342,3.247,3.151,3.047,
00015       2.965,2.858,2.701,2.599,2.486,2.328};
00016    double npe_ph[Nph] = {10.068,9.004,8.086,7.304,6.620,6.026,5.504,5.054,
00017       4.666,4.334,4.050,3.804,3.604,3.440};
00018    double nce_ph[Nph] = {0.235,0.217,0.210,0.206,0.213,0.223,0.239,0.260,
00019       0.283,0.318,0.356,0.405,0.465,0.545};
00020 
00021    const int Nbr = 6;
00022    double np_br[Nbr]  = {357.0,306.0,239.0,168.0,114.0, 73.0};
00023    double nc_br[Nbr]  = {3.501,3.275,3.155,3.060,3.053,3.014};
00024    double npe_br[Nbr] = {8.000,11.000,10.000,9.000,9.000,8.000};
00025    double nce_br[Nbr] = {0.318,0.311,0.306,0.319,0.370,0.429};
00026 
00027    TGraphErrors *phUP = new TGraphErrors(Nph,np_ph,nc_ph,npe_ph,nce_ph);
00028    TGraphErrors *phDN = new TGraphErrors(Nph,np_ph,nc_ph,npe_ph,nce_ph);
00029    TGraphErrors *brUP = new TGraphErrors(Nbr,np_br,nc_br,npe_br,nce_br);
00030    TGraphErrors *brDN = new TGraphErrors(Nbr,np_br,nc_br,npe_br,nce_br);
00031 
00032    float Top_margin   = 0.;
00033    float Left_margin  = 0.025;
00034    float Right_margin = 0.005;
00035    float maxPlotPart  = 395;
00036    float Marker_Size  = 1.3;
00037    int   Marker_Style = 8;
00038   
00039    float Et_200_Min   = 0.71;
00040    float Et_200_Max   = 3.80;
00041    float Et_130_Min   = 1.21;
00042    float Et_130_Max   = 3.29;
00043   
00044    float Nc_200_Min   = 1.31;
00045    float Nc_200_Max   = 4.30;
00046    float Nc_130_Min   = 1.51;
00047    float Nc_130_Max   = 3.89;
00048   
00049    TCanvas *canvasNc = new TCanvas("canvasNc", "Multiplicity",630,10,600,500);
00050   
00051    gStyle->SetOptStat(0);
00052    canvasNc->SetFillColor(10);
00053    canvasNc->SetBorderSize(0);
00054   
00055    // Primitives in Nc200 pad
00056    TPad *padNcUP = new TPad("padNcUP","200 GeV",0.07,0.60,1.,1.00);
00057    padNcUP->Draw();
00058    padNcUP->cd();
00059    padNcUP->SetFillColor(10);
00060    padNcUP->SetFrameFillColor(10);
00061    padNcUP->SetBorderSize(0);
00062    padNcUP->SetLeftMargin(Left_margin);
00063    padNcUP->SetRightMargin(Right_margin);
00064    padNcUP->SetTopMargin(Top_margin+0.005);
00065    padNcUP->SetBottomMargin(0.00);
00066   
00067    TH1F* frameNcUP = new TH1F("frameNcUP","",100,0,maxPlotPart);
00068    frameNcUP->GetYaxis()->SetLabelOffset(0.005);
00069    frameNcUP->GetYaxis()->SetLabelSize(0.10);
00070    frameNcUP->SetMinimum(Nc_200_Min);
00071    frameNcUP->SetMaximum(Nc_200_Max);
00072    frameNcUP->SetNdivisions(505,"Y");
00073    frameNcUP->SetNdivisions(505,"X");
00074    frameNcUP->Draw();
00075   
00076    brUP->SetMarkerStyle(22);
00077    brUP->SetMarkerSize (2.0);
00078    brUP->Draw("P");                    
00079   
00080    phDN->SetMarkerStyle(23);
00081    phDN->SetMarkerSize (2);
00082    phDN->Draw("P");
00083   
00084    canvasNc->cd();
00085   
00086    // Primitives in Nc130 pad
00087    TPad *padNcDN = new TPad("padNcDN","130 GeV",0.07,0.02,1.,0.60);
00088    padNcDN->Draw();
00089    padNcDN->cd();
00090    padNcDN->SetFillColor(10);
00091    padNcDN->SetFrameFillColor(10);
00092    padNcDN->SetBorderSize(0);
00093    padNcDN->SetLeftMargin(Left_margin);
00094    padNcDN->SetRightMargin(Right_margin);
00095    padNcDN->SetTopMargin(Top_margin+0.005);
00096    padNcDN->SetBottomMargin(0.30);
00097   
00098    TH1F* frameNcDN = new TH1F("frameNcDN","",100,0,maxPlotPart);
00099    frameNcDN->GetYaxis()->SetLabelOffset(0.005);
00100    frameNcDN->GetYaxis()->SetLabelSize(0.07);
00101    frameNcDN->GetXaxis()->SetLabelOffset(0.005);
00102    frameNcDN->GetXaxis()->SetLabelSize(0.07);
00103    frameNcDN->SetMinimum(Nc_200_Min);
00104    frameNcDN->SetMaximum(Nc_200_Max);
00105    frameNcDN->SetNdivisions(505,"Y");
00106    frameNcDN->SetNdivisions(505,"X");
00107    frameNcDN->Draw();
00108   
00109    brDN->SetMarkerStyle(23);
00110    brDN->SetMarkerSize (2.0);
00111    brDN->Draw("P");                    
00112              
00113    phUP->SetMarkerStyle(22);
00114    phUP->SetMarkerSize (2);
00115    phUP->Draw("P");
00116 
00117    TLatex t1;
00118    t1.SetTextFont(12); t1.SetTextSize(0.0525);
00119    t1.DrawLatex(-5,0.6,"Non-symmetric symbols should be used carefully in plotting. \
00120       These two graphs show how misleading");
00121    t1.DrawLatex(-5,0.4,"a careless use of symbols can be. The two plots represent \
00122       the same data sets but because of a bad");
00123    t1.DrawLatex(-5,0.2,"symbol choice, the two plots on the top appear further apart \
00124       than for the bottom example.");
00125 
00126    canvasNc->cd();
00127 }

Generated on Tue Jul 5 15:44:20 2011 for ROOT_528-00b_version by  doxygen 1.5.1