ndmspc  v1.2.0-0.1.rc3
NBinningPoint.h
1 #ifndef Ndmspc_NBinningPoint_H
2 #define Ndmspc_NBinningPoint_H
3 #include <TObject.h>
4 #include "NLogger.h"
5 #include "NParameters.h"
6 
7 namespace Ndmspc {
8 
18 class NBinning;
19 class NStorageTree;
20 class NGnTree;
21 class NBinningPoint : public TObject {
22  public:
27  NBinningPoint(NBinning * b = nullptr);
28 
32  virtual ~NBinningPoint();
33 
38  virtual void Print(Option_t * option = "") const;
39 
43  virtual void Reset();
44 
49  Int_t GetNDimensionsContent() const { return fContentNDimensions; }
50 
55  Int_t * GetCoords() const { return fContentCoords; }
56 
61  Int_t GetNDimensions() const { return fNDimensions; }
62 
67  Int_t * GetStorageCoords() const { return fStorageCoords; }
68 
75  bool RecalculateStorageCoords(Long64_t entry = -1, bool useBinningDefCheck = false);
76 
83  bool SetPointContentFromLinearIndex(Long64_t linBin, bool checkBinningDef = false);
84 
91 
97  Long64_t Fill(bool ignoreFilledCheck = false);
98 
103  json & GetCfg() { return fCfg; }
104 
109  void SetCfg(json cfg) { fCfg = cfg; }
110 
115  std::map<int, std::vector<int>> GetBaseAxisRanges() const;
116 
124  std::string GetString(const std::string & prefix = "", bool all = false) const;
125 
130  std::vector<std::string> GetLabels() const { return fLabels; }
131 
136  Double_t * GetMins() const { return fMins; }
137 
142  Double_t * GetMaxs() const { return fMaxs; }
143 
149  Double_t GetBinMin(std::string axis) const;
150 
156  Double_t GetBinMax(std::string axis) const;
157 
164  Double_t GetBinCenter(std::string axis) const;
165 
171  std::string GetBinLabel(std::string axis) const;
172 
179  Int_t GetBin(std::string axis) const;
180 
185  NBinning * GetBinning() const { return fBinning; }
186 
191  void SetBinning(NBinning * b);
192 
198 
204 
209  NGnTree * GetInput() const { return fInput; }
210 
215  void SetInput(NGnTree * input) { fInput = input; }
216 
221  void SetEntryNumber(Long64_t entry) { fEntryNumber = entry; }
222 
227  Long64_t GetEntryNumber() const { return fEntryNumber; }
228 
236  void SetParameters(NParameters * params) { fParameters = params; }
237 
245  NParameters * GetParameters() const { return fParameters; }
246 
253  TObject * GetTempObject(const std::string & name) const;
254 
261  void SetTempObject(const std::string & name, TObject * obj) { fTempObjects[name] = obj; }
262 
267  json & GetTempCfg() { return fTempCfg; }
268 
269  private:
270  json fCfg{};
271  NGnTree * fInput{nullptr};
272  NBinning * fBinning{nullptr};
275  Int_t * fContentCoords{nullptr};
276  Int_t fNDimensions{1};
277  Int_t * fStorageCoords{nullptr};
278  Double_t * fMins{nullptr};
279  Double_t * fMaxs{nullptr};
280  Int_t * fBaseBinMin{nullptr};
281  Int_t * fBaseBinMax{nullptr};
282  std::vector<std::string> fLabels{};
283  Long64_t fEntryNumber{-1};
285  std::map<std::string, TObject *> fTempObjects;
286  json fTempCfg{};
287 
289  ClassDef(NBinningPoint, 1);
291 };
292 } // namespace Ndmspc
293 #endif
Represents a single point in multi-dimensional binning.
Definition: NBinningPoint.h:21
Double_t * GetMins() const
Get the array of minimum values for all axes.
json & GetTempCfg()
Get reference to temporary configuration JSON object.
NGnTree * fInput
Input NGnTree object.
NBinningPoint(NBinning *b=nullptr)
Constructor.
Double_t GetBinMax(std::string axis) const
Get the maximum value for a specific axis.
Long64_t Fill(bool ignoreFilledCheck=false)
Fill the binning point content.
Int_t fNDimensions
Number of dimensions.
std::map< int, std::vector< int > > GetBaseAxisRanges() const
Get base axis ranges for the point.
std::string GetString(const std::string &prefix="", bool all=false) const
Returns a string representation of the binning point.
Double_t * GetMaxs() const
Get the array of maximum values for all axes.
void SetEntryNumber(Long64_t entry)
Set entry number for the point.
void SetTreeStorage(NStorageTree *s)
Set storage tree object pointer.
std::string GetBinLabel(std::string axis) const
Get the label for a specific axis.
bool RecalculateStorageCoords(Long64_t entry=-1, bool useBinningDefCheck=false)
Recalculate storage coordinates for the point.
virtual ~NBinningPoint()
Destructor.
Long64_t GetEntryNumber() const
Get entry number for the point.
Int_t * fContentCoords
Coordinates of the point.
NParameters * GetParameters() const
Get the parameters associated with this binning point.
std::vector< std::string > fLabels
Labels for each axis.
Int_t * GetStorageCoords() const
Get pointer to storage coordinates array.
Definition: NBinningPoint.h:67
Double_t GetBinCenter(std::string axis) const
Returns the center value of the bin along the specified axis.
json fTempCfg
Temporary configuration object.
NBinning * fBinning
Binning object.
NParameters * fParameters
Parameter axis (if any)
Int_t * fBaseBinMin
Base bin minimum (for variable binning)
NStorageTree * GetTreeStorage() const
Get pointer to storage tree object.
void SetTempObject(const std::string &name, TObject *obj)
Set a temporary object with the given name.
void SetCfg(json cfg)
Set configuration JSON object.
NStorageTree * GetStorageTree() const
Returns a pointer to the associated storage tree.
Definition: NBinningPoint.h:90
virtual void Print(Option_t *option="") const
Print binning point information.
std::vector< std::string > GetLabels() const
Get labels for each axis.
Double_t * fMaxs
Maximum values for each axis.
bool SetPointContentFromLinearIndex(Long64_t linBin, bool checkBinningDef=false)
Set point content from linear index.
Int_t fContentNDimensions
Number of dimensions in content histogram.
Double_t * fMins
Minimum values for each axis.
void SetBinning(NBinning *b)
Set NBinning object pointer.
TObject * GetTempObject(const std::string &name) const
Retrieve a temporary object by name.
NStorageTree * fTreeStorage
Storage tree object.
NGnTree * GetInput() const
Get pointer to input NGnTree object.
NBinning * GetBinning() const
Get pointer to NBinning object.
Int_t GetBin(std::string axis) const
Returns the bin index for the specified axis.
std::map< std::string, TObject * > fTempObjects
! Outputs map
Int_t * GetCoords() const
Get pointer to content coordinates array.
Definition: NBinningPoint.h:55
void SetParameters(NParameters *params)
Set the parameters for this binning point.
Long64_t fEntryNumber
Entry in the storage tree.
Int_t * fBaseBinMax
Base bin maximum (for variable binning)
void SetInput(NGnTree *input)
Set input NGnTree object pointer.
json fCfg
Configuration object.
Int_t GetNDimensions() const
Get number of dimensions.
Definition: NBinningPoint.h:61
virtual void Reset()
Reset the binning point to initial state.
Int_t * fStorageCoords
Storage coordinates of the point.
json & GetCfg()
Get reference to configuration JSON object.
Int_t GetNDimensionsContent() const
Get number of dimensions in content histogram.
Definition: NBinningPoint.h:49
Double_t GetBinMin(std::string axis) const
Get the minimum value for a specific axis.
NBinning object for managing multi-dimensional binning and axis definitions.
Definition: NBinning.h:45
NDMSPC tree object for managing multi-dimensional data storage and processing.
Definition: NGnTree.h:75
NParameters object.
Definition: NParameters.h:13
NDMSPC storage tree object for managing ROOT TTree-based data storage.
Definition: NStorageTree.h:22