#include "RooFit.h"
#include "RooGenericPdf.h"
#include "RooGenericPdf.h"
#include "RooStreamParser.h"
#include "RooArgList.h"
ClassImp(RooGenericPdf)
RooGenericPdf::RooGenericPdf(const char *name, const char *title, const RooArgList& dependents) : 
  RooAbsPdf(name,title), 
  _actualVars("actualVars","Variables used by PDF expression",this),
  _formula(name,title,dependents)
{  
  
  _actualVars.add(dependents) ; 
  if (_actualVars.getSize()==0) _value = traceEval(0) ;
}
RooGenericPdf::RooGenericPdf(const char *name, const char *title, 
			     const char* formula, const RooArgList& dependents) : 
  RooAbsPdf(name,title), 
  _actualVars("actualVars","Variables used by PDF expression",this),
  _formula(name,formula,dependents)
{  
  _actualVars.add(dependents) ; 
  if (_actualVars.getSize()==0) _value = traceEval(0) ;
}
RooGenericPdf::RooGenericPdf(const RooGenericPdf& other, const char* name) : 
  RooAbsPdf(other, name), 
  _actualVars("actualVars",this,other._actualVars),
  _formula(other._formula)
{
  
}
RooGenericPdf::~RooGenericPdf() 
{
  
}
Double_t RooGenericPdf::evaluate() const
{
  
  return _formula.eval(_normMgr.lastNormSet()) ;
}
Bool_t RooGenericPdf::setFormula(const char* formula) 
{
  
  if (_formula.reCompile(formula)) return kTRUE ;
  
  SetTitle(formula) ;
  setValueDirty() ;
  return kFALSE ;
}
Bool_t RooGenericPdf::isValidReal(Double_t , Bool_t ) const {
  
  return kTRUE ;
}
Bool_t RooGenericPdf::redirectServersHook(const RooAbsCollection& newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t )
{
  
  return _formula.changeDependents(newServerList,mustReplaceAll,nameChange) ;
}
void RooGenericPdf::printToStream(ostream& os, PrintOption opt, TString indent) const
{
  
  RooAbsPdf::printToStream(os,opt,indent);
  if(opt >= Verbose) {
    indent.Append("  ");
    os << indent;
    _formula.printToStream(os,opt,indent);
  }
}
Bool_t RooGenericPdf::readFromStream(istream& is, Bool_t compact, Bool_t )
{
  
  if (compact) {
    cout << "RooGenericPdf::readFromStream(" << GetName() << "): can't read in compact mode" << endl ;
    return kTRUE ;
  } else {
    RooStreamParser parser(is) ;
    return setFormula(parser.readLine()) ;
  }
}
void RooGenericPdf::writeToStream(ostream& os, Bool_t compact) const
{
  
  if (compact) {
    cout << getVal() << endl ;
  } else {
    os << GetTitle() ;
  }
}
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.