// RooAbsHiddenReal is a base class for objects that want to hide
// their return value from interactive use, e.g. for implementations
// of parameter unblinding functions. This class overrides all
// printing methods with versions that do not reveal the objects value
// and it has a protected version of getVal()
// END_HTML
#include "RooFit.h"
#include "Riostream.h"
#include "RooArgSet.h"
#include "RooArgSet.h"
#include "RooAbsHiddenReal.h"
#include "RooCategory.h"
#include "RooMsgService.h"
using namespace std;
ClassImp(RooAbsHiddenReal)
;
RooCategory* RooAbsHiddenReal::_dummyBlindState = 0;
RooAbsHiddenReal::RooAbsHiddenReal(const char *name, const char *title, const char* unit)
: RooAbsReal(name,title,unit),
_state("state","Blinding state",this,dummyBlindState())
{
}
RooAbsHiddenReal::RooAbsHiddenReal(const char *name, const char *title, RooAbsCategory& blindState, const char* unit)
: RooAbsReal(name,title,unit),
_state("state","Blinding state",this,blindState)
{
}
RooAbsHiddenReal::RooAbsHiddenReal(const RooAbsHiddenReal& other, const char* name) :
RooAbsReal(other, name),
_state("state",this,other._state)
{
}
RooAbsHiddenReal::~RooAbsHiddenReal()
{
}
void RooAbsHiddenReal::printValue(ostream& os) const
{
os << "(hidden)" ;
}
Bool_t RooAbsHiddenReal::readFromStream(istream& is, Bool_t compact, Bool_t verbose)
{
if (isHidden()) {
coutE(InputArguments) << "RooAbsHiddenReal::readFromStream(" << GetName() << "): not allowed" << endl ;
return kTRUE ;
} else {
return readFromStream(is,compact,verbose) ;
}
}
void RooAbsHiddenReal::writeToStream(ostream& os, Bool_t compact) const
{
if (isHidden()) {
coutE(InputArguments) << "RooAbsHiddenReal::writeToStream(" << GetName() << "): not allowed" << endl ;
} else {
RooAbsReal::writeToStream(os,compact) ;
}
}
RooAbsCategory& RooAbsHiddenReal::dummyBlindState() const
{
if (!_dummyBlindState) {
_dummyBlindState = new RooCategory("dummyBlindState","dummy blinding state") ;
_dummyBlindState->defineType("Normal",0) ;
_dummyBlindState->defineType("Blind",1) ;
_dummyBlindState->setIndex(1) ;
}
return *_dummyBlindState ;
}