#include #include "TFile.h" #include "TTree.h" #include "TCanvas.h" #include "TStopwatch.h" using namespace std; int addone( int foo ) { return foo+1; } int icount; TTree* buildtree( ) { TFile *f = new TFile("deleteme.root","RECREATE"); TTree *t = new TTree("aTree","aTree"); t->Branch("count",&icount,"count/I"); for ( icount=0; icount!=200000; ++icount ) { t->Fill(); } return t; } void testit() { TTree *t = buildtree(); TStopwatch w; w.Start(); cout << "start loop:" << endl; int sum=0; for ( int i=0; i!=200000; ++i ) { sum += addone(i); } w.Stop(); cout << "done: loop1; " << sum << endl; w.Print(); new TCanvas(); w.Start(); t->Draw("count"); w.Stop(); cerr << "done: Draw 1" << endl; w.Print(); new TCanvas(); w.Start(); t->Draw("addone(count)"); w.Stop(); cerr << "done: Draw 2" << endl; w.Print(); }