Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooNLLVar.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooNLLVar.h,v 1.10 2007/07/21 21:32:52 wouter Exp $
5  * Authors: *
6  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8  * *
9  * Copyright (c) 2000-2005, Regents of the University of California *
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_NLL_VAR
17 #define ROO_NLL_VAR
18 
19 #include "RooAbsOptTestStatistic.h"
20 #include "RooCmdArg.h"
21 #include "RooAbsPdf.h"
22 #include <vector>
23 
24 class RooRealSumPdf ;
25 
26 class RooNLLVar : public RooAbsOptTestStatistic {
27 public:
28 
29  // Constructors, assignment etc
30  RooNLLVar() { _first = kTRUE ; }
31  RooNLLVar(const char *name, const char* title, RooAbsPdf& pdf, RooAbsData& data,
32  const RooCmdArg& arg1=RooCmdArg::none(), const RooCmdArg& arg2=RooCmdArg::none(),const RooCmdArg& arg3=RooCmdArg::none(),
33  const RooCmdArg& arg4=RooCmdArg::none(), const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdArg& arg6=RooCmdArg::none(),
34  const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none(),const RooCmdArg& arg9=RooCmdArg::none()) ;
35 
36  RooNLLVar(const char *name, const char *title, RooAbsPdf& pdf, RooAbsData& data,
37  Bool_t extended, const char* rangeName=0, const char* addCoefRangeName=0,
38  Int_t nCPU=1, RooFit::MPSplit interleave=RooFit::BulkPartition, Bool_t verbose=kTRUE, Bool_t splitRange=kFALSE,
39  Bool_t cloneData=kTRUE, Bool_t binnedL=kFALSE) ;
40 
41  RooNLLVar(const char *name, const char *title, RooAbsPdf& pdf, RooAbsData& data,
42  const RooArgSet& projDeps, Bool_t extended=kFALSE, const char* rangeName=0,
43  const char* addCoefRangeName=0, Int_t nCPU=1, RooFit::MPSplit interleave=RooFit::BulkPartition, Bool_t verbose=kTRUE, Bool_t splitRange=kFALSE,
44  Bool_t cloneData=kTRUE, Bool_t binnedL=kFALSE) ;
45 
46  RooNLLVar(const RooNLLVar& other, const char* name=0);
47  virtual TObject* clone(const char* newname) const { return new RooNLLVar(*this,newname); }
48 
49  virtual RooAbsTestStatistic* create(const char *name, const char *title, RooAbsReal& pdf, RooAbsData& adata,
50  const RooArgSet& projDeps, const char* rangeName, const char* addCoefRangeName=0,
51  Int_t nCPU=1, RooFit::MPSplit interleave=RooFit::BulkPartition, Bool_t verbose=kTRUE, Bool_t splitRange=kFALSE, Bool_t binnedL=kFALSE) {
52  return new RooNLLVar(name,title,(RooAbsPdf&)pdf,adata,projDeps,_extended,rangeName, addCoefRangeName, nCPU, interleave,verbose,splitRange,kFALSE,binnedL) ;
53  }
54 
55  virtual ~RooNLLVar();
56 
57  void applyWeightSquared(Bool_t flag) ;
58 
59  virtual Double_t defaultErrorLevel() const { return 0.5 ; }
60 
61  void batchMode(bool on = true) {
62  _batchEvaluations = on;
63  }
64 
65 protected:
66 
67  virtual Bool_t processEmptyDataSets() const { return _extended ; }
68  virtual Double_t evaluatePartition(std::size_t firstEvent, std::size_t lastEvent, std::size_t stepSize) const;
69 
70  static RooArgSet _emptySet ; // Supports named argument constructor
71 
72 private:
73  std::tuple<double, double, double> computeBatched(
74  std::size_t stepSize, std::size_t firstEvent, std::size_t lastEvent) const;
75 
76  std::tuple<double, double, double> computeScalar(
77  std::size_t stepSize, std::size_t firstEvent, std::size_t lastEvent) const;
78 
79  Bool_t _extended ;
80  bool _batchEvaluations{false};
81  Bool_t _weightSq ; // Apply weights squared?
82  mutable Bool_t _first ; //!
83  Double_t _offsetSaveW2; //!
84  Double_t _offsetCarrySaveW2; //!
85 
86  mutable std::vector<Double_t> _binw ; //!
87  mutable RooRealSumPdf* _binnedPdf ; //!
88 
89  ClassDef(RooNLLVar,3) // Function representing (extended) -log(L) of p.d.f and dataset
90 };
91 
92 #endif
93