#include "RooFit.h"
#include "Riostream.h"
#include "Riostream.h"
#include <stdlib.h>
#include <string.h>
#include "TTree.h"
#include "TString.h"
#include "TH1.h"
#include "RooAbsCategoryLValue.h"
#include "RooArgSet.h"
#include "RooStreamParser.h"
#include "RooRandom.h"
ClassImp(RooAbsCategoryLValue)
;
RooAbsCategoryLValue::RooAbsCategoryLValue(const char *name, const char *title) :
RooAbsCategory(name,title)
{
setValueDirty() ;
setShapeDirty() ;
}
RooAbsCategoryLValue::RooAbsCategoryLValue(const RooAbsCategoryLValue& other, const char* name) :
RooAbsCategory(other, name), RooAbsLValue(other)
{
}
RooAbsCategoryLValue::~RooAbsCategoryLValue()
{
}
RooAbsArg& RooAbsCategoryLValue::operator=(Int_t index)
{
setIndex(index,kTRUE) ;
return *this ;
}
RooAbsArg& RooAbsCategoryLValue::operator=(const char *label)
{
setLabel(label) ;
return *this ;
}
RooAbsArg& RooAbsCategoryLValue::operator=(const RooAbsCategory& other)
{
if (&other==this) return *this ;
const RooCatType* type = lookupType(other.getLabel(),kTRUE) ;
if (!type) return *this ;
_value = *type ;
setValueDirty() ;
return *this ;
}
Bool_t RooAbsCategoryLValue::setOrdinal(UInt_t n)
{
const RooCatType *newValue= getOrdinal(n);
if(newValue) {
return setIndex(newValue->getVal());
}
else {
return kFALSE;
}
}
void RooAbsCategoryLValue::copyCache(const RooAbsArg* source)
{
RooAbsCategory::copyCache(source) ;
setIndex(_value.getVal()) ;
}
Bool_t RooAbsCategoryLValue::readFromStream(istream&, Bool_t, Bool_t)
{
return kTRUE ;
}
void RooAbsCategoryLValue::writeToStream(ostream&, Bool_t) const
{
}
void RooAbsCategoryLValue::randomize() {
UInt_t ordinal= RooRandom::integer(numTypes());
setOrdinal(ordinal);
}
void RooAbsCategoryLValue::setBin(Int_t ibin)
{
if (ibin<0 || ibin>=numBins()) {
cout << "RooAbsCategoryLValue::setBin(" << GetName() << ") ERROR: bin index " << ibin
<< " is out of range (0," << numBins()-1 << ")" << endl ;
return ;
}
const RooCatType* type = getOrdinal(ibin) ;
setIndex(type->getVal()) ;
}
Int_t RooAbsCategoryLValue::getBin() const
{
getIndex() ;
return _types.IndexOf(_types.FindObject(_value.GetName())) ;
}
Int_t RooAbsCategoryLValue::numBins() const
{
return numTypes() ;
}
ROOT page - Class index - Class Hierarchy - Top of the page
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.