diff --git a/algo/detectors/tof/Hitfind.cxx b/algo/detectors/tof/Hitfind.cxx index 4937cf80c62cb8ffd5347d511f08f0062351e15e..d02d56cbae1ed8df000e32a900fa1994f6648819 100644 --- a/algo/detectors/tof/Hitfind.cxx +++ b/algo/detectors/tof/Hitfind.cxx @@ -21,16 +21,18 @@ namespace cbm::algo::tof // --- Output data resultType result = {}; - auto& clusterTs = result.first; - auto& monitor = result.second; + + auto& clusterTs = std::get<0>(result); + auto& monitor = std::get<1>(result); + auto& calDigi = std::get<2>(result); // Do calibration globally (optional, should not be used together with RPC-wise calibration) - CalibRawDigis(digiIn, monitor); + calDigi = CalibRawDigis(digiIn, monitor); // Loop over the digis array and store the Digis in separate vectors for // each RPC modules - for (int32_t idigi = 0; idigi < digiIn.size(); idigi++) { - CbmTofDigi* pDigi = &(digiIn[idigi]); + for (int32_t idigi = 0; idigi < calDigi.size(); idigi++) { + CbmTofDigi* pDigi = &(calDigi[idigi]); // These are doubles in the digi class const double SmType = pDigi->GetType(); @@ -160,10 +162,11 @@ namespace cbm::algo::tof // -------------------------- Calibration ------------------------------------- - void Hitfind::CalibRawDigis(gsl::span<CbmTofDigi> digiVec, HitfindMonitorData& monitor) + std::vector<CbmTofDigi> Hitfind::CalibRawDigis(gsl::span<CbmTofDigi> digiVec, HitfindMonitorData& monitor) { // channel deadtime map std::map<int32_t, double> mChannelDeadTime; + std::vector<CbmTofDigi> calDigiVecOut; for (size_t iDigi = 0; iDigi < digiVec.size(); iDigi++) { @@ -228,12 +231,14 @@ namespace cbm::algo::tof if (0 < iWx) { dWT -= dDTot * (walk[iWx - 1] - walk[iWx]); } } pCalDigi.SetTime(pCalDigi.GetTime() - dWT); // calibrate Digi Time - digiVec[iDigi] = pCalDigi; + calDigiVecOut.push_back(pCalDigi); } /// Sort the buffers of hits due to the time offsets applied - std::sort(digiVec.begin(), digiVec.end(), + std::sort(calDigiVecOut.begin(), calDigiVecOut.end(), [](const CbmTofDigi& a, const CbmTofDigi& b) -> bool { return a.GetTime() < b.GetTime(); }); + + return calDigiVecOut; } } // namespace cbm::algo::tof diff --git a/algo/detectors/tof/Hitfind.h b/algo/detectors/tof/Hitfind.h index a8d80d8df460ae4f3ba2eb8cda3651fcecff8e29..a281ebee80c9e740507cf34920b5f338e31878dc 100644 --- a/algo/detectors/tof/Hitfind.h +++ b/algo/detectors/tof/Hitfind.h @@ -52,7 +52,7 @@ namespace cbm::algo::tof class Hitfind { public: - typedef std::pair<PartitionedVector<Hit>, HitfindMonitorData> resultType; + typedef std::tuple<PartitionedVector<Hit>, HitfindMonitorData, std::vector<CbmTofDigi>> resultType; /** @brief Algorithm execution ** @param fles timeslice to hitfind @@ -89,7 +89,7 @@ namespace cbm::algo::tof std::vector<int32_t> fNbRpc; /** @brief Applies calibration to input digis **/ - void CalibRawDigis(gsl::span<CbmTofDigi> digiVec, HitfindMonitorData& monitor); + std::vector<CbmTofDigi> CalibRawDigis(gsl::span<CbmTofDigi> digiVec, HitfindMonitorData& monitor); }; } // namespace cbm::algo::tof diff --git a/algo/detectors/tof/HitfinderChain.cxx b/algo/detectors/tof/HitfinderChain.cxx index 6d78c43b7cf88751373602ac87280a587edce73b..d23e9aea522ba3fb983b9e4c060cf476be95925f 100644 --- a/algo/detectors/tof/HitfinderChain.cxx +++ b/algo/detectors/tof/HitfinderChain.cxx @@ -20,7 +20,7 @@ HitfinderChain::ReturnType HitfinderChain::Run(gsl::span<CbmTofDigi> digis) { auto ret = (*fHitfind)(digis); - L_(info) << "TS contains " << ret.first.NElements() << " TOF Hits"; - L_(error) << "TOF Digis with unknown RPCs: " << ret.second.fDigiCalibUnknownRPC; + L_(info) << "TS contains " << std::get<0>(ret).NElements() << " TOF Hits"; + L_(error) << "TOF Digis with unknown RPCs: " << std::get<1>(ret).fDigiCalibUnknownRPC; return ret; } diff --git a/algo/global/Reco.cxx b/algo/global/Reco.cxx index 1500cfb35c3a38477cd7e5289e1435f7518620e3..e4ba22ece97a1e2a0a68861f3a11096106329e9c 100644 --- a/algo/global/Reco.cxx +++ b/algo/global/Reco.cxx @@ -76,10 +76,10 @@ void Reco::Init(const Options& opts) fEventBuild = std::make_unique<evbuild::EventbuildChain>(config, fSender); // STS Hitfinder - fs::path stsHitfinderParamsPath = opts.ParamsDir() / "StsHitfinder.yaml"; - yaml = YAML::LoadFile(stsHitfinderParamsPath.string()); - sts::HitfinderPars hitFinderSetup = config::Read<sts::HitfinderPars>(yaml); - hitFinderSetup.landauTable = sts::LandauTable::FromFile(opts.ParamsDir() / "LandauWidthTable.txt"); + fs::path stsHitfinderParamsPath = opts.ParamsDir() / "StsHitfinder.yaml"; + yaml = YAML::LoadFile(stsHitfinderParamsPath.string()); + sts::HitfinderPars hitFinderSetup = config::Read<sts::HitfinderPars>(yaml); + hitFinderSetup.landauTable = sts::LandauTable::FromFile(opts.ParamsDir() / "LandauWidthTable.txt"); sts::HitfinderChainPars hitFinderPars; hitFinderPars.setup = std::move(hitFinderSetup); hitFinderPars.memory = Params().sts.memory; @@ -153,8 +153,8 @@ RecoResults Reco::Run(const fles::Timeslice& ts) PartitionedVector<tof::Hit> tofHits; if (Opts().HasStep(Step::LocalReco) && Opts().HasDetector(fles::Subsystem::TOF)) { - auto [hits, monitor] = fTofHitFinder.Run(unpackResult.first.fTof); - tofHits = std::move(hits); + auto [hits, monitor, caldigis] = fTofHitFinder.Run(unpackResult.first.fTof); + tofHits = std::move(hits); QueueTofRecoMetrics(monitor); } diff --git a/reco/tasks/CbmTaskTofClusterizer.cxx b/reco/tasks/CbmTaskTofClusterizer.cxx index a6eaf631d2644c8cfaaff78700f337973b8a9a66..c9020271df490cd0cf639d5feb636662aef66bef 100644 --- a/reco/tasks/CbmTaskTofClusterizer.cxx +++ b/reco/tasks/CbmTaskTofClusterizer.cxx @@ -347,12 +347,13 @@ bool CbmTaskTofClusterizer::BuildClusters() } } - // Make copy for calibrated digis (calibration done in algo) - // Can be left out if calibrated digis not stored separately! - *fTofCalDigiVec = fTofDigiVec; - //call cluster finder - auto clusters = fAlgo(*fTofCalDigiVec).first; + auto clusterOut = fAlgo(fTofDigiVec); + auto clusters = std::get<0>(clusterOut); + + // Calibrated digis (calibration done in algo) + // Can be left out if calibrated digis not stored separately! + *fTofCalDigiVec = std::get<2>(clusterOut); //Store hits and match for (auto const& cluster : clusters.Data()) {