Logo ROOT   6.14/05
Reference Guide
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)
cout << "in edit, gammamap.size = " << gammaSyst.size() << ", unimap.size = " << uniformSyst.size() << endl;
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:47
std::string AddNormFactor(RooWorkspace *, std::string &, std::string &, EstimateSummary &, bool)
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:320
void FormatFrameForLikelihood(RooPlot *frame, std::string XTitle=std::string("#sigma / #sigma_{SM}"), std::string YTitle=std::string("-log likelihood"))
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)
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)
A RooPlot is a plot frame and a container for graphics objects within that frame. ...
Definition: RooPlot.h:41
Namespace for the RooStats classes.
Definition: Asimov.h:20
TDirectory * Mkdir(TDirectory *file, std::string name)
TDirectory * Makedirs(TDirectory *file, std::vector< std::string > names)
Describe directory structure in memory.
Definition: TDirectory.h:34
void AddPoissonTerms(RooWorkspace *proto, std::string prefix, std::string obsPrefix, std::string expPrefix, int lowBin, int highBin, std::vector< std::string > &likelihoodTermNames)
RooWorkspace * MakeCombinedModel(std::vector< std::string >, std::vector< RooWorkspace *>)
The TH1 histogram class.
Definition: TH1.h:56
void FitModel(RooWorkspace *, std::string, std::string, std::string, bool=false)
RooWorkspace * MakeSingleChannelModel(std::vector< RooStats::HistFactory::EstimateSummary > summary, std::vector< std::string > systToFix, bool doRatio=false)
Mother of all ROOT objects.
Definition: TObject.h:37
Definition: file.py:1
const char * proto
Definition: civetweb.c:15049
char name[80]
Definition: TGX11.cxx:109
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43