00001 /***************************************************************************** 00002 * Project: RooFit * 00003 * Package: RooFitCore * 00004 * @(#)root/roofitcore:$Id: RooTFoamBinding.cxx 28259 2009-04-16 16:21:16Z 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 // Lightweight interface adaptor that binds a RooAbsPdf to TFOAM 00021 // END_HTML 00022 // 00023 00024 00025 #include "RooFit.h" 00026 #include "Riostream.h" 00027 00028 #include "RooTFoamBinding.h" 00029 #include "RooRealBinding.h" 00030 #include "RooAbsReal.h" 00031 #include "RooAbsPdf.h" 00032 #include "RooArgSet.h" 00033 00034 #include <assert.h> 00035 00036 00037 00038 ClassImp(RooTFoamBinding) 00039 ; 00040 00041 00042 //_____________________________________________________________________________ 00043 RooTFoamBinding::RooTFoamBinding(const RooAbsReal& pdf, const RooArgSet& observables) 00044 { 00045 _nset.add(observables) ; 00046 _binding = new RooRealBinding(pdf,observables,&_nset,kFALSE,0) ; 00047 } 00048 00049 00050 //_____________________________________________________________________________ 00051 RooTFoamBinding::~RooTFoamBinding() 00052 { 00053 // Destructor 00054 delete _binding ; 00055 } 00056 00057 00058 00059 //_____________________________________________________________________________ 00060 Double_t RooTFoamBinding::Density(Int_t ndim, Double_t *xvec) 00061 { 00062 Double_t x[10] ; 00063 for (int i=0 ; i<ndim ; i++) { 00064 x[i] = xvec[i]*(_binding->getMaxLimit(i)-_binding->getMinLimit(i)) + _binding->getMinLimit(i) ; 00065 //cout << "RTFB::Density xvec[" << i << "] = " << xvec[i] << " x[i] = " << x[i] << endl ; 00066 } 00067 Double_t ret = (*_binding)(x) ; 00068 return ret<0?0:ret ; 00069 }