Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitCore                                                       *
0004  *    File: $Id: RooRangeBinning.h,v 1.4 2007/05/11 09:11:30 verkerke Exp $
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_RANGE_BINNING
0017 #define ROO_RANGE_BINNING
0018 
0019 #include "RooAbsBinning.h"
0020 
0021 class RooRangeBinning : public RooAbsBinning {
0022 public:
0023 
0024   RooRangeBinning(const char* name=nullptr) ;
0025   RooRangeBinning(double xmin, double xmax, const char* name=nullptr) ;
0026   RooRangeBinning(const RooRangeBinning&, const char* name=nullptr) ;
0027   RooAbsBinning* clone(const char* name=nullptr) const override { return new RooRangeBinning(*this,name?name:GetName()) ; }
0028 
0029   Int_t numBoundaries() const override { return 2 ; }
0030   void binNumbers(double const * /*x*/, int * /*bins*/, std::size_t /*n*/, int /*coef*/) const override {}
0031   double binCenter(Int_t) const override { return (_range[0] + _range[1]) / 2 ; }
0032   double binWidth(Int_t) const override { return (_range[1] - _range[0]) ; }
0033   double binLow(Int_t) const override { return _range[0] ; }
0034   double binHigh(Int_t) const override { return _range[1] ; }
0035 
0036   void setRange(double xlo, double xhi) override ;
0037   void setMin(double xlo) override { setRange(xlo,highBound()) ; }
0038   void setMax(double xhi) override { setRange(lowBound(),xhi) ; }
0039 
0040   double lowBound() const override { return _range[0] ; }
0041   double highBound() const override { return _range[1] ; }
0042   double averageBinWidth() const override { return binWidth(0) ; }
0043 
0044   double* array() const override { return const_cast<double*>(_range) ; }
0045 
0046 protected:
0047 
0048   double _range[2] ;
0049 
0050   ClassDefOverride(RooRangeBinning,1) // Binning that only defines the total range
0051 };
0052 
0053 #endif