HyperPlot
v1
Bin and visualise multidimensional datasets
|
HyperPlot, Author: Sam Harnew, sam.h , Date: Dec 2015 arne w@gma il.c om
HyperBinningDiskRes is a binning scheme where each bin volume is defined by a HyperVolume.
Finding the correct bin number is quite a compuationally slow process if one has to loop over every bin and check if a HyperPoint falls within that bin volume. It's not unusual to have millions of HyperPoints that need to be sorted into tens of thousands of bins. This would require billions of calulations. To speed this process up there is the option to build a hierarchy of bins. A schematic below shows a 1D example.
Imagine we have a HyperPoint that falls into Bin 0. One would first check if it falls into HyperVolume 0 (note the distiction here between Bin/HyperVolume Numbers as indicated by the figure). First we check if it falls into HyperVolume 0, then HyperVolume 1 or 2, then HyperVolume 3 or 4, then HyperVolume 7 or 8.
In this simple example, it took 7 operations, whereas checking each Bin would have taken
The
Definition at line 81 of file HyperBinningDiskRes.h.
#include <HyperBinningDiskRes.h>
Public Member Functions | |
HyperBinningDiskRes () | |
HyperBinningDiskRes (const HyperBinningDiskRes &other) | |
virtual | ~HyperBinningDiskRes () |
virtual void | reserveCapacity (int nElements) |
virtual void | setDimension (int dim) |
virtual void | addPrimaryVolumeNumber (int volumeNumber) |
virtual bool | addHyperVolume (const HyperVolume &hyperVolume, std::vector< int > linkedVolumes=std::vector< int >(0, 0)) |
virtual int | getNumHyperVolumes () const |
virtual HyperVolume | getHyperVolume (int volumeNumber) const |
Get a HyperVolume from its volume number. More... | |
virtual std::vector< int > | getLinkedHyperVolumes (int volumeNumber) const |
virtual int | getNumPrimaryVolumes () const |
virtual int | getPrimaryVolumeNumber (int i) const |
virtual bool | isDiskResident () const |
virtual TString | filename () const |
virtual void | load (TString filename, TString option="READ") |
virtual BinningBase * | clone () const |
Create a clone of the object and return a pointer to it. | |
Public Member Functions inherited from HyperBinning | |
HyperBinning () | |
The only constructor. | |
bool | isPrimaryVolume (int volumeNumber) const |
int | getHyperVolumeNumber (int binNumber) const |
int | getBinNum (int volumeNumber) const |
virtual std::vector< int > | getPrimaryVolumeNumbers () const |
virtual | ~HyperBinning () |
virtual void | save (TString filename) const |
virtual void | save () const |
virtual void | mergeBinnings (const BinningBase &other) |
virtual int | getNumBins () const |
virtual int | getBinNum (const HyperPoint &coords) const |
virtual std::vector< int > | getBinNum (const HyperPointSet &coords) const |
std::vector< int > | getBinNumAlt (const HyperPointSet &coords) const |
virtual HyperVolume | getBinHyperVolume (int binNumber) const |
virtual HyperPoint | getAverageBinWidth () const |
virtual HyperCuboid | getLimits () const |
Public Member Functions inherited from BinningBase | |
void | setNames (HyperName names) |
HyperName | getNames () const |
const int & | getDimension () const |
double | getMin (int dimension) const |
double | getMax (int dimension) const |
TString | getBinningType () const |
bool | isSameBinningType (const BinningBase &other) const |
Protected Member Functions | |
void | getEntry (int volumeNumber) const |
void | loadHyperBinningTree () |
void | loadPrimaryVolumeTree () |
void | createHyperBinningTree () |
void | createPrimaryVolumeTree () |
Protected Member Functions inherited from HyperBinning | |
int | followBinLinks (const HyperPoint &coords, int binNumber) const |
void | updateCash () const |
void | updateBinNumbering () const |
void | updateAverageBinWidth () const |
void | updateMinMax () const |
int | getHyperBinningDimFromTree (TTree *tree) |
void | createBranches (TTree *tree, int *binNumber, double *lowCorner, double *highCorner, std::vector< int > **linkedBins) const |
void | saveHyperVolumeToTree (TTree *tree, double *lowCorner, double *highCorner, const HyperVolume &hyperVolume) const |
void | savePrimaryVolumeNumbers () const |
Protected Member Functions inherited from BinningBase | |
void | setBinningType (TString binningType) |
Private Attributes | |
TFile * | _file |
bool | _writeable |
TTree * | _tree |
HyperCuboid | _cuboid |
std::vector< int > * | _linkedBins |
int | _volumeNumber |
int | _currentEntry |
TTree * | _treePrimVol |
int | _primVolNum |
HyperBinningDiskRes::HyperBinningDiskRes | ( | ) |
The empty constuctor. Must call the load function to associate this object to a file
Definition at line 6 of file HyperBinningDiskRes.cpp.
HyperBinningDiskRes::HyperBinningDiskRes | ( | const HyperBinningDiskRes & | other | ) |
The copy constuctor. Essentially just calls the empty constuctor, then loads from the same file as the other binning.
Definition at line 22 of file HyperBinningDiskRes.cpp.
|
virtual |
Destructor
Definition at line 334 of file HyperBinningDiskRes.cpp.
|
virtual |
Add a HyperVolume and its linked bins to the HyperBinning
Implements HyperBinning.
Definition at line 133 of file HyperBinningDiskRes.cpp.
|
virtual |
Add a primary volume number
Implements HyperBinning.
Definition at line 104 of file HyperBinningDiskRes.cpp.
|
protected |
Get a HyperVolume from the tree and load it into memory
Definition at line 55 of file HyperBinningDiskRes.cpp.
|
virtual |
Get a HyperVolume from its volume number.
get one of the HyperVolumes
Implements HyperBinning.
Definition at line 67 of file HyperBinningDiskRes.cpp.
|
virtual |
Get all HyperVolumes linked to a specific volume number i.e. from the binning hiearcy
Implements HyperBinning.
Definition at line 74 of file HyperBinningDiskRes.cpp.
|
virtual |
Get the number of HyperVolumes (this is not the number of bins)
Implements HyperBinning.
Definition at line 123 of file HyperBinningDiskRes.cpp.
|
virtual |
Get the number of primary volumes
Implements HyperBinning.
Definition at line 169 of file HyperBinningDiskRes.cpp.
|
virtual |
Get the primary volume numbers
Implements HyperBinning.
Definition at line 176 of file HyperBinningDiskRes.cpp.
|
virtual |
Load HyperBinningDiskRes from a file
Implements HyperBinning.
Definition at line 279 of file HyperBinningDiskRes.cpp.
|
virtual |
Set the dimension of the HyperBinningDiskRes. This can only be called once, when it is known what the dimension is i.e. either when loading from a file, or the first time a HyperVolume is added to an empty file
Reimplemented from HyperBinning.
Definition at line 44 of file HyperBinningDiskRes.cpp.