Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
Measurement.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_MEASUREMENT_H
12#define HISTFACTORY_MEASUREMENT_H
13
14#include <string>
15#include <map>
16#include <fstream>
17#include <iostream>
18#include <vector>
19
20#include "TNamed.h"
21
22#include "PreprocessFunction.h"
25
26#include <ROOT/RConfig.hxx> // for the R__DEPRECATED macro
27
28class TFile;
29
30namespace RooStats{
31namespace HistFactory {
32
33class Measurement : public TNamed {
34
35public:
36
38 /// Measurement( const Measurement& other ); // Copy
39 Measurement(const char* Name, const char* Title="");
40
41 /// set output prefix
42 void SetOutputFilePrefix( const std::string& prefix ) { fOutputFilePrefix = prefix; }
43 /// retrieve prefix for output files
44 std::string GetOutputFilePrefix() { return fOutputFilePrefix; }
45
46 /// insert PoI at beginning of vector of PoIs
47 void SetPOI( const std::string& POI ) { fPOI.insert( fPOI.begin(), POI ); }
48 /// append parameter to vector of PoIs
49 void AddPOI( const std::string& POI ) { fPOI.push_back(POI); }
50 /// get name of PoI at given index
51 std::string GetPOI(unsigned int i=0) { return fPOI.at(i); }
52 /// get vector of PoI names
53 std::vector<std::string>& GetPOIList() { return fPOI; }
54
55
56 /// Add a parameter to be set as constant
57 /// (Similar to ParamSetting method below)
58 void AddConstantParam( const std::string& param );
59 /// empty vector of constant parameters
60 void ClearConstantParams() { fConstantParams.clear(); }
61 /// get vector of all constant parameters
62 std::vector< std::string >& GetConstantParams() { return fConstantParams; }
63
64 /// Set a parameter to a specific value
65 /// (And optionally fix it)
66 void SetParamValue( const std::string& param, double value);
67 /// get map: parameter name <--> parameter value
68 std::map<std::string, double>& GetParamValues() { return fParamValues; }
69 /// clear map of parameter values
70 void ClearParamValues() { fParamValues.clear(); }
71
72 void AddPreprocessFunction( std::string name, std::string expression, std::string dependencies );
73 /// add a preprocess function object
74 void AddFunctionObject( const RooStats::HistFactory::PreprocessFunction function) { fFunctionObjects.push_back( function ); }
75 void SetFunctionObjects( std::vector< RooStats::HistFactory::PreprocessFunction > objects ) { fFunctionObjects = objects; }
76 /// get vector of defined function objects
77 std::vector< RooStats::HistFactory::PreprocessFunction >& GetFunctionObjects() { return fFunctionObjects; }
78 const std::vector< RooStats::HistFactory::PreprocessFunction >& GetFunctionObjects() const { return fFunctionObjects; }
79 std::vector< std::string > GetPreprocessFunctions() const;
80
81 /// get vector of defined Asimov Datasets
82 std::vector< RooStats::HistFactory::Asimov >& GetAsimovDatasets() { return fAsimovDatasets; }
83 /// add an Asimov Dataset
84 void AddAsimovDataset( RooStats::HistFactory::Asimov dataset ) { fAsimovDatasets.push_back(dataset); }
85
86 /// set integrated luminosity used to normalise histograms (if NormalizeByTheory is true for this sample)
87 void SetLumi(double Lumi ) { fLumi = Lumi; }
88 /// set relative uncertainty on luminosity
89 void SetLumiRelErr( double RelErr ) { fLumiRelErr = RelErr; }
90 /// retrieve integrated luminosity
91 double GetLumi() { return fLumi; }
92 /// retrieve relative uncertainty on luminosity
93 double GetLumiRelErr() { return fLumiRelErr; }
94
95 void SetBinLow( int BinLow ) { fBinLow = BinLow; }
96 void SetBinHigh ( int BinHigh ) { fBinHigh = BinHigh; }
97 int GetBinLow() { return fBinLow; }
98 int GetBinHigh() { return fBinHigh; }
99
100 /// Do not produce any plots or tables, just save the model.
101 ///
102 /// \deprecated Will be removed in ROOT 6.36. ExportOnly() == true is the default since ROOT 6.34 and it can't be disabled anymore in 6.36.
103 void SetExportOnly( bool ExportOnly )
104#ifndef ROOFIT_BUILDS_ITSELF
105 R__DEPRECATED(6,36, "ExportOnly() == true is the default since ROOT 6.34 and it can't be disabled anymore in 6.36.")
106#endif
107 { fExportOnly = ExportOnly; }
108
109 /// \deprecated Will be removed in ROOT 6.36. ExportOnly() == true is the default since ROOT 6.34 and it can't be disabled anymore in 6.36.
110 bool GetExportOnly()
111#ifndef ROOFIT_BUILDS_ITSELF
112 R__DEPRECATED(6,36, "ExportOnly() == true is the default since ROOT 6.34 and it can't be disabled anymore in 6.36.")
113#endif
114 { return fExportOnly; }
115
116 void PrintTree( std::ostream& = std::cout ); /// Print to a stream
117 void PrintXML( std::string Directory="", std::string NewOutputPrefix="" );
118
119 std::vector< RooStats::HistFactory::Channel >& GetChannels() { return fChannels; }
120 const std::vector< RooStats::HistFactory::Channel >& GetChannels() const { return fChannels; }
121 RooStats::HistFactory::Channel& GetChannel( std::string );
122 /// add a completely configured channel
123 void AddChannel( RooStats::HistFactory::Channel chan ) { fChannels.push_back( chan ); }
124
125 bool HasChannel( std::string );
126 void writeToFile( TFile* file );
127
128 void CollectHistograms();
129
130
131 void AddGammaSyst(std::string syst, double uncert);
132 void AddLogNormSyst(std::string syst, double uncert);
133 void AddUniformSyst(std::string syst);
134 void AddNoSyst(std::string syst);
135
136 std::map< std::string, double >& GetGammaSyst() { return fGammaSyst; }
137 std::map< std::string, double >& GetUniformSyst() { return fUniformSyst; }
138 std::map< std::string, double >& GetLogNormSyst() { return fLogNormSyst; }
139 std::map< std::string, double >& GetNoSyst() { return fNoSyst; }
140
141 std::map< std::string, double > const& GetGammaSyst() const { return fGammaSyst; }
142 std::map< std::string, double > const& GetUniformSyst() const { return fUniformSyst; }
143 std::map< std::string, double > const& GetLogNormSyst() const { return fLogNormSyst; }
144 std::map< std::string, double > const& GetNoSyst() const { return fNoSyst; }
145
146 std::string GetInterpolationScheme() { return fInterpolationScheme; }
147
148private:
149
150 /// Configurables of this measurement
151 std::string fOutputFilePrefix;
152 std::vector<std::string> fPOI;
153 double fLumi;
154 double fLumiRelErr;
155 int fBinLow;
156 int fBinHigh;
157 bool fExportOnly = true;
158 std::string fInterpolationScheme;
159
160 /// Channels that make up this measurement
161 std::vector< RooStats::HistFactory::Channel > fChannels;
162
163 /// List of Parameters to be set constant
164 std::vector< std::string > fConstantParams;
165
166 /// Map of parameter names to initial values to be set
167 std::map< std::string, double > fParamValues;
168
169 /// List of Preprocess Function objects
170 std::vector< RooStats::HistFactory::PreprocessFunction > fFunctionObjects;
171
172 /// List of Asimov datasets to generate
173 std::vector< RooStats::HistFactory::Asimov > fAsimovDatasets;
174
175 /// List of Alternate constraint terms
176 std::map< std::string, double > fGammaSyst;
177 std::map< std::string, double > fUniformSyst;
178 std::map< std::string, double > fLogNormSyst;
179 std::map< std::string, double > fNoSyst;
180
181 std::string GetDirPath( TDirectory* dir );
182
184
185};
186
187} // namespace HistFactory
188} // namespace RooStats
189
190#endif
#define R__DEPRECATED(MAJOR, MINOR, REASON)
Definition RConfig.hxx:504
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition TGX11.cxx:110
TODO Here, we are missing some documentation.
Definition Asimov.h:22
This class encapsulates all information for the statistical interpretation of one experiment.
Definition Channel.h:30
The RooStats::HistFactory::Measurement class can be used to construct a model by combining multiple R...
Definition Measurement.h:33
void ClearParamValues()
clear map of parameter values
Definition Measurement.h:70
std::map< std::string, double > & GetParamValues()
get map: parameter name <--> parameter value
Definition Measurement.h:68
const std::vector< RooStats::HistFactory::PreprocessFunction > & GetFunctionObjects() const
Definition Measurement.h:78
void AddPOI(const std::string &POI)
append parameter to vector of PoIs
Definition Measurement.h:49
std::vector< std::string > & GetPOIList()
get vector of PoI names
Definition Measurement.h:53
void SetLumi(double Lumi)
set integrated luminosity used to normalise histograms (if NormalizeByTheory is true for this sample)
Definition Measurement.h:87
void SetParamValue(const std::string &param, double value)
Set a parameter to a specific value (And optionally fix it)
double GetLumiRelErr()
retrieve relative uncertainty on luminosity
Definition Measurement.h:93
void SetExportOnly(bool ExportOnly) R__DEPRECATED(6
Do not produce any plots or tables, just save the model.
std::vector< std::string > & GetConstantParams()
get vector of all constant parameters
Definition Measurement.h:62
void SetOutputFilePrefix(const std::string &prefix)
set output prefix
Definition Measurement.h:42
std::vector< RooStats::HistFactory::Asimov > & GetAsimovDatasets()
get vector of defined Asimov Datasets
Definition Measurement.h:82
Measurement()
Standard constructor.
void SetPOI(const std::string &POI)
insert PoI at beginning of vector of PoIs
Definition Measurement.h:47
std::string GetOutputFilePrefix()
retrieve prefix for output files
Definition Measurement.h:44
void AddConstantParam(const std::string &param)
Add a parameter to be set as constant (Similar to ParamSetting method below)
void AddFunctionObject(const RooStats::HistFactory::PreprocessFunction function)
add a preprocess function object
Definition Measurement.h:74
void ClearConstantParams()
empty vector of constant parameters
Definition Measurement.h:60
std::vector< RooStats::HistFactory::PreprocessFunction > & GetFunctionObjects()
get vector of defined function objects
Definition Measurement.h:77
void SetFunctionObjects(std::vector< RooStats::HistFactory::PreprocessFunction > objects)
Definition Measurement.h:75
void AddPreprocessFunction(std::string name, std::string expression, std::string dependencies)
Add a preprocessed function by giving the function a name, a functional expression,...
std::vector< std::string > GetPreprocessFunctions() const
Returns a list of defined preprocess function expressions.
void SetLumiRelErr(double RelErr)
set relative uncertainty on luminosity
Definition Measurement.h:89
double GetLumi()
retrieve integrated luminosity
Definition Measurement.h:91
void AddAsimovDataset(RooStats::HistFactory::Asimov dataset)
add an Asimov Dataset
Definition Measurement.h:84
std::string GetPOI(unsigned int i=0)
get name of PoI at given index
Definition Measurement.h:51
Describe directory structure in memory.
Definition TDirectory.h:45
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:53
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Namespace for the RooStats classes.
Definition Asimov.h:19