MINT2
|
#include <HyperBinningMemRes.h>
Public Member Functions | |
HyperBinningMemRes () | |
The only constructor. More... | |
virtual | ~HyperBinningMemRes () |
virtual void | reserveCapacity (int nElements) |
virtual std::vector< int > | getPrimaryVolumeNumbers () const |
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 |
virtual std::vector< int > | getLinkedHyperVolumes (int volumeNumber) const |
virtual int | getNumPrimaryVolumes () const |
virtual int | getPrimaryVolumeNumber (int i) const |
virtual void | load (TString filename, TString option="READ") |
virtual BinningBase * | clone () const |
Public Member Functions inherited from HyperBinning | |
HyperBinning () | |
The only constructor. More... | |
bool | isPrimaryVolume (int volumeNumber) const |
int | getHyperVolumeNumber (int binNumber) const |
int | getBinNum (int volumeNumber) 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 | |
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 |
virtual bool | isDiskResident () const |
virtual TString | filename () const |
virtual | ~BinningBase () |
Protected Member Functions | |
void | setBranchAddresses (TTree *tree, int *binNumber, double *lowCorner, double *highCorner, std::vector< int > **linkedBins) const |
void | loadPrimaryVolumeNumbers (TFile *file) |
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) |
Protected Attributes | |
std::vector< HyperVolume > | _hyperVolumes |
std::vector< int > | _primaryVolumeNumbers |
std::vector< std::vector< int > > | _linkedHyperVolumes |
HyperPlot, Author: Sam Harnew, sam.h , Date: Dec 2015 arne w@gma il.c om
HyperBinningMemRes 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 80 of file HyperBinningMemRes.h.
HyperBinningMemRes::HyperBinningMemRes | ( | ) |
|
virtual |
|
virtual |
Add a HyperVolume to the HyperBinningMemRes and add a set of empty HyperVolume links.
Implements HyperBinning.
Definition at line 65 of file HyperBinningMemRes.cpp.
|
virtual |
Add a primary volume number
Implements HyperBinning.
Definition at line 41 of file HyperBinningMemRes.cpp.
|
virtual |
Implements HyperBinning.
Definition at line 31 of file HyperBinningMemRes.cpp.
|
virtual |
get one of the HyperVolumes
Implements HyperBinning.
Definition at line 127 of file HyperBinningMemRes.cpp.
|
virtual |
Implements HyperBinning.
Definition at line 24 of file HyperBinningMemRes.cpp.
|
virtual |
get the number of HyperVolumes
Implements HyperBinning.
Definition at line 49 of file HyperBinningMemRes.cpp.
|
virtual |
Implements HyperBinning.
Definition at line 55 of file HyperBinningMemRes.cpp.
|
virtual |
Implements HyperBinning.
Definition at line 59 of file HyperBinningMemRes.cpp.
|
virtual |
Look at the tree that contains the HyperBinningMemRes and find the dimensionality
Reimplemented from HyperBinning.
Definition at line 134 of file HyperBinningMemRes.cpp.
|
virtual |
Load HyperBinningMemRes from a file
Implements HyperBinning.
Definition at line 141 of file HyperBinningMemRes.cpp.
|
protected |
Save the list of Primary Volume Numbers to the open (and in scope) TFile.
Definition at line 89 of file HyperBinningMemRes.cpp.
|
virtual |
Reimplemented from HyperBinning.
Definition at line 246 of file HyperBinningMemRes.cpp.
|
protected |
Set branch addresses for loading HyperBinningMemRes from a file.
Definition at line 113 of file HyperBinningMemRes.cpp.
|
virtual |
Set the dimension of the HyperBinningMemRes. This can only be called once, when it is known what dimesnion it is.
Reimplemented from HyperBinning.
Definition at line 15 of file HyperBinningMemRes.cpp.
|
protected |
std::vector containing all of the HyperVolumes. Usually, not all of these are bins, but part of the bin hierarchy that is discussed in the class description.
Definition at line 84 of file HyperBinningMemRes.h.
|
protected |
Every HyperVolume has a _linkedHyperVolumes - if this is empty, this means the HyperVolume is a true Bin. If not it is part of the binning hierarchy. In the below, HyperVolume 0 would be linked to HyperVolume [1,2], although HyperVolume 4 would be linked to nothing.
Definition at line 116 of file HyperBinningMemRes.h.
|
protected |
Usually all bins will be accessed through one primary volume i.e. volume 0 in the below example. If one wants to merge two binning schemes together e.g. Binning1 and Binning2 this involes appending the list of HyperVolumes from Binning2 to Binning1. This brings a problem when trying to sort a HyperPoint into a specific bin i.e. getBinNumber(HyperPoint) - if it belongs to Binning2, it will first have to check that it doesn't fall into any of the volumes in Binning1.
To remedy this problem we introduce the list of primary volumes. If this list exists i.e. its size is greater than 0, all the primary volumes will be checked first. The existance of this list also implies that ALL volumes are linked to the primary volumes.
HyperVolume Numbers
|----------—0----------—|
|---—1---—|---—2---—|
|–3—|—4–|—5—|–6–|
|-7-|-8|
Definition at line 90 of file HyperBinningMemRes.h.