Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:22

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitCore                                                       *
0004  * @(#)root/roofitcore:$Id$
0005  * Authors:                                                                  *
0006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
0007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
0008  *                                                                           *
0009  * Copyright (c) 2000-2005, Regents of the University of California          *
0010  *                          and Stanford University. All rights reserved.    *
0011  *                                                                           *
0012  * Redistribution and use in source and binary forms,                        *
0013  * with or without modification, are permitted according to the terms        *
0014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
0015  *****************************************************************************/
0016 #ifndef ROO_FUNCTOR
0017 #define ROO_FUNCTOR
0018 
0019 #include "RooArgSet.h"
0020 #include "RooAbsReal.h"
0021 
0022 class RooAbsFunc ;
0023 class RooAbsPdf ;
0024 
0025 class RooFunctor {
0026 
0027 public:
0028   RooFunctor(const RooAbsFunc& func) ;
0029   RooFunctor(const RooAbsReal& func, const RooArgList& observables, const RooArgList& parameters) ;
0030   RooFunctor(const RooAbsReal& func, const RooArgList& observables, const RooArgList& parameters, const RooArgSet& nset) ;
0031   RooFunctor(const RooFunctor&) ;
0032   virtual ~RooFunctor() ;
0033 
0034   Int_t nObs() const {
0035     // Number of observables
0036     return _nobs ;
0037   }
0038   Int_t nPar() const {
0039     // Number of parameters;
0040     return _npar ;
0041   }
0042 
0043   double operator()(double x) const { return eval(x) ; }
0044   double operator()(const double* x, const double* p) const { return eval(x,p) ; }
0045   double operator()(const double* x) const { return eval(x) ; }
0046 
0047   double eval(const double* /*x*/, const double* /*p*/) const ;
0048   double eval(const double* /*x*/) const ;
0049   double eval(double  /*x*/) const ;
0050 
0051   inline RooAbsFunc& binding() { return _ownedBinding ? *_ownedBinding : *_binding; }
0052   inline RooAbsFunc const& binding() const { return _ownedBinding ? *_ownedBinding : *_binding; }
0053 
0054 protected:
0055 
0056   std::unique_ptr<RooAbsFunc> _ownedBinding; ///< Do we own the binding function
0057   RooArgSet _nset;                           ///< Normalization observables
0058   RooAbsFunc *_binding = nullptr;            ///< Function binding
0059   mutable std::vector<double> _x;            ///<! Transfer array ;
0060   Int_t _npar = 0;                           ///<! Number of parameters ;
0061   Int_t _nobs;                               ///<! Number of observables ;
0062 
0063   ClassDef(RooFunctor,0) // Export RooAbsReal as functor
0064 };
0065 
0066 #endif