1
0
Fork 0
mirror of https://github.com/gwm17/Specter.git synced 2024-11-22 18:28:52 -05:00

Renamed HistogramParams, CutParameters to HistogramArgs, CutArgs to avoid confusion with the Parameter concept

This commit is contained in:
Gordon McCann 2022-05-01 17:03:53 -04:00
parent c325e29b73
commit ac074f99c4
14 changed files with 89 additions and 89 deletions

View File

@ -2,10 +2,10 @@
Cut.cpp
Cut related classes. A cut here is defined as a filter upon a histogram based on some range for a parameter or set of parameters.
CutParams is the underlying data that defines a cut (excluding the actual points).
CutArgs is the underlying data that defines a cut (excluding the actual points).
Cut is the base class for all cut objects. Should not be used in practice. All cut objects have functions which can query what kind of cut it is. If one has the cut object,
Is1D() or Is2D() can be called. If one has the CutParams, a 1D cut will have y_par set to "None" while a 2D cut will have a valid parameter name.
Is1D() or Is2D() can be called. If one has the CutArgs, a 1D cut will have y_par set to "None" while a 2D cut will have a valid parameter name.
Cut1D is a one-dimensional (single parameter cut) while Cut2D is a two-dimensional (two parameter cut). There are a few differences between 1D and 2D cuts.
A Cut1D only contains two values, a min and a max. The parameter is checked that it falls within these bounds.
@ -20,7 +20,7 @@
namespace Navigator {
/*1D Cuts -- Can be made on and applied to either 1D or 2D histograms*/
Cut1D::Cut1D(const CutParams& params, double min, double max) :
Cut1D::Cut1D(const CutArgs& params, double min, double max) :
Cut(params), m_minVal(min), m_maxVal(max)
{
m_params.type = CutType::Cut1D;
@ -41,7 +41,7 @@ namespace Navigator {
}
/*2D Cuts -- Can only be made on 2D histogram, but applied to either 1D or 2D histograms*/
Cut2D::Cut2D(const CutParams& params, const std::vector<double>& xpoints, const std::vector<double>& ypoints) :
Cut2D::Cut2D(const CutArgs& params, const std::vector<double>& xpoints, const std::vector<double>& ypoints) :
Cut(params), m_xpoints(xpoints), m_ypoints(ypoints)
{
m_params.type = CutType::Cut2D;

View File

@ -2,10 +2,10 @@
Cut.h
Cut related classes. A cut here is defined as a filter upon a histogram based on some range for a parameter or set of parameters.
CutParams is the underlying data that defines a cut (excluding the actual points).
CutArgs is the underlying data that defines a cut (excluding the actual points).
Cut is the base class for all cut objects. Should not be used in practice. All cut objects have functions which can query what kind of cut it is. If one has the cut object,
Is1D() or Is2D() can be called. If one has the CutParams, a 1D cut will have y_par set to "None" while a 2D cut will have a valid parameter name.
Is1D() or Is2D() can be called. If one has the CutArgs, a 1D cut will have y_par set to "None" while a 2D cut will have a valid parameter name.
Cut1D is a one-dimensional (single parameter cut) while Cut2D is a two-dimensional (two parameter cut). There are a few differences between 1D and 2D cuts.
A Cut1D only contains two values, a min and a max. The parameter is checked that it falls within these bounds.
@ -29,10 +29,10 @@ namespace Navigator {
None
};
struct NAV_API CutParams
struct NAV_API CutArgs
{
CutParams() {}
CutParams(const std::string& n, const std::string& x, const std::string& y = "None") :
CutArgs() {}
CutArgs(const std::string& n, const std::string& x, const std::string& y = "None") :
name(n), x_par(x), y_par(y)
{
}
@ -47,7 +47,7 @@ namespace Navigator {
{
public:
Cut(const CutParams& params) :
Cut(const CutArgs& params) :
m_params(params), m_isValid(false)
{
}
@ -65,16 +65,16 @@ namespace Navigator {
inline const std::string& GetName() const { return m_params.name; }
inline const std::string& GetXParameter() const { return m_params.x_par; }
inline const std::string& GetYParameter() const { return m_params.y_par; }
inline const CutParams& GetCutParams() const { return m_params; }
inline const CutArgs& GetCutArgs() const { return m_params; }
protected:
CutParams m_params;
CutArgs m_params;
bool m_isValid;
};
class NAV_API Cut1D : public Cut
{
public:
Cut1D(const CutParams& params, double min, double max);
Cut1D(const CutArgs& params, double min, double max);
virtual ~Cut1D();
virtual void IsInside(double x, double y=0.0) override;
virtual void Draw() const override;
@ -88,7 +88,7 @@ namespace Navigator {
class NAV_API Cut2D : public Cut
{
public:
Cut2D(const CutParams& params, const std::vector<double>& xpoints, const std::vector<double>& ypoints);
Cut2D(const CutArgs& params, const std::vector<double>& xpoints, const std::vector<double>& ypoints);
virtual ~Cut2D();
virtual void IsInside(double x, double y) override;
virtual void Draw() const override;

View File

@ -5,11 +5,11 @@
thousands to millions of events. In the ImPlot paradigm we would need to loop over all of this data and bin it, not to mention explicitly store all of this data in memory for every histogram. I point this
out not to say that ImPlot histograms are bad intrinsically, because they definitely have a use for smaller data sets, but rather to explain why for this program I have re-invented the wheel somewhat.
HistogramParameters are the underlying data which define a histogram. This is grouped in a struct to easily pass these around for use in contexts like the Editor.
HistogramArgs are the underlying data which define a histogram. This is grouped in a struct to easily pass these around for use in contexts like the Editor.
Every histogram has a set of histogram parameters.
Histogram is the base class of all histograms. Should not be used in practice. Every histogram contains functions to query what type of underlying histogram it is. If one has
the Histogram object, Is1D() or Is2D() can be called. If one only has the HistogramParameters, the values of x_par and y_par can be inspected. In particular, a 1D histogram will have
the Histogram object, Is1D() or Is2D() can be called. If one only has the HistogramArgs, the values of x_par and y_par can be inspected. In particular, a 1D histogram will have
y_par set to "None", while a 2D histogram should have a valid parameter name for y_par.
Histogram1D is a one dimensional (single parameter) histogram. Histogram2D is a two dimensional (two parameter) histogram. The only real difference between these in practice, other than
@ -46,7 +46,7 @@ namespace Navigator {
/*
1D Histogram class
*/
Histogram1D::Histogram1D(const HistogramParameters& params) :
Histogram1D::Histogram1D(const HistogramArgs& params) :
Histogram(params)
{
InitBins();
@ -136,7 +136,7 @@ namespace Navigator {
2D Histogram class
Note for 2D: Rendering is done from top left to bottom right. So ybins run from top to bottom (ymin is last row, ymax is first row)
*/
Histogram2D::Histogram2D(const HistogramParameters& params) :
Histogram2D::Histogram2D(const HistogramArgs& params) :
Histogram(params)
{
m_colorScaleRange[0] = 0.0f;
@ -278,7 +278,7 @@ namespace Navigator {
-- Literally everything hahaha
*/
HistogramSummary::HistogramSummary(const HistogramParameters& params, const std::vector<std::string>& subhistos) :
HistogramSummary::HistogramSummary(const HistogramArgs& params, const std::vector<std::string>& subhistos) :
Histogram(params), m_subhistos(subhistos), m_labels(nullptr)
{
m_colorScaleRange[0] = 0.0f;

View File

@ -5,11 +5,11 @@
thousands to millions of events. In the ImPlot paradigm we would need to loop over all of this data and bin it, not to mention explicitly store all of this data in memory for every histogram. I point this
out not to say that ImPlot histograms are bad intrinsically, because they definitely have a use for smaller data sets, but rather to explain why for this program I have re-invented the wheel somewhat.
HistogramParameters are the underlying data which define a histogram. This is grouped in a struct to easily pass these around for use in contexts like the Editor.
HistogramArgs are the underlying data which define a histogram. This is grouped in a struct to easily pass these around for use in contexts like the Editor.
Every histogram has a set of histogram parameters.
Histogram is the base class of all histograms. Should not be used in practice. Every histogram contains functions to query what type of underlying histogram it is. If one has
the Histogram object, Is1D() or Is2D() can be called. If one only has the HistogramParameters, the values of x_par and y_par can be inspected. In particular, a 1D histogram will have
the Histogram object, Is1D() or Is2D() can be called. If one only has the HistogramArgs, the values of x_par and y_par can be inspected. In particular, a 1D histogram will have
y_par set to "None", while a 2D histogram should have a valid parameter name for y_par.
Histogram1D is a one dimensional (single parameter) histogram. Histogram2D is a two dimensional (two parameter) histogram. The only real difference between these in practice, other than
@ -48,16 +48,16 @@ namespace Navigator {
double sigma_y = 0.0;
};
struct NAV_API HistogramParameters
struct NAV_API HistogramArgs
{
HistogramParameters() {}
HistogramArgs() {}
HistogramParameters(const std::string& n, const std::string& x, int bins, double min, double max) :
HistogramArgs(const std::string& n, const std::string& x, int bins, double min, double max) :
name(n), x_par(x), nbins_x(bins), min_x(min), max_x(max)
{
}
HistogramParameters(const std::string& n, const std::string& x, const std::string& y, int binsx, double minx, double maxx, int binsy, double miny, double maxy) :
HistogramArgs(const std::string& n, const std::string& x, const std::string& y, int binsx, double minx, double maxx, int binsy, double miny, double maxy) :
name(n), x_par(x), y_par(y), nbins_x(binsx), min_x(minx), max_x(maxx), nbins_y(binsy), min_y(miny), max_y(maxy)
{
}
@ -83,7 +83,7 @@ namespace Navigator {
m_initFlag(false)
{
}
Histogram(const HistogramParameters& params) :
Histogram(const HistogramArgs& params) :
m_params(params), m_initFlag(false)
{
}
@ -95,7 +95,7 @@ namespace Navigator {
virtual StatResults AnalyzeRegion(double x_min, double x_max, double y_min = 0.0, double y_max = 0.0) { return StatResults(); }
inline virtual float* GetColorScaleRange() { return nullptr; }
inline virtual std::vector<double> GetBinData() { return std::vector<double>(); }
inline HistogramParameters& GetParameters() { return m_params; }
inline HistogramArgs& GetParameters() { return m_params; }
inline SpectrumType GetType() { return m_params.type; }
inline const std::string& GetXParam() const { return m_params.x_par; };
inline const std::string& GetYParam() const { return m_params.y_par; };
@ -104,14 +104,14 @@ namespace Navigator {
inline void AddCutToBeApplied(const std::string& name) { m_params.cutsAppliedTo.push_back(name); }
protected:
HistogramParameters m_params;
HistogramArgs m_params;
bool m_initFlag;
};
class NAV_API Histogram1D : public Histogram
{
public:
Histogram1D(const HistogramParameters& params);
Histogram1D(const HistogramArgs& params);
virtual ~Histogram1D();
virtual void FillData(double x, double y=0.0) override;
virtual void Draw() override;
@ -131,7 +131,7 @@ namespace Navigator {
class NAV_API Histogram2D : public Histogram
{
public:
Histogram2D(const HistogramParameters& params);
Histogram2D(const HistogramArgs& params);
virtual ~Histogram2D();
virtual void FillData(double x, double y) override;
virtual void Draw() override;
@ -155,7 +155,7 @@ namespace Navigator {
class NAV_API HistogramSummary : public Histogram
{
public:
HistogramSummary(const HistogramParameters& params, const std::vector<std::string>& subhistos);
HistogramSummary(const HistogramArgs& params, const std::vector<std::string>& subhistos);
~HistogramSummary();
inline const std::vector<std::string>& GetSubHistograms() const { return m_subhistos; }

View File

@ -26,7 +26,7 @@ namespace Navigator {
/*************Histogram Functions Begin*************/
void SpectrumManager::AddHistogram(const HistogramParameters& params)
void SpectrumManager::AddHistogram(const HistogramArgs& params)
{
std::lock_guard<std::mutex> guard(m_managerMutex);
if (params.y_par == "None") //Check dimensionality
@ -35,7 +35,7 @@ namespace Navigator {
m_histoMap[params.name].reset(new Histogram2D(params));
}
void SpectrumManager::AddHistogramSummary(const HistogramParameters& params, const std::vector<std::string>& subhistos)
void SpectrumManager::AddHistogramSummary(const HistogramArgs& params, const std::vector<std::string>& subhistos)
{
std::lock_guard<std::mutex> guard(m_managerMutex);
m_histoMap[params.name].reset(new HistogramSummary(params, subhistos));
@ -153,7 +153,7 @@ namespace Navigator {
}
}
const HistogramParameters& SpectrumManager::GetHistogramParams(const std::string& name)
const HistogramArgs& SpectrumManager::GetHistogramParams(const std::string& name)
{
std::lock_guard<std::mutex> guard(m_managerMutex);
auto iter = m_histoMap.find(name);
@ -213,10 +213,10 @@ namespace Navigator {
//This function allows us to obtain the key histogram info in a list, avoiding excessive manager calls and thread-locks
//in something like the Editor.
std::vector<HistogramParameters> SpectrumManager::GetListOfHistograms()
std::vector<HistogramArgs> SpectrumManager::GetListOfHistograms()
{
std::lock_guard<std::mutex> guard(m_managerMutex);
std::vector<HistogramParameters> list;
std::vector<HistogramArgs> list;
list.reserve(m_histoMap.size());
for (auto& gram : m_histoMap)
{
@ -259,7 +259,7 @@ namespace Navigator {
auto histoIter = m_histoMap.find(param.GetName());
if (histoIter == m_histoMap.end())
{
HistogramParameters histo(param.GetName(), param.GetName(), nbins, minVal, maxVal);
HistogramArgs histo(param.GetName(), param.GetName(), nbins, minVal, maxVal);
m_histoMap[param.GetName()].reset(new Histogram1D(histo));
}
}
@ -346,13 +346,13 @@ namespace Navigator {
}
//Similar to GetListOfHistograms, see that documentation
std::vector<CutParams> SpectrumManager::GetListOfCuts()
std::vector<CutArgs> SpectrumManager::GetListOfCuts()
{
std::lock_guard<std::mutex> guard(m_managerMutex);
std::vector<CutParams> list;
std::vector<CutArgs> list;
list.reserve(m_cutMap.size());
for (auto& entry : m_cutMap)
list.push_back(entry.second->GetCutParams());
list.push_back(entry.second->GetCutArgs());
return list;
}

View File

@ -38,8 +38,8 @@ namespace Navigator {
}
/*Histogram Functions*/
void AddHistogram(const HistogramParameters& params);
void AddHistogramSummary(const HistogramParameters& params, const std::vector<std::string>& subhistos);
void AddHistogram(const HistogramArgs& params);
void AddHistogramSummary(const HistogramArgs& params, const std::vector<std::string>& subhistos);
void RemoveHistogram(const std::string& name);
void AddCutToHistogramDraw(const std::string& cutname, const std::string& histoname);
void AddCutToHistogramApplied(const std::string& cutname, const std::string& histoname);
@ -47,12 +47,12 @@ namespace Navigator {
void ClearHistograms();
void ClearHistogram(const std::string& name);
void DrawHistogram(const std::string& name);
const HistogramParameters& GetHistogramParams(const std::string& name);
const HistogramArgs& GetHistogramParams(const std::string& name);
float* GetColorScaleRange(const std::string& name);
std::vector<double> GetBinData(const std::string& name);
std::vector<std::string> GetSubHistograms(const std::string& name);
StatResults AnalyzeHistogramRegion(const std::string& name, const ImPlotRect& region);
std::vector<HistogramParameters> GetListOfHistograms();
std::vector<HistogramArgs> GetListOfHistograms();
/********************/
/*Parameter Functions*/
@ -68,12 +68,12 @@ namespace Navigator {
/********************/
/*Cut Functions*/
inline void AddCut(const CutParams& params, double min, double max)
inline void AddCut(const CutArgs& params, double min, double max)
{
std::lock_guard<std::mutex> guard(m_managerMutex);
m_cutMap[params.name].reset(new Cut1D(params, min, max));
}
inline void AddCut(const CutParams& params, const std::vector<double>& xpoints, const std::vector<double>& ypoints)
inline void AddCut(const CutArgs& params, const std::vector<double>& xpoints, const std::vector<double>& ypoints)
{
std::lock_guard<std::mutex> guard(m_managerMutex);
m_cutMap[params.name].reset(new Cut2D(params, xpoints, ypoints));
@ -81,7 +81,7 @@ namespace Navigator {
void RemoveCut(const std::string& name);
std::vector<double> GetCutXPoints(const std::string& name);
std::vector<double> GetCutYPoints(const std::string& name);
std::vector<CutParams> GetListOfCuts();
std::vector<CutArgs> GetListOfCuts();
/**************/
private:
@ -100,7 +100,7 @@ namespace Navigator {
std::unordered_map<std::string, std::shared_ptr<ParameterData>> m_paramMap;
std::unordered_map<std::string, std::shared_ptr<std::atomic<double>>> m_varMap;
HistogramParameters m_nullHistoResult; //For handling bad query
HistogramArgs m_nullHistoResult; //For handling bad query
std::mutex m_managerMutex; //synchronization
};

View File

@ -25,7 +25,7 @@ namespace Navigator {
SpectrumSerializer::~SpectrumSerializer() {}
void SpectrumSerializer::SerializeData(const std::vector<HistogramParameters>& histoList, const std::vector<CutParams>& cutList)
void SpectrumSerializer::SerializeData(const std::vector<HistogramArgs>& histoList, const std::vector<CutArgs>& cutList)
{
SpectrumManager& manager = SpectrumManager::GetInstance();
@ -174,11 +174,11 @@ namespace Navigator {
std::string check;
double value_doub;
CutParams cut_data, reset_cut;
CutArgs cut_data, reset_cut;
std::vector<double> cut_xdata;
std::vector<double> cut_ydata;
std::vector<std::string> subhistos;
HistogramParameters hist_data, reset_hist;
HistogramArgs hist_data, reset_hist;
while (input >> check)
{

View File

@ -25,7 +25,7 @@ namespace Navigator {
SpectrumSerializer(const std::string& filepath);
~SpectrumSerializer();
void SerializeData(const std::vector<HistogramParameters>& histoList, const std::vector<CutParams>& cutList);
void SerializeData(const std::vector<HistogramArgs>& histoList, const std::vector<CutArgs>& cutList);
void DeserializeData();
inline const std::string& GetFilename() { return m_filename; }

View File

@ -50,13 +50,13 @@ namespace Navigator {
void EditorLayer::UpdateHistogramList()
{
m_histoList = SpectrumManager::GetInstance().GetListOfHistograms();
std::sort(m_histoList.begin(), m_histoList.end(), SortByName<HistogramParameters>);
std::sort(m_histoList.begin(), m_histoList.end(), SortByName<HistogramArgs>);
}
void EditorLayer::UpdateCutList()
{
m_cutList = SpectrumManager::GetInstance().GetListOfCuts();
std::sort(m_cutList.begin(), m_cutList.end(), SortByName<CutParams>);
std::sort(m_cutList.begin(), m_cutList.end(), SortByName<CutArgs>);
}
void EditorLayer::UpdateParameterList()
@ -348,11 +348,11 @@ namespace Navigator {
void EditorLayer::ExportHistogramDialog()
{
static std::string filename = "";
static HistogramParameters selectedGram = HistogramParameters();
static HistogramArgs selectedGram = HistogramArgs();
if(m_exportHistogram)
{
filename = "";
selectedGram = HistogramParameters();
selectedGram = HistogramArgs();
m_exportHistogram = false;
ImGui::OpenPopup("Export Histogram");
}
@ -388,7 +388,7 @@ namespace Navigator {
}
}
void EditorLayer::ExportHistogram(HistogramParameters selectedGram, const std::string& filename)
void EditorLayer::ExportHistogram(HistogramArgs selectedGram, const std::string& filename)
{
std::ofstream output(filename);
if(!output.is_open())

View File

@ -44,7 +44,7 @@ namespace Navigator {
void UpdateHistogramList();
void UpdateCutList();
void UpdateParameterList(); //Currently not really used, only once. Params all made at construction time of PhysicsLayer
void ExportHistogram(HistogramParameters selectedGram, const std::string& filename);
void ExportHistogram(HistogramArgs selectedGram, const std::string& filename);
EventCallbackFunc m_callbackFunc;
@ -54,8 +54,8 @@ namespace Navigator {
SourceDialog m_sourceDialog;
std::vector<HistogramParameters> m_histoList;
std::vector<CutParams> m_cutList;
std::vector<HistogramArgs> m_histoList;
std::vector<CutArgs> m_cutList;
std::vector<std::string> m_paramList;
//ImGui Settings

View File

@ -24,7 +24,7 @@ namespace Navigator {
{
}
bool SpectrumDialog::ImGuiRenderSpectrumDialog(const std::vector<HistogramParameters>& histoList, const std::vector<CutParams>& cutList, const std::vector<std::string>& paramList)
bool SpectrumDialog::ImGuiRenderSpectrumDialog(const std::vector<HistogramArgs>& histoList, const std::vector<CutArgs>& cutList, const std::vector<std::string>& paramList)
{
static std::string selectedCut = "";
bool result = false;
@ -246,7 +246,7 @@ namespace Navigator {
}
}
void SpectrumDialog::RenderCutDialog(const std::vector<CutParams>& cutList)
void SpectrumDialog::RenderCutDialog(const std::vector<CutArgs>& cutList)
{
static std::string selectedCut = "";
if (m_openCutFlag)

View File

@ -21,19 +21,19 @@ namespace Navigator {
SpectrumDialog();
~SpectrumDialog();
bool ImGuiRenderSpectrumDialog(const std::vector<HistogramParameters>& histoList, const std::vector<CutParams>& cutList, const std::vector<std::string>& paramList);
bool ImGuiRenderSpectrumDialog(const std::vector<HistogramArgs>& histoList, const std::vector<CutArgs>& cutList, const std::vector<std::string>& paramList);
inline void SetSpectrumDialog() { m_openFlag = true; }
private:
void RenderDialog1D(const std::vector<std::string>& paramList);
void RenderDialog2D(const std::vector<std::string>& paramList);
void RenderDialogSummary(const std::vector<std::string>& paramList);
void RenderCutDialog(const std::vector<CutParams>& cutList);
void RenderCutDialog(const std::vector<CutArgs>& cutList);
bool m_openFlag;
bool m_openCutFlag;
HistogramParameters m_newParams;
HistogramParameters m_blank;
HistogramArgs m_newParams;
HistogramArgs m_blank;
std::vector<std::string> m_subhistos;
ImGuiSelectableFlags selectFlags;

View File

@ -34,7 +34,7 @@ namespace Navigator {
SpectrumPanel::~SpectrumPanel() {}
//Main render function. Handles generating subplot regions as well as the zoomed in region
bool SpectrumPanel::OnImGuiRender(const std::vector<HistogramParameters>& histoList, const std::vector<CutParams>& cutList, const std::vector<std::string>& paramList)
bool SpectrumPanel::OnImGuiRender(const std::vector<HistogramArgs>& histoList, const std::vector<CutArgs>& cutList, const std::vector<std::string>& paramList)
{
static bool acceptCutFlag = false;
m_result = false;
@ -68,7 +68,7 @@ namespace Navigator {
if (!m_cutModeFlag && ImPlot::IsPlotHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left))
{
m_zoomedFlag = false;
m_zoomedGram = HistogramParameters();
m_zoomedGram = HistogramArgs();
}
else if (m_cutModeFlag)
{
@ -183,7 +183,7 @@ namespace Navigator {
{
m_newCutX.push_back(ImPlot::GetPlotMousePos().x);
}
ImPlot::PlotVLines(m_newCutParams.name.c_str(), m_newCutX.data(), int(m_newCutX.size()));
ImPlot::PlotVLines(m_newCutArgs.name.c_str(), m_newCutX.data(), int(m_newCutX.size()));
break;
}
case SpectrumType::Histo2D:
@ -200,7 +200,7 @@ namespace Navigator {
m_newCutX.push_back(point.x);
m_newCutY.push_back(point.y);
}
ImPlot::PlotLine(m_newCutParams.name.c_str(), m_newCutX.data(), m_newCutY.data(), int(m_newCutX.size()));
ImPlot::PlotLine(m_newCutArgs.name.c_str(), m_newCutX.data(), m_newCutY.data(), int(m_newCutX.size()));
break;
}
}
@ -219,16 +219,16 @@ namespace Navigator {
ImGui::Text("Save this Cut?");
if (ImGui::Button("Yes"))
{
if (m_newCutParams.y_par == "None")
if (m_newCutArgs.y_par == "None")
{
std::sort(m_newCutX.begin(), m_newCutX.end());
SpectrumManager::GetInstance().AddCut(m_newCutParams, m_newCutX[0], m_newCutX[1]);
SpectrumManager::GetInstance().AddCut(m_newCutArgs, m_newCutX[0], m_newCutX[1]);
}
else
{
SpectrumManager::GetInstance().AddCut(m_newCutParams, m_newCutX, m_newCutY);
SpectrumManager::GetInstance().AddCut(m_newCutArgs, m_newCutX, m_newCutY);
}
SpectrumManager::GetInstance().AddCutToHistogramDraw(m_newCutParams.name, m_zoomedGram.name);
SpectrumManager::GetInstance().AddCutToHistogramDraw(m_newCutArgs.name, m_zoomedGram.name);
ImGui::CloseCurrentPopup();
m_result = true;
}
@ -247,34 +247,34 @@ namespace Navigator {
{
if (ImGui::Button(ICON_FA_CUT " Draw Cut"))
{
m_newCutParams = CutParams();
m_newCutArgs = CutArgs();
m_newCutX.resize(0);
m_newCutY.resize(0);
ImGui::OpenPopup(ICON_FA_CUT " New Cut Dialog");
}
if (ImGui::BeginPopupModal(ICON_FA_CUT " New Cut Dialog"))
{
m_newCutParams.x_par = m_zoomedGram.x_par;
m_newCutParams.y_par = m_zoomedGram.y_par;
m_newCutArgs.x_par = m_zoomedGram.x_par;
m_newCutArgs.y_par = m_zoomedGram.y_par;
switch (m_zoomedGram.type)
{
case SpectrumType::Histo1D:
{
m_newCutParams.type = CutType::Cut1D;
ImGui::BulletText("%s", ("X Parameter: " + m_newCutParams.x_par).c_str());
m_newCutArgs.type = CutType::Cut1D;
ImGui::BulletText("%s", ("X Parameter: " + m_newCutArgs.x_par).c_str());
break;
}
case SpectrumType::Histo2D:
{
m_newCutParams.type = CutType::Cut2D;
ImGui::BulletText("%s", ("X Parameter: " + m_newCutParams.x_par).c_str());
ImGui::BulletText("%s", ("Y Parameter: " + m_newCutParams.y_par).c_str());
m_newCutArgs.type = CutType::Cut2D;
ImGui::BulletText("%s", ("X Parameter: " + m_newCutArgs.x_par).c_str());
ImGui::BulletText("%s", ("Y Parameter: " + m_newCutArgs.y_par).c_str());
break;
}
case SpectrumType::None: m_newCutParams.type = CutType::None; break;
case SpectrumType::Summary: m_newCutParams.type = CutType::None; break;
case SpectrumType::None: m_newCutArgs.type = CutType::None; break;
case SpectrumType::Summary: m_newCutArgs.type = CutType::None; break;
}
ImGui::InputText("Cut Name", &m_newCutParams.name);
ImGui::InputText("Cut Name", &m_newCutArgs.name);
if (ImGui::Button("Accept & Draw"))
{
m_cutModeFlag = true;

View File

@ -33,7 +33,7 @@ namespace Navigator {
SpectrumPanel();
~SpectrumPanel();
bool OnImGuiRender(const std::vector<HistogramParameters>& histoList, const std::vector<CutParams>& cutList, const std::vector<std::string>& paramList);
bool OnImGuiRender(const std::vector<HistogramArgs>& histoList, const std::vector<CutArgs>& cutList, const std::vector<std::string>& paramList);
inline const std::string& GetZoomedOnHistogram() { return m_zoomedGram.name; }
inline const bool IsZoomed() { return m_zoomedFlag; }
@ -43,17 +43,17 @@ namespace Navigator {
void RenderCutButton();
void RenderRemoveRegionButton();
void RemoveSelectedRegion(const std::string& region);
std::vector<HistogramParameters> m_selectedGrams;
std::vector<HistogramArgs> m_selectedGrams;
std::vector<IntegrationRegion> m_integralRegions;
bool m_zoomedFlag;
bool m_cutModeFlag;
bool m_acceptCutFlag;
bool m_result;
HistogramParameters m_zoomedGram;
HistogramArgs m_zoomedGram;
int m_tableSizes[2];
int m_totalSlots;
int m_nRegions;
CutParams m_newCutParams;
CutArgs m_newCutArgs;
std::vector<double> m_newCutX;
std::vector<double> m_newCutY;
};