diff --git a/algo/ca/core/utils/CaVector.h b/algo/ca/core/utils/CaVector.h index 6d0c31b2841f1bb53b2a474c653a5a55923a4b5e..de24b82564d7f8e084fd68c76495e101da9817d8 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 a5f55575ee4459be0b9b5ffaa919260528111375..dc50101d0f863db301b020d4112562d1fbb364c1 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 96bb7bdbb10be8392936041ab821ab0b5d607c98..adcf82152d954ec00dcb4c4851a90f6014e6cbc6 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