Hi James,
I've always done this by instantiating TCanvas myself, and then when you want to update the histogram, call TCanvas::Update().
TCanvas *c = new TCanvas( ... );
[...]
if (i % 1000 == 0) {
hist->Draw(); c->Update();
Hope this helps.
On Dec 10, 2008, at 4:29 PM, James Jackson wrote:
> Hi,
>
> I would like to update the drawing of a histogram periodicially
> within a loop where it is being filled, i.e.:
>
> TH2F *myHist = new TH2F("myHist", "Titles", 100, -5., 5., 100, 0.,
> 20.);
> etaGammaAcc->Draw("LEGO");
>
> for(Int_t i = 0; i < 5000000; ++i)
> {
> // Values for this iteration
> Double_t val1 = someCalculation();
> Double_t val2 = somOtherCalculation();
>
> // Fill the histogram
> myHist->Fill(val1, val2);
>
> // Plot every 1000 iterations
> if(i % 1000 == 0)
> {
> myHist->Draw("LEGO");
> }
> }
>
> However, this doesn't work - I only get a blank canvas displayed
> until the loop exits (or I kill the script). Is there a way to do
> this?
>
> Regards,
> James.
>
Received on Wed Dec 10 2008 - 22:39:05 CET
This archive was generated by hypermail 2.2.0 : Thu Dec 11 2008 - 17:50:02 CET