ROOT logo
/*****************************************************************************
 * Project: RooFit                                                           *
 * Package: RooFitCore                                                       *
 *    File: $Id$
 * Authors:                                                                  *
 *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
 *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
 *                                                                           *
 * Copyright (c) 2000-2005, Regents of the University of California          *
 *                          and Stanford University. All rights reserved.    *
 *                                                                           *
 * Redistribution and use in source and binary forms,                        *
 * with or without modification, are permitted according to the terms        *
 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
 *****************************************************************************/

#ifndef ROO_XY_CHI2_VAR
#define ROO_XY_CHI2_VAR

#include "RooAbsOptTestStatistic.h"
#include "RooCmdArg.h"
#include "RooDataSet.h"
#include "RooAbsPdf.h"
#include "RooNumIntConfig.h"
#include <list>
class RooAbsIntegrator ;


class RooXYChi2Var : public RooAbsOptTestStatistic {
public:

  // Constructors, assignment etc
  RooXYChi2Var() ;
  RooXYChi2Var(const char *name, const char* title, RooAbsReal& func, RooDataSet& data, Bool_t integrate=kFALSE) ;
  RooXYChi2Var(const char *name, const char* title, RooAbsReal& func, RooDataSet& data, RooRealVar& yvar, Bool_t integrate=kFALSE) ;
  RooXYChi2Var(const char *name, const char* title, RooAbsPdf& extPdf, RooDataSet& data, Bool_t integrate=kFALSE) ;
  RooXYChi2Var(const char *name, const char* title, RooAbsPdf& extPdf, RooDataSet& data, RooRealVar& yvar, Bool_t integrate=kFALSE) ;
  
  RooXYChi2Var(const RooXYChi2Var& other, const char* name=0);
  virtual TObject* clone(const char* newname) const { return new RooXYChi2Var(*this,newname); }

  virtual RooAbsTestStatistic* create(const char *name, const char *title, RooAbsReal& pdf, RooAbsData& adata,
				      const RooArgSet&, const char*, const char*,Int_t, RooFit::MPSplit,Bool_t, Bool_t, Bool_t) {
    // Virtual constructor
    return new RooXYChi2Var(name,title,pdf,(RooDataSet&)adata) ;
  }
  
  virtual ~RooXYChi2Var();

  virtual Double_t defaultErrorLevel() const { 
    // The default error level for MINUIT error analysis for a chi^2 is 1.0
    return 1.0 ; 
  }

  RooNumIntConfig& binIntegratorConfig() { return _intConfig ; }
  const RooNumIntConfig& binIntegratorConfig() const { return _intConfig ; }

protected:

  Bool_t allowFunctionCache() { 
    // Disable function (component) caching if integration is requested as the function
    // will be evaluated at coordinates other than the points in the dataset
    return !_integrate ; 
  }

  RooArgSet requiredExtraObservables() const ;

  Double_t fy() const ; 

  Bool_t _extended ; // Is the input function and extended p.d.f.
  Bool_t _integrate ; // Is integration over the bin volume requested
 
  RooRealVar* _yvar ; // Y variable if so designated
  RooArgSet _rrvArgs ; // Set of real-valued observables
  TIterator* _rrvIter ; //! Iterator over set of real-valued observables

  void initialize() ;
  void initIntegrator() ;
  Double_t xErrorContribution(Double_t ydata) const ;

  virtual Double_t evaluatePartition(Int_t firstEvent, Int_t lastEvent, Int_t stepSize) const ;

  RooNumIntConfig   _intConfig ; // Numeric integrator configuration for integration of function over bin
  RooAbsReal*       _funcInt ; //! Function integral
  std::list<RooAbsBinning*> _binList ; //! Bin ranges
  
  ClassDef(RooXYChi2Var,1) // Chi^2 function of p.d.f w.r.t a unbinned dataset with X and Y values
};


#endif
 RooXYChi2Var.h:1
 RooXYChi2Var.h:2
 RooXYChi2Var.h:3
 RooXYChi2Var.h:4
 RooXYChi2Var.h:5
 RooXYChi2Var.h:6
 RooXYChi2Var.h:7
 RooXYChi2Var.h:8
 RooXYChi2Var.h:9
 RooXYChi2Var.h:10
 RooXYChi2Var.h:11
 RooXYChi2Var.h:12
 RooXYChi2Var.h:13
 RooXYChi2Var.h:14
 RooXYChi2Var.h:15
 RooXYChi2Var.h:16
 RooXYChi2Var.h:17
 RooXYChi2Var.h:18
 RooXYChi2Var.h:19
 RooXYChi2Var.h:20
 RooXYChi2Var.h:21
 RooXYChi2Var.h:22
 RooXYChi2Var.h:23
 RooXYChi2Var.h:24
 RooXYChi2Var.h:25
 RooXYChi2Var.h:26
 RooXYChi2Var.h:27
 RooXYChi2Var.h:28
 RooXYChi2Var.h:29
 RooXYChi2Var.h:30
 RooXYChi2Var.h:31
 RooXYChi2Var.h:32
 RooXYChi2Var.h:33
 RooXYChi2Var.h:34
 RooXYChi2Var.h:35
 RooXYChi2Var.h:36
 RooXYChi2Var.h:37
 RooXYChi2Var.h:38
 RooXYChi2Var.h:39
 RooXYChi2Var.h:40
 RooXYChi2Var.h:41
 RooXYChi2Var.h:42
 RooXYChi2Var.h:43
 RooXYChi2Var.h:44
 RooXYChi2Var.h:45
 RooXYChi2Var.h:46
 RooXYChi2Var.h:47
 RooXYChi2Var.h:48
 RooXYChi2Var.h:49
 RooXYChi2Var.h:50
 RooXYChi2Var.h:51
 RooXYChi2Var.h:52
 RooXYChi2Var.h:53
 RooXYChi2Var.h:54
 RooXYChi2Var.h:55
 RooXYChi2Var.h:56
 RooXYChi2Var.h:57
 RooXYChi2Var.h:58
 RooXYChi2Var.h:59
 RooXYChi2Var.h:60
 RooXYChi2Var.h:61
 RooXYChi2Var.h:62
 RooXYChi2Var.h:63
 RooXYChi2Var.h:64
 RooXYChi2Var.h:65
 RooXYChi2Var.h:66
 RooXYChi2Var.h:67
 RooXYChi2Var.h:68
 RooXYChi2Var.h:69
 RooXYChi2Var.h:70
 RooXYChi2Var.h:71
 RooXYChi2Var.h:72
 RooXYChi2Var.h:73
 RooXYChi2Var.h:74
 RooXYChi2Var.h:75
 RooXYChi2Var.h:76
 RooXYChi2Var.h:77
 RooXYChi2Var.h:78
 RooXYChi2Var.h:79
 RooXYChi2Var.h:80
 RooXYChi2Var.h:81
 RooXYChi2Var.h:82
 RooXYChi2Var.h:83
 RooXYChi2Var.h:84
 RooXYChi2Var.h:85
 RooXYChi2Var.h:86
 RooXYChi2Var.h:87
 RooXYChi2Var.h:88
 RooXYChi2Var.h:89
 RooXYChi2Var.h:90
 RooXYChi2Var.h:91