#define Ex3_cxx
#include "Ex3.h"

void Ex3::Loop()
{

   if (fTree == 0) return;

   Int_t nentries = Int_t(fTree->GetEntries());
	
	// declare a histogram
	TH1F *myHisto		= new TH1F("myHisto","fPx",100,2,20);	

	// limit the loop to the last 100 entries
	// read the entry and fill the histogram with p
	for (Int_t i = (nentries - 100); i< nentries; i++) {
		fTree->GetEntry(i);
		myHisto->Fill(p);
   }

	// draw the histogram to a default canvasS
	myHisto->Draw();

}
