Re: Weights with user defined functions

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Nov 18 1997 - 16:20:57 MET


Scott Sampson wrote:

> Hi,
>
> I want to use a function to control the weighting of histograms projected
> from an ntuple. i.e. I define some function
>
> float weight(float var) { .... return weight;}
>
> and then when I project the histogram I use this function and a variable
> from the ntuple:
>
> nt->Draw("x>>h1","weight(z)")
>
> where x and z are ntuple variables. The problem is that I get an error
> message
>
> Unknown name : "weight(z)"
>
> Now this does work if I use some library routine like sin(z). How can I
> define my own weighting functions? Thanks,

This feature is not implemented in TTree::Draw.
Only standard mathematical functions can be called.
For a more sophisticated analysis with user defined functions
use TTree::MakeCode to generate the skeleton of an analysis
function.

Rene Brun



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