RE: [ROOT] TNtuple::Draw question....

From: Philippe Canal (pcanal@fnal.gov)
Date: Wed Jul 30 2003 - 17:11:38 MEST


Hi,

Starting with ROOT 3.05/06, TTree::Draw can call any global function.
So you 'just' need to create a new global function that return value.
For example:
    class foo: public TNtuple{
    ...
    private:
	static foo *fgCurrent;
    public:
	static void SetCurrent(foo*) { fgCurrent = foo; }
       static Double_t GetCurrentValue() { return
fgCurrent?fgCurrent->value:0; }
    };
    ..
    ...
    onyou->Draw("x:y/foo::GetCurrentValue()");

Or more you can embedded the current value in the string:

    onyou->Draw(Form("x:y/%lf",onyou->GetValue()));

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Ray Fliller III
Sent: Wednesday, July 30, 2003 8:56 AM
To: ROOT mailing list
Subject: [ROOT] TNtuple::Draw question....




  Hello Rooters,


    I have a class that looks like

    class foo: public TNtuple{
	protected:

       Double_t value;

	public:
	foo(char *name, char *title, char *varlist):
		TNtuple(name,title,varlist)
          ....
       Double_t GetValue() const {return value;}
         ....
    }

  Assume that the TNtuple have columns x,y,z, how can I do

  foo *onyou= new foo("foo","onyou","x:y:z");
  onyou->Draw("x:y/GetValue()")

  or some such thing.


--

 RAINMAN
      "How much does a piece of gum cost Ray?"
      "About $100."
      "How much does a new car cost Ray?"
      "`Bout $100."
      "There goes working for NASA!"

==================================================================
Ray Fliller: rfliller@bnl.gov      Office Phone: (631)-344-6124
C-A Accelerator Physics            Dept. Fax: (631)-344-5954
Building 911B
Brookhaven National Lab
Upton, NY 11973                    Office: Room 211

http://www.agsrhichome.bnl.gov/People/rfliller/
==================================================================


#################################################################
#################################################################
#################################################################
#####
#####
#####
#################################################################
#################################################################
#################################################################



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