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