Skip to content
Snippets Groups Projects
Commit 4807efde authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau Committed by Volker Friese
Browse files

[algo] Prepare DigiEventQa for Histo publication

- Add to DigiEventQaConfig a static method to get the name of digi time histos (avoid copies w/ risk of divergence)
- Add in DigiEventQaConfig a method to get Config strings for all histos (ensure same output folder)
- Add in DigiEventQaConfig a method to get Config strings for all canvases + prepare it for Digi Time in Event canvas
- Change storage for Histo1D in DigiEventQaData to a vector + modify map to provide reference to entry in it (preparation for addition of other histograms)
- Add GetConfig accessor to DigiEventQa
parent 43926a9a
No related branches found
No related tags found
1 merge request!1212Add services main folder + histogram server binary w/o FairMQ + tester binary example
/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt /* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only SPDX-License-Identifier: GPL-3.0-only
Authors: Volker Friese [committer] */ Authors: Volker Friese [committer], P.-A. Loizeau */
#include "DigiEventQa.h" #include "DigiEventQa.h"
...@@ -20,18 +20,21 @@ namespace cbm::algo::evbuild ...@@ -20,18 +20,21 @@ namespace cbm::algo::evbuild
// --- Instantiate return object // --- Instantiate return object
DigiEventQaData result; DigiEventQaData result;
result.fVectHistos.reserve(fConfig.fData.size());
for (const auto& entry : fConfig.fData) { for (const auto& entry : fConfig.fData) {
ECbmModuleId subsystem = entry.first; ECbmModuleId subsystem = entry.first;
string hist_name = "digi_time_" + ::ToString(subsystem);
auto& detConfig = fConfig.fData.at(subsystem); auto& detConfig = fConfig.fData.at(subsystem);
result.fDigiTimeHistos.try_emplace(subsystem, detConfig.fNumBins, detConfig.fMinValue, detConfig.fMaxValue, result.fVectHistos.emplace_back(detConfig.fNumBins, detConfig.fMinValue, detConfig.fMaxValue,
hist_name); DigiEventQaConfig::GetDigiTimeHistoName(subsystem));
result.fDigiTimeHistos.emplace(subsystem, result.fVectHistos.back());
} }
// --- Event loop. Fill histograms. // --- Event loop. Fill histograms.
for (const auto& event : events) for (const auto& event : events) { //
for (auto& subsystem : fConfig.fData) for (auto& subsystem : result.fDigiTimeHistos) { //
QaDigiTimeInEvent(event, subsystem.first, result.fDigiTimeHistos.at(subsystem.first)); QaDigiTimeInEvent(event, subsystem.first, subsystem.second);
}
}
result.fNumEvents = events.size(); result.fNumEvents = events.size();
return result; return result;
......
/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt /* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only SPDX-License-Identifier: GPL-3.0-only
Authors: Volker Friese [committer] */ Authors: Volker Friese [committer], P.-A. Loizeau */
#ifndef ALGO_QA_DIGIEVENTQA_H #ifndef ALGO_QA_DIGIEVENTQA_H
#define ALGO_QA_DIGIEVENTQA_H 1 #define ALGO_QA_DIGIEVENTQA_H 1
...@@ -25,8 +25,10 @@ namespace cbm::algo::evbuild ...@@ -25,8 +25,10 @@ namespace cbm::algo::evbuild
** @since 16 June 2023 ** @since 16 June 2023
**/ **/
struct DigiEventQaData { struct DigiEventQaData {
std::map<ECbmModuleId, Histo1D> fDigiTimeHistos = {};
size_t fNumEvents = 0; std::vector<Histo1D> fVectHistos = {};
std::map<ECbmModuleId, Histo1D&> fDigiTimeHistos = {};
size_t fNumEvents = 0;
}; };
...@@ -72,6 +74,37 @@ namespace cbm::algo::evbuild ...@@ -72,6 +74,37 @@ namespace cbm::algo::evbuild
fData[detector] = {numBins, tmin, tmax}; fData[detector] = {numBins, tmin, tmax};
} }
} }
static std::string GetDigiTimeHistoName(const ECbmModuleId& subsystem)
{
return "digi_time_" + ::ToString(subsystem);
}
std::vector<std::pair<std::string, std::string>> GetHistosConfigs() const
{
std::vector<std::pair<std::string, std::string>> cfg {};
for (const auto& entry : fData) {
cfg.push_back(std::pair<std::string, std::string>(GetDigiTimeHistoName(entry.first), "DigiEvtQa"));
}
return cfg;
}
std::vector<std::pair<std::string, std::string>> GetCanvasConfigs() const
{
/// => Format is "CanvasName;Canvas Title;NbPadX(U);NbPadY(U);ConfigPad1(s);....;ConfigPadXY(s)"
/// => Format of Pad config is
/// "GrixX(b),GridY(b),LogX(b),LogY(b),LogZ(b),(HistoName1,DrawOptions1),...,(HistoNameZ,DrawOptionsZ)"
/// => See core/base/utils/fles/CbmFlesCanvasTools for the full code, especially GenerateCanvasConfigString
// --- Canvas of all Time in event per system
std::pair<std::string, std::string> cfgDigiTimeAll {"digiEvtTimeQaCanv", "digiEvtTimeQaCanv;"};
cfgDigiTimeAll.second += "Digi time in Events per subsystem;";
cfgDigiTimeAll.second += std::to_string(fData.size() / 2 + fData.size() % 2) + ";2;";
for (const auto& entry : fData) {
cfgDigiTimeAll.second += std::string("1,1,0,1,0,(") + GetDigiTimeHistoName(entry.first) + ",hist);";
}
if (fData.size() % 2) { // Empty pad if odd number of systems
cfgDigiTimeAll.second += std::string("1,1,0,1,0,;");
}
return std::vector<std::pair<std::string, std::string>> {cfgDigiTimeAll};
}
}; };
...@@ -97,6 +130,9 @@ namespace cbm::algo::evbuild ...@@ -97,6 +130,9 @@ namespace cbm::algo::evbuild
/** @brief Info to string **/ /** @brief Info to string **/
std::string ToString() const; std::string ToString() const;
/** @brief Const access to Qa config **/
const DigiEventQaConfig& GetConfig() const { return fConfig; }
private: // methods private: // methods
/** @brief Fill histogram with digi time within event /** @brief Fill histogram with digi time within event
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment