Logo ROOT   6.16/01
Reference Guide
Systematics.h
Go to the documentation of this file.
1// @(#)root/roostats:$Id$
2// Author: George Lewis, Kyle Cranmer
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 HISTFACTORY_SYSTEMATICS_H
12#define HISTFACTORY_SYSTEMATICS_H
13
14#include <string>
15#include <fstream>
16#include <iostream>
17
18#include "TH1.h"
20
21namespace RooStats{
22namespace HistFactory {
23
24 namespace Constraint {
26 std::string Name( Type type );
27 Type GetType( const std::string& Name );
28 }
29
30
31 // Base class for common functions
32 /*
33 class Systematic {
34
35 public:
36
37 virtual void Print(std::ostream& = std::cout);
38 virtual void writeToFile(const std::string& FileName,
39 const std::string& Directory);
40
41
42 };
43 */
44
45/** \class OverallSys
46 * \ingroup HistFactory
47 * Configuration for a constrained overall systematic to scale sample normalisations.
48 */
49 class OverallSys {
50
51 public:
52
53 OverallSys() : fLow(0), fHigh(0) {}
54
55 void SetName( const std::string& Name ) { fName = Name; }
56 std::string GetName() { return fName; }
57
58 void SetLow( double Low ) { fLow = Low; }
59 void SetHigh( double High ) { fHigh = High; }
60 double GetLow() { return fLow; }
61 double GetHigh() { return fHigh; }
62
63 void Print(std::ostream& = std::cout);
64 void PrintXML(std::ostream&);
65
66 protected:
67 std::string fName;
68 double fLow;
69 double fHigh;
70
71 };
72
73/** \class NormFactor
74 * \ingroup HistFactory
75 * Configuration for an \a un- constrained overall systematic to scale sample normalisations.
76 */
77 class NormFactor {
78
79 public:
80
81 NormFactor();
82
83 void SetName( const std::string& Name ) { fName = Name; }
84 std::string GetName() { return fName; }
85
86 void SetVal( double Val ) { fVal = Val; }
87 double GetVal() { return fVal; }
88
89 void SetConst( bool Const=true ) { fConst = Const; }
90 bool GetConst() { return fConst; }
91
92 void SetLow( double Low ) { fLow = Low; }
93 void SetHigh( double High ) { fHigh = High; }
94 double GetLow() { return fLow; }
95 double GetHigh() { return fHigh; }
96
97 void Print(std::ostream& = std::cout);
98 void PrintXML(std::ostream&);
99
100 protected:
101
102 std::string fName;
103 double fVal;
104 double fLow;
105 double fHigh;
106 bool fConst;
107
108 };
109
110/** \class HistoSys
111 * \ingroup HistFactory
112 * Configuration for a constrained, coherent shape variation of affected samples.
113 */
114 class HistoSys {
115
116 public:
117
118 HistoSys() : fhLow(NULL), fhHigh(NULL) {;}
119 HistoSys(const std::string& Name) : fName(Name), fhLow(NULL), fhHigh(NULL) {;}
120
121 void Print(std::ostream& = std::cout);
122 void PrintXML(std::ostream&);
123 void writeToFile( const std::string& FileName, const std::string& DirName );
124
125 void SetHistoLow( TH1* Low ) { fhLow = Low; }
126 void SetHistoHigh( TH1* High ) { fhHigh = High; }
127
128 TH1* GetHistoLow();
129 TH1* GetHistoHigh();
130
131 void SetName( const std::string& Name ) { fName = Name; }
132 std::string GetName() { return fName; }
133
134 void SetInputFileLow( const std::string& InputFileLow ) { fInputFileLow = InputFileLow; }
135 void SetInputFileHigh( const std::string& InputFileHigh ) { fInputFileHigh = InputFileHigh; }
136
137 std::string GetInputFileLow() { return fInputFileLow; }
138 std::string GetInputFileHigh() { return fInputFileHigh; }
139
140 void SetHistoNameLow( const std::string& HistoNameLow ) { fHistoNameLow = HistoNameLow; }
141 void SetHistoNameHigh( const std::string& HistoNameHigh ) { fHistoNameHigh = HistoNameHigh; }
142
143 std::string GetHistoNameLow() { return fHistoNameLow; }
144 std::string GetHistoNameHigh() { return fHistoNameHigh; }
145
146 void SetHistoPathLow( const std::string& HistoPathLow ) { fHistoPathLow = HistoPathLow; }
147 void SetHistoPathHigh( const std::string& HistoPathHigh ) { fHistoPathHigh = HistoPathHigh; }
148
149 std::string GetHistoPathLow() { return fHistoPathLow; }
150 std::string GetHistoPathHigh() { return fHistoPathHigh; }
151
152 protected:
153
154 std::string fName;
155
156 std::string fInputFileLow;
157 std::string fHistoNameLow;
158 std::string fHistoPathLow;
159
160 std::string fInputFileHigh;
161 std::string fHistoNameHigh;
162 std::string fHistoPathHigh;
163
164 // The Low and High Histograms
167
168 };
169
170/** \class HistoFactor
171 * \ingroup HistFactory
172 * Configuration for an \a unconstrained, coherent shape variation of affected samples.
173 */
175
176 public:
177
178 HistoFactor() : fhLow(NULL), fhHigh(NULL) {;}
179
180 void SetName( const std::string& Name ) { fName = Name; }
181 std::string GetName() { return fName; }
182
183 void SetInputFileLow( const std::string& InputFileLow ) { fInputFileLow = InputFileLow; }
184 void SetInputFileHigh( const std::string& InputFileHigh ) { fInputFileHigh = InputFileHigh; }
185
186 std::string GetInputFileLow() { return fInputFileLow; }
187 std::string GetInputFileHigh() { return fInputFileHigh; }
188
189 void SetHistoNameLow( const std::string& HistoNameLow ) { fHistoNameLow = HistoNameLow; }
190 void SetHistoNameHigh( const std::string& HistoNameHigh ) { fHistoNameHigh = HistoNameHigh; }
191
192 std::string GetHistoNameLow() { return fHistoNameLow; }
193 std::string GetHistoNameHigh() { return fHistoNameHigh; }
194
195 void SetHistoPathLow( const std::string& HistoPathLow ) { fHistoPathLow = HistoPathLow; }
196 void SetHistoPathHigh( const std::string& HistoPathHigh ) { fHistoPathHigh = HistoPathHigh; }
197
198 std::string GetHistoPathLow() { return fHistoPathLow; }
199 std::string GetHistoPathHigh() { return fHistoPathHigh; }
200
201 void Print(std::ostream& = std::cout);
202 void writeToFile( const std::string& FileName, const std::string& DirName );
203 void PrintXML(std::ostream&);
204
205 TH1* GetHistoLow();
206 TH1* GetHistoHigh();
207 void SetHistoLow( TH1* Low ) { fhLow = Low; }
208 void SetHistoHigh( TH1* High ) { fhHigh = High; }
209
210 protected:
211
212 std::string fName;
213
214 std::string fInputFileLow;
215 std::string fHistoNameLow;
216 std::string fHistoPathLow;
217
218 std::string fInputFileHigh;
219 std::string fHistoNameHigh;
220 std::string fHistoPathHigh;
221
222 // The Low and High Histograms
225
226 };
227
228/** \class ShapeSys
229 * \ingroup HistFactory
230 * Constrained bin-by-bin variation of affected histogram.
231 */
232 class ShapeSys {
233
234 public:
235
236 ShapeSys() : fConstraintType(Constraint::Gaussian), fhError(NULL) {}
237
238 void SetName( const std::string& Name ) { fName = Name; }
239 std::string GetName() { return fName; }
240
241 void SetInputFile( const std::string& InputFile ) { fInputFile = InputFile; }
242 std::string GetInputFile() { return fInputFile; }
243
244 void SetHistoName( const std::string& HistoName ) { fHistoName = HistoName; }
245 std::string GetHistoName() { return fHistoName; }
246
247 void SetHistoPath( const std::string& HistoPath ) { fHistoPath = HistoPath; }
248 std::string GetHistoPath() { return fHistoPath; }
249
250 void Print(std::ostream& = std::cout);
251 void PrintXML(std::ostream&);
252 void writeToFile( const std::string& FileName, const std::string& DirName );
253
254 TH1* GetErrorHist();
255 void SetErrorHist(TH1* hError) { fhError = hError; }
256
257 void SetConstraintType( Constraint::Type ConstrType ) { fConstraintType = ConstrType; }
259
260 protected:
261
262 std::string fName;
263 std::string fInputFile;
264 std::string fHistoName;
265 std::string fHistoPath;
267
268 // The histogram holding the error
270
271 };
272
273/** \class ShapeFactor
274 * \ingroup HistFactory
275 * \a Unconstrained bin-by-bin variation of affected histogram.
276 */
278
279 public:
280
281 ShapeFactor();
282
283 void SetName( const std::string& Name ) { fName = Name; }
284 std::string GetName() { return fName; }
285
286 void Print(std::ostream& = std::cout);
287 void PrintXML(std::ostream&);
288 void writeToFile( const std::string& FileName, const std::string& DirName);
289
290 void SetInitialShape(TH1* shape) { fhInitialShape = shape; }
292
293 void SetConstant(bool constant) { fConstant = constant; }
294 bool IsConstant() { return fConstant; }
295
297
298 void SetInputFile( const std::string& InputFile ) {
299 fInputFile = InputFile;
300 fHasInitialShape=true;
301 }
302 std::string GetInputFile() { return fInputFile; }
303
304 void SetHistoName( const std::string& HistoName ) {
305 fHistoName = HistoName;
306 fHasInitialShape=true;
307 }
308 std::string GetHistoName() { return fHistoName; }
309
310 void SetHistoPath( const std::string& HistoPath ) {
311 fHistoPath = HistoPath;
312 fHasInitialShape=true;
313 }
314 std::string GetHistoPath() { return fHistoPath; }
315
316 protected:
317 std::string fName;
318
320
321 // A histogram representing
322 // the initial shape
324 std::string fHistoName;
325 std::string fHistoPath;
326 std::string fInputFile;
328
329 };
330
331/** \class StatError
332 * \ingroup HistFactory
333 * Statistical error of Monte Carlo predictions.
334 */
335 class StatError {
336
337 public:
338
339 StatError() : fActivate(false), fUseHisto(false), fhError(NULL) {;}
340
341 void Print(std::ostream& = std::cout);
342 void PrintXML(std::ostream&);
343 void writeToFile( const std::string& FileName, const std::string& DirName );
344
345 void Activate( bool IsActive=true ) { fActivate = IsActive; }
346 bool GetActivate() { return fActivate; }
347
348 void SetUseHisto( bool UseHisto=true ) { fUseHisto = UseHisto; }
349 bool GetUseHisto() { return fUseHisto; }
350
351 void SetInputFile( const std::string& InputFile ) { fInputFile = InputFile; }
352 std::string GetInputFile() { return fInputFile; }
353
354 void SetHistoName( const std::string& HistoName ) { fHistoName = HistoName; }
355 std::string GetHistoName() { return fHistoName; }
356
357 void SetHistoPath( const std::string& HistoPath ) { fHistoPath = HistoPath; }
358 std::string GetHistoPath() { return fHistoPath; }
359
360
361 TH1* GetErrorHist();
363
364 protected:
365
367 bool fUseHisto; // Use an external histogram for the errors
368 std::string fInputFile;
369 std::string fHistoName;
370 std::string fHistoPath;
371
372 // The histogram holding the error
374
375 };
376
377/** \class StatErrorConfig
378 * \ingroup HistFactory
379 * Configuration to automatically assign nuisance parameters for the statistical
380 * error of the Monte Carlo simulations.
381 */
383
384 public:
385
387 void Print(std::ostream& = std::cout);
388 void PrintXML(std::ostream&);
389
390 void SetRelErrorThreshold( double Threshold ) { fRelErrorThreshold = Threshold; }
392
393 void SetConstraintType( Constraint::Type ConstrType ) { fConstraintType = ConstrType; }
395
396 protected:
397
400
401 };
402
403
404}
405}
406
407#endif
void Error(const char *location, const char *msgfmt,...)
int type
Definition: TGX11.cxx:120
Internal class wrapping an histogram and managing its content.
Definition: HistRef.h:24
Configuration for an unconstrained, coherent shape variation of affected samples.
Definition: Systematics.h:174
void SetName(const std::string &Name)
Definition: Systematics.h:180
void SetHistoPathLow(const std::string &HistoPathLow)
Definition: Systematics.h:195
void SetHistoPathHigh(const std::string &HistoPathHigh)
Definition: Systematics.h:196
void writeToFile(const std::string &FileName, const std::string &DirName)
void SetHistoNameHigh(const std::string &HistoNameHigh)
Definition: Systematics.h:190
void Print(std::ostream &=std::cout)
void SetInputFileHigh(const std::string &InputFileHigh)
Definition: Systematics.h:184
void SetInputFileLow(const std::string &InputFileLow)
Definition: Systematics.h:183
void SetHistoNameLow(const std::string &HistoNameLow)
Definition: Systematics.h:189
Configuration for a constrained, coherent shape variation of affected samples.
Definition: Systematics.h:114
void writeToFile(const std::string &FileName, const std::string &DirName)
void SetHistoNameLow(const std::string &HistoNameLow)
Definition: Systematics.h:140
void PrintXML(std::ostream &)
void SetHistoPathHigh(const std::string &HistoPathHigh)
Definition: Systematics.h:147
void Print(std::ostream &=std::cout)
void SetName(const std::string &Name)
Definition: Systematics.h:131
HistoSys(const std::string &Name)
Definition: Systematics.h:119
void SetInputFileLow(const std::string &InputFileLow)
Definition: Systematics.h:134
void SetHistoPathLow(const std::string &HistoPathLow)
Definition: Systematics.h:146
void SetInputFileHigh(const std::string &InputFileHigh)
Definition: Systematics.h:135
void SetHistoNameHigh(const std::string &HistoNameHigh)
Definition: Systematics.h:141
Configuration for an un- constrained overall systematic to scale sample normalisations.
Definition: Systematics.h:77
void Print(std::ostream &=std::cout)
Definition: Systematics.cxx:61
void PrintXML(std::ostream &)
Definition: Systematics.cxx:70
void SetConst(bool Const=true)
Definition: Systematics.h:89
void SetName(const std::string &Name)
Definition: Systematics.h:83
Configuration for a constrained overall systematic to scale sample normalisations.
Definition: Systematics.h:49
void PrintXML(std::ostream &)
Definition: Systematics.cxx:87
void SetName(const std::string &Name)
Definition: Systematics.h:55
void Print(std::ostream &=std::cout)
Definition: Systematics.cxx:80
Unconstrained bin-by-bin variation of affected histogram.
Definition: Systematics.h:277
void writeToFile(const std::string &FileName, const std::string &DirName)
void SetName(const std::string &Name)
Definition: Systematics.h:283
void Print(std::ostream &=std::cout)
void SetInputFile(const std::string &InputFile)
Definition: Systematics.h:298
void SetHistoName(const std::string &HistoName)
Definition: Systematics.h:304
void SetConstant(bool constant)
Definition: Systematics.h:293
void SetHistoPath(const std::string &HistoPath)
Definition: Systematics.h:310
Constrained bin-by-bin variation of affected histogram.
Definition: Systematics.h:232
void SetName(const std::string &Name)
Definition: Systematics.h:238
void PrintXML(std::ostream &)
void Print(std::ostream &=std::cout)
Constraint::Type fConstraintType
Definition: Systematics.h:266
void SetInputFile(const std::string &InputFile)
Definition: Systematics.h:241
Constraint::Type GetConstraintType()
Definition: Systematics.h:258
void SetHistoName(const std::string &HistoName)
Definition: Systematics.h:244
void writeToFile(const std::string &FileName, const std::string &DirName)
void SetConstraintType(Constraint::Type ConstrType)
Definition: Systematics.h:257
void SetErrorHist(TH1 *hError)
Definition: Systematics.h:255
void SetHistoPath(const std::string &HistoPath)
Definition: Systematics.h:247
Configuration to automatically assign nuisance parameters for the statistical error of the Monte Carl...
Definition: Systematics.h:382
void SetConstraintType(Constraint::Type ConstrType)
Definition: Systematics.h:393
void Print(std::ostream &=std::cout)
void SetRelErrorThreshold(double Threshold)
Definition: Systematics.h:390
Statistical error of Monte Carlo predictions.
Definition: Systematics.h:335
void Activate(bool IsActive=true)
Definition: Systematics.h:345
void SetHistoPath(const std::string &HistoPath)
Definition: Systematics.h:357
void SetInputFile(const std::string &InputFile)
Definition: Systematics.h:351
void SetHistoName(const std::string &HistoName)
Definition: Systematics.h:354
void PrintXML(std::ostream &)
void SetUseHisto(bool UseHisto=true)
Definition: Systematics.h:348
void writeToFile(const std::string &FileName, const std::string &DirName)
void Print(std::ostream &=std::cout)
The TH1 histogram class.
Definition: TH1.h:56
Type GetType(const std::string &Name)
Definition: Systematics.cxx:34
std::string Name(Type type)
Definition: Systematics.cxx:27
@(#)root/roostats:$Id$ Author: George Lewis, Kyle Cranmer
Definition: Asimov.h:20