You are here

Using TTree::Draw() to access a TTree

Now close the browser, quit and restart ROOT (to make sure everybody starts from the same point). Then open the file again:

root[0] TFile::Open("http://root.cern/files/introtutorials/eventdata.root");

For this exercise, you will probably need the TTree::Draw() documentation.

  1. Now, display the "fPosY" leaf values, without the browser, just by using the TTree::Draw() function. As the TTree is called EventTree, you need to call something like EventTree->Draw("X"), which would draw the distribution of X values. Of course you don't want to draw the value of X but of fPosY...the value of X but of fPosY...

    hist_posy_0.png
    Figure 4: Distribution of "fPosY" values

  2. Still the same "fPosY" leaf values, but now apply a cut in the momentum, meaning draw only the fPosY value of events with a momentum higher than 50.0. Check the documentation of TTree::Draw() - you will be using the method overload taking a const char* as selection.

    hist_cut_posy_0_0.png
    Figure 5: Distribution of "fPosY" values, with a cut at 50.0