HyperPlot  v1
Bin and visualise multidimensional datasets
Public Member Functions | Private Member Functions | Private Attributes | List of all members
HyperBinningMakerPhaseBinning Class Reference

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

This algorithm takes a HyperFunction which describes some kind of phase motion i.e. map from R^n -> [-pi, pi]. In the final HyperVolumeBinning, each HyperVolume gets assigned a bin number depending on the phase at that HyperVolume center. The range [ -pi, pi ] is split uniformly into a given number of bin pairs (so total bins = bin pairs x 2 ). The numbering of bins is like so...

[ -pi, pi ] -> [ -_numBinPairs, ..., -1, +1, ... , +_numBinPairs ]

The algorithm tries to split HyperVolumes such that the bin number does not change within the HyperVolumes limits.

Definition at line 38 of file HyperBinningMakerPhaseBinning.h.

#include <HyperBinningMakerPhaseBinning.h>

Inheritance diagram for HyperBinningMakerPhaseBinning:
HyperBinningMaker

Public Member Functions

 HyperBinningMakerPhaseBinning (const HyperCuboid &binningRange, HyperFunction *func)
 
virtual void makeBinning ()
 
void setNumBinPairs (int binpairs)
 
void setBinEdges (std::vector< double > binEdges)
 
virtual int gradientSplitAll ()
 
 ~HyperBinningMakerPhaseBinning ()
 
- Public Member Functions inherited from HyperBinningMaker
 HyperBinningMaker (const HyperCuboid &binningRange, const HyperPointSet &data)
 
void setBinningDimensions (std::vector< int > dims)
 
void addShadowHyperPointSet (const HyperPointSet &data)
 
void setSeed (int seed)
 
void useSnapToGrid (bool val)
 
void setGridMultiplier (HyperPoint &multipliers)
 
void setGridMultiplier (double multiplier)
 
void useEventWeights (bool val=true)
 
void setMinimumBinContent (double val)
 
void setShadowMinimumBinContent (double val)
 
void setMinimumEdgeLength (double val)
 
void setMinimumEdgeLength (HyperPoint val)
 
void setHyperFunction (HyperFunction *fnc)
 Set the HyperFunction - only used by some binning Algs.
 
void drawAfterEachIteration (TString path)
 
void setNames (HyperName names)
 
int & getGlobalVolumeStatus (int volumeNumber)
 
int & getDimensionSpecificVolumeStatus (int volumeNumber, int dimension)
 
const int & getGlobalVolumeStatus (int volumeNumber) const
 
const int & getDimensionSpecificVolumeStatus (int volumeNumber, int dimension) const
 
int getNumContinueBins (int dimension=-1) const
 
int getNumBins () const
 
int getNumHyperVolumes () const
 
int split (int volumeNumber, int dimension, double splitPoint)
 
HyperCuboid splitBelowPoint (int dim, double splitPoint, const HyperCuboid &original) const
 
HyperCuboid splitAbovePoint (int dim, double splitPoint, const HyperCuboid &original) const
 
double getSumOfWeights (const HyperPointSet &hyperPointSet) const
 
double getWeight (const HyperPoint &hyperPoint) const
 
bool isValidBinningDimension (int dimension)
 
virtual bool passFunctionCriteria (HyperCuboid &cuboid1, HyperCuboid &cuboid2)
 
HyperPointSet filterHyperPointSet (const HyperPointSet &hyperPointSet, const HyperCuboid &hyperCuboid, bool print=false) const
 
void addBin (const HyperCuboid &hyperCuboid, const HyperPointSet &hyperPointSet, const HyperPointSet &shadowHyperPointSet, int status)
 
void setDimSpecStatusFromMinBinWidths (int volumeNumber)
 
void updateGlobalStatusFromDimSpecific (int volumeNumber)
 
bool snapToGrid (const HyperCuboid &cuboid, int dimension, double &splitCoord) const
 
virtual void startedAlgorithm ()
 
virtual void startedIteration ()
 
void drawCurrentState (TString path) const
 
virtual void finishedIteration ()
 
virtual void finishedAlgorithm ()
 
HyperBinningMemRes getHyperVolumeBinning () const
 
HyperHistogramgetHyperBinningHistogram () const
 
HyperHistogramgetShadowHyperBinningHistogram () const
 
HyperHistogramgetRatioHyperBinningHistogram () const
 
virtual ~HyperBinningMaker ()
 destructor
 
double countEventsBelowSplitPoint (int binNumber, int dimension, double splitPoint) const
 
double countEventsInHyperCuboid (const HyperPointSet &hyperPointSet, const HyperCuboid &hyperCuboid) const
 
double countShadowEventsBelowSplitPoint (int binNumber, int dimension, double splitPoint) const
 
double findSmartSplitPoint (int binNumber, int dimension, double dataFraction) const
 
int smartSplit (int binNumber, int dimension, double dataFraction)
 
int smartSplitAll (int dimension, double dataFraction)
 
int smartSplitAllRandomise (double dataFraction=0.5)
 
int smartMultiSplit (int binNumber, int dimension, int parts)
 
int smartMultiSplit (int binNumber, int dimension)
 
int smartMultiSplitAll (int dimension)
 
double findSmartSplitPointInt (int binNumber, int dimension, double dataFraction) const
 
int smartSplitInt (int binNumber, int dimension, double dataFraction)
 
int smartSplitAllInt (int dimension, double dataFraction)
 
int splitAll (int dimension, double splitPoint)
 
int splitAllRandomise (double splitPoint=0.5)
 
int likelihoodSplit (int binNumber)
 
int likelihoodSplitAll ()
 
int smartLikelihoodSplit (int binNumber)
 
int smartLikelihoodSplitAll ()
 
void getSplitToMinNeg2LLH (double &split, double &sig, int binNumber, int dimension, bool useConstraints=true)
 
void getDimWithLargestSplitSignificance (int &dim, double &split, int binNumber, bool useConstraints=true)
 
TH1D * scanSig (int binNumber, int dimension, int nbins, bool useConstraints=true)
 
double neg2LLH (int binNumber, int dimension, double splitPoint, bool useConstraints=true)
 
double nullNeg2LLH (int binNumber)
 

Private Member Functions

int splitByCoord (int volumeNumber, int dimension, HyperPoint &coord)
 
int getBinNumFromFunc (HyperPoint &point)
 
int getBinNumFromFuncVal (double phase)
 
double getLowBinBoundary (double phase)
 
double getHighBinBoundary (double phase)
 
double closestBinBoundary (double val)
 
HyperPoint getGrad (HyperPoint &point)
 
HyperPoint getGradPos (HyperPoint &point, double funcValAtPoint)
 
double getSecondDerivative (HyperPoint &point, HyperPoint &vector, double funcValAtPoint, double &deriv)
 
int splitDimFromGrad (int volumeNumber, HyperPoint gradient)
 
virtual int gradientSplit (int binNumber, int &dimension)
 
int systematicSplit (int volumeNumber, int dimension, double valAtCenter, HyperPoint gradient)
 
HyperPointSet getSplitCorners (int volumeNumber)
 
HyperPointSet getSplitFaces (int volumeNumber)
 
HyperPointSet getSplitEdges (int volumeNumber)
 
HyperPoint orderAndTestSplitPoints (HyperPointSet &points, HyperPoint &point, double valAtPoint, HyperPoint gradient)
 
int randomWalkSplit (int volumeNumber, int dimension)
 
void walkOrthogonal (HyperPoint &point, HyperCuboid &walkLimits)
 
void walk (HyperPoint &point, HyperCuboid &walkLimits)
 

Private Attributes

int _numBinPairs
 
CyclicPhaseBins _binEdges
 
int _maximumRandWalks
 
int _numWalkers
 
double _walkSizeFrac
 
int _numberOfSystematicSplits
 
int _numberOfGradientSplits
 

Additional Inherited Members

- Static Public Member Functions inherited from HyperBinningMaker
static void setOutputLevel (bool val)
 
- Protected Types inherited from HyperBinningMaker
enum  VolumeStatus { DONE, CONTINUE }
 
- Protected Attributes inherited from HyperBinningMaker
std::vector< HyperCuboid_hyperCuboids
 
std::vector< std::vector< int > > _linkedBins
 
std::vector< HyperPointSet_hyperPointSets
 
std::vector< HyperPointSet_shadowHyperPointSets
 
std::vector< int > _status
 
std::vector< std::vector< int > > _dimSpecificStatus
 
std::vector< int > _binningDimensions
 
bool _shadowAdded
 
bool _useEventWeights
 
double _minimumBinContent
 
double _shadowMinimumBinContent
 
HyperPoint _minimumEdgeLength
 
TRandom * _random
 
bool _drawAlgorithm
 
TString _drawAlgorithmDir
 
int _iterationNum
 
HyperName _names
 
HyperFunction_func
 
bool _snapToGrid
 
HyperPoint _gridMultiplier
 
- Static Protected Attributes inherited from HyperBinningMaker
static bool s_printBinning = true
 

Constructor & Destructor Documentation

HyperBinningMakerPhaseBinning::HyperBinningMakerPhaseBinning ( const HyperCuboid binningRange,
HyperFunction func 
)

Constructor that initiates the base class HyperBinningMaker

Definition at line 9 of file HyperBinningMakerPhaseBinning.cpp.

HyperBinningMakerPhaseBinning::~HyperBinningMakerPhaseBinning ( )

Destructor

Definition at line 1021 of file HyperBinningMakerPhaseBinning.cpp.

Member Function Documentation

double HyperBinningMakerPhaseBinning::closestBinBoundary ( double  val)
private

For a given phase, determine the closest bin boundary (as a phase)

Definition at line 183 of file HyperBinningMakerPhaseBinning.cpp.

int HyperBinningMakerPhaseBinning::getBinNumFromFunc ( HyperPoint point)
private

For a given HyperPoint, get the bin number

Definition at line 197 of file HyperBinningMakerPhaseBinning.cpp.

int HyperBinningMakerPhaseBinning::getBinNumFromFuncVal ( double  phase)
private

For a given phase, get the bin number

Definition at line 163 of file HyperBinningMakerPhaseBinning.cpp.

HyperPoint HyperBinningMakerPhaseBinning::getGrad ( HyperPoint point)
private

Evaluate the gradient at a given point. Step length is the minimium edge length. Function is evaluated at (x+h and x-h)

Definition at line 203 of file HyperBinningMakerPhaseBinning.cpp.

HyperPoint HyperBinningMakerPhaseBinning::getGradPos ( HyperPoint point,
double  funcValAtPoint 
)
private

Evaluate the gradient at a given point. Step length is the minimium edge length. Function is evaluated at (x+h) only

Definition at line 230 of file HyperBinningMakerPhaseBinning.cpp.

double HyperBinningMakerPhaseBinning::getHighBinBoundary ( double  phase)
private

For a given bin, get the upper phase boundary

Definition at line 177 of file HyperBinningMakerPhaseBinning.cpp.

double HyperBinningMakerPhaseBinning::getLowBinBoundary ( double  phase)
private

For a given bin, get the lower phase boundary

Definition at line 171 of file HyperBinningMakerPhaseBinning.cpp.

double HyperBinningMakerPhaseBinning::getSecondDerivative ( HyperPoint point,
HyperPoint vector,
double  funcValAtPoint,
double &  deriv 
)
private

Evaluate the second and first derivative in a given direction at a given point

Definition at line 255 of file HyperBinningMakerPhaseBinning.cpp.

HyperPointSet HyperBinningMakerPhaseBinning::getSplitCorners ( int  volumeNumber)
private

Get a list of all the corners of the volume number given

Definition at line 328 of file HyperBinningMakerPhaseBinning.cpp.

HyperPointSet HyperBinningMakerPhaseBinning::getSplitEdges ( int  volumeNumber)
private

Get a list of all the edge centers of the volume number given

Definition at line 444 of file HyperBinningMakerPhaseBinning.cpp.

HyperPointSet HyperBinningMakerPhaseBinning::getSplitFaces ( int  volumeNumber)
private

Get a list of all the face centers of the volume number given

Definition at line 395 of file HyperBinningMakerPhaseBinning.cpp.

int HyperBinningMakerPhaseBinning::gradientSplit ( int  binNumber,
int &  dimension 
)
privatevirtual

The default split method. It uses the gradient of the function to predict where the boundary wetween two bin numbers is. If it fails, it will call the systematic split instead

Definition at line 699 of file HyperBinningMakerPhaseBinning.cpp.

void HyperBinningMakerPhaseBinning::makeBinning ( )
virtual

run the algorithm

Implements HyperBinningMaker.

Definition at line 23 of file HyperBinningMakerPhaseBinning.cpp.

HyperPoint HyperBinningMakerPhaseBinning::orderAndTestSplitPoints ( HyperPointSet points,
HyperPoint point,
double  valAtPoint,
HyperPoint  gradient 
)
private

See systematicSplit for a full description.

Definition at line 526 of file HyperBinningMakerPhaseBinning.cpp.

int HyperBinningMakerPhaseBinning::randomWalkSplit ( int  volumeNumber,
int  dimension 
)
private

Do random walk within the HyperVolume to search for a point where the bin number changes. Not really used anymore.

Definition at line 900 of file HyperBinningMakerPhaseBinning.cpp.

void HyperBinningMakerPhaseBinning::setBinEdges ( std::vector< double >  binEdges)

set the bin edges - the highest bin edge is the lowest + pi, so only nBinPair edges need to be passed

Definition at line 157 of file HyperBinningMakerPhaseBinning.cpp.

void HyperBinningMakerPhaseBinning::setNumBinPairs ( int  binpairs)

set the number of bin pairs (see class description of details)

Definition at line 146 of file HyperBinningMakerPhaseBinning.cpp.

int HyperBinningMakerPhaseBinning::splitByCoord ( int  volumeNumber,
int  dimension,
HyperPoint coord 
)
private

Split a HyperVolume in a given dimension at a given coord

Definition at line 136 of file HyperBinningMakerPhaseBinning.cpp.

int HyperBinningMakerPhaseBinning::splitDimFromGrad ( int  volumeNumber,
HyperPoint  gradient 
)
private

Use the graident at the center of the given volume number to decide what dimension to split in.

Definition at line 295 of file HyperBinningMakerPhaseBinning.cpp.

int HyperBinningMakerPhaseBinning::systematicSplit ( int  volumeNumber,
int  dimension,
double  valAtCenter,
HyperPoint  gradient 
)
private

This function looks at the function value at specific points within the HyperVolume. It uses the corners of the HyperVolume, a point in the middle of each face (NPlane), and a point in the middle of each edge. If the bin number changes at any of these points, it will result in the bin being split. To speed things up it uses the gradient at the HyperVolume center to order the points, on which are most liekly to result in a successful split. While looping through the points it estimates the uncertainty of the function estimate (from the graient). If the estimate indicates that the function is more than 5 sigma from a bin split, it will skip that point (and all remaining points since they are ordered)

Definition at line 633 of file HyperBinningMakerPhaseBinning.cpp.

void HyperBinningMakerPhaseBinning::walk ( HyperPoint point,
HyperCuboid walkLimits 
)
private

Do a random walk in a random dimension (within the walk limits)

Definition at line 113 of file HyperBinningMakerPhaseBinning.cpp.

void HyperBinningMakerPhaseBinning::walkOrthogonal ( HyperPoint point,
HyperCuboid walkLimits 
)
private

Do a random walk in one dimension (within the walk limits)

Definition at line 92 of file HyperBinningMakerPhaseBinning.cpp.


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