|
ndmspc
v1.2.0-0.1.rc3
|
NBinning object for managing multi-dimensional binning and axis definitions. More...
#include <NBinning.h>
Public Member Functions | |
| NBinning () | |
| Default constructor. More... | |
| NBinning (TObjArray *axes) | |
| Constructor from TObjArray of axes. More... | |
| NBinning (std::vector< TAxis * > axes) | |
| Constructor from vector of TAxis pointers. More... | |
| virtual | ~NBinning () |
| Destructor. More... | |
| void | Initialize () |
| Initialize the binning object. More... | |
| void | Reset () |
| Reset the binning object to initial state. More... | |
| virtual void | Print (Option_t *option="") const |
| Print binning information. More... | |
| void | PrintContent (Option_t *option="") const |
| Print binning content. More... | |
| Long64_t | FillAll (NBinningDef *def=nullptr) |
| Fill all bins according to definition. More... | |
| std::vector< std::vector< int > > | GetCoordsRange (std::vector< int > c) const |
| Get coordinate ranges for given coordinates. More... | |
| std::vector< std::vector< int > > | GetAxisRanges (std::vector< int > c) const |
| Get axis ranges for given coordinates. More... | |
| bool | GetAxisRange (size_t axisId, double &min, double &max, std::vector< int > c) const |
| Get axis range for a specific axis and coordinates. More... | |
| bool | GetAxisRangeInBase (size_t axisId, int &min, int &max, std::vector< int > c) const |
| Get axis range in base for a specific axis and coordinates. More... | |
| TObjArray * | GenerateListOfAxes () |
| Generate a list of axes as TObjArray. More... | |
| std::vector< int > | GetAxisBinning (size_t axisId, const std::vector< int > &c) const |
| Get binning for a specific axis and coordinates. More... | |
| std::vector< int > | GetAxisIndexes (AxisType type) const |
| Get indexes of axes by type. More... | |
| std::vector< int > | GetAxisIndexesByNames (std::vector< std::string > axisNames) const |
| Get axis indexes by axis names. More... | |
| std::vector< std::string > | GetAxisNamesByType (AxisType type) const |
| Get axis names by type. More... | |
| std::vector< std::string > | GetAxisNamesByIndexes (std::vector< int > axisIds) const |
| Get axis names by indexes. More... | |
| bool | AddBinning (size_t id, std::vector< int > binning, size_t n=1) |
| Add binning for a specific axis. More... | |
| bool | AddBinningVariable (size_t id, std::vector< int > mins) |
| Add variable binning for a specific axis. More... | |
| bool | AddBinningViaBinWidths (size_t id, std::vector< std::vector< int >> widths) |
| Add binning via bin widths for a specific axis. More... | |
| bool | SetAxisType (size_t id, AxisType type) |
| Set axis type for a specific axis. More... | |
| THnSparse * | GetMap () const |
| Get the mapping histogram. More... | |
| THnSparse * | GetContent () const |
| Get the content histogram. More... | |
| std::vector< TAxis * > | GetAxes () const |
| Get vector of axis pointers. More... | |
| std::vector< TAxis * > | GetAxesByType (AxisType type) const |
| Get axes by type. More... | |
| Binning | GetBinningType (size_t i) const |
| Get binning type for a specific axis. More... | |
| AxisType | GetAxisType (size_t i) const |
| Get axis type for a specific axis. More... | |
| char | GetAxisTypeChar (size_t i) const |
| Get axis type as character for a specific axis. More... | |
| NBinningDef * | GetDefinition (const std::string &name="") |
| Get binning definition by name. More... | |
| std::map< std::string, NBinningDef * > | GetDefinitions () const |
| Get all binning definitions. More... | |
| std::vector< std::string > | GetDefinitionNames () const |
| Get all definition names. More... | |
| std::string | GetCurrentDefinitionName () const |
| Get current definition name. More... | |
| void | SetCurrentDefinitionName (const std::string &name) |
| Set current definition name. More... | |
| void | AddBinningDefinition (std::string name, std::map< std::string, std::vector< std::vector< int >>> binning, bool forceDefault=false) |
| Add a binning definition. More... | |
| NBinningPoint * | GetPoint () |
| Get the current binning point. More... | |
| NBinningPoint * | GetPoint (size_t id, const std::string binning="") |
| Get binning point for a specific axis and binning. More... | |
| void | SetPoint (NBinningPoint *point) |
| Set the current binning point. More... | |
| bool | SetCfg (const json &cfg) |
| Set configuration from JSON. More... | |
Private Attributes | |
| THnSparse * | fMap {nullptr} |
| Mapping histogram. | |
| THnSparse * | fContent {nullptr} |
| Content histogram. | |
| std::vector< TAxis * > | fAxes |
| List of axes. | |
| std::vector< Binning > | fBinningTypes |
| Binning types. | |
| std::vector< AxisType > | fAxisTypes |
| Axis types. | |
| std::string | fCurrentDefinitionName {""} |
| Current definition name. | |
| std::map< std::string, NBinningDef * > | fDefinitions |
| Binning definitions. | |
| std::vector< std::string > | fDefinitionNames |
| Binning definition names. | |
| NBinningPoint * | fPoint {nullptr} |
| ! Binning point object | |
NBinning object for managing multi-dimensional binning and axis definitions.
Provides methods for axis management, binning definitions, mapping, and content handling. Supports fixed and variable binning, user-defined axes, and integration with THnSparse histograms.
Definition at line 45 of file NBinning.h.
| Ndmspc::NBinning::NBinning | ( | ) |
| Ndmspc::NBinning::NBinning | ( | TObjArray * | axes | ) |
Constructor from TObjArray of axes.
| axes | Array of axis objects. |
Constructor
Definition at line 33 of file NBinning.cxx.
References fAxes, and Initialize().
| Ndmspc::NBinning::NBinning | ( | std::vector< TAxis * > | axes | ) |
Constructor from vector of TAxis pointers.
| axes | Vector of axis pointers. |
Constructor
Definition at line 25 of file NBinning.cxx.
References Initialize().
|
virtual |
Destructor.
Destructor
Definition at line 56 of file NBinning.cxx.
References fAxes, fContent, fDefinitions, and fMap.
| bool Ndmspc::NBinning::AddBinning | ( | size_t | id, |
| std::vector< int > | binning, | ||
| size_t | n = 1 |
||
| ) |
Add binning for a specific axis.
| id | Axis index. |
| binning | Vector of binning values. |
| n | Optional number of bins. |
Add binning
Definition at line 560 of file NBinning.cxx.
References fAxes, fMap, and Ndmspc::NUtils::VectorToArray().
Referenced by AddBinningVariable().
| void Ndmspc::NBinning::AddBinningDefinition | ( | std::string | name, |
| std::map< std::string, std::vector< std::vector< int >>> | binning, | ||
| bool | forceDefault = false |
||
| ) |
Add a binning definition.
| name | Definition name. |
| binning | Map of axis names to binning vectors. |
| forceDefault | If true, force as default definition. |
Add binning definition
Definition at line 1053 of file NBinning.cxx.
References AddBinningViaBinWidths(), fAxes, fCurrentDefinitionName, fDefinitionNames, fDefinitions, fMap, and SetAxisType().
Referenced by Ndmspc::NGnTree::Import(), and Ndmspc::NGnTree::NGnTree().
| bool Ndmspc::NBinning::AddBinningVariable | ( | size_t | id, |
| std::vector< int > | mins | ||
| ) |
Add variable binning for a specific axis.
| id | Axis index. |
| mins | Vector of minimum values. |
Add Variable binning
Definition at line 593 of file NBinning.cxx.
References AddBinning(), and fAxes.
Referenced by AddBinningViaBinWidths().
| bool Ndmspc::NBinning::AddBinningViaBinWidths | ( | size_t | id, |
| std::vector< std::vector< int >> | widths | ||
| ) |
Add binning via bin widths for a specific axis.
| id | Axis index. |
| widths | Vector of bin widths. |
Add binning via bin widths
Definition at line 634 of file NBinning.cxx.
References AddBinningVariable(), fAxes, and Ndmspc::NUtils::GetCoordsString().
Referenced by AddBinningDefinition().
| Long64_t Ndmspc::NBinning::FillAll | ( | NBinningDef * | def = nullptr | ) |
Fill all bins according to definition.
| def | Optional binning definition. |
Fill content binnings from mapping
Definition at line 416 of file NBinning.cxx.
References fBinningTypes, and fMap.
| TObjArray * Ndmspc::NBinning::GenerateListOfAxes | ( | ) |
Generate a list of axes as TObjArray.
Create and return TObjArray of axes
Definition at line 850 of file NBinning.cxx.
References fAxes, Ndmspc::NUtils::GetCoordsString(), Ndmspc::NBinningDef::GetDefinition(), and GetDefinition().
|
inline |
Get vector of axis pointers.
Definition at line 223 of file NBinning.h.
References fAxes.
Referenced by Ndmspc::NBinningPoint::GetBin(), Ndmspc::NBinningPoint::GetBinCenter(), Ndmspc::NBinningPoint::GetBinLabel(), Ndmspc::NBinningPoint::GetBinMax(), Ndmspc::NBinningPoint::GetBinMin(), Ndmspc::NBinningPoint::GetString(), Ndmspc::NGnTree::Import(), Ndmspc::NBinningDef::NBinningDef(), Ndmspc::NBinningPoint::NBinningPoint(), Ndmspc::NBinningDef::Print(), and Ndmspc::NBinningPoint::RecalculateStorageCoords().
| std::vector< TAxis * > Ndmspc::NBinning::GetAxesByType | ( | AxisType | type | ) | const |
Get axes by type.
| type | AxisType to filter. |
Get axes by type
Definition at line 952 of file NBinning.cxx.
References fAxes, and fAxisTypes.
| std::vector< int > Ndmspc::NBinning::GetAxisBinning | ( | size_t | axisId, |
| const std::vector< int > & | c | ||
| ) | const |
Get binning for a specific axis and coordinates.
| axisId | Axis index. |
| c | Vector of coordinates. |
Returns axis binning for given axis id
Definition at line 761 of file NBinning.cxx.
References fAxes, and fBinningTypes.
| std::vector< int > Ndmspc::NBinning::GetAxisIndexes | ( | AxisType | type | ) | const |
Get indexes of axes by type.
| type | AxisType to filter. |
Get axis indexes by axes type
Definition at line 934 of file NBinning.cxx.
References fAxes, and fAxisTypes.
| std::vector< int > Ndmspc::NBinning::GetAxisIndexesByNames | ( | std::vector< std::string > | axisNames | ) | const |
Get axis indexes by axis names.
| axisNames | Vector of axis names. |
Get axis indexes by names
Definition at line 970 of file NBinning.cxx.
References fAxes, and fAxisTypes.
| std::vector< std::string > Ndmspc::NBinning::GetAxisNamesByIndexes | ( | std::vector< int > | axisIds | ) | const |
Get axis names by indexes.
| axisIds | Vector of axis indexes. |
Get axis names by indexes
Definition at line 1006 of file NBinning.cxx.
References fAxes, and fAxisTypes.
| std::vector< std::string > Ndmspc::NBinning::GetAxisNamesByType | ( | AxisType | type | ) | const |
Get axis names by type.
| type | AxisType to filter. |
Get axis names by type
Definition at line 988 of file NBinning.cxx.
References fAxes, and fAxisTypes.
| bool Ndmspc::NBinning::GetAxisRange | ( | size_t | axisId, |
| double & | min, | ||
| double & | max, | ||
| std::vector< int > | c | ||
| ) | const |
Get axis range for a specific axis and coordinates.
| axisId | Axis index. |
| min | Output minimum value. |
| max | Output maximum value. |
| c | Vector of coordinates. |
Get axis range for given axis id
Definition at line 809 of file NBinning.cxx.
References fAxes, and GetAxisRangeInBase().
| bool Ndmspc::NBinning::GetAxisRangeInBase | ( | size_t | axisId, |
| int & | min, | ||
| int & | max, | ||
| std::vector< int > | c | ||
| ) | const |
Get axis range in base for a specific axis and coordinates.
| axisId | Axis index. |
| min | Output minimum bin. |
| max | Output maximum bin. |
| c | Vector of coordinates. |
Get axis range for given axis id
Definition at line 823 of file NBinning.cxx.
References fAxes, and fBinningTypes.
Referenced by GetAxisRange().
| std::vector< std::vector< int > > Ndmspc::NBinning::GetAxisRanges | ( | std::vector< int > | c | ) | const |
Get axis ranges for given coordinates.
| c | Vector of coordinates. |
Returns axis ranges for given coordinates
Definition at line 721 of file NBinning.cxx.
References fAxes, and fBinningTypes.
Referenced by Ndmspc::NBinningPoint::RecalculateStorageCoords().
| AxisType Ndmspc::NBinning::GetAxisType | ( | size_t | i | ) | const |
Get axis type for a specific axis.
| i | Axis index. |
Get axis type
Definition at line 909 of file NBinning.cxx.
References fAxisTypes.
Referenced by Ndmspc::NBinningPoint::GetString().
| char Ndmspc::NBinning::GetAxisTypeChar | ( | size_t | i | ) | const |
Get axis type as character for a specific axis.
| i | Axis index. |
Definition at line 920 of file NBinning.cxx.
References fAxisTypes.
| Binning Ndmspc::NBinning::GetBinningType | ( | size_t | i | ) | const |
Get binning type for a specific axis.
| i | Axis index. |
Definition at line 712 of file NBinning.cxx.
References fBinningTypes.
|
inline |
Get the content histogram.
Definition at line 217 of file NBinning.h.
References fContent.
Referenced by Ndmspc::NBinningPoint::Fill(), Ndmspc::NGnThreadData::Merge(), Ndmspc::NStorageTree::Merge(), Ndmspc::NBinningPoint::NBinningPoint(), Ndmspc::NGnThreadData::Process(), Ndmspc::NBinningPoint::RecalculateStorageCoords(), and Ndmspc::NBinningPoint::SetPointContentFromLinearIndex().
| std::vector< std::vector< int > > Ndmspc::NBinning::GetCoordsRange | ( | std::vector< int > | c | ) | const |
Get coordinate ranges for given coordinates.
| c | Vector of coordinates. |
Definition at line 665 of file NBinning.cxx.
References fAxes, and fBinningTypes.
|
inline |
Get current definition name.
Definition at line 276 of file NBinning.h.
References fCurrentDefinitionName.
Referenced by Ndmspc::NGnTree::GetEntry(), Ndmspc::NGnTree::GetOutput(), Ndmspc::NGnTree::GetResourceStatisticsNavigator(), Ndmspc::NGnTree::Play(), Ndmspc::NGnTree::Projection(), and Ndmspc::NBinningPoint::RecalculateStorageCoords().
| NBinningDef * Ndmspc::NBinning::GetDefinition | ( | const std::string & | name = "" | ) |
Get binning definition by name.
| name | Definition name (optional). |
Get binning definition by name
Definition at line 1024 of file NBinning.cxx.
References fCurrentDefinitionName, and fDefinitions.
Referenced by Ndmspc::NGnNavigator::DrawSpectra(), Ndmspc::NGnNavigator::ExecuteEvent(), Ndmspc::NBinningPoint::Fill(), Ndmspc::NStorageTree::Fill(), GenerateListOfAxes(), Ndmspc::NGnNavigator::GetChild(), GetPoint(), Ndmspc::NGnThreadData::Init(), Ndmspc::NGnThreadData::Merge(), Ndmspc::NStorageTree::Merge(), Ndmspc::NGnTree::Play(), Ndmspc::NGnNavigator::Print(), Ndmspc::NGnThreadData::Process(), Ndmspc::NGnTree::Process(), Ndmspc::NGnTree::Projection(), Ndmspc::NBinningPoint::RecalculateStorageCoords(), and Ndmspc::NGnNavigator::Reshape().
|
inline |
Get all definition names.
Definition at line 270 of file NBinning.h.
References fDefinitionNames.
Referenced by Ndmspc::NGnThreadData::Init(), Ndmspc::NGnThreadData::Merge(), Ndmspc::NStorageTree::Merge(), Ndmspc::NGnTree::Play(), and Ndmspc::NGnTree::Process().
|
inline |
Get all binning definitions.
Definition at line 264 of file NBinning.h.
References fDefinitions.
Referenced by Ndmspc::NStorageTree::Merge(), and Ndmspc::NBinningPoint::RecalculateStorageCoords().
|
inline |
Get the mapping histogram.
Definition at line 211 of file NBinning.h.
References fMap.
| NBinningPoint * Ndmspc::NBinning::GetPoint | ( | ) |
Get the current binning point.
Return binning point
Definition at line 1128 of file NBinning.cxx.
References fPoint.
Referenced by Ndmspc::NGnTree::GetEntry(), Ndmspc::NStorageTree::GetEntry(), Ndmspc::NGnThreadData::Init(), Ndmspc::NGnThreadData::Merge(), Ndmspc::NStorageTree::Merge(), Ndmspc::NGnTree::NGnTree(), Ndmspc::NGnTree::Play(), Ndmspc::NGnThreadData::Process(), Ndmspc::NBinningDef::RefreshContentFromIds(), and SetCfg().
| NBinningPoint * Ndmspc::NBinning::GetPoint | ( | size_t | id, |
| const std::string | binning = "" |
||
| ) |
Get binning point for a specific axis and binning.
| id | Axis index. |
| binning | Binning name. |
Get binning point by id and binning name
Definition at line 1140 of file NBinning.cxx.
References fContent, fPoint, Ndmspc::NBinningPoint::GetCoords(), GetDefinition(), Ndmspc::NBinningDef::GetId(), and Ndmspc::NBinningPoint::RecalculateStorageCoords().
| void Ndmspc::NBinning::Initialize | ( | ) |
Initialize the binning object.
Initialize binning
Definition at line 90 of file NBinning.cxx.
References fAxes.
Referenced by NBinning().
|
virtual |
Print binning information.
| option | Print options. |
Definition at line 245 of file NBinning.cxx.
References fAxes, fContent, fCurrentDefinitionName, fDefinitions, fMap, and PrintContent().
Referenced by Ndmspc::NGnTree::Print().
| void Ndmspc::NBinning::PrintContent | ( | Option_t * | option = "" | ) | const |
Print binning content.
| option | Print options. |
Print content
Definition at line 341 of file NBinning.cxx.
References Ndmspc::NUtils::ArrayToVector(), fAxes, fBinningTypes, fContent, and Ndmspc::NUtils::GetCoordsString().
Referenced by Print().
| void Ndmspc::NBinning::Reset | ( | ) |
Reset the binning object to initial state.
Reset binning
Definition at line 78 of file NBinning.cxx.
References fContent, fMap, fPoint, and Ndmspc::NBinningPoint::Reset().
Referenced by Ndmspc::NGnTree::Process().
| bool Ndmspc::NBinning::SetAxisType | ( | size_t | id, |
| AxisType | type | ||
| ) |
Set axis type for a specific axis.
| id | Axis index. |
| type | AxisType to set. |
Set axis type
Definition at line 896 of file NBinning.cxx.
References fAxes, and fAxisTypes.
Referenced by AddBinningDefinition().
| bool Ndmspc::NBinning::SetCfg | ( | const json & | cfg | ) |
Set configuration from JSON.
| cfg | JSON configuration. |
Set configuration
Definition at line 1174 of file NBinning.cxx.
References GetPoint(), and Ndmspc::NBinningPoint::SetCfg().
Referenced by Ndmspc::NGnTree::Process().
| void Ndmspc::NBinning::SetCurrentDefinitionName | ( | const std::string & | name | ) |
Set current definition name.
| name | Definition name to set. |
Set current binning definition name
Definition at line 1184 of file NBinning.cxx.
References fCurrentDefinitionName, fDefinitionNames, fDefinitions, fPoint, and Ndmspc::NBinningPoint::Reset().
Referenced by Ndmspc::NGnThreadData::Merge().
|
inline |
Set the current binning point.
| point | Pointer to NBinningPoint. |
Definition at line 311 of file NBinning.h.
References fPoint.