MINT2
HyperBinningPainter.cpp
Go to the documentation of this file.
2 
5  _histogram(histogram),
6  _density(false)
7 {
8  WELCOME_LOG << "Good day from the HyperBinningPainter() Constructor";
9 }
10 
12 void HyperBinningPainter::draw(TString path, TString option){
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 }
87 
88 }
89 
90 
virtual void draw(TString path="", TString option="")
double getBinError(int bin) const
int getNBins() const
Definition: HistogramBase.h:63
HyperBinningPainter(HyperHistogram *histogram)
double getBinContent(int bin) const
virtual void plot(TString plotDirectory, TString plotOptions="", TPad *pad=0, double scaleFactor=1.0)
HyperHistogram * _histogram
double volume() const
#define WELCOME_LOG
const BinningBase & getBinning() const
virtual HyperVolume getBinHyperVolume(int binNumber) const =0