RooAbsGenContext.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooAbsGenContext.h,v 1.15 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_ABS_GEN_CONTEXT
00017 #define ROO_ABS_GEN_CONTEXT
00018 
00019 #include "TNamed.h"
00020 #include "RooPrintable.h"
00021 #include "RooArgSet.h"
00022 #include "RooAbsPdf.h"
00023 
00024 class RooDataSet;
00025 
00026 class RooAbsGenContext : public TNamed, public RooPrintable {
00027 public:
00028   RooAbsGenContext(const RooAbsPdf &model, const RooArgSet &vars, const RooDataSet *prototype= 0, const RooArgSet* auxProto=0,
00029                    Bool_t _verbose= kFALSE) ;
00030   virtual ~RooAbsGenContext();
00031 
00032   RooDataSet *generate(Int_t nEvents= 0);
00033 
00034   Bool_t isValid() const { 
00035     // If true generator context is in a valid state
00036     return _isValid; 
00037   }
00038 
00039   inline void setVerbose(Bool_t verbose= kTRUE) { 
00040     // Set/clear verbose messaging
00041     _verbose= verbose; 
00042   }
00043   inline Bool_t isVerbose() const { 
00044     // If true verbose messaging is active
00045     return _verbose; 
00046   }
00047 
00048   virtual void setProtoDataOrder(Int_t* lut) ;
00049 
00050    inline virtual void Print(Option_t *options= 0) const {
00051      // Print context information on stdout
00052      printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
00053   }
00054 
00055   virtual void attach(const RooArgSet& params) ;
00056 
00057   virtual void printName(ostream& os) const ;
00058   virtual void printTitle(ostream& os) const ;
00059   virtual void printClassName(ostream& os) const ;
00060   virtual void printArgs(ostream& os) const ;
00061   virtual void printMultiline(ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const;
00062 
00063   virtual Int_t defaultPrintContents(Option_t* opt) const ;
00064   virtual StyleOption defaultPrintStyle(Option_t* opt) const ;
00065 
00066 protected:
00067 
00068   friend class RooConvGenContext ;
00069   friend class RooProdGenContext ;
00070   friend class RooAddGenContext ;
00071   friend class RooSimGenContext ;
00072   friend class RooEffGenContext ;
00073 
00074   virtual void initGenerator(const RooArgSet &theEvent);
00075   virtual void generateEvent(RooArgSet &theEvent, Int_t remaining) = 0;
00076 
00077   void resampleData(Double_t& ratio) ;
00078 
00079   const RooDataSet *_prototype; // Pointer to prototype dataset
00080   RooArgSet *_theEvent;         // Pointer to observable event being generated
00081   Bool_t _isValid;              // Is context in valid state?
00082   Bool_t _verbose;              // Verbose messaging?
00083   UInt_t _expectedEvents;       // Number of expected events from extended p.d.f
00084   RooArgSet _protoVars;         // Prototype observables
00085   Int_t _nextProtoIndex;        // Next prototype event to load according to LUT
00086   RooAbsPdf::ExtendMode _extendMode ;  // Extended mode capabilities of p.d.f.
00087   Int_t* _protoOrder ;          // LUT with traversal order of prototype data
00088   TString _normRange ;          // Normalization range of pdf
00089 
00090   RooDataSet* _genData ;        //! Data being generated
00091 
00092   ClassDef(RooAbsGenContext,0) // Abstract context for generating a dataset from a PDF
00093 };
00094 
00095 #endif

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