Re: hist painter

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Fri, 20 Aug 2010 08:35:57 +0200


Hi Akira,
OKUMURA, Akira wrote:
> Hello Rene,
>
> Thank you. I have two more questions.
>
> 1. Is there any way to get the current painter name which is set via TVirtualHistPainter::SetPainter?
>

use static TVirtualHistPainter *HistPainter(TH1 *obj)
> 2. Do I have to always call TVirtualHistPainter::SetPainter("MyHistPainter") when I clone a TH1 whose painter is MyHistPainter?
>

No, the fPainter member is not persistent. When painting the cloned histogram, the current painter will be used.
> 3. Is there any way to set another painter (e.g. from THistPainter to MyHistPainter) after TH1::GetPainter is called first time?
>

Currently there is no way (other than calling Clone or DrawCopy to reset the painter once the histogram has been painted.

Rene brun
> Regards,
>
> --
> OKUMURA, Akira oxon@{astro.isas.jaxa.jp,stanford.edu}
> Institute of Space and Astronautical Science (ISAS/JAXA)
> Now at KIPAC/SLAC/Stanford
> Varian Physics #306
> 382 Via Pueblo Mall, MC 406 Stanford, CA94305
> TEL 650-736-0971/FAX 650-724-5065
> Skype : okumura.akira
>
> On 2010/08/19, at 1:31, Rene Brun wrote:
>
>
>> Hi Akira,
>>
>> Yes, your interpretation is correct.
>>
>> Rene
>>
>> OKUMURA, Akira wrote:
>>
>>> Hello ROOTers,
>>>
>>> I am writing a class MyHistPainter which derive from THistPainter.
>>>
>>> Since TH1 does not have a method SetPainter, I have to write my code as follows.
>>>
>>> TVirtualHistPainter::SetPainter("MyHistPainter"); // switch the default painter to mine
>>> TH1* hist = new TH1("", "", 100, 0, 1);
>>> hist->GetPainter(); // create a painter
>>> TVirtualHistPainter::SetPainter("THistPainter"); // revert to the original one
>>>
>>> Is this a correct way when using own painter?
>>>
>>> Regards,
>>>
>>> --
>>> OKUMURA, Akira oxon@{astro.isas.jaxa.jp,stanford.edu}
>>> Institute of Space and Astronautical Science (ISAS/JAXA)
>>> Now at KIPAC/SLAC/Stanford
>>> Varian Physics #306
>>> 382 Via Pueblo Mall, MC 406 Stanford, CA94305
>>> TEL 650-736-0971/FAX 650-724-5065
>>> Skype : okumura.akira
>>>
>>>
>>>
>
>
Received on Fri Aug 20 2010 - 08:36:03 CEST

This archive was generated by hypermail 2.2.0 : Fri Aug 20 2010 - 11:50:01 CEST