MINT2
Public Member Functions | Protected Attributes | List of all members
HyperBinningPainter Class Reference

#include <HyperBinningPainter.h>

Inheritance diagram for HyperBinningPainter:
HyperBinningPainter1D HyperBinningPainter2D

Public Member Functions

 HyperBinningPainter (HyperHistogram *histogram)
 
void useDensity (bool val)
 
virtual void draw (TString path="", TString option="")
 
virtual ~HyperBinningPainter ()
 

Protected Attributes

HyperHistogram_histogram
 
bool _density
 

Detailed Description

HyperPlot, Author: Sam Harnew, sam.h.nosp@m.arne.nosp@m.w@gma.nosp@m.il.c.nosp@m.om , Date: Dec 2015

Class plotting HyperBinningHistograms of any dimension

Definition at line 30 of file HyperBinningPainter.h.

Constructor & Destructor Documentation

◆ HyperBinningPainter()

HyperBinningPainter::HyperBinningPainter ( HyperHistogram histogram)

Construct a HyperBinningPainter for a given HyperBinningHistogram

Definition at line 4 of file HyperBinningPainter.cpp.

4  :
5  _histogram(histogram),
6  _density(false)
7 {
8  WELCOME_LOG << "Good day from the HyperBinningPainter() Constructor";
9 }
HyperHistogram * _histogram
#define WELCOME_LOG

◆ ~HyperBinningPainter()

HyperBinningPainter::~HyperBinningPainter ( )
virtual

Destructor

Definition at line 86 of file HyperBinningPainter.cpp.

86  {
87 
88 }

Member Function Documentation

◆ draw()

void HyperBinningPainter::draw ( TString  path = "",
TString  option = "" 
)
virtual

Draw the HyperBinningHistogram

Reimplemented in HyperBinningPainter2D, and HyperBinningPainter1D.

Definition at line 12 of file HyperBinningPainter.cpp.

12  {
13 
14  option = option; //remove conpilation warning
15 
16 
17  int nBins = _histogram->getNBins();
18 
19  //double volumeSum = 0.0;
20  //for (int i = 0; i < nBins; i++){
21  // double volume = _histogram->getBinning().getBinHyperVolume(i).volume();
22  // volumeSum += volume;
23  //}
24 //
25  //double* edgeArray = new double [nBins + 1];
26  //edgeArray[0]=0.0;
27 //
28  //double binSum = 0.0;
29 //
30  //for (int i = 0; i < nBins; i++){
31  // double volume = _histogram->getBinning().getBinHyperVolume(i).volume();
32  // binSum += 1.0;//volume/volumeSum;
33  // edgeArray[i+1] = binSum;
34  //}
35 //
36  TH1D tempHist("tempHist", "tempHist", nBins, 0.0, nBins);
37  tempHist.GetXaxis()->SetTitle("Bin Number");
38  //tempHist.GetYaxis()->SetTitle("Frequency");
39 
40  //int dim = _histogram->getBinning().getDimension();
41 
42  //TCanvas canvas("canvas", "canvas", 400.0, dim*80.0 + 2.0*30.0 + 300.0);
43 
44 
45 
46  //TPad padPlot ("padPlot", "padPlot" , 0.0, (dim*80.0 + 2.0*30.0)/(dim*80.0 + 2.0*30.0 + 300.0) , 1.0, 1.0);
47  //canvas.cd();
48  //padPlot.Draw();
49 //
50  //TPad padBinning("padBinning", "padBinning", 0.0, 0.0 , 1.0, (dim*80.0 + 2.0*30.0)/(dim*80.0 + 2.0*30.0 + 300.0) );
51  //canvas.cd();
52  //padBinning.Draw();
53 
54  for (int i = 0; i < nBins; i++){
55  if (_density == true) {
56  double volume = _histogram->getBinning().getBinHyperVolume(i).volume();
57  tempHist.SetBinContent(i+1, _histogram->getBinContent(i)/volume);
58  tempHist.SetBinError (i+1, _histogram->getBinError(i)/volume);
59  }
60  else{
61  tempHist.SetBinContent(i+1, _histogram->getBinContent(i));
62  tempHist.SetBinError (i+1, _histogram->getBinError(i));
63  }
64  }
65 
66  RootPlotter1D plotter(&tempHist);
67  plotter.plot( path );
68 
69  // plotter.plot("", "", &padPlot);
70  // _histogram->getBinning().drawBinning("", &padBinning);
71  //
72 //
73  // canvas.Draw();
74 //
75  // gStyle->SetPaperSize(400.0, dim*80.0 + 2.0*30.0 + 300.0);
76 //
77  // padBinning.Print(path + "_bin" + Plotter::s_imageformat);
78  // padPlot.Print(path + "_data" + Plotter::s_imageformat);
79 //
80  // canvas.Print(path + Plotter::s_imageformat);
81 
82  //INFO_LOG << "I can't plot N dimensional histograms just yet";
83 
84 }
double getBinError(int bin) const
int getNBins() const
Definition: HistogramBase.h:63
double getBinContent(int bin) const
HyperHistogram * _histogram
double volume() const
const BinningBase & getBinning() const
virtual HyperVolume getBinHyperVolume(int binNumber) const =0

◆ useDensity()

void HyperBinningPainter::useDensity ( bool  val)
inline

Am I drawing the bin contents or the density?

Definition at line 41 of file HyperBinningPainter.h.

Member Data Documentation

◆ _density

bool HyperBinningPainter::_density
protected

Am I drawing the bin contents or the density?

Definition at line 35 of file HyperBinningPainter.h.

◆ _histogram

HyperHistogram* HyperBinningPainter::_histogram
protected

Pointer to the HyperBinningHistogram I'm going to plot

Definition at line 34 of file HyperBinningPainter.h.


The documentation for this class was generated from the following files: