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
14#include <vector>
15#include <string>
16#include <map>
17#include <iostream>
18#include <sstream>
19
20#include <RooPlot.h>
21#include <RooArgSet.h>
22#include <RooFitResult.h>
23#include <RooAbsReal.h>
24#include <RooRealVar.h>
25#include <RooWorkspace.h>
26#include <TObject.h>
27#include <TH1.h>
28#include <TDirectory.h>
29
31class ParamHistFunc;
32
33
34namespace RooStats{
35 namespace HistFactory{
36
37 // Forward Declarations FTW
38 class Measurement;
39 class Channel;
40 class Sample;
41
43
44 public:
45
46
50
51 static void ConfigureWorkspaceForMeasurement( const std::string& ModelName,
52 RooWorkspace* ws_single,
53 Measurement& measurement );
54
55 RooWorkspace* MakeSingleChannelModel( Measurement& measurement, Channel& channel );
56 RooWorkspace* MakeCombinedModel(std::vector<std::string>, std::vector<RooWorkspace*>);
57
58 static RooWorkspace* MakeCombinedModel( Measurement& measurement );
59 static void PrintCovarianceMatrix(RooFitResult* result, RooArgSet* params,
60 std::string filename);
61
62 void SetFunctionsToPreprocess(std::vector<std::string> lines) { fPreprocessFunctions=lines; }
63
64 protected:
65
66 void AddConstraintTerms(RooWorkspace* proto, Measurement& measurement, std::string prefix, std::string interpName,
67 std::vector<OverallSys>& systList,
68 std::vector<std::string>& likelihoodTermNames,
69 std::vector<std::string>& totSystTermNames);
70
71 std::string AddNormFactor(RooWorkspace* proto, std::string& channel,
72 std::string& sigmaEpsilon, Sample& sample, bool doRatio);
73
74 void AddMultiVarGaussConstraint(RooWorkspace* proto, std::string prefix,
75 int lowBin, int highBin,
76 std::vector<std::string>& likelihoodTermNames);
77
78 void AddPoissonTerms(RooWorkspace* proto, std::string prefix, std::string obsPrefix,
79 std::string expPrefix, int lowBin, int highBin,
80 std::vector<std::string>& likelihoodTermNames);
81
82 static void EditSyst(RooWorkspace* proto, const char* pdfNameChar,
83 std::map<std::string,double> gammaSyst,
84 std::map<std::string,double> uniformSyst,
85 std::map<std::string,double> logNormSyst,
86 std::map<std::string,double> noSyst);
87
88 void LinInterpWithConstraint(RooWorkspace* proto, const TH1* nominal, std::vector<HistoSys>,
89 std::string prefix, std::string productPrefix,
90 std::string systTerm,
91 std::vector<std::string>& likelihoodTermNames);
92
94
95 void MakeTotalExpected(RooWorkspace* proto, std::string totName,
96 std::vector<std::string>& syst_x_expectedPrefixNames,
97 std::vector<std::string>& normByNames);
98
100 std::vector<RooWorkspace*> wspace_vec,
101 std::vector<std::string> channel_names,
102 std::string dataSetName,
103 RooArgList obsList,
104 RooCategory* channelCat);
105
106 void ProcessExpectedHisto(const TH1* hist, RooWorkspace* proto, std::string prefix,
107 std::string productPrefix, std::string systTerm );
108
109 void SetObsToExpected(RooWorkspace* proto, std::string obsPrefix, std::string expPrefix,
110 int lowBin, int highBin);
111
112 std::unique_ptr<TH1> MakeScaledUncertaintyHist(const std::string& Name,
113 std::vector< std::pair<const TH1*, const TH1*> > HistVec ) const;
114
115 TH1* MakeAbsolUncertaintyHist( const std::string& Name, const TH1* Hist );
116
118 std::vector<std::string>& constraintTerms,
119 ParamHistFunc& paramHist, const TH1* uncertHist,
120 Constraint::Type type, Double_t minSigma );
121
123 std::vector<std::string> obsNameVec);
124
125 std::vector<std::string> fSystToFix;
126 std::map<std::string, double> fParamValues;
127 double fNomLumi;
131
132 private:
133
134 void GuessObsNameVec(const TH1* hist);
135
136 std::vector<std::string> fObsNameVec;
137 std::string fObsName;
138 std::vector<std::string> fPreprocessFunctions;
139
141 };
142
143 }
144}
145
146#endif
double Double_t
Definition RtypesCore.h:59
#define ClassDef(name, id)
Definition Rtypes.h:325
int type
Definition TGX11.cxx:121
const char * proto
Definition civetweb.c:16604
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:21
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:29
RooCategory is an object to represent discrete states.
Definition RooCategory.h:27
RooDataSet is a container class to hold unbinned data.
Definition RooDataSet.h:33
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
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.
void ConfigureHistFactoryDataset(RooDataSet *obsData, TH1 *nominal, RooWorkspace *proto, std::vector< std::string > obsNameVec)
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)
void ProcessExpectedHisto(const TH1 *hist, RooWorkspace *proto, std::string prefix, std::string productPrefix, std::string systTerm)
void SetObsToExpected(RooWorkspace *proto, std::string obsPrefix, std::string expPrefix, int lowBin, int highBin)
void SetFunctionsToPreprocess(std::vector< std::string > lines)
RooDataSet * MergeDataSets(RooWorkspace *combined, std::vector< RooWorkspace * > wspace_vec, std::vector< std::string > channel_names, std::string dataSetName, RooArgList obsList, RooCategory *channelCat)
TH1 * MakeAbsolUncertaintyHist(const std::string &Name, const TH1 *Hist)
static void ConfigureWorkspaceForMeasurement(const std::string &ModelName, RooWorkspace *ws_single, Measurement &measurement)
RooArgList createStatConstraintTerms(RooWorkspace *proto, std::vector< std::string > &constraintTerms, ParamHistFunc &paramHist, const TH1 *uncertHist, Constraint::Type type, Double_t minSigma)
void AddPoissonTerms(RooWorkspace *proto, std::string prefix, std::string obsPrefix, std::string expPrefix, int lowBin, int highBin, std::vector< std::string > &likelihoodTermNames)
static void PrintCovarianceMatrix(RooFitResult *result, RooArgSet *params, std::string filename)
void MakeTotalExpected(RooWorkspace *proto, std::string totName, std::vector< std::string > &syst_x_expectedPrefixNames, std::vector< std::string > &normByNames)
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)
std::string AddNormFactor(RooWorkspace *proto, std::string &channel, std::string &sigmaEpsilon, Sample &sample, bool doRatio)
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)
RooWorkspace * MakeCombinedModel(std::vector< std::string >, std::vector< RooWorkspace * >)
void LinInterpWithConstraint(RooWorkspace *proto, const TH1 *nominal, std::vector< HistoSys >, std::string prefix, std::string productPrefix, std::string systTerm, std::vector< std::string > &likelihoodTermNames)
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.
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
Mother of all ROOT objects.
Definition TObject.h:37
Namespace for the RooStats classes.
Definition Asimov.h:19