#include "RooFit.h"
#include "RooConvIntegrandBinding.h"
#include "RooConvIntegrandBinding.h"
#include "RooAbsReal.h"
#include "RooArgSet.h"
#include "RooAbsRealLValue.h"
#include "RooMsgService.h"
#include <assert.h>
ClassImp(RooConvIntegrandBinding)
;
RooConvIntegrandBinding::RooConvIntegrandBinding(const RooAbsReal& func, const RooAbsReal& model, 
				       RooAbsReal& xprime, RooAbsReal& x, 
				       const RooArgSet* nset, Bool_t clipInvalid) :
  RooAbsFunc(2), _func(&func), _model(&model), _vars(0), _nset(nset), _clipInvalid(clipInvalid)
{
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
        
  
  _vars= new RooAbsRealLValue*[2];
  if(0 == _vars) {
    _valid= kFALSE;
    return;
  }
  
  _vars[0]= dynamic_cast<RooAbsRealLValue*>(&xprime);
  if(0 == _vars[0]) {
    oocoutE(&func,InputArguments) << "RooConvIntegrandBinding: cannot bind to ";
    xprime.Print("1");
    _valid= kFALSE;
  }
  _vars[1]= dynamic_cast<RooAbsRealLValue*>(&x);
  if(0 == _vars[1]) {
    oocoutE(&func,InputArguments) << "RooConvIntegrandBinding: cannot bind to ";
    x.Print("1");
    _valid= kFALSE;
  }
}
RooConvIntegrandBinding::~RooConvIntegrandBinding() {
  if(0 != _vars) delete[] _vars;
}
void RooConvIntegrandBinding::loadValues(const Double_t xvector[], Bool_t clipInvalid) const {
  _xvecValid = kTRUE ;
  for(UInt_t index= 0; index < _dimension; index++) {
    if (clipInvalid && !_vars[index]->isValidReal(xvector[index])) {
      _xvecValid = kFALSE ;
    } else {
      
      _vars[index]->setVal(xvector[index]);
    }
  }
}  
Double_t RooConvIntegrandBinding::operator()(const Double_t xvector[]) const {
  assert(isValid());
  _ncall++ ;
  
  loadValues(xvector);
  if (!_xvecValid) return 0 ;
  
  Double_t f_xp = _func->getVal(_nset) ;
  
  const Double_t xvec_tmp[2] = { xvector[1]-xvector[0] , xvector[1] } ;
  loadValues(xvec_tmp,kTRUE);
  if (!_xvecValid) return 0 ;
  Double_t g_xmxp = _model->getVal(_nset) ;
  
  
  
  
  return f_xp*g_xmxp ;
}
Double_t RooConvIntegrandBinding::getMinLimit(UInt_t index) const {
  assert(isValid());
  return _vars[index]->getMin();
}
Double_t RooConvIntegrandBinding::getMaxLimit(UInt_t index) const {
  assert(isValid());
  return _vars[index]->getMax();
}
Last update: Thu Jan 17 08:44:21 2008
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.