Re: [ROOT] SetPainter

From: Aldo F. Saavedra (afsaavedra@lbl.gov)
Date: Wed Jun 18 2003 - 11:33:00 MEST


Hi Rene, Axel,

Thanks for the tip. Once I created the dictionary for my
derived class everything worked fine. I was just not
sure.

>
> I am just curious to know why you want to create your own HistPainter?
>  -missing functionality in the default painter?
>  -a feature you do not like?

The only reason I created a new painting object for the
histogram was because the COLZ option with TH2.
I wanted the bin of the histogram coloured but the colz
uses a colour proportional to its value.
I think this works fine with a big distribution
of numbers where you can see a trend.

One of my datasets only had 11 values and I wanted the colour
of the bin be equal to a specific value. The z palette
would show this relationship.

So I modified the PaintColorLevels function so that
it would find to which Contourlevel the bin value belonged.
The colour would then be obtained from GetColorPalette(Contourlevel)
and use the colour to paint the bin.

The second change was with the z palette. My problem with
the z palette was that it showed the levels proportional to
their value. So if you had a big interval and a few small ones.
only the big interval was the one really visible. This
was not very helpful when
for example looking at currents of the chip.
if I had the following contourlevels
0 4 5 5.2 5.4 5.6 5.8 6.0 10 200 . The 10 - 200 colour would
use most of the palette. But the interesting region is the 4-6mA
region and you wanted to see which bins in the histogram belonged
to the 4-6mA. You wanted to see how the 4-6mA changed within
the histogram.

So I changed PaintPalette so that all the colours would be equally
spaced no matter their value. But their actual contour value would
be printed. I include an example.

Cheers,
Aldo



>
> Rene Brun
>
> "Aldo F. Saavedra" wrote:
> >
> > Hi,
> >
> > I was wondering if someone could help me with the
> > following. I found you could set your own
> > painting class using SetPainter function.
> >
> > So in my code I have included the following:
> > TVirtualHistPainter::SetPainter("TMyHistoPainter");
> >
> > The TMyHistoPainter class is derived from
> > THistPainter as shown in the code below.
> >
> > The problem is that I had not being able
> > to set the name to TMyHistoPainter class
> > to "TMyHistoPainter" .
> >
> > One tactic that I tried was
> > to let TMyHistoPainter
> > inherit TNamed which contains functions
> > that allow you to set the classname.
> > But during the compilation I had
> > the message that the delete function
> > was ambiguous. I think both functions
> > had the implemented the function.
> >
> > So my question is how to name TMyHistoPainter
> > class "TMyHistoPainter".
> >
> > At the moment I'm using 3.05/05 in windows.
> >
> > Any ideas would be greatly appreciated.
> >
> > // a bit of the code
> > // definition of the class
> > #include "THistPainter.h"
> > #include "Rtypes.h"
> >
> > class TMyHistoPainter: public THistPainter
> > {
> >
> >   public:
> >   TMyHistoPainter();
> >
> >   ClassDef(TMyHistoPainter,0)
> >
> > };
> >
> > // implementation of the class
> >
> > ClassImp(TMyHistoPainter)
> >
> > TMyHistoPainter::TMyHistoPainter():THistPainter()
> > {// the constructor
> >
> > }
> >
> > ***********************************************************
> >  Aldo F. Saavedra
> >  ATLAS Collaboration - Pixel Group (Physics Division)
> >  Lawrence Berkeley National Laboratory
> >
> >  Email: AFSaavedra@lbl.gov
> >  Phone: 1 510 486 4690
> >  Fax:   1 510 486 5101
> >  Postal Address: Lawrence Berkeley National Laboratory
> >  1 Cyclotron Rd Mailstop 50B-62222
> >  Berkeley, CA 94720
> >  USA
> > ***********************************************************
>

***********************************************************
 Aldo F. Saavedra
 ATLAS Collaboration - Pixel Group (Physics Division)
 Lawrence Berkeley National Laboratory

 Email: AFSaavedra@lbl.gov
 Phone: 1 510 486 4690
 Fax:   1 510 486 5101
 Postal Address: Lawrence Berkeley National Laboratory
 1 Cyclotron Rd Mailstop 50B-62222
 Berkeley, CA 94720
 USA
***********************************************************



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET