ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HistoToWorkspaceFactory.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_HISTOTOWORKSPACEFACTORY
12 #define ROOSTATS_HISTOTOWORKSPACEFACTORY
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 
30 
31 namespace RooStats{
32 namespace HistFactory{
33 
34  struct EstimateSummary;
35 
37 
38  public:
39 
40  HistoToWorkspaceFactory( std::string, std::string , std::vector<std::string> , double =200, double =20, int =0, int =6, TFile * =0);
42  virtual ~HistoToWorkspaceFactory();
43 
44  void AddEfficiencyTerms(RooWorkspace* proto, std::string prefix, std::string interpName,
45  std::map<std::string,std::pair<double,double> > systMap,
46  std::vector<std::string>& likelihoodTermNames, std::vector<std::string>& totSystTermNames);
47 
48  std::string AddNormFactor(RooWorkspace *, std::string & , std::string & , EstimateSummary & , bool );
49 
50  void AddMultiVarGaussConstraint(RooWorkspace* proto, std::string prefix,int lowBin, int highBin, std::vector<std::string>& likelihoodTermNames);
51 
52  void AddPoissonTerms(RooWorkspace* proto, std::string prefix, std::string obsPrefix, std::string expPrefix, int lowBin, int highBin,
53  std::vector<std::string>& likelihoodTermNames);
54 
55  //void Combine_old();
56 
57  RooWorkspace * MakeCombinedModel(std::vector<std::string>, std::vector<RooWorkspace*>);
58 
59  //void Combine_ratio(std::vector<std::string> , std::vector<RooWorkspace*>);
60 
61  void Customize(RooWorkspace* proto, const char* pdfNameChar, std::map<std::string,std::string> renameMap);
62 
63  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);
64 
65  void FormatFrameForLikelihood(RooPlot* frame, std::string XTitle=std::string("#sigma / #sigma_{SM}"), std::string YTitle=std::string("-log likelihood"));
66 
67 
68  void LinInterpWithConstraint(RooWorkspace* proto, TH1* nominal, std::vector<TH1*> lowHist, std::vector<TH1*> highHist,
69  std::vector<std::string> sourceName, std::string prefix, std::string productPrefix, std::string systTerm,
70  int lowBin, int highBin, std::vector<std::string>& likelihoodTermNames);
71 
72  TDirectory* Makedirs( TDirectory* file, std::vector<std::string> names );
73 
74  RooWorkspace* MakeSingleChannelModel(std::vector<RooStats::HistFactory::EstimateSummary> summary, std::vector<std::string> systToFix, bool doRatio=false);
75 
76  void MakeTotalExpected(RooWorkspace* proto, std::string totName, std::string /**/, std::string /**/,
77  int lowBin, int highBin, std::vector<std::string>& syst_x_expectedPrefixNames,
78  std::vector<std::string>& normByNames);
79 
80  TDirectory* Mkdir( TDirectory * file, std::string name );
81 
82  void PrintCovarianceMatrix(RooFitResult* result, RooArgSet* params, std::string filename);
83  void ProcessExpectedHisto(TH1* hist,RooWorkspace* proto, std::string prefix, std::string productPrefix, std::string systTerm, double low, double high, int lowBin, int highBin);
84  void SetObsToExpected(RooWorkspace* proto, std::string obsPrefix, std::string expPrefix, int lowBin, int highBin);
85  void FitModel(RooWorkspace *, std::string, std::string, std::string, bool=false );
86  std::string FilePrefixStr(std::string);
87 
88 
89  std::string fFileNamePrefix;
90  std::string fRowTitle;
91  std::vector<std::string> fSystToFix;
94  std::stringstream fResultsPrefixStr;
96  FILE * pFile;
97 
99  };
100 
101 }
102 }
103 
104 #endif
void MakeTotalExpected(RooWorkspace *proto, std::string totName, std::string, std::string, int lowBin, int highBin, std::vector< std::string > &syst_x_expectedPrefixNames, std::vector< std::string > &normByNames)
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)
void SetObsToExpected(RooWorkspace *proto, std::string obsPrefix, std::string expPrefix, int lowBin, int highBin)
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:45
static const char * filename()
RooWorkspace * MakeCombinedModel(std::vector< std::string >, std::vector< RooWorkspace * >)
void PrintCovarianceMatrix(RooFitResult *result, RooArgSet *params, std::string filename)
void ProcessExpectedHisto(TH1 *hist, RooWorkspace *proto, std::string prefix, std::string productPrefix, std::string systTerm, double low, double high, int lowBin, int highBin)
#define ClassDef(name, id)
Definition: Rtypes.h:254
void FormatFrameForLikelihood(RooPlot *frame, std::string XTitle=std::string("#sigma / #sigma_{SM}"), std::string YTitle=std::string("-log likelihood"))
TDirectory * Mkdir(TDirectory *file, std::string name)
std::string AddNormFactor(RooWorkspace *, std::string &, std::string &, EstimateSummary &, bool)
void AddEfficiencyTerms(RooWorkspace *proto, std::string prefix, std::string interpName, std::map< std::string, std::pair< double, double > > systMap, std::vector< std::string > &likelihoodTermNames, std::vector< std::string > &totSystTermNames)
void Customize(RooWorkspace *proto, const char *pdfNameChar, std::map< std::string, std::string > renameMap)
void AddMultiVarGaussConstraint(RooWorkspace *proto, std::string prefix, int lowBin, int highBin, std::vector< std::string > &likelihoodTermNames)
RooWorkspace * MakeSingleChannelModel(std::vector< RooStats::HistFactory::EstimateSummary > summary, std::vector< std::string > systToFix, bool doRatio=false)
A RooPlot is a plot frame and a container for graphics objects within that frame. ...
Definition: RooPlot.h:41
tuple file
Definition: fildir.py:20
TDirectory * Makedirs(TDirectory *file, std::vector< std::string > names)
Describe directory structure in memory.
Definition: TDirectory.h:44
void AddPoissonTerms(RooWorkspace *proto, std::string prefix, std::string obsPrefix, std::string expPrefix, int lowBin, int highBin, std::vector< std::string > &likelihoodTermNames)
The TH1 histogram class.
Definition: TH1.h:80
void FitModel(RooWorkspace *, std::string, std::string, std::string, bool=false)
#define name(a, b)
Definition: linkTestLib0.cpp:5
Mother of all ROOT objects.
Definition: TObject.h:58
double result[121]
void LinInterpWithConstraint(RooWorkspace *proto, TH1 *nominal, std::vector< TH1 * > lowHist, std::vector< TH1 * > highHist, std::vector< std::string > sourceName, std::string prefix, std::string productPrefix, std::string systTerm, int lowBin, int highBin, std::vector< std::string > &likelihoodTermNames)
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:42