diff --git a/algo/qa/DigiEventQa.cxx b/algo/qa/DigiEventQa.cxx index 25f9ed56686176dbf8b84e9afc7a166d7c7b9453..d1dc775c4f89243cfd5de16be099a3d0771cf0c0 100644 --- a/algo/qa/DigiEventQa.cxx +++ b/algo/qa/DigiEventQa.cxx @@ -1,6 +1,6 @@ /* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt SPDX-License-Identifier: GPL-3.0-only - Authors: Volker Friese [committer] */ + Authors: Volker Friese [committer], P.-A. Loizeau */ #include "DigiEventQa.h" @@ -20,18 +20,21 @@ namespace cbm::algo::evbuild // --- Instantiate return object DigiEventQaData result; + result.fVectHistos.reserve(fConfig.fData.size()); for (const auto& entry : fConfig.fData) { ECbmModuleId subsystem = entry.first; - string hist_name = "digi_time_" + ::ToString(subsystem); auto& detConfig = fConfig.fData.at(subsystem); - result.fDigiTimeHistos.try_emplace(subsystem, detConfig.fNumBins, detConfig.fMinValue, detConfig.fMaxValue, - hist_name); + result.fVectHistos.emplace_back(detConfig.fNumBins, detConfig.fMinValue, detConfig.fMaxValue, + DigiEventQaConfig::GetDigiTimeHistoName(subsystem)); + result.fDigiTimeHistos.emplace(subsystem, result.fVectHistos.back()); } // --- Event loop. Fill histograms. - for (const auto& event : events) - for (auto& subsystem : fConfig.fData) - QaDigiTimeInEvent(event, subsystem.first, result.fDigiTimeHistos.at(subsystem.first)); + for (const auto& event : events) { // + for (auto& subsystem : result.fDigiTimeHistos) { // + QaDigiTimeInEvent(event, subsystem.first, subsystem.second); + } + } result.fNumEvents = events.size(); return result; diff --git a/algo/qa/DigiEventQa.h b/algo/qa/DigiEventQa.h index 64ee77f58ee0f76c8d7946584d4519a6179ec6a7..9e09ee8f5d753adaef995ac6b27c3985fc1d80ca 100644 --- a/algo/qa/DigiEventQa.h +++ b/algo/qa/DigiEventQa.h @@ -1,6 +1,6 @@ /* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt SPDX-License-Identifier: GPL-3.0-only - Authors: Volker Friese [committer] */ + Authors: Volker Friese [committer], P.-A. Loizeau */ #ifndef ALGO_QA_DIGIEVENTQA_H #define ALGO_QA_DIGIEVENTQA_H 1 @@ -25,8 +25,10 @@ namespace cbm::algo::evbuild ** @since 16 June 2023 **/ 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 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 /** @brief Info to string **/ std::string ToString() const; + /** @brief Const access to Qa config **/ + const DigiEventQaConfig& GetConfig() const { return fConfig; } + private: // methods /** @brief Fill histogram with digi time within event