/*****************************************************************************
 * Project: RooFit                                                           *
 * Package: RooFitCore                                                       *
 *    File: $Id: RooChi2Var.h,v 1.12 2007/05/11 09:11:30 verkerke Exp $
 * 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_CHI2_VAR
#define ROO_CHI2_VAR

#include "RooAbsOptTestStatistic.h"
#include "RooCmdArg.h"
#include "RooDataHist.h"
#include "RooAbsPdf.h"

class RooChi2Var : public RooAbsOptTestStatistic {
public:

  // Constructors, assignment etc
  RooChi2Var(const char *name, const char* title, RooAbsReal& func, RooDataHist& data,
	     const RooCmdArg& arg1                , const RooCmdArg& arg2=RooCmdArg::none(),const RooCmdArg& arg3=RooCmdArg::none(),
	     const RooCmdArg& arg4=RooCmdArg::none(), const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdArg& arg6=RooCmdArg::none(),
	     const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none(),const RooCmdArg& arg9=RooCmdArg::none()) ;

  RooChi2Var(const char *name, const char* title, RooAbsPdf& pdf, RooDataHist& data,
	     const RooCmdArg& arg1                , const RooCmdArg& arg2=RooCmdArg::none(),const RooCmdArg& arg3=RooCmdArg::none(),
	     const RooCmdArg& arg4=RooCmdArg::none(), const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdArg& arg6=RooCmdArg::none(),
	     const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none(),const RooCmdArg& arg9=RooCmdArg::none()) ;

  enum FuncMode { Function, Pdf, ExtendedPdf } ;

  RooChi2Var(const char *name, const char *title, RooAbsPdf& pdf, RooDataHist& data,
	    Bool_t extended=kFALSE, const char* rangeName=0, const char* addCoefRangeName=0, 
	     Int_t nCPU=1, RooFit::MPSplit interleave=RooFit::BulkPartition, Bool_t verbose=kTRUE, Bool_t splitCutRange=kTRUE, RooDataHist::ErrorType=RooDataHist::SumW2) ;

  RooChi2Var(const char *name, const char *title, RooAbsReal& func, RooDataHist& data,
	     const RooArgSet& projDeps, FuncMode funcMode, const char* rangeName=0, const char* addCoefRangeName=0, 
	     Int_t nCPU=1, RooFit::MPSplit interleave=RooFit::BulkPartition, Bool_t verbose=kTRUE, Bool_t splitCutRange=kTRUE, RooDataHist::ErrorType=RooDataHist::SumW2) ;

  RooChi2Var(const RooChi2Var& other, const char* name=0);
  virtual TObject* clone(const char* newname) const { return new RooChi2Var(*this,newname); }

  virtual RooAbsTestStatistic* create(const char *name, const char *title, RooAbsReal& pdf, RooAbsData& dhist,
				      const RooArgSet& projDeps, const char* rangeName=0, const char* addCoefRangeName=0, 
				      Int_t nCPU=1, RooFit::MPSplit interleave=RooFit::BulkPartition,Bool_t verbose=kTRUE, Bool_t splitCutRange=kTRUE, Bool_t = kFALSE) {
    // Virtual constructor
    return new RooChi2Var(name,title,(RooAbsPdf&)pdf,(RooDataHist&)dhist,projDeps,_funcMode,rangeName,
			  addCoefRangeName,nCPU,interleave,verbose, splitCutRange,_etype) ;
  }
  
  virtual ~RooChi2Var();

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

protected:

  static RooArgSet _emptySet ;        // Supports named argument constructor
 
  RooDataHist::ErrorType _etype ;     // Error type store in associated RooDataHist
  FuncMode _funcMode ;                // Function, P.d.f. or extended p.d.f?

  virtual Double_t evaluatePartition(Int_t firstEvent, Int_t lastEvent, Int_t stepSize) const ;
  
  ClassDef(RooChi2Var,1) // Chi^2 function of p.d.f w.r.t a binned dataset
};


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