|
ndmspc
v1.2.0-0.1.rc3
|
NDMSPC storage tree object for managing ROOT TTree-based data storage. More...
#include <NStorageTree.h>
Public Member Functions | |
| NStorageTree (NBinning *binning=nullptr) | |
| Constructor. More... | |
| virtual | ~NStorageTree () |
| Destructor. More... | |
| virtual void | Print (Option_t *option="") const |
| Print storage tree information. More... | |
| virtual void | Clear (Option_t *option="") |
| Clear storage tree data. More... | |
| bool | SetFileTree (TFile *file, TTree *tree) |
| Tree handling. More... | |
| bool | InitTree (const std::string &filename="", const std::string &treename="ngnt") |
| Initialize tree from file and tree name. More... | |
| Long64_t | GetEntries () const |
| Get number of entries in the tree. More... | |
| Long64_t | GetEntry (Long64_t entry, NBinningPoint *point=nullptr, bool checkBinningDef=false) |
| Get entry by index and fill NBinningPoint. More... | |
| 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. More... | |
| bool | Close (bool write=false, std::map< std::string, TList * > outputs={}) |
| Close the storage tree, optionally writing outputs. More... | |
| TFile * | GetFile () const |
| Returns the associated TFile object. More... | |
| Long64_t | Merge (TCollection *list) |
| Merge storage trees from a collection. More... | |
| std::vector< std::string > | GetBrancheNames (bool onlyEnabled=false) const |
| Branches handling. More... | |
| std::map< std::string, NTreeBranch > | GetBranchesMap () const |
| Get map of branch names to NTreeBranch objects. More... | |
| void | SetBranchesMap (std::map< std::string, NTreeBranch > map) |
| Set map of branch names to NTreeBranch objects. More... | |
| bool | AddBranch (const std::string &name, void *address, const std::string &className) |
| Add a branch to the tree. More... | |
| NTreeBranch * | GetBranch (const std::string &name) |
| Get pointer to NTreeBranch by name. More... | |
| TObject * | GetBranchObject (const std::string &name) |
| Get pointer to branch object by name. More... | |
| void | SetEnabledBranches (std::vector< std::string > branches, int status=1) |
| Set enabled/disabled status for branches. More... | |
| void | SetBranchAddresses () |
| Set addresses for all branches. More... | |
| NBinning * | GetBinning () const |
| Get pointer to binning object. More... | |
| void | SetBinning (NBinning *binning) |
| Set binning object pointer. More... | |
| TTree * | GetTree () const |
| Get pointer to TTree object. More... | |
| std::string | GetFileName () const |
| Get file name. More... | |
| std::string | GetPrefix () const |
| Get prefix path. More... | |
| std::string | GetPostfix () const |
| Get postfix path. More... | |
| void | SetOutputs (TMap *outputs) |
| Set outputs map. More... | |
Protected Attributes | |
| std::string | fFileName {"ngnt.root"} |
| Current filename. | |
| TFile * | fFile {nullptr} |
| ! Current file | |
| TTree * | fTree {nullptr} |
| ! TTree container | |
| std::string | fPrefix {""} |
| Prefix path. | |
| std::string | fPostfix {""} |
| Postfix path. | |
| std::map< std::string, NTreeBranch > | fBranchesMap |
| Branches map. | |
| TMap * | fOutputs |
| ! Output objects map | |
| NBinning * | fBinning {nullptr} |
| Binning object. | |
NDMSPC storage tree object for managing ROOT TTree-based data storage.
Provides methods for tree/file handling, branch management, binning integration, entry access, filling, merging, and output management. Supports flexible branch enabling, address setting, and integration with NBinning and NBinningPoint.
Definition at line 22 of file NStorageTree.h.
| Ndmspc::NStorageTree::NStorageTree | ( | NBinning * | binning = nullptr | ) |
Constructor.
| binning | Pointer to NBinning object (optional). |
Constructor
Definition at line 18 of file NStorageTree.cxx.
|
virtual |
| bool Ndmspc::NStorageTree::AddBranch | ( | const std::string & | name, |
| void * | address, | ||
| const std::string & | className | ||
| ) |
Add a branch to the tree.
| name | Branch name. |
| address | Pointer to branch data. |
| className | Class name of branch data. |
Definition at line 345 of file NStorageTree.cxx.
References fBranchesMap, and fTree.
Referenced by Ndmspc::NGnTree::Import(), Ndmspc::NGnThreadData::Init(), and Merge().
|
virtual |
Clear storage tree data.
| option | Clear options. |
Clear object
Definition at line 32 of file NStorageTree.cxx.
References fBranchesMap, fFile, fFileName, fPostfix, fPrefix, and fTree.
Referenced by Ndmspc::NGnThreadData::Init().
| bool Ndmspc::NStorageTree::Close | ( | bool | write = false, |
| std::map< std::string, TList * > | outputs = {} |
||
| ) |
Close the storage tree, optionally writing outputs.
| write | If true, write outputs before closing. |
| outputs | Map of output names to TList pointers. |
Close
Definition at line 266 of file NStorageTree.cxx.
References fBinning, fFile, and fTree.
Referenced by Ndmspc::NGnTree::Close(), and Merge().
| Int_t Ndmspc::NStorageTree::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.
| point | Pointer to NBinningPoint. |
| hnstIn | Pointer to input NStorageTree (optional). |
| ignoreFilledCheck | Ignore filled check. |
| ranges | Ranges for axes. |
| useProjection | Use projection. |
Fill Entry
Definition at line 196 of file NStorageTree.cxx.
References fBinning, fBranchesMap, fFile, Ndmspc::NBinningPoint::Fill(), fTree, GetBranch(), Ndmspc::NBinningDef::GetContent(), Ndmspc::NBinning::GetDefinition(), Ndmspc::NBinningPoint::GetEntryNumber(), Ndmspc::NTreeBranch::GetObject(), Ndmspc::NBinningPoint::GetStorageCoords(), Ndmspc::NUtils::SetAxisRanges(), and Ndmspc::NBinningPoint::SetEntryNumber().
Referenced by Merge(), and Ndmspc::NGnThreadData::Process().
|
inline |
Get pointer to binning object.
Definition at line 176 of file NStorageTree.h.
References fBinning.
Referenced by Merge().
| NTreeBranch * Ndmspc::NStorageTree::GetBranch | ( | const std::string & | name | ) |
Get pointer to NTreeBranch by name.
| name | Branch name. |
Return branch by name
Definition at line 361 of file NStorageTree.cxx.
References fBranchesMap.
Referenced by Fill(), GetBranchObject(), Ndmspc::NGnTree::GetEntry(), Ndmspc::NGnTree::Import(), Ndmspc::NGnThreadData::Init(), Merge(), Ndmspc::NGnTree::Play(), Ndmspc::NGnThreadData::Process(), and Ndmspc::NGnNavigator::Reshape().
| std::vector< std::string > Ndmspc::NStorageTree::GetBrancheNames | ( | bool | onlyEnabled = false | ) | const |
Branches handling.
Get names of branches.
| onlyEnabled | If true, return only enabled branches. |
Get branch names
Definition at line 332 of file NStorageTree.cxx.
References fBranchesMap.
Referenced by Ndmspc::NGnThreadData::Init(), and Print().
|
inline |
Get map of branch names to NTreeBranch objects.
Definition at line 129 of file NStorageTree.h.
References fBranchesMap.
Referenced by Ndmspc::NGnThreadData::Init(), Merge(), Ndmspc::NGnTree::Open(), and Ndmspc::NGnNavigator::Reshape().
| TObject * Ndmspc::NStorageTree::GetBranchObject | ( | const std::string & | name | ) |
Get pointer to branch object by name.
| name | Branch name. |
Return branch object
Definition at line 378 of file NStorageTree.cxx.
References GetBranch().
Referenced by Ndmspc::NGnTree::Projection().
|
inline |
Get number of entries in the tree.
Definition at line 69 of file NStorageTree.h.
References fTree.
Referenced by Ndmspc::NGnTree::GetEntries(), and Merge().
| Long64_t Ndmspc::NStorageTree::GetEntry | ( | Long64_t | entry, |
| NBinningPoint * | point = nullptr, |
||
| bool | checkBinningDef = false |
||
| ) |
Get entry by index and fill NBinningPoint.
| entry | Entry index. |
| point | Pointer to NBinningPoint (optional). |
| checkBinningDef | Check binning definition. |
Get entry
Definition at line 143 of file NStorageTree.cxx.
References fBinning, fBranchesMap, fFileName, fTree, Ndmspc::NBinning::GetPoint(), Ndmspc::NBinningPoint::Reset(), and Ndmspc::NBinningPoint::SetPointContentFromLinearIndex().
Referenced by Ndmspc::NGnTree::GetEntry(), and Merge().
|
inline |
Returns the associated TFile object.
Definition at line 107 of file NStorageTree.h.
References fFile.
|
inline |
Get file name.
Definition at line 194 of file NStorageTree.h.
References fFileName.
Referenced by Ndmspc::NGnTree::Import(), Ndmspc::NGnThreadData::Init(), Ndmspc::NGnThreadData::Merge(), Merge(), Ndmspc::NGnTree::Process(), and Ndmspc::NGnTree::Projection().
|
inline |
Get postfix path.
Definition at line 206 of file NStorageTree.h.
References fPostfix.
Referenced by Ndmspc::NGnTree::Process().
|
inline |
Get prefix path.
Definition at line 200 of file NStorageTree.h.
References fPrefix.
Referenced by Ndmspc::NGnTree::Process().
|
inline |
Get pointer to TTree object.
Definition at line 188 of file NStorageTree.h.
References fTree.
Referenced by Merge(), and Ndmspc::NGnTree::Process().
| bool Ndmspc::NStorageTree::InitTree | ( | const std::string & | filename = "", |
| const std::string & | treename = "ngnt" |
||
| ) |
Initialize tree from file and tree name.
| filename | File name (optional). |
| treename | Tree name (default: "ngnt"). |
Init tree
Definition at line 81 of file NStorageTree.cxx.
References fFile, fFileName, fPostfix, fPrefix, fTree, and Ndmspc::NUtils::OpenFile().
Referenced by Ndmspc::NGnThreadData::Init(), and Ndmspc::NGnTree::NGnTree().
| Long64_t Ndmspc::NStorageTree::Merge | ( | TCollection * | list | ) |
Merge storage trees from a collection.
| list | Pointer to TCollection. |
Merge trees
Definition at line 431 of file NStorageTree.cxx.
References AddBranch(), Ndmspc::NUtils::ArrayToVector(), Close(), fBinning, Fill(), fTree, GetBinning(), GetBranch(), GetBranchesMap(), Ndmspc::NBinning::GetContent(), Ndmspc::NUtils::GetCoordsString(), Ndmspc::NBinning::GetDefinition(), Ndmspc::NBinning::GetDefinitionNames(), Ndmspc::NBinning::GetDefinitions(), GetEntries(), GetEntry(), Ndmspc::NBinningPoint::GetEntryNumber(), GetFileName(), Ndmspc::NBinning::GetPoint(), GetTree(), and Ndmspc::NTreeBranch::SetAddress().
Referenced by Ndmspc::NGnThreadData::Merge().
|
virtual |
Print storage tree information.
| option | Print options. |
Print object
Definition at line 54 of file NStorageTree.cxx.
References fBranchesMap, fFileName, fPostfix, fPrefix, fTree, GetBrancheNames(), and Ndmspc::NUtils::GetCoordsString().
Referenced by Ndmspc::NGnTree::Print().
|
inline |
Set binning object pointer.
| binning | Pointer to NBinning. |
Definition at line 182 of file NStorageTree.h.
References fBinning.
Referenced by Ndmspc::NGnThreadData::Merge(), and Ndmspc::NGnTree::NGnTree().
| void Ndmspc::NStorageTree::SetBranchAddresses | ( | ) |
Set addresses for all branches.
Set branch addresses
Definition at line 390 of file NStorageTree.cxx.
References fBranchesMap, and fTree.
Referenced by Ndmspc::NGnTree::Open().
|
inline |
Set map of branch names to NTreeBranch objects.
| map | Map of branch names to NTreeBranch. |
Definition at line 135 of file NStorageTree.h.
References fBranchesMap.
| void Ndmspc::NStorageTree::SetEnabledBranches | ( | std::vector< std::string > | branches, |
| int | status = 1 |
||
| ) |
Set enabled/disabled status for branches.
| branches | Vector of branch names. |
| status | Status to set (1=enabled, 0=disabled). |
Enable/disable branches
Definition at line 412 of file NStorageTree.cxx.
References fBranchesMap.
Referenced by Ndmspc::NGnThreadData::Merge(), and Ndmspc::NGnTree::Open().
| bool Ndmspc::NStorageTree::SetFileTree | ( | TFile * | file, |
| TTree * | tree | ||
| ) |
Tree handling.
Set file and tree for storage.
| file | Pointer to TFile. |
| tree | Pointer to TTree. |
Set File and tree
Definition at line 120 of file NStorageTree.cxx.
References fFile, fFileName, fPostfix, fPrefix, and fTree.
Referenced by Ndmspc::NGnTree::Open().
|
inline |
Set outputs map.
| outputs | Pointer to TMap of outputs. |
Definition at line 212 of file NStorageTree.h.
References fOutputs.