Update histogram drawing in a loop

From: James Jackson <james.jackson_at_cern.ch>
Date: Wed, 10 Dec 2008 21:29:04 +0000


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:29:14 CET

This archive was generated by hypermail 2.2.0 : Wed Dec 10 2008 - 23:50:01 CET