Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:22

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitCore                                                       *
0004  *    File: $Id: RooGenContext.h,v 1.19 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_GEN_CONTEXT
0017 #define ROO_GEN_CONTEXT
0018 
0019 #include "RooAbsGenContext.h"
0020 #include "RooArgSet.h"
0021 
0022 class RooAbsPdf;
0023 class RooDataSet;
0024 class RooAcceptReject;
0025 class TRandom;
0026 class RooRealVar ;
0027 class RooAbsNumGenerator ;
0028 
0029 class RooGenContext : public RooAbsGenContext {
0030 public:
0031   RooGenContext(const RooAbsPdf &model, const RooArgSet &vars, const RooDataSet *prototype= nullptr,
0032       const RooArgSet* auxProto=nullptr, bool verbose=false, const RooArgSet* forceDirect=nullptr);
0033   ~RooGenContext() override;
0034 
0035   void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const override ;
0036 
0037   void attach(const RooArgSet& params) override ;
0038 
0039 protected:
0040 
0041   void initGenerator(const RooArgSet &theEvent) override;
0042   void generateEvent(RooArgSet &theEvent, Int_t remaining) override;
0043 
0044   RooArgSet _cloneSet;    ///< Clone of all nodes of input p.d.f
0045   RooAbsPdf *_pdfClone = nullptr;   ///< Clone of input p.d.f
0046   RooArgSet _directVars,_uniformVars,_otherVars; ///< List of observables generated internally, randomly, and by accept/reject sampling
0047   Int_t _code;                                   ///< Internal generation code
0048   double _maxProb{0.}, _area{0.}, _norm{0.};   ///< Maximum probability, p.d.f area and normalization
0049   std::unique_ptr<RooAbsReal> _acceptRejectFunc; ///< Projection function to be passed to accept/reject sampler
0050   std::unique_ptr<RooAbsNumGenerator> _generator; ///< MC sampling generation engine
0051   std::unique_ptr<RooRealVar> _maxVar;            ///< Variable holding maximum value of p.d.f
0052   Int_t _updateFMaxPerEvent ;         ///< If true, maximum p.d.f value needs to be recalculated for each event
0053 
0054   ClassDefOverride(RooGenContext,0) // Universal context for generating toy MC data from any p.d.f
0055 };
0056 
0057 #endif