From a6dd27d0244a548daf301ece09b0a7cb67ca40d5 Mon Sep 17 00:00:00 2001 From: "s.zharko@gsi.de" <s.zharko@gsi.de> Date: Thu, 26 Sep 2024 19:35:47 +0200 Subject: [PATCH] KF[bugfix]: accessing the material thickness by bin indices in the kf::MaterialMap --- algo/kf/core/geo/KfField.h | 2 +- algo/kf/core/geo/KfMaterialMap.h | 20 ++++++++++++++++++++ core/base/CMakeLists.txt | 2 +- reco/L1/qa/CbmCaInputQaSetup.cxx | 6 +++--- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/algo/kf/core/geo/KfField.h b/algo/kf/core/geo/KfField.h index df48b5c509..dc1f489502 100644 --- a/algo/kf/core/geo/KfField.h +++ b/algo/kf/core/geo/KfField.h @@ -218,7 +218,7 @@ namespace cbm::algo::kf , foFldOrig(fldMode == EFieldMode::Orig ? std::make_optional(detail::FieldBase<T, EFieldMode::Orig>()) : std::nullopt) , fPrimVertexField(FieldRegion<T>(fldMode, fldType)) - , fFieldType(EFieldType::Normal) + , fFieldType(fldType) , fFieldMode(fldMode) { } diff --git a/algo/kf/core/geo/KfMaterialMap.h b/algo/kf/core/geo/KfMaterialMap.h index 7c25dca012..37a850a69c 100644 --- a/algo/kf/core/geo/KfMaterialMap.h +++ b/algo/kf/core/geo/KfMaterialMap.h @@ -97,6 +97,26 @@ namespace cbm::algo::kf } } + + /// \brief Gets material thickness in units of radiational length X0 + /// \tparam I Type of the x and y (floating point) + /// \param iX Bin number along x axis + /// \param iY Bin number along y axis + template<typename I> + I GetBinThicknessX0(int iX, int iY) const + { + if constexpr (std::is_same_v<I, fvec>) { + fvec res; + for (size_t i = 0; i < utils::simd::Size<I>(); ++i) { + res[i] = GetBinThicknessX0<fscal>(iX, iY); + } + return res; + } + else { + return fTable[iX + iY * fNbins]; + } + } + /// \brief Function to test the instance for NaN bool IsUndefined() const { diff --git a/core/base/CMakeLists.txt b/core/base/CMakeLists.txt index 5fe27362d3..ca11909b3d 100644 --- a/core/base/CMakeLists.txt +++ b/core/base/CMakeLists.txt @@ -55,7 +55,7 @@ set(PRIVATE_DEPENDENCIES generate_cbm_library() -Install(FILES CbmDigitize.h CbmTrackingDetectorInterfaceBase.h report/CbmReportElement.h +Install(FILES CbmDigitize.h CbmTrackingDetectorInterfaceBase.h report/CbmReportElement.h utils/CbmEnumArray.h DESTINATION include ) diff --git a/reco/L1/qa/CbmCaInputQaSetup.cxx b/reco/L1/qa/CbmCaInputQaSetup.cxx index 41bb8fe5f6..7dfc29fa8c 100644 --- a/reco/L1/qa/CbmCaInputQaSetup.cxx +++ b/reco/L1/qa/CbmCaInputQaSetup.cxx @@ -415,14 +415,14 @@ try { auto [detID, stationID] = kfSetup.GetIndexMap().GlobalToLocal(iLayer); TString sN = Form("%s/mat_budget_%s_st%d", dir.Data(), kDetName[detID], stationID); TString sT = - Form("Material budget map for %s station %d;x [cm];y [cm]; X/X_{0} [\%]", kDetName[detID], stationID); + Form("Material budget map for %s station %d;x [cm];y [cm]; X/X_{0} [%%]", kDetName[detID], stationID); auto nBins{matMap.GetNbins()}; auto xMin{-matMap.GetXYmax()}; auto xMax{+matMap.GetXYmax()}; auto* pHist = MakeQaObject<TH2F>(sN, sT, nBins, xMin, xMax, nBins, xMin, xMax); for (int iX = 0; iX < nBins; ++iX) { for (int iY = 0; iY < nBins; ++iY) { - pHist->SetBinContent(iX + 1, iY + 1, 100. * matMap.GetThicknessX0(iX, iY)); + pHist->SetBinContent(iX + 1, iY + 1, 100. * matMap.template GetBinThicknessX0<float>(iX, iY)); } } } @@ -434,7 +434,7 @@ try { MakeQaDirectory("TrackingKFSetup/active"); CreateMaterialBudgetHistograms(fpParameters->GetActiveSetup(), "TrackingKFSetup/active"); - LOG(error) << fName << ": initializing... \033[1;32mDone\033[0m"; + LOG(info) << fName << ": initializing... \033[1;32mDone\033[0m"; return kSUCCESS; } catch (const std::exception& e) { -- GitLab