Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 #include "Rtypes.h"
15 
16 #include "RooAbsStudy.h"
17 
18 #include "RooStats/ToyMCSampler.h"
20 
21 #include "RooWorkspace.h"
22 #include "RooArgSet.h"
23 
24 #include "RooDataSet.h"
25 #include "RooLinkedList.h"
26 #include "RooLinkedListIter.h"
27 
28 #include <vector>
29 
30 namespace RooStats {
31 
32 class ToyMCStudy: public RooAbsStudy {
33 
34  public:
35  // need to have constructor without arguments for proof
36  ToyMCStudy(const char *name = "ToyMCStudy", const char *title = "ToyMCStudy") :
37  RooAbsStudy(name, title),
38  fRandomSeed(0),
39  fToyMCSampler(NULL)
40  {
41  // In this case, this is the normal output. The SamplingDistribution
42  // instances are stored as detailed output.
43  storeDetailedOutput(kTRUE);
44  }
45 
46  RooAbsStudy* clone(const char* /*newname*/="") const { return new ToyMCStudy(*this) ; }
47 
48  virtual ~ToyMCStudy() {}
49 
50  // RooAbsStudy interfaces
51  virtual Bool_t initialize(void);
52  virtual Bool_t execute(void);
53  virtual Bool_t finalize(void);
54 
55  RooDataSet* merge();
56 
57  void SetToyMCSampler(ToyMCSampler& t) { fToyMCSampler = &t; }
58  void SetParamPoint(const RooArgSet& paramPoint) { fParamPoint.add(paramPoint); }
59 
60  void SetRandomSeed(unsigned int seed) { fRandomSeed = seed; }
61 
62  protected:
63 
64  unsigned int fRandomSeed;
65  ToyMCSampler *fToyMCSampler;
66  RooArgSet fParamPoint;
67 
68  protected:
69  ClassDef(ToyMCStudy,2); // toy MC study for parallel processing
70 
71 };
72 
73 
74 class ToyMCPayload : public TNamed {
75 
76  public:
77 
78  ToyMCPayload() {
79  // proof constructor, do not use
80  fDataSet = NULL;
81  }
82 
83  ToyMCPayload(RooDataSet* sd)
84  {
85  fDataSet = sd;
86  }
87 
88  virtual ~ToyMCPayload() {
89  }
90 
91 
92  RooDataSet* GetSamplingDistributions()
93  {
94  return fDataSet;
95  }
96 
97  private:
98  RooDataSet* fDataSet;
99 
100  protected:
101  ClassDef(ToyMCPayload,1);
102 };
103 
104 
105 }
106 
107 
108 #endif