// RooRangeBoolean
// END_HTML
#include "RooFit.h"
#include "Riostream.h"
#include "Riostream.h"
#include <math.h>
#include "TMath.h"
#include "RooRangeBoolean.h"
#include "RooAbsReal.h"
#include "RooRealVar.h"
#include "RooArgList.h"
#include "RooMsgService.h"
#include "TMath.h"
using namespace std;
ClassImp(RooRangeBoolean)
;
RooRangeBoolean::RooRangeBoolean()
{
}
RooRangeBoolean::RooRangeBoolean(const char* name, const char* title, RooAbsRealLValue& x, const char* rangeName) :
RooAbsReal(name, title),
_x("x", "Dependent", this, x),
_rangeName(rangeName)
{
}
RooRangeBoolean::RooRangeBoolean(const RooRangeBoolean& other, const char* name) :
RooAbsReal(other, name),
_x("x", this, other._x),
_rangeName(other._rangeName)
{
}
RooRangeBoolean::~RooRangeBoolean()
{
}
Double_t RooRangeBoolean::evaluate() const
{
Double_t xmin = ((RooAbsRealLValue&)_x.arg()).getMin(_rangeName.Data()) ;
Double_t xmax = ((RooAbsRealLValue&)_x.arg()).getMax(_rangeName.Data()) ;
Double_t ret = (_x >= xmin && _x < xmax) ? 1.0 : 0.0 ;
return ret ;
}
std::list<Double_t>* RooRangeBoolean::plotSamplingHint(RooAbsRealLValue& obs, Double_t , Double_t ) const
{
if (string(obs.GetName())!=_x.arg().GetName()) {
return 0 ;
}
list<Double_t>* hint = new list<Double_t> ;
hint->push_back(((RooAbsRealLValue&)_x.arg()).getMin(_rangeName.Data())-1e-6) ;
hint->push_back(((RooAbsRealLValue&)_x.arg()).getMin(_rangeName.Data())+1e-6) ;
hint->push_back(((RooAbsRealLValue&)_x.arg()).getMax(_rangeName.Data())-1e-6) ;
hint->push_back(((RooAbsRealLValue&)_x.arg()).getMax(_rangeName.Data())+1e-6) ;
return hint ;
}