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

Remove now unused channels per board references from everywhere.

This commit is contained in:
Gordon McCann 2022-10-01 15:26:41 -04:00
parent c0b51c5ba9
commit 1de7bc9b7d
14 changed files with 43 additions and 58 deletions

View File

@ -44,7 +44,6 @@ namespace Specter {
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"))
@ -79,7 +78,6 @@ namespace Specter {
{ {
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)
{ {
@ -92,13 +90,11 @@ namespace Specter {
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);
} }
else if (m_chosenType == DataSource::SourceType::DaqromancyOnline) else if (m_chosenType == DataSource::SourceType::DaqromancyOnline)
{ {
ImGui::InputText("Hostname", &m_chosenLocation); ImGui::InputText("Hostname", &m_chosenLocation);
ImGui::InputText("Port", &m_chosenPort); ImGui::InputText("Port", &m_chosenPort);
ImGui::InputInt("Channels Per Digitizer Board", &m_channels_per_board);
} }
else if (m_chosenType == DataSource::SourceType::DaqromancyOffline) else if (m_chosenType == DataSource::SourceType::DaqromancyOffline)
{ {
@ -111,7 +107,6 @@ namespace Specter {
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);
@ -120,12 +115,12 @@ namespace Specter {
{ {
if (m_chosenType == DataSource::SourceType::CompassOffline || m_chosenType == DataSource::SourceType::DaqromancyOffline) if (m_chosenType == DataSource::SourceType::CompassOffline || m_chosenType == DataSource::SourceType::DaqromancyOffline)
{ {
PhysicsStartEvent event(m_chosenLocation, m_chosenType, m_chosenWindow, m_chosenPort, false, 0U, m_channels_per_board); PhysicsStartEvent event(m_chosenLocation, m_chosenType, m_chosenWindow, m_chosenPort, false, 0U);
Application::Get().OnEvent(event); Application::Get().OnEvent(event);
} }
else if (m_chosenType == DataSource::SourceType::CompassOnline || m_chosenType == DataSource::SourceType::DaqromancyOnline) else if (m_chosenType == DataSource::SourceType::CompassOnline || m_chosenType == DataSource::SourceType::DaqromancyOnline)
{ {
PhysicsStartEvent event(m_chosenLocation, m_chosenType, m_chosenWindow, m_chosenPort, true, m_bitflags, m_channels_per_board); PhysicsStartEvent event(m_chosenLocation, m_chosenType, m_chosenWindow, m_chosenPort, true, m_bitflags);
Application::Get().OnEvent(event); Application::Get().OnEvent(event);
} }
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();

View File

@ -30,7 +30,6 @@ namespace Specter {
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;
}; };
} }

View File

@ -21,9 +21,8 @@ namespace Specter {
{ {
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) :
int channels_per_board=16) : m_sourceLocation(loc), m_port(port), m_sourceType(type), m_coincidenceWindow(window), m_sortFlag(sortFlag), m_bitflags(bitflags)
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 const std::string GetSourceLocation() const { return m_sourceLocation; } inline const std::string GetSourceLocation() const { return m_sourceLocation; }
@ -31,7 +30,6 @@ namespace Specter {
inline const DataSource::SourceType GetSourceType() const { return m_sourceType; } inline const DataSource::SourceType GetSourceType() const { return m_sourceType; }
inline const uint64_t GetCoincidenceWindow() const { return m_coincidenceWindow; } inline const uint64_t GetCoincidenceWindow() const { return m_coincidenceWindow; }
inline const bool GetSortFlag() const { 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; } inline const uint16_t GetBitFlags() const { return m_bitflags; }
std::string ToString() const override std::string ToString() const override
@ -49,7 +47,6 @@ namespace Specter {
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 PhysicsStopEvent : public Event class PhysicsStopEvent : public Event

View File

@ -5,13 +5,6 @@
need to know if the buffer is/was filled, however we use non-blocking since we don't want the entire process to hang on attempting a connection or waiting need to know if the buffer is/was filled, however we use non-blocking since we don't want the entire process to hang on attempting a connection or waiting
for data to come over the pipe. We handle the case of an un-filled buffer internally. for data to come over the pipe. We handle the case of an un-filled buffer internally.
IMPORTANT
Specter wants a unqiue ID on each hit. To do this we use the idiom:
id = board_number * nchannels_per_board + channel_number
This requires two things: that the class variable m_nchannels_per_board be set to match your physical digitizers, and that ALL of your
digitizers have the SAME number of channels. By default CompassRun assumes 16 channels per board, as this is what is used with the SE-SPS setup at FoxLab.
If you use a different set of boards, CHANGE THIS VALUE! If you use mixed boards, you will need to invent a new id scheme altogether.
ADDITIONALLY ADDITIONALLY
CoMPASS servers provide no stream side information on the state of a transfer (verified via communication w/ CAEN). That is: there are no headers or enders on the data transfers. CoMPASS servers provide no stream side information on the state of a transfer (verified via communication w/ CAEN). That is: there are no headers or enders on the data transfers.
This forces us to use the size of a single CoMPASS datum (CompassHit) to determine the state of a transfer. If the read buffer size is not a whole multiple of CompassHits, the data This forces us to use the size of a single CoMPASS datum (CompassHit) to determine the state of a transfer. If the read buffer size is not a whole multiple of CompassHits, the data
@ -20,13 +13,17 @@
Maybe we can get them to change this? Headers reeaaally should exist for transfers like this. Maybe we can get them to change this? Headers reeaaally should exist for transfers like this.
GWM -- April 2022 GWM -- April 2022
Make it so that number of channels per board is no longer fixed. Use pairing function defined in Utils/Functions.h to generate a UUID for each board channel/pair.
GWM -- Oct 2022
*/ */
#include "CompassOnlineSource.h" #include "CompassOnlineSource.h"
namespace Specter { namespace Specter {
CompassOnlineSource::CompassOnlineSource(const std::string& hostname, const std::string& port, uint16_t header, int channels_per_board) : CompassOnlineSource::CompassOnlineSource(const std::string& hostname, const std::string& port, uint16_t header) :
DataSource(), m_bufferIter(nullptr), m_bufferEnd(nullptr), m_header(header), m_nchannels_per_board(channels_per_board) DataSource(), m_bufferIter(nullptr), m_bufferEnd(nullptr), m_header(header)
{ {
InitConnection(hostname, port); InitConnection(hostname, port);
} }

View File

@ -5,13 +5,6 @@
need to know if the buffer is/was filled, however we use non-blocking since we don't want the entire process to hang on attempting a connection or waiting need to know if the buffer is/was filled, however we use non-blocking since we don't want the entire process to hang on attempting a connection or waiting
for data to come over the pipe. We handle the case of an un-filled buffer internally. for data to come over the pipe. We handle the case of an un-filled buffer internally.
IMPORTANT
Specter wants a unqiue ID on each hit. To do this we use the idiom:
id = board_number * nchannels_per_board + channel_number
This requires two things: that the class variable m_nchannels_per_board be set to match your physical digitizers, and that ALL of your
digitizers have the SAME number of channels. By default CompassRun assumes 16 channels per board, as this is what is used with the SE-SPS setup at FoxLab.
If you use a different set of boards, CHANGE THIS VALUE! If you use mixed boards, you will need to invent a new id scheme altogether.
ADDITIONALLY ADDITIONALLY
CoMPASS servers provide no stream side information on the state of a transfer (verified via communication w/ CAEN). That is: there are no headers or enders on the data transfers. CoMPASS servers provide no stream side information on the state of a transfer (verified via communication w/ CAEN). That is: there are no headers or enders on the data transfers.
This forces us to use the size of a single CoMPASS datum (CompassHit) to determine the state of a transfer. If the read buffer size is not a whole multiple of CompassHits, the data This forces us to use the size of a single CoMPASS datum (CompassHit) to determine the state of a transfer. If the read buffer size is not a whole multiple of CompassHits, the data
@ -26,6 +19,10 @@
of Specter's runtime). Best to use the CoMPASSPlot for waves. of Specter's runtime). Best to use the CoMPASSPlot for waves.
GWM -- May 2022 GWM -- May 2022
Make it so that number of channels per board is no longer fixed. Use pairing function defined in Utils/Functions.h to generate a UUID for each board channel/pair.
GWM -- Oct 2022
*/ */
#ifndef COMPASS_ONLINE_SOURCE_H #ifndef COMPASS_ONLINE_SOURCE_H
#define COMPASS_ONLINE_SOURCE_H #define COMPASS_ONLINE_SOURCE_H
@ -39,7 +36,7 @@ namespace Specter {
class CompassOnlineSource : public DataSource class CompassOnlineSource : public DataSource
{ {
public: public:
CompassOnlineSource(const std::string& hostname, const std::string& port, uint16_t header, int channels_per_board=16); CompassOnlineSource(const std::string& hostname, const std::string& port, uint16_t header);
virtual ~CompassOnlineSource() override; virtual ~CompassOnlineSource() override;
virtual const SpecData& GetData() override; virtual const SpecData& GetData() override;
@ -53,8 +50,6 @@ namespace Specter {
std::vector<char> m_currentBuffer; std::vector<char> m_currentBuffer;
uint16_t m_header; uint16_t m_header;
int m_datasize; //size of CoMPASS hit in bytes, set by header arg int m_datasize; //size of CoMPASS hit in bytes, set by header arg
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
//different numbers of channels, you will have to find a different id solution.
char* m_bufferIter; char* m_bufferIter;
char* m_bufferEnd; char* m_bufferEnd;
CompassHit m_currentHit; CompassHit m_currentHit;

View File

@ -10,25 +10,29 @@
Updated to also handle scaler data. -- GWM Oct. 2020 Updated to also handle scaler data. -- GWM Oct. 2020
Modifed and updated for use in Specter. Obviously stripped out any ROOT code. Also, now uses the very nice std::filesystem Modifed and updated for use in Specter. Obviously stripped out any ROOT code. Also, now uses the very nice std::filesystem
library to handle filepathing. Also, removed scalers (for now). library to handle filepathing.
GWM -- Feb 2022 GWM -- Feb 2022
Update to reflect new CAEN binary data format with headers to indicate data contents. Update to reflect new CAEN binary data format with headers to indicate data contents.
GWM -- May 2022 GWM -- May 2022
Make it so that number of channels per board is no longer fixed. Use pairing function defined in Utils/Functions.h to generate a UUID for each board channel/pair.
GWM -- Oct 2022
*/ */
#include "CompassRun.h" #include "CompassRun.h"
namespace Specter { namespace Specter {
CompassRun::CompassRun() : CompassRun::CompassRun() :
DataSource(), m_directory(""), m_startIndex(0), m_nchannels_per_board(16) DataSource(), m_directory(""), m_startIndex(0)
{ {
} }
CompassRun::CompassRun(const std::string& dir, int channels_per_board) : CompassRun::CompassRun(const std::string& dir) :
DataSource(), m_directory(dir), m_startIndex(0), m_nchannels_per_board(channels_per_board) DataSource(), m_directory(dir), m_startIndex(0)
{ {
CollectFiles(); CollectFiles();
} }

View File

@ -8,17 +8,17 @@
Written by G.W. McCann Oct. 2020 Written by G.W. McCann Oct. 2020
Modifed and updated for use in Specter. Obviously stripped out any ROOT code. Also, now uses the very nice std::filesystem Modifed and updated for use in Specter. Obviously stripped out any ROOT code. Also, now uses the very nice std::filesystem
library to handle filepathing. One change of great import: Specter wants a unqiue ID on each hit. To do this we use the idiom: library to handle filepathing.
id = board_number * nchannels_per_board + channel_number
This requires two things: that the class variable m_nchannels_per_board be set to match your physical digitizers, and that ALL of your
digitizers have the SAME number of channels. By default CompassRun assumes 16 channels per board, as this is what is used with the SE-SPS setup at FoxLab.
If you use a different set of boards, CHANGE THIS VALUE! If you use mixed boards, you will need to invent a new id scheme altogether.
GWM -- Feb 2022 GWM -- Feb 2022
Update to reflect new CAEN binary data format with headers to indicate data contents. Update to reflect new CAEN binary data format with headers to indicate data contents.
GWM -- May 2022 GWM -- May 2022
Make it so that number of channels per board is no longer fixed. Use pairing function defined in Utils/Functions.h to generate a UUID for each board channel/pair.
GWM -- Oct 2022
*/ */
#ifndef COMPASSRUN_H #ifndef COMPASSRUN_H
#define COMPASSRUN_H #define COMPASSRUN_H
@ -36,7 +36,7 @@ namespace Specter {
public: public:
CompassRun(); CompassRun();
CompassRun(const std::string& dir, int channels_per_board=16); CompassRun(const std::string& dir);
virtual ~CompassRun(); virtual ~CompassRun();
virtual const SpecData& GetData() override; virtual const SpecData& 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,8 +52,7 @@ namespace Specter {
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.
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.
ShiftMap m_smap; ShiftMap m_smap;
CompassHit m_hit; CompassHit m_hit;

View File

@ -2,8 +2,8 @@
namespace Specter { namespace Specter {
DYFileSource::DYFileSource(const std::string& directory, int channels_per_board) : DYFileSource::DYFileSource(const std::string& directory) :
DataSource(), m_directory(directory), m_channelsPerBoard(channels_per_board) DataSource(), m_directory(directory)
{ {
CollectFiles(); CollectFiles();
} }

View File

@ -10,7 +10,7 @@ namespace Specter {
class DYFileSource : public DataSource class DYFileSource : public DataSource
{ {
public: public:
DYFileSource(const std::string& directory, int channels_per_board = 16); DYFileSource(const std::string& directory);
virtual ~DYFileSource(); virtual ~DYFileSource();
virtual const SpecData& GetData() override; virtual const SpecData& GetData() override;
@ -21,7 +21,6 @@ namespace Specter {
std::filesystem::path m_directory; std::filesystem::path m_directory;
static constexpr std::string_view s_extension = ".dybin"; static constexpr std::string_view s_extension = ".dybin";
int m_channelsPerBoard;
std::vector<DaqGrimoire::DYFileReader> m_files; std::vector<DaqGrimoire::DYFileReader> m_files;
DaqGrimoire::DYListData m_dyHit; DaqGrimoire::DYListData m_dyHit;

View File

@ -2,8 +2,8 @@
namespace Specter { namespace Specter {
DYOnlineSource::DYOnlineSource(const std::string& hostname, const std::string& port, int channelsPerBoard) : DYOnlineSource::DYOnlineSource(const std::string& hostname, const std::string& port) :
DataSource(), m_clientConnection(hostname, port), m_channelsPerBoard(channelsPerBoard) DataSource(), m_clientConnection(hostname, port)
{ {
m_validFlag = m_clientConnection.IsConnected(); m_validFlag = m_clientConnection.IsConnected();
} }

View File

@ -9,7 +9,7 @@ namespace Specter {
class DYOnlineSource : public DataSource class DYOnlineSource : public DataSource
{ {
public: public:
DYOnlineSource(const std::string& hostname, const std::string& port, int channelsPerBoard = 16); DYOnlineSource(const std::string& hostname, const std::string& port);
~DYOnlineSource(); ~DYOnlineSource();
virtual const SpecData& GetData() override; virtual const SpecData& GetData() override;

View File

@ -15,14 +15,14 @@
namespace Specter { namespace Specter {
//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& location, const std::string& port, uint16_t header, int channels_per_board, DataSource::SourceType type) DataSource* CreateDataSource(const std::string& location, const std::string& port, uint16_t header, DataSource::SourceType type)
{ {
switch(type) switch(type)
{ {
case DataSource::SourceType::CompassOffline : return new CompassRun(location, channels_per_board); case DataSource::SourceType::CompassOffline : return new CompassRun(location);
case DataSource::SourceType::CompassOnline : return new CompassOnlineSource(location, port, header, channels_per_board); case DataSource::SourceType::CompassOnline : return new CompassOnlineSource(location, port, header);
case DataSource::SourceType::DaqromancyOffline: return new DYFileSource(location, channels_per_board); case DataSource::SourceType::DaqromancyOffline: return new DYFileSource(location);
case DataSource::SourceType::DaqromancyOnline: return new DYOnlineSource(location, port, channels_per_board); case DataSource::SourceType::DaqromancyOnline: return new DYOnlineSource(location, port);
case DataSource::SourceType::None : return nullptr; case DataSource::SourceType::None : return nullptr;
} }
SPEC_WARN("Invalid DataSourceType at CreateDataSource!"); SPEC_WARN("Invalid DataSourceType at CreateDataSource!");

View File

@ -40,7 +40,7 @@ namespace Specter {
SpecData m_datum; SpecData m_datum;
}; };
DataSource* CreateDataSource(const std::string& location, const std::string& port, uint16_t bitflags, int channels_per_board, DataSource::SourceType type); DataSource* CreateDataSource(const std::string& location, const std::string& port, uint16_t bitflags, DataSource::SourceType type);
std::string ConvertDataSourceTypeToString(DataSource::SourceType type); std::string ConvertDataSourceTypeToString(DataSource::SourceType type);
} }

View File

@ -114,7 +114,7 @@ namespace Specter {
{ {
SPEC_PROFILE_FUNCTION(); SPEC_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.GetBitFlags(), event.GetChannelsPerBoard(), event.GetSourceType())); m_source.reset(CreateDataSource(event.GetSourceLocation(), event.GetSourcePort(), event.GetBitFlags(), 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