Hi Philippe,
Thank you for the suggestion. When I try this, this is what happens:
analyzer [8] TF2 *myf = new TF2("myf","[0]*x+[1]*y",0.,3000.,0.,3000.) analyzer [9] myf->SetParameters(.1,.1) analyzer [10] T->UnbinnedFit("myf","electronP:preshowerE:showerE","preshowerE>450.")Error in <TTreePlayer::UnbinnedFit>: Function dimension=2 not equal to expression dimension=3 (Long64_t)0
Playing with:
T->UnbinnedFit("myf","preshowerE:showerE","(preshowerE>450.)*electronP");
does not help either. Doing
T->Fit("myf","preshowerE:showerE","(preshowerE>450.)*electronP","W")
(ignore the "error bars" on the temporary histogram being fitted) does sort of work as long as the 2-d histogram being created is binned finely enough that no bin contains more than one event.
I do have a solution for this case, it would just be nice to be able to have a general solution that is not restricted to a handful of variables and parameters with a somewhat convoluted approach. This is why I'm interested in having the Parameters work in TTreeFormula's.
Rob
On Thu, 12 Oct 2006, Philippe Canal wrote:
> Date: Thu, 12 Oct 2006 16:40:53 -0500
> From: Philippe Canal <pcanal_at_fnal.gov>
> To: 'Robert Feuerbach' <feuerbac_at_jlab.org>, 'Rene Brun' <Rene.Brun_at_cern.ch>
> Subject: RE: [ROOT] Using Parameters in TTreeFormula's?
>
> Hi Robert,
>
> > I do NOT want to 'fit' to the population's distribution like the
> > example does -- the function I'm trying to use (TF1 or whatever)
> > should NOT return something proportional to the number of events
> > in a bin/region. Instead, the evaluation is similar to TGraph,
> > where the Chi2 function is built directly from the X and Y
> > points.
>
> As far as I know/understand this is __exactly__ (except for
> actually creating the intermediary TGraph2D object) what
> TTree::UnbinnedFit does ....
>
> Seriously, it sound that you want you exactly want is:
>
> TF2 *myf = new TF2("myf","[0]*x+[1]*y",0.,3000.,0.,3000.);
> myf->SetParameters(.1,.1);
> tree->UnbinnedFit("myf","electronP:preshowerE:showerE",selection);
>
> Cheers,
> Philippe.
/*************************************************** * Dr. Robert J. Feuerbach feuerbac_at_jlab.org * * 12000 Jefferson Avenue CEBAF Center A120 * * Suite 4 Office: (757) 269-7254 * * Newport News, VA 23606 Page: 584-7254 * * Fax: (757) 269-5703 Mailstop 12H3 * ***************************************************/Received on Fri Oct 13 2006 - 04:36:04 MEST
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:01 MET