ROOT  6.06/09
Reference Guide
ToyMCStudy.h
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 // Author: Sven Kreiss and Kyle Cranmer June 2010
3 /*************************************************************************
4  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOSTATS_ToyMCStudy
12 #define ROOSTATS_ToyMCStudy
13 
14 
15 
16 
17 #ifndef ROOT_Rtypes
18 #include "Rtypes.h"
19 #endif
20 
21 #include "RooAbsStudy.h"
22 
23 #include "RooStats/ToyMCSampler.h"
25 
26 #include "RooWorkspace.h"
27 #include "RooArgSet.h"
28 
29 #include "RooDataSet.h"
30 #include "RooLinkedList.h"
31 #include "RooLinkedListIter.h"
32 
33 #include <vector>
34 
35 
36 
37 namespace RooStats {
38 
39 /**
40 
41 ToyMCStudy is an implementation of RooAbsStudy for toy Monte Carlo sampling.
42 This class is automatically used by ToyMCSampler when given a ProofConfig.
43 This is also its intended use case.
44 
45 \ingroup Roostats
46 
47 */
48 
49 
50 class ToyMCStudy: public RooAbsStudy {
51 
52  public:
53  // need to have constructor without arguments for proof
54  ToyMCStudy(const char *name = "ToyMCStudy", const char *title = "ToyMCStudy") :
55  RooAbsStudy(name, title),
56  fRandomSeed(0),
58  {
59  // In this case, this is the normal output. The SamplingDistribution
60  // instances are stored as detailed output.
62  }
63 
64  RooAbsStudy* clone(const char* /*newname*/="") const { return new ToyMCStudy(*this) ; }
65 
66  virtual ~ToyMCStudy() {}
67 
68  // RooAbsStudy interfaces
69  virtual Bool_t initialize(void);
70  virtual Bool_t execute(void);
71  virtual Bool_t finalize(void);
72 
73  RooDataSet* merge();
74 
76  void SetParamPoint(const RooArgSet& paramPoint) { fParamPoint.add(paramPoint); }
77 
78  void SetRandomSeed(unsigned int seed) { fRandomSeed = seed; }
79 
80  protected:
81 
82  unsigned int fRandomSeed;
85 
86  protected:
87  ClassDef(ToyMCStudy,2); // toy MC study for parallel processing
88 
89 };
90 
91 
92 class ToyMCPayload : public TNamed {
93 
94  public:
95 
97  // proof constructor, do not use
98  fDataSet = NULL;
99  }
100 
102  {
103  fDataSet = sd;
104  }
105 
106  virtual ~ToyMCPayload() {
107  }
108 
109 
111  {
112  return fDataSet;
113  }
114 
115  private:
117 
118  protected:
120 };
121 
122 
123 }
124 
125 
126 #endif
ToyMCStudy(const char *name="ToyMCStudy", const char *title="ToyMCStudy")
Definition: ToyMCStudy.h:54
unsigned int fRandomSeed
Definition: ToyMCStudy.h:82
RooDataSet * merge()
Definition: ToyMCStudy.cxx:93
ToyMCPayload(RooDataSet *sd)
Definition: ToyMCStudy.h:101
RooDataSet * GetSamplingDistributions()
Definition: ToyMCStudy.h:110
bool Bool_t
Definition: RtypesCore.h:59
virtual Bool_t finalize(void)
Definition: ToyMCStudy.cxx:83
RooDataSet * fDataSet
Definition: ToyMCStudy.h:116
virtual Bool_t initialize(void)
Definition: ToyMCStudy.cxx:38
void SetRandomSeed(unsigned int seed)
Definition: ToyMCStudy.h:78
RooArgSet fParamPoint
Definition: ToyMCStudy.h:84
void SetParamPoint(const RooArgSet &paramPoint)
Definition: ToyMCStudy.h:76
ToyMCStudy is an implementation of RooAbsStudy for toy Monte Carlo sampling.
Definition: ToyMCStudy.h:50
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
ClassDef(ToyMCStudy, 2)
ToyMCSampler is an implementation of the TestStatSampler interface.
Definition: ToyMCSampler.h:99
ToyMCSampler * fToyMCSampler
Definition: ToyMCStudy.h:83
Namespace for the RooStats classes.
Definition: Asimov.h:20
void SetToyMCSampler(ToyMCSampler &t)
Definition: ToyMCStudy.h:75
#define name(a, b)
Definition: linkTestLib0.cpp:5
ClassDef(ToyMCPayload, 1)
#define NULL
Definition: Rtypes.h:82
virtual Bool_t execute(void)
Definition: ToyMCStudy.cxx:72
RooAbsStudy * clone(const char *="") const
Definition: ToyMCStudy.h:64
virtual ~ToyMCStudy()
Definition: ToyMCStudy.h:66
const Bool_t kTRUE
Definition: Rtypes.h:91
void storeDetailedOutput(Bool_t flag)
Definition: RooAbsStudy.h:47
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add element to non-owning set.
Definition: RooArgSet.cxx:448