# ntuple1

    //
    // To see the output of this macro, click  here
    //
    gROOT.Reset("c1");
    TCanvas c1("c1","The Ntuple canvas",700,780);
    //
    // Connect ROOT histogram/ntuple demonstration file
    // generated by example  A Batch example,etc..>
    TFile f1("hsimple.root");
    //
    // Inside this canvas, we create 4 pads
    //
    TPad pad1("pad1","This is pad1",0.02,0.52,0.46,0.46,18);
    TPad pad2("pad2","This is pad2",0.52,0.52,0.46,0.46,18);
    TPad pad3("pad3","This is pad3",0.02,0.02,0.46,0.46,18);
    TPad pad4("pad4","This is pad4",0.52,0.02,0.46,0.46,18);
    pad1.Draw();
    pad2.Draw();
    pad3.Draw();
    pad4.Draw();
    //
    // Change default style for the statistics box
    gStyle.SetStatW(0.30);
    gStyle.SetStatH(0.20);
    gStyle.SetStatColor(28);
    //
    // Display a function of one ntuple column imposing a condition
    // on another column.
    pad1.cd();
    pad1.SetGridx();
    pad1.SetGridy();
    pad1.SetLogy();
    ntuple.SetLineColor(1);
    ntuple.SetFillStyle(1001);
    ntuple.SetFillColor(24);
    ntuple.Draw("3*px+2","px**2+py**2>1");
    ntuple.SetFillColor(49);
    ntuple.Draw("2*px+2","pz>2","same");
    ntuple.SetFillStyle(3008);
    ntuple.SetFillColor(37);
    ntuple.Draw("1.3*px+2","(px^2+py^2>4) && py>0","same");
    //
    // Display the profile of two columns
    // The profile histogram produced is saved in the current directory with the name hprofs
    pad2.cd();
    pad2.SetGridx();
    pad2.SetGridy();
    ntuple.Draw("pz:px>>hprofs","","profs");
    hprofs.SetMarkerStyle(21);
    hprofs.Fit("pol2","","same");
    // Get pointer to fitted function and modify its attributes
    TF1 *fpol2=hprofs.GetFunction("pol2");
    fpol2.SetLineWidth(4);
    fpol2.SetLineColor(5);
    //
    // Display a scatter plot of two columns with a selection.
    // Superimpose the result of another cut with a different marker color
    pad3.cd();
    ntuple.SetMarkerColor(1);
    ntuple.Draw("py:px","pz>1");
    ntuple.SetMarkerColor(2);
    ntuple.Draw("py:px","pz<1","same");
    //
    // Display a 3-D scatter plot of 3 columns. Superimpose a different selection.
    pad4.cd();
    ntuple.Draw("pz:py:px","(pz<10 && pz>6)+(pz<4 && pz>3)");
    ntuple.SetMarkerColor(4);
    ntuple.Draw("pz:py:px","pz<6 && pz>4","same");
    ntuple.SetMarkerColor(5);
    ntuple.Draw("pz:py:px","pz<4 && pz>3","same");
    TPaveText l4(-0.9,0.5,0.9,0.95);
    l4.SetFillColor(28);
    l4.SetTextAlign(12);
    l4.AddText("You can interactively rotate this view in 2 ways:");
    l4.AddText("  - With the RotateCube in clicking in this pad");
    l4.AddText("  - Selecting View with x3d in the View menu");
    l4.Draw();
    //
    c1.cd();
    gStyle.SetStatColor(19);

[ROOT page] [Class index] [Top of the page]

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.