Hi Stelios, Currently you can not use any user defined free-standing function in the TTree::Draw command. You can only use the function defined in TFormula and the method of the objects stored in the tree. In order to use a user defined free-standing function you currently have to use and customize the result of MakeSelector. We are currently working on improvements to TTree::Draw that will simplify this type of usage. Cheers, Philippe. -----Original Message----- From: owner-about-root@listserv.fnal.gov [mailto:owner-about-root@listserv.fnal.gov]On Behalf Of Stilianos Kesisoglou Sent: Sunday, June 08, 2003 8:14 PM To: roottalk@root.cern.ch; roottalk@pcroot.cern.ch; about-root@fnal.gov Subject: Using a user defined function from the command line Hi, Is it possible to use a user defined function from the command line on ROOT when drawing a histogram? For example I have the function: #include <cmath> float angl(float y, float phi) { const float pi = 3.141592654; float angle; if (y==0.0) { angle = pi; } else if (y>0.0) { angle = phi; } else { angle = phi-2*pi; } return angle; } and I load it to ROOT: root[] .L angl.C I can use it from the command line if I want to: root[] angl(0.5,0.58) with no problem, but what about when I plot a histogram? root[] myTree->Draw("angl(y,phi)") (where "y" and "phi" are variables of the tree "myTree") I try to do it and ROOT complains. I would like to do it exactly as if that function was let's say "atan2" Any suggestions? Thanks! Stelios.
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET