Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/RooAbsGenContext.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitCore                                                       *
0004  *    File: $Id: RooAbsGenContext.h,v 1.15 2007/05/11 09:11:30 verkerke Exp $
0005  * Authors:                                                                  *
0006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
0007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
0008  *                                                                           *
0009  * Copyright (c) 2000-2005, Regents of the University of California          *
0010  *                          and Stanford University. All rights reserved.    *
0011  *                                                                           *
0012  * Redistribution and use in source and binary forms,                        *
0013  * with or without modification, are permitted according to the terms        *
0014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
0015  *****************************************************************************/
0016 #ifndef ROO_ABS_GEN_CONTEXT
0017 #define ROO_ABS_GEN_CONTEXT
0018 
0019 #include "TNamed.h"
0020 #include "RooPrintable.h"
0021 #include "RooArgSet.h"
0022 #include "RooAbsPdf.h"
0023 
0024 class RooDataSet;
0025 
0026 class RooAbsGenContext : public TNamed, public RooPrintable {
0027 public:
0028   RooAbsGenContext(const RooAbsPdf &model, const RooArgSet &vars, const RooDataSet *prototype= nullptr, const RooArgSet* auxProto=nullptr,
0029          bool _verbose= false) ;
0030 
0031   virtual RooDataSet *generate(double nEvents= 0, bool skipInit=false, bool extendedMode=false);
0032 
0033   bool isValid() const {
0034     // If true generator context is in a valid state
0035     return _isValid;
0036   }
0037 
0038   inline void setVerbose(bool verbose= true) {
0039     // Set/clear verbose messaging
0040     _verbose= verbose;
0041   }
0042   inline bool isVerbose() const {
0043     // If true verbose messaging is active
0044     return _verbose;
0045   }
0046 
0047   virtual void setProtoDataOrder(Int_t* lut) ;
0048 
0049    inline void Print(Option_t *options= nullptr) const override {
0050      // Print context information on stdout
0051      printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
0052   }
0053 
0054   virtual void attach(const RooArgSet& params) ;
0055 
0056   void printName(std::ostream& os) const override ;
0057   void printTitle(std::ostream& os) const override ;
0058   void printClassName(std::ostream& os) const override ;
0059   void printArgs(std::ostream& os) const override ;
0060   void printMultiline(std::ostream& os, Int_t contents, bool verbose=false, TString indent="") const override;
0061 
0062   Int_t defaultPrintContents(Option_t* opt) const override ;
0063   StyleOption defaultPrintStyle(Option_t* opt) const override ;
0064 
0065   virtual void setExpectedData(bool) {} ;
0066 
0067   virtual void generateEvent(RooArgSet &theEvent, Int_t remaining) = 0;
0068   virtual void initGenerator(const RooArgSet &theEvent);
0069 
0070 protected:
0071 
0072   virtual RooDataSet* createDataSet(const char* name, const char* title, const RooArgSet& obs) ;
0073 
0074   void resampleData(double& ratio) ;
0075 
0076   const RooDataSet *_prototype; ///< Pointer to prototype dataset
0077   RooArgSet _theEvent;          ///< Pointer to observable event being generated
0078   bool _isValid;              ///< Is context in valid state?
0079   bool _verbose;              ///< Verbose messaging?
0080   UInt_t _expectedEvents;       ///< Number of expected events from extended p.d.f
0081   RooArgSet _protoVars;         ///< Prototype observables
0082   Int_t _nextProtoIndex;        ///< Next prototype event to load according to LUT
0083   RooAbsPdf::ExtendMode _extendMode ;  ///< Extended mode capabilities of p.d.f.
0084   std::vector<Int_t> _protoOrder ; ///< LUT with traversal order of prototype data
0085   TString _normRange ;          ///< Normalization range of pdf
0086 
0087   RooDataSet* _genData = nullptr;        ///<! Data being generated
0088 
0089   ClassDefOverride(RooAbsGenContext,0) // Abstract context for generating a dataset from a PDF
0090 };
0091 
0092 #endif