Crombie Tools
PlotFitParameters.h
Go to the documentation of this file.
1 //--------------------------------------------------------------------------------------------------
2 // PlotFitParameters
3 //
4 // This class Plots the parameter of some fit as a function of some variable.
5 // These are defined by the user.
6 //
7 // Authors: D.Abercrombie
8 //--------------------------------------------------------------------------------------------------
9 #ifndef CROMBIETOOLS_PLOTTOOLS_PLOTFITPARAMETERS_H
10 #define CROMBIETOOLS_PLOTTOOLS_PLOTFITPARAMETERS_H
11 
12 #include "TH1.h"
13 
14 #include "Plot2D.h"
15 
16 class PlotFitParameters : public Plot2D
17 {
18  public:
20  virtual ~PlotFitParameters();
21 
22  /// Read the fit results to make graphs of parameter expressions
23  std::vector<TGraphErrors*> MakeGraphs ( TString ParameterExpr );
24  /// Read the fit results to make graphs of parameters
25  std::vector<TGraphErrors*> MakeGraphs ( Int_t ParameterNum );
26 
27  /// Various ways to merge the 2D histogram into 1D histograms for fits
29 
30  /// Set the CutStyle used by PlotFitParameters::DoFit()
31  void SetCutStyle ( CutStyle style ) { fCutStyle = style; }
32 
33  /// Add a component of the fit function to also plot in any resulting dump
34  void AddFunctionComponent ( TString function ) { fFunctionComponents.push_back(function); }
35 
36  private:
37 
38  void GetMeans ( Int_t NumXBins, const Double_t *XBins );
39  void DoFit ( TF1* fitFunc, TF1* looseFunc, TH2D* histToFit,
40  TF1**& fitHolder, TMatrixDSym**& covHolder );
41 
42  void ClearFits ();
43 
44  TF1* MakeFunction ( TString function, Double_t /* MinX */, Double_t /* MaxX */,
45  Double_t MinY, Double_t MaxY )
46  { return new TF1("func", function, MinY, MaxY); }
47  Int_t fFitXBins; ///< Holds the number of XBins in fFits for cleaning
48  std::vector<TH1*> fMeans; ///< Means of x variable bins for setting x values of TGraphs
49  std::vector<TString> fFunctionComponents;
50 
51  CutStyle fCutStyle = kBinned; ///< Sets the way that the 2D histograms is treated in PlotFitParameters::DoFit()
52 
53  ClassDef(PlotFitParameters, 1)
54 };
55 
56 #endif