MINT2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
HyperBinningPainter2D Class Reference

#include <HyperBinningPainter2D.h>

Inheritance diagram for HyperBinningPainter2D:
HyperBinningPainter

Public Member Functions

 HyperBinningPainter2D (BinningBase *binning, HyperPointSet *hyperPoints=0)
 
 HyperBinningPainter2D (HyperHistogram *histogram)
 
virtual void draw (TString path="", TString option="")
 
 ~HyperBinningPainter2D ()
 
- Public Member Functions inherited from HyperBinningPainter
 HyperBinningPainter (HyperHistogram *histogram)
 
void useDensity (bool val)
 
virtual ~HyperBinningPainter ()
 

Private Member Functions

const BinningBasegetBinning ()
 
int getFillColour (double binContents)
 
void addHyperPoints (TH2D *histogram)
 
void drawFilledBins (RootPlotter2D *plotter, bool hashNeg=false)
 
void drawFilledBin (RootPlotter2D *plotter, int bin, bool hashNeg=false)
 
void drawFilledBin (RootPlotter2D *plotter, HyperCuboid *bin, double binContents)
 
void drawFilledBin (RootPlotter2D *plotter, HyperCuboid *bin, int fillColor, int fillStyle)
 
void drawBinEdges (RootPlotter2D *plotter)
 
void drawBinEdge (RootPlotter2D *plotter, int bin)
 
void drawBinEdge (RootPlotter2D *plotter, HyperCuboid *bin)
 
void drawBinEdges2 (RootPlotter2D *plotter)
 
void drawBinEdge2 (RootPlotter2D *plotter, int bin, double minWidX, double minWidY)
 
void drawBinEdge2 (RootPlotter2D *plotter, HyperCuboid *bin, double minWidX, double minWidY)
 
void drawBinEdge2 (RootPlotter2D *plotter, HyperCuboid *bin, int edge, double minWidX, double minWidY)
 
void drawBinNumbers (RootPlotter2D *plotter)
 
void drawBinNumbers (RootPlotter2D *plotter, int bin)
 
void drawBinCont (RootPlotter2D *plotter)
 
void drawBinCont (RootPlotter2D *plotter, int bin)
 

Private Attributes

BinningBase_binning
 
HyperPointSet_hyperPoints
 

Additional Inherited Members

- Protected Attributes inherited from HyperBinningPainter
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 2D HyperBinningHistograms

Definition at line 29 of file HyperBinningPainter2D.h.

Constructor & Destructor Documentation

◆ HyperBinningPainter2D() [1/2]

HyperBinningPainter2D::HyperBinningPainter2D ( BinningBase binning,
HyperPointSet hyperPoints = 0 
)

Construct a 2D HyperBinningPainter for a given HyperVolumeBinning and HyperPointSet. This option will draw the HyperPointSet as dots over the binning scheme

Definition at line 6 of file HyperBinningPainter2D.cpp.

6  :
8  _binning(binning),
9  _hyperPoints(hyperPoints)
10 {
11  if (getBinning().getDimension() != 2){
12  ERROR_LOG << "You have given a 2D painter a different dimensionality of binning and/or data. I'll probably crash soon";
13  }
14  if (hyperPoints != 0){
15  if(hyperPoints->getDimension() !=2){
16  ERROR_LOG << "You have given a 2D painter a different dimensionality of binning and/or data. I'll probably crash soon";
17  }
18  }
19  WELCOME_LOG << "Good day from the HyperBinningPainter2D() Constructor";
20 }
HyperBinningPainter(HyperHistogram *histogram)
#define ERROR_LOG
const int & getDimension() const
Definition: HyperPointSet.h:40
#define WELCOME_LOG
const BinningBase & getBinning()

◆ HyperBinningPainter2D() [2/2]

HyperBinningPainter2D::HyperBinningPainter2D ( HyperHistogram histogram)

Construct a 2D HyperBinningPainter for a given HyperBinningHistogram

Definition at line 23 of file HyperBinningPainter2D.cpp.

23  :
24  HyperBinningPainter(histogram),
25  _binning(0),
26  _hyperPoints(0)
27 {
28  if (getBinning().getDimension() != 2){
29  ERROR_LOG << "You have given a 2D painter a different dimensionality of binning and/or data. I'll probably crash soon";
30  }
31  WELCOME_LOG << "Good day from the HyperBinningPainter2D() Constructor";
32 }
HyperBinningPainter(HyperHistogram *histogram)
#define ERROR_LOG
#define WELCOME_LOG
const BinningBase & getBinning()

◆ ~HyperBinningPainter2D()

HyperBinningPainter2D::~HyperBinningPainter2D ( )

Constructor

Definition at line 436 of file HyperBinningPainter2D.cpp.

436  {
437 
438 }

Member Function Documentation

◆ addHyperPoints()

void HyperBinningPainter2D::addHyperPoints ( TH2D *  histogram)
private

If HyperPoints provided, add to TH2D

Definition at line 363 of file HyperBinningPainter2D.cpp.

363  {
364  for(unsigned int i = 0; i < _hyperPoints->size(); i++){
365  histogram->Fill(_hyperPoints->at(i).at(0), _hyperPoints->at(i).at(1));
366  }
367 }
const HyperPoint & at(int i) const
const double & at(int i) const
Definition: HyperPoint.cpp:433
unsigned int size() const

◆ draw()

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

Draw the HyperBinningHistogram

Reimplemented from HyperBinningPainter.

Definition at line 370 of file HyperBinningPainter2D.cpp.

370  {
371 
372  bool drawBinEd1 = option.Contains("Edges1" );
373  bool drawBinEd2 = option.Contains("Edges2" );
374  bool drawBinNums = option.Contains("BinNums");
375  bool drawHashedNeg = option.Contains("HashNeg");
376  bool drawBinContOp = option.Contains("Text");
377 
378  double x_min = getBinning().getMin(0);
379  double x_max = getBinning().getMax(0);
380  double y_min = getBinning().getMin(1);
381  double y_max = getBinning().getMax(1);
382 
383  TString xtitle = _histogram->getNames().getAxisString(0);
384  TString ytitle = _histogram->getNames().getAxisString(1);
385 
386  TH2D* histogram = new TH2D("2DHyperBinningPlot", "2DHyperBinningPlot", 100, x_min, x_max, 100, y_min, y_max);
387  histogram->GetXaxis()->SetTitle( xtitle );
388  histogram->GetYaxis()->SetTitle( ytitle );
389 
390  double min = _histogram->getMin();
391  double max = _histogram->getMax();
392  if (_density == true){
393  min = _histogram->getMinDensity();
394  max = _histogram->getMaxDensity();
395  }
396 
397  if (drawHashedNeg){
398  min = min<0.0?0.0:min;
399  max = fabs(max)>fabs(min)?fabs(max):fabs(min);
400  }
401 
402  if (_histogram != 0){
403  //if you want the scale to be correct on the zaxis, we need to fill the
404  //histogram with events between min-max (annoying)
405  for(int i = 1; i <= 100; i++) for (int j = 0; j <= 100; ++j) histogram->SetBinContent(i, j, max);
406  histogram->SetBinContent(2, 2, min);
407  histogram->SetMaximum(max);
408  histogram->SetMinimum(min);
409  }
410 
411  histogram->SetContour(gStyle->GetNumberContours());
412  //std::cout << "Am setting number of contours to " << gStyle->GetNumberContours() << std::endl;
413  RootPlotter2D plotter(histogram);
414 
415  if (_hyperPoints != 0) addHyperPoints(histogram);
416  if (_binning != 0) drawBinEdges (&plotter);
417  if (_histogram != 0) {
418  TBox* box = new TBox(getBinning().getMin(0) , getBinning().getMin(1), getBinning().getMax(0) , getBinning().getMax(1));
419  box->SetFillColor( 0 );
420  box->SetLineWidth(0.0);
421  plotter.addObject(box) ;
422  drawFilledBins(&plotter, drawHashedNeg);
423  if (drawBinEd1 ) drawBinEdges (&plotter);
424  if (drawBinEd2 ) drawBinEdges2 (&plotter);
425  if (drawBinNums ) drawBinNumbers(&plotter);
426  if (drawBinContOp ) drawBinCont (&plotter);
427 
428  }
429 
430  plotter.plot(path, "COLZ");
431 
432  delete histogram;
433 }
double getMax(int dimension) const
Definition: BinningBase.cpp:46
double getMaxDensity() const
TString getAxisString(int dim)
Definition: HyperName.cpp:96
double getMin(int dimension) const
Definition: BinningBase.cpp:42
double getMin() const
void drawBinEdges2(RootPlotter2D *plotter)
void drawBinNumbers(RootPlotter2D *plotter)
void addHyperPoints(TH2D *histogram)
double getMax() const
HyperHistogram * _histogram
void drawBinEdges(RootPlotter2D *plotter)
void drawFilledBins(RootPlotter2D *plotter, bool hashNeg=false)
void drawBinCont(RootPlotter2D *plotter)
HyperName getNames() const
const BinningBase & getBinning()
double getMinDensity() const

◆ drawBinCont() [1/2]

void HyperBinningPainter2D::drawBinCont ( RootPlotter2D plotter)
private

Draw bin contents on the all the bins

Definition at line 296 of file HyperBinningPainter2D.cpp.

296  {
297  for(int i = 0; i < getBinning().getNumBins(); i++) drawBinCont(plotter, i);
298 }
virtual int getNumBins() const =0
void drawBinCont(RootPlotter2D *plotter)
const BinningBase & getBinning()

◆ drawBinCont() [2/2]

void HyperBinningPainter2D::drawBinCont ( RootPlotter2D plotter,
int  bin 
)
private

Draw bin content on a single bin

Definition at line 302 of file HyperBinningPainter2D.cpp.

302  {
304  double binCont = _histogram->getBinContent(bin );
305  TString label = ""; label += binCont;
306  plotter->addText( label ,center.at(0), center.at(1), 2, 2, 0.02, 0);
307 
308 }
double getBinContent(int bin) const
HyperHistogram * _histogram
const double & at(int i) const
Definition: HyperPoint.cpp:433
void addText(TString text, double x, double y, int alignh=1, int alignv=2, double size=0.06, int ndc=true, int color=kBlack)
Definition: RootPlotter.cpp:33
HyperPoint getAverageCenter() const
const BinningBase & getBinning()
virtual HyperVolume getBinHyperVolume(int binNumber) const =0

◆ drawBinEdge() [1/2]

void HyperBinningPainter2D::drawBinEdge ( RootPlotter2D plotter,
int  bin 
)
private

add the bin edges to the Plotter (for one HyperVolume)

Definition at line 48 of file HyperBinningPainter2D.cpp.

48  {
49 
50  for (int i = 0; i < getBinning().getBinHyperVolume(bin).size(); i++){
51  HyperCuboid temp (getBinning().getBinHyperVolume(bin).getHyperCuboid(i));
52  drawBinEdge(plotter, &temp);
53  }
54 }
int size() const
Definition: HyperVolume.h:60
void drawBinEdge(RootPlotter2D *plotter, int bin)
const BinningBase & getBinning()
virtual HyperVolume getBinHyperVolume(int binNumber) const =0

◆ drawBinEdge() [2/2]

void HyperBinningPainter2D::drawBinEdge ( RootPlotter2D plotter,
HyperCuboid bin 
)
private

add the bin edges to the Plotter (for one HyperCuboid)

Definition at line 57 of file HyperBinningPainter2D.cpp.

57  {
58 
59  TLine* leftLine = new TLine(bin->getLowCorner().at(0) , bin->getLowCorner().at(1), bin->getLowCorner().at(0) , bin->getHighCorner().at(1));
60  TLine* rightLine = new TLine(bin->getHighCorner().at(0), bin->getLowCorner().at(1), bin->getHighCorner().at(0), bin->getHighCorner().at(1));
61  TLine* topLine = new TLine(bin->getLowCorner().at(0) , bin->getHighCorner().at(1), bin->getHighCorner().at(0) , bin->getHighCorner().at(1));
62  TLine* bottomLine = new TLine(bin->getLowCorner().at(0) , bin->getLowCorner().at(1), bin->getHighCorner().at(0) , bin->getLowCorner().at(1));
63 
64  leftLine ->SetLineWidth(1);
65  rightLine ->SetLineWidth(1);
66  topLine ->SetLineWidth(1);
67  bottomLine->SetLineWidth(1);
68 
69  leftLine ->SetLineColor(kBlack);
70  rightLine ->SetLineColor(kBlack);
71  topLine ->SetLineColor(kBlack);
72  bottomLine->SetLineColor(kBlack);
73 
74  //
75  leftLine ->SetLineStyle(3);
76  //rightLine ->SetLineStyle(3);
77  //topLine ->SetLineStyle(3);
78  bottomLine->SetLineStyle(3);
79 
80  plotter->addObject(leftLine);
81  //plotter->addObject(rightLine);
82  //plotter->addObject(topLine);
83  plotter->addObject(bottomLine);
84 
85 }
void addObject(TObject *obj)
Definition: Plotter.cpp:168
const HyperPoint & getHighCorner() const
Definition: HyperCuboid.h:89
const double & at(int i) const
Definition: HyperPoint.cpp:433
const HyperPoint & getLowCorner() const
Definition: HyperCuboid.h:87

◆ drawBinEdge2() [1/3]

void HyperBinningPainter2D::drawBinEdge2 ( RootPlotter2D plotter,
int  bin,
double  minWidX,
double  minWidY 
)
private

draw edges between bins with different contents

Definition at line 106 of file HyperBinningPainter2D.cpp.

106  {
107 
108  for (int i = 0; i < getBinning().getBinHyperVolume(bin).size(); i++){
109  HyperCuboid temp (getBinning().getBinHyperVolume(bin).getHyperCuboid(i));
110  drawBinEdge2(plotter, &temp, minWidX, minWidY);
111  }
112 }
int size() const
Definition: HyperVolume.h:60
const BinningBase & getBinning()
void drawBinEdge2(RootPlotter2D *plotter, int bin, double minWidX, double minWidY)
virtual HyperVolume getBinHyperVolume(int binNumber) const =0

◆ drawBinEdge2() [2/3]

void HyperBinningPainter2D::drawBinEdge2 ( RootPlotter2D plotter,
HyperCuboid bin,
double  minWidX,
double  minWidY 
)
private

draw edges between bins with different contents

Definition at line 115 of file HyperBinningPainter2D.cpp.

115  {
116 
117  drawBinEdge2(plotter, bin, 0 , minWidX, minWidY);
118  drawBinEdge2(plotter, bin, 1 , minWidX, minWidY);
119  drawBinEdge2(plotter, bin, 2 , minWidX, minWidY);
120  drawBinEdge2(plotter, bin, 3 , minWidX, minWidY);
121 
122 }
void drawBinEdge2(RootPlotter2D *plotter, int bin, double minWidX, double minWidY)

◆ drawBinEdge2() [3/3]

void HyperBinningPainter2D::drawBinEdge2 ( RootPlotter2D plotter,
HyperCuboid bin,
int  edge,
double  minWidX,
double  minWidY 
)
private

draw edges between bins with different contents

Definition at line 125 of file HyperBinningPainter2D.cpp.

125  {
126 
127  double binContent = _histogram->getVal( bin->getCenter() );
128  TLine* line = 0;
129 
130  if (edge == 0) { //left edge
131 
132  HyperPoint cornerLow (bin->getLowCorner().at(0)-minWidX*0.5, bin->getLowCorner ().at(1)+minWidY*0.05);
133  HyperPoint cornerHigh(bin->getLowCorner().at(0)-minWidX*0.5, bin->getHighCorner().at(1)-minWidY*0.05);
134  int binNumLow = getBinning().getBinNum( cornerLow );
135  int binNumHigh = getBinning().getBinNum( cornerHigh );
136 
137  if (binNumLow == -1 ) return;
138  if (binNumHigh == -1 ) return;
139 
140  double binConLow = _histogram->getBinContent(binNumLow );
141  double binConHigh = _histogram->getBinContent(binNumHigh);
142 
143  HyperCuboid binLow = getBinning().getBinHyperVolume(binNumLow ).at(0);
144  HyperCuboid binHigh = getBinning().getBinHyperVolume(binNumHigh).at(0);
145 
146  if (binNumLow == binNumHigh && binContent == binConLow) return;
147  else if (binNumLow == binNumHigh && binContent != binConLow) {
148  line = new TLine( bin->getLowCorner().at(0), bin->getLowCorner ().at(1), bin->getLowCorner().at(0), bin->getHighCorner().at(1) );
149  }
150  else if (binConLow != binContent){
151  line = new TLine( bin->getLowCorner().at(0), bin->getLowCorner ().at(1), bin->getLowCorner().at(0), binLow.getHighCorner().at(1) );
152  }
153  else if (binConHigh != binContent){
154  line = new TLine( bin->getLowCorner().at(0), binHigh.getLowCorner ().at(1), bin->getLowCorner().at(0), bin->getHighCorner().at(1) );
155  }
156 
157  }
158 
159  if (edge == 1) { //right edge
160 
161  HyperPoint cornerLow (bin->getHighCorner().at(0)+minWidX*0.5, bin->getLowCorner ().at(1)+minWidY*0.05);
162  HyperPoint cornerHigh(bin->getHighCorner().at(0)+minWidX*0.5, bin->getHighCorner().at(1)-minWidY*0.05);
163  int binNumLow = getBinning().getBinNum( cornerLow );
164  int binNumHigh = getBinning().getBinNum( cornerHigh );
165 
166  if (binNumLow == -1 ) return;
167  if (binNumHigh == -1 ) return;
168 
169  double binConLow = _histogram->getBinContent(binNumLow );
170  double binConHigh = _histogram->getBinContent(binNumHigh);
171 
172  HyperCuboid binLow = getBinning().getBinHyperVolume(binNumLow ).at(0);
173  HyperCuboid binHigh = getBinning().getBinHyperVolume(binNumHigh).at(0);
174 
175  if (binNumLow == binNumHigh && binContent == binConLow) return;
176  else if (binNumLow == binNumHigh && binContent != binConLow) {
177  line = new TLine( bin->getHighCorner().at(0), bin->getLowCorner ().at(1), bin->getHighCorner().at(0), bin->getHighCorner().at(1) );
178  }
179  else if (binConLow != binContent){
180  line = new TLine( bin->getHighCorner().at(0), bin->getLowCorner ().at(1), bin->getHighCorner().at(0), binLow.getHighCorner().at(1) );
181  }
182  else if (binConHigh != binContent){
183  line = new TLine( bin->getHighCorner().at(0), binHigh.getLowCorner ().at(1), bin->getHighCorner().at(0), bin->getHighCorner().at(1) );
184  }
185 
186  }
187 
188  if (edge == 2) { //top edge
189 
190  HyperPoint cornerLow (bin->getLowCorner ().at(0)+minWidX*0.05, bin->getHighCorner().at(1)+minWidY*0.5);
191  HyperPoint cornerHigh(bin->getHighCorner().at(0)-minWidX*0.05, bin->getHighCorner().at(1)+minWidY*0.5);
192  int binNumLow = getBinning().getBinNum( cornerLow );
193  int binNumHigh = getBinning().getBinNum( cornerHigh );
194 
195  if (binNumLow == -1 ) return;
196  if (binNumHigh == -1 ) return;
197 
198  double binConLow = _histogram->getBinContent(binNumLow );
199  double binConHigh = _histogram->getBinContent(binNumHigh);
200 
201  HyperCuboid binLow = getBinning().getBinHyperVolume(binNumLow ).at(0);
202  HyperCuboid binHigh = getBinning().getBinHyperVolume(binNumHigh).at(0);
203 
204  if (binNumLow == binNumHigh && binContent == binConLow) return;
205  else if (binNumLow == binNumHigh && binContent != binConLow) {
206  line = new TLine( bin->getLowCorner ().at(0), bin->getHighCorner().at(1), bin->getHighCorner().at(0), bin->getHighCorner().at(1) );
207  }
208  else if (binConLow != binContent){
209  line = new TLine( bin->getLowCorner ().at(0), bin->getHighCorner().at(1), binLow.getHighCorner().at(0), bin->getHighCorner().at(1) );
210  }
211  else if (binConHigh != binContent){
212  line = new TLine( binHigh.getLowCorner ().at(0), bin->getHighCorner().at(1), bin->getHighCorner().at(0), bin->getHighCorner().at(1) );
213  }
214 
215  }
216 
217  if (edge == 3) { //bottom edge
218 
219  HyperPoint cornerLow (bin->getLowCorner ().at(0)+minWidX*0.05, bin->getLowCorner().at(1)-minWidY*0.5);
220  HyperPoint cornerHigh(bin->getHighCorner().at(0)-minWidX*0.05, bin->getLowCorner().at(1)-minWidY*0.5);
221  int binNumLow = getBinning().getBinNum( cornerLow );
222  int binNumHigh = getBinning().getBinNum( cornerHigh );
223 
224  if (binNumLow == -1 ) return;
225  if (binNumHigh == -1 ) return;
226  double binConLow = _histogram->getBinContent(binNumLow );
227  double binConHigh = _histogram->getBinContent(binNumHigh);
228 
229  HyperCuboid binLow = getBinning().getBinHyperVolume(binNumLow ).at(0);
230  HyperCuboid binHigh = getBinning().getBinHyperVolume(binNumHigh).at(0);
231 
232  if (binNumLow == binNumHigh && binContent == binConLow) return;
233  else if (binNumLow == binNumHigh && binContent != binConLow) {
234  line = new TLine( bin->getLowCorner ().at(0), bin->getLowCorner().at(1), bin->getHighCorner().at(0), bin->getLowCorner().at(1) );
235  }
236  else if (binConLow != binContent){
237  line = new TLine( bin->getLowCorner ().at(0), bin->getLowCorner().at(1), binLow.getHighCorner().at(0), bin->getLowCorner().at(1) );
238  }
239  else if (binConHigh != binContent){
240  line = new TLine( binHigh.getLowCorner ().at(0), bin->getLowCorner().at(1), bin->getHighCorner().at(0), bin->getLowCorner().at(1) );
241  }
242 
243  }
244 
245  if (line == 0) return;
246 
247  line ->SetLineWidth(1);
248  line ->SetLineColor(kBlack);
249  line ->SetLineStyle(1);
250 
251  plotter->addObject(line);
252 
253 
254 }
void addObject(TObject *obj)
Definition: Plotter.cpp:168
const HyperCuboid & at(int i) const
Definition: HyperVolume.h:55
double getBinContent(int bin) const
virtual int getBinNum(const HyperPoint &coords) const =0
HyperPoint getCenter() const
Definition: HyperCuboid.cpp:93
const HyperPoint & getHighCorner() const
Definition: HyperCuboid.h:89
HyperHistogram * _histogram
const double & at(int i) const
Definition: HyperPoint.cpp:433
virtual double getVal(const HyperPoint &point) const
const HyperPoint & getLowCorner() const
Definition: HyperCuboid.h:87
const BinningBase & getBinning()
virtual HyperVolume getBinHyperVolume(int binNumber) const =0

◆ drawBinEdges()

void HyperBinningPainter2D::drawBinEdges ( RootPlotter2D plotter)
private

add the bin edges to the Plotter (for all HyperVolumes)

Definition at line 43 of file HyperBinningPainter2D.cpp.

43  {
44  for(int i = 0; i < getBinning().getNumBins(); i++) drawBinEdge(plotter, i);
45 }
virtual int getNumBins() const =0
void drawBinEdge(RootPlotter2D *plotter, int bin)
const BinningBase & getBinning()

◆ drawBinEdges2()

void HyperBinningPainter2D::drawBinEdges2 ( RootPlotter2D plotter)
private

draw edges between bins with different contents

Definition at line 89 of file HyperBinningPainter2D.cpp.

89  {
90 
91  double minBinWidthX = 10e50;
92  double minBinWidthY = 10e50;
93 
94  for(int i = 0; i < getBinning().getNumBins(); i++){
96  double binWidthX = vol.getWidth(0);
97  double binWidthY = vol.getWidth(1);
98  if (binWidthX < minBinWidthX) minBinWidthX = binWidthX;
99  if (binWidthY < minBinWidthY) minBinWidthY = binWidthY;
100  }
101 
102  for(int i = 0; i < getBinning().getNumBins(); i++) drawBinEdge2(plotter, i, minBinWidthX, minBinWidthY);
103 }
virtual int getNumBins() const =0
HyperCuboid getLimits() const
HyperPoint getWidth() const
const BinningBase & getBinning()
void drawBinEdge2(RootPlotter2D *plotter, int bin, double minWidX, double minWidY)
virtual HyperVolume getBinHyperVolume(int binNumber) const =0

◆ drawBinNumbers() [1/2]

void HyperBinningPainter2D::drawBinNumbers ( RootPlotter2D plotter)
private

Draw bin numbers on the all the bins

Definition at line 282 of file HyperBinningPainter2D.cpp.

282  {
283  for(int i = 0; i < getBinning().getNumBins(); i++) drawBinNumbers(plotter, i);
284 }
virtual int getNumBins() const =0
void drawBinNumbers(RootPlotter2D *plotter)
const BinningBase & getBinning()

◆ drawBinNumbers() [2/2]

void HyperBinningPainter2D::drawBinNumbers ( RootPlotter2D plotter,
int  bin 
)
private

Draw bin number on a single bin

Definition at line 288 of file HyperBinningPainter2D.cpp.

288  {
290  TString label = ""; label += bin;
291  plotter->addText( label ,center.at(0), center.at(1), 2, 2, 0.02, 0);
292 
293 }
const double & at(int i) const
Definition: HyperPoint.cpp:433
void addText(TString text, double x, double y, int alignh=1, int alignv=2, double size=0.06, int ndc=true, int color=kBlack)
Definition: RootPlotter.cpp:33
HyperPoint getAverageCenter() const
const BinningBase & getBinning()
virtual HyperVolume getBinHyperVolume(int binNumber) const =0

◆ drawFilledBin() [1/3]

void HyperBinningPainter2D::drawFilledBin ( RootPlotter2D plotter,
int  bin,
bool  hashNeg = false 
)
private

add filled bins to the Plotter (for all HyperVolumes)

Definition at line 317 of file HyperBinningPainter2D.cpp.

317  {
318 
319  double binContent = _histogram->getBinContent(bin);
320  if (_density == true ) binContent = _histogram->getFrequencyDensity(bin);
321 
322  bool neg = false;
323  if (hashNeg == true && binContent < 0.0) {
324  binContent = -binContent;
325  neg = true;
326  }
327 
328  for (int i = 0; i < getBinning().getBinHyperVolume(bin).size(); i++){
329  HyperCuboid temp (getBinning().getBinHyperVolume(bin).getHyperCuboid(i));
330  drawFilledBin(plotter, &temp, binContent);
331  if (neg){
332  drawFilledBin(plotter, &temp, 1, 3344);
333  }
334  }
335 
336 }
int size() const
Definition: HyperVolume.h:60
double getBinContent(int bin) const
void drawFilledBin(RootPlotter2D *plotter, int bin, bool hashNeg=false)
double getFrequencyDensity(int bin) const
HyperHistogram * _histogram
const BinningBase & getBinning()
virtual HyperVolume getBinHyperVolume(int binNumber) const =0

◆ drawFilledBin() [2/3]

void HyperBinningPainter2D::drawFilledBin ( RootPlotter2D plotter,
HyperCuboid bin,
double  binContents 
)
private

add filled bins to the Plotter (for all HyperVolumes)

Definition at line 340 of file HyperBinningPainter2D.cpp.

340  {
341 
342  int fillColor = getFillColour(binContents);
343  int fillStyle = 1001;
344 
345  drawFilledBin(plotter, bin, fillColor, fillStyle);
346 
347 }
void drawFilledBin(RootPlotter2D *plotter, int bin, bool hashNeg=false)
int getFillColour(double binContents)

◆ drawFilledBin() [3/3]

void HyperBinningPainter2D::drawFilledBin ( RootPlotter2D plotter,
HyperCuboid bin,
int  fillColor,
int  fillStyle 
)
private

add filled bins to the Plotter (for all HyperVolumes)

Definition at line 350 of file HyperBinningPainter2D.cpp.

350  {
351 
352  TBox* box = new TBox(bin->getLowCorner().at(0) , bin->getLowCorner().at(1), bin->getHighCorner().at(0) , bin->getHighCorner().at(1));
353  box->SetFillColor( fillColor );
354  box->SetLineWidth(0.0);
355  box->SetFillStyle( fillStyle );
356  box->SetLineColor( fillColor );
357  plotter->addObject(box);
358 
359 }
void addObject(TObject *obj)
Definition: Plotter.cpp:168
const HyperPoint & getHighCorner() const
Definition: HyperCuboid.h:89
const double & at(int i) const
Definition: HyperPoint.cpp:433
const HyperPoint & getLowCorner() const
Definition: HyperCuboid.h:87

◆ drawFilledBins()

void HyperBinningPainter2D::drawFilledBins ( RootPlotter2D plotter,
bool  hashNeg = false 
)
private

add filled bins to the Plotter (for all HyperVolumes)

Definition at line 312 of file HyperBinningPainter2D.cpp.

312  {
313  for(int i = 0; i < getBinning().getNumBins(); i++) drawFilledBin(plotter, i, hashNeg);
314 }
virtual int getNumBins() const =0
void drawFilledBin(RootPlotter2D *plotter, int bin, bool hashNeg=false)
const BinningBase & getBinning()

◆ getBinning()

const BinningBase & HyperBinningPainter2D::getBinning ( )
private

get the binning (works for either constructor)

Definition at line 35 of file HyperBinningPainter2D.cpp.

35  {
36 
37  if (_binning != 0) return *_binning;
38  return _histogram->getBinning();
39 
40 }
HyperHistogram * _histogram
const BinningBase & getBinning() const

◆ getFillColour()

int HyperBinningPainter2D::getFillColour ( double  binContents)
private

Code stolen from the THistPainter - choose the colour to make the bin based on the colour scale of the TH2D

Definition at line 259 of file HyperBinningPainter2D.cpp.

259  {
260  double min = _histogram->getMin();
261  double max = _histogram->getMax();
262  if (_density == true){
263  min = _histogram->getMinDensity();
264  max = _histogram->getMaxDensity();
265  }
266 
267  if (binContents < min || binContents > max) return kWhite;
268 
269  int ndivz = gStyle->GetNumberContours();
270  double dz = max - min;
271  double scale = ndivz/dz;
272  int ncolors = gStyle->GetNumberOfColors();
273 
274  int color = int(0.01+(binContents-min)*scale);
275  int theColor = int((color+0.99)*double(ncolors)/double(ndivz));
276  if (theColor > ncolors-1) theColor = ncolors-1;
277 
278  return gStyle->GetColorPalette(theColor);
279 }
double getMaxDensity() const
double getMin() const
double getMax() const
HyperHistogram * _histogram
double getMinDensity() const

Member Data Documentation

◆ _binning

BinningBase* HyperBinningPainter2D::_binning
private

This gets filled in an alternate constructor (usually the HyperBinningHistogram get taken from the inhereted HyperBinningPainter class). This allows a HyperPointSet to be plotted on top of the HyperVolumeBinning

Definition at line 33 of file HyperBinningPainter2D.h.

◆ _hyperPoints

HyperPointSet* HyperBinningPainter2D::_hyperPoints
private

This gets filled in an alternate constructor (usually the HyperBinningHistogram get taken from the inhereted HyperBinningPainter class). This allows a HyperPointSet to be plotted on top of the HyperVolumeBinning

Definition at line 37 of file HyperBinningPainter2D.h.


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