stressGraphics.cxx

Go to the documentation of this file.
00001 // @(#)root/test:$name:  $:$id: stressGraphics.cxx,v 1.0 exp $
00002 // Author: O.Couet
00003 
00004 //
00005 //    ROOT  Graphics test suite and benchmarks.
00006 //
00007 // The suite of programs below tests many elements of the graphics classes
00008 //
00009 // The test can be run as a standalone program or with the interpreter.
00010 //
00011 // To run as a standalone program:
00012 //
00013 //    make stressGraphics
00014 //    stressGraphics
00015 //
00016 // To get a short help:
00017 //    stressGraphics -h
00018 //
00019 // To run interactively, do
00020 // root
00021 //  Root > .L stressGraphics.cxx
00022 //  Root > stressGraphics()
00023 
00024 
00025 #ifndef __CINT__
00026 
00027 #include <stdlib.h>
00028 #include <Riostream.h>
00029 #include <time.h>
00030 #include <TString.h>
00031 #include <TROOT.h>
00032 #include <TError.h>
00033 #include <TRandom.h>
00034 #include <TBenchmark.h>
00035 #include <TSystem.h>
00036 #include <TApplication.h>
00037 #include <TDatime.h>
00038 #include <TFile.h>
00039 #include <TF1.h>
00040 #include "TF2.h"
00041 #include <TF3.h>
00042 #include <TH2.h>
00043 #include <TNtuple.h>
00044 #include <TProfile.h>
00045 
00046 #include <TStyle.h>
00047 #include <TCanvas.h>
00048 #include <TColor.h>
00049 #include <TFrame.h>
00050 #include <TPostScript.h>
00051 #include <TPDF.h>
00052 #include <TLine.h>
00053 #include <TMarker.h>
00054 #include <TPolyLine.h>
00055 #include <TLatex.h>
00056 #include <TEllipse.h>
00057 #include <TCurlyArc.h>
00058 #include <TArc.h>
00059 #include <TPaveText.h>
00060 #include <TPaveStats.h>
00061 #include <TPaveLabel.h>
00062 #include <TGaxis.h>
00063 #include <TGraph.h>
00064 #include <TGraphErrors.h>
00065 #include <TGraphAsymmErrors.h>
00066 #include <TGraphBentErrors.h>
00067 #include <TMultiGraph.h>
00068 #include <TGraph2D.h>
00069 #include <TImage.h>
00070 #include <TMath.h>
00071 #include <TSystem.h>
00072 
00073 
00074 void     stressGraphics (Int_t verbose);
00075 Int_t    StatusPrint    (TString &filename, Int_t id, const TString &title, Int_t res, Int_t ref, Int_t err);
00076 Int_t    AnalysePS      (const TString &filename);
00077 Int_t    FileSize       (char *filename);
00078 TCanvas *StartTest      (Int_t w, Int_t h);
00079 void     TestReport1    (TCanvas *C, const TString &title);
00080 void     TestReport2    ();
00081 void     DoCcode        (TCanvas *C);
00082 
00083 // Tests functions.
00084 void     tline          ();
00085 void     tmarker        ();
00086 void     tpolyline      ();
00087 void     patterns       ();
00088 void     ttext1         ();
00089 void     ttext2         ();
00090 void     tlatex1        ();
00091 void     tlatex2        ();
00092 void     tlatex3        ();
00093 void     tlatex4        ();
00094 void     tlatex5        ();
00095 void     kerning        ();
00096 void     itbf           ();
00097 void     transpad       ();
00098 void     statfitparam   ();
00099 void     tgaxis1        ();
00100 void     tgaxis2        ();
00101 void     tgaxis3        ();
00102 void     tgaxis4        ();
00103 void     labels1        ();
00104 void     tellipse       ();
00105 void     feynman        ();
00106 void     tgraph1        ();
00107 void     tgraph2        ();
00108 void     tgraph3        ();
00109 void     tmultigraph1   ();
00110 void     tmultigraph2   ();
00111 void     options2d1     ();
00112 void     options2d2     ();
00113 void     options2d3     ();
00114 void     options2d4     ();
00115 void     options2d5     ();
00116 void     earth          ();
00117 void     tgraph2d1      ();
00118 void     tgraph2d2      ();
00119 void     tgraph2d3      ();
00120 void     ntuple1        ();
00121 void     quarks         ();
00122 void     timage         ();
00123 void     zoomtf1        ();
00124 void     zoomfit        ();
00125 void     parallelcoord  ();
00126 void     clonepad       ();
00127 void     waves          ();
00128 
00129 // Auxiliary functions
00130 void     patterns_box   (Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t  y2);
00131 void     tmarker_draw   (Double_t x, Double_t y, Int_t mt, Double_t d);
00132 Double_t interference   (Double_t *x, Double_t *par);
00133 Double_t result         (Double_t *x, Double_t *par);
00134 void     cleanup        ();
00135 #endif
00136 
00137 // Global variables.
00138 Int_t     gVerbose;
00139 Int_t     gTestNum;
00140 Int_t     gPS1RefNb[50];
00141 Int_t     gPS1ErrNb[50];
00142 Int_t     gPDFRefNb[50];
00143 Int_t     gPDFErrNb[50];
00144 Int_t     gGIFRefNb[50];
00145 Int_t     gGIFErrNb[50];
00146 Int_t     gJPGRefNb[50];
00147 Int_t     gJPGErrNb[50];
00148 Int_t     gPNGRefNb[50];
00149 Int_t     gPNGErrNb[50];
00150 Int_t     gPS2RefNb[50];
00151 Int_t     gPS2ErrNb[50];
00152 Bool_t    gOptionR;
00153 Bool_t    gOptionK;
00154 TH2F     *gH2;
00155 TFile    *gLocalFile;
00156 char      gCfile[16];
00157 char      outfile[16];
00158 char      gLine[80];
00159 
00160 
00161 #ifndef __CINT__
00162 //______________________________________________________________________________
00163 int main(int argc, char *argv[])
00164 {
00165    TApplication theApp("App", &argc, argv);
00166    gBenchmark = new TBenchmark();
00167 
00168    TString opt;
00169    Int_t verbose = 0;
00170    if (argc > 1) verbose = atoi(argv[1]);
00171    opt = argv[1];
00172 
00173    if (opt.Contains("-h")) {
00174       printf("Usage: stressGraphics [-h] [-r] [-k]\n");
00175       printf("Options:\n");
00176       printf("  -r : Generate de reference output.\n");
00177       printf("       Redirect the output in the file \"stressGraphics.ref\"\n");
00178       printf("       to redefine the reference file.\n");
00179       printf("\n");
00180       printf("  -k : Keep the PS files even for passed tests.\n");
00181       printf("       By default PS files for passed tests are deleted.\n");
00182       printf("\n");
00183       printf("  -h : Print usage\n");
00184       return 0;
00185    }
00186 
00187    if (opt.Contains("-r")) {
00188       gOptionR = kTRUE;
00189    } else {
00190       gOptionR = kFALSE;
00191    }
00192 
00193    if (opt.Contains("-k")) {
00194       gOptionK = kTRUE;
00195    } else {
00196       gOptionK = kFALSE;
00197    }
00198 
00199    stressGraphics(verbose);
00200 
00201    cleanup();
00202    return 0;
00203 }
00204 #endif
00205 
00206 
00207 //______________________________________________________________________________
00208 void stressGraphics(Int_t verbose = 0)
00209 {
00210    // Run all graphics stress tests.
00211 
00212    gErrorIgnoreLevel = 9999;
00213    gROOT->SetBatch();
00214 
00215    // Check if $ROOTSYS/tutorials/hsimple.root exists
00216    gLocalFile = new TFile("$(ROOTSYS)/tutorials/hsimple.root");
00217    if (gLocalFile->IsZombie()) {
00218       delete gLocalFile;
00219       gLocalFile = new TFile("hsimple.root");
00220       if (gLocalFile->IsZombie()) {
00221          delete gLocalFile;
00222          printf("Create $(ROOTSYS)/tutorials/hsimple.root\n");
00223          gROOT->Macro("$(ROOTSYS)/tutorials/hsimple.C");
00224          gLocalFile = new TFile("$(ROOTSYS)/tutorials/hsimple.root");
00225          if (gLocalFile->IsZombie()) {
00226             delete gLocalFile;
00227             printf("Could not create $(ROOTSYS)/tutorials/hsimple.root\n");
00228             return;
00229          }
00230       }
00231    }
00232    gErrorIgnoreLevel = 0;
00233 
00234    // Read the reference file "stressGraphics.ref"
00235    FILE *sg = fopen("stressGraphics.ref","r");
00236    char line[160];
00237    Int_t i = -1;
00238    while (fgets(line,160,sg)) {
00239       if (i>=0) {
00240          sscanf(&line[8]  ,"%d",&gPS1RefNb[i]);
00241          sscanf(&line[18] ,"%d",&gPS1ErrNb[i]);
00242          sscanf(&line[28] ,"%d",&gPDFRefNb[i]);
00243          sscanf(&line[38] ,"%d",&gPDFErrNb[i]);
00244          sscanf(&line[48] ,"%d",&gGIFRefNb[i]);
00245          sscanf(&line[58] ,"%d",&gGIFErrNb[i]);
00246          sscanf(&line[68] ,"%d",&gJPGRefNb[i]);
00247          sscanf(&line[78] ,"%d",&gJPGErrNb[i]);
00248          sscanf(&line[88] ,"%d",&gPNGRefNb[i]);
00249          sscanf(&line[98] ,"%d",&gPNGErrNb[i]);
00250          sscanf(&line[108],"%d",&gPS2RefNb[i]);
00251          sscanf(&line[118],"%d",&gPS2ErrNb[i]);
00252       }
00253       i++;
00254    }
00255    fclose(sg);
00256 
00257    gRandom->SetSeed(65539);
00258 
00259    if (gOptionR) {
00260       cout << "Test#   PS1Ref#   PS1Err#   PDFRef#   PDFErr#   GIFRef#   GIFErr#   JPGRef#   JPGErr#   PNGRef#   PNGErr#   PS2Ref#   PS2Err#" <<endl;
00261    } else {
00262       cout << "**********************************************************************" <<endl;
00263       cout << "*  Starting  Graphics - S T R E S S suite                            *" <<endl;
00264       cout << "**********************************************************************" <<endl;
00265    }
00266 
00267    gVerbose = verbose;
00268    gTestNum = 0;
00269 
00270    gBenchmark->Start("stressGraphics");
00271 
00272    if (!gOptionR) {
00273       cout << "*  Starting Basic Graphics - S T R E S S                             *" <<endl;
00274       cout << "**********************************************************************" <<endl;
00275    }
00276    tline        ();
00277    tmarker      ();
00278    tpolyline    ();
00279    patterns     ();
00280    ttext1       ();
00281    ttext2       ();
00282    tlatex1      ();
00283    tlatex2      ();
00284    tlatex3      ();
00285    tlatex4      ();
00286    tlatex5      ();
00287    kerning      ();
00288    itbf         ();
00289    transpad     ();
00290    statfitparam ();
00291    if (!gOptionR) {
00292       cout << "**********************************************************************" <<endl;
00293       cout << "*  Starting High Level 2D Primitives - S T R E S S                   *" <<endl;
00294       cout << "**********************************************************************" <<endl;
00295    }
00296    tgaxis1      ();
00297    tgaxis2      ();
00298    tgaxis3      ();
00299    tgaxis4      ();
00300    labels1      ();
00301    tellipse     ();
00302    feynman      ();
00303    tgraph1      ();
00304    tgraph2      ();
00305    tgraph3      ();
00306    tmultigraph1 ();
00307    tmultigraph2 ();
00308    waves        ();
00309    if (!gOptionR) {
00310       cout << "**********************************************************************" <<endl;
00311       cout << "*  Starting High Level 3D Primitives - S T R E S S                   *" <<endl;
00312       cout << "**********************************************************************" <<endl;
00313    }
00314    options2d1   ();
00315    options2d2   ();
00316    options2d3   ();
00317    options2d4   ();
00318    options2d5   ();
00319    earth        ();
00320    tgraph2d1    ();
00321    tgraph2d2    ();
00322    tgraph2d3    ();
00323    if (!gOptionR) {
00324       cout << "**********************************************************************" <<endl;
00325       cout << "*  Starting complex drawing and TPad - S T R E S S                   *" <<endl;
00326       cout << "**********************************************************************" <<endl;
00327    }
00328    ntuple1      ();
00329    quarks       ();
00330    timage       ();
00331    zoomtf1      ();
00332    zoomfit      ();
00333    parallelcoord();
00334 ///clonepad     ();
00335    if (!gOptionR) {
00336       cout << "**********************************************************************" <<endl;
00337 
00338       gBenchmark->Stop("stressGraphics");
00339 
00340       //Print table with results
00341       Bool_t UNIX = strcmp(gSystem->GetName(), "Unix") == 0;
00342       if (UNIX) {
00343          TString sp = gSystem->GetFromPipe("uname -a");
00344          sp.Resize(60);
00345          printf("*  SYS: %s\n",sp.Data());
00346          if (strstr(gSystem->GetBuildNode(),"Linux")) {
00347             sp = gSystem->GetFromPipe("lsb_release -d -s");
00348             printf("*  SYS: %s\n",sp.Data());
00349          }
00350          if (strstr(gSystem->GetBuildNode(),"Darwin")) {
00351             sp  = gSystem->GetFromPipe("sw_vers -productVersion");
00352             sp += " Mac OS X ";
00353             printf("*  SYS: %s\n",sp.Data());
00354          }
00355       } else {
00356          const Char_t *os = gSystem->Getenv("OS");
00357          if (!os) printf("*  SYS: Windows 95\n");
00358          else     printf("*  SYS: %s %s \n",os,gSystem->Getenv("PROCESSOR_IDENTIFIER"));
00359       }
00360 
00361       printf("**********************************************************************\n");
00362       printf("* ");
00363       gBenchmark->Print("stressGraphics");
00364 
00365       Double_t ct = gBenchmark->GetCpuTime("stressGraphics");
00366       //normalize at 860 rootmarks on pcbrun4
00367       const Double_t rootmarks = 860*(47.12/ct);
00368 
00369       printf("**********************************************************************\n");
00370       printf("*  ROOTMARKS =%6.1f   *  Root%-8s  %d/%d\n",rootmarks,gROOT->GetVersion(),
00371              gROOT->GetVersionDate(),gROOT->GetVersionTime());
00372       printf("**********************************************************************\n");
00373    }
00374 }
00375 
00376 
00377 //______________________________________________________________________________
00378 Int_t StatusPrint(TString &filename, Int_t id, const TString &title,
00379                   Int_t res, Int_t ref, Int_t err)
00380 {
00381    // Print test program number and its title
00382 
00383    if (!gOptionR) {
00384       if (id>0) {
00385          sprintf(gLine,"Test %2d: %s",id,title.Data());
00386       } else {
00387          sprintf(gLine,"       %s",title.Data());
00388       }
00389 
00390       const Int_t nch = strlen(gLine);
00391       if (TMath::Abs(res-ref)<=err) {
00392          cout << gLine;
00393          for (Int_t i = nch; i < 67; i++) cout << ".";
00394          cout << " OK" << endl;
00395          if (!gOptionK) gSystem->Unlink(filename.Data());
00396       } else {
00397          cout << gLine;
00398          Int_t ndots = 60;
00399          Int_t w = 3;
00400          if (gTestNum < 10) { ndots++; w--;}
00401          for (Int_t i = nch; i < ndots; i++) cout << ".";
00402          cout << setw(w) << gTestNum << " FAILED" << endl;
00403          cout << "         Result    = "  << res << endl;
00404          cout << "         Reference = "  << ref << endl;
00405          cout << "         Error     = "  << TMath::Abs(res-ref)
00406                                           << " (was " << err << ")"<< endl;
00407          return 1;
00408       }
00409    } else {
00410       if (id>0)  printf("%5d%10d%10d",id,res,err);
00411       if (id==0) printf("%10d%10d",res,err);
00412       if (id<0)  printf("%10d%10d\n",res,err);
00413    }
00414    return 0;
00415 }
00416 
00417 
00418 //______________________________________________________________________________
00419 Int_t FileSize (char *filename)
00420 {
00421    // Return the size of filename
00422 
00423    FileStat_t fs;
00424    gSystem->GetPathInfo(filename, fs);
00425    return (Int_t)fs.fSize;
00426 }
00427 
00428 
00429 //______________________________________________________________________________
00430 Int_t AnalysePS(const TString &filename)
00431 {
00432    // Analyse the PS file "filename" and return the number of character in the
00433    // meaningful part of the file. The variable part (date etc..) are not
00434    // counted.
00435 
00436    Bool_t counting = kFALSE;
00437    Int_t count = 0;
00438 
00439    char *line = new char[251];
00440    TString l;
00441    FILE *fp;
00442    Int_t status;
00443    if ((fp=fopen(filename.Data(), "r"))==NULL) {
00444       printf("ERROR1 : File can not open !..\n");
00445       return 0;
00446    }
00447    while((status=fscanf(fp, "%s", line)) != EOF) {
00448       l = line;
00449       if (l.Contains("%!PS-Adobe"))  counting = kFALSE;
00450       if (l.Contains("%%EndProlog")) counting = kTRUE;
00451       if (counting) count = count+l.Length();
00452    }
00453    if (gVerbose==1) printf(">>>>>>>>> Number of characters found in %s: %d\n",filename.Data(),count);
00454    return count;
00455 }
00456 
00457 
00458 //______________________________________________________________________________
00459 TCanvas *StartTest(Int_t w, Int_t h)
00460 {
00461    // Start Test:
00462    // Open the TCanvas C and set the acceptable error (number of characters)
00463 
00464    gTestNum++;
00465    gStyle->Reset();
00466    TCanvas *old = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("C");
00467    if (old) {
00468       if (old->IsOnHeap()) delete old;
00469    }
00470    TCanvas *C = new TCanvas("C","C",0,0,w,h);
00471    return C;
00472 }
00473 
00474 
00475 //______________________________________________________________________________
00476 void TestReport1(TCanvas *C, const TString &title)
00477 {
00478    // Report 1:
00479    // Draw the canvas generate as PostScript, count the number of characters in
00480    // the PS file and compare the result with the reference value.
00481 
00482    gErrorIgnoreLevel = 9999;
00483    sprintf(outfile,"sg1_%2.2d.ps",gTestNum);
00484 
00485    TPostScript *ps1 = new TPostScript(outfile, 111);
00486    C->Draw();
00487    ps1->Close();
00488    TString psfile = outfile;
00489    StatusPrint(psfile,  gTestNum, title, AnalysePS(outfile) ,
00490                                          gPS1RefNb[gTestNum-1],
00491                                          gPS1ErrNb[gTestNum-1]);
00492 
00493    sprintf(outfile,"sg%2.2d.pdf",gTestNum);
00494    C->cd(0);
00495    TPDF *pdf = new TPDF(outfile,111);
00496    C->Draw();
00497    pdf->Close();
00498    TString pdffile = outfile;
00499    StatusPrint(pdffile, 0, "  PDF output", FileSize(outfile),
00500                                            gPDFRefNb[gTestNum-1],
00501                                            gPDFErrNb[gTestNum-1]);
00502 
00503    sprintf(outfile,"sg%2.2d.gif",gTestNum);
00504    C->cd(0);
00505    C->SaveAs(outfile);
00506    TString giffile = outfile;
00507    StatusPrint(giffile, 0, "  GIF output", FileSize(outfile),
00508                                            gGIFRefNb[gTestNum-1],
00509                                            gGIFErrNb[gTestNum-1]);
00510 
00511    sprintf(outfile,"sg%2.2d.jpg",gTestNum);
00512    C->cd(0);
00513    C->SaveAs(outfile);
00514    TString jpgfile = outfile;
00515    StatusPrint(jpgfile, 0, "  JPG output", FileSize(outfile),
00516                                            gJPGRefNb[gTestNum-1],
00517                                            gJPGErrNb[gTestNum-1]);
00518 
00519    sprintf(outfile,"sg%2.2d.png",gTestNum);
00520    C->cd(0);
00521    C->SaveAs(outfile);
00522    TString pngfile = outfile;
00523    StatusPrint(pngfile, 0, "  PNG output", FileSize(outfile),
00524                                            gPNGRefNb[gTestNum-1],
00525                                            gPNGErrNb[gTestNum-1]);
00526 
00527    gErrorIgnoreLevel = 0;
00528 
00529    return;
00530 }
00531 
00532 
00533 //______________________________________________________________________________
00534 void DoCcode(TCanvas *C)
00535 {
00536    // Generate the C code conresponding to the canvas C.
00537 
00538    gErrorIgnoreLevel = 9999;
00539 
00540    sprintf(gCfile,"sg%2.2d.C",gTestNum);
00541 
00542    C->SaveAs(gCfile);
00543    if (C) {delete C; C = 0;}
00544    gErrorIgnoreLevel = 0;
00545    return;
00546 }
00547 
00548 
00549 //______________________________________________________________________________
00550 void TestReport2()
00551 {
00552    // Report 2:
00553    // Draw the canvas generate as .C, generate the corresponding PostScript
00554    // file (using gPad), count the number of characters in it and compare the
00555    // result with the reference value.
00556 
00557    sprintf(outfile,"sg2_%2.2d.ps",gTestNum);
00558 
00559    gErrorIgnoreLevel = 9999;
00560    sprintf(gCfile,".x sg%2.2d.C",gTestNum);
00561    gROOT->ProcessLine(gCfile);
00562    gPad->SaveAs(outfile);
00563    gErrorIgnoreLevel = 0;
00564 
00565    TString psfile = outfile;
00566    Int_t i = StatusPrint(psfile,-1, "  C file result", AnalysePS(outfile),
00567                                                        gPS2RefNb[gTestNum-1],
00568                                                        gPS2ErrNb[gTestNum-1]);
00569 
00570    sprintf(gCfile,"sg%2.2d.C",gTestNum);
00571    if (!gOptionK && !i) gSystem->Unlink(gCfile);
00572 
00573    return;
00574 }
00575 
00576 
00577 //______________________________________________________________________________
00578 void tline()
00579 {
00580    // Test TLine.
00581 
00582    TCanvas *C = StartTest(800,800);
00583 
00584    TLine *l1 = new TLine(0.1,0.1,0.9,0.1);
00585    l1->SetLineColor(1); l1->SetLineWidth(1) ; l1->SetLineStyle(1) ; l1->Draw();
00586    TLine *l2 = new TLine(0.1,0.2,0.9,0.2);
00587    l2->SetLineColor(2); l2->SetLineWidth(2) ; l2->SetLineStyle(2) ; l2->Draw();
00588    TLine *l3 = new TLine(0.1,0.3,0.9,0.3);
00589    l3->SetLineColor(3); l3->SetLineWidth(3) ; l3->SetLineStyle(3) ; l3->Draw();
00590    TLine *l4 = new TLine(0.1,0.4,0.9,0.4);
00591    l4->SetLineColor(4); l4->SetLineWidth(4) ; l4->SetLineStyle(4) ; l4->Draw();
00592    TLine *l5 = new TLine(0.1,0.5,0.9,0.5);
00593    l5->SetLineColor(5); l5->SetLineWidth(5) ; l5->SetLineStyle(5) ; l5->Draw();
00594    TLine *l6 = new TLine(0.1,0.6,0.9,0.6);
00595    l6->SetLineColor(6); l6->SetLineWidth(6) ; l6->SetLineStyle(6) ; l6->Draw();
00596    TLine *l7 = new TLine(0.1,0.7,0.9,0.7);
00597    l7->SetLineColor(7); l7->SetLineWidth(7) ; l7->SetLineStyle(7) ; l7->Draw();
00598    TLine *l8 = new TLine(0.1,0.8,0.9,0.8);
00599    l8->SetLineColor(8); l8->SetLineWidth(8) ; l8->SetLineStyle(8) ; l8->Draw();
00600    TLine *l9 = new TLine(0.1,0.9,0.9,0.9);
00601    l9->SetLineColor(9); l9->SetLineWidth(9) ; l9->SetLineStyle(9) ; l9->Draw();
00602 
00603    TestReport1(C, "TLine");
00604    DoCcode(C);
00605    TestReport2();
00606 };
00607 
00608 
00609 //______________________________________________________________________________
00610 void tmarker()
00611 {
00612    // Test TMarker
00613 
00614    TCanvas *C = StartTest(100,800);
00615 
00616    C->Range(0,0,1,1);
00617    C->SetFillColor(0);
00618    C->SetBorderSize(2);
00619    int i;
00620    Double_t x = 0.5;
00621    Double_t y = 0.1;
00622    Double_t dy = 0.04;
00623    for (i = 1; i<=7; i++) {
00624       tmarker_draw(x, y, i, dy);
00625       y = y+dy;
00626    }
00627    for (i = 20; i<=34; i++) {
00628       tmarker_draw(x, y, i, dy);
00629       y = y+dy;
00630    }
00631 
00632    TestReport1(C, "TMarker");
00633    DoCcode(C);
00634    TestReport2();
00635 };
00636 
00637 
00638 //______________________________________________________________________________
00639 void tmarker_draw(Double_t x, Double_t y, Int_t mt, Double_t d)
00640 {
00641    // Auxiliary function used by "tmarker"
00642 
00643    double dy=d/3;
00644    TMarker *m  = new TMarker(x+0.1, y, mt);
00645    TText   *t  = new TText(x-0.1, y, Form("%d",mt));
00646    TLine   *l1 = new TLine(0,y,1,y);
00647    TLine   *l2 = new TLine(0,y+dy,1,y+dy);
00648    TLine   *l3 = new TLine(0,y-dy,1,y-dy);
00649    l2->SetLineStyle(2);
00650    l3->SetLineStyle(2);
00651    m->SetMarkerSize(3.6);
00652    m->SetMarkerColor(kRed);
00653    t->SetTextAlign(32);
00654    t->SetTextSize(0.3);
00655    t->Draw();
00656    l1->Draw();
00657    l2->Draw();
00658    l3->Draw();
00659    m->Draw();
00660 }
00661 
00662 
00663 //______________________________________________________________________________
00664 void tpolyline()
00665 {
00666    // Test TPolyLine
00667 
00668    TCanvas *C = StartTest(700,500);
00669 
00670    C->Range(0,30,11,650);
00671    Double_t x[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
00672    Double_t y[10] = {200, 300, 300, 200, 200, 100, 10, 580, 10, 600};
00673    TPolyLine *p = new TPolyLine(10,x,y);
00674    p->SetLineWidth(3);
00675    p->SetLineColor(2);
00676    p->Draw("F");
00677    p->Draw("");
00678 
00679    TestReport1(C, "TPolyLine");
00680    DoCcode(C);
00681    TestReport2();
00682 };
00683 
00684 
00685 //______________________________________________________________________________
00686 void patterns()
00687 {
00688    // Test Patterns
00689 
00690    TCanvas *C = StartTest(700,900);
00691 
00692    C->Range(0,0,1,1);
00693    C->SetBorderSize(2);
00694    C->SetFrameFillColor(0);
00695    Double_t bh = 0.059;
00696    Double_t db = 0.01;
00697    Double_t y  = 0.995;
00698    Int_t i,j=3001;
00699    for (i=1; i<=5; i++) {
00700       patterns_box(j++, 0.01, y-bh, 0.19, y);
00701       patterns_box(j++, 0.21, y-bh, 0.39, y);
00702       patterns_box(j++, 0.41, y-bh, 0.59, y);
00703       patterns_box(j++, 0.61, y-bh, 0.79, y);
00704       patterns_box(j++, 0.81, y-bh, 0.99, y);
00705       y = y-bh-db;
00706    }
00707    y = y-3*db;
00708    gStyle->SetHatchesSpacing(2.0);
00709    gStyle->SetHatchesLineWidth(3);
00710    Int_t j1 = 3144;
00711    Int_t j2 = 3305;
00712    Int_t j3 = 3350;
00713    Int_t j4 = 3490;
00714    Int_t j5 = 3609;
00715    for (i=1; i<=9; i++) {
00716       if (i==6) {j2 += 10; j3 += 1; j4 += 1; j5 += 10;}
00717       if (i==5) {j4 -= 10; j5 -= 1;}
00718       patterns_box(j1, 0.01, y-bh, 0.19, y);
00719       patterns_box(j2, 0.21, y-bh, 0.39, y);
00720       patterns_box(j3, 0.41, y-bh, 0.59, y);
00721       patterns_box(j4, 0.61, y-bh, 0.79, y);
00722       patterns_box(j5, 0.81, y-bh, 0.99, y);
00723       j1 += 100;
00724       j2 += 10;
00725       j3 += 1;
00726       j4 -= 9;
00727       j5 += 9;
00728       y = y-bh-db;
00729    }
00730 
00731    TestReport1(C, "Fill patterns");
00732    DoCcode(C);
00733    TestReport2();
00734 };
00735 
00736 
00737 //______________________________________________________________________________
00738 void patterns_box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t  y2)
00739 {
00740    // Auxiliary function used by "patterns"
00741 
00742    TBox b;
00743    b.SetFillColor(1);
00744    b.SetFillStyle(pat);
00745    b.DrawBox(x1,y1,x2,y2);
00746    b.SetFillStyle(0);
00747    b.DrawBox(x1,y1,x2,y2);
00748    b.SetFillColor(0);
00749    b.SetFillStyle(1000);
00750    Double_t dx = (x2-x1)/3;
00751    Double_t dy = (y2-y1)/3;
00752    Double_t h  = (y2-y1)/3;
00753    b.DrawBox(x1+dx, y1+dy, x2-dx, y2-dy);
00754    b.SetFillStyle(0);
00755    b.DrawBox(x1+dx, y1+dy, x2-dx, y2-dy);
00756    TLatex l;
00757    l.SetTextAlign(22);
00758    l.SetTextSize(h);
00759    l.DrawLatex((x1+x2)/2, (y1+y2)/2, Form("%d",pat));
00760 }
00761 
00762 
00763 //______________________________________________________________________________
00764 void ttext1()
00765 {
00766    // 1st TText test.
00767 
00768    TCanvas *C = StartTest(900,500);
00769 
00770    C->Range(0,0,1,1);
00771    C->SetBorderSize(2);
00772    C->SetFrameFillColor(0);
00773    TLine *lv = new TLine(0.5,0.0,0.5,1.0);
00774    lv->Draw();
00775    for (float s=0.1; s<1.0 ; s+=0.1) {
00776       TLine *lh = new TLine(0.,s,1.,s);
00777       lh->Draw();
00778    }
00779    TText *tex1b = new TText(0.02,0.4,"jgabcdefhiklmnopqrstuvwxyz_{}");
00780    // 161 is not a valid text font. This tests if the protection against
00781    // invalid text font is working.
00782    tex1b->SetTextFont(161);
00783    tex1b->SetTextColor(2);
00784    tex1b->SetTextAngle(0);
00785    tex1b->SetTextAlign(11);
00786    tex1b->SetTextSize(0.1);
00787    tex1b->Draw();
00788    TText *tex1 = new TText(0.5,0.1,"j0al {&`ag}_:^)Jj");
00789    tex1->SetTextFont(41);
00790    tex1->SetTextColor(2);
00791    tex1->SetTextAngle( 0);
00792    tex1->SetTextAlign(21);
00793    tex1->SetTextSize(0.15);
00794    tex1->Draw();
00795    TText *tex2 = new TText(0.5,0.5,"j0Al {&`ag}_:^)Jj");
00796    tex2->SetTextColor(3);
00797    tex2->SetTextFont(21);
00798    tex2->SetTextAlign(21);
00799    tex2->SetTextSize(0.1);
00800    tex2->Draw();
00801    TText *tex3 = new TText(0.5,0.3,"j0Al {&`ag}_:^)Jj");
00802    tex3->SetTextColor(4);
00803    tex3->SetTextFont(31);
00804    tex3->SetTextAlign(31);
00805    tex3->SetTextSize(0.1);
00806    tex3->Draw();
00807    TText *tex4 = new TText(0.5,0.8,"j0Al {&`ag}_:^)Jj");
00808    tex4->SetTextColor(5);
00809    tex4->SetTextFont(71);
00810    tex4->SetTextAlign(22);
00811    tex4->SetTextSize(0.07);
00812    tex4->Draw();
00813    TText *tex5 = new TText(0.5,0.7,"13 j0Al {&`ag}_:^)Jj");
00814    tex5->SetTextColor(6);
00815    tex5->SetTextFont(51);
00816    tex5->SetTextAlign(13);
00817    tex5->SetTextSize(0.1);
00818    tex5->Draw();
00819 
00820    TestReport1(C, "TText 1 (Text attributes)");
00821    DoCcode(C);
00822    TestReport2();
00823 }
00824 
00825 
00826 //______________________________________________________________________________
00827 void ttext2()
00828 {
00829    // 2nd TText test. A very long text string.
00830 
00831    TCanvas *C = StartTest(600,600);
00832 
00833    TText t(0.001,0.5,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
00834    t.SetTextFont(42); t.SetTextSize(0.02);
00835    t.Draw();
00836 
00837    TestReport1(C, "TText 2 (A very long text string)");
00838    DoCcode(C);
00839    TestReport2();
00840 }
00841 
00842 
00843 //______________________________________________________________________________
00844 void tlatex1()
00845 {
00846    // 1st TLatex test.
00847 
00848    TCanvas *C = StartTest(600,700);
00849 
00850    TLatex l;
00851    l.SetTextAlign(12);
00852    l.SetTextSize(0.04);
00853    l.DrawLatex(0.1,0.9,"1) C(x) = d #sqrt{#frac{2}{#lambdaD}}  #int^{x}_{0}cos(#frac{#pi}{2}t^{2})dt");
00854    l.DrawLatex(0.1,0.7,"2) C(x) = d #sqrt{#frac{2}{#lambdaD}}  #int^{x}cos(#frac{#pi}{2}t^{2})dt");
00855    l.DrawLatex(0.1,0.5,"3) R = |A|^{2} = #frac{1}{2}#left(#[]{#frac{1}{2}+C(V)}^{2}+#[]{#frac{1}{2}+S(V)}^{2}#right)");
00856    l.DrawLatex(0.1,0.3,"4) F(t) = #sum_{i=-#infty}^{#infty}A(i)cos#[]{#frac{i}{t+i}}");
00857    l.DrawLatex(0.1,0.1,"5) {}_{3}^{7}Li");
00858 
00859    TestReport1(C, "TLatex 1");
00860    DoCcode(C);
00861    TestReport2();
00862 }
00863 
00864 
00865 //______________________________________________________________________________
00866 void tlatex2()
00867 {
00868    // 2nd TLatex test.
00869 
00870    TCanvas *C = StartTest(700,500);
00871 
00872    TLatex l;
00873    l.SetTextAlign(23);
00874    l.SetTextSize(0.1);
00875    l.DrawLatex(0.5,0.95,"e^{+}e^{-}#rightarrowZ^{0}#rightarrowI#bar{I}, q#bar{q}");
00876    l.DrawLatex(0.5,0.75,"|#vec{a}#bullet#vec{b}|=#Sigmaa^{i}_{jk}+b^{bj}_{i}");
00877    l.DrawLatex(0.5,0.5,"i(#partial_{#mu}#bar{#psi}#gamma^{#mu}+m#bar{#psi})=0#Leftrightarrow(#Box+m^{2})#psi=0");
00878    l.DrawLatex(0.5,0.3,"L_{em}=eJ^{#mu}_{em}A_{#mu} , ^{}J^{#mu}_{em}=#bar{I}#gamma_{#mu}I , M^{j}_{i}=#SigmaA_{#alpha}#tau^{#alphaj}_{i}");
00879 
00880    TestReport1(C, "TLatex 2");
00881    DoCcode(C);
00882    TestReport2();
00883 }
00884 
00885 
00886 //______________________________________________________________________________
00887 void tlatex3()
00888 {
00889    // 3rd TLatex test.
00890 
00891    TCanvas *C = StartTest(700,500);
00892 
00893    TPaveText pt(.05,.1,.95,.8);
00894    pt.AddText("#frac{2s}{#pi#alpha^{2}}  #frac{d#sigma}{dcos#theta} (e^{+}e^{-} #rightarrow f#bar{f} ) = \
00895    #left| #frac{1}{1 - #Delta#alpha} #right|^{2} (1+cos^{2}#theta)");
00896    pt.AddText("+ 4 Re #left{ #frac{2}{1 - #Delta#alpha} #chi(s) #[]{#hat{g}_{#nu}^{e}#hat{g}_{#nu}^{f} \
00897    (1 + cos^{2}#theta) + 2 #hat{g}_{a}^{e}#hat{g}_{a}^{f} cos#theta) } #right}");
00898    pt.AddText("+ 16#left|#chi(s)#right|^{2}\
00899    #left[(#hat{g}_{a}^{e}^{2} + #hat{g}_{v}^{e}^{2})\
00900    (#hat{g}_{a}^{f}^{2} + #hat{g}_{v}^{f}^{2})(1+cos^{2}#theta)\
00901    + 8 #hat{g}_{a}^{e} #hat{g}_{a}^{f} #hat{g}_{v}^{e} #hat{g}_{v}^{f}cos#theta#right] ");
00902    pt.SetLabel("Born equation");
00903    pt.Draw();
00904 
00905    TestReport1(C, "TLatex 3 (TLatex in TPaveText)");
00906    DoCcode(C);
00907    TestReport2();
00908 }
00909 
00910 
00911 //______________________________________________________________________________
00912 void tlatex4()
00913 {
00914    // 4th TLatex test.
00915 
00916    TCanvas *C = StartTest(600,700);
00917 
00918    TLatex l;
00919    l.SetTextSize(0.03);
00920    l.SetTextAlign(22);
00921    l.DrawLatex(0.165, 0.95, "Lower case");
00922    l.DrawLatex(0.495, 0.95, "Upper case");
00923    l.DrawLatex(0.825, 0.95, "Variations");
00924    l.SetTextAlign(12);
00925    float y, x1, x2;
00926    y = 0.90; x1 = 0.07; x2 = x1+0.2;
00927                  l.DrawLatex(x1, y, "alpha : ")   ; l.DrawLatex(x2, y, "#alpha");
00928    y -= 0.0375 ; l.DrawLatex(x1, y, "beta : ")    ; l.DrawLatex(x2, y, "#beta");
00929    y -= 0.0375 ; l.DrawLatex(x1, y, "gamma : ")   ; l.DrawLatex(x2, y, "#gamma");
00930    y -= 0.0375 ; l.DrawLatex(x1, y, "delta : ")   ; l.DrawLatex(x2, y, "#delta");
00931    y -= 0.0375 ; l.DrawLatex(x1, y, "epsilon : ") ; l.DrawLatex(x2, y, "#epsilon");
00932    y -= 0.0375 ; l.DrawLatex(x1, y, "zeta : ")    ; l.DrawLatex(x2, y, "#zeta");
00933    y -= 0.0375 ; l.DrawLatex(x1, y, "eta : ")     ; l.DrawLatex(x2, y, "#eta");
00934    y -= 0.0375 ; l.DrawLatex(x1, y, "theta : ")   ; l.DrawLatex(x2, y, "#theta");
00935    y -= 0.0375 ; l.DrawLatex(x1, y, "iota : ")    ; l.DrawLatex(x2, y, "#iota");
00936    y -= 0.0375 ; l.DrawLatex(x1, y, "kappa : ")   ; l.DrawLatex(x2, y, "#kappa");
00937    y -= 0.0375 ; l.DrawLatex(x1, y, "lambda : ")  ; l.DrawLatex(x2, y, "#lambda");
00938    y -= 0.0375 ; l.DrawLatex(x1, y, "mu : ")      ; l.DrawLatex(x2, y, "#mu");
00939    y -= 0.0375 ; l.DrawLatex(x1, y, "nu : ")      ; l.DrawLatex(x2, y, "#nu");
00940    y -= 0.0375 ; l.DrawLatex(x1, y, "xi : ")      ; l.DrawLatex(x2, y, "#xi");
00941    y -= 0.0375 ; l.DrawLatex(x1, y, "omicron : ") ; l.DrawLatex(x2, y, "#omicron");
00942    y -= 0.0375 ; l.DrawLatex(x1, y, "pi : ")      ; l.DrawLatex(x2, y, "#pi");
00943    y -= 0.0375 ; l.DrawLatex(x1, y, "rho : ")     ; l.DrawLatex(x2, y, "#rho");
00944    y -= 0.0375 ; l.DrawLatex(x1, y, "sigma : ")   ; l.DrawLatex(x2, y, "#sigma");
00945    y -= 0.0375 ; l.DrawLatex(x1, y, "tau : ")     ; l.DrawLatex(x2, y, "#tau");
00946    y -= 0.0375 ; l.DrawLatex(x1, y, "upsilon : ") ; l.DrawLatex(x2, y, "#upsilon");
00947    y -= 0.0375 ; l.DrawLatex(x1, y, "phi : ")     ; l.DrawLatex(x2, y, "#phi");
00948    y -= 0.0375 ; l.DrawLatex(x1, y, "chi : ")     ; l.DrawLatex(x2, y, "#chi");
00949    y -= 0.0375 ; l.DrawLatex(x1, y, "psi : ")     ; l.DrawLatex(x2, y, "#psi");
00950    y -= 0.0375 ; l.DrawLatex(x1, y, "omega : ")   ; l.DrawLatex(x2, y, "#omega");
00951    y = 0.90; x1 = 0.40; x2 = x1+0.2;
00952                  l.DrawLatex(x1, y, "Alpha : ")   ; l.DrawLatex(x2, y, "#Alpha");
00953    y -= 0.0375 ; l.DrawLatex(x1, y, "Beta : ")    ; l.DrawLatex(x2, y, "#Beta");
00954    y -= 0.0375 ; l.DrawLatex(x1, y, "Gamma : ")   ; l.DrawLatex(x2, y, "#Gamma");
00955    y -= 0.0375 ; l.DrawLatex(x1, y, "Delta : ")   ; l.DrawLatex(x2, y, "#Delta");
00956    y -= 0.0375 ; l.DrawLatex(x1, y, "Epsilon : ") ; l.DrawLatex(x2, y, "#Epsilon");
00957    y -= 0.0375 ; l.DrawLatex(x1, y, "Zeta : ")    ; l.DrawLatex(x2, y, "#Zeta");
00958    y -= 0.0375 ; l.DrawLatex(x1, y, "Eta : ")     ; l.DrawLatex(x2, y, "#Eta");
00959    y -= 0.0375 ; l.DrawLatex(x1, y, "Theta : ")   ; l.DrawLatex(x2, y, "#Theta");
00960    y -= 0.0375 ; l.DrawLatex(x1, y, "Iota : ")    ; l.DrawLatex(x2, y, "#Iota");
00961    y -= 0.0375 ; l.DrawLatex(x1, y, "Kappa : ")   ; l.DrawLatex(x2, y, "#Kappa");
00962    y -= 0.0375 ; l.DrawLatex(x1, y, "Lambda : ")  ; l.DrawLatex(x2, y, "#Lambda");
00963    y -= 0.0375 ; l.DrawLatex(x1, y, "Mu : ")      ; l.DrawLatex(x2, y, "#Mu");
00964    y -= 0.0375 ; l.DrawLatex(x1, y, "Nu : ")      ; l.DrawLatex(x2, y, "#Nu");
00965    y -= 0.0375 ; l.DrawLatex(x1, y, "Xi : ")      ; l.DrawLatex(x2, y, "#Xi");
00966    y -= 0.0375 ; l.DrawLatex(x1, y, "Omicron : ") ; l.DrawLatex(x2, y, "#Omicron");
00967    y -= 0.0375 ; l.DrawLatex(x1, y, "Pi : ")      ; l.DrawLatex(x2, y, "#Pi");
00968    y -= 0.0375 ; l.DrawLatex(x1, y, "Rho : ")     ; l.DrawLatex(x2, y, "#Rho");
00969    y -= 0.0375 ; l.DrawLatex(x1, y, "Sigma : ")   ; l.DrawLatex(x2, y, "#Sigma");
00970    y -= 0.0375 ; l.DrawLatex(x1, y, "Tau : ")     ; l.DrawLatex(x2, y, "#Tau");
00971    y -= 0.0375 ; l.DrawLatex(x1, y, "Upsilon : ") ; l.DrawLatex(x2, y, "#Upsilon");
00972    y -= 0.0375 ; l.DrawLatex(x1, y, "Phi : ")     ; l.DrawLatex(x2, y, "#Phi");
00973    y -= 0.0375 ; l.DrawLatex(x1, y, "Chi : ")     ; l.DrawLatex(x2, y, "#Chi");
00974    y -= 0.0375 ; l.DrawLatex(x1, y, "Psi : ")     ; l.DrawLatex(x2, y, "#Psi");
00975    y -= 0.0375 ; l.DrawLatex(x1, y, "Omega : ")   ; l.DrawLatex(x2, y, "#Omega");
00976    x1 = 0.73; x2 = x1+0.2;
00977    y = 0.7500 ; l.DrawLatex(x1, y, "varepsilon : ") ; l.DrawLatex(x2, y, "#varepsilon");
00978    y = 0.6375 ; l.DrawLatex(x1, y, "vartheta : ")   ; l.DrawLatex(x2, y, "#vartheta");
00979    y = 0.2625 ; l.DrawLatex(x1, y, "varsigma : ")   ; l.DrawLatex(x2, y, "#varsigma");
00980    y = 0.1875 ; l.DrawLatex(x1, y, "varUpsilon : ") ; l.DrawLatex(x2, y, "#varUpsilon");
00981    y = 0.1500 ; l.DrawLatex(x1, y, "varphi : ")     ; l.DrawLatex(x2, y, "#varphi");
00982    y = 0.0375 ; l.DrawLatex(x1, y, "varomega : ")   ; l.DrawLatex(x2, y, "#varomega");
00983 
00984    TestReport1(C, "TLatex 4 (Greek letters)");
00985    DoCcode(C);
00986    TestReport2();
00987 }
00988 
00989 
00990 //______________________________________________________________________________
00991 void tlatex5()
00992 {
00993    // 5th TLatex test.
00994 
00995    TCanvas *C = StartTest(600,600);
00996 
00997    TLatex l;
00998    l.SetTextSize(0.03);
00999    l.SetTextAlign(12);
01000    float y, step, x1, x2;
01001    y = 0.96; step = 0.0465; x1 = 0.02; x2 = x1+0.04;
01002                l.DrawLatex(x1, y, "#club")           ; l.DrawText(x2, y, "#club");
01003    y -= step ; l.DrawLatex(x1, y, "#voidn")          ; l.DrawText(x2, y, "#voidn");
01004    y -= step ; l.DrawLatex(x1, y, "#leq")            ; l.DrawText(x2, y, "#leq");
01005    y -= step ; l.DrawLatex(x1, y, "#approx")         ; l.DrawText(x2, y, "#approx");
01006    y -= step ; l.DrawLatex(x1, y, "#in")             ; l.DrawText(x2, y, "#in");
01007    y -= step ; l.DrawLatex(x1, y, "#supset")         ; l.DrawText(x2, y, "#supset");
01008    y -= step ; l.DrawLatex(x1, y, "#cap")            ; l.DrawText(x2, y, "#cap");
01009    y -= step ; l.DrawLatex(x1, y, "#ocopyright")     ; l.DrawText(x2, y, "#ocopyright");
01010    y -= step ; l.DrawLatex(x1, y, "#trademark")      ; l.DrawText(x2, y, "#trademark");
01011    y -= step ; l.DrawLatex(x1, y, "#times")          ; l.DrawText(x2, y, "#times");
01012    y -= step ; l.DrawLatex(x1, y, "#bullet")         ; l.DrawText(x2, y, "#bullet");
01013    y -= step ; l.DrawLatex(x1, y, "#voidb")          ; l.DrawText(x2, y, "#voidb");
01014    y -= step ; l.DrawLatex(x1, y, "#doublequote")    ; l.DrawText(x2, y, "#doublequote");
01015    y -= step ; l.DrawLatex(x1, y, "#lbar")           ; l.DrawText(x2, y, "#lbar");
01016    y -= step ; l.DrawLatex(x1, y, "#arcbottom")      ; l.DrawText(x2, y, "#arcbottom");
01017    y -= step ; l.DrawLatex(x1, y, "#downarrow")      ; l.DrawText(x2, y, "#downarrow");
01018    y -= step ; l.DrawLatex(x1, y, "#leftrightarrow") ; l.DrawText(x2, y, "#leftrightarrow");
01019    y -= step ; l.DrawLatex(x1, y, "#Downarrow")      ; l.DrawText(x2, y, "#Downarrow");
01020    y -= step ; l.DrawLatex(x1, y, "#Leftrightarrow") ; l.DrawText(x2, y, "#Leftrightarrow");
01021    y -= step ; l.DrawLatex(x1, y, "#void8")          ; l.DrawText(x2, y, "#void8");
01022    y -= step ; l.DrawLatex(x1, y, "#hbar")           ; l.DrawText(x2, y, "#hbar");
01023    y = 0.96; step = 0.0465; x1 = 0.27; x2 = x1+0.04;
01024                l.DrawLatex(x1, y, "#diamond")        ; l.DrawText(x2, y, "#diamond");
01025    y -= step ; l.DrawLatex(x1, y, "#aleph")          ; l.DrawText(x2, y, "#aleph");
01026    y -= step ; l.DrawLatex(x1, y, "#geq")            ; l.DrawText(x2, y, "#geq");
01027    y -= step ; l.DrawLatex(x1, y, "#neq")            ; l.DrawText(x2, y, "#neq");
01028    y -= step ; l.DrawLatex(x1, y, "#notin")          ; l.DrawText(x2, y, "#notin");
01029    y -= step ; l.DrawLatex(x1, y, "#subseteq")       ; l.DrawText(x2, y, "#subseteq");
01030    y -= step ; l.DrawLatex(x1, y, "#cup")            ; l.DrawText(x2, y, "#cup");
01031    y -= step ; l.DrawLatex(x1, y, "#copyright")      ; l.DrawText(x2, y, "#copyright");
01032    y -= step ; l.DrawLatex(x1, y, "#void3")          ; l.DrawText(x2, y, "#void3");
01033    y -= step ; l.DrawLatex(x1, y, "#divide")         ; l.DrawText(x2, y, "#divide");
01034    y -= step ; l.DrawLatex(x1, y, "#circ")           ; l.DrawText(x2, y, "#circ");
01035    y -= step ; l.DrawLatex(x1, y, "#infty")          ; l.DrawText(x2, y, "#infty");
01036    y -= step ; l.DrawLatex(x1, y, "#angle")          ; l.DrawText(x2, y, "#angle");
01037    y -= step ; l.DrawLatex(x1, y, "#cbar")           ; l.DrawText(x2, y, "#cbar");
01038    y -= step ; l.DrawLatex(x1, y, "#arctop")         ; l.DrawText(x2, y, "#arctop");
01039    y -= step ; l.DrawLatex(x1, y, "#leftarrow")      ; l.DrawText(x2, y, "#leftarrow");
01040    y -= step ; l.DrawLatex(x1, y, "#otimes")         ; l.DrawText(x2, y, "#otimes");
01041    y -= step ; l.DrawLatex(x1, y, "#Leftarrow")      ; l.DrawText(x2, y, "#Leftarrow");
01042    y -= step ; l.DrawLatex(x1, y, "#prod")           ; l.DrawText(x2, y, "#prod");
01043    y -= step ; l.DrawLatex(x1, y, "#Box")            ; l.DrawText(x2, y, "#Box");
01044    y -= step ; l.DrawLatex(x1, y, "#parallel")       ; l.DrawText(x2, y, "#parallel");
01045    y = 0.96; step = 0.0465; x1 = 0.52; x2 = x1+0.04;
01046                l.DrawLatex(x1, y, "#heart")          ; l.DrawText(x2, y, "#heart");
01047    y -= step ; l.DrawLatex(x1, y, "#Jgothic")        ; l.DrawText(x2, y, "#Jgothic");
01048    y -= step ; l.DrawLatex(x1, y, "#LT")             ; l.DrawText(x2, y, "#LT");
01049    y -= step ; l.DrawLatex(x1, y, "#equiv")          ; l.DrawText(x2, y, "#equiv");
01050    y -= step ; l.DrawLatex(x1, y, "#subset")         ; l.DrawText(x2, y, "#subset");
01051    y -= step ; l.DrawLatex(x1, y, "#supseteq")       ; l.DrawText(x2, y, "#supseteq");
01052    y -= step ; l.DrawLatex(x1, y, "#wedge")          ; l.DrawText(x2, y, "#wedge");
01053    y -= step ; l.DrawLatex(x1, y, "#oright")         ; l.DrawText(x2, y, "#oright");
01054    y -= step ; l.DrawLatex(x1, y, "#AA")             ; l.DrawText(x2, y, "#AA");
01055    y -= step ; l.DrawLatex(x1, y, "#pm")             ; l.DrawText(x2, y, "#pm");
01056    y -= step ; l.DrawLatex(x1, y, "#3dots")          ; l.DrawText(x2, y, "#3dots");
01057    y -= step ; l.DrawLatex(x1, y, "#nabla")          ; l.DrawText(x2, y, "#nabla");
01058    y -= step ; l.DrawLatex(x1, y, "#downleftarrow")  ; l.DrawText(x2, y, "#downleftarrow");
01059    y -= step ; l.DrawLatex(x1, y, "#topbar")         ; l.DrawText(x2, y, "#topbar");
01060    y -= step ; l.DrawLatex(x1, y, "#arcbar")         ; l.DrawText(x2, y, "#arcbar");
01061    y -= step ; l.DrawLatex(x1, y, "#uparrow")        ; l.DrawText(x2, y, "#uparrow");
01062    y -= step ; l.DrawLatex(x1, y, "#oplus")          ; l.DrawText(x2, y, "#oplus");
01063    y -= step ; l.DrawLatex(x1, y, "#Uparrow")        ; l.DrawText(x2, y, "#Uparrow");
01064    y -= step ; l.DrawLatex(x1, y-0.01, "#sum")       ; l.DrawText(x2, y, "#sum");
01065    y -= step ; l.DrawLatex(x1, y, "#perp")           ; l.DrawText(x2, y, "#perp");
01066    y = 0.96; step = 0.0465; x1 = 0.77; x2 = x1+0.04;
01067                l.DrawLatex(x1, y, "#spade")          ; l.DrawText(x2, y, "#spade");
01068    y -= step ; l.DrawLatex(x1, y, "#Rgothic")        ; l.DrawText(x2, y, "#Rgothic");
01069    y -= step ; l.DrawLatex(x1, y, "#GT")             ; l.DrawText(x2, y, "#GT");
01070    y -= step ; l.DrawLatex(x1, y, "#propto")         ; l.DrawText(x2, y, "#propto");
01071    y -= step ; l.DrawLatex(x1, y, "#notsubset")      ; l.DrawText(x2, y, "#notsubset");
01072    y -= step ; l.DrawLatex(x1, y, "#oslash")         ; l.DrawText(x2, y, "#oslash");
01073    y -= step ; l.DrawLatex(x1, y, "#vee")            ; l.DrawText(x2, y, "#vee");
01074    y -= step ; l.DrawLatex(x1, y, "#void1")          ; l.DrawText(x2, y, "#void1");
01075    y -= step ; l.DrawLatex(x1, y, "#aa")             ; l.DrawText(x2, y, "#aa");
01076    y -= step ; l.DrawLatex(x1, y, "#/")              ; l.DrawText(x2, y, "#/");
01077    y -= step ; l.DrawLatex(x1, y, "#upoint")         ; l.DrawText(x2, y, "#upoint");
01078    y -= step ; l.DrawLatex(x1, y, "#partial")        ; l.DrawText(x2, y, "#partial");
01079    y -= step ; l.DrawLatex(x1, y, "#corner")         ; l.DrawText(x2, y, "#corner");
01080    y -= step ; l.DrawLatex(x1, y, "#ltbar")          ; l.DrawText(x2, y, "#ltbar");
01081    y -= step ; l.DrawLatex(x1, y, "#bottombar")      ; l.DrawText(x2, y, "#bottombar");
01082    y -= step ; l.DrawLatex(x1, y, "#rightarrow")     ; l.DrawText(x2, y, "#rightarrow");
01083    y -= step ; l.DrawLatex(x1, y, "#surd")           ; l.DrawText(x2, y, "#surd");
01084    y -= step ; l.DrawLatex(x1, y, "#Rightarrow")     ; l.DrawText(x2, y, "#Rightarrow");
01085    y -= step ; l.DrawLatex(x1, y-0.015, "#int")      ; l.DrawText(x2, y, "#int");
01086    y -= step ; l.DrawLatex(x1, y, "#odot")           ; l.DrawText(x2, y, "#odot");
01087 
01088    TestReport1(C, "TLatex 5 (Mathematical Symbols)");
01089    DoCcode(C);
01090    TestReport2();
01091 }
01092 
01093 
01094 //______________________________________________________________________________
01095 void kerning()
01096 {
01097    // Text kerning.
01098 
01099    TCanvas *C = StartTest(1000, 700);
01100 
01101    for (Int_t i = 0;i < 25;i++) {
01102       TLine *ln = new TLine(0, 0.04 * (i - 0.2), 1, 0.04 * (i - 0.2));
01103       ln->Draw();
01104       Float_t sz = 0.0016 * i;
01105       TLatex *l = new TLatex(0.10, 0.04 * i, "AVAVAVAVAVAVAVAVAVAVAVAVAVAVAVAVAVAVA#color[2]{X}");
01106       l->SetTextSize(sz);
01107       l->Draw();
01108       TLatex *l1 = new TLatex(0.05, 0.04 * i, Form("%g", sz));
01109       l1->SetTextSize(0.02);
01110       l1->Draw();
01111    }
01112 
01113    TestReport1(C, "Text kerning");
01114    DoCcode(C);
01115    TestReport2();
01116 }
01117 
01118 
01119 //______________________________________________________________________________
01120 void itbf()
01121 {
01122    // TLatex commands #kern, #lower, #it and #bf
01123 
01124    TCanvas *C = StartTest(700, 500);
01125 
01126    gStyle->SetTextFont(132);
01127 
01128    (new TLatex(0.01, 0.9, "Positive k#kern[0.3]{e}#kern[0.3]{r}#kern[0.3]{n}#kern[0.3]{i}#kern[0.3]{n}#kern[0.3]{g} with #^{}kern[0.3]"))->Draw();
01129    (new TLatex(0.01, 0.7, "Negative k#kern[-0.3]{e}#kern[-0.3]{r}#kern[-0.3]{n}#kern[-0.3]{i}#kern[-0.3]{n}#kern[-0.3]{g} with #^{}kern[-0.3]"))->Draw();
01130    (new TLatex(0.01, 0.5, "Vertical a#lower[0.2]{d}#lower[0.4]{j}#lower[0.1]{u}#lower[-0.1]{s}#lower[-0.3]{t}#lower[-0.4]{m}#lower[-0.2]{e}#lower[0.1]{n}t with #^{}lower[-0.4...+0.4]"))->Draw();
01131    (new TLatex(0.01, 0.3, "Font styles: #^{}bf{#bf{bold}}, #^{}it{#it{italic}}, #^{}bf{#^{}it{#bf{#it{bold italic}}}}, #^{}bf{#^{}bf{#bf{#bf{unbold}}}}"))->Draw();
01132    (new TLatex(0.01, 0.1, "Font styles: abc#alpha#beta#gamma, #^{}it{#it{abc#alpha#beta#gamma}}, #^{}it{#^{}it{#it{#it{abc#alpha#beta#gamma}}}}"))->Draw();
01133 
01134    TestReport1(C, "TLatex commands #kern, #lower, #it and #bf");
01135    DoCcode(C);
01136    TestReport2();
01137 }
01138 
01139 
01140 //______________________________________________________________________________
01141 void transpad()
01142 {
01143    // Transparent pad.
01144 
01145    TCanvas *C = StartTest(700,500);
01146 
01147    TPad *pad1 = new TPad("pad1","",0,0,1,1);
01148    TPad *pad2 = new TPad("pad2","",0,0,1,1);
01149    pad2->SetFillStyle(4000); //will be transparent
01150    pad1->Draw();
01151    pad1->cd();
01152 
01153    TH1F *ht1 = new TH1F("ht1","ht1",100,-3,3);
01154    TH1F *ht2 = new TH1F("ht2","ht2",100,-3,3);
01155    TRandom r;
01156    for (Int_t i=0;i<100000;i++) {
01157       Double_t x1 = r.Gaus(-1,0.5);
01158       Double_t x2 = r.Gaus(1,1.5);
01159       if (i <1000) ht1->Fill(x1);
01160       ht2->Fill(x2);
01161    }
01162    ht1->Draw();
01163    pad1->Update(); //this will force the generation of the "stats" box
01164    TPaveStats *ps1 = (TPaveStats*)ht1->GetListOfFunctions()->FindObject("stats");
01165    ps1->SetX1NDC(0.4); ps1->SetX2NDC(0.6);
01166    pad1->Modified();
01167    C->cd();
01168 
01169    //compute the pad range with suitable margins
01170    Double_t ymin = 0;
01171    Double_t ymax = 2000;
01172    Double_t dy = (ymax-ymin)/0.8; //10 per cent margins top and bottom
01173    Double_t xmin = -3;
01174    Double_t xmax = 3;
01175    Double_t dx = (xmax-xmin)/0.8; //10 per cent margins left and right
01176    pad2->Range(xmin-0.1*dx,ymin-0.1*dy,xmax+0.1*dx,ymax+0.1*dy);
01177    pad2->Draw();
01178    pad2->cd();
01179    ht2->SetLineColor(kRed);
01180    ht2->Draw("][sames");
01181    pad2->Update();
01182    TPaveStats *ps2 = (TPaveStats*)ht2->GetListOfFunctions()->FindObject("stats");
01183    ps2->SetX1NDC(0.65); ps2->SetX2NDC(0.85);
01184    ps2->SetTextColor(kRed);
01185 
01186    // draw axis on the right side of the pad
01187    TGaxis *axis = new TGaxis(xmax,ymin,xmax,ymax,ymin,ymax,50510,"+L");
01188    axis->SetLabelColor(kRed);
01189    axis->Draw();
01190 
01191    TestReport1(C, "Transparent pad");
01192    DoCcode(C);
01193    TestReport2();
01194 }
01195 
01196 
01197 //______________________________________________________________________________
01198 void statfitparam ()
01199 {
01200    // Stat and fit parameters with errors.
01201 
01202    TCanvas *C = StartTest(800,500);
01203 
01204    C->Divide(3,2);
01205    gStyle->SetOptFit(1111);
01206    gStyle->SetOptStat(111111);
01207    gStyle->SetStatW(0.43);
01208    gStyle->SetStatH(0.35);
01209 
01210    TH1 *hsf1 = new TH1F("hsf1","hsf1", 2,0.,1.);
01211    TH1 *hsf2 = new TH1F("hsf2","hsf2", 2,0.,1.);
01212    TH1 *hsf3 = new TH1F("hsf3","hsf3", 2,0.,1.);
01213    TH1 *hsf4 = new TH1F("hsf4","hsf4", 2,0.,1.);
01214    TH1 *hsf5 = new TH1F("hsf5","hsf5", 2,0.,1.);
01215 
01216    C->cd(1);
01217    hsf1->SetBinContent (1, 5.3E5); hsf1->SetBinError (1, 0.9);
01218    hsf1->SetBinContent (2, 5.3E5); hsf1->SetBinError (2, 0.1);
01219    hsf1->Fit("pol0","Q");
01220 
01221    C->cd(2);
01222    hsf2->SetBinContent (1, 5.0E15); hsf2->SetBinError (1, 4.9E15);
01223    hsf2->SetBinContent (2, 5.0E15); hsf2->SetBinError (2, 4.9E11);
01224    hsf2->Fit("pol0","Q");
01225 
01226    C->cd(3);
01227    hsf3->SetBinContent (1, 5.0E-15); hsf3->SetBinError (1, 4.9E-15);
01228    hsf3->SetBinContent (2, 5.0E-15); hsf3->SetBinError (2, 4.9E-11);
01229    hsf3->Fit("pol0","Q");
01230 
01231    C->cd(4);
01232    hsf4->SetBinContent (1, 5); hsf4->SetBinError (1, 3);
01233    hsf4->SetBinContent (2, 5); hsf4->SetBinError (2, 1);
01234    hsf4->Fit("pol0","Q");
01235 
01236    C->cd(5);
01237    hsf5->SetBinContent (1, 5.3); hsf5->SetBinError (1, 0.9);
01238    hsf5->SetBinContent (2, 5.3); hsf5->SetBinError (2, 0.1);
01239    hsf5->Fit("pol0","Q");
01240 
01241    C->cd(6);
01242    TPaveText *pt = new TPaveText(0.02,0.2,0.98,0.8,"brNDC");
01243    pt->SetFillColor(18);
01244    pt->SetTextAlign(12);
01245    pt->AddText("This example test all the possible cases");
01246    pt->AddText("handled by ThistPainter::GetBestFormat.");
01247    pt->AddText("This method returns the best format to");
01248    pt->AddText("paint the fit parameters errors.");
01249    pt->Draw();
01250 
01251    TestReport1(C, "Stat and fit parameters with errors");
01252    DoCcode(C);
01253    TestReport2();
01254 }
01255 
01256 //______________________________________________________________________________
01257 void tgaxis1()
01258 {
01259    // 1st TGaxis test.
01260 
01261    TCanvas *C = StartTest(700,500);
01262 
01263    C->Range(-10,-1,10,1);
01264    TGaxis *axis1 = new TGaxis(-4.5,-0.2,5.5,-0.2,-6,8,510,"");
01265    axis1->SetName("axis1");
01266    axis1->Draw();
01267    TGaxis *axis2 = new TGaxis(-4.5,0.2,5.5,0.2,0.001,10000,510,"G");
01268    axis2->SetName("axis2");
01269    axis2->Draw();
01270    TGaxis *axis3 = new TGaxis(-9,-0.8,-9,0.8,-8,8,50510,"");
01271    axis3->SetName("axis3");
01272    axis3->SetTitle("axis3");
01273    axis3->SetTitleOffset(0.5);
01274    axis3->Draw();
01275    TGaxis *axis4 = new TGaxis(-7,-0.8,-7,0.8,1,10000,50510,"G");
01276    axis4->SetName("axis4");
01277    axis4->SetTitle("axis4");
01278    axis4->Draw();
01279    TGaxis *axis5 = new TGaxis(-4.5,-0.6,5.5,-0.6,1.2,1.32,80506,"-+");
01280    axis5->SetName("axis5");
01281    axis5->SetLabelSize(0.03);
01282    axis5->SetTextFont(72);
01283    axis5->Draw();
01284    TGaxis *axis6 = new TGaxis(-4.5,0.5,5.5,0.5,100,900,50510,"-");
01285    axis6->SetName("axis6");
01286    axis6->Draw();
01287    TGaxis *axis6a = new TGaxis(-5.5,0.85,5.5,0.85,0,4.3e-6,510,"");
01288    axis6a->SetName("axis6a");
01289    axis6a->Draw();
01290    TGaxis *axis7 = new TGaxis(8,-0.8,8,0.8,0,9000,50510,"+L");
01291    axis7->SetName("axis7");
01292    axis7->Draw();
01293    TGaxis *axis8 = new TGaxis(6.5,0.8,6.499,-0.8,0,90,50510,"-");
01294    axis8->SetName("axis8");
01295    axis8->Draw();
01296 
01297    TestReport1(C, "TGaxis 1");
01298    DoCcode(C);
01299    TestReport2();
01300 }
01301 
01302 
01303 //______________________________________________________________________________
01304 void tgaxis2()
01305 {
01306    // 2nd TGaxis test.
01307 
01308    TCanvas *C = StartTest(600,700);
01309 
01310    C->Range(-10,-1,10,1);
01311    TGaxis *axis1 = new TGaxis(-5,-0.2,6,-0.2,-6,8,510,"");
01312    axis1->SetName("axis1");
01313    axis1->Draw();
01314    TGaxis *axis2 = new TGaxis(-5,0.2,6,0.2,0.001,10000,510,"G");
01315    axis2->SetName("axis2");
01316    axis2->Draw();
01317    TGaxis *axis3 = new TGaxis(-9,-0.8,-9,0.8,-8,8,50510,"");
01318    axis3->SetName("axis3");
01319    axis3->Draw();
01320    TGaxis *axis4 = new TGaxis(-7,-0.8,-7,0.8,1,10000,50510,"G");
01321    axis4->SetName("axis4");
01322    axis4->Draw();
01323    TGaxis *axis5 = new TGaxis(-5,-0.6,6,-0.6,1.2,1.32,80506,"-+");
01324    axis5->SetName("axis5");
01325    axis5->SetLabelSize(0.03);
01326    axis5->SetTextFont(72);
01327    axis5->SetLabelOffset(0.025);
01328    axis5->Draw();
01329    TGaxis *axis6 = new TGaxis(-5,0.6,6,0.6,100,900,50510,"-");
01330    axis6->SetName("axis6");
01331    axis6->Draw();
01332    TGaxis *axis7 = new TGaxis(8,-0.8,8,0.8,0,9000,50510,"+L");
01333    axis7->SetName("axis7");
01334    axis7->SetLabelOffset(0.01);
01335    axis7->Draw();
01336 
01337    TestReport1(C, "TGaxis 2");
01338    DoCcode(C);
01339    TestReport2();
01340 }
01341 
01342 
01343 //______________________________________________________________________________
01344 void tgaxis3()
01345 {
01346    // 3rd TGaxis test.
01347 
01348    TCanvas *C = StartTest(700,900);
01349 
01350    time_t script_time;
01351    script_time = time(0);
01352    script_time = 3600*(int)(script_time/3600);
01353    gStyle->SetTimeOffset(script_time);
01354    C->Divide(1,3);
01355    C->SetFillColor(28);
01356    int i;
01357    gStyle->SetTitleH(0.08);
01358    float noise;
01359    TH1F *ht = new TH1F("ht","Love at first sight",3000,0.,2000.);
01360    for (i=1;i<3000;i++) {
01361       noise = gRandom->Gaus(0,120);
01362       if (i>700) {
01363          noise += 1000*sin((i-700)*6.28/30)*exp((double)(700-i)/300);
01364       }
01365       ht->SetBinContent(i,noise);
01366    }
01367    C->cd(1);
01368    ht->SetLineColor(2);
01369    ht->GetXaxis()->SetLabelSize(0.05);
01370    ht->Draw();
01371    ht->GetXaxis()->SetTimeDisplay(1);
01372    float x[100], t[100];
01373    for (i=0;i<100;i++) {
01374       x[i] = sin(i*4*3.1415926/50)*exp(-(double)i/20);
01375       t[i] = 6000+(double)i/20;
01376    }
01377    TGraph *gt = new TGraph(100,t,x);
01378    gt->SetTitle("Politics");
01379    C->cd(2);
01380    gt->SetFillColor(19);
01381    gt->SetLineColor(5);
01382    gt->SetLineWidth(2);
01383    gt->Draw("AL");
01384    gt->GetXaxis()->SetLabelSize(0.05);
01385    gt->GetXaxis()->SetTimeDisplay(1);
01386    gPad->Modified();
01387    float x2[10], t2[10];
01388    for (i=0;i<10;i++) {
01389       x2[i] = gRandom->Gaus(500,100)*i;
01390       t2[i] = i*365*86400;
01391    }
01392    TGraph *gt2 = new TGraph(10,t2,x2);
01393    gt2->SetTitle("Number of monkeys on the moon");
01394    C->cd(3);
01395    gt2->SetFillColor(19);
01396    gt2->SetMarkerColor(4);
01397    gt2->SetMarkerStyle(29);
01398    gt2->SetMarkerSize(1.3);
01399    gt2->Draw("AP");
01400    gt2->GetXaxis()->SetLabelSize(0.05);
01401    gt2->GetXaxis()->SetTimeDisplay(1);
01402    gt2->GetXaxis()->SetTimeFormat("y. %Y");
01403 
01404    TestReport1(C, "TGaxis 3 (Time on axis)");
01405    DoCcode(C);
01406    TestReport2();
01407 }
01408 
01409 
01410 //______________________________________________________________________________
01411 void tgaxis4()
01412 {
01413    // 4th TGaxis test.
01414 
01415    TCanvas *C = StartTest(600,700);
01416 
01417    TDatime T0(2003,1,1,0,0,0);
01418    int X0 = T0.Convert();
01419    gStyle->SetTimeOffset(X0);
01420    TDatime T1(2002,9,23,0,0,0);
01421    int X1 = T1.Convert()-X0;
01422    TDatime T2(2003,3,7,0,0,0);
01423    int X2 = T2.Convert()-X0;
01424    TH1F * h1 = new TH1F("h1","test",100,X1,X2);
01425    TRandom r;
01426    for (Int_t i=0;i<30000;i++) {
01427       Double_t noise = r.Gaus(0.5*(X1+X2),0.1*(X2-X1));
01428       h1->Fill(noise);
01429    }
01430    h1->GetXaxis()->SetTimeDisplay(1);
01431    h1->GetXaxis()->SetLabelSize(0.03);
01432    h1->GetXaxis()->SetTimeFormat("%Y:%m:%d");
01433    h1->Draw();
01434 
01435    TestReport1(C, "TGaxis 4 (Time on axis)");
01436    DoCcode(C);
01437    TestReport2();
01438    delete h1;
01439 }
01440 
01441 
01442 //______________________________________________________________________________
01443 void labels1()
01444 {
01445    // Alphanumeric labels in a 1-d histogram
01446 
01447    TCanvas *C = StartTest(900,500);
01448 
01449    const Int_t nx = 20;
01450 
01451    C->SetGrid();
01452    C->SetBottomMargin(0.15);
01453    TH1F *hlab1 = new TH1F("hlab1","hlab1",nx,0,nx);
01454    hlab1->SetFillColor(38);
01455    for (Int_t i=0;i<5000;i++) {
01456       hlab1->Fill(gRandom->Gaus(0.5*nx,0.2*nx));
01457    }
01458    hlab1->SetStats(0);
01459    TAxis *xa = hlab1->GetXaxis();
01460    xa->SetBinLabel( 1, "Jean");
01461    xa->SetBinLabel( 2, "Pierre");
01462    xa->SetBinLabel( 3, "Marie");
01463    xa->SetBinLabel( 4, "Odile");
01464    xa->SetBinLabel( 5, "Sebastien");
01465    xa->SetBinLabel( 6, "Fons");
01466    xa->SetBinLabel( 7, "Rene");
01467    xa->SetBinLabel( 8, "Nicolas");
01468    xa->SetBinLabel( 9, "Xavier");
01469    xa->SetBinLabel(10, "Greg");
01470    xa->SetBinLabel(11, "Bjarne");
01471    xa->SetBinLabel(12, "Anton");
01472    xa->SetBinLabel(13, "Otto");
01473    xa->SetBinLabel(14, "Eddy");
01474    xa->SetBinLabel(15, "Peter");
01475    xa->SetBinLabel(16, "Pasha");
01476    xa->SetBinLabel(17, "Philippe");
01477    xa->SetBinLabel(18, "Suzanne");
01478    xa->SetBinLabel(19, "Jeff");
01479    xa->SetBinLabel(20, "Valery");
01480    hlab1->Draw();
01481    TPaveText *pt = new TPaveText(0.6,0.7,0.98,0.98,"brNDC");
01482    pt->SetFillColor(18);
01483    pt->SetTextAlign(12);
01484    pt->AddText("Use the axis Context Menu LabelsOption");
01485    pt->AddText(" \"a\"   to sort by alphabetic order");
01486    pt->AddText(" \">\"   to sort by decreasing vakues");
01487    pt->AddText(" \"<\"   to sort by increasing vakues");
01488    pt->Draw();
01489 
01490    TestReport1(C, "Alphanumeric labels in a 1-d histogram");
01491    DoCcode(C);
01492    TestReport2();
01493    delete hlab1;
01494 }
01495 
01496 
01497 //______________________________________________________________________________
01498 void tellipse()
01499 {
01500    // TEllipse test.
01501 
01502    TCanvas *C = StartTest(700,800);
01503 
01504    C->Range(0,0,1,1);
01505    TPaveLabel pel(0.1,0.8,0.9,0.95,"Examples of Ellipses");
01506    pel.SetFillColor(42);
01507    pel.Draw();
01508    TEllipse el1(0.25,0.25,.1,.2);
01509    el1.Draw();
01510    el1.SetFillStyle(0);
01511    TEllipse el2(0.25,0.6,.2,.1);
01512    el2.SetFillColor(6);
01513    el2.SetFillStyle(3008);
01514    el2.Draw();
01515    TEllipse el3(0.75,0.6,.2,.1,45,315);
01516    el3.SetFillColor(2);
01517    el3.SetFillStyle(1001);
01518    el3.SetLineColor(4);
01519    el3.Draw();
01520    TEllipse el4(0.75,0.25,.2,.15,45,315,62);
01521    el4.SetFillColor(5);
01522    el4.SetFillStyle(1001);
01523    el4.SetLineColor(4);
01524    el4.SetLineWidth(6);
01525    el4.Draw();
01526 
01527    TestReport1(C, "TEllipse");
01528    DoCcode(C);
01529    TestReport2();
01530 }
01531 
01532 
01533 //______________________________________________________________________________
01534 void feynman()
01535 {
01536    // Feynman diagrams test.
01537 
01538    TCanvas *C = StartTest(600,300);
01539 
01540    C->Range(0, 0, 140, 60);
01541    Int_t linsav = gStyle->GetLineWidth();
01542    gStyle->SetLineWidth(3);
01543    TLatex t;
01544    t.SetTextAlign(22);
01545    t.SetTextSize(0.1);
01546    TLine * l;
01547    l = new TLine(10, 10, 30, 30); l->Draw();
01548    l = new TLine(10, 50, 30, 30); l->Draw();
01549    TCurlyArc *ginit = new TCurlyArc(30, 30, 12.5*TMath::Sqrt(2), 135, 225);
01550    ginit->SetWavy();
01551    ginit->Draw();
01552    t.DrawLatex(7,6,"e^{-}");
01553    t.DrawLatex(7,55,"e^{+}");
01554    t.DrawLatex(7,30,"#gamma");
01555    TCurlyLine *gamma = new TCurlyLine(30, 30, 55, 30);
01556    gamma->SetWavy();
01557    gamma->Draw();
01558    t.DrawLatex(42.5,37.7,"#gamma");
01559    TArc *a = new TArc(70, 30, 15);
01560    a->Draw();
01561    a->SetFillStyle(0);
01562    t.DrawLatex(55, 45,"#bar{q}");
01563    t.DrawLatex(85, 15,"q");
01564    TCurlyLine *gluon = new TCurlyLine(70, 45, 70, 15);
01565    gluon->Draw();
01566    t.DrawLatex(77.5,30,"g");
01567    TCurlyLine *z0 = new TCurlyLine(85, 30, 110, 30);
01568    z0->SetWavy();
01569    z0->Draw();
01570    t.DrawLatex(100, 37.5,"Z^{0}");
01571    l = new TLine(110, 30, 130, 10); l->Draw();
01572    l = new TLine(110, 30, 130, 50); l->Draw();
01573    TCurlyArc *gluon1 = new TCurlyArc(110, 30, 12.5*TMath::Sqrt(2), 315, 45);
01574    gluon1->Draw();
01575    t.DrawLatex(135,6,"#bar{q}");
01576    t.DrawLatex(135,55,"q");
01577    t.DrawLatex(135,30,"g");
01578    C->Update();
01579    gStyle->SetLineWidth(linsav);
01580 
01581    TestReport1(C, "Feynman diagrams");
01582    DoCcode(C);
01583    TestReport2();
01584 }
01585 
01586 
01587 //______________________________________________________________________________
01588 void tgraph1()
01589 {
01590    // 1st TGraph test.
01591 
01592    TCanvas *C = StartTest(700,500);
01593 
01594    C->SetFillColor(42);
01595    C->SetGrid();
01596    const Int_t n = 20;
01597    Double_t x[n], y[n];
01598    for (Int_t i=0;i<n;i++) {
01599      x[i] = i*0.1;
01600      y[i] = 10*sin(x[i]+0.2);
01601    }
01602    TGraph *gr = new TGraph(n,x,y);
01603    gr->SetLineColor(2);
01604    gr->SetLineWidth(4);
01605    gr->SetMarkerColor(4);
01606    gr->SetMarkerStyle(21);
01607    gr->SetTitle("a simple graph");
01608    gr->GetXaxis()->SetTitle("X title");
01609    gr->GetYaxis()->SetTitle("Y title");
01610    gr->Draw("ACP");
01611    C->Update();
01612    C->GetFrame()->SetFillColor(21);
01613    C->GetFrame()->SetBorderSize(12);
01614 
01615    TestReport1(C, "TGraph 1");
01616    DoCcode(C);
01617    TestReport2();
01618 }
01619 
01620 
01621 //______________________________________________________________________________
01622 void tgraph2()
01623 {
01624    // 2nd TGraph test.
01625 
01626    TCanvas *C = StartTest(700,500);
01627 
01628    C->SetGrid();
01629    TMultiGraph *mg = new TMultiGraph();
01630    mg->SetTitle("Exclusion graphs");
01631    const Int_t n = 35;
01632    Double_t x1[n], x2[n], x3[n], y1[n], y2[n], y3[n];
01633    for (Int_t i=0;i<n;i++) {
01634      x1[i]  = i*0.1;
01635      x2[i]  = x1[i];
01636      x3[i]  = x1[i]+.5;
01637      y1[i] = 10*sin(x1[i]);
01638      y2[i] = 10*cos(x1[i]);
01639      y3[i] = 10*sin(x1[i])-2;
01640    }
01641    TGraph *gr1 = new TGraph(n,x1,y1);
01642    gr1->SetLineColor(2);
01643    gr1->SetLineWidth(1504);
01644    gr1->SetFillStyle(3005);
01645    TGraph *gr2 = new TGraph(n,x2,y2);
01646    gr2->SetLineColor(4);
01647    gr2->SetLineWidth(-2002);
01648    gr2->SetFillStyle(3004);
01649    gr2->SetFillColor(9);
01650    TGraph *gr3 = new TGraph(n,x3,y3);
01651    gr3->SetLineColor(5);
01652    gr3->SetLineWidth(-802);
01653    gr3->SetFillStyle(3002);
01654    gr3->SetFillColor(2);
01655    mg->Add(gr1);
01656    mg->Add(gr2);
01657    mg->Add(gr3);
01658    mg->Draw("AC");
01659 
01660    TestReport1(C, "TGraph 2 (Exclusion Zone)");
01661    DoCcode(C);
01662    TestReport2();
01663 }
01664 
01665 
01666 //______________________________________________________________________________
01667 void tgraph3()
01668 {
01669    // 3rd TGraph test.
01670 
01671    TCanvas *C = StartTest(800,400);
01672 
01673    C->Divide(2,1);
01674 
01675    TGraph *g1 = new TGraph();
01676    g1->SetPoint(0, 1e-4, 1);
01677    g1->SetPoint(1, 1e-2, 2);
01678    g1->SetPoint(2, 1e-1, 3);
01679    g1->SetPoint(3, 1, 4);
01680    g1->SetPoint(4, 1e1, 5);
01681    g1->SetPoint(5, 1e2, 5);
01682    g1->SetPoint(6, 1e3, 4);
01683    g1->SetPoint(7, 1e4, 3);
01684    g1->SetPoint(8, 1e5, 2);
01685    g1->SetPoint(9, 1e6, 1);
01686    g1->SetTitle("10 blue circles should be visible");
01687 
01688    g1->SetMarkerStyle(kFullCircle);
01689    g1->SetMarkerSize(1.0);
01690    g1->SetMarkerColor(kBlue);
01691    g1->SetLineColor(kBlue);
01692 
01693    C->cd(1);
01694    g1->Fit("gaus","Q");
01695    g1->Draw("AP");
01696    gPad->SetLogx();
01697 
01698    C->cd(2);
01699    gPad->SetLogx();
01700    gPad->SetLogy();
01701    TGraph* g2 = new TGraph();
01702    for (int i = 0; i < 10; i++) g2->SetPoint(i, i + 1, i + 1);
01703    g2->SetTitle("2 log scales from 1e-2 to 1e2;x;y");
01704    g2->GetXaxis()->SetLimits(1e-2, 1e2);
01705    g2->GetHistogram()->SetMinimum(1e-2);
01706    g2->GetHistogram()->SetMaximum(1e2);
01707    g2->GetXaxis()->CenterTitle();
01708    g2->GetYaxis()->CenterTitle();
01709    g2->Draw("a*");
01710 
01711    TestReport1(C, "TGraph 3 (Fitting and log scales)");
01712    DoCcode(C);
01713    TestReport2();
01714 }
01715 
01716 
01717 //______________________________________________________________________________
01718 void tmultigraph1()
01719 {
01720    // TMultigraph and TGraphErrors test
01721 
01722    TCanvas *C = StartTest(700,500);
01723 
01724    gStyle->SetOptFit();
01725    C->SetGrid();
01726    TMultiGraph *mg = new TMultiGraph();
01727    Int_t n1 = 10;
01728    Double_t x1[]  = {-0.1, 0.05, 0.25, 0.35, 0.5, 0.61,0.7,0.85,0.89,0.95};
01729    Double_t y1[]  = {-1,2.9,5.6,7.4,9,9.6,8.7,6.3,4.5,1};
01730    Double_t ex1[] = {.05,.1,.07,.07,.04,.05,.06,.07,.08,.05};
01731    Double_t ey1[] = {.8,.7,.6,.5,.4,.4,.5,.6,.7,.8};
01732    TGraphErrors *gr1 = new TGraphErrors(n1,x1,y1,ex1,ey1);
01733    gr1->SetMarkerColor(kBlue);
01734    gr1->SetMarkerStyle(21);
01735    gr1->Fit("pol6","q");
01736    mg->Add(gr1);
01737    Int_t n2 = 10;
01738    Float_t x2[]  = {-0.28, 0.005, 0.19, 0.29, 0.45, 0.56,0.65,0.80,0.90,1.01};
01739    Float_t y2[]  = {2.1,3.86,7,9,10,10.55,9.64,7.26,5.42,2};
01740    Float_t ex2[] = {.04,.12,.08,.06,.05,.04,.07,.06,.08,.04};
01741    Float_t ey2[] = {.6,.8,.7,.4,.3,.3,.4,.5,.6,.7};
01742    TGraphErrors *gr2 = new TGraphErrors(n2,x2,y2,ex2,ey2);
01743    gr2->SetMarkerColor(kRed);
01744    gr2->SetMarkerStyle(20);
01745    gr2->Fit("pol5","q");
01746    mg->Add(gr2);
01747    mg->Draw("ap");
01748    C->Update();
01749    TPaveStats *stats1 = (TPaveStats*)gr1->GetListOfFunctions()->FindObject("stats");
01750    TPaveStats *stats2 = (TPaveStats*)gr2->GetListOfFunctions()->FindObject("stats");
01751    stats1->SetTextColor(kBlue);
01752    stats2->SetTextColor(kRed);
01753    stats1->SetX1NDC(0.12); stats1->SetX2NDC(0.32); stats1->SetY1NDC(0.75);
01754    stats2->SetX1NDC(0.72); stats2->SetX2NDC(0.92); stats2->SetY1NDC(0.78);
01755    C->Modified();
01756 
01757    TestReport1(C, "TMultigraph and TGraphErrors");
01758    DoCcode(C);
01759    TestReport2();
01760 }
01761 
01762 
01763 //______________________________________________________________________________
01764 void tmultigraph2()
01765 {
01766    // All Kind of TMultigraph test
01767 
01768    TCanvas *C = StartTest(800,800);
01769 
01770    gStyle->SetOptFit();
01771 
01772    C->SetGrid();
01773    C->Divide(2,2);
01774 
01775    // Draw a frame to define the range
01776    TMultiGraph *mg1 = new TMultiGraph();
01777    TMultiGraph *mg2 = new TMultiGraph();
01778    TMultiGraph *mg3 = new TMultiGraph();
01779    TMultiGraph *mg4 = new TMultiGraph();
01780 
01781    // Vectors used to build the graphs
01782    Int_t n1 = 10;
01783    Double_t x1[]    = {-0.1, 0.05, 0.25, 0.35, 0.5, 0.61,0.7,0.85,0.89,0.95};
01784    Double_t y1[]    = {-1,2.9,5.6,7.4,9,9.6,8.7,6.3,4.5,1};
01785    Double_t exl1[]  = {.05,.1,.07,.07,.04,.05,.06,.07,.08,.05};
01786    Double_t eyl1[]  = {.8,.7,.6,.5,.4,.4,.5,.6,.7,.8};
01787    Double_t exh1[]  = {.02,.08,.05,.05,.03,.03,.04,.05,.06,.03};
01788    Double_t eyh1[]  = {.6,.5,.4,.3,.2,.2,.3,.4,.5,.6};
01789    Double_t exld1[] = {.0,.0,.0,.0,.0,.0,.0,.0,.0,.0};
01790    Double_t eyld1[] = {.0,.0,.05,.0,.0,.0,.0,.0,.0,.0};
01791    Double_t exhd1[] = {.0,.0,.0,.0,.0,.0,.0,.0,.0,.0};
01792    Double_t eyhd1[] = {.0,.0,.0,.0,.0,.0,.0,.0,.05,.0};
01793 
01794    Int_t n2 = 10;
01795    Float_t  x2[]    = {-0.28, 0.005, 0.19, 0.29, 0.45, 0.56,0.65,0.80,0.90,1.01};
01796    Float_t  y2[]    = {2.1,3.86,7,9,10,10.55,9.64,7.26,5.42,2};
01797    Float_t  exl2[]  = {.04,.12,.08,.06,.05,.04,.07,.06,.08,.04};
01798    Float_t  eyl2[]  = {.6,.8,.7,.4,.3,.3,.4,.5,.6,.7};
01799    Float_t  exh2[]  = {.02,.08,.05,.05,.03,.03,.04,.05,.06,.03};
01800    Float_t  eyh2[]  = {.6,.5,.4,.3,.2,.2,.3,.4,.5,.6};
01801    Float_t  exld2[] = {.0,.0,.0,.0,.0,.0,.0,.0,.0,.0};
01802    Float_t  eyld2[] = {.0,.0,.05,.0,.0,.0,.0,.0,.0,.0};
01803    Float_t  exhd2[] = {.0,.0,.0,.0,.0,.0,.0,.0,.0,.0};
01804    Float_t  eyhd2[] = {.0,.0,.0,.0,.0,.0,.0,.0,.05,.0};
01805 
01806    // Create 1st multigraph
01807    C->cd(1);
01808    TGraph *gr11 = new TGraph(n1,x1,y1);
01809    gr11->SetMarkerColor(kBlue);
01810    gr11->SetMarkerStyle(20);
01811    TGraph *gr12 = new TGraph(n2,x2,y2);
01812    gr12->SetMarkerColor(kRed);
01813    gr12->SetMarkerStyle(23);
01814    mg1->Add(gr11,"pc");
01815    mg1->Add(gr12);
01816    mg1->Draw("ap");
01817    TLatex *tex1 = new TLatex(-0.3,10.0,"TGraph");
01818    tex1->Draw();
01819 
01820    // Create 2nd multigraph
01821    C->cd(2);
01822    TGraphErrors *gr21 = new TGraphErrors(n1,x1,y1,exl1,eyl1);
01823    gr21->SetMarkerColor(kBlue+1);
01824    gr21->SetMarkerStyle(21);
01825    TGraphErrors *gr22 = new TGraphErrors(n2,x2,y2,exl2,eyl2);
01826    gr22->SetMarkerColor(kRed+1);
01827    gr22->SetMarkerStyle(20);
01828    gr22->Fit("pol3","q");
01829    mg2->Add(gr21,"pl");
01830    mg2->Add(gr22);
01831    mg2->Draw("ap");
01832    TLatex *tex2 = new TLatex(-0.3,10.0,"TGraphErrors");
01833    tex2->Draw();
01834 
01835    // Create 3rd multigraph
01836    C->cd(3);
01837    TGraphAsymmErrors *gr31 = new TGraphAsymmErrors(n1,x1,y1,exl1,exh1,eyl1,eyh1);
01838    gr31->SetMarkerColor(kBlue-1);
01839    gr31->SetMarkerStyle(21);
01840    TGraphAsymmErrors *gr32 = new TGraphAsymmErrors(n2,x2,y2,exl2,exh2,eyl2,eyh2);
01841    gr32->SetMarkerColor(kRed-1);
01842    gr32->SetMarkerStyle(20);
01843    gr32->Fit("pol4","q");
01844    mg3->Add(gr31,"pl");
01845    mg3->Add(gr32);
01846    mg3->Draw("ap");
01847    TLatex *tex3 = new TLatex(-0.3,10.0,"TGraphAsymmErrors");
01848    tex3->Draw();
01849 
01850    // Create 4th multigraph
01851    C->cd(4);
01852    TGraphBentErrors *gr41 = new TGraphBentErrors(n1,x1,y1,exl1,exh1,eyl1,eyh1,exld1,exhd1,eyld1,eyhd1);
01853    gr41->SetMarkerColor(kGreen);
01854    gr41->SetMarkerStyle(21);
01855    TGraphBentErrors *gr42 = new TGraphBentErrors(n2,x2,y2,exl2,exh2,eyl2,eyh2,exld2,exhd2,eyld2,eyhd2);
01856    gr42->SetMarkerColor(kViolet);
01857    gr42->SetMarkerStyle(20);
01858    gr42->Fit("pol5","q");
01859    mg4->Add(gr41,"pc");
01860    mg4->Add(gr42);
01861    mg4->Draw("ap");
01862    TLatex *tex4 = new TLatex(-0.3,10.0,"TGraphBentErrors");
01863    tex4->Draw();
01864 
01865    C->Modified();
01866 
01867    TestReport1(C, "All Kind of TMultigraph");
01868    DoCcode(C);
01869    TestReport2();
01870 }
01871 
01872 
01873 //______________________________________________________________________________
01874 void options2d1()
01875 {
01876    // 1st 2D options Test
01877 
01878    TCanvas *C = StartTest(800,600);
01879 
01880    gStyle->SetOptStat(0);
01881    gStyle->SetPalette(1);
01882    gStyle->SetCanvasColor(33);
01883    gStyle->SetFrameFillColor(18);
01884    TF2 *f2 = new TF2("f2","xygaus + xygaus(5) + xylandau(10)",-4,4,-4,4);
01885    Double_t params[] = {130,-1.4,1.8,1.5,1, 150,2,0.5,-2,0.5, 3600,-2,0.7,-3,0.3};
01886    f2->SetParameters(params);
01887    gH2 = new TH2F("h2","xygaus + xygaus(5) + xylandau(10)",20,-4,4,20,-4,4);
01888    gH2->SetFillColor(46);
01889    gH2->FillRandom("f2",40000);
01890 
01891    TPaveLabel pl1;
01892    Float_t x1=0.67, y1=0.875, x2=0.85, y2=0.95;
01893    C->Divide(2,2);
01894    C->SetFillColor(17);
01895    C->cd(1);
01896    gH2->Draw();       pl1.DrawPaveLabel(x1,y1,x2,y2,"SCAT","brNDC");
01897    C->cd(2);
01898    gH2->Draw("box");  pl1.DrawPaveLabel(x1,y1,x2,y2,"BOX","brNDC");
01899    C->cd(3);
01900    gH2->Draw("arr");  pl1.DrawPaveLabel(x1,y1,x2,y2,"ARR","brNDC");
01901    C->cd(4);
01902    gH2->Draw("colz"); pl1.DrawPaveLabel(x1,y1,x2,y2,"COLZ","brNDC");
01903 
01904    TestReport1(C, "Basic 2D options");
01905    DoCcode(C);
01906    TestReport2();
01907 }
01908 
01909 
01910 //______________________________________________________________________________
01911 void options2d2()
01912 {
01913    // 2nd 2D options Test
01914 
01915    TCanvas *C = StartTest(800,600);
01916 
01917    TPaveLabel pl2;
01918    Float_t x1=0.67, y1=0.875, x2=0.85, y2=0.95;
01919    gPad->SetGrid();
01920    C->SetFillColor(17);
01921    C->SetGrid();
01922    gH2->Draw("text"); pl2.DrawPaveLabel(x1,y1,x2,y2,"TEXT","brNDC");
01923 
01924    TestReport1(C, "Text option");
01925    DoCcode(C);
01926    TestReport2();
01927 }
01928 
01929 
01930 //______________________________________________________________________________
01931 void options2d3()
01932 {
01933    // 3rd 2D options Test
01934 
01935    TCanvas *C = StartTest(800,600);
01936 
01937    TPaveLabel pl3;
01938    Float_t x1=0.67, y1=0.875, x2=0.85, y2=0.95;
01939    C->Divide(2,2);
01940    gPad->SetGrid();
01941    C->SetFillColor(17);
01942    C->cd(1);
01943    gH2->Draw("contz"); pl3.DrawPaveLabel(x1,y1,x2,y2,"CONTZ","brNDC");
01944    C->cd(2);
01945    gPad->SetGrid();
01946    gH2->Draw("cont1"); pl3.DrawPaveLabel(x1,y1,x2,y2,"CONT1","brNDC");
01947    C->cd(3);
01948    gPad->SetGrid();
01949    gH2->Draw("cont2"); pl3.DrawPaveLabel(x1,y1,x2,y2,"CONT2","brNDC");
01950    C->cd(4);
01951    gPad->SetGrid();
01952    gH2->Draw("cont3"); pl3.DrawPaveLabel(x1,y1,x2,y2,"CONT3","brNDC");
01953 
01954    TestReport1(C, "Contour options");
01955    DoCcode(C);
01956    TestReport2();
01957 }
01958 
01959 
01960 //______________________________________________________________________________
01961 void options2d4()
01962 {
01963    // 4th 2D options Test
01964 
01965    TCanvas *C = StartTest(800,600);
01966 
01967    TPaveLabel pl4;
01968    Float_t x1=0.67, y1=0.875, x2=0.85, y2=0.95;
01969    C->Divide(2,2);
01970    C->SetFillColor(17);
01971    C->cd(1);
01972    gH2->Draw("lego");     pl4.DrawPaveLabel(x1,y1,x2,y2,"LEGO","brNDC");
01973    C->cd(2);
01974    gH2->Draw("lego1");    pl4.DrawPaveLabel(x1,y1,x2,y2,"LEGO1","brNDC");
01975    C->cd(3);
01976    gPad->SetTheta(61); gPad->SetPhi(-82);
01977    gH2->Draw("surf1pol"); pl4.DrawPaveLabel(x1,y1,x2+0.05,y2,"SURF1POL","brNDC");
01978    C->cd(4);
01979    gPad->SetTheta(21); gPad->SetPhi(-90);
01980    gH2->Draw("surf1cyl"); pl4.DrawPaveLabel(x1,y1,x2+0.05,y2,"SURF1CYL","brNDC");
01981 
01982    TestReport1(C, "Lego options");
01983    DoCcode(C);
01984    TestReport2();
01985 }
01986 
01987 
01988 //______________________________________________________________________________
01989 void options2d5()
01990 {
01991    // 5th 2D options Test
01992 
01993    TCanvas *C = StartTest(800,600);
01994 
01995    TPaveLabel pl5;
01996    Float_t x1=0.67, y1=0.875, x2=0.85, y2=0.95;
01997    C->Divide(2,2);
01998    C->SetFillColor(17);
01999    C->cd(1);
02000    gH2->Draw("surf1");   pl5.DrawPaveLabel(x1,y1,x2,y2,"SURF1","brNDC");
02001    C->cd(2);
02002    gH2->Draw("surf2z");  pl5.DrawPaveLabel(x1,y1,x2,y2,"SURF2Z","brNDC");
02003    C->cd(3);
02004    gH2->Draw("surf3");   pl5.DrawPaveLabel(x1,y1,x2,y2,"SURF3","brNDC");
02005    C->cd(4);
02006    gH2->Draw("surf4");   pl5.DrawPaveLabel(x1,y1,x2,y2,"SURF4","brNDC");
02007 
02008    TestReport1(C, "Surface options");
02009    DoCcode(C);
02010    TestReport2();
02011    delete gH2;
02012 }
02013 
02014 
02015 //______________________________________________________________________________
02016 void earth()
02017 {
02018    // 5th 2D options Test
02019 
02020    TCanvas *C = StartTest(1000,800);
02021 
02022    gStyle->SetPalette(1);
02023    gStyle->SetOptTitle(1);
02024    gStyle->SetOptStat(0);
02025    C->Divide(2,2);
02026    TH2F *h1 = new TH2F("h01","Aitoff",    50, -180, 180, 50, -89.5, 89.5);
02027    TH2F *h2 = new TH2F("h02","Mercator",  50, -180, 180, 50, -80.5, 80.5);
02028    TH2F *h3 = new TH2F("h03","Sinusoidal",50, -180, 180, 50, -90.5, 90.5);
02029    TH2F *h4 = new TH2F("h04","Parabolic", 50, -180, 180, 50, -90.5, 90.5);
02030    ifstream in;
02031    in.open("../tutorials/graphics/earth.dat");
02032    if (!in) {
02033       in.clear();
02034       in.open("earth.dat");
02035    }
02036    if (!in)
02037       printf("Cannot find earth.dat!\n");
02038    Float_t x,y;
02039    while (1) {
02040      in >> x >> y;
02041      if (!in.good()) break;
02042      h1->Fill(x,y, 1);
02043      h2->Fill(x,y, 1);
02044      h3->Fill(x,y, 1);
02045      h4->Fill(x,y, 1);
02046    }
02047    in.close();
02048    C->cd(1); h1->Draw("z aitoff");
02049    C->cd(2); h2->Draw("z mercator");
02050    C->cd(3); h3->Draw("z sinusoidal");
02051    C->cd(4); h4->Draw("z parabolic");
02052 
02053    TestReport1(C, "Special contour options (AITOFF etc.)");
02054    DoCcode(C);
02055    TestReport2();
02056    delete h1;
02057    delete h2;
02058    delete h3;
02059    delete h4;
02060 }
02061 
02062 
02063 //______________________________________________________________________________
02064 void tgraph2d1()
02065 {
02066    // 1st TGraph2D Test
02067 
02068    TCanvas *C = StartTest(600,600);
02069 
02070    Double_t P = 5.;
02071    Int_t npx  = 20 ;
02072    Int_t npy  = 20 ;
02073    Double_t x = -P;
02074    Double_t y = -P;
02075    Double_t z;
02076    Int_t k = 0;
02077    Double_t dx = (2*P)/npx;
02078    Double_t dy = (2*P)/npy;
02079    TGraph2D *dt = new TGraph2D(npx*npy);
02080    dt->SetName("Graph2DA");
02081    dt->SetNpy(41);
02082    dt->SetNpx(40);
02083    for (Int_t i=0; i<npx; i++) {
02084       for (Int_t j=0; j<npy; j++) {
02085          z = sin(sqrt(x*x+y*y))+1;
02086          dt->SetPoint(k,x,y,z);
02087          k++;
02088          y = y+dy;
02089       }
02090        x = x+dx;
02091        y = -P;
02092    }
02093    gStyle->SetPalette(1);
02094    dt->SetFillColor(0);
02095    dt->SetLineColor(1);
02096    dt->SetMarkerSize(1);
02097    dt->Draw("tri2p0Z  ");
02098 
02099    TestReport1(C, "TGraph2D 1 (TRI2 and P0)");
02100 
02101    DoCcode(C);
02102 
02103    TObject *old = (TObject*)gDirectory->GetList()->FindObject(dt->GetName());
02104    if (old) gDirectory->GetList()->Remove(old);
02105 
02106    TestReport2();
02107    delete dt;
02108 }
02109 
02110 
02111 //______________________________________________________________________________
02112 void tgraph2d2()
02113 {
02114    // 2nd TGraph2D Test
02115 
02116    TCanvas *C = StartTest(600,600);
02117 
02118    gStyle->SetPadBorderMode(0);
02119    gStyle->SetFrameBorderMode(0);
02120    gStyle->SetCanvasBorderMode(0);
02121    Double_t Px = 6.;
02122    Double_t Py = 6.;
02123    Int_t np    = 1000;
02124    Double_t *rx=0, *ry=0, *rz=0;
02125    rx = new Double_t[np];
02126    ry = new Double_t[np];
02127    rz = new Double_t[np];
02128    TRandom *r = new TRandom();
02129    for (Int_t N=0; N<np; N++) {
02130       rx[N]=2*Px*(r->Rndm(N))-Px;
02131       ry[N]=2*Py*(r->Rndm(N))-Py;
02132       rz[N]=sin(sqrt(rx[N]*rx[N]+ry[N]*ry[N]))+1;
02133    }
02134    gStyle->SetPalette(1);
02135    TGraph2D *dt = new TGraph2D( np, rx, ry, rz);
02136    dt->SetName("Graph2DA");
02137    dt->SetFillColor(0);
02138    dt->SetMarkerStyle(20);
02139    dt->Draw("PCOL");
02140 
02141    TestReport1(C, "TGraph2D 2 (COL and P)");
02142    DoCcode(C);
02143 
02144    TObject *old = (TObject*)gDirectory->GetList()->FindObject(dt->GetName());
02145    if (old) gDirectory->GetList()->Remove(old);
02146 
02147    TestReport2();
02148    delete dt;
02149 }
02150 
02151 
02152 //______________________________________________________________________________
02153 void tgraph2d3()
02154 {
02155    // 3rd TGraph2D Test
02156 
02157    TCanvas *C = StartTest(600,600);
02158 
02159    gStyle->SetPadBorderMode(0);
02160    gStyle->SetFrameBorderMode(0);
02161    gStyle->SetCanvasBorderMode(0);
02162    Double_t Px = 6.;
02163    Double_t Py = 6.;
02164    Int_t np    = 200;
02165    Double_t *rx=0, *ry=0, *rz=0;
02166    rx = new Double_t[np];
02167    ry = new Double_t[np];
02168    rz = new Double_t[np];
02169    TRandom *r = new TRandom();
02170    for (Int_t N=0; N<np; N++) {
02171       rx[N]=2*Px*(r->Rndm(N))-Px;
02172       ry[N]=2*Py*(r->Rndm(N))-Py;
02173       rz[N]=sin(sqrt(rx[N]*rx[N]+ry[N]*ry[N]))+1;
02174    }
02175    gStyle->SetPalette(1);
02176    TGraph2D *dt = new TGraph2D( np, rx, ry, rz);
02177    dt->SetName("Graph2DA");
02178    dt->SetFillColor(0);
02179    dt->Draw("CONT5  ");
02180 
02181    TestReport1(C, "TGraph2D 3 (CONT5)");
02182    DoCcode(C);
02183 
02184    TObject *old = (TObject*)gDirectory->GetList()->FindObject(dt->GetName());
02185    if (old) gDirectory->GetList()->Remove(old);
02186 
02187    TestReport2();
02188    delete dt;
02189 }
02190 
02191 
02192 //______________________________________________________________________________
02193 void ntuple1()
02194 {
02195    // 1st complex drawing and TPad test
02196 
02197    TCanvas *C = StartTest(700,780);
02198 
02199    TPad *pad1 = new TPad("pad1","This is pad1",0.02,0.52,0.48,0.98,21);
02200    TPad *pad2 = new TPad("pad2","This is pad2",0.52,0.52,0.98,0.98,21);
02201    TPad *pad3 = new TPad("pad3","This is pad3",0.02,0.02,0.48,0.48,21);
02202    TPad *pad4 = new TPad("pad4","This is pad4",0.52,0.02,0.98,0.48,1);
02203    pad1->Draw();
02204    pad2->Draw();
02205    pad3->Draw();
02206    pad4->Draw();
02207    gStyle->SetStatW(0.30);
02208    gStyle->SetStatH(0.20);
02209    gStyle->SetStatColor(42);
02210    pad1->cd();
02211    pad1->SetGrid();
02212    pad1->SetLogy();
02213    pad1->GetFrame()->SetFillColor(15);
02214    TNtuple *ntuple = (TNtuple*)gLocalFile->Get("ntuple");
02215    ntuple->SetLineColor(1);
02216    ntuple->SetFillStyle(1001);
02217    ntuple->SetFillColor(45);
02218    ntuple->Draw("3*px+2","px**2+py**2>1");
02219    ntuple->SetFillColor(38);
02220    ntuple->Draw("2*px+2","pz>2","same");
02221    ntuple->SetFillColor(5);
02222    ntuple->Draw("1.3*px+2","(px^2+py^2>4) && py>0","same");
02223    pad1->RedrawAxis();
02224    pad2->cd();
02225    pad2->SetGrid();
02226    pad2->GetFrame()->SetFillColor(32);
02227    ntuple->Draw("pz:px>>hprofs","","goffprofs");
02228    TProfile *hprofs = (TProfile*)gDirectory->Get("hprofs");
02229    hprofs->SetMarkerColor(5);
02230    hprofs->SetMarkerSize(0.7);
02231    hprofs->SetMarkerStyle(21);
02232    hprofs->Fit("pol2","q");
02233    TF1 *fpol2 = hprofs->GetFunction("pol2");
02234    fpol2->SetLineWidth(4);
02235    fpol2->SetLineColor(2);
02236    pad3->cd();
02237    pad3->GetFrame()->SetFillColor(38);
02238    pad3->GetFrame()->SetBorderSize(8);
02239    ntuple->SetMarkerColor(1);
02240    ntuple->Draw("py:px","pz>1");
02241    ntuple->SetMarkerColor(2);
02242    ntuple->Draw("py:px","pz<1","same");
02243    pad4->cd();
02244    ntuple->Draw("pz:py:px","(pz<10 && pz>6)+(pz<4 && pz>3)");
02245    ntuple->SetMarkerColor(4);
02246    ntuple->Draw("pz:py:px","pz<6 && pz>4","same");
02247    ntuple->SetMarkerColor(5);
02248    ntuple->Draw("pz:py:px","pz<4 && pz>3","same");
02249    TPaveText *l4 = new TPaveText(-0.9,0.5,0.9,0.95);
02250    l4->SetFillColor(42);
02251    l4->SetTextAlign(12);
02252    l4->AddText("You can interactively rotate this view in 2 ways:");
02253    l4->AddText("  - With the RotateCube in clicking in this pad");
02254    l4->AddText("  - Selecting View with x3d in the View menu");
02255    l4->Draw();
02256    gStyle->SetStatColor(19);
02257 
02258    TestReport1(C, "Ntuple drawing and TPad");
02259    DoCcode(C);
02260    TestReport2();
02261 }
02262 
02263 
02264 //______________________________________________________________________________
02265 void quarks()
02266 {
02267    // 2nd complex drawing and TPad test
02268 
02269    TCanvas *C = StartTest(630,760);
02270 
02271    C->SetFillColor(kBlack);
02272    Int_t quarkColor  = 50;
02273    Int_t leptonColor = 16;
02274    Int_t forceColor  = 38;
02275    Int_t titleColor  = kYellow;
02276    Int_t border = 8;
02277    TLatex *texf = new TLatex(0.90,0.455,"Force Carriers");
02278    texf->SetTextColor(forceColor);
02279    texf->SetTextAlign(22); texf->SetTextSize(0.07); texf->SetTextAngle(90);
02280    texf->Draw();
02281    TLatex *texl = new TLatex(0.11,0.288,"Leptons");
02282    texl->SetTextColor(leptonColor);
02283    texl->SetTextAlign(22); texl->SetTextSize(0.07); texl->SetTextAngle(90);
02284    texl->Draw();
02285    TLatex *texq = new TLatex(0.11,0.624,"Quarks");
02286    texq->SetTextColor(quarkColor);
02287    texq->SetTextAlign(22); texq->SetTextSize(0.07); texq->SetTextAngle(90);
02288    texq->Draw();
02289    TLatex tex1(0.5,0.5,"u");
02290    tex1.SetTextColor(titleColor); tex1.SetTextFont(32); tex1.SetTextAlign(22);
02291    tex1.SetTextSize(0.14); tex1.DrawLatex(0.5,0.93,"Elementary");
02292    tex1.SetTextSize(0.12); tex1.DrawLatex(0.5,0.84,"Particles");
02293    tex1.SetTextSize(0.05); tex1.DrawLatex(0.5,0.067,"Three Generations of Matter");
02294    tex1.SetTextColor(kBlack); tex1.SetTextSize(0.8);
02295    TPad *pad = new TPad("pad", "pad",0.15,0.11,0.85,0.79);
02296    pad->Draw();
02297    pad->cd();
02298    pad->Divide(4,4,0.0003,0.0003);
02299    pad->cd(1); gPad->SetFillColor(quarkColor);   gPad->SetBorderSize(border);
02300    tex1.DrawLatex(.5,.5,"u");
02301    pad->cd(2); gPad->SetFillColor(quarkColor);   gPad->SetBorderSize(border);
02302    tex1.DrawLatex(.5,.5,"c");
02303    pad->cd(3); gPad->SetFillColor(quarkColor);   gPad->SetBorderSize(border);
02304    tex1.DrawLatex(.5,.5,"t");
02305    pad->cd(4); gPad->SetFillColor(forceColor);   gPad->SetBorderSize(border);
02306    tex1.DrawLatex(.5,.55,"#gamma");
02307    pad->cd(5); gPad->SetFillColor(quarkColor);   gPad->SetBorderSize(border);
02308    tex1.DrawLatex(.5,.5,"d");
02309    pad->cd(6); gPad->SetFillColor(quarkColor);   gPad->SetBorderSize(border);
02310    tex1.DrawLatex(.5,.5,"s");
02311    pad->cd(7); gPad->SetFillColor(quarkColor);   gPad->SetBorderSize(border);
02312    tex1.DrawLatex(.5,.5,"b");
02313    pad->cd(8); gPad->SetFillColor(forceColor);   gPad->SetBorderSize(border);
02314    tex1.DrawLatex(.5,.55,"g");
02315    pad->cd(9); gPad->SetFillColor(leptonColor);  gPad->SetBorderSize(border);
02316    tex1.DrawLatex(.5,.5,"#nu_{e}");
02317    pad->cd(10); gPad->SetFillColor(leptonColor); gPad->SetBorderSize(border);
02318    tex1.DrawLatex(.5,.5,"#nu_{#mu}");
02319    pad->cd(11); gPad->SetFillColor(leptonColor); gPad->SetBorderSize(border);
02320    tex1.DrawLatex(.5,.5,"#nu_{#tau}");
02321    pad->cd(12); gPad->SetFillColor(forceColor);  gPad->SetBorderSize(border);
02322    tex1.DrawLatex(.5,.5,"Z");
02323    pad->cd(13); gPad->SetFillColor(leptonColor); gPad->SetBorderSize(border);
02324    tex1.DrawLatex(.5,.5,"e");
02325    pad->cd(14); gPad->SetFillColor(leptonColor); gPad->SetBorderSize(border);
02326    tex1.DrawLatex(.5,.56,"#mu");
02327    pad->cd(15); gPad->SetFillColor(leptonColor); gPad->SetBorderSize(border);
02328    tex1.DrawLatex(.5,.5,"#tau");
02329    pad->cd(16); gPad->SetFillColor(forceColor);  gPad->SetBorderSize(border);
02330    tex1.DrawLatex(.5,.5,"W");
02331    C->cd();
02332 
02333    TestReport1(C, "Divided pads and TLatex");
02334    DoCcode(C);
02335    TestReport2();
02336 }
02337 
02338 
02339 //______________________________________________________________________________
02340 void timage()
02341 {
02342    // TImage test
02343 
02344    TCanvas *C = StartTest(800,800);
02345 
02346    TImage *img = TImage::Open("$(ROOTSYS)/tutorials/image/rose512.jpg");
02347    if (!img) {
02348       printf("Could not create an image... exit\n");
02349       return;
02350    }
02351    TImage *i1 = TImage::Open("$(ROOTSYS)/tutorials/image/rose512.jpg");
02352    i1->SetConstRatio(kFALSE);
02353    i1->Flip(90);
02354    TImage *i2 = TImage::Open("$(ROOTSYS)/tutorials/image/rose512.jpg");
02355    i2->SetConstRatio(kFALSE);
02356    i2->Flip(180);
02357    TImage *i3 = TImage::Open("$(ROOTSYS)/tutorials/image/rose512.jpg");
02358    i3->SetConstRatio(kFALSE);
02359    i3->Flip(270);
02360    TImage *i4 = TImage::Open("$(ROOTSYS)/tutorials/image/rose512.jpg");
02361    i4->SetConstRatio(kFALSE);
02362    i4->Mirror(kTRUE);
02363    float d = 0.40;
02364    TPad *p1 = new TPad("i1", "i1", 0.05, 0.55, 0.05+d*i1->GetWidth()/i1->GetHeight(), 0.95);
02365    TPad *p2 = new TPad("i2", "i2", 0.55, 0.55, 0.95, 0.55+d*i2->GetHeight()/i2->GetWidth());
02366    TPad *p3 = new TPad("i3", "i3", 0.55, 0.05, 0.55+d*i3->GetWidth()/i3->GetHeight(), 0.45);
02367    TPad *p4 = new TPad("i4", "i4", 0.05, 0.05, 0.45, 0.05+d*i4->GetHeight()/i4->GetWidth());
02368    p1->Draw();
02369    p1->cd();
02370    i1->Draw();
02371    C->cd();
02372    p2->Draw();
02373    p2->cd();
02374    i2->Draw();
02375    C->cd();
02376    p3->Draw();
02377    p3->cd();
02378    i3->Draw();
02379    C->cd();
02380    p4->Draw();
02381    p4->cd();
02382    i4->Draw();
02383    C->cd();
02384 
02385    TestReport1(C, "TImage");
02386    DoCcode(C);
02387    TestReport2();
02388 }
02389 
02390 
02391 //______________________________________________________________________________
02392 double fg(double *x, double *p) {return sin((*p)*(*x));}
02393 void zoomtf1()
02394 {
02395    // Zoom/UnZoom a collection of TF1
02396 
02397    TCanvas *C = StartTest(800,800);
02398 
02399    TF1* f[6];
02400 
02401    for (int i=0;i<6;++i) {
02402       f[i]=new TF1(Form("f%d",i),fg, 0,2, 1);
02403       f[i]->SetParameter(0,i+1);
02404       f[i]->SetLineColor(i+1);
02405       f[i]->Draw(i?"same":"");
02406    }
02407    f[0]->GetXaxis()->SetRangeUser(.1,.3);
02408    gPad->Update();
02409    f[0]->GetXaxis()->UnZoom();
02410    gPad->Modified();
02411 
02412    TestReport1(C, "Zoom/UnZoom a collection of TF1");
02413    if (gOptionR) {
02414       DoCcode(C);
02415       TestReport2();
02416    }
02417 }
02418 
02419 
02420 //______________________________________________________________________________
02421 void zoomfit()
02422 {
02423    // Zoom/UnZoom a fitted histogram
02424 
02425    TCanvas *C = StartTest(800,800);
02426 
02427    TH1 *hpx = (TH1*)gLocalFile->Get("hpx");
02428    hpx->Fit("gaus","q");
02429    hpx->GetXaxis()->SetRangeUser(.1,.3);
02430    gPad->Modified();
02431    gPad->Update();
02432    hpx->GetXaxis()->UnZoom();
02433    gPad->Modified();
02434    gPad->Update();
02435 
02436    TestReport1(C, "Zoom/UnZoom a fitted histogram");
02437    DoCcode(C);
02438    TestReport2();
02439 }
02440 
02441 
02442 //______________________________________________________________________________
02443 void parallelcoord()
02444 {
02445    // Parallel Coordinates
02446 
02447    TCanvas *C = StartTest(800,700);
02448 
02449    TNtuple *ntuple = (TNtuple*)gLocalFile->Get("ntuple");
02450 
02451    C->Divide(1,2);
02452 
02453    C->cd(1);
02454    ntuple->Draw("px:py:pz:random:px*py*pz","","para");
02455    C->cd(2);
02456    ntuple->Draw("px:py:pz:random:px*py*pz","","candle");
02457 
02458    TestReport1(C, "Parallel Coordinates");
02459    if (gOptionR) {
02460       DoCcode(C);
02461       TestReport2();
02462    }
02463 }
02464 
02465 
02466 //______________________________________________________________________________
02467 void clonepad()
02468 {
02469    // Draw a pad and clone it
02470 
02471    TCanvas *C = StartTest(700,500);
02472 
02473    TH1 *hpxpy = (TH1*)gLocalFile->Get("hpxpy");
02474    hpxpy->Draw();
02475    TCanvas *C2 = (TCanvas*)C->DrawClone();
02476 
02477    TestReport1(C2, "Draw a pad and clone it");
02478 }
02479 
02480 
02481 //______________________________________________________________________________
02482 Double_t interference( Double_t *x, Double_t *par)
02483 {
02484    // Needed for the "waves" test
02485 
02486    Double_t x_p2 = x[0] * x[0];
02487    Double_t d_2 = 0.5 * par[2];
02488    Double_t ym_p2 = (x[1] - d_2) * (x[1] - d_2);
02489    Double_t yp_p2 = (x[1] + d_2) * (x[1] + d_2);
02490    Double_t  tpi_l = TMath::Pi() /  par[1];
02491    Double_t amplitude = par[0] * (cos(tpi_l  * sqrt(x_p2 + ym_p2))
02492                          + par[3] * cos(tpi_l  * sqrt(x_p2 + yp_p2)));
02493    return amplitude * amplitude;
02494 }
02495 
02496 
02497 //______________________________________________________________________________
02498 Double_t result( Double_t *x, Double_t *par)
02499 {
02500    // Needed for the "waves" test
02501 
02502    Double_t xint[2];
02503    Double_t  maxintens = 0, xcur = 14;
02504    Double_t dlambda = 0.1 * par[1];
02505    for(Int_t i=0; i<10; i++){
02506       xint[0] = xcur;
02507       xint[1] = x[1];
02508       Double_t  intens = interference(xint, par);
02509       if(intens > maxintens) maxintens = intens;
02510       xcur -= dlambda;
02511    }
02512    return maxintens;
02513 }
02514 
02515 
02516 //______________________________________________________________________________
02517 void waves()
02518 {
02519    // TGraph, TArc, TPalette and TColor
02520 
02521    TF2 * finter;
02522    Double_t d = 3;
02523    Double_t lambda = 1;
02524    Double_t amp = 10;
02525 
02526    TCanvas *C = StartTest(1004, 759);
02527 
02528    C->Range(0, -10,  30, 10);
02529    C->SetFillColor(0);
02530    TPad *pad = new TPad("pr","pr",  0.5, 0 , 1., 1);
02531    pad->Range(0, -10,  15, 10);
02532    pad->Draw();
02533 
02534    const Int_t colNum = 30;
02535    Int_t palette[colNum];
02536    Int_t color_offset = 1001;
02537    for (Int_t i=0;i<colNum;i++) {
02538       new TColor(color_offset+i
02539       ,    pow(i/((colNum)*1.0),0.3)
02540       ,    pow(i/((colNum)*1.0),0.3)
02541       ,0.5*(i/((colNum)*1.0)),"");
02542       palette[i] = color_offset+i;
02543    }
02544    gStyle->SetPalette(colNum,palette);
02545    C->cd();
02546    TF2 * f0 = new TF2("ray_source",interference, 0.02, 15, -8, 8, 4);
02547 
02548    f0->SetParameters(amp, lambda, 0, 0);
02549    f0->SetNpx(200);
02550    f0->SetNpy(200);
02551    f0->SetContour(colNum-2);
02552    f0->Draw("samecolz");
02553 
02554    TLatex title;
02555    title.DrawLatex(1.6, 8.5, "A double slit experiment");
02556 
02557    TGraph *graph = new TGraph(4);
02558    graph->SetFillColor(0);
02559    graph->SetFillStyle(1001);
02560    graph->SetLineWidth(0);
02561    graph->SetPoint(0, 0., 0.1);
02562    graph->SetPoint(1, 14.8, 8);
02563    graph->SetPoint(2, 0, 8);
02564    graph->SetPoint(3, 0, 0.1);
02565    graph->Draw("F");
02566 
02567    graph = new TGraph(4);
02568    graph->SetFillColor(0);
02569    graph->SetFillStyle(1001);
02570    graph->SetLineWidth(0);
02571    graph->SetPoint(0, 0, -0.1);
02572    graph->SetPoint(1, 14.8, -8);
02573    graph->SetPoint(2, 0, -8);
02574    graph->SetPoint(3, 0, -0.1);
02575    graph->Draw("F");
02576 
02577    TLine * line;
02578    line = new TLine(15,-10, 15, 0 - 0.5*d -0.2);
02579    line->SetLineWidth(10); line->Draw();
02580    line = new TLine(15, 0 - 0.5*d +0.2 ,15, 0 + 0.5*d -0.2);
02581    line->SetLineWidth(10); line->Draw();
02582 
02583    line = new TLine(15,0 + 0.5*d + 0.2,15, 10);
02584    line->SetLineWidth(10); line->Draw();
02585 
02586    pad ->cd();
02587    finter = new TF2("interference",interference, 0.01, 14, -10, 10, 4);
02588 
02589    finter->SetParameters(amp, lambda, d, 1);
02590    finter->SetNpx(200);
02591    finter->SetNpy(200);
02592    finter->SetContour(colNum-2);
02593    finter->Draw("samecolorz");
02594 
02595    TArc *arc = new TArc();;
02596    arc->SetFillStyle(0);
02597    arc->SetLineWidth(2);
02598    arc->SetLineColor(5);
02599    Float_t r = 0.5 * lambda, dr = lambda;
02600       for (Int_t i = 0; i < 15; i++) {
02601       arc->DrawArc(0,  0.5*d, r, 0., 360., "only");
02602       arc->DrawArc(0, -0.5*d, r, 0., 360., "only");
02603       r += dr;
02604    }
02605 
02606    pad ->cd();
02607    TF2 * fresult = new TF2("result",result, 14, 15, -10, 10, 4);
02608 
02609    fresult->SetParameters(amp, lambda, d, 1);
02610    fresult->SetNpx(300);
02611    fresult->SetNpy(300);
02612    fresult->SetContour(colNum-2);
02613    fresult->Draw("samecolor");
02614    line = new TLine(13.8,-10, 14, 10);
02615    line->SetLineWidth(10); line->SetLineColor(0); line->Draw();
02616 
02617    TestReport1(C, "TGraph, TArc, TPalette and TColor");
02618 ///DoCcode(C);
02619 ///TestReport2();
02620    if (gOptionR) printf("\n");
02621 }
02622 
02623 
02624 //______________________________________________________________________________
02625 void cleanup()
02626 {
02627 }

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