mirror of
https://github.com/gwm17/Specter.git
synced 2025-04-18 05:48:52 -04:00
Added in flexible board channel count to both online and offline CoMPASS sources. Started process of adding in scaler support (maybe graphs?)
This commit is contained in:
parent
29433be65a
commit
e1b56dd1c3
|
@ -3,7 +3,7 @@
|
||||||
An example of what a user created layer might look like. This is how one would extend the base editor to have more
|
An example of what a user created layer might look like. This is how one would extend the base editor to have more
|
||||||
functionality, specific to their experiment/setup. In this case, we provide inputs for reaction information so that
|
functionality, specific to their experiment/setup. In this case, we provide inputs for reaction information so that
|
||||||
the kinematic shift of the SE-SPS focal plane can be calculated, and weights for tracing particle trajectories are
|
the kinematic shift of the SE-SPS focal plane can be calculated, and weights for tracing particle trajectories are
|
||||||
produced for use in analysis (as NavVariables).
|
produced for use in analysis (as Variables).
|
||||||
|
|
||||||
A reminder that these layers should not be that intense. The more work that is shoved into the UI, the less responsive
|
A reminder that these layers should not be that intense. The more work that is shoved into the UI, the less responsive
|
||||||
and more sluggish overall the UI will become. The vast bulk of the analysis work should be left to the PhysicsLayer which has its own
|
and more sluggish overall the UI will become. The vast bulk of the analysis work should be left to the PhysicsLayer which has its own
|
||||||
|
|
|
@ -61,4 +61,36 @@ namespace Navigator {
|
||||||
}
|
}
|
||||||
|
|
||||||
Variable::~Variable() {}
|
Variable::~Variable() {}
|
||||||
|
|
||||||
|
void Variable::SetName(const std::string& name)
|
||||||
|
{
|
||||||
|
if (m_name != "")
|
||||||
|
{
|
||||||
|
NAV_ERROR("Attempting to change the name of an already bound Variable! Set name: {0} New name: {1}", m_name, name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
Scaler::Scaler() :
|
||||||
|
m_pdata(nullptr), m_name("")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Scaler::Scaler(const std::string& name) :
|
||||||
|
m_pdata(nullptr), m_name(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Scaler::~Scaler() {}
|
||||||
|
|
||||||
|
void Scaler::SetName(const std::string& name)
|
||||||
|
{
|
||||||
|
if (m_name != "")
|
||||||
|
{
|
||||||
|
NAV_ERROR("Attempting to change the name of an already bound Scaler! Set name: {0} New name: {1}", m_name, name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_name = name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ namespace Navigator {
|
||||||
inline void SetValue(double value) { *(m_pdata) = value; }
|
inline void SetValue(double value) { *(m_pdata) = value; }
|
||||||
inline double GetValue() { return *(m_pdata); }
|
inline double GetValue() { return *(m_pdata); }
|
||||||
inline const std::string& GetName() { return m_name; }
|
inline const std::string& GetName() { return m_name; }
|
||||||
|
void SetName(const std::string& name);
|
||||||
|
|
||||||
friend class SpectrumManager;
|
friend class SpectrumManager;
|
||||||
private:
|
private:
|
||||||
|
@ -81,6 +82,25 @@ namespace Navigator {
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Scaler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Scaler();
|
||||||
|
Scaler(const std::string& name);
|
||||||
|
~Scaler();
|
||||||
|
|
||||||
|
inline void Increment() { ++(*m_pdata); }
|
||||||
|
|
||||||
|
inline const std::string& GetName() { return m_name; }
|
||||||
|
inline uint64_t GetCounts() { return *m_pdata; }
|
||||||
|
void SetName(const std::string& name);
|
||||||
|
|
||||||
|
friend class SpectrumManager;
|
||||||
|
private:
|
||||||
|
std::shared_ptr<std::atomic<uint64_t>> m_pdata;
|
||||||
|
std::string m_name;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,6 +43,7 @@ namespace Navigator {
|
||||||
m_chosenPort = "51489";
|
m_chosenPort = "51489";
|
||||||
m_chosenWindow = 3000000;
|
m_chosenWindow = 3000000;
|
||||||
m_bitflags = 0;
|
m_bitflags = 0;
|
||||||
|
m_channels_per_board = 16;
|
||||||
ImGui::OpenPopup(ICON_FA_LINK " Attach Source");
|
ImGui::OpenPopup(ICON_FA_LINK " Attach Source");
|
||||||
}
|
}
|
||||||
if (ImGui::BeginPopupModal(ICON_FA_LINK " Attach Source"))
|
if (ImGui::BeginPopupModal(ICON_FA_LINK " Attach Source"))
|
||||||
|
@ -77,6 +78,7 @@ namespace Navigator {
|
||||||
{
|
{
|
||||||
m_bitflags = m_bitflags ^ CompassHeaders::EnergyCalibrated;
|
m_bitflags = m_bitflags ^ CompassHeaders::EnergyCalibrated;
|
||||||
}
|
}
|
||||||
|
ImGui::InputInt("Channels Per Digitizer Board", &m_channels_per_board);
|
||||||
}
|
}
|
||||||
else if (m_chosenType == DataSource::SourceType::CompassOffline)
|
else if (m_chosenType == DataSource::SourceType::CompassOffline)
|
||||||
{
|
{
|
||||||
|
@ -88,6 +90,7 @@ namespace Navigator {
|
||||||
auto temp = m_fileDialog.RenderFileDialog();
|
auto temp = m_fileDialog.RenderFileDialog();
|
||||||
if (!temp.first.empty() && temp.second == FileDialog::Type::OpenDir)
|
if (!temp.first.empty() && temp.second == FileDialog::Type::OpenDir)
|
||||||
m_chosenLocation = temp.first;
|
m_chosenLocation = temp.first;
|
||||||
|
ImGui::InputInt("Channels Per Digitizer Board", &m_channels_per_board);
|
||||||
}
|
}
|
||||||
ImGui::InputInt("Coinc. Window (ps)", &m_chosenWindow);
|
ImGui::InputInt("Coinc. Window (ps)", &m_chosenWindow);
|
||||||
|
|
||||||
|
@ -96,12 +99,12 @@ namespace Navigator {
|
||||||
{
|
{
|
||||||
if (m_chosenType == DataSource::SourceType::CompassOffline)
|
if (m_chosenType == DataSource::SourceType::CompassOffline)
|
||||||
{
|
{
|
||||||
PhysicsStartEvent event(m_chosenLocation, m_chosenType, m_chosenWindow, m_chosenPort);
|
PhysicsStartEvent event(m_chosenLocation, m_chosenType, m_chosenWindow, m_chosenPort, false, 0U, m_channels_per_board);
|
||||||
Application::Get().OnEvent(event);
|
Application::Get().OnEvent(event);
|
||||||
}
|
}
|
||||||
else if (m_chosenType == DataSource::SourceType::CompassOnline)
|
else if (m_chosenType == DataSource::SourceType::CompassOnline)
|
||||||
{
|
{
|
||||||
PhysicsStartEvent event(m_chosenLocation, m_chosenType, m_chosenWindow, m_chosenPort, true, m_bitflags);
|
PhysicsStartEvent event(m_chosenLocation, m_chosenType, m_chosenWindow, m_chosenPort, true, m_bitflags, m_channels_per_board);
|
||||||
Application::Get().OnEvent(event);
|
Application::Get().OnEvent(event);
|
||||||
}
|
}
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace Navigator {
|
||||||
FileDialog m_fileDialog;
|
FileDialog m_fileDialog;
|
||||||
uint16_t m_bitflags;
|
uint16_t m_bitflags;
|
||||||
int m_chosenWindow;
|
int m_chosenWindow;
|
||||||
|
int m_channels_per_board;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,15 +21,18 @@ namespace Navigator {
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//Bitflags is a final option for random crap needed for a source. Currently used for compass online to indicate header state.
|
//Bitflags is a final option for random crap needed for a source. Currently used for compass online to indicate header state.
|
||||||
PhysicsStartEvent(const std::string& loc, DataSource::SourceType type, uint64_t window, const std::string& port = "51489", bool sortFlag=false, uint16_t bitflags = 0) :
|
PhysicsStartEvent(const std::string& loc, DataSource::SourceType type, uint64_t window, const std::string& port = "51489", bool sortFlag=false, uint16_t bitflags = 0,
|
||||||
m_sourceLocation(loc), m_port(port), m_sourceType(type), m_coincidenceWindow(window), m_sortFlag(sortFlag), m_bitflags(bitflags)
|
int channels_per_board=16) :
|
||||||
|
m_sourceLocation(loc), m_port(port), m_sourceType(type), m_coincidenceWindow(window), m_sortFlag(sortFlag), m_bitflags(bitflags), m_channels_per_board(channels_per_board)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
inline std::string GetSourceLocation() { return m_sourceLocation; }
|
inline const std::string GetSourceLocation() const { return m_sourceLocation; }
|
||||||
inline std::string GetSourcePort() { return m_port; }
|
inline const std::string GetSourcePort() const { return m_port; }
|
||||||
inline DataSource::SourceType GetSourceType() { return m_sourceType; }
|
inline const DataSource::SourceType GetSourceType() const { return m_sourceType; }
|
||||||
inline uint64_t GetCoincidenceWindow() { return m_coincidenceWindow; }
|
inline const uint64_t GetCoincidenceWindow() const { return m_coincidenceWindow; }
|
||||||
inline bool GetSortFlag() { return m_sortFlag; }
|
inline const bool GetSortFlag() const { return m_sortFlag; }
|
||||||
|
inline const int GetChannelsPerBoard() const { return m_channels_per_board; }
|
||||||
|
inline const uint16_t GetBitFlags() const { return m_bitflags; }
|
||||||
|
|
||||||
std::string ToString() const override
|
std::string ToString() const override
|
||||||
{
|
{
|
||||||
|
@ -46,6 +49,7 @@ namespace Navigator {
|
||||||
uint64_t m_coincidenceWindow;
|
uint64_t m_coincidenceWindow;
|
||||||
bool m_sortFlag;
|
bool m_sortFlag;
|
||||||
uint16_t m_bitflags;
|
uint16_t m_bitflags;
|
||||||
|
int m_channels_per_board;
|
||||||
};
|
};
|
||||||
|
|
||||||
class NAV_API PhysicsStopEvent : public Event
|
class NAV_API PhysicsStopEvent : public Event
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
|
|
||||||
namespace Navigator {
|
namespace Navigator {
|
||||||
|
|
||||||
CompassOnlineSource::CompassOnlineSource(const std::string& hostname, const std::string& port, uint16_t header) :
|
CompassOnlineSource::CompassOnlineSource(const std::string& hostname, const std::string& port, uint16_t header, int channels_per_board) :
|
||||||
DataSource(), m_bufferIter(nullptr), m_bufferEnd(nullptr), m_header(header)
|
DataSource(), m_bufferIter(nullptr), m_bufferEnd(nullptr), m_header(header), m_nchannels_per_board(channels_per_board)
|
||||||
{
|
{
|
||||||
InitConnection(hostname, port);
|
InitConnection(hostname, port);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace Navigator {
|
||||||
class CompassOnlineSource : public DataSource
|
class CompassOnlineSource : public DataSource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CompassOnlineSource(const std::string& hostname, const std::string& port, uint16_t header);
|
CompassOnlineSource(const std::string& hostname, const std::string& port, uint16_t header, int channels_per_board=16);
|
||||||
virtual ~CompassOnlineSource() override;
|
virtual ~CompassOnlineSource() override;
|
||||||
|
|
||||||
virtual const NavData& GetData() override;
|
virtual const NavData& GetData() override;
|
||||||
|
|
|
@ -23,12 +23,12 @@
|
||||||
namespace Navigator {
|
namespace Navigator {
|
||||||
|
|
||||||
CompassRun::CompassRun() :
|
CompassRun::CompassRun() :
|
||||||
DataSource(), m_directory(""), m_startIndex(0)
|
DataSource(), m_directory(""), m_startIndex(0), m_nchannels_per_board(16)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CompassRun::CompassRun(const std::string& dir) :
|
CompassRun::CompassRun(const std::string& dir, int channels_per_board) :
|
||||||
DataSource(), m_directory(dir), m_startIndex(0)
|
DataSource(), m_directory(dir), m_startIndex(0), m_nchannels_per_board(channels_per_board)
|
||||||
{
|
{
|
||||||
CollectFiles();
|
CollectFiles();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace Navigator {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CompassRun();
|
CompassRun();
|
||||||
CompassRun(const std::string& dir);
|
CompassRun(const std::string& dir, int channels_per_board=16);
|
||||||
virtual ~CompassRun();
|
virtual ~CompassRun();
|
||||||
virtual const NavData& GetData() override;
|
virtual const NavData& GetData() override;
|
||||||
inline void SetDirectory(const std::string& dir) { m_directory = dir; CollectFiles(); }
|
inline void SetDirectory(const std::string& dir) { m_directory = dir; CollectFiles(); }
|
||||||
|
@ -52,7 +52,7 @@ namespace Navigator {
|
||||||
|
|
||||||
std::vector<CompassFile> m_datafiles;
|
std::vector<CompassFile> m_datafiles;
|
||||||
unsigned int m_startIndex; //this is the file we start looking at; increases as we finish files.
|
unsigned int m_startIndex; //this is the file we start looking at; increases as we finish files.
|
||||||
const int m_nchannels_per_board = 16; //IMPORTANT: Used for ID'ing channels uniquely. If you use boards with 32 or 8 or 64 channels you must change this! If you mix boards with
|
int m_nchannels_per_board; //IMPORTANT: Used for ID'ing channels uniquely. If you use boards with 32 or 8 or 64 channels you must change this! If you mix boards with
|
||||||
//different numbers of channels, you will have to find a different id solution.
|
//different numbers of channels, you will have to find a different id solution.
|
||||||
ShiftMap m_smap;
|
ShiftMap m_smap;
|
||||||
|
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
namespace Navigator {
|
namespace Navigator {
|
||||||
|
|
||||||
//loc=either an ip address or a file location, port=address port, or unused in case of file
|
//loc=either an ip address or a file location, port=address port, or unused in case of file
|
||||||
DataSource* CreateDataSource(const std::string& loc, const std::string& port, DataSource::SourceType type, uint16_t bitflags)
|
DataSource* CreateDataSource(const std::string& location, const std::string& port, uint16_t header, int channels_per_board, DataSource::SourceType type)
|
||||||
{
|
{
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case DataSource::SourceType::CompassOffline : return new CompassRun(loc);
|
case DataSource::SourceType::CompassOffline : return new CompassRun(location, channels_per_board);
|
||||||
case DataSource::SourceType::CompassOnline : return new CompassOnlineSource(loc, port, bitflags);
|
case DataSource::SourceType::CompassOnline : return new CompassOnlineSource(location, port, header, channels_per_board);
|
||||||
case DataSource::SourceType::None : return nullptr;
|
case DataSource::SourceType::None : return nullptr;
|
||||||
}
|
}
|
||||||
NAV_WARN("Invalid DataSourceType at CreateDataSource!");
|
NAV_WARN("Invalid DataSourceType at CreateDataSource!");
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace Navigator {
|
||||||
NavData m_datum;
|
NavData m_datum;
|
||||||
};
|
};
|
||||||
|
|
||||||
NAV_API DataSource* CreateDataSource(const std::string& loc, const std::string& port, DataSource::SourceType type, uint16_t bitflags = 0);
|
NAV_API DataSource* CreateDataSource(const std::string& location, const std::string& port, uint16_t bitflags, int channels_per_board, DataSource::SourceType type);
|
||||||
|
|
||||||
NAV_API std::string ConvertDataSourceTypeToString(DataSource::SourceType type);
|
NAV_API std::string ConvertDataSourceTypeToString(DataSource::SourceType type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ namespace Navigator {
|
||||||
{
|
{
|
||||||
NAV_PROFILE_FUNCTION();
|
NAV_PROFILE_FUNCTION();
|
||||||
std::scoped_lock<std::mutex> guard(m_sourceMutex); //Shouldn't matter for this, but safety first
|
std::scoped_lock<std::mutex> guard(m_sourceMutex); //Shouldn't matter for this, but safety first
|
||||||
m_source.reset(CreateDataSource(event.GetSourceLocation(), event.GetSourcePort(), event.GetSourceType()));
|
m_source.reset(CreateDataSource(event.GetSourceLocation(), event.GetSourcePort(), event.GetBitFlags(), event.GetChannelsPerBoard(), event.GetSourceType()));
|
||||||
m_eventBuilder.SetCoincidenceWindow(event.GetCoincidenceWindow());
|
m_eventBuilder.SetCoincidenceWindow(event.GetCoincidenceWindow());
|
||||||
m_eventBuilder.SetSortFlag(event.GetSortFlag());
|
m_eventBuilder.SetSortFlag(event.GetSortFlag());
|
||||||
m_eventBuilder.ClearAll(); //Protect against stopping mid-event
|
m_eventBuilder.ClearAll(); //Protect against stopping mid-event
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace Navigator {
|
||||||
|
|
||||||
void OpenGLContext::Init()
|
void OpenGLContext::Init()
|
||||||
{
|
{
|
||||||
|
NAV_PROFILE_FUNCTION();
|
||||||
glfwMakeContextCurrent(m_windowHandle);
|
glfwMakeContextCurrent(m_windowHandle);
|
||||||
|
|
||||||
int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
|
int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
|
||||||
|
|
|
@ -35,6 +35,7 @@ namespace Navigator {
|
||||||
|
|
||||||
void OpenGLWindow::Init(const WindowProperties& props)
|
void OpenGLWindow::Init(const WindowProperties& props)
|
||||||
{
|
{
|
||||||
|
NAV_PROFILE_FUNCTION();
|
||||||
m_data.width = props.width;
|
m_data.width = props.width;
|
||||||
m_data.height = props.height;
|
m_data.height = props.height;
|
||||||
m_data.name = props.name;
|
m_data.name = props.name;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user