Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/RooParamBinning.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitCore                                                       *
0004  *    File: $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_PARAM_BINNING
0017 #define ROO_PARAM_BINNING
0018 
0019 #include "Rtypes.h"
0020 #include "RooAbsBinning.h"
0021 #include "RooRealVar.h"
0022 #include "RooListProxy.h"
0023 
0024 class RooParamBinning : public RooAbsBinning {
0025 public:
0026 
0027   RooParamBinning(const char* name=nullptr) ;
0028   RooParamBinning(RooAbsReal& xlo, RooAbsReal& xhi, Int_t nBins, const char* name=nullptr) ;
0029   RooParamBinning(const RooParamBinning& other, const char* name=nullptr) ;
0030   RooAbsBinning* clone(const char* name=nullptr) const override { return new RooParamBinning(*this,name?name:GetName()) ; }
0031   ~RooParamBinning() override ;
0032 
0033   void setRange(double xlo, double xhi) override ;
0034 
0035   Int_t numBoundaries() const override { return _nbins + 1 ; }
0036   void binNumbers(double const * x, int * bins, std::size_t n, int coef) const override;
0037 
0038   double lowBound() const override { return xlo()->getVal() ; }
0039   double highBound() const override { return xhi()->getVal() ; }
0040 
0041   double binCenter(Int_t bin) const override ;
0042   double binWidth(Int_t bin) const override ;
0043   double binLow(Int_t bin) const override ;
0044   double binHigh(Int_t bin) const override ;
0045 
0046   double averageBinWidth() const override { return _binw ; }
0047   double* array() const override ;
0048 
0049   void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const override ;
0050 
0051   void insertHook(RooAbsRealLValue&) const override  ;
0052   void removeHook(RooAbsRealLValue&) const override  ;
0053 
0054   bool isShareable() const override { return false ; } // parameterized binning cannot be shared across instances
0055   bool isParameterized() const override { return true ; } // binning is parameterized, range will need special handling in integration
0056   RooAbsReal* lowBoundFunc() const override { return xlo() ; }
0057   RooAbsReal* highBoundFunc() const override { return xhi() ; }
0058 
0059 protected:
0060 
0061   mutable double* _array = nullptr; //! do not persist
0062   mutable RooAbsReal* _xlo = nullptr; //!
0063   mutable RooAbsReal* _xhi = nullptr; //!
0064   Int_t    _nbins = 100;
0065   double _binw = 0;
0066   mutable RooListProxy* _lp = nullptr; //
0067   mutable RooAbsArg* _owner = nullptr; //
0068 
0069   RooAbsReal* xlo() const { return _lp ? ((RooAbsReal*)_lp->at(0)) : _xlo ; }
0070   RooAbsReal* xhi() const { return _lp ? ((RooAbsReal*)_lp->at(1)) : _xhi ; }
0071 
0072   ClassDefOverride(RooParamBinning,3) // Binning specification with ranges parameterized by external RooAbsReal functions
0073 };
0074 
0075 #endif