Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
HistoToWorkspaceFactoryFast.h
Go to the documentation of this file.
1// @(#)root/roostats:$Id: cranmer $
2// Author: Kyle Cranmer, Akira Shibata
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_HISTOTOWORKSPACEFACTORYFAST
12#define ROOSTATS_HISTOTOWORKSPACEFACTORYFAST
13
15
16#include <RooArgSet.h>
17#include <RooDataSet.h>
18#include <RooFitResult.h>
19#include <RooPlot.h>
20#include <RooWorkspace.h>
21
22#include <TH1.h>
23#include <TObject.h>
24
25#include <vector>
26#include <string>
27#include <map>
28#include <memory>
29
30
31class ParamHistFunc;
32class RooProduct;
33class RooHistFunc;
34
35namespace RooStats {
36namespace HistFactory {
37
38// Forward Declarations FTW
39class Measurement;
40class Channel;
41class Sample;
42
44
45public:
46 /// \brief Configuration settings for HistFactory behavior.
48 /// \brief Enable or disable optimization for binned likelihood fits (default `true`).
50 /// \brief Control whether whether combined workspace is written to a ROOT file (default `true`).
52 /// \brief Control whether individual workspace files are created for each channel (default `true`).
54 /// \brief Control whether errors on the data histograms are stored in the workspace (default `false`).
55 bool storeDataError = false;
56 };
57
61
62 static void ConfigureWorkspaceForMeasurement( const std::string& ModelName,
65
67 RooFit::OwningPtr<RooWorkspace> MakeCombinedModel(std::vector<std::string>, std::vector<std::unique_ptr<RooWorkspace>>&);
68
69 static RooFit::OwningPtr<RooWorkspace> MakeCombinedModel( Measurement& measurement, const Configuration& config);
72 std::string filename);
73
74 void SetFunctionsToPreprocess(std::vector<std::string> lines) { fPreprocessFunctions=lines; }
75
76 protected:
77
78 void AddConstraintTerms(RooWorkspace& proto, Measurement& measurement, std::string prefix, std::string interpName,
79 std::vector<OverallSys>& systList,
80 std::vector<std::string>& likelihoodTermNames,
81 std::vector<std::string>& totSystTermNames);
82
83 std::unique_ptr<RooProduct> CreateNormFactor(RooWorkspace& proto, std::string& channel,
84 std::string& sigmaEpsilon, Sample& sample, bool doRatio);
85
86 std::unique_ptr<RooWorkspace> MakeSingleChannelWorkspace(Measurement& measurement, Channel& channel);
87
88 void MakeTotalExpected(RooWorkspace& proto, const std::string& totName,
89 const std::vector<RooProduct*>& sampleScaleFactors,
90 std::vector<std::vector<RooAbsArg*>>& sampleHistFuncs) const;
91
92 RooHistFunc* MakeExpectedHistFunc(const TH1* hist, RooWorkspace& proto, std::string prefix,
93 const RooArgList& observables) const;
94
95 std::unique_ptr<TH1> MakeScaledUncertaintyHist(const std::string& Name,
96 std::vector< std::pair<const TH1*, std::unique_ptr<TH1>> > const& HistVec ) const;
97
98 TH1* MakeAbsolUncertaintyHist( const std::string& Name, const TH1* Hist );
99
101 std::vector<std::string> const& obsNameVec);
102
103 std::vector<std::string> fSystToFix;
104 std::map<std::string, double> fParamValues;
105 double fNomLumi = 1.0;
106 double fLumiError = 0.0;
107 int fLowBin = 0;
108 int fHighBin = 0;
109
110 private:
111
112 void GuessObsNameVec(const TH1* hist);
113
114 std::vector<std::string> fObsNameVec;
115 std::string fObsName;
116 std::vector<std::string> fPreprocessFunctions;
118
120
122 };
123
124 }
125}
126
127#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
const char * proto
Definition civetweb.c:18822
A class which maps the current values of a RooRealVar (or a set of RooRealVars) to one of a number of...
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Container class to hold unbinned data.
Definition RooDataSet.h:32
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
A real-valued function sampled from a multidimensional histogram.
Definition RooHistFunc.h:31
Represents the product of a given set of RooAbsReal objects.
Definition RooProduct.h:29
This class encapsulates all information for the statistical interpretation of one experiment.
Definition Channel.h:30
This class provides helper functions for creating likelihood models from histograms.
std::unique_ptr< RooProduct > CreateNormFactor(RooWorkspace &proto, std::string &channel, std::string &sigmaEpsilon, Sample &sample, bool doRatio)
std::unique_ptr< RooWorkspace > MakeSingleChannelWorkspace(Measurement &measurement, Channel &channel)
void MakeTotalExpected(RooWorkspace &proto, const std::string &totName, const std::vector< RooProduct * > &sampleScaleFactors, std::vector< std::vector< RooAbsArg * > > &sampleHistFuncs) const
std::unique_ptr< TH1 > MakeScaledUncertaintyHist(const std::string &Name, std::vector< std::pair< const TH1 *, std::unique_ptr< TH1 > > > const &HistVec) const
RooHistFunc * MakeExpectedHistFunc(const TH1 *hist, RooWorkspace &proto, std::string prefix, const RooArgList &observables) const
Create the nominal hist function from hist, and register it in the workspace.
void SetFunctionsToPreprocess(std::vector< std::string > lines)
RooFit::OwningPtr< RooWorkspace > MakeSingleChannelModel(Measurement &measurement, Channel &channel)
RooFit::OwningPtr< RooWorkspace > MakeCombinedModel(std::vector< std::string >, std::vector< std::unique_ptr< RooWorkspace > > &)
TH1 * MakeAbsolUncertaintyHist(const std::string &Name, const TH1 *Hist)
static void ConfigureWorkspaceForMeasurement(const std::string &ModelName, RooWorkspace *ws_single, Measurement &measurement)
void AddConstraintTerms(RooWorkspace &proto, Measurement &measurement, std::string prefix, std::string interpName, std::vector< OverallSys > &systList, std::vector< std::string > &likelihoodTermNames, std::vector< std::string > &totSystTermNames)
void ConfigureHistFactoryDataset(RooDataSet &obsData, TH1 const &nominal, RooWorkspace &proto, std::vector< std::string > const &obsNameVec)
static void PrintCovarianceMatrix(RooFitResult *result, RooArgSet *params, std::string filename)
RooArgList createObservables(const TH1 *hist, RooWorkspace &proto) const
Create observables of type RooRealVar. Creates 1 to 3 observables, depending on the type of the histo...
The RooStats::HistFactory::Measurement class can be used to construct a model by combining multiple R...
Definition Measurement.h:31
Persistable container for RooFit projects.
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:108
Mother of all ROOT objects.
Definition TObject.h:41
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...
Definition Config.h:35
Namespace for the RooStats classes.
Definition CodegenImpl.h:61
bool createPerRegionWorkspaces
Control whether individual workspace files are created for each channel (default true).
bool binnedFitOptimization
Enable or disable optimization for binned likelihood fits (default true).
bool createWorkspaceFile
Control whether whether combined workspace is written to a ROOT file (default true).
bool storeDataError
Control whether errors on the data histograms are stored in the workspace (default false).