RooAcceptReject.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooAcceptReject.h,v 1.16 2007/05/11 09:11:30 verkerke Exp $
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 #ifndef ROO_ACCEPT_REJECT
00017 #define ROO_ACCEPT_REJECT
00018 
00019 #include "RooAbsNumGenerator.h"
00020 #include "RooPrintable.h"
00021 #include "RooArgSet.h"
00022 
00023 class RooAbsReal;
00024 class RooRealVar;
00025 class RooDataSet;
00026 class RooRealBinding;
00027 class RooNumGenFactory ;
00028 
00029 class RooAcceptReject : public RooAbsNumGenerator {
00030 public:
00031   RooAcceptReject() : _nextCatVar(0), _nextRealVar(0) {
00032     // coverity[UNINIT_CTOR]
00033   } ; 
00034   RooAcceptReject(const RooAbsReal &func, const RooArgSet &genVars, const RooNumGenConfig& config, Bool_t verbose=kFALSE, const RooAbsReal* maxFuncVal=0);
00035   RooAbsNumGenerator* clone(const RooAbsReal& func, const RooArgSet& genVars, const RooArgSet& /*condVars*/, 
00036                             const RooNumGenConfig& config, Bool_t verbose=kFALSE, const RooAbsReal* maxFuncVal=0) const {
00037     return new RooAcceptReject(func,genVars,config,verbose,maxFuncVal) ;
00038   }
00039   virtual ~RooAcceptReject();
00040 
00041   const RooArgSet *generateEvent(UInt_t remaining, Double_t& resampleRatio);
00042   Double_t getFuncMax() ;
00043 
00044 
00045   // Advertisement of capabilities
00046   virtual Bool_t canSampleConditional() const { return kTRUE ; }
00047   virtual Bool_t canSampleCategories() const { return kTRUE ; }
00048 
00049  
00050 protected:
00051 
00052   friend class RooNumGenFactory ;
00053   static void registerSampler(RooNumGenFactory& fact) ; 
00054 
00055   void addEventToCache();
00056   const RooArgSet *nextAcceptedEvent();
00057 
00058   Double_t _maxFuncVal, _funcSum;      // Maximum function value found, and sum of all samples made
00059   UInt_t _realSampleDim,_catSampleMult;// Number of real and discrete dimensions to be samplesd
00060   UInt_t _minTrials;                   // Minimum number of max.finding trials, total number of samples
00061   UInt_t _totalEvents;                 // Total number of function samples
00062   UInt_t _eventsUsed;                  // Accepted number of function samples
00063   TIterator *_nextCatVar;              // Iterator of categories to be generated
00064   TIterator *_nextRealVar;             // Iterator over variables to be generated
00065 
00066   UInt_t _minTrialsArray[4];           // Minimum number of trials samples for 1,2,3 dimensional problems
00067 
00068   ClassDef(RooAcceptReject,0) // Context for generating a dataset from a PDF
00069 };
00070 
00071 #endif

Generated on Tue Jul 5 14:26:03 2011 for ROOT_528-00b_version by  doxygen 1.5.1