1 #ifndef Ndmspc_NGnNavigator_H
2 #define Ndmspc_NGnNavigator_H
8 #include "NBinningDef.h"
30 NGnNavigator(
const char * name =
"GnNavigator",
const char * title =
"Gn Navigator",
31 std::vector<std::string> objectTypes = {
"TH1"});
47 NGnNavigator *
Reshape(std::string binningName, std::vector<std::vector<int>> levels,
size_t level = 0,
48 std::map<
int, std::vector<int>> ranges = {}, std::map<int, std::vector<int>> rangesBase = {});
61 std::map<
int, std::vector<int>> ranges = {}, std::map<int, std::vector<int>> rangesBase = {},
71 void Export(
const std::string & filename, std::vector<std::string> objectNames,
const std::string & wsUrl =
"",
72 int timeoutMs = 1000);
86 virtual void Print(Option_t * option =
"")
const override;
92 virtual void Draw(Option_t * option =
"")
override;
115 virtual TList *
DrawSpectra(std::string parameterName, std::vector<int> projIds, std::vector<double> minmax = {0.05},
116 const std::string& minmaxMode =
"V", Option_t * option =
"")
const;
133 virtual TList *
DrawSpectraByName(std::string parameterName, std::vector<std::string> projAxes,
134 std::vector<double> minmax = {0.05},
const std::string& minmaxMode =
"V", Option_t * option =
"")
const;
149 virtual TList *
DrawSpectraAll(std::string parameterName, std::vector<double> minmax = {0.05},
150 const std::string& minmaxMode =
"V", Option_t * option =
"")
const;
156 virtual void Paint(Option_t * option =
"")
override;
172 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
override;
263 std::vector<TObject *>
GetObjects(
const std::string & name)
const;
271 TObject *
GetObject(
const std::string & name,
int index = 0)
const;
279 void SetObject(
const std::string & name, TObject * obj,
int index = -1);
317 std::vector<double>
GetParameters(
const std::string & name)
const;
325 double GetParameter(
const std::string & name,
int index = 0)
const;
333 void SetParameter(
const std::string & name,
double value,
int index = -1);
Defines binning mapping and content for NDMSPC histograms.
Navigator object for managing hierarchical data structures and projections.
void SetLevel(size_t l)
Set current level in hierarchy.
size_t GetNCells() const
Get number of cells in projection histogram.
std::vector< TObject * > GetObjects(const std::string &name) const
Get objects by name.
void SetChild(NGnNavigator *child, int index=-1)
Set child navigator at index.
void ResizeParameterContentMap(const std::string &name, int n)
Resize parameter content map for a given name.
std::vector< std::string > GetParameterNames() const
Get parameter names managed by navigator.
void SetObject(const std::string &name, TObject *obj, int index=-1)
Set object by name and index.
void SetLevels(const std::vector< std::vector< int >> &levels)
Set the levels using a vector of vectors of integers.
void SetChildrenSize(size_t n)
Set number of children.
void SetParameterNames(const std::vector< std::string > &names)
Set parameter names managed by navigator.
virtual TList * DrawSpectraByName(std::string parameterName, std::vector< std::string > projAxes, std::vector< double > minmax={0.05}, const std::string &minmaxMode="V", Option_t *option="") const
Draws spectra for the given parameter and projection axes.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Handle execution of events (e.g., mouse, keyboard).
virtual void Print(Option_t *option="") const override
Print navigator information.
NGnNavigator * GetParent() const
Get parent navigator.
double GetParameterError(const std::string &name, int index=0) const
Retrieves a specific error value for a parameter.
void SetProjection(TH1 *h)
Set projection histogram.
NGnNavigator * fParent
Parent object.
virtual ~NGnNavigator()
Destructor.
std::vector< std::string > fParameterNames
Parameter names.
TH1 * GetProjection() const
Get projection histogram.
size_t fNLevels
Number of levels in the hierarchy.
virtual void Paint(Option_t *option="") override
Paint navigator objects.
void ResizeParameterErrorContentMap(const std::string &name, int n)
Resizes the error vector for a given parameter name.
virtual TList * DrawSpectra(std::string parameterName, std::vector< int > projIds, std::vector< double > minmax={0.05}, const std::string &minmaxMode="V", Option_t *option="") const
Draw spectra for a parameter.
virtual void Draw(Option_t *option="") override
Draw navigator objects.
std::map< std::string, std::vector< TObject * > > GetObjectContentMap() const
Get object content map.
void SetParameterError(const std::string &name, double value, int index=-1)
Sets a specific error value for a parameter.
std::vector< std::vector< int > > fLevels
Levels definition.
void SetLastIndexSelected(size_t idx)
Set last selected index.
TObject * GetObject(const std::string &name, int index=0) const
Get object by name and index.
std::vector< std::string > GetObjectNames() const
Get object names managed by navigator.
NGnNavigator * GetChild(size_t index) const
Get child navigator at index.
size_t fNCells
Number of cells in the projection histogram.
void Export(const std::string &filename, std::vector< std::string > objectNames, const std::string &wsUrl="", int timeoutMs=1000)
Export navigator data to file.
NGnNavigator(const char *name="GnNavigator", const char *title="Gn Navigator", std::vector< std::string > objectTypes={"TH1"})
Constructor.
NGnNavigator * Reshape(std::string binningName, std::vector< std::vector< int >> levels, size_t level=0, std::map< int, std::vector< int >> ranges={}, std::map< int, std::vector< int >> rangesBase={})
Reshape navigator using binning name and levels.
std::vector< std::string > fObjectTypes
Object types.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Calculate distance to primitive for graphical selection.
void SetGnTree(NGnTree *tree)
Set NGnTree object pointer.
size_t fLastHoverBin
To avoid spamming the console on hover.
json GetInfoJson() const
Retrieves information about the navigator in JSON format.
size_t GetLevel() const
Get current level in hierarchy.
NGnTree * fGnTree
! Pointer to the NGnTree
size_t GetLastIndexSelected() const
Get last selected index.
std::map< std::string, std::vector< double > > fParameterContentMap
Parameter content map.
virtual TList * DrawSpectraAll(std::string parameterName, std::vector< double > minmax={0.05}, const std::string &minmaxMode="V", Option_t *option="") const
Draws all spectra for the given parameter.
size_t fLevel
Level of the object in the hierarchy.
void ExportToJson(json &j, NGnNavigator *obj, std::vector< std::string > objectNames)
Export navigator data to JSON.
std::vector< NGnNavigator * > fChildren
Children objects.
void SetNLevels(size_t n)
Set number of levels in hierarchy.
void SetNCells(size_t n)
Set number of cells in projection histogram.
std::map< std::string, std::vector< double > > fParameterErrorContentMap
Parameter error content map.
Int_t fTrigger
last triggered event
void SetParent(NGnNavigator *parent)
Set parent navigator.
std::vector< std::string > fObjectNames
Object names.
size_t GetLastHoverBin() const
Get last hovered bin index.
std::map< std::string, std::vector< double > > GetParameterErrorContentMap() const
Returns the map containing parameter error vectors for each parameter name.
void ResizeObjectContentMap(const std::string &name, size_t n)
Resize object content map for a given name.
void SetObjectNames(const std::vector< std::string > &names)
Set object names managed by navigator.
NGnTree * GetGnTree() const
Get pointer to NGnTree object.
void SetParameter(const std::string &name, double value, int index=-1)
Set parameter value by name and index.
size_t GetNLevels() const
Get number of levels in hierarchy.
double GetParameter(const std::string &name, int index=0) const
Get parameter value by name and index.
std::vector< double > GetParameters(const std::string &name) const
Get parameters by name.
std::map< std::string, std::vector< double > > GetParameterContentMap() const
Get parameter content map.
size_t fLastIndexSelected
last selected index in the object
void SetObjectTypes(const std::vector< std::string > &types)
Set object types managed by navigator.
std::vector< std::vector< int > > GetLevels() const
Get the current levels as a vector of vectors of integers.
std::vector< NGnNavigator * > GetChildren() const
Get vector of child navigators.
std::map< std::string, std::vector< TObject * > > fObjectContentMap
Object content map.
NGnNavigator * GetRoot() const
Returns the root parent of this NGnNavigator.
void SetLastHoverBin(size_t b)
Set last hovered bin index.
TH1 * fProjection
Projection histogram.
std::vector< double > GetParameterErrors(const std::string &name) const
Retrieves the error vector for a given parameter name.
NDMSPC tree object for managing multi-dimensional data storage and processing.