1 #ifndef Ndmspc_NGnTree_H
2 #define Ndmspc_NGnTree_H
11 #include "NParameters.h"
12 #include "NStorageTree.h"
88 NGnTree(std::vector<TAxis *> axes, std::string filename =
"", std::string treename =
"ngnt");
96 NGnTree(TObjArray * axes, std::string filename =
"", std::string treename =
"ngnt");
104 NGnTree(
NGnTree * ngnt, std::string filename =
"", std::string treename =
"ngnt");
121 NGnTree(THnSparse * hns, std::string parameterAxis,
const std::string & outFileName =
"/tmp/ngnt_imported.root",
122 json cfg = json::object());
133 virtual void Print(Option_t * option =
"")
const override;
143 virtual void Draw(Option_t * option =
"")
override;
154 void Play(
int timeout = 0, std::string binning =
"", std::vector<int> outputPointIds = {0},
155 std::vector<std::vector<int>> ranges = {}, Option_t * option =
"");
186 TList *
GetOutput(std::string name =
"");
244 Int_t
GetEntry(Long64_t entry,
bool checkBinningDef =
true);
253 Int_t
GetEntry(std::vector<std::vector<int>> range,
bool checkBinningDef =
true);
260 bool Close(
bool write =
false);
269 bool Process(NGnProcessFuncPtr func,
const json & cfg = json::object(), std::string binningName =
"",
270 NGnBeginFuncPtr beginFunc =
nullptr, NGnEndFuncPtr endFunc =
nullptr);
280 bool Process(NGnProcessFuncPtr func,
const std::vector<std::string> & defNames,
const json & cfg = json::object(),
281 NBinning * binningIn =
nullptr, NGnBeginFuncPtr beginFunc =
nullptr, NGnEndFuncPtr endFunc =
nullptr);
300 TList *
Projection(
const json & cfg, std::string binningName =
"");
310 NGnNavigator *
Reshape(std::string binningName, std::vector<std::vector<int>> levels,
int level = 0,
311 std::map<
int, std::vector<int>> ranges = {}, std::map<int, std::vector<int>> rangesBase = {});
323 int level = 0, std::map<
int, std::vector<int>> ranges = {},
324 std::map<int, std::vector<int>> rangesBase = {});
348 static NGnTree *
Open(
const std::string & filename,
const std::string & branches =
"",
349 const std::string & treename =
"ngnt");
358 static NGnTree *
Open(TTree * tree,
const std::string & branches =
"", TFile * file =
nullptr);
372 static NGnTree *
Import(
const std::string & findPath,
const std::string & fileName,
373 const std::vector<std::string> & headers,
374 const std::string & outFileName =
"/tmp/ngnt_imported.root",
bool close=
true);
Represents a single point in multi-dimensional binning.
NBinning object for managing multi-dimensional binning and axis definitions.
Navigator object for managing hierarchical data structures and projections.
NDMSPC tree object for managing multi-dimensional data storage and processing.
NBinning * GetBinning() const
Get pointer to binning object.
std::map< std::string, TList * > GetOutputs() const
Get outputs map.
virtual void Draw(Option_t *option="") override
Draws the tree object.
NGnNavigator * GetNavigator() const
Returns the navigator associated with this tree.
void SetIsPureCopy(bool val)
Sets the pure copy status of the tree.
bool Close(bool write=false)
Close the tree, optionally writing data.
bool fOwnsTreeStorage
True when fTreeStorage is owned by this instance.
void SetBinning(NBinning *binning)
Set binning object pointer.
bool IsPureCopy() const
Checks if the tree is a pure copy.
virtual ~NGnTree()
Destructor.
Int_t GetEntry(Long64_t entry, bool checkBinningDef=true)
Get entry by index.
virtual void Print(Option_t *option="") const override
Print tree information.
void SetInput(NGnTree *input)
Set input NGnTree pointer.
NGnTree()
Default constructor.
static NGnTree * Import(const std::string &findPath, const std::string &fileName, const std::vector< std::string > &headers, const std::string &outFileName="/tmp/ngnt_imported.root", bool close=true)
Imports an NGnTree from a specified file.
NGnNavigator * Reshape(std::string binningName, std::vector< std::vector< int >> levels, int level=0, std::map< int, std::vector< int >> ranges={}, std::map< int, std::vector< int >> rangesBase={})
Reshape navigator using binning name and levels.
NBinning * fBinning
Binning object.
TList * GetOutput(std::string name="")
Get output list by name.
NParameters * GetParameters() const
Returns the parameters associated with this tree.
NGnTree * fInput
Input NGnTree for processing.
bool fOwnsBinning
True when fBinning is owned by this instance.
NStorageTree * GetStorageTree() const
Get pointer to storage tree object.
NGnTree * GetInput() const
Get pointer to input NGnTree.
std::string fWorkerMacroList
Comma-separated macro paths sent to TCP workers.
void Play(int timeout=0, std::string binning="", std::vector< int > outputPointIds={0}, std::vector< std::vector< int >> ranges={}, Option_t *option="")
Play tree data with optional binning and output point IDs.
void SetOutputs(std::map< std::string, TList * > outputs)
Set outputs map.
void SetWorkerMacro(const std::string ¯oList)
Set the macro(s) that TCP workers should load when bootstrapping.
bool InitParameters(const std::vector< std::string > ¶mNames)
Initializes the parameters for the tree using the provided parameter names.
std::map< std::string, TList * > fOutputs
Outputs.
NGnNavigator * fNavigator
! Navigator object
Long64_t GetEntries() const
Get number of entries in storage tree.
NParameters * fParameters
Parameters object.
TList * Projection(const json &cfg, std::string binningName="")
Project tree data using configuration and binning name.
NGnNavigator * GetResourceStatisticsNavigator(std::string binningName, std::vector< std::vector< int >> levels, int level=0, std::map< int, std::vector< int >> ranges={}, std::map< int, std::vector< int >> rangesBase={})
Returns a navigator for resource statistics based on binning and levels.
NStorageTree * fTreeStorage
Tree storage.
static std::string BuildObjectPath(const json &cfg, const json &objCfg, const NBinningPoint *point)
Helper: build object path string from configuration and a binning point.
void SetNavigator(NGnNavigator *navigator)
Sets the navigator for this tree.
static NGnTree * Open(const std::string &filename, const std::string &branches="", const std::string &treename="ngnt")
Open NGnTree from file.
bool Process(NGnProcessFuncPtr func, const json &cfg=json::object(), std::string binningName="", NGnBeginFuncPtr beginFunc=nullptr, NGnEndFuncPtr endFunc=nullptr)
Process tree data using a function pointer and configuration.
bool fIsPureCopy
Flag indicating pure copy mode.
NDMSPC storage tree object for managing ROOT TTree-based data storage.
Long64_t GetEntries() const
Get number of entries in the tree.