// SimpleInterval is a concrete implementation of the ConfInterval interface.
// It implements simple 1-dimensional intervals in a range [a,b].
// In addition, you can ask it for the upper- or lower-bound.
// END_HTML
#ifndef RooStats_SimpleInterval
#include "RooStats/SimpleInterval.h"
#endif
#include "RooAbsReal.h"
#include <string>
ClassImp(RooStats::SimpleInterval) ;
using namespace RooStats;
SimpleInterval::SimpleInterval() : fLowerLimit(0), fUpperLimit(0)
{
}
SimpleInterval::SimpleInterval(const char* name) :
ConfInterval(name,name), fLowerLimit(0), fUpperLimit(0)
{
}
SimpleInterval::SimpleInterval(const char* name, const char* title) :
ConfInterval(name,title), fLowerLimit(0), fUpperLimit(0)
{
}
SimpleInterval::SimpleInterval(const char* name, RooAbsArg* var, Double_t lower, Double_t upper) :
ConfInterval(name,name), fLowerLimit(lower), fUpperLimit(upper)
{
fParameters = new RooArgSet((std::string(name)+"_parameters").c_str());
fParameters->addClone( *var );
}
SimpleInterval::SimpleInterval(const char* name, const char* title, RooAbsArg* var, Double_t lower, Double_t upper):
ConfInterval(name,title), fLowerLimit(lower), fUpperLimit(upper)
{
fParameters = new RooArgSet((std::string(name)+"_parameters").c_str());
fParameters->addClone( *var );
}
SimpleInterval::~SimpleInterval()
{
}
Bool_t SimpleInterval::IsInInterval(RooArgSet ¶meterPoint)
{
if( !this->CheckParameters(parameterPoint) )
return false;
if(parameterPoint.getSize() != 1 )
return false;
RooAbsReal* point = dynamic_cast<RooAbsReal*> (parameterPoint.first());
if (point == 0)
return false;
if ( point->getVal() > fUpperLimit || point->getVal() < fUpperLimit)
return false;
return true;
}
RooArgSet* SimpleInterval::GetParameters() const
{
return (RooArgSet*) fParameters->clone((std::string(fParameters->GetName())+"_clone").c_str());
}
Bool_t SimpleInterval::CheckParameters(RooArgSet ¶meterPoint) const
{
if (parameterPoint.getSize() != fParameters->getSize() ) {
std::cout << "size is wrong, parameters don't match" << std::endl;
return false;
}
if ( ! parameterPoint.equals( *fParameters ) ) {
std::cout << "size is ok, but parameters don't match" << std::endl;
return false;
}
return true;
}
Last change: Fri Nov 21 08:37:10 2008
Last generated: 2008-11-21 08:37
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.