Re: [ROOT] User defined function as a weight.

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Aug 07 2003 - 08:35:59 MEST


Hi,

In my mail, I clearly said "Using 3.05/07"
If you want this  feature, upgrade your system to this version.

Rene Brun

On Thu, 7 
Aug 2003, Dmitry A. 
Shtol wrote:

> Thank you for advice, but I have version 3.01/06, where this method 
> doesn't work.
> 
> This is a test:
> //file MyF.C
> float MyF(float x) {                                                                      
>    return x*x;                                                                            
> }
> 
> root> .L MyF.C             
> root> h1->Draw("Eton","(Z1>0)*MyF(Eton)")
> *ERROR 26 : 
>  Unknown name : "MyF(Eton)"
> (Int_t)(-1)
> 
> 
> ==============================================================
> Dmitry A. Shtol                        (SND group)
> Budker Institute of Nuclear Physics
> 
> On Wed, 6 Aug 2003, Rene Brun wrote:
> 
> > Hi
> > 
> > Using 3.05/07, create a file w.C as below
> > 
> > //file w.C
> > double w(double z, double d, double sig) {
> >    double s2 = sqrt(2)*sig;
> >    return 0.5*(TMath::Erf((z+d)/s2-TMath::Erf((z-d)/s2));
> > }
> > 
> > then in ROOT, do
> > 
> > root > .L w.C
> > root > ntuple.Draw("el11","(z>0)*w(z1m,10,5)");
> > 
> > Rene Brun
> > 
> > 
> > 
> > On Wed, 6 Aug 
> > 2003, Dmitry A. 
> > Shtol wrote:
> > 
> > > I asked this question some time before, but didn't get answer. I need 
> > > to use user defined function as a weight in TNtuple::Draw(). In PAW it 
> > > looks like that:
> > > 
> > > app comis quit
> > >     real function w(z,d,sig)
> > >     real z,d,sig,s2
> > >     s2=sqrt(2.)*sig
> > >     w=0.5*(erf((z+d)/s2)-erf((z-d)/s2))
> > >     end
> > > quit
> > > 
> > > *************
> > > 
> > > nt/pro [id] [idn] el11 [cond]*w(z1m,10.,5.)
> > > 
> > > Where el11 and z1m are elements of ntuple.
> > > What is the simplest way to do it in ROOT?
> > > 
> > > ==============================================================
> > > Dmitry A. Shtol                        (SND group)
> > > Budker Institute of Nuclear Physics
> > > 
> > 
> 



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