ISurface.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <limits>
4 #include <map>
5 #include <vector>
6 
7 #include "TAttMarker.h"
8 
10 
11 class TGraph;
12 class TH2;
13 class TH2F;
14 
15 namespace ana
16 {
17  class ISurface
18  {
19  public:
21  : fBestLikelihood(std::numeric_limits<double>::signaling_NaN()),
22  fBestFitX(std::numeric_limits<double>::signaling_NaN()),
23  fBestFitY(std::numeric_limits<double>::signaling_NaN()),
24  fHist(nullptr), fLogX(false), fLogY(false)
25  {}
26 
27  virtual ~ISurface() {}
28 
29  double BestLikelihood() const {return fBestLikelihood;}
30  double GetBestFitX() const {return fBestFitX;}
31  double GetBestFitY() const {return fBestFitY;}
32 
33  /// Draw the surface itself
34  void Draw() const;
35 
36  /// Draw the best fit point
37  void DrawBestFit(Color_t color, Int_t marker= kFullCircle) const;
38 
39  /// \param fc Surface to compare against for this significance level
40  /// \param style Line style for TAttLine, solid, dotted, dashed etc
41  /// \param color Line color for TAttLine
42  /// \param minchi \f$\chi^2\f$ of best fit to compare against.
43  /// Default: best fit from this surface.
44  void DrawContour(TH2* fc, Style_t style, Color_t color,
45  double minchi = -1);
46 
47  /// For expert use, custom painting of contours
48  std::vector<TGraph*> GetGraphs(TH2* fc, double minchi = -1);
49 
50 
51  TH2* ToTH2(double minchi = -1) const;
52 
53  void SetTitle(const char* str);
54 
55  protected:
56  double BinCenterX(int bin) const;
57  double BinCenterY(int bin) const;
58 
59  /// \a dir should already be the appropriate sub-directory
60  void SaveToHelper(TDirectory* dir) const;
61  static void FillSurfObj(ISurface & surf, TDirectory * dir);
62 
64  double fBestFitX;
65  double fBestFitY;
66  TH2F* fHist;
67  bool fLogX, fLogY;
68  std::vector<double> fSeedValues;
69 
70  void EnsureAxes() const;
71  };
72 
73  /// Helper function for the gaussian approximation surfaces
74  TH2* Flat(double level, const ISurface& s);
75 }
76 
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
double BinCenterX(int bin) const
Definition: ISurface.cxx:244
void SetTitle(const char *str)
Definition: ISurface.cxx:183
double BinCenterY(int bin) const
Definition: ISurface.cxx:251
double GetBestFitY() const
Definition: ISurface.h:31
std::vector< TGraph * > GetGraphs(TH2 *fc, double minchi=-1)
For expert use, custom painting of contours.
Definition: ISurface.cxx:106
const XML_Char * s
Definition: expat.h:262
void DrawBestFit(Color_t color, Int_t marker=kFullCircle) const
Draw the best fit point.
Definition: ISurface.cxx:32
TH2F * fHist
Definition: ISurface.h:66
void Draw() const
Draw the surface itself.
Definition: ISurface.cxx:19
void DrawContour(TH2 *fc, Style_t style, Color_t color, double minchi=-1)
Definition: ISurface.cxx:44
bool fLogX
Definition: ISurface.h:67
double fBestFitY
Definition: ISurface.h:65
void SaveToHelper(TDirectory *dir) const
dir should already be the appropriate sub-directory
Definition: ISurface.cxx:189
float bin[41]
Definition: plottest35.C:14
bool fLogY
Definition: ISurface.h:67
std::vector< double > fSeedValues
Definition: ISurface.h:68
TH2 * ToTH2(double minchi=-1) const
Definition: ISurface.cxx:161
void EnsureAxes() const
Definition: ISurface.cxx:63
TDirectory * dir
Definition: macro.C:5
double fBestFitX
Definition: ISurface.h:64
virtual ~ISurface()
Definition: ISurface.h:27
static void FillSurfObj(ISurface &surf, TDirectory *dir)
Definition: ISurface.cxx:214
TH2 * Flat(double level, const ISurface &s)
Helper function for the gaussian approximation surfaces.
Definition: ISurface.cxx:232
double fBestLikelihood
Definition: ISurface.h:63
double BestLikelihood() const
Definition: ISurface.h:29
double GetBestFitX() const
Definition: ISurface.h:30
surf
Definition: demo5.py:35