Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooRandomizeParamMCSModule.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooRandomizeParamMCSModule.h,v 1.2 2007/05/11 09:11:30 verkerke Exp $
5  * Authors: *
6  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8  * *
9  * Copyright (c) 2000-2005, Regents of the University of California *
10  * and Stanford University. All rights reserved. *
11  * *
12  * Redistribution and use in source and binary forms, *
13  * with or without modification, are permitted according to the terms *
14  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15  *****************************************************************************/
16 
17 #ifndef ROO_RANDOMIZE_PARAM_MCS_MODULE
18 #define ROO_RANDOMIZE_PARAM_MCS_MODULE
19 
20 #include "RooAbsMCStudyModule.h"
21 #include "RooRealVar.h"
22 #include <list>
23 
24 class RooRandomizeParamMCSModule : public RooAbsMCStudyModule {
25 public:
26 
27  RooRandomizeParamMCSModule() ;
28  RooRandomizeParamMCSModule(const RooRandomizeParamMCSModule& other) ;
29  virtual ~RooRandomizeParamMCSModule() ;
30 
31  void sampleUniform(RooRealVar& param, Double_t lo, Double_t hi) ;
32  void sampleGaussian(RooRealVar& param, Double_t mean, Double_t sigma) ;
33 
34  void sampleSumUniform(const RooArgSet& paramSet, Double_t lo, Double_t hi) ;
35  void sampleSumGauss(const RooArgSet& paramSet, Double_t lo, Double_t hi) ;
36 
37  Bool_t initializeInstance() ;
38 
39  Bool_t initializeRun(Int_t /*numSamples*/) ;
40  RooDataSet* finalizeRun() ;
41 
42  Bool_t processBeforeGen(Int_t /*sampleNum*/) ;
43 
44 private:
45 
46  struct UniParam {
47  UniParam() {}
48  UniParam(RooRealVar* p, Double_t lo, Double_t hi) : _param(p), _lo(lo), _hi(hi) {}
49  bool operator==(const UniParam& other) { return (_param==other._param) ; }
50  bool operator<(const UniParam& other) { return (_lo<other._lo) ; }
51  RooRealVar* _param ;
52  Double_t _lo ;
53  Double_t _hi ;
54  } ;
55 
56  struct UniParamSet {
57  UniParamSet() {}
58  UniParamSet(const RooArgSet& pset, Double_t lo, Double_t hi) : _pset(pset), _lo(lo), _hi(hi) {}
59  bool operator==(const UniParamSet& other) { return (_lo==other._lo) ; }
60  bool operator<(const UniParamSet& other) { return (_lo<other._lo) ; }
61  RooArgSet _pset ;
62  Double_t _lo ;
63  Double_t _hi ;
64  } ;
65 
66  struct GausParam {
67  GausParam() {}
68  GausParam(RooRealVar* p, Double_t mean, Double_t sigma) : _param(p), _mean(mean), _sigma(sigma) {}
69  bool operator==(const GausParam& other) { return (_param==other._param) ; }
70  bool operator<(const GausParam& other) { return (_mean<other._mean) ; }
71  RooRealVar* _param ;
72  Double_t _mean ;
73  Double_t _sigma ;
74  } ;
75 
76  struct GausParamSet {
77  GausParamSet() {}
78  GausParamSet(const RooArgSet& pset, Double_t mean, Double_t sigma) : _pset(pset), _mean(mean), _sigma(sigma) {}
79  bool operator==(const GausParamSet& other) { return (_mean==other._mean) ; }
80  bool operator<(const GausParamSet& other) { return (_mean<other._mean) ; }
81  RooArgSet _pset ;
82  Double_t _mean ;
83  Double_t _sigma ;
84  } ;
85 
86  std::list<UniParam> _unifParams ; //!
87  std::list<UniParamSet> _unifParamSets ; //!
88  std::list<GausParam> _gausParams ; //!
89  std::list<GausParamSet> _gausParamSets ; //!
90 
91  RooArgSet _genParSet ;
92  RooDataSet* _data ;
93 
94  ClassDef(RooRandomizeParamMCSModule,0) // MCStudy module to vary one or more input parameters during fit/generation cycle
95 } ;
96 
97 
98 #endif
99