ROOT Version : 6.12/04
Hello all, I’ve created a TGProgressBar to track the progress of my TTreeReader Loop. The problem is that the progress bar “finishes” way before my loop through the tree.
I create my progress bar like so:
TGMainFrame *fMain = new TGMainFrame(gClient->GetRoot(), 600, 300);
TGVerticalFrame *fVframe = new TGVerticalFrame(fMain, 0, 0, 0);
TGHProgressBar *Prog = new TGHProgressBar(fVframe, TGProgressBar::kFancy, 300);
Prog->SetBarColor("purple");
Prog->ShowPosition(kTRUE, kFALSE, "%.0f events");
Prog->SetRange(0, number_of_events);
fVframe->Resize(300, 300);
fVframe->AddFrame(Prog);
fMain->AddFrame(fVframe);
fMain->SetWindowName("Progress Bar for Event Loop");
TGDimension size = fMain->GetDefaultSize();
fMain->Resize(size);
fMain->MapSubwindows();
fMain->MapWindow();
Prog->Reset();
Then in my TTreeReader loop I do:
int cnt = 0;
while (reader.Next()) {
cnt++;
Prog->Increment(cnt);
//Do some analysis . . . .
if (reader.GetCurrentEntry()%1000 == 0) gSystem->ProcessEvents();
}
My TTree has about 47 million events in it, and takes about 140 seconds to loop through, whereas the progressbar fills up in maybe 5 seconds.