Re: *Rotate* Update histogram drawing in a loop

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


Thanks Chris / Kevin, works a treat. This now leaves me with another quandry - I just get the default projection, whereas I would like it be rotated to a more useable view. I can't find anything obvious to perform this programmatically, does anyone have any hints?

Regards,
James.

On 10 Dec 2008, at 21:38, Christopher Jones wrote:

> 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:49:19 CET

This archive was generated by hypermail 2.2.0 : Thu Dec 11 2008 - 11:50:01 CET