Logo ROOT  
Reference Guide
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
14#include <vector>
15#include <string>
16#include <map>
17#include <iostream>
18#include <sstream>
19#include <memory>
20
21#include <RooPlot.h>
22#include <RooArgSet.h>
23#include <RooFitResult.h>
24#include <RooAbsReal.h>
25#include <RooRealVar.h>
26#include <RooWorkspace.h>
27#include <TObject.h>
28#include <TH1.h>
29#include <TDirectory.h>
30
32class ParamHistFunc;
33class RooProduct;
34class RooHistFunc;
35
36namespace RooStats{
37 namespace HistFactory{
38
39 // Forward Declarations FTW
40 class Measurement;
41 class Channel;
42 class Sample;
43
45
46 public:
47
50 };
51
55
56 static void ConfigureWorkspaceForMeasurement( const std::string& ModelName,
57 RooWorkspace* ws_single,
58 Measurement& measurement );
59
60 RooWorkspace* MakeSingleChannelModel( Measurement& measurement, Channel& channel );
61 RooWorkspace* MakeCombinedModel(std::vector<std::string>, std::vector<std::unique_ptr<RooWorkspace>>&);
62
63 static RooWorkspace* MakeCombinedModel( Measurement& measurement );
65 std::string filename);
66
67 void SetFunctionsToPreprocess(std::vector<std::string> lines) { fPreprocessFunctions=lines; }
68
69 protected:
70
71 void AddConstraintTerms(RooWorkspace* proto, Measurement& measurement, std::string prefix, std::string interpName,
72 std::vector<OverallSys>& systList,
73 std::vector<std::string>& likelihoodTermNames,
74 std::vector<std::string>& totSystTermNames);
75
76 std::unique_ptr<RooProduct> CreateNormFactor(RooWorkspace* proto, std::string& channel,
77 std::string& sigmaEpsilon, Sample& sample, bool doRatio);
78
80 int lowBin, int highBin,
81 std::vector<std::string>& likelihoodTermNames);
82
83 void AddPoissonTerms(RooWorkspace* proto, std::string prefix, std::string obsPrefix,
84 std::string expPrefix, int lowBin, int highBin,
85 std::vector<std::string>& likelihoodTermNames);
86
87 static void EditSyst(RooWorkspace* proto, const char* pdfNameChar,
88 std::map<std::string,double> gammaSyst,
89 std::map<std::string,double> uniformSyst,
90 std::map<std::string,double> logNormSyst,
91 std::map<std::string,double> noSyst);
92
94
95 void MakeTotalExpected(RooWorkspace* proto, const std::string& totName,
96 const std::vector<RooProduct*>& sampleScaleFactors,
97 std::vector<std::vector<RooAbsArg*>>& sampleHistFuncs) const;
98
100 std::vector<std::unique_ptr<RooWorkspace>>& wspace_vec,
101 std::vector<std::string> const& channel_names,
102 std::string const& dataSetName,
103 RooArgList obsList,
104 RooCategory* channelCat);
105
106 RooHistFunc* MakeExpectedHistFunc(const TH1* hist, RooWorkspace* proto, std::string prefix,
107 const RooArgList& observables) const;
108
109 std::unique_ptr<TH1> MakeScaledUncertaintyHist(const std::string& Name,
110 std::vector< std::pair<const TH1*, const TH1*> > HistVec ) const;
111
112 TH1* MakeAbsolUncertaintyHist( const std::string& Name, const TH1* Hist );
113
115 std::vector<std::string>& constraintTerms,
116 ParamHistFunc& paramHist, const TH1* uncertHist,
117 Constraint::Type type, double minSigma );
118
119 void ConfigureHistFactoryDataset(RooDataSet& obsData, TH1 const& nominal, RooWorkspace& proto,
120 std::vector<std::string> const& obsNameVec);
121
122 std::vector<std::string> fSystToFix;
123 std::map<std::string, double> fParamValues;
124 double fNomLumi = 1.0;
125 double fLumiError = 0.0;
126 int fLowBin = 0;
127 int fHighBin = 0;
128
129 private:
130
131 void GuessObsNameVec(const TH1* hist);
132
133 std::vector<std::string> fObsNameVec;
134 std::string fObsName;
135 std::vector<std::string> fPreprocessFunctions;
137
139
141 };
142
143 }
144}
145
146#endif
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
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
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 Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
const char * proto
Definition: civetweb.c:17493
A class which maps the current values of a RooRealVar (or a set of RooRealVars) to one of a number of...
Definition: ParamHistFunc.h:24
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:57
RooCategory is an object to represent discrete states.
Definition: RooCategory.h:28
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:55
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Definition: RooFitResult.h:40
RooHistFunc implements a real-valued function sampled from a multidimensional histogram.
Definition: RooHistFunc.h:30
A RooProduct 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)
static void EditSyst(RooWorkspace *proto, const char *pdfNameChar, std::map< std::string, double > gammaSyst, std::map< std::string, double > uniformSyst, std::map< std::string, double > logNormSyst, std::map< std::string, double > noSyst)
RooWorkspace * MakeSingleChannelModel(Measurement &measurement, Channel &channel)
RooWorkspace * MakeSingleChannelWorkspace(Measurement &measurement, Channel &channel)
RooArgList createStatConstraintTerms(RooWorkspace *proto, std::vector< std::string > &constraintTerms, ParamHistFunc &paramHist, const TH1 *uncertHist, Constraint::Type type, double minSigma)
void SetFunctionsToPreprocess(std::vector< std::string > lines)
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.
TH1 * MakeAbsolUncertaintyHist(const std::string &Name, const TH1 *Hist)
static void ConfigureWorkspaceForMeasurement(const std::string &ModelName, RooWorkspace *ws_single, Measurement &measurement)
void MakeTotalExpected(RooWorkspace *proto, const std::string &totName, const std::vector< RooProduct * > &sampleScaleFactors, std::vector< std::vector< RooAbsArg * > > &sampleHistFuncs) const
void AddPoissonTerms(RooWorkspace *proto, std::string prefix, std::string obsPrefix, std::string expPrefix, int lowBin, int highBin, std::vector< std::string > &likelihoodTermNames)
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)
RooDataSet * MergeDataSets(RooWorkspace *combined, std::vector< std::unique_ptr< RooWorkspace > > &wspace_vec, std::vector< std::string > const &channel_names, std::string const &dataSetName, RooArgList obsList, RooCategory *channelCat)
std::unique_ptr< TH1 > MakeScaledUncertaintyHist(const std::string &Name, std::vector< std::pair< const TH1 *, const TH1 * > > HistVec) const
void AddMultiVarGaussConstraint(RooWorkspace *proto, std::string prefix, int lowBin, int highBin, std::vector< std::string > &likelihoodTermNames)
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)
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...
RooWorkspace * MakeCombinedModel(std::vector< std::string >, std::vector< std::unique_ptr< RooWorkspace > > &)
The RooStats::HistFactory::Measurement class can be used to construct a model by combining multiple R...
Definition: Measurement.h:30
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
Mother of all ROOT objects.
Definition: TObject.h:37
@ HistFactory
Definition: RooGlobalFunc.h:65
Namespace for the RooStats classes.
Definition: Asimov.h:19
const char * Name
Definition: TXMLSetup.cxx:67