Re: painting an object derived from TH1

From: Valeri Fine (Faine) (fine@bnl.gov)
Date: Thu Oct 21 1999 - 16:51:04 MEST


----- Original Message ----- 
From: Damir Buskulic <buskulic@lapp.in2p3.fr>
To: ROOT mailing list <roottalk@hpsalo.cern.ch>
Sent: 21 октября 1999 г. 5:13
Subject: painting an object derived from TH1


> Hi,
> 
> with the new library scheme of ROOT, the Painter and Hist are separated.
> I have a class that derives from TH1F, but I would like to paint some
> parts differently, namely the stat box. Before, I was just overloading
> the TH1::PaintStats method.
> How can I do it now ? Do I have to specify a completely different
> painter that I have to rewrite ? I looked a little bit at the code and
> found that the static member fgPainter was holding the class description
> of the current Painter. Since it is static, I cannot change it without
> changing also the painter for regular TH1.
> I suppose I'll just put regular stats off and overlay my own stat box.
> 
> Any other ideas ?

You may re-define two classes:

class  TMyHist : public TH1 {
  public: 
    TVirtualHistPainter * Painter(TVirtualHistPainter *myPainter) {
      TVirtualHistPainter * old = fPainter;
      fPainter  = myPainter;
      return old;
    }
}

  Afterwards you can define your own painter and attach it to your particular 
histogram. This way you may use either standard or your own Painter with each
other Update step or for different TPads. 

                         Valery



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:41 MET