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

Added in scaler support to SpectrumManager

This commit is contained in:
Gordon McCann 2022-06-17 01:01:16 -04:00
parent ad98d7dc49
commit 3290a97f19
2 changed files with 39 additions and 0 deletions

View File

@ -332,6 +332,38 @@ namespace Navigator {
/*************Variable Functions End*************/
void SpectrumManager::BindScaler(Scaler& scaler)
{
NAV_PROFILE_FUNCTION();
std::scoped_lock<std::mutex> guard(m_managerMutex);
auto iter = m_scalerMap.find(scaler.GetName());
if (iter == m_scalerMap.end())
{
m_scalerMap[scaler.GetName()].reset(new std::atomic<uint64_t>(0));
}
scaler.m_pdata = m_scalerMap[scaler.GetName()];
}
void SpectrumManager::ResetScalers()
{
NAV_PROFILE_FUNCTION();
std::scoped_lock<std::mutex> guard(m_managerMutex);
for (auto& scaler : m_scalerMap)
{
*(scaler.second) = 0;
}
}
std::vector<std::string> SpectrumManager::GetListOfScalers()
{
std::scoped_lock<std::mutex> guard(m_managerMutex);
std::vector<std::string> list;
list.reserve(m_scalerMap.size());
for (auto& iter : m_scalerMap)
list.push_back(iter.first);
return list;
}
/*************Cut Functions Begin*************/
void SpectrumManager::RemoveCut(const std::string& name)

View File

@ -67,6 +67,12 @@ namespace Navigator {
std::vector<std::string> GetListOfVariables();
/********************/
/*Scaler Functions*/
void BindScaler(Scaler& scaler);
void ResetScalers();
std::vector<std::string> GetListOfScalers();
/******************/
/*Cut Functions*/
inline void AddCut(const CutArgs& params, double min, double max)
{
@ -105,6 +111,7 @@ namespace Navigator {
std::unordered_map<std::string, std::shared_ptr<Cut>> m_cutMap;
std::unordered_map<std::string, std::shared_ptr<ParameterData>> m_paramMap;
std::unordered_map<std::string, std::shared_ptr<std::atomic<double>>> m_varMap;
std::unordered_map<std::string, std::shared_ptr<std::atomic<uint64_t>>> m_scalerMap;
HistogramArgs m_nullHistoResult; //For handling bad query