BCHistogramBase.cxx
315 BCLog::OutWarning(Form("BCHistogramBase::CheckIntervals : interval out of bounds, removing %f", intervals[i]));
325 // warning: unique will not reliably remove all duplicates unless the vector has first been sorted.
330 BCLog::OutWarning(Form("BCHistogramBase::CheckIntervals : %lu duplicate interval values were removed.", old_size - intervals.size()));
351 void BCHistogramBase::GetNonzeroBinDensityMassVector(std::vector<std::pair<double, double> >& bin_dens_mass, int sort)
357 unsigned nbins = GetHistogram()->GetBin(GetHistogram()->GetNbinsX(), GetHistogram()->GetNbinsY(), GetHistogram()->GetNbinsZ());
364 if (!GetHistogram()->IsBinUnderflow(i) && !GetHistogram()->IsBinOverflow(i) && GetHistogram()->GetBinContent(i) > 0) {
371 double w = (bx > 0 ? GetHistogram()->GetXaxis()->GetBinWidth(bx) : 1) * (by > 0 ? GetHistogram()->GetYaxis()->GetBinWidth(by) : 1) * (bz > 0 ? GetHistogram()->GetZaxis()->GetBinWidth(bz) : 1);
376 std::stable_sort(bin_dens_mass.begin(), bin_dens_mass.end(), std::greater<std::pair<double, double> >());
378 std::stable_sort(bin_dens_mass.begin(), bin_dens_mass.end(), std::less<std::pair<double, double> >());
382 std::vector<std::pair<double, double> > BCHistogramBase::GetSmallestIntervalBounds(std::vector<double> masses, bool overcoverage)
431 std::vector<std::pair<double, double> >::iterator last = std::unique(levels.begin(), levels.end());
437 std::vector<double> BCHistogramBase::GetSmallestIntervalSize(std::vector<double> masses, bool overcoverage)
445 BCLog::OutWarning(Form("BCHistogramBase::GetSmallestIntervalSize : mass out of bounds, removing %f", masses[i]));
459 for (std::vector<std::pair<double, double> >::const_iterator bin = bin_dens_mass.begin(); bin != bin_dens_mass.end(); ++bin) {
499 // necessary because ROOT will otherwise draw space below zero for the errors---which we don't have
502 GetHistogram()->GetYaxis()->SetRangeUser(ymin, (gPad->GetLogy() ? 2 * ymax : ymax + 0.1 * (ymax - ymin)));
557 TArrow* arrow_mode = new TArrow(marker_mode->GetX(), (gPad->GetLogy() ? marker_mode->GetY()*pow(ymax / ymin, -1.5e-2) : marker_mode->GetY() + (ymax - ymin) * -1.5e-2),
558 marker_mode->GetX(), (gPad->GetLogy() ? ymin * pow(ymax / ymin, 4e-2) : ymin + (ymax - ymin) * 4e-2),
572 TArrow* arrow_mode2 = new TArrow((gPad->GetLogx() ? marker_mode->GetX()*pow(xmax / xmin, -1.5e-2) : marker_mode->GetX() + (xmax - xmin) * -1.5e-2), marker_mode->GetY(),
573 (gPad->GetLogx() ? xmin * pow(xmax / xmin, 4e-2) : xmin + (xmax - xmin) * 4e-2), marker_mode->GetY(),
613 TArrow* arrow_mode = new TArrow(marker_mode->GetX(), (gPad->GetLogy() ? marker_mode->GetY()*pow(ymax / ymin, -1.5e-2) : marker_mode->GetY() + (ymax - ymin) * -1.5e-2),
614 marker_mode->GetX(), (gPad->GetLogy() ? ymin * pow(ymax / ymin, 3e-2) : ymin + (ymax - ymin) * 3e-2),
628 TArrow* arrow_mode2 = new TArrow((gPad->GetLogx() ? marker_mode->GetX()*pow(xmax / xmin, -1.5e-2) : marker_mode->GetX() + (xmax - xmin) * -1.5e-2), marker_mode->GetY(),
629 (gPad->GetLogx() ? xmin * pow(xmax / xmin, 3e-2) : xmin + (xmax - xmin) * 3e-2), marker_mode->GetY(),
666 TArrow* arrow_std = new TArrow(marker_mean->GetX() - GetHistogram()->GetRMS(1), marker_mean->GetY(),
677 TArrow* arrow_std2 = new TArrow(marker_mean->GetX(), marker_mean->GetY() - GetHistogram()->GetRMS(2),
698 fLegend.SetX1(gPad->GetLeftMargin() + (1 - gPad->GetRightMargin() - gPad->GetLeftMargin()) * 10e-2);
705 fLegend.SetX1NDC(gPad->GetLeftMargin() + (1 - gPad->GetRightMargin() - gPad->GetLeftMargin()) * 10e-2);
715 TLegendEntry* BCHistogramBase::AddLegendEntry(TObject* obj, const std::string& label, const std::string& options)
728 TLegendEntry* BCHistogramBase::AddBandLegendEntry(TObject* obj, const std::string& label, const std::string& options)
746 fHistogram->GetYaxis()->SetRangeUser(ymin, ymax * (1.15 + fLegend.GetTextSize()*fLegend.GetNRows()) * 1.05);
friend void swap(BCHistogramBase &first, BCHistogramBase &second)
Swap function.
Definition: BCHistogramBase.cxx:140
BCHistogramBase & operator=(BCHistogramBase other)
Assignment operator.
Definition: BCHistogramBase.cxx:131
virtual void DrawMarkers()
Draw markers (global mode, local mode, etc.).
Definition: BCHistogramBase.cxx:522
T * OwnClone(const T *o)
Create a clone of the input but avoid registering the object with ROOT so it cannot be deleted twice...
Definition: BCAux.h:189
virtual std::vector< double > GetSmallestIntervalSize(std::vector< double > masses, bool overcoverage=true)
Get smallest interval sizes in dimensions of histogram: length (1D), area (2D), volume (3D)...
Definition: BCHistogramBase.cxx:437
TLegendEntry * AddLegendEntry(TObject *obj, const std::string &label, const std::string &options)
Add legend entry, checking first for unused extra entries.
Definition: BCHistogramBase.cxx:715
virtual void CheckIntervals(std::vector< double > &intervals, int sort)
Check intervals: remove values below 0 or above 1.
Definition: BCHistogramBase.cxx:310
void GetNonzeroBinDensityMassVector(std::vector< std::pair< double, double > > &bin_dens_mass, int sort=-1)
Fill vector with values and integrals of nonzero bins sorted by value.
Definition: BCHistogramBase.cxx:351
virtual void CopyOptions(const BCHistogramBase &other)
Copy options from.
Definition: BCHistogramBase.cxx:97
std::vector< std::pair< double, double > > GetSmallestIntervalBounds(std::vector< double > masses, bool overcoverage=true)
Get probability density levels bounding from below the smallest-interval levels with probability mass...
Definition: BCHistogramBase.cxx:382
void Smooth(int n=-1)
Applying ROOT smoothing to histogram, and renormalize.
Definition: BCHistogramBase.cxx:291
BCHistogramBase(const TH1 *const hist=0, int dimension=0)
The default constructor.
Definition: BCHistogramBase.cxx:32
virtual void SetHistogram(const TH1 *const hist)
Sets the histogram.
Definition: BCHistogramBase.cxx:194
virtual void SetColorScheme(BCHColorScheme scheme)
Sets the color scheme.
Definition: BCHistogramBase.cxx:232
virtual std::vector< double > DefaultIntervals(int nbands=-1)
Return default intervals.
Definition: BCHistogramBase.cxx:334
int fGlobalModeMarkerStyle
Holds option for global-mode marker style.
Definition: BCHistogramBase.h:704
virtual double ResizeLegend()
Resize legend and set it for placement at the top of the pad.
Definition: BCHistogramBase.cxx:695
virtual bool Valid() const
Whether histogram has been set and filled.
Definition: BCHistogramBase.cxx:226
int GetMarkerColor() const
Returns the marker colors (used for mean, median, and mode.
Definition: BCHistogramBase.h:177
std::vector< TLegendEntry * > fExtraLegendEntries
Storage for unused legend entries (for use with multicolumn legends).
Definition: BCHistogramBase.h:756
int fLocalModeMarkerStyle
Holds option for local-mode marker style.
Definition: BCHistogramBase.h:716
unsigned fNSmooth
Number of times to smooth histogram using ROOT's smooth function.
Definition: BCHistogramBase.h:692
void SetMarkerColor(int c)
Set marker color (used for mean, median, and mode).
Definition: BCHistogramBase.h:379
TLegendEntry * AddBandLegendEntry(TObject *obj, const std::string &label, const std::string &options)
Add band legend entry, creating unused extra entries if necessary.
Definition: BCHistogramBase.cxx:728