Logo ROOT  
Reference Guide
No Matches
Go to the documentation of this file.
2 * Project: RooFit *
3 * Package: RooFitModels *
4 * File: $Id: Roo2DKeysPdf.h,v 1.12 2007/05/11 09:13:07 verkerke Exp $
5 * Authors: *
6 * AB, Adrian Bevan, Liverpool University, bevan@slac.stanford.edu *
7 * *
8 * Copyright (c) 2000-2005, Regents of the University of California, *
9 * Liverpool University, *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_2DKEYS
17#define ROO_2DKEYS
19#include "RooAbsPdf.h"
20#include "RooRealProxy.h"
21#include "RooAbsReal.h"
22#include "RooDataSet.h"
25class Roo2DKeysPdf : public RooAbsPdf
28 Roo2DKeysPdf(const char *name, const char *title,
29 RooAbsReal& xx, RooAbsReal &yy, RooDataSet& data, TString options = "a", Double_t widthScaleFactor = 1.0);
30 Roo2DKeysPdf(const Roo2DKeysPdf& other, const char* name=0);
31 virtual TObject* clone(const char* newname) const { return new Roo2DKeysPdf(*this,newname); }
33 virtual ~Roo2DKeysPdf();
35//load in a new dataset and re-calculate the PDF
36//return 0 if successful
37 Int_t loadDataSet(RooDataSet& data, TString options);
39// The Roo2DKeys options available are:
40// a = select an adaptive bandwidth [default]
41// n = select a normal bandwidth
42// m = mirror kernel contributions at edges [fold gaussians back into the x,y plane]
43// d = print debug statements [useful for development only; default is off]
44// v = print verbose debug statements [useful for development only; default is off]
45// vv = print ludicrously verbose debug statements [useful for development only; default is off]
46 void setOptions(TString options);
47 void getOptions(void) const;
49// Set the value of a scale factor to modify the bandwidth by. The default value for this is unity.
50// Modification of 'normal' bandwidths is useful when the data are not 'normally distributed',
51// otherwise one expects little departure from that behavior. Note that both the normal and adaptive
52// bandwidth selections are modified by this factor. Useful for systematic studies.
53// ***********
54// *IMPORTANT* The kernel is proportional to 1/widthScaleFactor.
55// ***********
56 inline void setWidthScaleFactor(Double_t widthScaleFactor);
58// choose the kernel bandwith to use. The default is 0
59// 0 = use adaptive kernel estimator (uses local population to vary with of kernels)
60// 1 = use trivial kernel estimator (uses all data and sigma to estimate uniform kernel bandwidth)
61 Int_t calculateBandWidth(Int_t kernel = -999);
63 Int_t getBandWidthType() const;
64 Double_t getMean(const char * axis) const;
65 Double_t getSigma(const char * axis) const;
67// print content and basic information about the data
68 void PrintInfo(std::ostream &) const;
70// save PDF to a file as a TH2F *, TTree * or both
71// this is so that you only need to compute the PDF once and
72// are free to use the much faster Roo2DHistPdf class in order
73// to perform fits/do toy studies etc.
74 void writeToFile(char * outputFile, const char * name) const;
75 void writeHistToFile(char * outputFile, const char * histName) const;
76 void writeNTupleToFile(char * outputFile, const char * name) const;
81 Double_t evaluate() const;
86 // these are used in calculating bandwidths for x and y
87 Double_t evaluateFull(Double_t thisX, Double_t thisY) const;
88 Double_t g(Double_t var1, Double_t * _var1, Double_t sigma1, Double_t var2,
89 Double_t * _var2, Double_t sigma2) const;
91 //mirror corrections for the boundaries
92 Double_t highBoundaryCorrection(Double_t thisVar, Double_t thisH, Double_t high, Double_t tVar) const;
93 Double_t lowBoundaryCorrection(Double_t thisVar, Double_t thisH, Double_t low, Double_t tVar) const;
100 Double_t _xMean; // the (x,y) mean and sigma are properties of the data, not of the PDF
104 Double_t _n; //coefficient of the kernel estimation sum
105 Double_t _n16; //pow(_nEvents, -1/6)
107 Double_t _2pi; // = M_PI*2
112 Double_t _widthScaleFactor; //allow manipulation of the bandwidth by a scale factor
121 ClassDef(Roo2DKeysPdf,0) // Two-dimensional kernel estimation p.d.f.
124inline void Roo2DKeysPdf::setWidthScaleFactor(Double_t widthScaleFactor) { _widthScaleFactor = widthScaleFactor; }
#define g(i)
Definition RSha256.hxx:105
double Double_t
Definition RtypesCore.h:59
#define ClassDef(name, id)
Definition Rtypes.h:325
char name[80]
Definition TGX11.cxx:110
Two-dimensional kernel estimation PDF.
RooRealProxy y
Double_t _lox
Double_t _loy
void writeNTupleToFile(char *outputFile, const char *name) const
Saves the data and calculated bandwidths to a file, as a record of what produced the PDF and to give ...
Int_t _BandWidthType
Double_t getMean(const char *axis) const
Double_t _hix
void writeToFile(char *outputFile, const char *name) const
Int_t _verbosedebug
Double_t _ySigma
Double_t * _x
Double_t _norm
Double_t _n16
Double_t getSigma(const char *axis) const
Double_t _hiy
Double_t _widthScaleFactor
Double_t * _hy
Double_t _yoffset
Int_t getBandWidthType() const
Double_t _xSigma
Int_t _MirrorAtBoundary
void PrintInfo(std::ostream &) const
Prints out _p[_nPoints][_nPoints] indicating the domain limits.
Int_t loadDataSet(RooDataSet &data, TString options)
Loads a new data set into the class instance.
Double_t * _y
Int_t _vverbosedebug
Double_t * _hx
Double_t evaluate() const
Evaluates the kernel estimation for x,y, interpolating between the points if necessary.
virtual ~Roo2DKeysPdf()
virtual TObject * clone(const char *newname) const
Double_t highBoundaryCorrection(Double_t thisVar, Double_t thisH, Double_t high, Double_t tVar) const
Apply the mirror at boundary correction to a dimension given the space position to evaluate at (thisV...
Double_t _xoffset
Double_t _xMean
Double_t lowBoundaryCorrection(Double_t thisVar, Double_t thisH, Double_t low, Double_t tVar) const
Double_t _yMean
void writeHistToFile(char *outputFile, const char *histName) const
Plots the PDF as a histogram and saves it to a file, so that it can be loaded in as a Roo2DHist PDF i...
Int_t calculateBandWidth(Int_t kernel=-999)
Calculates the kernel bandwidth for x & y and the probability look up table _p[i][j].
Double_t _sqrt2pi
void setOptions(TString options)
Double_t evaluateFull(Double_t thisX, Double_t thisY) const
Evaluates the sum of the product of the 2D kernels for use in calculating the fixed kernel estimate,...
void getOptions(void) const
void setWidthScaleFactor(Double_t widthScaleFactor)
Double_t _2pi
RooRealProxy x
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition RooAbsReal.h:61
RooDataSet is a container class to hold unbinned data.
Definition RooDataSet.h:33
Mother of all ROOT objects.
Definition TObject.h:37
Basic string class.
Definition TString.h:136