// Class RooRecursiveFraction is a RooAbsReal implementation that
// calculates the plain fraction of sum of RooAddPdf components
// from a set of recursive fractions: for a given set of input fractions
// a_i it returns a_0 * Prod_i (1 - a_i).
// END_HTML
#include "RooFit.h"
#include "Riostream.h"
#include "Riostream.h"
#include <math.h>
#include "RooRecursiveFraction.h"
#include "RooAbsReal.h"
#include "RooAbsPdf.h"
#include "RooErrorHandler.h"
#include "RooArgSet.h"
#include "RooNLLVar.h"
#include "RooChi2Var.h"
#include "RooMsgService.h"
ClassImp(RooRecursiveFraction)
;
RooRecursiveFraction::RooRecursiveFraction()
{
_listIter = _list.createIterator() ;
}
RooRecursiveFraction::RooRecursiveFraction(const char* name, const char* title, const RooArgList& fracList) :
RooAbsReal(name, title),
_list("list","First set of components",this)
{
_listIter = _list.createIterator() ;
for (Int_t ifrac=fracList.getSize()-1 ; ifrac>=0 ; ifrac--) {
RooAbsArg* comp = fracList.at(ifrac) ;
if (!dynamic_cast<RooAbsReal*>(comp)) {
coutE(InputArguments) << "RooRecursiveFraction::ctor(" << GetName() << ") ERROR: component " << comp->GetName()
<< " is not of type RooAbsReal" << endl ;
RooErrorHandler::softAbort() ;
}
_list.add(*comp) ;
}
}
RooRecursiveFraction::RooRecursiveFraction(const RooRecursiveFraction& other, const char* name) :
RooAbsReal(other, name),
_list("list",this,other._list)
{
_listIter = _list.createIterator() ;
}
RooRecursiveFraction::~RooRecursiveFraction()
{
if (_listIter) delete _listIter ;
}
Double_t RooRecursiveFraction::evaluate() const
{
RooAbsReal* comp ;
const RooArgSet* nset = _list.nset() ;
_listIter->Reset() ;
comp=(RooAbsReal*)_listIter->Next() ;
Double_t prod = comp->getVal(nset) ;
while((comp=(RooAbsReal*)_listIter->Next())) {
prod *= (1-comp->getVal(nset)) ;
}
return prod ;
}
Last change: Mon Aug 25 11:36:57 2008
Last generated: 2008-08-25 11:36
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.