From f6d62befe059995c56622411ed63d80a3d1b48ce Mon Sep 17 00:00:00 2001 From: "s.zharko@gsi.de" <s.zharko@gsi.de> Date: Thu, 4 Apr 2024 01:01:50 +0200 Subject: [PATCH] online QA: CA updates --- algo/ca/core/utils/CaVector.h | 2 ++ algo/ca/qa/CaInputQa.cxx | 25 +++++++++++++++++++++++++ algo/ca/qa/CaInputQa.h | 5 +++++ 3 files changed, 32 insertions(+) diff --git a/algo/ca/core/utils/CaVector.h b/algo/ca/core/utils/CaVector.h index 6d0c31b284..de24b82564 100644 --- a/algo/ca/core/utils/CaVector.h +++ b/algo/ca/core/utils/CaVector.h @@ -259,6 +259,8 @@ namespace cbm::algo::ca using Tbase::begin; using Tbase::capacity; + using Tbase::cbegin; + using Tbase::cend; using Tbase::clear; using Tbase::end; using Tbase::insert; //TODO:: make it private diff --git a/algo/ca/qa/CaInputQa.cxx b/algo/ca/qa/CaInputQa.cxx index a5f55575ee..dc50101d0f 100644 --- a/algo/ca/qa/CaInputQa.cxx +++ b/algo/ca/qa/CaInputQa.cxx @@ -138,6 +138,20 @@ void InputQa::Init() } } + // Hit time distributions + fvphHitTime.resize(nSt + 1); // [nSt] - total over stations + for (int iSt = 0; iSt < nSt + 1; ++iSt) { + auto staNm = iSt == nSt ? "" : format("_sta_{}", iSt); + auto staTl = iSt == nSt ? "" : format(" in station {}", iSt); + for (auto hitSet : kHitSets) { + auto setNm = EHitSet::Input == hitSet ? "input" : "used"; + auto setTl = EHitSet::Input == hitSet ? "Input" : "Used"; + auto name = format("hit_{}_rel_time{}", setNm, staNm); + auto titl = format("{} hit relative time{}; #delta t_{{hit}};Count", setTl, staTl); + fvphHitTime[iSt][hitSet] = fQaData.MakeObj<H1D>(name, titl, 10000, -0.1, 1.1); + } + } + // ----- Init canvases // Hit occupancies for (auto hitSet : kHitSets) { @@ -211,6 +225,13 @@ void InputQa::Exec() vbHitUsed[iH] = true; } + // Calculate max and min hit time + const auto& hits = fpInputData->GetHits(); + auto [minTimeIt, maxTimeIt] = + std::minmax_element(hits.cbegin(), hits.cend(), [](const auto& h1, const auto& h2) { return h1.T() < h2.T(); }); + fMinHitTime = minTimeIt->T(); + fMaxHitTime = maxTimeIt->T(); + // Fill input hit histograms { for (int iH = 0; iH < nHitsInput; ++iH) { @@ -233,6 +254,7 @@ void InputQa::Exec() // void InputQa::FillHitDistributionsForHitSet(InputQa::EHitSet hitSet, const Hit& hit) { + int nSt = fpParameters->GetNstationsActive(); int iSt = hit.Station(); double x = hit.X(); double y = hit.Y(); @@ -243,4 +265,7 @@ void InputQa::FillHitDistributionsForHitSet(InputQa::EHitSet hitSet, const Hit& auto nKeys = static_cast<double>(fpInputData->GetNhitKeys()); fvphHitFrontKeyIndex[hitSet]->Fill(hit.FrontKey() / nKeys); fvphHitBackKeyIndex[hitSet]->Fill(hit.BackKey() / nKeys); + double relTime = (hit.T() - fMinHitTime) / (fMaxHitTime - fMinHitTime); + fvphHitTime[iSt][hitSet]->Fill(relTime); + fvphHitTime[nSt][hitSet]->Fill(relTime); } diff --git a/algo/ca/qa/CaInputQa.h b/algo/ca/qa/CaInputQa.h index 96bb7bdbb1..adcf82152d 100644 --- a/algo/ca/qa/CaInputQa.h +++ b/algo/ca/qa/CaInputQa.h @@ -72,6 +72,9 @@ namespace cbm::algo::ca static constexpr double kXYZMargin = 0.05; ///< Margin for occupancy distributions in XY plane static constexpr int knHitSets = 2; ///< Number of hit sets: input/used + double fMinHitTime = std::numeric_limits<double>::max(); + double fMaxHitTime = std::numeric_limits<double>::lowest(); + // Hit distributions vs. station using OccupHistContainer_t = std::vector<HitSetArray_t<qa::H2D*>>; OccupHistContainer_t fvphHitOccupXY; ///< hist: Hit occupancy in different stations in XY plane @@ -82,5 +85,7 @@ namespace cbm::algo::ca HitSetArray_t<qa::H1D*> fvphHitFrontKeyIndex = {nullptr, nullptr}; ///< Indices of front hit keys HitSetArray_t<qa::H1D*> fvphHitBackKeyIndex = {nullptr, nullptr}; ///< Indices of back hit keys + + std::vector<HitSetArray_t<qa::H1D*>> fvphHitTime; ///< Time distribution of hits }; } // namespace cbm::algo::ca -- GitLab