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
81 void MakeTotalExpected(RooWorkspace* proto, const std::string& totName,
82 const std::vector<RooProduct*>& sampleScaleFactors,
83 std::vector<std::vector<RooAbsArg*>>& sampleHistFuncs) const;
84
86 std::vector<std::unique_ptr<RooWorkspace>>& wspace_vec,
87 std::vector<std::string> const& channel_names,
88 std::string const& dataSetName,
89 RooArgList const& obsList,
90 RooCategory* channelCat);
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>& constraintTerms,
102 ParamHistFunc& paramHist, const TH1* uncertHist,
103 Constraint::Type type, double minSigma );
104
105 void ConfigureHistFactoryDataset(RooDataSet& obsData, TH1 const& nominal, RooWorkspace& proto,
106 std::vector<std::string> const& obsNameVec);
107
108 std::vector<std::string> fSystToFix;
109 std::map<std::string, double> fParamValues;
110 double fNomLumi = 1.0;
111 double fLumiError = 0.0;
112 int fLowBin = 0;
113 int fHighBin = 0;
114
115 private:
116
117 void GuessObsNameVec(const TH1* hist);
118
119 std::vector<std::string> fObsNameVec;
120 std::string fObsName;
121 std::vector<std::string> fPreprocessFunctions;
123
125
127 };
128
129 }
130}
131
132#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:17502
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:56
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:31
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)
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)
std::unique_ptr< TH1 > MakeScaledUncertaintyHist(const std::string &Name, std::vector< std::pair< const TH1 *, std::unique_ptr< TH1 > > > const &HistVec) const
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)
RooDataSet * MergeDataSets(RooWorkspace *combined, std::vector< std::unique_ptr< RooWorkspace > > &wspace_vec, std::vector< std::string > const &channel_names, std::string const &dataSetName, RooArgList const &obsList, RooCategory *channelCat)
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 ConfigureHistFactoryDataset(RooDataSet &obsData, TH1 const &nominal, RooWorkspace &proto, std::vector< std::string > const &obsNameVec)
static void PrintCovarianceMatrix(RooFitResult *result, RooArgSet *params, std::string filename)
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:31
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:41
@ HistFactory
Definition: RooGlobalFunc.h:63
Namespace for the RooStats classes.
Definition: Asimov.h:19
const char * Name
Definition: TXMLSetup.cxx:67