RE: *Rotate* Update histogram drawing in a loop

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Thu, 11 Dec 2008 11:12:43 +0100


If "c" is the TCanvas do:

c->SetTheta(..);
c->SetPhi(..);

OC

-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On Behalf Of James Jackson
Sent: Wednesday, December 10, 2008 10:49 PM To: Christopher Jones
Cc: roottalk_at_lxbuild091.cern.ch
Subject: Re: [ROOT] *Rotate* Update histogram drawing in a loop

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 Thu Dec 11 2008 - 11:12:49 CET

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