Logo ROOT   6.08/07
Reference Guide
HLFactory.h
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 
3 /*************************************************************************
4  * Project: RooStats *
5  * Package: RooFit/RooStats *
6  * Authors: *
7  * Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke *
8  *************************************************************************
9  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
10  * All rights reserved. *
11  * *
12  * For the licensing terms see $ROOTSYS/LICENSE. *
13  * For the list of contributors see $ROOTSYS/README/CREDITS. *
14  *************************************************************************/
15 
16 #ifndef RooStats_HLFactory
17 #define RooStats_HLFactory
18 
19 #include "TString.h"
20 #include "RooAbsPdf.h"
21 #include "RooCategory.h"
22 #include "RooDataSet.h"
23 #include "RooWorkspace.h"
24 
25 
26 // class TString;
27 // class RooDataSet;
28 
29 namespace RooStats {
30 
31  /**
32  HLFactory is an High Level model Factory allows you to
33  describe your models in a configuration file
34  (_datacards_) acting as an interface with the RooFactoryWSTool.
35  Moreover it provides tools for the combination of models and datasets.
36 
37  \ingroup Roostats
38  */
39 
40 
41  class HLFactory : public TNamed {
42 
43  public:
44 
45  /// Constructor
46  HLFactory(const char *name,
47  const char *fileName=0,
48  bool isVerbose = false);
49 
50  /// Constructor with external RooWorkspace
51  HLFactory(const char* name,
52  RooWorkspace* externalWs,
53  bool isVerbose = false);
54 
55  /// Default Constructor
56  HLFactory();
57 
58  /// Default Destructor
59  ~HLFactory();
60 
61  /// Add channel for the combination
62  int AddChannel(const char* label,
63  const char* SigBkgPdfName,
64  const char* BkgPdfName=0,
65  const char* datasetName=0);
66 
67  /// Dump the Workspace content as configuration file
68  /* It needs some workspace object list or something..*/
69  void DumpCfg(const char* /*cardname*/ ){ /* t.b.i. */ }; // Dump the factory content as configuration file
70 
71  /// Get the combined signal plus background pdf
72  RooAbsPdf* GetTotSigBkgPdf(); // Get the Signal and Background combined model
73 
74  /// Get the combined background pdf
75  RooAbsPdf* GetTotBkgPdf(); // Get the Background combined model
76 
77  /// Get the combined dataset
78  RooDataSet* GetTotDataSet(); // Get the combined dataset
79 
80  /// Get the combined dataset
81  RooCategory* GetTotCategory(); // Get the category
82 
83  /// Get the RooWorkspace containing the models and variables
84  RooWorkspace* GetWs(){return fWs;}; // Expose the internal Workspace
85 
86  /// Process a configuration file
87  int ProcessCard(const char* filename);
88 
89  private:
90 
91  /// The category of the combination
93 
94  /// The background model combination
96 
97  /// The signal plus background model combination
99 
100  /// The datasets combination
102 
103  /// Flag to keep trace of the status of the combination
105 
106  /// Create the category for the combinations
107  void fCreateCategory();
108 
109  /// Check the length of the lists
110  bool fNamesListsConsistent();
111 
112  /// List of channels names to combine for the signal plus background pdfs
114 
115  /// List of channels names to combine for the background pdfs
117 
118  /// List of channels names to combine for the datasets
120 
121  /// List of channels names to combine for the datasets
123 
124  /// The verbosity flag
125  bool fVerbose;
126 
127  /// Keep trace of the inclusion deepness
129 
130  /// The RooWorkspace containing the models and variables
132 
133  /// Owns workspace
134  bool fOwnWs;
135 
136  /// Read the actual cfg file
137  int fReadFile(const char*fileName, bool is_included = false);
138 
139  /// Parse a single line an puts the content in the RooWorkSpace
140  int fParseLine(TString& line);
141 
142 
143  ClassDef(HLFactory,1) // The high Level Model Factory to create models from datacards
144 
145  };
146 }
147 
148 #endif
void DumpCfg(const char *)
Dump the Workspace content as configuration file.
Definition: HLFactory.h:69
RooCategory * fComboCat
The category of the combination.
Definition: HLFactory.h:92
TLine * line
int AddChannel(const char *label, const char *SigBkgPdfName, const char *BkgPdfName=0, const char *datasetName=0)
Add channel for the combination.
Definition: HLFactory.cxx:131
bool fOwnWs
Owns workspace.
Definition: HLFactory.h:134
RooDataSet * GetTotDataSet()
Get the combined dataset.
Definition: HLFactory.cxx:279
Basic string class.
Definition: TString.h:137
RooWorkspace * fWs
The RooWorkspace containing the models and variables.
Definition: HLFactory.h:131
TList fBkgPdfNames
List of channels names to combine for the background pdfs.
Definition: HLFactory.h:116
void fCreateCategory()
Create the category for the combinations.
Definition: HLFactory.cxx:523
#define ClassDef(name, id)
Definition: Rtypes.h:254
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
HLFactory is an High Level model Factory allows you to describe your models in a configuration file (...
Definition: HLFactory.h:41
RooDataSet * fComboDataset
The datasets combination.
Definition: HLFactory.h:101
HLFactory()
Default Constructor.
Definition: HLFactory.cxx:88
A doubly linked list.
Definition: TList.h:47
RooAbsPdf * GetTotBkgPdf()
Get the combined background pdf.
Definition: HLFactory.cxx:230
RooAbsPdf * fComboBkgPdf
The background model combination.
Definition: HLFactory.h:95
TList fDatasetsNames
List of channels names to combine for the datasets.
Definition: HLFactory.h:119
RooAbsPdf * fComboSigBkgPdf
The signal plus background model combination.
Definition: HLFactory.h:98
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:29
int fInclusionLevel
Keep trace of the inclusion deepness.
Definition: HLFactory.h:128
RooCategory represents a fundamental (non-derived) discrete value object.
Definition: RooCategory.h:25
bool fNamesListsConsistent()
Check the length of the lists.
Definition: HLFactory.cxx:548
~HLFactory()
Default Destructor.
Definition: HLFactory.cxx:109
bool fVerbose
The verbosity flag.
Definition: HLFactory.h:125
int ProcessCard(const char *filename)
Process a configuration file.
Definition: HLFactory.cxx:349
Namespace for the RooStats classes.
Definition: Asimov.h:20
RooCategory * GetTotCategory()
Get the combined dataset.
Definition: HLFactory.cxx:332
bool fCombinationDone
Flag to keep trace of the status of the combination.
Definition: HLFactory.h:104
TList fSigBkgPdfNames
List of channels names to combine for the signal plus background pdfs.
Definition: HLFactory.h:113
TList fLabelsNames
List of channels names to combine for the datasets.
Definition: HLFactory.h:122
RooWorkspace * GetWs()
Get the RooWorkspace containing the models and variables.
Definition: HLFactory.h:84
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
int fParseLine(TString &line)
Parse a single line an puts the content in the RooWorkSpace.
Definition: HLFactory.cxx:563
RooAbsPdf * GetTotSigBkgPdf()
Get the combined signal plus background pdf.
Definition: HLFactory.cxx:180
char name[80]
Definition: TGX11.cxx:109
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:42
int fReadFile(const char *fileName, bool is_included=false)
Read the actual cfg file.