ndmspc v1.2.0-0.1.rc7
Loading...
Searching...
No Matches
NGnThreadData.h
1#ifndef Ndmspc_NHnSparseThreadData_H
2#define Ndmspc_NHnSparseThreadData_H
3// #include "NBinning.h"
4// #include "NStorageTree.h"
5#include "NGnTree.h"
6#include "NThreadData.h"
7#include <unordered_set>
8
9namespace Ndmspc {
10
20class NGnThreadData : public NThreadData {
21 public:
26
30 virtual ~NGnThreadData();
31
43 bool Init(size_t id, NGnProcessFuncPtr func, NGnBeginFuncPtr beginFunc, NGnEndFuncPtr endFunc, NGnTree * ngnt,
44 NBinning * binningIn, NGnTree * input = nullptr, const std::string & filename = "",
45 const std::string & treename = "ngnt");
46
52
60 bool InitStorage(NStorageTree * ts, const std::string & filename = "", const std::string & treename = "ngnt");
61
67
72 Long64_t GetNProcessed() const { return fNProcessed; }
73
78 void SetNProcessed(Long64_t n) { fNProcessed = n; }
79
84 void SetCfg(const json & cfg) { fCfg = cfg; }
85
90 json GetCfg() const { return fCfg; }
91
99 void SetResultsFilename(const std::string & filename) { fResultsFilename = filename; }
100
105 const std::string & GetResultsFilename() const { return fResultsFilename; }
106
111 bool IsPureCopy() const { return fIsPureCopy; }
112
117 void SetIsPureCopy(bool val) { fIsPureCopy = val; }
118
123 virtual void Process(const std::vector<int> & coords);
124
125 void SetCurrentDefinitionName(const std::string & name);
126 void SyncCurrentDefinitionIds(const std::vector<Long64_t> & ids);
127
128 void ExecuteBeginFunction();
129 void ExecuteEndFunction();
130
135
141 virtual Long64_t Merge(TCollection * list);
142
143 private:
148 Long64_t fNProcessed{0};
150 json fCfg{};
151 bool fIsPureCopy{false};
152 std::string fResultsFilename{};
153 std::unordered_set<Long64_t> fProcessedBinIds{};
154 std::vector<TObject *> fDeferredDeletes;
155
157 ClassDef(NGnThreadData, 1);
159};
160} // namespace Ndmspc
161#endif
NBinning object for managing multi-dimensional binning and axis definitions.
Definition NBinning.h:45
void SetIsPureCopy(bool val)
Sets the pure copy status of the object.
NGnEndFuncPtr fEndFunc
Function pointer to the end function.
NGnBeginFuncPtr fBeginFunc
Function pointer to the begin function.
void SetNProcessed(Long64_t n)
Set number of processed entries.
json GetCfg() const
Get configuration JSON object.
bool IsPureCopy() const
Checks if the object is a pure copy.
std::string fResultsFilename
Shared-FS path to copy result to after Close(true) (TCP mode)
bool Init(size_t id, NGnProcessFuncPtr func, NGnBeginFuncPtr beginFunc, NGnEndFuncPtr endFunc, NGnTree *ngnt, NBinning *binningIn, NGnTree *input=nullptr, const std::string &filename="", const std::string &treename="ngnt")
Initialize thread data for processing.
NGnThreadData()
Constructor.
void SetResultsFilename(const std::string &filename)
Set the results filename for TCP mode (shared filesystem path).
void SetProcessFunc(NGnProcessFuncPtr func)
Set the processing function pointer.
NBinning * fBiningSource
Pointer to the source binning (from the original NGnTree)
std::unordered_set< Long64_t > fProcessedBinIds
Set of already-processed global bin IDs (duplicate guard)
virtual void Process(const std::vector< int > &coords)
Process coordinates (virtual).
const std::string & GetResultsFilename() const
Get the results filename for TCP mode.
Long64_t GetNProcessed() const
Get number of processed entries.
bool InitStorage(NStorageTree *ts, const std::string &filename="", const std::string &treename="ngnt")
Initialize storage tree for thread data.
virtual Long64_t Merge(TCollection *list)
Merge thread data from a collection (virtual).
NGnTree * GetHnSparseBase() const
Get pointer to base NGnTree object.
virtual ~NGnThreadData()
Destructor.
json fCfg
Configuration object.
void FlushDeferredDeletes()
Delete deferred ROOT objects, skipping TCanvas/TPad (leaked safely).
void SetCfg(const json &cfg)
Set configuration JSON object.
std::vector< TObject * > fDeferredDeletes
Objects deferred for single-threaded deletion.
NGnTree * fHnSparseBase
Pointer to the base class.
Long64_t fNProcessed
Number of processed entries.
bool fIsPureCopy
Flag indicating pure copy mode.
NGnProcessFuncPtr fProcessFunc
Function pointer to the processing function.
NDMSPC tree object for managing multi-dimensional data storage and processing.
Definition NGnTree.h:75
NDMSPC storage tree object for managing ROOT TTree-based data storage.
NThreadData()
Default constructor.
Global callback function for libwebsockets client events.
void(*)(Ndmspc::NBinningPoint *, TList *, TList *, int) NGnProcessFuncPtr
Function pointer type for processing binning points and lists.
Definition NGnTree.h:40
void(*)(Ndmspc::NBinningPoint *, int) NGnEndFuncPtr
Function pointer type for termination functions used in NGnTree.
Definition NGnTree.h:62
void(*)(Ndmspc::NBinningPoint *, int) NGnBeginFuncPtr
Function pointer type for the beginning of a tree operation.
Definition NGnTree.h:52