ndmspc  v1.1.1-1
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 
8 namespace Ndmspc {
9 
19 class NGnThreadData : public NThreadData {
20  public:
24  NGnThreadData();
25 
29  virtual ~NGnThreadData();
30 
42  bool Init(size_t id, NGnProcessFuncPtr func, NGnBeginFuncPtr beginFunc, NGnEndFuncPtr endFunc, NGnTree * ngnt,
43  NBinning * binningIn, NGnTree * input = nullptr, const std::string & filename = "",
44  const std::string & treename = "ngnt");
45 
50  void SetProcessFunc(NGnProcessFuncPtr func) { fProcessFunc = func; }
51 
59  bool InitStorage(NStorageTree * ts, const std::string & filename = "", const std::string & treename = "ngnt");
60 
65  NGnTree * GetHnSparseBase() const { return fHnSparseBase; }
66 
71  Long64_t GetNProcessed() const { return fNProcessed; }
72 
77  void SetCfg(const json & cfg) { fCfg = cfg; }
78 
83  json GetCfg() const { return fCfg; }
84 
89  bool IsPureCopy() const { return fIsPureCopy; }
90 
95  void SetIsPureCopy(bool val) { fIsPureCopy = val; }
96 
101  virtual void Process(const std::vector<int> & coords);
102 
103  void ExecuteBeginFunction();
104  void ExecuteEndFunction();
105 
109  void FlushDeferredDeletes();
110 
116  virtual Long64_t Merge(TCollection * list);
117 
118  private:
119  NGnProcessFuncPtr fProcessFunc{nullptr};
120  NGnBeginFuncPtr fBeginFunc{nullptr};
121  NGnEndFuncPtr fEndFunc{nullptr};
122  NGnTree * fHnSparseBase{nullptr};
123  Long64_t fNProcessed{0};
124  NBinning * fBiningSource{nullptr};
125  json fCfg{};
126  bool fIsPureCopy{false};
127  std::vector<TObject *> fDeferredDeletes;
128 
130  ClassDef(NGnThreadData, 1);
132 };
133 } // namespace Ndmspc
134 #endif
NBinning object for managing multi-dimensional binning and axis definitions.
Definition: NBinning.h:45
Thread-local data object for NDMSPC processing.
Definition: NGnThreadData.h:19
void SetIsPureCopy(bool val)
Sets the pure copy status of the object.
Definition: NGnThreadData.h:95
NGnEndFuncPtr fEndFunc
Function pointer to the end function.
NGnBeginFuncPtr fBeginFunc
Function pointer to the begin function.
json GetCfg() const
Get configuration JSON object.
Definition: NGnThreadData.h:83
bool IsPureCopy() const
Checks if the object is a pure copy.
Definition: NGnThreadData.h:89
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.
NGnTree * GetHnSparseBase() const
Get pointer to base NGnTree object.
Definition: NGnThreadData.h:65
void SetProcessFunc(NGnProcessFuncPtr func)
Set the processing function pointer.
Definition: NGnThreadData.h:50
NBinning * fBiningSource
Pointer to the source binning (from the original NGnTree)
virtual void Process(const std::vector< int > &coords)
Process coordinates (virtual).
Long64_t GetNProcessed() const
Get number of processed entries.
Definition: NGnThreadData.h:71
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).
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.
Definition: NGnThreadData.h:77
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:76
NDMSPC storage tree object for managing ROOT TTree-based data storage.
Definition: NStorageTree.h:22
Thread-local data object for NDMSPC processing.
Definition: NThreadData.h:21