Having in mind that one should not call Draw() in a loop; for an object in
a canvas (because TPad adds poiter to an object every time one calls
Draw()), I find this example a little bit strange (taken from Consumer
example) :
Int_t oldentries = 0;
while (1) {
hpx = (TH1F *) mfile->Get("hpx", hpx);
hpxpy = (TH2F *) mfile->Get("hpxpy", hpxpy);
hprof = (TProfile *) mfile->Get("hprof", hprof);
if (hpx->GetEntries() == oldentries) break;
oldentries = hpx->GetEntries();
if (!gROOT->IsBatch()) {
pad1->cd();
hpx->Draw();
pad2->cd();
hprof->Draw();
pad3->cd();
hpxpy->Draw("cont");
c1->Modified();
c1->Update();
} else {
printf("Entries, hpx=%d, Mean=%g,
RMS=%g\n",hpx->GetEntries(),hpx->GetMean(),hpx->GetRMS());
}
gSystem->Sleep(100); // sleep for 0.1 seconds
}
Of course every time we call TMapFile.Get(); we get a new object, but then
what about multiple Draw(); calls for the same TPad(); ? Is it ok, or can
we avoid it somehow?
Best regards,
Dr. Anton Fokin
Division of Cosmic and Subatomic Physics
Lund University
Sweden