00001 /***************************************************************************** 00002 * Project: RooFit * 00003 * Package: RooFitCore * 00004 * @(#)root/roofitcore:$Id: RooAbsIntegrator.cxx 34064 2010-06-22 15:05:19Z wouter $ 00005 * Authors: * 00006 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu * 00007 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu * 00008 * * 00009 * Copyright (c) 2000-2005, Regents of the University of California * 00010 * and Stanford University. All rights reserved. * 00011 * * 00012 * Redistribution and use in source and binary forms, * 00013 * with or without modification, are permitted according to the terms * 00014 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) * 00015 *****************************************************************************/ 00016 00017 ////////////////////////////////////////////////////////////////////////////// 00018 // 00019 // BEGIN_HTML 00020 // RooAbsIntegrator is the abstract interface for integrators of real-valued 00021 // functions that implement the RooAbsFunc interface. 00022 // END_HTML 00023 // 00024 // 00025 00026 #include "RooFit.h" 00027 00028 #include "Riostream.h" 00029 00030 00031 #include "RooAbsIntegrator.h" 00032 #include "RooAbsIntegrator.h" 00033 #include "RooMsgService.h" 00034 #include "TClass.h" 00035 00036 ClassImp(RooAbsIntegrator) 00037 ; 00038 00039 00040 //_____________________________________________________________________________ 00041 RooAbsIntegrator::RooAbsIntegrator() : _function(0), _valid(kFALSE), _printEvalCounter(kFALSE) 00042 { 00043 // Default constructor 00044 } 00045 00046 00047 00048 //_____________________________________________________________________________ 00049 RooAbsIntegrator::RooAbsIntegrator(const RooAbsFunc& function, Bool_t doPrintEvalCounter) : 00050 _function(&function), _valid(function.isValid()), _printEvalCounter(doPrintEvalCounter) 00051 { 00052 // Copy constructor 00053 } 00054 00055 00056 00057 //_____________________________________________________________________________ 00058 Double_t RooAbsIntegrator::calculate(const Double_t *yvec) 00059 { 00060 // Calculate integral value with given array of parameter values 00061 00062 integrand()->resetNumCall() ; 00063 00064 integrand()->saveXVec() ; 00065 Double_t ret = integral(yvec) ; 00066 integrand()->restoreXVec() ; 00067 00068 cxcoutD(NumIntegration) << IsA()->GetName() << "::calculate(" << _function->getName() << ") number of function calls = " << integrand()->numCall()<<", result = "<<ret << endl ; 00069 return ret ; 00070 } 00071 00072 00073 00074 //_____________________________________________________________________________ 00075 Bool_t RooAbsIntegrator::setLimits(Double_t xmin, Double_t xmax) 00076 { 00077 // Interface to set limits on integration 00078 return setLimits(&xmin,&xmax) ; 00079 } 00080 00081 00082 00083 //_____________________________________________________________________________ 00084 Bool_t RooAbsIntegrator::setUseIntegrandLimits(Bool_t) 00085 { 00086 // Interface function that allows to defer limit definition to integrand definition 00087 return kFALSE ; 00088 }