Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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  class HLFactory : public TNamed {
32 
33  public:
34 
35  /// Constructor
36  HLFactory(const char *name,
37  const char *fileName=0,
38  bool isVerbose = false);
39 
40  /// Constructor with external RooWorkspace
41  HLFactory(const char* name,
42  RooWorkspace* externalWs,
43  bool isVerbose = false);
44 
45  /// Default Constructor
46  HLFactory();
47 
48  /// Default Destructor
49  ~HLFactory();
50 
51  /// Add channel for the combination
52  int AddChannel(const char* label,
53  const char* SigBkgPdfName,
54  const char* BkgPdfName=0,
55  const char* datasetName=0);
56 
57  /// Dump the Workspace content as configuration file
58  /* It needs some workspace object list or something..*/
59  void DumpCfg(const char* /*cardname*/ ){ /* t.b.i. */ }; // Dump the factory content as configuration file
60 
61  /// Get the combined signal plus background pdf
62  RooAbsPdf* GetTotSigBkgPdf(); // Get the Signal and Background combined model
63 
64  /// Get the combined background pdf
65  RooAbsPdf* GetTotBkgPdf(); // Get the Background combined model
66 
67  /// Get the combined dataset
68  RooDataSet* GetTotDataSet(); // Get the combined dataset
69 
70  /// Get the combined dataset
71  RooCategory* GetTotCategory(); // Get the category
72 
73  /// Get the RooWorkspace containing the models and variables
74  RooWorkspace* GetWs(){return fWs;}; // Expose the internal Workspace
75 
76  /// Process a configuration file
77  int ProcessCard(const char* filename);
78 
79  private:
80 
81  /// The category of the combination
82  RooCategory* fComboCat;
83 
84  /// The background model combination
85  RooAbsPdf* fComboBkgPdf;
86 
87  /// The signal plus background model combination
88  RooAbsPdf* fComboSigBkgPdf;
89 
90  /// The datasets combination
91  RooDataSet* fComboDataset;
92 
93  /// Flag to keep trace of the status of the combination
94  bool fCombinationDone;
95 
96  /// Create the category for the combinations
97  void fCreateCategory();
98 
99  /// Check the length of the lists
100  bool fNamesListsConsistent();
101 
102  /// List of channels names to combine for the signal plus background pdfs
103  TList fSigBkgPdfNames;
104 
105  /// List of channels names to combine for the background pdfs
106  TList fBkgPdfNames;
107 
108  /// List of channels names to combine for the datasets
109  TList fDatasetsNames;
110 
111  /// List of channels names to combine for the datasets
112  TList fLabelsNames;
113 
114  /// The verbosity flag
115  bool fVerbose;
116 
117  /// Keep trace of the inclusion deepness
118  int fInclusionLevel;
119 
120  /// The RooWorkspace containing the models and variables
121  RooWorkspace* fWs;
122 
123  /// Owns workspace
124  bool fOwnWs;
125 
126  /// Read the actual cfg file
127  int fReadFile(const char*fileName, bool is_included = false);
128 
129  /// Parse a single line an puts the content in the RooWorkSpace
130  int fParseLine(TString& line);
131 
132 
133  ClassDef(HLFactory,1) // The high Level Model Factory to create models from datacards
134 
135  };
136 }
137 
138 #endif