Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:25:26

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitCore                                                       *
0004  *    File: $Id$
0005  * Authors:                                                                  *
0006  *   WV, Wouter Verkerke, NIKHEF, verkerke@nikhef.nl                         *
0007  *                                                                           *
0008  * Copyright (c) 2000-2008, NIKHEF, Regents of the University of California  *
0009  *                          and Stanford University. All rights reserved.    *
0010  *                                                                           *
0011  *****************************************************************************/
0012 
0013 #ifndef ROOFUNCTORBINDING
0014 #define ROOFUNCTORBINDING
0015 
0016 #include "RooAbsReal.h"
0017 #include "RooArgList.h"
0018 #include "RooListProxy.h"
0019 #include "RooAbsPdf.h"
0020 #include "RooRealProxy.h"
0021 #include "Math/IFunction.h"
0022 
0023 namespace RooFit {
0024 
0025 RooAbsReal* bindFunction(const char* name, const ROOT::Math::IBaseFunctionMultiDim& ftor,const RooArgList& vars) ;
0026 RooAbsPdf*  bindPdf(const char* name, const ROOT::Math::IBaseFunctionMultiDim& ftor, const RooArgList& vars) ;
0027 
0028 }
0029 
0030 class RooFunctorBinding : public RooAbsReal {
0031 public:
0032   RooFunctorBinding() = default;
0033   RooFunctorBinding(const char *name, const char *title, const ROOT::Math::IBaseFunctionMultiDim& ftor, const RooArgList& vars);
0034   RooFunctorBinding(const RooFunctorBinding& other, const char* name=nullptr) ;
0035   TObject* clone(const char* newname=nullptr) const override { return new RooFunctorBinding(*this,newname); }
0036   inline ~RooFunctorBinding() override { delete[] x ; }
0037   void printArgs(std::ostream& os) const override ;
0038 
0039   ROOT::Math::IBaseFunctionMultiDim const *function() const { return func; }
0040   RooArgList const &variables() const { return vars; }
0041 
0042 protected:
0043 
0044   double evaluate() const override ;
0045 
0046   const ROOT::Math::IBaseFunctionMultiDim* func = nullptr; // Functor
0047   RooListProxy vars; // Argument reference
0048   double *x = nullptr; // Argument value array
0049 
0050   ClassDefOverride(RooFunctorBinding,1) // RooAbsReal binding to a ROOT::Math::IBaseFunctionMultiDim
0051 };
0052 
0053 
0054 
0055 class RooFunctorPdfBinding : public RooAbsPdf {
0056 public:
0057   RooFunctorPdfBinding() = default;
0058   RooFunctorPdfBinding(const char *name, const char *title, const ROOT::Math::IBaseFunctionMultiDim& ftor, const RooArgList& vars);
0059   RooFunctorPdfBinding(const RooFunctorPdfBinding& other, const char* name=nullptr) ;
0060   TObject* clone(const char* newname=nullptr) const override { return new RooFunctorPdfBinding(*this,newname); }
0061   inline ~RooFunctorPdfBinding() override { delete[] x ; }
0062   void printArgs(std::ostream& os) const override ;
0063 
0064   ROOT::Math::IBaseFunctionMultiDim const *function() const { return func; }
0065   RooArgList const &variables() const { return vars; }
0066 
0067 protected:
0068 
0069   double evaluate() const override ;
0070 
0071   const ROOT::Math::IBaseFunctionMultiDim* func = nullptr;    // Functor
0072   RooListProxy vars ;    // Argument reference
0073   double *x = nullptr; // Argument value array
0074 
0075   ClassDefOverride(RooFunctorPdfBinding,1) // RooAbsPdf binding to a ROOT::Math::IBaseFunctionMultiDim
0076 };
0077 
0078 
0079 #endif