Logo ROOT  
Reference Guide
RooRealAnalytic.cxx
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * @(#)root/roofitcore:$Id$
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 
17 /**
18 \file RooRealAnalytic.cxx
19 \class RooRealAnalytic
20 \ingroup Roofitcore
21 
22 Lightweight RooAbsFunc interface adaptor that binds an analytic integral of a
23 RooAbsReal object (specified by a code) to a set of dependent variables.
24 **/
25 
26 
27 #include "RooFit.h"
28 
29 #include "RooRealAnalytic.h"
30 #include "RooAbsReal.h"
31 #include "RooAbsRealLValue.h"
32 
33 #include <assert.h>
34 
35 using namespace std;
36 
38 ;
39 
40 
41 ////////////////////////////////////////////////////////////////////////////////
42 /// Evaluate our analytic integral at the specified values of the dependents.
43 
45 {
46  assert(isValid());
47  loadValues(xvector);
48  _ncall++ ;
49  return _code ? _func->analyticalIntegralWN(_code,_nset,_rangeName?_rangeName->GetName():0):_func->getVal(_nset) ;
50 }
51 
52 
53 ////////////////////////////////////////////////////////////////////////////////
54 /// Evaluate the analytic integral of the function at the specified values of the dependents.
56  assert(isValid());
57  _ncall += coordinates.front().size();
58 
59  if (!_batchBuffer)
60  _batchBuffer.reset(new std::vector<double>());
61  _batchBuffer->resize(coordinates.front().size());
62  RooSpan<double> results(*_batchBuffer);
63 
64  for (std::size_t i=0; i < coordinates.front().size(); ++i) {
65  for (unsigned int dim=0; dim < coordinates.size(); ++dim) {
66  _vars[dim]->setVal(coordinates[dim][i]);
67  }
68 
69  if (_code == 0) {
70  results[i] = _func->getVal(_nset);
71  } else {
72  results[i] = _func->analyticalIntegralWN(_code,_nset,_rangeName?_rangeName->GetName():0);
73  }
74  }
75 
76  return results;
77 }
78 
RooAbsReal.h
RooFit.h
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
RooRealAnalytic.h
RooRealAnalytic::operator()
virtual Double_t operator()(const Double_t xvector[]) const override
Evaluate our analytic integral at the specified values of the dependents.
Definition: RooRealAnalytic.cxx:44
RooRealAnalytic::getValues
RooSpan< const double > getValues(std::vector< RooSpan< const double >> coordinates) const override
Evaluate the analytic integral of the function at the specified values of the dependents.
Definition: RooRealAnalytic.cxx:55
size
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
RooRealAnalytic
Lightweight RooAbsFunc interface adaptor that binds an analytic integral of a RooAbsReal object (spec...
Definition: RooRealAnalytic.h:21
Double_t
double Double_t
Definition: RtypesCore.h:59
RooAbsRealLValue.h
RooSpan
A simple container to hold a batch of data values.
Definition: RooSpan.h:34