Menu

#11 access to input category in RooMappedCategory

open
nobody
None
5
2005-08-19
2005-08-19
Anonymous
No

It would be convenient to have access to the input
category of a RooMappedCategory, eg

const RooAbsCategory& inputCat() const { return
_inputCat.arg() ; }

An example of a use case is when one needs a
RooMultiCategory over a list of categories that
contains RooMappedCategories. In that case it seems
necessary to replace the RooMappedCategory with its
input category, because RooMultiCategory only deals
with RooAbsCategoryLValue.

It would actually convenient to add the functionality
for dealing with RooMappedCategories directly in the
RooMultiCategory class, for example with the following

static RooAbsCategory*
findFundamentalCategory(RooMappedCategory* mapcat)
{
// recursive function to find input category of a
mapped category
RooAbsCategory* mother =
const_cast<RooAbsCategory*>(&(mapcat->inputCat())) ;
if(dynamic_cast<RooMappedCategory*>(mother)) {
mother = findFundamentalCategory(
dynamic_cast<RooMappedCategory*>(mother)) ;
}
return mother ;
}

void RooMultiCatIter::initialize(const RooArgSet& catList)
{
// Build iterator array for given catList

// Copy RooCategory list into internal argset
TIterator* catIter = catList.createIterator() ;
TObject* obj ;
while ((obj = catIter->Next())) {
RooAbsCategory *cat=
dynamic_cast<RooAbsCategoryLValue*>(obj);
if( 0 == cat ) {
RooMappedCategory* mapcat =
dynamic_cast<RooMappedCategory*>(obj);
if( mapcat )
cat = findFundamentalCategory( mapcat ) ;
}
if(0 == cat) {
cout << "RooMultiCatIter:: list element " <<
obj->GetName()
<< " is not a RooAbsCategoryLValue, ignored" << endl ;
continue ;
}
_catList.add(*cat) ;
}
delete catIter ;
[...]

Discussion


Log in to post a comment.

MongoDB Logo MongoDB