|
ndmspc v1.2.0-0.1.rc5
|
NBinning object for managing multi-dimensional binning and axis definitions. More...
#include <NBinning.h>
Public Member Functions | |
| NBinning () | |
| Default constructor. | |
| NBinning (TObjArray *axes) | |
| Constructor from TObjArray of axes. | |
| NBinning (std::vector< TAxis * > axes) | |
| Constructor from vector of TAxis pointers. | |
| virtual | ~NBinning () |
| Destructor. | |
| void | Initialize () |
| Initialize the binning object. | |
| void | Reset () |
| Reset the binning object to initial state. | |
| virtual void | Print (Option_t *option="") const |
| Print binning information. | |
| void | PrintContent (Option_t *option="") const |
| Print binning content. | |
| Long64_t | FillAll (NBinningDef *def=nullptr) |
| Fill all bins according to definition. | |
| std::vector< std::vector< int > > | GetCoordsRange (std::vector< int > c) const |
| Get coordinate ranges for given coordinates. | |
| std::vector< std::vector< int > > | GetAxisRanges (std::vector< int > c) const |
| Get axis ranges for given coordinates. | |
| bool | GetAxisRange (size_t axisId, double &min, double &max, std::vector< int > c) const |
| Get axis range for a specific axis and coordinates. | |
| 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. | |
| TObjArray * | GenerateListOfAxes () |
| Generate a list of axes as TObjArray. | |
| std::vector< int > | GetAxisBinning (size_t axisId, const std::vector< int > &c) const |
| Get binning for a specific axis and coordinates. | |
| std::vector< int > | GetAxisIndexes (AxisType type) const |
| Get indexes of axes by type. | |
| std::vector< int > | GetAxisIndexesByNames (std::vector< std::string > axisNames) const |
| Get axis indexes by axis names. | |
| std::vector< std::string > | GetAxisNamesByType (AxisType type) const |
| Get axis names by type. | |
| std::vector< std::string > | GetAxisNamesByIndexes (std::vector< int > axisIds) const |
| Get axis names by indexes. | |
| bool | AddBinning (size_t id, std::vector< int > binning, size_t n=1) |
| Add binning for a specific axis. | |
| bool | AddBinningVariable (size_t id, std::vector< int > mins) |
| Add variable binning for a specific axis. | |
| bool | AddBinningViaBinWidths (size_t id, std::vector< std::vector< int > > widths) |
| Add binning via bin widths for a specific axis. | |
| bool | SetAxisType (size_t id, AxisType type) |
| Set axis type for a specific axis. | |
| THnSparse * | GetMap () const |
| Get the mapping histogram. | |
| THnSparse * | GetContent () const |
| Get the content histogram. | |
| std::vector< TAxis * > | GetAxes () const |
| Get vector of axis pointers. | |
| std::vector< TAxis * > | GetAxesByType (AxisType type) const |
| Get axes by type. | |
| Binning | GetBinningType (size_t i) const |
| Get binning type for a specific axis. | |
| AxisType | GetAxisType (size_t i) const |
| Get axis type for a specific axis. | |
| char | GetAxisTypeChar (size_t i) const |
| Get axis type as character for a specific axis. | |
| NBinningDef * | GetDefinition (const std::string &name="") |
| Get binning definition by name. | |
| std::map< std::string, NBinningDef * > | GetDefinitions () const |
| Get all binning definitions. | |
| std::vector< std::string > | GetDefinitionNames () const |
| Get all definition names. | |
| std::string | GetCurrentDefinitionName () const |
| Get current definition name. | |
| void | SetCurrentDefinitionName (const std::string &name) |
| Set current definition name. | |
| void | AddBinningDefinition (std::string name, std::map< std::string, std::vector< std::vector< int > > > binning, bool forceDefault=false) |
| Add a binning definition. | |
| NBinningPoint * | GetPoint () |
| Get the current binning point. | |
| NBinningPoint * | GetPoint (size_t id, const std::string binning="") |
| Get binning point for a specific axis and binning. | |
| void | SetPoint (NBinningPoint *point) |
| Set the current binning point. | |
| bool | SetCfg (const json &cfg) |
| Set configuration from JSON. | |
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 fAxes, and 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 AddBinningDefinition(), and 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 AddBinning(), AddBinningViaBinWidths(), fAxes, fCurrentDefinitionName, fDefinitionNames, fDefinitions, FillAll(), fMap, Ndmspc::NUtils::GetCoordsString(), Ndmspc::NBinningDef::GetIds(), Ndmspc::kVariable, 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 Ndmspc::NBinningDef::AddVariableAxis(), Ndmspc::NDimensionalExecutor::Execute(), fAxes, fAxisTypes, fBinningTypes, fContent, fMap, Ndmspc::NUtils::FormatTime(), Ndmspc::NBinningDef::GetContent(), Ndmspc::NBinningPoint::GetCoords(), Ndmspc::NUtils::GetCoordsString(), Ndmspc::NBinningDef::GetIds(), Ndmspc::NBinningPoint::GetStorageCoords(), Ndmspc::NBinningDef::GetVariableAxes(), Ndmspc::kMultiple, Ndmspc::kSingle, Ndmspc::kUser, Ndmspc::kVariable, Ndmspc::NBinningDef::Print(), Ndmspc::NUtils::ProgressBar(), Ndmspc::NBinningPoint::RecalculateStorageCoords(), and Ndmspc::NUtils::VectorToArray().
Referenced by AddBinningDefinition().
| 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(), GetDefinition(), and Ndmspc::NBinningDef::GetDefinition().
|
inline |
Get vector of axis pointers.
Definition at line 223 of file NBinning.h.
References fAxes.
Referenced by Ndmspc::NGnTree::Import(), and Ndmspc::NBinningDef::NBinningDef().
| 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, fBinningTypes, Ndmspc::kMultiple, Ndmspc::kSingle, and Ndmspc::kUser.
| 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, fBinningTypes, Ndmspc::NUtils::GetAxisRangeInBase(), Ndmspc::kMultiple, and Ndmspc::kSingle.
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, fBinningTypes, Ndmspc::NUtils::GetAxisRangeInBase(), Ndmspc::kMultiple, Ndmspc::kSingle, and Ndmspc::kUser.
| 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, and Ndmspc::kUndefined.
| 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, Ndmspc::kFixed, Ndmspc::kUndefined, and Ndmspc::kVariable.
Referenced by PrintContent().
| 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, and Ndmspc::kUndefined.
|
inline |
Get the content histogram.
Definition at line 217 of file NBinning.h.
References fContent.
Referenced by Ndmspc::NStorageTree::Merge(), and Ndmspc::NGnTree::Process().
| 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, fBinningTypes, Ndmspc::NUtils::GetAxisRangeInBase(), Ndmspc::kMultiple, Ndmspc::kSingle, and Ndmspc::kUser.
|
inline |
Get current definition name.
Definition at line 276 of file NBinning.h.
References fCurrentDefinitionName.
| 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 GenerateListOfAxes(), GetPoint(), Ndmspc::NStorageTree::Merge(), Ndmspc::NGnTree::Process(), and Ndmspc::NGnTree::Projection().
|
inline |
Get all definition names.
Definition at line 270 of file NBinning.h.
References fDefinitionNames.
|
inline |
Get all binning definitions.
Definition at line 264 of file NBinning.h.
References fDefinitions.
|
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 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, GetDefinition(), and Ndmspc::NBinningDef::GetId().
| void Ndmspc::NBinning::Initialize | ( | ) |
Initialize the binning object.
Initialize binning
Definition at line 90 of file NBinning.cxx.
References fAxes, fAxisTypes, fBinningTypes, fContent, fMap, fPoint, Ndmspc::kFixed, Ndmspc::kMultiple, Ndmspc::kSingle, and Ndmspc::kUser.
Referenced by NBinning(), and NBinning().
|
virtual |
Print binning information.
| option | Print options. |
Definition at line 245 of file NBinning.cxx.
References fAxes, fContent, fCurrentDefinitionName, fDefinitions, fMap, and PrintContent().
| 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, Ndmspc::NUtils::GetAxisRangeInBase(), GetAxisTypeChar(), Ndmspc::NUtils::GetCoordsString(), Ndmspc::kMultiple, Ndmspc::kSingle, and Ndmspc::kUser.
Referenced by Print().
| void Ndmspc::NBinning::Reset | ( | ) |
Reset the binning object to initial state.
Reset binning
Definition at line 78 of file NBinning.cxx.
| 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().
| 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, and fPoint.
|
inline |
Set the current binning point.
| point | Pointer to NBinningPoint. |
Definition at line 311 of file NBinning.h.
References fPoint.
|
private |
List of axes.
Definition at line 323 of file NBinning.h.
Referenced by AddBinning(), AddBinningDefinition(), AddBinningVariable(), AddBinningViaBinWidths(), FillAll(), GenerateListOfAxes(), GetAxes(), GetAxesByType(), GetAxisBinning(), GetAxisIndexes(), GetAxisIndexesByNames(), GetAxisNamesByIndexes(), GetAxisNamesByType(), GetAxisRange(), GetAxisRangeInBase(), GetAxisRanges(), GetCoordsRange(), Initialize(), NBinning(), NBinning(), Print(), PrintContent(), SetAxisType(), and ~NBinning().
|
private |
Axis types.
Definition at line 325 of file NBinning.h.
Referenced by FillAll(), GetAxesByType(), GetAxisIndexes(), GetAxisIndexesByNames(), GetAxisNamesByIndexes(), GetAxisNamesByType(), GetAxisType(), GetAxisTypeChar(), Initialize(), and SetAxisType().
|
private |
Binning types.
Definition at line 324 of file NBinning.h.
Referenced by FillAll(), GetAxisBinning(), GetAxisRangeInBase(), GetAxisRanges(), GetBinningType(), GetCoordsRange(), Initialize(), and PrintContent().
|
private |
Content histogram.
Definition at line 322 of file NBinning.h.
Referenced by FillAll(), GetContent(), GetPoint(), Initialize(), Print(), PrintContent(), Reset(), and ~NBinning().
|
private |
Current definition name.
Definition at line 326 of file NBinning.h.
Referenced by AddBinningDefinition(), GetCurrentDefinitionName(), GetDefinition(), Print(), and SetCurrentDefinitionName().
|
private |
Binning definition names.
Definition at line 328 of file NBinning.h.
Referenced by AddBinningDefinition(), GetDefinitionNames(), and SetCurrentDefinitionName().
|
private |
Binning definitions.
Definition at line 327 of file NBinning.h.
Referenced by AddBinningDefinition(), GetDefinition(), GetDefinitions(), Print(), SetCurrentDefinitionName(), and ~NBinning().
|
private |
Mapping histogram.
Definition at line 321 of file NBinning.h.
Referenced by AddBinning(), AddBinningDefinition(), FillAll(), GetMap(), Initialize(), Print(), Reset(), and ~NBinning().
|
private |
! Binning point object
Definition at line 329 of file NBinning.h.
Referenced by GetPoint(), GetPoint(), Initialize(), Reset(), SetCurrentDefinitionName(), and SetPoint().