1 #ifndef Ndmspc_NStorageTree_H
2 #define Ndmspc_NStorageTree_H
7 #include "NBinningPoint.h"
8 #include "NTreeBranch.h"
39 virtual void Print(Option_t * option =
"")
const;
45 virtual void Clear(Option_t * option =
"");
63 bool InitTree(
const std::string & filename =
"",
const std::string & treename =
"ngnt");
92 std::vector<std::vector<int>> ranges = {},
bool useProjection =
false);
100 bool Close(
bool write =
false, std::map<std::string, TList *> outputs = {});
114 Long64_t
Merge(TCollection * list);
123 std::vector<std::string>
GetBrancheNames(
bool onlyEnabled =
false)
const;
144 bool AddBranch(
const std::string & name,
void * address,
const std::string & className);
Represents a single point in multi-dimensional binning.
NBinning object for managing multi-dimensional binning and axis definitions.
NDMSPC storage tree object for managing ROOT TTree-based data storage.
std::map< std::string, NTreeBranch > fBranchesMap
Branches map.
void SetBranchAddresses()
Set addresses for all branches.
TFile * GetFile() const
Returns the associated TFile object.
TTree * fTree
! TTree container
Long64_t GetEntries() const
Get number of entries in the tree.
Long64_t Merge(TCollection *list)
Merge storage trees from a collection.
void SetEnabledBranches(std::vector< std::string > branches, int status=1)
Set enabled/disabled status for branches.
virtual void Clear(Option_t *option="")
Clear storage tree data.
bool SetFileTree(TFile *file, TTree *tree)
Tree handling.
std::string GetFileName() const
Get file name.
bool AddBranch(const std::string &name, void *address, const std::string &className)
Add a branch to the tree.
Long64_t GetEntry(Long64_t entry, NBinningPoint *point=nullptr, bool checkBinningDef=false)
Get entry by index and fill NBinningPoint.
std::vector< std::string > GetBrancheNames(bool onlyEnabled=false) const
Branches handling.
std::string fFileName
Current filename.
std::string GetPrefix() const
Get prefix path.
TObject * GetBranchObject(const std::string &name)
Get pointer to branch object by name.
NTreeBranch * GetBranch(const std::string &name)
Get pointer to NTreeBranch by name.
bool InitTree(const std::string &filename="", const std::string &treename="ngnt")
Initialize tree from file and tree name.
std::string GetPostfix() const
Get postfix path.
NBinning * GetBinning() const
Get pointer to binning object.
virtual ~NStorageTree()
Destructor.
bool Close(bool write=false, std::map< std::string, TList * > outputs={})
Close the storage tree, optionally writing outputs.
TFile * fFile
! Current file
NBinning * fBinning
Binning object.
TMap * fOutputs
! Output objects map
void SetBranchesMap(std::map< std::string, NTreeBranch > map)
Set map of branch names to NTreeBranch objects.
TTree * GetTree() const
Get pointer to TTree object.
void SetOutputs(TMap *outputs)
Set outputs map.
NStorageTree(NBinning *binning=nullptr)
Constructor.
virtual void Print(Option_t *option="") const
Print storage tree information.
std::string fPrefix
Prefix path.
std::string fPostfix
Postfix path.
Int_t Fill(NBinningPoint *point, NStorageTree *hnstIn=nullptr, bool ignoreFilledCheck=false, std::vector< std::vector< int >> ranges={}, bool useProjection=false)
Fill tree with NBinningPoint and optional input tree.
void SetBinning(NBinning *binning)
Set binning object pointer.
std::map< std::string, NTreeBranch > GetBranchesMap() const
Get map of branch names to NTreeBranch objects.
NDMSPC tree branch object for managing ROOT TBranch and associated data.