From da046d6d82813fee5b693b0d5d3a5c2f5c5e50b6 Mon Sep 17 00:00:00 2001 From: "se.gorbunov" <se.gorbunov@gsi.de> Date: Mon, 27 Nov 2023 14:10:37 +0000 Subject: [PATCH] clang-format of algo/ca --- algo/ca/TrackingChain.cxx | 71 +++++++--- algo/ca/TrackingChain.h | 29 ++-- algo/ca/TrackingDefs.h | 4 +- algo/ca/core/data/CaBranch.h | 14 +- algo/ca/core/data/CaDataManager.cxx | 8 +- algo/ca/core/data/CaDataManager.h | 15 +- algo/ca/core/data/CaGrid.cxx | 12 +- algo/ca/core/data/CaGrid.h | 37 +++-- algo/ca/core/data/CaGridArea.h | 26 ++-- algo/ca/core/data/CaGridEntry.h | 18 +-- algo/ca/core/data/CaHit.cxx | 4 +- algo/ca/core/data/CaHit.h | 46 +++--- algo/ca/core/data/CaInputData.cxx | 4 +- algo/ca/core/data/CaInputData.h | 16 +-- algo/ca/core/data/CaMeasurementTime.cxx | 2 +- algo/ca/core/data/CaMeasurementTime.h | 18 +-- algo/ca/core/data/CaMeasurementU.cxx | 2 +- algo/ca/core/data/CaMeasurementU.h | 12 +- algo/ca/core/data/CaMeasurementXy.cxx | 2 +- algo/ca/core/data/CaMeasurementXy.h | 24 ++-- algo/ca/core/data/CaTrack.h | 10 +- algo/ca/core/data/CaTrackParam.cxx | 22 ++- algo/ca/core/data/CaTrackParam.h | 44 +++--- algo/ca/core/data/CaTriplet.cxx | 2 +- algo/ca/core/data/CaTriplet.h | 38 ++--- algo/ca/core/pars/CaConfigReader.cxx | 74 +++++++--- algo/ca/core/pars/CaConfigReader.h | 12 +- algo/ca/core/pars/CaConstants.h | 10 +- algo/ca/core/pars/CaField.cxx | 12 +- algo/ca/core/pars/CaField.h | 48 +++---- algo/ca/core/pars/CaInitManager.cxx | 42 ++++-- algo/ca/core/pars/CaInitManager.h | 40 +++--- algo/ca/core/pars/CaIteration.cxx | 8 +- algo/ca/core/pars/CaIteration.h | 10 +- algo/ca/core/pars/CaMaterialMap.cxx | 12 +- algo/ca/core/pars/CaMaterialMap.h | 13 +- algo/ca/core/pars/CaMaterialMonitor.cxx | 32 +++-- algo/ca/core/pars/CaMaterialMonitor.h | 36 ++--- algo/ca/core/pars/CaParameters.cxx | 22 ++- algo/ca/core/pars/CaParameters.h | 59 ++++---- algo/ca/core/pars/CaSearchWindow.h | 4 +- algo/ca/core/pars/CaStation.cxx | 12 +- algo/ca/core/pars/CaStation.h | 8 +- algo/ca/core/pars/CaStationInitializer.cxx | 12 +- algo/ca/core/pars/CaStationInitializer.h | 36 ++--- algo/ca/core/tracking/CaCloneMerger.cxx | 7 +- algo/ca/core/tracking/CaCloneMerger.h | 24 ++-- algo/ca/core/tracking/CaFramework.cxx | 5 +- algo/ca/core/tracking/CaFramework.h | 132 +++++++++--------- algo/ca/core/tracking/CaTrackExtender.cxx | 18 ++- algo/ca/core/tracking/CaTrackExtender.h | 6 +- algo/ca/core/tracking/CaTrackFinder.cxx | 24 +++- algo/ca/core/tracking/CaTrackFinder.h | 6 +- algo/ca/core/tracking/CaTrackFinderWindow.cxx | 122 +++++++++++----- algo/ca/core/tracking/CaTrackFinderWindow.h | 6 +- algo/ca/core/tracking/CaTrackFit.cxx | 7 +- algo/ca/core/tracking/CaTrackFit.h | 20 +-- algo/ca/core/tracking/CaTrackFitter.cxx | 28 ++-- algo/ca/core/tracking/CaTrackFitter.h | 6 +- .../ca/core/tracking/CaTripletConstructor.cxx | 82 ++++++++--- algo/ca/core/tracking/CaTripletConstructor.h | 34 ++--- algo/ca/core/utils/CaEnumArray.h | 2 +- algo/ca/core/utils/CaMonitor.h | 16 +-- algo/ca/core/utils/CaMonitorData.h | 10 +- algo/ca/core/utils/CaObjectInitController.h | 12 +- algo/ca/core/utils/CaSimdPseudo.h | 13 +- algo/ca/core/utils/CaSimdVc.h | 4 +- algo/ca/core/utils/CaTimer.h | 4 +- algo/ca/core/utils/CaTrackingMonitor.h | 2 +- algo/ca/core/utils/CaUtils.h | 28 ++-- algo/ca/core/utils/CaVector.h | 8 +- algo/ca/qa/CaQaBuilder.h | 4 +- algo/ca/qa/CaQaConfig.cxx | 4 +- algo/ca/qa/CaQaConfig.h | 8 +- algo/ca/qa/CaQaData.h | 10 +- algo/ca/qa/CaQaDefinitions.h | 4 +- algo/global/RecoResults.h | 5 +- reco/L1/CbmL1Track.h | 2 +- 78 files changed, 948 insertions(+), 697 deletions(-) diff --git a/algo/ca/TrackingChain.cxx b/algo/ca/TrackingChain.cxx index ee7774c52b..a5b67748ce 100644 --- a/algo/ca/TrackingChain.cxx +++ b/algo/ca/TrackingChain.cxx @@ -9,6 +9,10 @@ #include "TrackingChain.h" +#include "CaConstants.h" +#include "CaHit.h" +#include "CaInitManager.h" +#include "CaParameters.h" #include "tof/Config.h" #include <fstream> @@ -16,11 +20,6 @@ #include <xpu/host.h> -#include "CaConstants.h" -#include "CaHit.h" -#include "CaInitManager.h" -#include "CaParameters.h" - using namespace cbm::algo; using cbm::algo::TrackingChain; @@ -50,7 +49,7 @@ TrackingChain::TrackingChain(std::shared_ptr<HistogramSender> histoSender) : fpS fpSender->PrepareAndSendMsg(cfg, zmq::send_flags::sndmore); } // Histograms serialization and emission to close multi-part message - fpSender->PrepareAndSendMsg(std::vector<Histo1D> {}, zmq::send_flags::none); + fpSender->PrepareAndSendMsg(std::vector<Histo1D>{}, zmq::send_flags::none); } } @@ -63,7 +62,7 @@ void TrackingChain::Init() auto paramFile = Opts().ParamsDir(); paramFile /= paramFileBase; L_(info) << "Tracking Chain: reading CA parameters file " << GNb << paramFile.string() << CL << '\n'; - auto manager = InitManager {}; + auto manager = InitManager{}; manager.ReadParametersObject(paramFile.string()); auto parameters = manager.TakeParameters(); L_(info) << "Tracking Chain: parameters object: \n" << parameters.ToString(1) << '\n'; @@ -179,7 +178,9 @@ template<EDetectorID DetID> void TrackingChain::ReadHits(PartitionedSpan<const ca::HitTypes_t::at<DetID>> hits) { std::ofstream out; - if constexpr (kDEBUG) { out.open(std::string("./Debug_hits_") + ca::kDetName[DetID] + ".txt"); } + if constexpr (kDEBUG) { + out.open(std::string("./Debug_hits_") + ca::kDetName[DetID] + ".txt"); + } using Hit_t = ca::HitTypes_t::at<DetID>; constexpr bool IsMvd = (DetID == EDetectorID::Mvd); @@ -200,15 +201,21 @@ void TrackingChain::ReadHits(PartitionedSpan<const ca::HitTypes_t::at<DetID>> hi int iStLocal = -1; // FIXME: This definition of the station index works only for STS, and there is no any guaranty, that it will // work for other mCBM setups. - if constexpr (IsSts) { iStLocal = (extHitAddress >> 4) & 0xF; } + if constexpr (IsSts) { + iStLocal = (extHitAddress >> 4) & 0xF; + } if constexpr (IsTof) { - iStLocal = tof::Config::GetTofTrackingStation(extHitAddress); - if (tof::Config::IsBmon(extHitAddress)) { continue; } // skip hits from Bmon + iStLocal = cbm::algo::tof::Config::GetTofTrackingStation(extHitAddress); + if (tof::Config::IsBmon(extHitAddress)) { + continue; + } // skip hits from Bmon } int iStActive = (iStLocal != -1) ? fCaFramework.GetParameters().GetStationIndexActive(iStLocal, DetID) : -1; size_t iOffset = hits.Offsets()[iPartition]; - if (iStActive < 0) { continue; } + if (iStActive < 0) { + continue; + } double lastTime = -1e9; double prevTime = -1; for (size_t iPartHit = 0; iPartHit < vHits.size(); ++iPartHit) { @@ -240,25 +247,45 @@ void TrackingChain::ReadHits(PartitionedSpan<const ca::HitTypes_t::at<DetID>> hi caHit.SetStation(iStActive); caHit.SetId(fCaDataManager.GetNofHits()); if (caHit.Check()) { - if ((caHit.T() < lastTime - 1000.) && (dataStream < 100000)) { dataStream++; } + if ((caHit.T() < lastTime - 1000.) && (dataStream < 100000)) { + dataStream++; + } lastTime = caHit.T(); - if (!IsTof) { dataStream = extHitAddress; } + if (!IsTof) { + dataStream = extHitAddress; + } fCaDataManager.PushBackHit(caHit, dataStreamDet | dataStream); faHitExternalIndices.push_back(std::make_tuple(DetID, iPartition, iPartHit)); if constexpr (kDEBUG) { out << (dataStreamDet | dataStream) << " ----- " << caHit.ToString() << '\n'; - if (prevTime > caHit.T()) { out << "TIME IS UNSORTED\n"; } + if (prevTime > caHit.T()) { + out << "TIME IS UNSORTED\n"; + } } - if (fNofHitKeys <= caHit.FrontKey()) { fNofHitKeys = caHit.FrontKey() + 1; } - if (fNofHitKeys <= caHit.BackKey()) { fNofHitKeys = caHit.BackKey() + 1; } + if (fNofHitKeys <= caHit.FrontKey()) { + fNofHitKeys = caHit.FrontKey() + 1; + } + if (fNofHitKeys <= caHit.BackKey()) { + fNofHitKeys = caHit.BackKey() + 1; + } } else { - if constexpr (IsMvd) { fCaMonitorData.IncrementCounter(ca::ECounter::UndefinedMvdHit); } - if constexpr (IsSts) { fCaMonitorData.IncrementCounter(ca::ECounter::UndefinedStsHit); } - if constexpr (IsMuch) { fCaMonitorData.IncrementCounter(ca::ECounter::UndefinedMuchHit); } - if constexpr (IsTrd) { fCaMonitorData.IncrementCounter(ca::ECounter::UndefinedTrdHit); } - if constexpr (IsTof) { fCaMonitorData.IncrementCounter(ca::ECounter::UndefinedTofHit); } + if constexpr (IsMvd) { + fCaMonitorData.IncrementCounter(ca::ECounter::UndefinedMvdHit); + } + if constexpr (IsSts) { + fCaMonitorData.IncrementCounter(ca::ECounter::UndefinedStsHit); + } + if constexpr (IsMuch) { + fCaMonitorData.IncrementCounter(ca::ECounter::UndefinedMuchHit); + } + if constexpr (IsTrd) { + fCaMonitorData.IncrementCounter(ca::ECounter::UndefinedTrdHit); + } + if constexpr (IsTof) { + fCaMonitorData.IncrementCounter(ca::ECounter::UndefinedTofHit); + } } prevTime = caHit.T(); // ---- Update number of hit keys diff --git a/algo/ca/TrackingChain.h b/algo/ca/TrackingChain.h index c750d9d7ce..03d5cc430a 100644 --- a/algo/ca/TrackingChain.h +++ b/algo/ca/TrackingChain.h @@ -9,12 +9,6 @@ #pragma once -#include "TrackingDefs.h" -#include "tof/Hit.h" - -#include <memory> -#include <vector> - #include "CaDataManager.h" #include "CaFramework.h" #include "CaQaBuilder.h" @@ -26,7 +20,12 @@ #include "PartitionedSpan.h" #include "RecoResults.h" #include "SubChain.h" +#include "TrackingDefs.h" #include "sts/Hit.h" +#include "tof/Hit.h" + +#include <memory> +#include <vector> namespace cbm::algo { @@ -35,7 +34,7 @@ namespace cbm::algo /// /// The class executes a tracking algorithm in the online data reconstruction chain. class TrackingChain : public SubChain { - public: + public: /// \brief Constructor from parameters /// \param histoSender A shared pointer to a histogram sender TrackingChain(std::shared_ptr<HistogramSender> histoSender = nullptr); @@ -79,7 +78,7 @@ namespace cbm::algo /// \brief Provides action in the end of the run void Finalize(); - private: + private: // ********************* // ** Utility functions @@ -102,12 +101,12 @@ namespace cbm::algo // ************************* // ** Framework variables - ca::TrackingMonitor fCaMonitor {}; ///< CA internal monitor (debug purposes) - ca::TrackingMonitorData fCaMonitorData {}; ///< CA monitor data object - ca::Framework fCaFramework {}; ///< CA framework instance - ca::DataManager fCaDataManager {}; ///< CA data manager - ca::qa::Builder fQaBuilder {ca::qa::Config()}; ///< CA QA builder - std::shared_ptr<HistogramSender> fpSender; ///< Histogram sender + ca::TrackingMonitor fCaMonitor{}; ///< CA internal monitor (debug purposes) + ca::TrackingMonitorData fCaMonitorData{}; ///< CA monitor data object + ca::Framework fCaFramework{}; ///< CA framework instance + ca::DataManager fCaDataManager{}; ///< CA data manager + ca::qa::Builder fQaBuilder{ca::qa::Config()}; ///< CA QA builder + std::shared_ptr<HistogramSender> fpSender; ///< Histogram sender // ************************ // ** Auxilary variables @@ -116,7 +115,7 @@ namespace cbm::algo /// \brief External indices of used hits /// \note Indexing: [globalHitID], value: (DetID, partitionID, hitID) - ca::Vector<std::tuple<ca::EDetectorID, uint32_t, uint32_t>> faHitExternalIndices {"faHitExternalIndices"}; + ca::Vector<std::tuple<ca::EDetectorID, uint32_t, uint32_t>> faHitExternalIndices{"faHitExternalIndices"}; static constexpr bool kDEBUG = false; ///< Debug mode }; diff --git a/algo/ca/TrackingDefs.h b/algo/ca/TrackingDefs.h index 04d457dd80..f9a1970d74 100644 --- a/algo/ca/TrackingDefs.h +++ b/algo/ca/TrackingDefs.h @@ -9,10 +9,10 @@ #pragma once -#include <tuple> - #include "CaEnumArray.h" +#include <tuple> + namespace cbm::algo { namespace mvd diff --git a/algo/ca/core/data/CaBranch.h b/algo/ca/core/data/CaBranch.h index f16537c0df..e43a269ca2 100644 --- a/algo/ca/core/data/CaBranch.h +++ b/algo/ca/core/data/CaBranch.h @@ -21,7 +21,7 @@ namespace cbm::algo::ca /// The class describes a combinatorial branch of the CA tracker /// class Branch { - public: + public: /// default constructor Branch() { fHits.reserve(25); } @@ -55,15 +55,15 @@ namespace cbm::algo::ca return (Chi2() <= b.Chi2()); } - private: + private: ///------------------------------ /// Data members - int fStation {0}; - fscal fChi2 {0.}; - int fId {0}; - bool fIsAlive {0}; - Vector<ca::HitIndex_t> fHits {"Branch::fHits"}; + int fStation{0}; + fscal fChi2{0.}; + int fId{0}; + bool fIsAlive{0}; + Vector<ca::HitIndex_t> fHits{"Branch::fHits"}; }; } // namespace cbm::algo::ca diff --git a/algo/ca/core/data/CaDataManager.cxx b/algo/ca/core/data/CaDataManager.cxx index 8b15a43c31..b2485442f2 100644 --- a/algo/ca/core/data/CaDataManager.cxx +++ b/algo/ca/core/data/CaDataManager.cxx @@ -61,7 +61,9 @@ void DataManager::ReadInputData(const std::string& fileName) // Open input binary file std::ifstream ifs(fileName, std::ios::binary); - if (!ifs) { LOG(fatal) << "L1: input data reader: data file \"" << fileName << "\" was not found"; } + if (!ifs) { + LOG(fatal) << "L1: input data reader: data file \"" << fileName << "\" was not found"; + } // Get InputData object try { @@ -100,7 +102,9 @@ void DataManager::InitData() for (int i = 0; i < nStreams - 1; i++) { fInputData.fvStreamStopIndices[i] = fInputData.fvStreamStartIndices[i + 1]; } - if (nStreams > 0) { fInputData.fvStreamStopIndices[nStreams - 1] = fInputData.fvHits.size(); } + if (nStreams > 0) { + fInputData.fvStreamStopIndices[nStreams - 1] = fInputData.fvHits.size(); + } } // --------------------------------------------------------------------------------------------------------------------- diff --git a/algo/ca/core/data/CaDataManager.h b/algo/ca/core/data/CaDataManager.h index f24ffe44c8..c0f814820b 100644 --- a/algo/ca/core/data/CaDataManager.h +++ b/algo/ca/core/data/CaDataManager.h @@ -18,7 +18,7 @@ namespace cbm::algo::ca /// \brief A manager for the input-output data of the CA tracking algorithm /// class alignas(constants::misc::Alignment) DataManager { - public: + public: /// \brief Default constructor DataManager() = default; @@ -83,7 +83,7 @@ namespace cbm::algo::ca void WriteInputData(const std::string& fileName) const; - private: + private: /// \brief Initializes data object /// /// Sorts hits by stations (complexity O(n)) and defines bordering hit index for station @@ -103,8 +103,8 @@ namespace cbm::algo::ca // *************************** // ** Member variables list ** // *************************** - InputData fInputData {}; ///< Object of input data - int64_t fLastStreamId {-1}; ///< data stream Id of the last hit added + InputData fInputData{}; ///< Object of input data + int64_t fLastStreamId{-1}; ///< data stream Id of the last hit added }; @@ -119,8 +119,10 @@ namespace cbm::algo::ca template<int Level> inline bool DataManager::CheckInputData() const { - if constexpr (Level == 0) { return true; } // Level = 0 -> do nothing - else if constexpr (Level > 0) { // Level = 1 and higher + if constexpr (Level == 0) { + return true; + } // Level = 0 -> do nothing + else if constexpr (Level > 0) { // Level = 1 and higher // ----- Check if the hits container is not empty ---------------------------------------------------------------- if (fInputData.fvHits.size() == 0) { LOG(warn) << "DataManager [check input]: Sample contains empty hits, tracking will not be executed"; @@ -150,4 +152,3 @@ namespace cbm::algo::ca return true; } } // namespace cbm::algo::ca - diff --git a/algo/ca/core/data/CaGrid.cxx b/algo/ca/core/data/CaGrid.cxx index 0cb070746e..f37345f611 100644 --- a/algo/ca/core/data/CaGrid.cxx +++ b/algo/ca/core/data/CaGrid.cxx @@ -8,11 +8,11 @@ #include "CaGrid.h" +#include "CaHit.h" + #include <algorithm> #include <cstring> -#include "CaHit.h" - using namespace cbm::algo::ca; using namespace cbm::algo; @@ -30,8 +30,12 @@ void Grid::BuildBins(fscal xMin, fscal xMax, fscal yMin, fscal yMax, fscal binWi fBinWidthY = binWidthY; // some sanity checks - if (fBinWidthX < 0.001) { fBinWidthX = 0.001; } - if (fBinWidthY < 0.001) { fBinWidthY = 0.001; } + if (fBinWidthX < 0.001) { + fBinWidthX = 0.001; + } + if (fBinWidthY < 0.001) { + fBinWidthY = 0.001; + } fBinWidthXinv = 1. / fBinWidthX; fBinWidthYinv = 1. / fBinWidthY; diff --git a/algo/ca/core/data/CaGrid.h b/algo/ca/core/data/CaGrid.h index eca4cd70b6..8514335fc7 100644 --- a/algo/ca/core/data/CaGrid.h +++ b/algo/ca/core/data/CaGrid.h @@ -35,7 +35,7 @@ namespace cbm::algo::ca /// The grid axis are named X and Y /// class Grid { - public: + public: /// \brief Default constructor Grid() = default; @@ -131,30 +131,30 @@ namespace cbm::algo::ca /// Get maximal entry range in T fscal GetMaxRangeT() const { return fMaxRangeT; } - private: + private: /// --- Data members --- - int fN {0}; ///< total N bins - int fNx {0}; ///< N bins in X - int fNy {0}; ///< N bins in Y + int fN{0}; ///< total N bins + int fNx{0}; ///< N bins in X + int fNy{0}; ///< N bins in Y - fscal fMinX {0.}; ///< minimal X value - fscal fMinY {0.}; ///< minimal Y value - fscal fBinWidthX {0.}; ///< bin width in X - fscal fBinWidthY {0.}; ///< bin width in Y - fscal fBinWidthXinv {0.}; ///< inverse bin width in X - fscal fBinWidthYinv {0.}; ///< inverse bin width in Y + fscal fMinX{0.}; ///< minimal X value + fscal fMinY{0.}; ///< minimal Y value + fscal fBinWidthX{0.}; ///< bin width in X + fscal fBinWidthY{0.}; ///< bin width in Y + fscal fBinWidthXinv{0.}; ///< inverse bin width in X + fscal fBinWidthYinv{0.}; ///< inverse bin width in Y - fscal fMaxRangeX {0.}; ///< maximal entry range in X - fscal fMaxRangeY {0.}; ///< maximal entry range in Y - fscal fMaxRangeT {0.}; ///< maximal entry range in T + fscal fMaxRangeX{0.}; ///< maximal entry range in X + fscal fMaxRangeY{0.}; ///< maximal entry range in Y + fscal fMaxRangeT{0.}; ///< maximal entry range in T - ca::Vector<ca::HitIndex_t> fFirstBinEntryIndex {"Grid::fFirstBinEntryIndex", 1, - 0}; ///< index of the first entry in the bin + ca::Vector<ca::HitIndex_t> fFirstBinEntryIndex{"Grid::fFirstBinEntryIndex", 1, + 0}; ///< index of the first entry in the bin - ca::Vector<ca::HitIndex_t> fNofBinEntries {"Grid::fNofBinEntries", 1, 0}; ///< number of hits in the bin + ca::Vector<ca::HitIndex_t> fNofBinEntries{"Grid::fNofBinEntries", 1, 0}; ///< number of hits in the bin - ca::Vector<ca::GridEntry> fEntries { + ca::Vector<ca::GridEntry> fEntries{ "Ca::Grid::fEntries"}; ///< grid entries with references to the hit index in fWindowHits }; @@ -191,4 +191,3 @@ namespace cbm::algo::ca } } // namespace cbm::algo::ca - diff --git a/algo/ca/core/data/CaGridArea.h b/algo/ca/core/data/CaGridArea.h index a0c2efca09..aa7bd50c92 100644 --- a/algo/ca/core/data/CaGridArea.h +++ b/algo/ca/core/data/CaGridArea.h @@ -22,7 +22,7 @@ namespace cbm::algo::ca /// \brief Class for accessing objects in the 2D area that are stored in ca::Grid /// class GridArea { - public: + public: /// \brief Constructor /// \param grid - the grid to work with /// \param x - X coordinate of the center of the area @@ -45,16 +45,16 @@ namespace cbm::algo::ca /// \brief debug mode: loop over the entire GetEntries() vector ignoring the search area void DoLoopOverEntireGrid(); - private: + private: const ca::Grid& fGrid; - int fAreaLastBinY {0}; // last Y bin of the area - int fAreaNbinsX {0}; // number of area bins in X - int fAreaFirstBin {0}; // first bin of the area (left-down corner of the area) - int fAreaCurrentBinY {0}; // current Y bin (incremented while iterating) - ca::HitIndex_t fCurentEntry {0}; // index of the current entry in fGrid.GetEntries() - ca::HitIndex_t fEntriesXend {0}; // end of the hit indices in current y-row - int fGridNbinsX {0}; // Number of grid bins in X (copy of fGrid::GetNofBinsX()) + int fAreaLastBinY{0}; // last Y bin of the area + int fAreaNbinsX{0}; // number of area bins in X + int fAreaFirstBin{0}; // first bin of the area (left-down corner of the area) + int fAreaCurrentBinY{0}; // current Y bin (incremented while iterating) + ca::HitIndex_t fCurentEntry{0}; // index of the current entry in fGrid.GetEntries() + ca::HitIndex_t fEntriesXend{0}; // end of the hit indices in current y-row + int fGridNbinsX{0}; // Number of grid bins in X (copy of fGrid::GetNofBinsX()) }; inline GridArea::GridArea(const ca::Grid& grid, fscal x, fscal y, fscal dx, fscal dy) @@ -82,7 +82,9 @@ namespace cbm::algo::ca // jump to the next y row if fCurentEntry is outside of the X area while (utils::IsUnlikely(xIndexOutOfRange)) { - if (utils::IsUnlikely(fAreaCurrentBinY >= fAreaLastBinY)) { return false; } + if (utils::IsUnlikely(fAreaCurrentBinY >= fAreaLastBinY)) { + return false; + } fAreaCurrentBinY++; // get new y-line fAreaFirstBin += fGridNbinsX; // move the left-down corner of the area to the next y-line fCurentEntry = fGrid.GetFirstBinEntryIndex(fAreaFirstBin); // get first hit in cell, if y-line is new @@ -99,7 +101,9 @@ namespace cbm::algo::ca ca::HitIndex_t entryIndex = 0; bool ok = GetNextGridEntry(entryIndex); - if (ok) { objectId = fGrid.GetEntries()[entryIndex].GetObjectId(); } + if (ok) { + objectId = fGrid.GetEntries()[entryIndex].GetObjectId(); + } return ok; } diff --git a/algo/ca/core/data/CaGridEntry.h b/algo/ca/core/data/CaGridEntry.h index 66d4ab00d5..32d7484097 100644 --- a/algo/ca/core/data/CaGridEntry.h +++ b/algo/ca/core/data/CaGridEntry.h @@ -41,18 +41,18 @@ namespace cbm::algo::ca fscal RangeY() const { return rangeY; } fscal RangeT() const { return rangeT; } - private: + private: constexpr static fscal kUndef = 0.; // TODO: test with constants::Undef<fscal> - ca::HitIndex_t fObjectId {0}; ///< hit id in L1Algo::fWindowHits array + ca::HitIndex_t fObjectId{0}; ///< hit id in L1Algo::fWindowHits array - fscal x {kUndef}; // x coordinate of the hit - fscal y {kUndef}; // y coordinate of the hit - fscal z {kUndef}; // z coordinate of the hit - fscal t {kUndef}; // t coordinate of the hit - fscal rangeX {kUndef}; // x range of the hit - fscal rangeY {kUndef}; // y range of the hit - fscal rangeT {kUndef}; // t range of the hit + fscal x{kUndef}; // x coordinate of the hit + fscal y{kUndef}; // y coordinate of the hit + fscal z{kUndef}; // z coordinate of the hit + fscal t{kUndef}; // t coordinate of the hit + fscal rangeX{kUndef}; // x range of the hit + fscal rangeY{kUndef}; // y range of the hit + fscal rangeT{kUndef}; // t range of the hit }; } // namespace cbm::algo::ca diff --git a/algo/ca/core/data/CaHit.cxx b/algo/ca/core/data/CaHit.cxx index fbc134729d..eb975a0016 100644 --- a/algo/ca/core/data/CaHit.cxx +++ b/algo/ca/core/data/CaHit.cxx @@ -25,7 +25,9 @@ std::string Hit::ToString() const std::string Hit::ToString(int verbose, bool bHeader) const { - if (verbose < 1) { return ""; } + if (verbose < 1) { + return ""; + } using std::setw; constexpr int widthF = 12; constexpr int widthI = 4; diff --git a/algo/ca/core/data/CaHit.h b/algo/ca/core/data/CaHit.h index 1a9c17e6a6..71ec43e75a 100644 --- a/algo/ca/core/data/CaHit.h +++ b/algo/ca/core/data/CaHit.h @@ -8,13 +8,13 @@ #pragma once // include this header only once per compilation unit +#include "CaSimd.h" + #include <boost/serialization/access.hpp> #include <sstream> #include <string> -#include "CaSimd.h" - namespace cbm::algo::ca { // FIXME: Move typedefs to another header (potential problems with dependencies) @@ -26,7 +26,7 @@ namespace cbm::algo::ca class Hit { friend class boost::serialization::access; - public: + public: /// Default constructor Hit() = default; @@ -139,7 +139,7 @@ namespace cbm::algo::ca /// \param bHeader If true, prints the header std::string ToString(int verbose, bool bHeader) const; - private: + private: ///----------------------------------------------------------------------------- /// data members @@ -147,25 +147,25 @@ namespace cbm::algo::ca /// NOTE: For STS f and b correspond to the indexes of the front and back clusters of the hit in a dataset. For other /// tracking detectors (MVD, MuCh, TRD, TOF) f == b and corresponds to the index of the hit. Indexes f and b /// do not intersect between different detector stations. - HitKeyIndex_t fFrontKey {0}; ///< front hit key index - HitKeyIndex_t fBackKey {0}; ///< back hit key index - - fscal fX {0.}; ///< measured X coordinate [cm] - fscal fY {0.}; ///< measured Y coordinate [cm] - fscal fZ {0.}; ///< fixed Z coordinate [cm] - fscal fT {0.}; ///< measured time [ns] - fscal fDx2 {0.}; ///< rms^2 of uncertainty of X coordinate [cm2] - fscal fDy2 {0.}; ///< rms^2 of uncertainty of Y coordinate [cm2] - fscal fDxy {0.}; ///< X/Y covariance [cm2] - fscal fDt2 {0.}; ///< measured uncertainty of time [ns2] - fscal fRangeX {0.}; ///< +/- range of uncertainty of X coordinate [cm] - fscal fRangeY {0.}; ///< +/- range of uncertainty of Y coordinate [cm] - fscal fRangeT {0.}; ///< +/- range of uncertainty of time [ns] - - HitIndex_t fId {0}; ///< id of the hit - int fStation {-1}; ///< index of station in the active stations array - - private: + HitKeyIndex_t fFrontKey{0}; ///< front hit key index + HitKeyIndex_t fBackKey{0}; ///< back hit key index + + fscal fX{0.}; ///< measured X coordinate [cm] + fscal fY{0.}; ///< measured Y coordinate [cm] + fscal fZ{0.}; ///< fixed Z coordinate [cm] + fscal fT{0.}; ///< measured time [ns] + fscal fDx2{0.}; ///< rms^2 of uncertainty of X coordinate [cm2] + fscal fDy2{0.}; ///< rms^2 of uncertainty of Y coordinate [cm2] + fscal fDxy{0.}; ///< X/Y covariance [cm2] + fscal fDt2{0.}; ///< measured uncertainty of time [ns2] + fscal fRangeX{0.}; ///< +/- range of uncertainty of X coordinate [cm] + fscal fRangeY{0.}; ///< +/- range of uncertainty of Y coordinate [cm] + fscal fRangeT{0.}; ///< +/- range of uncertainty of time [ns] + + HitIndex_t fId{0}; ///< id of the hit + int fStation{-1}; ///< index of station in the active stations array + + private: /// Serialization method, used to save ca::Hit objects into binary or text file in a defined order template<class Archive> void serialize(Archive& ar, const unsigned int /*version*/) diff --git a/algo/ca/core/data/CaInputData.cxx b/algo/ca/core/data/CaInputData.cxx index aaa519c1a2..cb09022bd3 100644 --- a/algo/ca/core/data/CaInputData.cxx +++ b/algo/ca/core/data/CaInputData.cxx @@ -33,7 +33,9 @@ InputData::InputData(InputData&& other) noexcept { this->Swap(other); } // InputData& InputData::operator=(const InputData& other) { - if (this != &other) { InputData(other).Swap(*this); } + if (this != &other) { + InputData(other).Swap(*this); + } return *this; } diff --git a/algo/ca/core/data/CaInputData.h b/algo/ca/core/data/CaInputData.h index 2172ad8b43..9ba08c1c0c 100644 --- a/algo/ca/core/data/CaInputData.h +++ b/algo/ca/core/data/CaInputData.h @@ -9,20 +9,20 @@ #pragma once // include this header only once per compilation unit -#include <boost/serialization/access.hpp> -#include <boost/serialization/array.hpp> - #include "CaConstants.h" #include "CaHit.h" #include "CaVector.h" +#include <boost/serialization/access.hpp> +#include <boost/serialization/array.hpp> + namespace cbm::algo::ca { /// Class InputData represents a block of the input data to the L1 tracking algorithm per event or time slice. /// Filling of the InputData is carried out with L1IODataManager class /// class alignas(constants::misc::Alignment) InputData { - public: + public: friend class DataManager; ///< Class which fills the InputData object for each event or time slice friend class boost::serialization::access; @@ -79,7 +79,7 @@ namespace cbm::algo::ca } - private: + private: /// \brief Swap method void Swap(InputData& other) noexcept; @@ -98,11 +98,11 @@ namespace cbm::algo::ca // *************************** /// \brief Sample of input hits - Vector<Hit> fvHits {"InputData::fHits"}; + Vector<Hit> fvHits{"InputData::fHits"}; /// \brief Index of the first hit in the sorted hits vector for a given data stream - Vector<HitIndex_t> fvStreamStartIndices {"InputData::fStreamStartIndices"}; - Vector<HitIndex_t> fvStreamStopIndices {"InputData::fStreamStopIndices"}; + Vector<HitIndex_t> fvStreamStartIndices{"InputData::fStreamStartIndices"}; + Vector<HitIndex_t> fvStreamStopIndices{"InputData::fStreamStopIndices"}; /// \brief Number of hit keys used for rejecting fake STS hits int fNhitKeys = -1; diff --git a/algo/ca/core/data/CaMeasurementTime.cxx b/algo/ca/core/data/CaMeasurementTime.cxx index 05e0bcc266..cf1e795ae5 100644 --- a/algo/ca/core/data/CaMeasurementTime.cxx +++ b/algo/ca/core/data/CaMeasurementTime.cxx @@ -17,7 +17,7 @@ namespace cbm::algo::ca template<typename DataT> std::string MeasurementTime<DataT>::ToString(int indentLevel) const { - std::stringstream aStream {}; + std::stringstream aStream{}; // TODO: possibly it is better to place the indentChar into ca::Parameters (S.Zharko) constexpr char indentChar = '\t'; std::string indent(indentLevel, indentChar); diff --git a/algo/ca/core/data/CaMeasurementTime.h b/algo/ca/core/data/CaMeasurementTime.h index a8a24532eb..5f72d7f04a 100644 --- a/algo/ca/core/data/CaMeasurementTime.h +++ b/algo/ca/core/data/CaMeasurementTime.h @@ -8,14 +8,14 @@ #pragma once // include this header only once per compilation unit -#include <boost/serialization/access.hpp> - -#include <string> - #include "CaConstants.h" #include "CaSimd.h" #include "CaUtils.h" +#include <boost/serialization/access.hpp> + +#include <string> + namespace cbm::algo::ca { @@ -29,7 +29,7 @@ namespace cbm::algo::ca template<typename DataT> class MeasurementTime { - public: + public: friend class boost::serialization::access; /// default constructor @@ -81,18 +81,18 @@ namespace cbm::algo::ca ar& fNdfT; } - private: + private: ///------------------------------ /// Data members - DataT fT {0}; ///< time coordinate of the measurement - DataT fDt2 {1.}; ///< rms^2 of the time coordinate measurement + DataT fT{0}; ///< time coordinate of the measurement + DataT fDt2{1.}; ///< rms^2 of the time coordinate measurement /// number of degrees of freedom (used for chi2 calculation) /// if ndf == 1, the measurement is used in fit and in the chi2 calculation /// if ndf == 0, the measurement is used neither in fit nor in the chi2 calculation - DataT fNdfT {0}; ///< ndf for the time coordinate measurement + DataT fNdfT{0}; ///< ndf for the time coordinate measurement } _fvecalignment; diff --git a/algo/ca/core/data/CaMeasurementU.cxx b/algo/ca/core/data/CaMeasurementU.cxx index 2d02b120d6..05e72e07be 100644 --- a/algo/ca/core/data/CaMeasurementU.cxx +++ b/algo/ca/core/data/CaMeasurementU.cxx @@ -18,7 +18,7 @@ namespace cbm::algo::ca template<typename DataT> std::string MeasurementU<DataT>::ToString(int indentLevel) const { - std::stringstream aStream {}; + std::stringstream aStream{}; // TODO: possibly it is better to place the indentChar into ca::Parameters (S.Zharko) constexpr char indentChar = '\t'; std::string indent(indentLevel, indentChar); diff --git a/algo/ca/core/data/CaMeasurementU.h b/algo/ca/core/data/CaMeasurementU.h index 1a62925148..b145b326b6 100644 --- a/algo/ca/core/data/CaMeasurementU.h +++ b/algo/ca/core/data/CaMeasurementU.h @@ -8,14 +8,14 @@ #pragma once // include this header only once per compilation unit -#include <boost/serialization/access.hpp> - -#include <string> - #include "CaConstants.h" #include "CaSimd.h" #include "CaUtils.h" +#include <boost/serialization/access.hpp> + +#include <string> + namespace cbm::algo::ca { /// \brief The class describes a 1D - measurement U in XY coordinate system @@ -35,7 +35,7 @@ namespace cbm::algo::ca template<typename DataT> class MeasurementU { - public: + public: friend class boost::serialization::access; /// default constructor @@ -106,7 +106,7 @@ namespace cbm::algo::ca ar& fNdf; } - private: + private: ///------------------------------ /// Data members diff --git a/algo/ca/core/data/CaMeasurementXy.cxx b/algo/ca/core/data/CaMeasurementXy.cxx index fea779e4e7..ebd861fd38 100644 --- a/algo/ca/core/data/CaMeasurementXy.cxx +++ b/algo/ca/core/data/CaMeasurementXy.cxx @@ -18,7 +18,7 @@ namespace cbm::algo::ca template<typename DataT> std::string MeasurementXy<DataT>::ToString(int indentLevel) const { - std::stringstream aStream {}; + std::stringstream aStream{}; // TODO: possibly it is better to place the indentChar into ca::Parameters (S.Zharko) constexpr char indentChar = '\t'; std::string indent(indentLevel, indentChar); diff --git a/algo/ca/core/data/CaMeasurementXy.h b/algo/ca/core/data/CaMeasurementXy.h index a705fb05ed..e13e26ef7e 100644 --- a/algo/ca/core/data/CaMeasurementXy.h +++ b/algo/ca/core/data/CaMeasurementXy.h @@ -8,14 +8,14 @@ #pragma once // include this header only once per compilation unit -#include <boost/serialization/access.hpp> - -#include <string> - #include "CaConstants.h" #include "CaSimd.h" #include "CaUtils.h" +#include <boost/serialization/access.hpp> + +#include <string> + namespace cbm::algo::ca { @@ -29,7 +29,7 @@ namespace cbm::algo::ca template<typename DataT> class MeasurementXy { - public: + public: friend class boost::serialization::access; /// default constructor @@ -160,7 +160,7 @@ namespace cbm::algo::ca ar& fNdfY; } - private: + private: /// \brief Copies all/one entries from the other class /// \tparam TdataB Type of the other class /// \tparam TDoAllA If true, all entries of the current class must be set @@ -171,7 +171,7 @@ namespace cbm::algo::ca template<typename TdataB, bool TDoAllA, bool TDoAllB> void CopyBase(const int ia, const MeasurementXy<TdataB>& Tb, const int ib); - private: + private: ///------------------------------ /// Data members @@ -180,11 +180,11 @@ namespace cbm::algo::ca // Therefore, we initialize the data members here with finite numbers. // For the numerical safety, with some reasonable numbers. - DataT fX {0.}; ///< x coordinate of the measurement - DataT fY {0.}; ///< y coordinate of the measurement - DataT fDx2 {1.}; ///< rms^2 of the x coordinate measurement - DataT fDy2 {1.}; ///< rms^2 of the y coordinate measurement - DataT fDxy {0.}; ///< covariance of the x and y coordinate measurements + DataT fX{0.}; ///< x coordinate of the measurement + DataT fY{0.}; ///< y coordinate of the measurement + DataT fDx2{1.}; ///< rms^2 of the x coordinate measurement + DataT fDy2{1.}; ///< rms^2 of the y coordinate measurement + DataT fDxy{0.}; ///< covariance of the x and y coordinate measurements /// number of degrees of freedom (used for chi2 calculation) /// if ndf == 1, the measurement is used in the chi2 calculation diff --git a/algo/ca/core/data/CaTrack.h b/algo/ca/core/data/CaTrack.h index 647f7f18fa..c1ed282801 100644 --- a/algo/ca/core/data/CaTrack.h +++ b/algo/ca/core/data/CaTrack.h @@ -9,12 +9,12 @@ #pragma once // include this header only once per compilation unit -#include <boost/serialization/access.hpp> - #include "CaConstants.h" #include "CaSimd.h" #include "CaTrackParam.h" +#include <boost/serialization/access.hpp> + namespace cbm::algo::ca { /// \class cbm::algo::ca::Track @@ -24,7 +24,7 @@ namespace cbm::algo::ca /// Covariation matrix: C[20] (C55) corresponds to the time variance /// class Track { - public: + public: friend class boost::serialization::access; Track() = default; @@ -38,8 +38,8 @@ namespace cbm::algo::ca ar& fParPV; } - public: - int fNofHits {constants::Undef<int>}; ///< Number of hits in track + public: + int fNofHits{constants::Undef<int>}; ///< Number of hits in track TrackParamS fParFirst; ///< Track parameters on the first station TrackParamS fParLast; ///< Track parameters on the last station diff --git a/algo/ca/core/data/CaTrackParam.cxx b/algo/ca/core/data/CaTrackParam.cxx index 7122793a3f..0704037dc7 100644 --- a/algo/ca/core/data/CaTrackParam.cxx +++ b/algo/ca/core/data/CaTrackParam.cxx @@ -4,12 +4,12 @@ #include "CaTrackParam.h" -#include <iomanip> -#include <iostream> - #include "AlgoFairloggerCompat.h" #include "CaUtils.h" +#include <iomanip> +#include <iostream> + namespace cbm::algo::ca { template<typename DataT> @@ -161,7 +161,9 @@ namespace cbm::algo::ca auto check = [&](const std::string& s, DataT val) { if (!utils::IsFinite(val)) { ret = false; - if (printWhenWrong) { LOG(warning) << " TrackParam parameter " << s << " is undefined: " << val; } + if (printWhenWrong) { + LOG(warning) << " TrackParam parameter " << s << " is undefined: " << val; + } } }; @@ -299,10 +301,14 @@ namespace cbm::algo::ca { int size = 1; - if constexpr (std::is_same_v<DataT, fvec>) { size = fvec::size(); } + if constexpr (std::is_same_v<DataT, fvec>) { + size = fvec::size(); + } assert(nFilled <= size); - if (nFilled < 0) { nFilled = size; } + if (nFilled < 0) { + nFilled = size; + } bool ok = true; for (int i = 0; i < nFilled; ++i) { @@ -311,7 +317,9 @@ namespace cbm::algo::ca if (!ok && printWhenWrong) { LOG(warning) << "TrackParam parameters are not consistent: " << std::endl; - if (nFilled == size) { LOG(warning) << " All vector elements are filled " << std::endl; } + if (nFilled == size) { + LOG(warning) << " All vector elements are filled " << std::endl; + } else { LOG(warning) << " Only first " << nFilled << " vector elements are filled " << std::endl; } diff --git a/algo/ca/core/data/CaTrackParam.h b/algo/ca/core/data/CaTrackParam.h index b09731e47e..25fc57b716 100644 --- a/algo/ca/core/data/CaTrackParam.h +++ b/algo/ca/core/data/CaTrackParam.h @@ -10,14 +10,14 @@ #pragma once // include this header only once per compilation unit -#include <boost/serialization/access.hpp> - -#include <string> - #include "CaConstants.h" #include "CaSimd.h" #include "CaUtils.h" +#include <boost/serialization/access.hpp> + +#include <string> + namespace cbm::algo::ca { /// \class cbm::algo::ca:: TrackParamBase @@ -30,11 +30,11 @@ namespace cbm::algo::ca template<typename DataT> class TrackParamBase { - public: + public: friend class boost::serialization::access; - static constexpr int kNtrackParam {7}; ///< N of variable track parameters: {x, y, tx, ty, q/p, t, vi} - static constexpr int kNcovParam {(kNtrackParam) * (kNtrackParam + 1) / 2}; ///< N of covariance matrix parameters + static constexpr int kNtrackParam{7}; ///< N of variable track parameters: {x, y, tx, ty, q/p, t, vi} + static constexpr int kNcovParam{(kNtrackParam) * (kNtrackParam + 1) / 2}; ///< N of covariance matrix parameters typedef std::array<DataT, kNcovParam> CovMatrix_t; ///< covariance matrix type @@ -521,7 +521,7 @@ namespace cbm::algo::ca ar& fNdfTime; } - private: + private: /// \brief Copies all/one entries from the other class /// \tparam TdataB Type of the other class /// \tparam TDoAllA If true, all entries of the current class must be set @@ -533,7 +533,7 @@ namespace cbm::algo::ca void CopyBase(const int ia, const TrackParamBase<TdataB>& Tb, const int ib); - private: + private: /// --------------------------------------------------------------------------------------------------------------------- /// Class members @@ -552,19 +552,19 @@ namespace cbm::algo::ca 0., 0., 0., 0., 0., 0., 1.}; ///< covariance matrix // clang-format on - DataT fX {0.}; ///< x-position [cm] - DataT fY {0.}; ///< y-position [cm] - DataT fZ {0.}; ///< z-position [cm] - DataT fTx {0.}; ///< slope along x-axis - DataT fTy {0.}; ///< slope along y-axis - DataT fQp {0.}; ///< charge over momentum [ec/GeV] - DataT fT {0.}; ///< time [ns] - DataT fVi {0.}; ///< inverse velocity in downstream direction [ns/cm] + DataT fX{0.}; ///< x-position [cm] + DataT fY{0.}; ///< y-position [cm] + DataT fZ{0.}; ///< z-position [cm] + DataT fTx{0.}; ///< slope along x-axis + DataT fTy{0.}; ///< slope along y-axis + DataT fQp{0.}; ///< charge over momentum [ec/GeV] + DataT fT{0.}; ///< time [ns] + DataT fVi{0.}; ///< inverse velocity in downstream direction [ns/cm] - DataT fChiSq {0.}; ///< chi^2 of track fit, spatial measurements - DataT fNdf {0.}; ///< NDF of track fit, spatial measurements - DataT fChiSqTime {0.}; ///< chi^2 of track fit, time measurements - DataT fNdfTime {0.}; ///< NDF of track fit, time measurements + DataT fChiSq{0.}; ///< chi^2 of track fit, spatial measurements + DataT fNdf{0.}; ///< NDF of track fit, spatial measurements + DataT fChiSqTime{0.}; ///< chi^2 of track fit, time measurements + DataT fNdfTime{0.}; ///< NDF of track fit, time measurements } _fvecalignment; // class TrackParamBase @@ -575,7 +575,7 @@ namespace cbm::algo::ca /// It contains extra methods that are difficult to implement in SIMD version template<typename DataT> class TrackParamBaseScalar : public TrackParamBase<DataT> { - public: + public: /// \brief Gets pseudo-rapidity DataT GetEta() const { return -log(tan(this->GetTheta() * DataT(0.5))); } diff --git a/algo/ca/core/data/CaTriplet.cxx b/algo/ca/core/data/CaTriplet.cxx index 1e6b74c29b..c2eee4e7da 100644 --- a/algo/ca/core/data/CaTriplet.cxx +++ b/algo/ca/core/data/CaTriplet.cxx @@ -10,7 +10,7 @@ std::string cbm::algo::ca::Triplet::ToString(int indentLevel) const { /// print the triplet parameters - std::stringstream ss {}; + std::stringstream ss{}; constexpr char indentChar = '\t'; std::string indent(indentLevel, indentChar); diff --git a/algo/ca/core/data/CaTriplet.h b/algo/ca/core/data/CaTriplet.h index 707fe400d0..4e9e66f3ed 100644 --- a/algo/ca/core/data/CaTriplet.h +++ b/algo/ca/core/data/CaTriplet.h @@ -9,11 +9,11 @@ #pragma once // include this header only once per compilation unit -#include <string> - #include "CaHit.h" #include "CaSimd.h" +#include <string> + namespace cbm::algo::ca { @@ -25,7 +25,7 @@ namespace cbm::algo::ca /// \brief Triplet class represents a short 3-hits track segment called a "triplet". /// class Triplet { - public: + public: /// Default constructor Triplet() = default; @@ -87,31 +87,31 @@ namespace cbm::algo::ca /// \param indentLevel number of indent characters in the output std::string ToString(int indentLevel = 0) const; - private: + private: ///----------------------------------------------------------------------------------------------- /// Data members - fscal fChi2 {0.}; ///< chi^2 - fscal fQp {0.}; ///< q/p - fscal fCqp {0.}; ///< RMS^2 of q/p - fscal fTx {0.}; ///< tx at the left hit - fscal fCtx {0.}; ///< RMS^2 of tx - fscal fTy {0.}; ///< ty at the left hit - fscal fCty {0.}; ///< RMS^2 of ty + fscal fChi2{0.}; ///< chi^2 + fscal fQp{0.}; ///< q/p + fscal fCqp{0.}; ///< RMS^2 of q/p + fscal fTx{0.}; ///< tx at the left hit + fscal fCtx{0.}; ///< RMS^2 of tx + fscal fTy{0.}; ///< ty at the left hit + fscal fCty{0.}; ///< RMS^2 of ty - unsigned int fFirstNeighbour {0}; ///< ID of the first neighbouring triplet - ca::HitIndex_t fHitL {0}; ///< left hit index (16b) in vHits array - ca::HitIndex_t fHitM {0}; ///< middle hit index (16b) - ca::HitIndex_t fHitR {0}; ///< right hit index (16b) - int fNneighbours {0}; ///< n of neighbouring triplets + unsigned int fFirstNeighbour{0}; ///< ID of the first neighbouring triplet + ca::HitIndex_t fHitL{0}; ///< left hit index (16b) in vHits array + ca::HitIndex_t fHitM{0}; ///< middle hit index (16b) + ca::HitIndex_t fHitR{0}; ///< right hit index (16b) + int fNneighbours{0}; ///< n of neighbouring triplets /// Triplet level - its possible position on the longest track candidate it belongs to. /// level 0 = rightmost triplet of a track candidate /// level k = k-ths triplet along the track counting upstream, from right to left. - unsigned char fLevel {0}; + unsigned char fLevel{0}; - unsigned short fSta {0}; ///< packed station numbers: staL (12b), staM-1-staL (2b), staR-2-staL (2b) - bool fIsMomentumFitted {0}; ///< if the triplet momentum is fitted + unsigned short fSta{0}; ///< packed station numbers: staL (12b), staM-1-staL (2b), staR-2-staL (2b) + bool fIsMomentumFitted{0}; ///< if the triplet momentum is fitted }; } // namespace cbm::algo::ca diff --git a/algo/ca/core/pars/CaConfigReader.cxx b/algo/ca/core/pars/CaConfigReader.cxx index a2bde49621..07d325b8ac 100644 --- a/algo/ca/core/pars/CaConfigReader.cxx +++ b/algo/ca/core/pars/CaConfigReader.cxx @@ -9,6 +9,9 @@ #include "CaConfigReader.h" +#include "CaConstants.h" +#include "CaInitManager.h" + #include <boost/algorithm/string.hpp> #include <iostream> @@ -18,9 +21,6 @@ #include <yaml-cpp/yaml.h> -#include "CaConstants.h" -#include "CaInitManager.h" - using namespace std::string_literals; using cbm::algo::ca::ConfigReader; @@ -36,12 +36,18 @@ ConfigReader::ConfigReader(InitManager* pInitManager, int verbose) : fpInitManag YAML::Node ConfigReader::GetNode(std::function<YAML::Node(YAML::Node)> fn) const { auto node = YAML::Node(YAML::NodeType::Undefined); - if (fUserConfigNode) { node = fn(fUserConfigNode); } - if (!node) { node = fn(fMainConfigNode); } + if (fUserConfigNode) { + node = fn(fUserConfigNode); + } + if (!node) { + node = fn(fMainConfigNode); + } if (!node) { std::stringstream msg; msg << "requested node was not found "; - if (fUserConfigNode) { msg << "either in user config (path: " << fsUserConfigPath << ") or "; } + if (fUserConfigNode) { + msg << "either in user config (path: " << fsUserConfigPath << ") or "; + } msg << "in main config (path: " << fsMainConfigPath << ")"; throw std::runtime_error(msg.str()); } @@ -73,7 +79,9 @@ std::vector<std::string> ConfigReader::GetNodeKeys(const YAML::Node& node) const void ConfigReader::Read() { { // Init CA iterations in L1InitManager - if (fVerbose >= 1) { LOG(info) << "- reading track finder iterations"; } + if (fVerbose >= 1) { + LOG(info) << "- reading track finder iterations"; + } auto iters = this->ReadCAIterationVector(); assert(iters.size()); fpInitManager->ClearCAIterations(); @@ -82,13 +90,17 @@ void ConfigReader::Read() } { // Unset inactive tracking stations - if (fVerbose >= 1) { LOG(info) << "- unsetting inactive tracking stations"; } + if (fVerbose >= 1) { + LOG(info) << "- unsetting inactive tracking stations"; + } auto inactiveMap = this->ReadInactiveStationMap(); if (std::any_of(inactiveMap.begin(), inactiveMap.end(), [](const auto& s) { return (s.size() != 0); })) { for (auto& station : fpInitManager->GetStationInfo()) { int iDet = static_cast<int>(station.GetDetectorID()); int iStLoc = station.GetStationID(); - if (inactiveMap[iDet].find(iStLoc) != inactiveMap[iDet].end()) { station.SetTrackingStatus(false); } + if (inactiveMap[iDet].find(iStLoc) != inactiveMap[iDet].end()) { + station.SetTrackingStatus(false); + } } // Since we disabled some stations, we have to rerun the layout initialization again, thus the station scheme is // kept consistent @@ -98,7 +110,9 @@ void ConfigReader::Read() // Init parameters, independnent from the tracking iteration - if (fVerbose >= 1) { LOG(info) << "- reading miscellaneous parameters"; } + if (fVerbose >= 1) { + LOG(info) << "- reading miscellaneous parameters"; + } fpInitManager->SetRandomSeed( GetNode([](YAML::Node n) { return n["core"]["common"]["random_seed"]; }).as<unsigned int>()); @@ -109,7 +123,9 @@ void ConfigReader::Read() fpInitManager->SetMaxTripletPerDoublets( GetNode([](YAML::Node n) { return n["core"]["track_finder"]["max_triplets_per_doublet"]; }).as<unsigned int>()); - if (fVerbose >= 1) { LOG(info) << "- reading developement parameters"; } + if (fVerbose >= 1) { + LOG(info) << "- reading developement parameters"; + } // Dev flags fpInitManager->DevSetIgnoreHitSearchAreas( GetNode([](YAML::Node n) { return n["core"]["dev"]["ignore_hit_search_areas"]; }).as<bool>()); @@ -159,33 +175,45 @@ std::vector<Iteration> ConfigReader::ReadCAIterationVector() // Read actual iteration sequence // if (fUserConfigNode) { - if (fVerbose >= 1) { LOG(info) << "- Reading user iterations "; } + if (fVerbose >= 1) { + LOG(info) << "- Reading user iterations "; + } auto currentNode = fUserConfigNode["core"]["track_finder"]["iterations"]; if (currentNode) { for (const auto& iterNode : currentNode) { std::string thisIterName = iterNode["name"].as<std::string>(""); std::string baseIterName = iterNode["base_iteration"].as<std::string>(""); - if (fVerbose >= 2) { LOG(info) << "- Reading user iteration " << thisIterName << "(" << baseIterName << ")"; } + if (fVerbose >= 2) { + LOG(info) << "- Reading user iteration " << thisIterName << "(" << baseIterName << ")"; + } if (mPossibleIterations.find(thisIterName) != mPossibleIterations.end()) { // This is an update of existing possible iteration - if (fVerbose >= 2) { LOG(info) << "- Select A"; } + if (fVerbose >= 2) { + LOG(info) << "- Select A"; + } res.push_back(ReadSingleCAIteration(iterNode, mPossibleIterations.at(thisIterName))); } else if (mPossibleIterations.find(baseIterName) != mPossibleIterations.end()) { // This is a user iteration based on the existing possible iteration - if (fVerbose >= 2) { LOG(info) << "- Select B"; } + if (fVerbose >= 2) { + LOG(info) << "- Select B"; + } res.push_back(ReadSingleCAIteration(iterNode, mPossibleIterations.at(baseIterName))); } else { // Try to find a base iteration from user-defined auto itFound = std::find_if(res.begin(), res.end(), [&](auto& i) { return i.GetName() == baseIterName; }); if (itFound != res.end()) { - if (fVerbose >= 2) { LOG(info) << "- Select C"; } + if (fVerbose >= 2) { + LOG(info) << "- Select C"; + } res.push_back(ReadSingleCAIteration(iterNode, *itFound)); } else { - if (fVerbose >= 2) { LOG(info) << "- Select D"; } + if (fVerbose >= 2) { + LOG(info) << "- Select D"; + } res.push_back(ReadSingleCAIteration(iterNode, Iteration())); } } @@ -226,12 +254,16 @@ std::vector<std::set<int>> ConfigReader::ReadInactiveStationMap() std::unordered_map<std::string, int> mDetNameToID; for (int iDet = 0; iDet < constants::size::MaxNdetectors; ++iDet) { auto detName = boost::algorithm::to_lower_copy(fpInitManager->GetDetectorName(static_cast<EDetectorID>(iDet))); - if (!detName.size()) { continue; } + if (!detName.size()) { + continue; + } mDetNameToID[detName] = iDet; } for (const auto& item : node) { std::string stName = item.as<std::string>(); - if (!stName.size()) { continue; } + if (!stName.size()) { + continue; + } // // Check name for spaces if (std::any_of(stName.begin(), stName.end(), [](auto c) { return c == ' ' || c == '\t' || c == '\n'; })) { @@ -266,7 +298,9 @@ std::vector<std::set<int>> ConfigReader::ReadInactiveStationMap() if (vNames.size() == 2) { // Disable one particular station try { int iStLoc = std::stoi(vNames.back()); - if (iStLoc < 0 || iStLoc >= nStations) { throw std::runtime_error("illegal local station index"); } + if (iStLoc < 0 || iStLoc >= nStations) { + throw std::runtime_error("illegal local station index"); + } vGeoIdToTrackingStatus[it->second].insert(iStLoc); } catch (const std::exception&) { diff --git a/algo/ca/core/pars/CaConfigReader.h b/algo/ca/core/pars/CaConfigReader.h index 7f3006eb4b..780f8920f8 100644 --- a/algo/ca/core/pars/CaConfigReader.h +++ b/algo/ca/core/pars/CaConfigReader.h @@ -9,14 +9,14 @@ #pragma once // include this header only once per compilation unit +#include "CaIteration.h" + #include <string> #include <unordered_map> #include <vector> #include <yaml-cpp/yaml.h> -#include "CaIteration.h" - using namespace cbm::algo::ca; namespace YAML @@ -35,7 +35,7 @@ namespace cbm::algo::ca /// TODO: Describe configuration procedure here... (main config, user config etc...) /// class ConfigReader { - public: + public: /// \brief Constructor /// \param pInitManager Pointer to the L1InitManager instance ConfigReader(InitManager* pInitManager, int verbose = 1); @@ -64,7 +64,7 @@ namespace cbm::algo::ca /// \brief Gets verbosity level int GetVerbosity() const { return fVerbose; } - private: + private: /// \brief Reads inactive tracking station map /// \return A vector of sets of disabled station local indexes vs. the the detector index std::vector<std::set<int>> ReadInactiveStationMap(); @@ -96,7 +96,7 @@ namespace cbm::algo::ca std::string fsMainConfigPath = ""; ///< Path to the main config file (mandatory) std::string fsUserConfigPath = ""; ///< Path to the user config file (optional) - YAML::Node fMainConfigNode {YAML::NodeType::Undefined}; ///< Main configuration node - YAML::Node fUserConfigNode {YAML::NodeType::Undefined}; ///< User configuration node + YAML::Node fMainConfigNode{YAML::NodeType::Undefined}; ///< Main configuration node + YAML::Node fUserConfigNode{YAML::NodeType::Undefined}; ///< User configuration node }; } // namespace cbm::algo::ca diff --git a/algo/ca/core/pars/CaConstants.h b/algo/ca/core/pars/CaConstants.h index cff4ad0baf..38f0f7b1df 100644 --- a/algo/ca/core/pars/CaConstants.h +++ b/algo/ca/core/pars/CaConstants.h @@ -9,10 +9,10 @@ #pragma once // include this header only once per compilation unit -#include <limits> - #include "CaSimd.h" +#include <limits> + /// Namespace contains compile-time constants definition for the CA tracking algorithm /// namespace cbm::algo::ca::constants @@ -22,11 +22,11 @@ namespace cbm::algo::ca::constants namespace size { /// Order of polynomial to approximate field in the vicinity of station plane - constexpr int MaxFieldApproxPolynomialOrder {5}; + constexpr int MaxFieldApproxPolynomialOrder{5}; /// Amount of coefficients in field approximations - constexpr int MaxNFieldApproxCoefficients {(MaxFieldApproxPolynomialOrder + 1) * (MaxFieldApproxPolynomialOrder + 2) - / 2}; + constexpr int MaxNFieldApproxCoefficients{(MaxFieldApproxPolynomialOrder + 1) * (MaxFieldApproxPolynomialOrder + 2) + / 2}; /// Amount of bits to code a station or triplet. This values determine the maximum number of stations and tripülets constexpr unsigned int StationBits = 6u; ///< Amount of bits to code one station diff --git a/algo/ca/core/pars/CaField.cxx b/algo/ca/core/pars/CaField.cxx index f970e5fc26..22401d4ea9 100644 --- a/algo/ca/core/pars/CaField.cxx +++ b/algo/ca/core/pars/CaField.cxx @@ -4,13 +4,13 @@ #include "CaField.h" +#include "CaTrackParam.h" +#include "CaUtils.h" + #include <iomanip> #include <iostream> #include <sstream> -#include "CaTrackParam.h" -#include "CaUtils.h" - using namespace cbm::algo::ca; // @@ -41,7 +41,7 @@ void FieldValue::CheckConsistency() const // TODO: std::string FieldValue::ToString(int indentLevel) const { - std::stringstream aStream {}; + std::stringstream aStream{}; constexpr char indentChar = '\t'; std::string indent(indentLevel, indentChar); aStream << indent << "Bx [kG]: " << std::setw(12) << std::setfill(' ') << x[0] << '\n'; @@ -135,7 +135,7 @@ FieldValue FieldSlice::GetFieldValueForLine(const TrackParamV& t) const // std::string FieldSlice::ToString(int indentLevel) const { - std::stringstream aStream {}; + std::stringstream aStream{}; // TODO: possibly it is better to place the indentChar into L1Parameters (S.Zharko) constexpr char indentChar = '\t'; std::string indent(indentLevel, indentChar); @@ -317,7 +317,7 @@ void FieldRegion::SetOneEntry(const FieldRegion& f1, const int i1) // std::string FieldRegion::ToString(int indentLevel) const { - std::stringstream aStream {}; + std::stringstream aStream{}; // TODO: possibly it is better to place the indentChar into L1Parameters (S.Zharko) constexpr char indentChar = '\t'; std::string indent(indentLevel, indentChar); diff --git a/algo/ca/core/pars/CaField.h b/algo/ca/core/pars/CaField.h index 39e93a59d5..e744448f54 100644 --- a/algo/ca/core/pars/CaField.h +++ b/algo/ca/core/pars/CaField.h @@ -5,24 +5,24 @@ #pragma once // include this header only once per compilation unit +#include "CaConstants.h" +#include "CaSimd.h" +#include "CaTrackParam.h" + #include <boost/serialization/access.hpp> #include <functional> #include <string> -#include "CaConstants.h" -#include "CaSimd.h" -#include "CaTrackParam.h" - namespace cbm::algo::ca { class FieldValue { - public: - fvec x {0.f}; //< x-component of the field - fvec y {0.f}; //< y-component of the field - fvec z {0.f}; //< z-component of the field + public: + fvec x{0.f}; //< x-component of the field + fvec y{0.f}; //< y-component of the field + fvec z{0.f}; //< z-component of the field /// Combines the magnetic field with another field value object using weight /// \param B other field value to combine with @@ -70,7 +70,7 @@ namespace cbm::algo::ca /// // TODO: Crosscheck the default content (S.Zharko) class FieldSlice { - public: + public: /// Default constructor FieldSlice(); @@ -92,7 +92,7 @@ namespace cbm::algo::ca /// \param indentLevel number of indent characters in the output std::string ToString(int indentLevel = 0) const; - public: + public: // NOTE: We don't use an initialization of arrays here because we cannot be sure // if the underlying type (fvec) has a default constructor, but // we are sure, that it can be initialized with a float. (S.Zharko) @@ -101,7 +101,7 @@ namespace cbm::algo::ca fvec cy[kMaxNFieldApproxCoefficients]; ///< Polynomial coefficients for y-component of the field value fvec cz[kMaxNFieldApproxCoefficients]; ///< Polynomial coefficients for z-component of the field value - fvec z {constants::Undef<fscal>}; ///< z coordinate of the slice + fvec z{constants::Undef<fscal>}; ///< z coordinate of the slice /// Serialization function friend class boost::serialization::access; @@ -117,7 +117,7 @@ namespace cbm::algo::ca class FieldRegion { - public: + public: // NOTE: When a custom constructor is defined, default constructor also should be provided (S.Zharko) FieldRegion() = default; @@ -187,29 +187,29 @@ namespace cbm::algo::ca fgOdiginalField = f; } - public: + public: static bool fgForceUseOfOriginalField; static std::function<std::tuple<double, double, double>(double x, double y, double z)> fgOdiginalField; // TODO: Probably it's better to have arrays instead of separate fvec values? (S.Zharko) // Bx(z) = cx0 + cx1*(z-z0) + cx2*(z-z0)^2 - fvec cx0 {0.f}; - fvec cx1 {0.f}; - fvec cx2 {0.f}; + fvec cx0{0.f}; + fvec cx1{0.f}; + fvec cx2{0.f}; // By(z) = cy0 + cy1*(z-z0) + cy2*(z-z0)^2 - fvec cy0 {0.f}; - fvec cy1 {0.f}; - fvec cy2 {0.f}; + fvec cy0{0.f}; + fvec cy1{0.f}; + fvec cy2{0.f}; // Bz(z) = cz0 + cz1*(z-z0) + cz2*(z-z0)^2 - fvec cz0 {0.f}; - fvec cz1 {0.f}; - fvec cz2 {0.f}; + fvec cz0{0.f}; + fvec cz1{0.f}; + fvec cz2{0.f}; - fvec z0 {0.f}; ///< z-coordinate of the field region central point + fvec z0{0.f}; ///< z-coordinate of the field region central point - bool fUseOriginalField {false}; + bool fUseOriginalField{false}; /// Serialization function friend class boost::serialization::access; diff --git a/algo/ca/core/pars/CaInitManager.cxx b/algo/ca/core/pars/CaInitManager.cxx index 9463491dae..bfa9af0a71 100644 --- a/algo/ca/core/pars/CaInitManager.cxx +++ b/algo/ca/core/pars/CaInitManager.cxx @@ -9,6 +9,8 @@ #include "CaInitManager.h" +#include "CaConfigReader.h" + #include <boost/archive/binary_iarchive.hpp> #include <boost/archive/binary_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> @@ -17,8 +19,6 @@ #include <fstream> #include <sstream> -#include "CaConfigReader.h" - using namespace constants; using cbm::algo::ca::InitManager; @@ -118,7 +118,9 @@ bool InitManager::FormParametersContainer() return false; } - if (!fParameters.fDevIsParSearchWUsed) { fInitController.SetFlag(EInitKey::kSearchWindows, true); } + if (!fParameters.fDevIsParSearchWUsed) { + fInitController.SetFlag(EInitKey::kSearchWindows, true); + } // Apply magnetic field to the station info objects std::for_each(fvStationInfo.begin(), fvStationInfo.end(), [&](auto& st) { st.SetFieldFunction(fFieldFunction); }); @@ -135,7 +137,9 @@ bool InitManager::FormParametersContainer() { // Form array of stations auto destIt = fParameters.fStations.begin(); for (const auto& station : fvStationInfo) { - if (!station.GetTrackingStatus()) { continue; } + if (!station.GetTrackingStatus()) { + continue; + } *destIt = station.GetStation(); ++destIt; } @@ -144,7 +148,9 @@ bool InitManager::FormParametersContainer() { // Form array of material map auto destIt = fParameters.fThickMap.begin(); for (auto& station : fvStationInfo) { - if (!station.GetTrackingStatus()) { continue; } + if (!station.GetTrackingStatus()) { + continue; + } *destIt = std::move(station.TakeMaterialMap()); ++destIt; } @@ -239,7 +245,9 @@ void InitManager::InitStationLayout() // Fill geo <-> active map int iStActive = aStation.GetTrackingStatus() ? fParameters.fNstationsActiveTotal++ : -1; fParameters.fvGeoToActiveMap[iStGeo] = iStActive; - if (iStActive > -1) { fParameters.fvActiveToGeoMap[iStActive] = iStGeo; } + if (iStActive > -1) { + fParameters.fvActiveToGeoMap[iStActive] = iStGeo; + } } fInitController.SetFlag(EInitKey::kStationLayoutInitialized, true); @@ -265,16 +273,16 @@ void InitManager::InitTargetField(double zStep) LOG(fatal) << "Attempt to initialize the field value and field region near target before the target position" << "initialization"; } - constexpr int nDimensions {3}; - constexpr int nPointsNodal {3}; + constexpr int nDimensions{3}; + constexpr int nPointsNodal{3}; - std::array<double, nPointsNodal> inputNodalZ {fTargetZ, fTargetZ + zStep, fTargetZ + 2. * zStep}; - std::array<ca::FieldValue, nPointsNodal> B {}; - std::array<fvec, nPointsNodal> z {}; + std::array<double, nPointsNodal> inputNodalZ{fTargetZ, fTargetZ + zStep, fTargetZ + 2. * zStep}; + std::array<ca::FieldValue, nPointsNodal> B{}; + std::array<fvec, nPointsNodal> z{}; // loop over nodal points for (int idx = 0; idx < nPointsNodal; ++idx) { - double point[nDimensions] {0., 0., inputNodalZ[idx]}; - double field[nDimensions] {}; + double point[nDimensions]{0., 0., inputNodalZ[idx]}; + double field[nDimensions]{}; fFieldFunction(point, field); z[idx] = inputNodalZ[idx]; B[idx].x = field[0]; @@ -339,7 +347,9 @@ void InitManager::ReadSearchWindows(const std::string& fileName) { // Open input binary file std::ifstream ifs(fileName); - if (!ifs) { LOG(fatal) << "InitManager: search window file \"" << fileName << "\" was not found"; } + if (!ifs) { + LOG(fatal) << "InitManager: search window file \"" << fileName << "\" was not found"; + } try { boost::archive::text_iarchive ia(ifs); @@ -500,7 +510,9 @@ void InitManager::CheckStationsInfoInit() // (1) Check the stations themselves bool bStationsFinalized = std::all_of(fvStationInfo.begin(), fvStationInfo.end(), [](const auto& st) { return st.GetInitController().IsFinalized(); }); - if (!bStationsFinalized) { LOG(fatal) << "At least one of the StationInitializer objects is not finalized"; } + if (!bStationsFinalized) { + LOG(fatal) << "At least one of the StationInitializer objects is not finalized"; + } // (2) Check for maximum allowed number of stations if (fParameters.GetNstationsGeometry() > constants::size::MaxNstations) { diff --git a/algo/ca/core/pars/CaInitManager.h b/algo/ca/core/pars/CaInitManager.h index b75ac7cdc0..5834644476 100644 --- a/algo/ca/core/pars/CaInitManager.h +++ b/algo/ca/core/pars/CaInitManager.h @@ -9,15 +9,6 @@ #pragma once // include this header only once per compilation unit -#include <array> -#include <bitset> -#include <memory> //unique_ptr -#include <numeric> -#include <set> -#include <string> -#include <type_traits> -#include <unordered_map> - #include "CaConstants.h" #include "CaField.h" #include "CaIteration.h" @@ -27,6 +18,15 @@ #include "CaStationInitializer.h" #include "CaUtils.h" +#include <array> +#include <bitset> +#include <memory> //unique_ptr +#include <numeric> +#include <set> +#include <string> +#include <type_traits> +#include <unordered_map> + namespace cbm::algo::ca { /// \enum cbm::algo::ca::EDetectorID @@ -46,7 +46,7 @@ namespace cbm::algo::ca /// reading the already prepared binary wile with extention ca.par TODO:.... continue /// class InitManager { - private: + private: /// \brief Init-controller key set enum class EInitKey { @@ -73,7 +73,7 @@ namespace cbm::algo::ca template<typename T> using DetectorIDArr_t = std::array<T, constants::size::MaxNdetectors>; - public: + public: /// \brief Default constructor InitManager() = default; @@ -270,7 +270,7 @@ namespace cbm::algo::ca /// \param false the Kalman filter is be used in track finder void DevSetIsParSearchWUsed(bool value = true) { fParameters.fDevIsParSearchWUsed = value; } - private: + private: /// \brief Checker for Iteration container initialization (sets EInitKey::kCAIterations) /// \return true If all Iteration objects were initialized properly void CheckCAIterationsInit(); @@ -282,22 +282,22 @@ namespace cbm::algo::ca /// \brief Returns station layout into undefined condition void ClearStationLayout(); - InitController_t fInitController {}; ///< Initialization flags - DetectorIDSet_t fActiveDetectorIDs {}; ///< Set of tracking detectors, active during the run - DetectorIDArr_t<std::string> fvDetectorNames {}; ///< Names of the detectors + InitController_t fInitController{}; ///< Initialization flags + DetectorIDSet_t fActiveDetectorIDs{}; ///< Set of tracking detectors, active during the run + DetectorIDArr_t<std::string> fvDetectorNames{}; ///< Names of the detectors - double fTargetZ {0.}; ///< Target position z component in double precision + double fTargetZ{0.}; ///< Target position z component in double precision - std::vector<StationInitializer> fvStationInfo {}; ///< Vector of StationInitializer objects (active + inactive) + std::vector<StationInitializer> fvStationInfo{}; ///< Vector of StationInitializer objects (active + inactive) /// A function which returns magnetic field vector B in a radius-vector xyz - FieldFunction_t fFieldFunction {[](const double (&)[3], double (&)[3]) {}}; + FieldFunction_t fFieldFunction{[](const double (&)[3], double (&)[3]) {}}; // NOTE: Stations of the detectors which are not assigned as active, are not included in the tracking! // TODO: remove - int fCAIterationsNumberCrosscheck {-1}; ///< Number of iterations to be passed (must be used for cross-checks) + int fCAIterationsNumberCrosscheck{-1}; ///< Number of iterations to be passed (must be used for cross-checks) - Parameters fParameters {}; ///< CA parameters object + Parameters fParameters{}; ///< CA parameters object std::string fsConfigInputMain = ""; ///< name for the input configuration file std::string fsConfigInputUser = ""; ///< name for the input configuration file diff --git a/algo/ca/core/pars/CaIteration.cxx b/algo/ca/core/pars/CaIteration.cxx index 1412441600..eec6d882b8 100644 --- a/algo/ca/core/pars/CaIteration.cxx +++ b/algo/ca/core/pars/CaIteration.cxx @@ -9,12 +9,12 @@ #include "CaIteration.h" -#include <limits> -#include <sstream> - #include "CaConstants.h" #include "CaUtils.h" +#include <limits> +#include <sstream> + using cbm::algo::ca::Iteration; using cbm::algo::ca::Vector; using cbm::algo::ca::utils::CheckValueLimits; @@ -62,7 +62,7 @@ void Iteration::SetTargetPosSigmaXY(float sigmaX, float sigmaY) // std::string Iteration::ToString(int) const { - std::vector<Iteration> vIter {*this}; + std::vector<Iteration> vIter{*this}; return Iteration::ToTableFromVector(vIter); } diff --git a/algo/ca/core/pars/CaIteration.h b/algo/ca/core/pars/CaIteration.h index f3b06c3563..c9afecd5a2 100644 --- a/algo/ca/core/pars/CaIteration.h +++ b/algo/ca/core/pars/CaIteration.h @@ -11,6 +11,8 @@ #pragma once // include this header only once per compilation unit +#include "CaVector.h" + #include <boost/serialization/access.hpp> #include <boost/serialization/string.hpp> @@ -18,8 +20,6 @@ #include <iomanip> #include <string> -#include "CaVector.h" - namespace cbm::algo::ca { /// \class cbm::algo::ca::Iteration @@ -29,7 +29,7 @@ namespace cbm::algo::ca /// class (e.g., fast primary tracks or secondary electron tracks). Hits associated with tracks /// reconstructed during current iteration are removed from the further iterations. class Iteration { - public: + public: /// \brief Default constructor Iteration() = default; @@ -209,9 +209,9 @@ namespace cbm::algo::ca /// \return Iterations table represented with a string static std::string ToTableFromVector(const Vector<Iteration>& vIterations); - private: + private: /** Basic fields **/ - std::string fName {""}; ///< Iteration name + std::string fName{""}; ///< Iteration name /** Track finder dependent cuts **/ // TODO: Iteratively change the literals to floats (S.Zharko) diff --git a/algo/ca/core/pars/CaMaterialMap.cxx b/algo/ca/core/pars/CaMaterialMap.cxx index dbabf6e1f1..8b02c09dd4 100644 --- a/algo/ca/core/pars/CaMaterialMap.cxx +++ b/algo/ca/core/pars/CaMaterialMap.cxx @@ -4,12 +4,12 @@ #include "CaMaterialMap.h" +#include "AlgoFairloggerCompat.h" + #include <iomanip> #include <sstream> #include <vector> -#include "AlgoFairloggerCompat.h" - /******************** * MaterialMap class * ********************/ @@ -36,7 +36,9 @@ int MaterialMap::GetBin(float x, float y) const { int i = static_cast<int>((x + fXYmax) * fFactor); int j = static_cast<int>((y + fXYmax) * fFactor); - if (i < 0 || j < 0 || i >= fNbins || j >= fNbins) { return -1; } + if (i < 0 || j < 0 || i >= fNbins || j >= fNbins) { + return -1; + } return i + j * fNbins; } @@ -68,7 +70,9 @@ fvec MaterialMap::GetRadThickVec(fvec x, fvec y) const void MaterialMap::CheckConsistency() const { /* (i) Check, if the object was initialized */ - if (IsNaN()) { throw std::logic_error("MaterialMap: class was not initialized"); } + if (IsNaN()) { + throw std::logic_error("MaterialMap: class was not initialized"); + } /* (ii) Check if the thickness values correct (non-negative) */ bool isThicknessOk = true; diff --git a/algo/ca/core/pars/CaMaterialMap.h b/algo/ca/core/pars/CaMaterialMap.h index af77e37874..9d80f2d6c3 100644 --- a/algo/ca/core/pars/CaMaterialMap.h +++ b/algo/ca/core/pars/CaMaterialMap.h @@ -4,6 +4,9 @@ #pragma once // include this header only once per compilation unit +#include "CaSimd.h" +#include "CaUtils.h" + #include <boost/serialization/vector.hpp> #include <iomanip> @@ -11,15 +14,12 @@ #include <string> #include <vector> -#include "CaSimd.h" -#include "CaUtils.h" - namespace cbm::algo::ca { /// \class MaterialMap /// \brief A map of station thickness in units of radiation length (X0) to the specific point in XY plane class MaterialMap { - public: + public: /// \brief Default constructor MaterialMap() = default; @@ -103,14 +103,14 @@ namespace cbm::algo::ca /// \brief Get bin index for (x,y). Returns -1 when outside of the map int GetBin(float x, float y) const; - private: + private: int fNbins = constants::Undef<int>; ///< Number of rows (== N columns) in the material budget table float fXYmax = constants::Undef<float>; ///< Size of the station in x and y dimensions [cm] float fFactor = constants::Undef<float>; ///< Util. var. for the conversion of point coordinates to row/column id float fZref = constants::Undef<float>; ///< Reference Z of the collected material [cm] float fZmin = constants::Undef<float>; ///< Minimal Z of the collected material [cm] float fZmax = constants::Undef<float>; ///< Minimal Z of the collected material [cm] - std::vector<float> fTable {}; ///< Material budget table + std::vector<float> fTable{}; ///< Material budget table /// \brief Serialization function friend class boost::serialization::access; @@ -128,4 +128,3 @@ namespace cbm::algo::ca } _fvecalignment; } // namespace cbm::algo::ca - diff --git a/algo/ca/core/pars/CaMaterialMonitor.cxx b/algo/ca/core/pars/CaMaterialMonitor.cxx index c204f13f06..1e9d02bd0e 100644 --- a/algo/ca/core/pars/CaMaterialMonitor.cxx +++ b/algo/ca/core/pars/CaMaterialMonitor.cxx @@ -7,11 +7,11 @@ #include "CaMaterialMonitor.h" +#include "AlgoFairloggerCompat.h" + #include <iomanip> #include <sstream> -#include "AlgoFairloggerCompat.h" - namespace cbm::algo::ca { @@ -29,7 +29,9 @@ namespace cbm::algo::ca fActiveBinMap.resize(0); - if (fMaterial) { fActiveBinMap.assign(fMaterial->GetNbins() * fMaterial->GetNbins(), 0); } + if (fMaterial) { + fActiveBinMap.assign(fMaterial->GetNbins() * fMaterial->GetNbins(), 0); + } fNhitsTotal = 0; fNhitsOutside = 0; @@ -46,7 +48,9 @@ namespace cbm::algo::ca } int i = fMaterial->GetBin(x, y); fNhitsTotal++; - if (i < 0) { fNhitsOutside++; } + if (i < 0) { + fNhitsOutside++; + } else { fActiveBinMap[i] = 1; } @@ -67,7 +71,9 @@ namespace cbm::algo::ca fPassiveRadThickMax = constants::Undef<double>; fPassiveRadThickMean = constants::Undef<double>; - if (!fMaterial) { return; } + if (!fMaterial) { + return; + } int nBins = fMaterial->GetNbins() * fMaterial->GetNbins(); @@ -110,8 +116,12 @@ namespace cbm::algo::ca if (fActiveNbins + fPassiveNbins != nBins) { LOG(fatal) << "MaterialMonitor: wrong calculation of N passive / active bins "; } - if (fActiveNbins > 0) { fActiveRadThickMean /= fActiveNbins; } - if (fPassiveNbins > 0) { fPassiveRadThickMean /= fPassiveNbins; } + if (fActiveNbins > 0) { + fActiveRadThickMean /= fActiveNbins; + } + if (fPassiveNbins > 0) { + fPassiveRadThickMean /= fPassiveNbins; + } } @@ -130,7 +140,9 @@ namespace cbm::algo::ca << "%, mean " << fActiveRadThickMean * 100. << "%. "; } else { - if (fNhitsTotal > 0) { ss << "No active material. "; } + if (fNhitsTotal > 0) { + ss << "No active material. "; + } else { ss << "No hits yet to identify active areas. "; } @@ -145,7 +157,9 @@ namespace cbm::algo::ca } if (fNhitsTotal > 0) { - if (fNhitsOutside == 0) { ss << "No hits outside of the map. "; } + if (fNhitsOutside == 0) { + ss << "No hits outside of the map. "; + } else { ss << "There are " << (100. * fNhitsOutside) / fNhitsTotal << "% hits outside the map!!! "; } diff --git a/algo/ca/core/pars/CaMaterialMonitor.h b/algo/ca/core/pars/CaMaterialMonitor.h index b03a67eec1..271696868f 100644 --- a/algo/ca/core/pars/CaMaterialMonitor.h +++ b/algo/ca/core/pars/CaMaterialMonitor.h @@ -9,12 +9,12 @@ #pragma once // include this header only once per compilation unit -#include <string> -#include <vector> - #include "CaConstants.h" #include "CaMaterialMap.h" +#include <string> +#include <vector> + namespace cbm::algo::ca { @@ -26,7 +26,7 @@ namespace cbm::algo::ca /// Class to collect statistics for ca::MaterialMap /// class MaterialMonitor { - public: + public: /// default constructor MaterialMonitor() : MaterialMonitor(nullptr) {} @@ -95,24 +95,24 @@ namespace cbm::algo::ca /// get the number of processed hits double GetNhits() const { return fNhitsTotal; } - private: - const ca::MaterialMap* fMaterial {nullptr}; ///< Pointer to ca::MaterialMap - std::string fName {}; ///< Name of the material map + private: + const ca::MaterialMap* fMaterial{nullptr}; ///< Pointer to ca::MaterialMap + std::string fName{}; ///< Name of the material map - std::vector<char> fActiveBinMap {}; ///< Map of active bins in the material map (bins where hits appear) + std::vector<char> fActiveBinMap{}; ///< Map of active bins in the material map (bins where hits appear) - int fActiveNbins {constants::Undef<int>}; ///< Active material: number of bins - double fActiveRadThickMin {constants::Undef<double>}; ///< Active material: minimal thickness - double fActiveRadThickMax {constants::Undef<double>}; ///< Active material: maximal thickness - double fActiveRadThickMean {constants::Undef<double>}; ///< Active material: average thickness + int fActiveNbins{constants::Undef<int>}; ///< Active material: number of bins + double fActiveRadThickMin{constants::Undef<double>}; ///< Active material: minimal thickness + double fActiveRadThickMax{constants::Undef<double>}; ///< Active material: maximal thickness + double fActiveRadThickMean{constants::Undef<double>}; ///< Active material: average thickness - int fPassiveNbins {constants::Undef<int>}; ///< Passive material: number of bins - double fPassiveRadThickMin {constants::Undef<double>}; ///< Passive material: minimal thickness - double fPassiveRadThickMax {constants::Undef<double>}; ///< Passive material: maximal thickness - double fPassiveRadThickMean {constants::Undef<double>}; ///< Passive material: average thickness + int fPassiveNbins{constants::Undef<int>}; ///< Passive material: number of bins + double fPassiveRadThickMin{constants::Undef<double>}; ///< Passive material: minimal thickness + double fPassiveRadThickMax{constants::Undef<double>}; ///< Passive material: maximal thickness + double fPassiveRadThickMean{constants::Undef<double>}; ///< Passive material: average thickness - unsigned long fNhitsTotal {0}; ///< number of hits in statistics - unsigned long fNhitsOutside {0}; ///< number of hits outside the material map + unsigned long fNhitsTotal{0}; ///< number of hits in statistics + unsigned long fNhitsOutside{0}; ///< number of hits outside the material map }; } // namespace cbm::algo::ca diff --git a/algo/ca/core/pars/CaParameters.cxx b/algo/ca/core/pars/CaParameters.cxx index a0b046caf9..73ab58bbc6 100644 --- a/algo/ca/core/pars/CaParameters.cxx +++ b/algo/ca/core/pars/CaParameters.cxx @@ -9,10 +9,10 @@ #include "CaParameters.h" -#include <iomanip> - #include "AlgoFairloggerCompat.h" +#include <iomanip> + using cbm::algo::ca::EDetectorID; using cbm::algo::ca::Iteration; using cbm::algo::ca::MaterialMap; @@ -156,7 +156,9 @@ void Parameters::CheckConsistency() const std::string names = ""; for (const auto& iter : fCAIterations) { - if (!iter.Check()) { names += iter.GetName() + " "; } + if (!iter.Check()) { + names += iter.GetName() + " "; + } } if (names.size()) { std::stringstream msg; @@ -170,7 +172,9 @@ void Parameters::CheckConsistency() const std::stringstream msg; msg << "L1Parameters: found " << nIterations << " iterations with GetTrackFromTripletsFlag() == true:\n"; for (const auto& iter : fCAIterations) { - if (iter.GetTrackFromTripletsFlag()) { msg << '\t' << "- " << iter.GetName() << '\n'; } + if (iter.GetTrackFromTripletsFlag()) { + msg << '\t' << "- " << iter.GetName() << '\n'; + } } msg << "Only the one iteration can have GetTrackFromTripletsFlag() == true, and this iteration should be "; msg << "the last one"; @@ -199,7 +203,9 @@ int Parameters::GetNstationsActive(EDetectorID detectorID) const int nStations = 0; for (int iStLoc = 0; iStLoc < this->GetNstationsGeometry(detectorID); ++iStLoc) { int iStActive = this->GetStationIndexActive(iStLoc, detectorID); - if (iStActive > -1) { ++nStations; } + if (iStActive > -1) { + ++nStations; + } } return nStations; } @@ -215,8 +221,10 @@ std::string Parameters::ToString(int verbosity, int indentLevel) const using namespace constants; using std::setfill; using std::setw; - std::stringstream msg {}; - if (verbosity < 1) { return msg.str(); } + std::stringstream msg{}; + if (verbosity < 1) { + return msg.str(); + } constexpr char indentCh = '\t'; std::string indent(indentLevel, indentCh); diff --git a/algo/ca/core/pars/CaParameters.h b/algo/ca/core/pars/CaParameters.h index 01dfb21c6b..93ee1b1b92 100644 --- a/algo/ca/core/pars/CaParameters.h +++ b/algo/ca/core/pars/CaParameters.h @@ -9,14 +9,6 @@ #pragma once // include this header only once per compilation unit -#include <boost/serialization/array.hpp> -#include <boost/serialization/utility.hpp> - -#include <array> -#include <numeric> -#include <type_traits> -#include <utility> - #include "CaConstants.h" #include "CaField.h" #include "CaIteration.h" @@ -25,6 +17,14 @@ #include "CaStation.h" #include "CaVector.h" +#include <boost/serialization/array.hpp> +#include <boost/serialization/utility.hpp> + +#include <array> +#include <numeric> +#include <type_traits> +#include <utility> + namespace cbm::algo::ca { class InitManager; @@ -51,7 +51,7 @@ namespace cbm::algo::ca template<typename T> using StationArray_t = std::array<T, constants::size::MaxNstations>; - public: + public: /// \brief Default constructor Parameters(); @@ -219,45 +219,45 @@ namespace cbm::algo::ca /// \brief Flag to match hits in overlaps using Mc information bool DevIsSuppressOverlapHitsViaMc() const { return fDevIsSuppressOverlapHitsViaMc; } - private: - unsigned int fMaxDoubletsPerSinglet {150}; ///< Upper-bound cut on max number of doublets per one singlet - unsigned int fMaxTripletPerDoublets {15}; ///< Upper-bound cut on max number of triplets per one doublet + private: + unsigned int fMaxDoubletsPerSinglet{150}; ///< Upper-bound cut on max number of doublets per one singlet + unsigned int fMaxTripletPerDoublets{15}; ///< Upper-bound cut on max number of triplets per one doublet - alignas(constants::misc::Alignment) IterationsContainer_t fCAIterations {}; ///< L1 tracking iterations vector + alignas(constants::misc::Alignment) IterationsContainer_t fCAIterations{}; ///< L1 tracking iterations vector /************************* ** Geometry parameters ** *************************/ /// \brief Target position - alignas(constants::misc::Alignment) std::array<fvec, 3> fTargetPos {Undef<float>, Undef<float>, Undef<float>}; + alignas(constants::misc::Alignment) std::array<fvec, 3> fTargetPos{Undef<float>, Undef<float>, Undef<float>}; /// Field value object at primary vertex (between target and the first station) - alignas(constants::misc::Alignment) ca::FieldValue fVertexFieldValue {}; + alignas(constants::misc::Alignment) ca::FieldValue fVertexFieldValue{}; /// Field region object at primary vertex (between target and the first station) - alignas(constants::misc::Alignment) ca::FieldRegion fVertexFieldRegion {}; + alignas(constants::misc::Alignment) ca::FieldRegion fVertexFieldRegion{}; /// Array of stations - alignas(constants::misc::Alignment) StationsContainer_t fStations {}; + alignas(constants::misc::Alignment) StationsContainer_t fStations{}; /// Array of station thickness map - alignas(constants::misc::Alignment) MaterialContainer_t fThickMap {}; + alignas(constants::misc::Alignment) MaterialContainer_t fThickMap{}; // ** Station layout arrays ** /// \brief First index of the station on the particular detector /// /// The last element of the array corresponds to the total number of geometry stations - alignas(constants::misc::Alignment) std::array<int, constants::size::MaxNdetectors + 1> fvFirstGeoId {}; + alignas(constants::misc::Alignment) std::array<int, constants::size::MaxNdetectors + 1> fvFirstGeoId{}; /// \brief Map of (local, det) to geo indices /// /// Usage: /// iStGeo = fvLocaToGeoIdMap[fvFirstGeoId[iDet] + iStLocal]; /// geo index. - alignas(constants::misc::Alignment) StationArray_t<int> fvLocalToGeoIdMap {}; + alignas(constants::misc::Alignment) StationArray_t<int> fvLocalToGeoIdMap{}; /// \brief Map of geo to (local, det) indices - alignas(constants::misc::Alignment) StationArray_t<std::pair<EDetectorID, int>> fvGeoToLocalIdMap {}; + alignas(constants::misc::Alignment) StationArray_t<std::pair<EDetectorID, int>> fvGeoToLocalIdMap{}; /// \brief Map of geo to active indices /// @@ -266,10 +266,10 @@ namespace cbm::algo::ca /// \example Let stations 1 and 4 be inactive. Then: /// geometry index: 0 1 2 3 4 5 6 7 8 9 0 0 0 0 /// active index: 0 -1 1 2 -1 3 4 5 6 7 0 0 0 0 - alignas(constants::misc::Alignment) StationArray_t<int> fvGeoToActiveMap {}; + alignas(constants::misc::Alignment) StationArray_t<int> fvGeoToActiveMap{}; /// \brief Map of active to geo indices - alignas(constants::misc::Alignment) StationArray_t<int> fvActiveToGeoMap {}; + alignas(constants::misc::Alignment) StationArray_t<int> fvActiveToGeoMap{}; alignas(constants::misc::Alignment) int fNstationsActiveTotal = -1; ///< total number of active tracking stations @@ -290,12 +290,12 @@ namespace cbm::algo::ca // ** Flags for development ** // *************************** - bool fDevIsIgnoreHitSearchAreas {false}; ///< Process all hits on the station ignoring hit search area - bool fDevIsUseOfOriginalField {false}; ///< Force use of original field - bool fDevIsMatchDoubletsViaMc {false}; ///< Flag to match doublets using MC information - bool fDevIsMatchTripletsViaMc {false}; ///< Flag to match triplets using Mc information - bool fDevIsExtendTracksViaMc {false}; ///< Flag to extend tracks using Mc information - bool fDevIsSuppressOverlapHitsViaMc {false}; ///< Flag to match hits in overlaps using Mc information + bool fDevIsIgnoreHitSearchAreas{false}; ///< Process all hits on the station ignoring hit search area + bool fDevIsUseOfOriginalField{false}; ///< Force use of original field + bool fDevIsMatchDoubletsViaMc{false}; ///< Flag to match doublets using MC information + bool fDevIsMatchTripletsViaMc{false}; ///< Flag to match triplets using Mc information + bool fDevIsExtendTracksViaMc{false}; ///< Flag to extend tracks using Mc information + bool fDevIsSuppressOverlapHitsViaMc{false}; ///< Flag to match hits in overlaps using Mc information bool fDevIsParSearchWUsed = false; ///< Flag: when true, the parametrized search windows are used in track ///< finder; when false, the Kalman filter is used instead @@ -339,4 +339,3 @@ namespace cbm::algo::ca } }; } // namespace cbm::algo::ca - diff --git a/algo/ca/core/pars/CaSearchWindow.h b/algo/ca/core/pars/CaSearchWindow.h index ea7e73c18a..2121f9618a 100644 --- a/algo/ca/core/pars/CaSearchWindow.h +++ b/algo/ca/core/pars/CaSearchWindow.h @@ -24,7 +24,7 @@ namespace cbm::algo::ca /// \brief Class L1SearchWindow defines a parameterisation of hits search window for CA tracking algorithm /// TODO: SZh 8.11.2022: add description class SearchWindow { - public: + public: /// \brief Constructor /// \param stationID Global index of active station /// \param trackGrID Track group ID @@ -129,7 +129,7 @@ namespace cbm::algo::ca /// \brief String representation of the contents std::string ToString() const; - private: + private: static constexpr unsigned char kNpars = 1; ///< Max number of parameters for one dependency static constexpr unsigned char kNdeps = 8; ///< Number of the dependencies diff --git a/algo/ca/core/pars/CaStation.cxx b/algo/ca/core/pars/CaStation.cxx index 8399fe9698..241b4b28e9 100644 --- a/algo/ca/core/pars/CaStation.cxx +++ b/algo/ca/core/pars/CaStation.cxx @@ -4,12 +4,12 @@ #include "CaStation.h" -#include <iomanip> -#include <sstream> - #include "AlgoFairloggerCompat.h" #include "CaUtils.h" +#include <iomanip> +#include <sstream> + using namespace cbm::algo::ca; //------------------------------------------------------------------------------------------------------------------------------------ @@ -67,11 +67,13 @@ void Station::CheckConsistency() const // std::string Station::ToString(int verbosityLevel, int indentLevel, bool isHeader) const { - std::stringstream msg {}; + std::stringstream msg{}; constexpr char indentChar = '\t'; constexpr char columnSize = 15; std::string indent(indentLevel, indentChar); - if (verbosityLevel == 0) { msg << "station type = " << type << ", z = " << fZ[0] << " cm"; } + if (verbosityLevel == 0) { + msg << "station type = " << type << ", z = " << fZ[0] << " cm"; + } else { if (isHeader) { verbosityLevel = 0; diff --git a/algo/ca/core/pars/CaStation.h b/algo/ca/core/pars/CaStation.h index 3fb76957e9..43b9274ae4 100644 --- a/algo/ca/core/pars/CaStation.h +++ b/algo/ca/core/pars/CaStation.h @@ -4,19 +4,19 @@ #pragma once // include this header only once per compilation unit -#include <string> - #include "CaConstants.h" #include "CaField.h" #include "CaSimd.h" +#include <string> + namespace cbm::algo::ca { /// Structure Station /// Contains a set of geometry parameters for a particular station /// class Station { - public: + public: // TODO: SZh 12.05.2022: Rewrite type into L1DetectorID, change detector indexing scheme // TODO: SZh 12.05.2022: Provide getters to stations @@ -28,7 +28,7 @@ namespace cbm::algo::ca fvec Xmax = constants::Undef<fvec>; ///< min radius of the station [cm] fvec Ymax = constants::Undef<fvec>; ///< max radius of the station [cm] - FieldSlice fieldSlice {}; ///< Magnetic field near the station + FieldSlice fieldSlice{}; ///< Magnetic field near the station // Serialization block friend class boost::serialization::access; diff --git a/algo/ca/core/pars/CaStationInitializer.cxx b/algo/ca/core/pars/CaStationInitializer.cxx index 1483c22f38..8b5f9e0b5b 100644 --- a/algo/ca/core/pars/CaStationInitializer.cxx +++ b/algo/ca/core/pars/CaStationInitializer.cxx @@ -10,13 +10,13 @@ #include "CaStationInitializer.h" +#include "AlgoFairloggerCompat.h" +#include "CaConstants.h" + #include <iomanip> #include <sstream> #include <utility> -#include "AlgoFairloggerCompat.h" -#include "CaConstants.h" - using cbm::algo::ca::EDetectorID; using cbm::algo::ca::MaterialMap; using cbm::algo::ca::Station; @@ -120,7 +120,9 @@ void StationInitializer::SetFieldFunction( for (double x = -fXmax; x <= fXmax; x += dx) { for (double y = -fYmax; y <= fYmax; y += dy) { double r = sqrt(fabs(x * x / fXmax / fXmax + y / fYmax * y / fYmax)); - if (r > 1.) { continue; } + if (r > 1.) { + continue; + } double p[D] = {x, y, fZref}; double B[D] = {}; getFieldValue(p, B); @@ -342,7 +344,7 @@ MaterialMap&& StationInitializer::TakeMaterialMap() // std::string StationInitializer::ToString(int verbosityLevel, int indentLevel) const { - std::stringstream aStream {}; + std::stringstream aStream{}; constexpr char indentChar = '\t'; std::string indent(indentLevel, indentChar); diff --git a/algo/ca/core/pars/CaStationInitializer.h b/algo/ca/core/pars/CaStationInitializer.h index 0dc5a80f69..d532be1ea3 100644 --- a/algo/ca/core/pars/CaStationInitializer.h +++ b/algo/ca/core/pars/CaStationInitializer.h @@ -9,15 +9,15 @@ #pragma once // include this header only once per compilation unit -#include <bitset> -#include <functional> -#include <string> - #include "CaMaterialMap.h" #include "CaObjectInitController.h" #include "CaSimd.h" #include "CaStation.h" +#include <bitset> +#include <functional> +#include <string> + namespace cbm::algo::ca { enum class EDetectorID; @@ -32,7 +32,7 @@ namespace cbm::algo::ca }; using ManagementFlags_t = std::bitset<static_cast<int>(EManagementFlag::kEnd)>; - public: + public: /// \enum EInitKey /// \brief Enumeration of fields, which must be initialized so the object can pass the threshold enum class EInitKey @@ -197,19 +197,19 @@ namespace cbm::algo::ca /// \param indentLevel Number of indent characters in the output std::string ToString(int verbosityLevel = 0, int indentLevel = 0) const; - private: - EDetectorID fDetectorID {static_cast<EDetectorID>(0)}; ///< Detector ID - int fStationID {-1}; ///< Local ID of a station - bool fTrackingStatus {false}; ///< Tracking status: true - station is used for tracking - double fXmax {0}; ///< Maximum distance between station center and its edge in x direction - double fYmax {0}; ///< Maximum distance between station center and its edge in y direction - double fZref {0}; ///< reference z - double fZmin {0}; ///< min z - double fZmax {0}; ///< max z - Station fStation {}; ///< ca::Station structure, describes a station in L1Algo - MaterialMap fThicknessMap {}; ///< Map of station thickness in units of radiation length - InitController_t fInitController {}; ///< Class fileds initialization flags - ManagementFlags_t fManagementFlags {}; ///< bitset flags to manage internal behaviour of the class + private: + EDetectorID fDetectorID{static_cast<EDetectorID>(0)}; ///< Detector ID + int fStationID{-1}; ///< Local ID of a station + bool fTrackingStatus{false}; ///< Tracking status: true - station is used for tracking + double fXmax{0}; ///< Maximum distance between station center and its edge in x direction + double fYmax{0}; ///< Maximum distance between station center and its edge in y direction + double fZref{0}; ///< reference z + double fZmin{0}; ///< min z + double fZmax{0}; ///< max z + Station fStation{}; ///< ca::Station structure, describes a station in L1Algo + MaterialMap fThicknessMap{}; ///< Map of station thickness in units of radiation length + InitController_t fInitController{}; ///< Class fileds initialization flags + ManagementFlags_t fManagementFlags{}; ///< bitset flags to manage internal behaviour of the class }; /// swap function for two StationInitializer objects, expected to be used instead of std::swap diff --git a/algo/ca/core/tracking/CaCloneMerger.cxx b/algo/ca/core/tracking/CaCloneMerger.cxx index ebcaad09f1..274f6123fb 100644 --- a/algo/ca/core/tracking/CaCloneMerger.cxx +++ b/algo/ca/core/tracking/CaCloneMerger.cxx @@ -9,14 +9,14 @@ #include "CaCloneMerger.h" -#include <iostream> - #include "CaFramework.h" #include "CaParameters.h" #include "CaTrack.h" #include "CaTrackFit.h" #include "CaVector.h" +#include <iostream> + using namespace cbm::algo::ca; using namespace cbm::algo; @@ -124,7 +124,8 @@ void CloneMerger::Exec(Vector<Track>& extTracks, Vector<ca::HitIndex_t>& extReco unsigned short dist = firstStation[iTr] - lastStation[jTr]; - if (dist > 1) stam = staf + 1; + if (dist > 1) + stam = staf + 1; else stam = staf - 1; diff --git a/algo/ca/core/tracking/CaCloneMerger.h b/algo/ca/core/tracking/CaCloneMerger.h index 8acc9fb88d..38e4d89def 100644 --- a/algo/ca/core/tracking/CaCloneMerger.h +++ b/algo/ca/core/tracking/CaCloneMerger.h @@ -28,7 +28,7 @@ namespace cbm::algo::ca /// Class implements a clones merger algorithm for the CA track finder /// class CloneMerger { - public: + public: /// Default constructor CloneMerger(const ca::Framework& algo); @@ -54,7 +54,7 @@ namespace cbm::algo::ca /// \param extRecoHits Reference to the external container of reconstructed hit indexes void Exec(Vector<Track>& extTracks, Vector<ca::HitIndex_t>&); - private: + private: // *************** // ** Functions ** // *************** @@ -94,32 +94,32 @@ namespace cbm::algo::ca // *************** /// First station of a track - Vector<unsigned short> fTrackFirstStation {"CloneMerger::fTrackFirstStation"}; + Vector<unsigned short> fTrackFirstStation{"CloneMerger::fTrackFirstStation"}; /// Last station of a track - Vector<unsigned short> fTrackLastStation {"CloneMerger::fTrackLastStation"}; + Vector<unsigned short> fTrackLastStation{"CloneMerger::fTrackLastStation"}; /// Index of the first hit of a track - Vector<ca::HitIndex_t> fTrackFirstHit {"CloneMerger::fTrackFirstHit"}; + Vector<ca::HitIndex_t> fTrackFirstHit{"CloneMerger::fTrackFirstHit"}; /// Index of the last hit of a track - Vector<ca::HitIndex_t> fTrackLastHit {"CloneMerger::fTrackLastHit"}; + Vector<ca::HitIndex_t> fTrackLastHit{"CloneMerger::fTrackLastHit"}; /// Index (TODO:??) of a track that can be merge with the given track - Vector<unsigned short> fTrackNeighbour {"CloneMerger::fTrackNeighbour"}; + Vector<unsigned short> fTrackNeighbour{"CloneMerger::fTrackNeighbour"}; /// Chi2 value of the track merging procedure - Vector<float> fTrackChi2 {"CloneMerger::fTrackChi2"}; + Vector<float> fTrackChi2{"CloneMerger::fTrackChi2"}; /// Flag: is the given track already stored to the output - Vector<char> fTrackIsStored {"CloneMerger::fTrackIsStored"}; + Vector<char> fTrackIsStored{"CloneMerger::fTrackIsStored"}; /// Flag: is the track a downstream neighbour of another track - Vector<char> fTrackIsDownstreamNeighbour {"CloneMerger::fTrackIsDownstreamNeighbour"}; + Vector<char> fTrackIsDownstreamNeighbour{"CloneMerger::fTrackIsDownstreamNeighbour"}; - Vector<Track> fTracksNew {"CaCloneMerger::fTracksNew"}; ///< vector of tracks after the merge + Vector<Track> fTracksNew{"CaCloneMerger::fTracksNew"}; ///< vector of tracks after the merge - Vector<ca::HitIndex_t> fRecoHitsNew {"CaCloneMerger::fRecoHitsNew"}; ///< vector of track hits after the merge + Vector<ca::HitIndex_t> fRecoHitsNew{"CaCloneMerger::fRecoHitsNew"}; ///< vector of track hits after the merge const ca::Framework& frAlgo; ///< Reference to the main track finder algorithm class }; diff --git a/algo/ca/core/tracking/CaFramework.cxx b/algo/ca/core/tracking/CaFramework.cxx index 1d335a7987..360920be92 100644 --- a/algo/ca/core/tracking/CaFramework.cxx +++ b/algo/ca/core/tracking/CaFramework.cxx @@ -26,10 +26,7 @@ using cbm::algo::ca::EDetectorID; using cbm::algo::ca::ETimer; // monitor timer key type //using cbm::ca::tools::Debugger; -void Framework::Init(const TrackingMode mode) -{ - fTrackingMode = mode; -} +void Framework::Init(const TrackingMode mode) { fTrackingMode = mode; } void Framework::Finish() { diff --git a/algo/ca/core/tracking/CaFramework.h b/algo/ca/core/tracking/CaFramework.h index c16b048fd3..44c0681332 100644 --- a/algo/ca/core/tracking/CaFramework.h +++ b/algo/ca/core/tracking/CaFramework.h @@ -4,12 +4,6 @@ #pragma once // include this header only once per compilation unit -#include <array> -#include <iomanip> -#include <iostream> -#include <limits> -#include <map> - #include "CaBranch.h" #include "CaCloneMerger.h" #include "CaConstants.h" @@ -32,6 +26,12 @@ #include "CaTriplet.h" #include "CaVector.h" +#include <array> +#include <iomanip> +#include <iostream> +#include <limits> +#include <map> + namespace cbm::algo::ca { class TripletConstructor; @@ -58,16 +58,16 @@ namespace cbm::algo::ca using Tindex = int; // TODO: Replace with ca::HitIndex_t, if suitable struct CaHitTimeInfo { - fscal fEventTimeMin {-std::numeric_limits<fscal>::max() / 2.}; - fscal fEventTimeMax {std::numeric_limits<fscal>::max() / 2.}; - fscal fMaxTimeBeforeHit {0.}; //< max event time for hits [0 .. hit] in the station hit array - fscal fMinTimeAfterHit {0.}; //< min event time for hits [hit ... ] in the station hit array + fscal fEventTimeMin{-std::numeric_limits<fscal>::max() / 2.}; + fscal fEventTimeMax{std::numeric_limits<fscal>::max() / 2.}; + fscal fMaxTimeBeforeHit{0.}; //< max event time for hits [0 .. hit] in the station hit array + fscal fMinTimeAfterHit{0.}; //< min event time for hits [hit ... ] in the station hit array }; /// Main class of CA track finder algorithm /// class Framework { - public: + public: // ************************* // ** Friend classes list ** // ************************* @@ -185,7 +185,7 @@ namespace cbm::algo::ca /// \brief Sets monitor data void SetMonitorData(const TrackingMonitorData& monitorData) { fMonitorData = monitorData; } - public: + public: /// Gets number of stations before the pipe (MVD stations in CBM) int GetNstationsBeforePipe() const { return fNstationsBeforePipe; } @@ -200,10 +200,10 @@ namespace cbm::algo::ca // const CbmL1MCTrack* GetMcTrackForWindowHit(int iHit) const; - private: - int fNstationsBeforePipe {0}; ///< number of stations before pipe (MVD stations in CBM) - int fNfieldStations {0}; ///< number of stations in the field region - float fDefaultMass {constants::phys::MuonMass}; ///< mass of the propagated particle [GeV/c2] + private: + int fNstationsBeforePipe{0}; ///< number of stations before pipe (MVD stations in CBM) + int fNfieldStations{0}; ///< number of stations in the field region + float fDefaultMass{constants::phys::MuonMass}; ///< mass of the propagated particle [GeV/c2] // *************************** @@ -213,12 +213,12 @@ namespace cbm::algo::ca Parameters fParameters; ///< Object of Framework parameters class InputData fInputData; ///< Tracking input data - Vector<unsigned char> fvHitKeyFlags { + Vector<unsigned char> fvHitKeyFlags{ "Framework::fvHitKeyFlags"}; ///< List of key flags: has been this hit or cluster already used - TrackingMonitorData fMonitorData {}; ///< Tracking monitor data (statistics per call) + TrackingMonitorData fMonitorData{}; ///< Tracking monitor data (statistics per call) - public: + public: Vector<CaHitTimeInfo> fHitTimeInfo; ca::Grid vGrid[constants::size::MaxNstations]; ///< @@ -229,99 +229,99 @@ namespace cbm::algo::ca ///\brief hits of the current time window /// it is a portion of fInputData to process in the current time window /// hit.Id is replaced by the hit index in fInputData - Vector<ca::Hit> fWindowHits {"Framework::fWindowHits"}; + Vector<ca::Hit> fWindowHits{"Framework::fWindowHits"}; - Vector<unsigned char> fIsWindowHitSuppressed {"Framework::fIsWindowHitSuppressed"}; + Vector<unsigned char> fIsWindowHitSuppressed{"Framework::fIsWindowHitSuppressed"}; ///\brief first index of the station hits in the time window - ca::HitIndex_t fStationHitsStartIndex[constants::size::MaxNstations + 1] {0}; + ca::HitIndex_t fStationHitsStartIndex[constants::size::MaxNstations + 1]{0}; ///\brief number of station hits in the time window - ca::HitIndex_t fStationNhits[constants::size::MaxNstations + 1] {0}; + ca::HitIndex_t fStationNhits[constants::size::MaxNstations + 1]{0}; /// ---------- - double fCaRecoTime {0.}; // time of the track finder + fitter + double fCaRecoTime{0.}; // time of the track finder + fitter - Vector<Track> fRecoTracks {"Framework::fRecoTracks"}; ///< reconstructed tracks - Vector<ca::HitIndex_t> fRecoHits {"Framework::fRecoHits"}; ///< packed hits of reconstructed tracks + Vector<Track> fRecoTracks{"Framework::fRecoTracks"}; ///< reconstructed tracks + Vector<ca::HitIndex_t> fRecoHits{"Framework::fRecoHits"}; ///< packed hits of reconstructed tracks - Vector<Track> fSliceRecoTracks {"Framework::fSliceRecoTracks"}; ///< reconstructed tracks in sub-timeslice - Vector<ca::HitIndex_t> fSliceRecoHits {"Framework::fSliceRecoHits"}; ///< packed hits of reconstructed tracks + Vector<Track> fSliceRecoTracks{"Framework::fSliceRecoTracks"}; ///< reconstructed tracks in sub-timeslice + Vector<ca::HitIndex_t> fSliceRecoHits{"Framework::fSliceRecoHits"}; ///< packed hits of reconstructed tracks /// Created triplets vs station index - Vector<ca::Triplet> fTriplets[constants::size::MaxNstations] {{"Framework::fTriplets"}}; + Vector<ca::Triplet> fTriplets[constants::size::MaxNstations]{{"Framework::fTriplets"}}; /// Track candidates created out of adjacent triplets before the final track selection. /// The candidates may share any amount of hits. - Vector<ca::Branch> fTrackCandidates {"Framework::fTrackCandidates"}; + Vector<ca::Branch> fTrackCandidates{"Framework::fTrackCandidates"}; ///< indices of the sub-slice hits - Vector<ca::HitIndex_t> fSliceHitIds[constants::size::MaxNstations] {"Framework::fSliceHitIds"}; + Vector<ca::HitIndex_t> fSliceHitIds[constants::size::MaxNstations]{"Framework::fSliceHitIds"}; - Vector<int> fStripToTrack {"Framework::fStripToTrack"}; // strip to track pointers + Vector<int> fStripToTrack{"Framework::fStripToTrack"}; // strip to track pointers - TrackingMode fTrackingMode {kSts}; + TrackingMode fTrackingMode{kSts}; - fvec EventTime {0.f}; - fvec Err {0.f}; + fvec EventTime{0.f}; + fvec Err{0.f}; /// --- data used during finding iterations - unsigned int fCurrentIterationIndex {0}; ///< index of the corrent iteration, needed for debug output + unsigned int fCurrentIterationIndex{0}; ///< index of the corrent iteration, needed for debug output const Iteration* fpCurrentIteration = nullptr; ///< pointer to the current CA track finder iteration - Vector<int> fHitFirstTriplet {"Framework::fHitFirstTriplet"}; /// link hit -> first triplet { hit, *, *} - Vector<int> fHitNtriplets {"Framework::fHitNtriplets"}; /// link hit ->n triplets { hit, *, *} + Vector<int> fHitFirstTriplet{"Framework::fHitFirstTriplet"}; /// link hit -> first triplet { hit, *, *} + Vector<int> fHitNtriplets{"Framework::fHitNtriplets"}; /// link hit ->n triplets { hit, *, *} - public: - ca::TrackExtender fTrackExtender {*this}; ///< Object of the track extender algorithm - ca::CloneMerger fCloneMerger {*this}; ///< Object of the clone merger algorithm - ca::TrackFitter fTrackFitter {*this}; ///< Object of the track extender algorithm - ca::TrackFinderWindow fTrackFinderWindow {*this}; ///< Object of the track finder algorithm for the time window - ca::TrackFinder fTrackFinder {*this}; ///< Object of the track finder algorithm for the entire time slice + public: + ca::TrackExtender fTrackExtender{*this}; ///< Object of the track extender algorithm + ca::CloneMerger fCloneMerger{*this}; ///< Object of the clone merger algorithm + ca::TrackFitter fTrackFitter{*this}; ///< Object of the track extender algorithm + ca::TrackFinderWindow fTrackFinderWindow{*this}; ///< Object of the track finder algorithm for the time window + ca::TrackFinder fTrackFinder{*this}; ///< Object of the track finder algorithm for the entire time slice - private: + private: /// ================================= DATA PART ================================= /// ----- Different parameters of CATrackFinder ----- - Tindex fFirstCAstation {0}; //first station used in CA + Tindex fFirstCAstation{0}; //first station used in CA // fNFindIterations - set number of interation for trackfinding // itetation of finding: int fNFindIterations = -1; // TODO investigate kAllPrimJumpIter & kAllSecJumpIter - float fTrackChi2Cut {10.f}; - float fTripletFinalChi2Cut {10.f}; - float fTripletChi2Cut {5.f}; // cut for selecting triplets before collecting tracks.per one DoF - float fDoubletChi2Cut {5.f}; - float fTimeCut1 {0.f}; // TODO: please, specify "1" and "2" (S.Zharko) - float fTimeCut2 {0.f}; + float fTrackChi2Cut{10.f}; + float fTripletFinalChi2Cut{10.f}; + float fTripletChi2Cut{5.f}; // cut for selecting triplets before collecting tracks.per one DoF + float fDoubletChi2Cut{5.f}; + float fTimeCut1{0.f}; // TODO: please, specify "1" and "2" (S.Zharko) + float fTimeCut2{0.f}; /// correction in order to take into account overlaping and iff z. if sort by y then it is max diff between same station's modules (~0.4cm) - fvec fMaxDZ {constants::Undef<fvec>}; + fvec fMaxDZ{constants::Undef<fvec>}; /// parameters which are different for different iterations. Set in the begin of CA Track Finder - float fPickGather {constants::Undef<fvec>}; ///< same for attaching additional hits to track - float fTripletLinkChi2 { - constants::Undef<fvec>}; ///< (dp2/dp_error2 < fTripletLinkChi2) => triplets are neighbours - fvec fMaxInvMom {constants::Undef<fvec>}; ///< max considered q/p for tracks - fvec fMaxSlopePV {constants::Undef<fvec>}; ///< max slope (tx\ty) in prim vertex - float fMaxSlope {constants::Undef<fvec>}; ///< max slope (tx\ty) in 3d hit position of a triplet + float fPickGather{constants::Undef<fvec>}; ///< same for attaching additional hits to track + float fTripletLinkChi2{ + constants::Undef<fvec>}; ///< (dp2/dp_error2 < fTripletLinkChi2) => triplets are neighbours + fvec fMaxInvMom{constants::Undef<fvec>}; ///< max considered q/p for tracks + fvec fMaxSlopePV{constants::Undef<fvec>}; ///< max slope (tx\ty) in prim vertex + float fMaxSlope{constants::Undef<fvec>}; ///< max slope (tx\ty) in 3d hit position of a triplet - fvec fTargX {constants::Undef<fvec>}; ///< target position x coordinate for the current iteration (modifiable) - fvec fTargY {constants::Undef<fvec>}; ///< target position y coordinate for the current iteration (modifiable) - fvec fTargZ {constants::Undef<fvec>}; ///< target position z coordinate for the current iteration (modifiable) + fvec fTargX{constants::Undef<fvec>}; ///< target position x coordinate for the current iteration (modifiable) + fvec fTargY{constants::Undef<fvec>}; ///< target position y coordinate for the current iteration (modifiable) + fvec fTargZ{constants::Undef<fvec>}; ///< target position z coordinate for the current iteration (modifiable) - bool fIsTargetField {false}; ///< is the magnetic field present at the target + bool fIsTargetField{false}; ///< is the magnetic field present at the target - ca::FieldValue fTargB _fvecalignment {}; // field in the target point (modifiable, do not touch!!) - ca::MeasurementXy<fvec> TargetMeasurement _fvecalignment {}; // target constraint [cm] + ca::FieldValue fTargB _fvecalignment{}; // field in the target point (modifiable, do not touch!!) + ca::MeasurementXy<fvec> TargetMeasurement _fvecalignment{}; // target constraint [cm] - int fGhostSuppression {1}; // NOTE: Should be equal to 0 in TRACKS_FROM_TRIPLETS mode! + int fGhostSuppression{1}; // NOTE: Should be equal to 0 in TRACKS_FROM_TRIPLETS mode! } _fvecalignment; diff --git a/algo/ca/core/tracking/CaTrackExtender.cxx b/algo/ca/core/tracking/CaTrackExtender.cxx index 0bfbb98c4f..3858466c0c 100644 --- a/algo/ca/core/tracking/CaTrackExtender.cxx +++ b/algo/ca/core/tracking/CaTrackExtender.cxx @@ -4,8 +4,6 @@ #include "CaTrackExtender.h" -#include <iostream> - #include "CaBranch.h" #include "CaDefines.h" #include "CaFramework.h" @@ -15,6 +13,8 @@ #include "CaTrackParam.h" #include "CaVector.h" +#include <iostream> + // using namespace std; using cbm::algo::ca::Vector; // TMP!! using std::cout; @@ -147,7 +147,7 @@ void TrackExtender::FitBranch(const ca::Branch& t, TrackParamV& T, const bool up void TrackExtender::FindMoreHits(ca::Branch& t, TrackParamV& Tout, const bool upstream, const fvec qp0) { - Vector<ca::HitIndex_t> newHits {"ca::TrackExtender::newHits"}; + Vector<ca::HitIndex_t> newHits{"ca::TrackExtender::newHits"}; newHits.reserve(frAlgo.GetParameters().GetNstationsActive()); ca::TrackFit fit; @@ -214,13 +214,17 @@ void TrackExtender::FindMoreHits(ca::Branch& t, TrackParamV& Tout, const bool up (sqrt(frAlgo.fPickGather * tr.C00()) + frAlgo.vGrid[ista].GetMaxRangeX() + frAlgo.fMaxDZ * abs(tr.Tx()))[0], (sqrt(frAlgo.fPickGather * tr.C11()) + frAlgo.vGrid[ista].GetMaxRangeY() + frAlgo.fMaxDZ * abs(tr.Ty()))[0]); - if (frAlgo.GetParameters().DevIsIgnoreHitSearchAreas()) { area.DoLoopOverEntireGrid(); } + if (frAlgo.GetParameters().DevIsIgnoreHitSearchAreas()) { + area.DoLoopOverEntireGrid(); + } ca::HitIndex_t ih = 0; while (area.GetNextObjectId(ih)) { // loop over the hits in the area - if (frAlgo.fIsWindowHitSuppressed[ih]) { continue; } + if (frAlgo.fIsWindowHitSuppressed[ih]) { + continue; + } const ca::Hit& hit = frAlgo.fWindowHits[ih]; if (sta.timeInfo && tr.NdfTime()[0] > -2.) { @@ -230,7 +234,9 @@ void TrackExtender::FindMoreHits(ca::Branch& t, TrackParamV& Tout, const bool up //if (GetFUsed((*fStripFlag)[hit.f] | (*fStripFlag)[hit.b])) continue; // if used - if (frAlgo.fvHitKeyFlags[hit.FrontKey()] || frAlgo.fvHitKeyFlags[hit.BackKey()]) { continue; } + if (frAlgo.fvHitKeyFlags[hit.FrontKey()] || frAlgo.fvHitKeyFlags[hit.BackKey()]) { + continue; + } auto [y, C11] = fit.ExtrapolateLineYdY2(hit.Z()); diff --git a/algo/ca/core/tracking/CaTrackExtender.h b/algo/ca/core/tracking/CaTrackExtender.h index 3e9ee941d6..fe14ed39c6 100644 --- a/algo/ca/core/tracking/CaTrackExtender.h +++ b/algo/ca/core/tracking/CaTrackExtender.h @@ -30,7 +30,7 @@ namespace cbm::algo::ca /// Class implements a clones merger algorithm for the CA track finder /// class TrackExtender { - public: + public: /// Default constructor TrackExtender(const ca::Framework& algo); @@ -54,7 +54,7 @@ namespace cbm::algo::ca /// \return chi2 fscal ExtendBranch(ca::Branch& t); - private: + private: ///------------------------------- /// Private methods @@ -83,7 +83,7 @@ namespace cbm::algo::ca void FitBranchFast(const ca::Branch& t, TrackParamV& T, const bool dir, const fvec qp0, const bool initParams = true); - private: + private: ///------------------------------- /// Data members diff --git a/algo/ca/core/tracking/CaTrackFinder.cxx b/algo/ca/core/tracking/CaTrackFinder.cxx index d8d095cd30..6cc55dd4c3 100644 --- a/algo/ca/core/tracking/CaTrackFinder.cxx +++ b/algo/ca/core/tracking/CaTrackFinder.cxx @@ -18,11 +18,11 @@ * */ -#include <chrono> - #include "CaFramework.h" #include "CaTrack.h" +#include <chrono> + using namespace cbm::algo::ca; using cbm::algo::ca::ECounter; @@ -134,13 +134,17 @@ void TrackFinder::FindTracks() continue; } - if (maxTimeBeforeHit < info.fEventTimeMax) { maxTimeBeforeHit = info.fEventTimeMax; } + if (maxTimeBeforeHit < info.fEventTimeMax) { + maxTimeBeforeHit = info.fEventTimeMax; + } info.fMaxTimeBeforeHit = maxTimeBeforeHit; if (tsStart > info.fEventTimeMax - 5) { tsStart = info.fEventTimeMax - 5; // 5 ns margin } - if (statTsEnd < info.fEventTimeMin) { statTsEnd = info.fEventTimeMin; } + if (statTsEnd < info.fEventTimeMin) { + statTsEnd = info.fEventTimeMin; + } } fscal minTimeAfterHit = std::numeric_limits<fscal>::max(); @@ -149,9 +153,13 @@ void TrackFinder::FindTracks() for (int ih = nStreamHits - 1; ih >= 0; --ih) { ca::HitIndex_t caHitId = frAlgo.fInputData.GetStreamStartIndex(iStream) + ih; const ca::Hit& h = frAlgo.fInputData.GetHit(caHitId); - if (frAlgo.fvHitKeyFlags[h.FrontKey()] || frAlgo.fvHitKeyFlags[h.BackKey()]) { continue; } // the hit is skipped + if (frAlgo.fvHitKeyFlags[h.FrontKey()] || frAlgo.fvHitKeyFlags[h.BackKey()]) { + continue; + } // the hit is skipped CaHitTimeInfo& info = frAlgo.fHitTimeInfo[caHitId]; - if (minTimeAfterHit > info.fEventTimeMin) { minTimeAfterHit = info.fEventTimeMin; } + if (minTimeAfterHit > info.fEventTimeMin) { + minTimeAfterHit = info.fEventTimeMin; + } info.fMinTimeAfterHit = minTimeAfterHit; } @@ -264,7 +272,9 @@ void TrackFinder::FindTracks() // cut at 50 hits per station per 1 us. int maxStationHits = (int) (50 * tsLength / 1.e3); for (int ista = 0; ista < frAlgo.GetParameters().GetNstationsActive(); ista++) { - if ((int) frAlgo.fSliceHitIds[ista].size() > maxStationHits) { frAlgo.fSliceHitIds[ista].clear(); } + if ((int) frAlgo.fSliceHitIds[ista].size() > maxStationHits) { + frAlgo.fSliceHitIds[ista].clear(); + } } } diff --git a/algo/ca/core/tracking/CaTrackFinder.h b/algo/ca/core/tracking/CaTrackFinder.h index 535241c34b..71420a3713 100644 --- a/algo/ca/core/tracking/CaTrackFinder.h +++ b/algo/ca/core/tracking/CaTrackFinder.h @@ -28,7 +28,7 @@ namespace cbm::algo::ca /// Class implements a clones merger algorithm for the CA track finder /// class TrackFinder { - public: + public: /// Default constructor TrackFinder(ca::Framework& algo); @@ -49,14 +49,14 @@ namespace cbm::algo::ca void FindTracks(); - private: + private: // ------------------------------- // Private methods bool checkTripletMatch(const ca::Triplet& l, const ca::Triplet& r, fscal& dchi2) const; - private: + private: // ------------------------------- // Data members diff --git a/algo/ca/core/tracking/CaTrackFinderWindow.cxx b/algo/ca/core/tracking/CaTrackFinderWindow.cxx index 4b0c580ecc..b1f0c47b1f 100644 --- a/algo/ca/core/tracking/CaTrackFinderWindow.cxx +++ b/algo/ca/core/tracking/CaTrackFinderWindow.cxx @@ -21,13 +21,6 @@ #include "CaTrackFinderWindow.h" -#include <algorithm> -#include <cstdio> -#include <fstream> -#include <iostream> -#include <list> -#include <map> - #include "CaBranch.h" #include "CaFramework.h" #include "CaGrid.h" @@ -36,6 +29,13 @@ #include "CaTrackParam.h" #include "CaTripletConstructor.h" +#include <algorithm> +#include <cstdio> +#include <fstream> +#include <iostream> +#include <list> +#include <map> + // #include "CaToolsDebugger.h" @@ -185,15 +185,27 @@ void TrackFinderWindow::CaTrackFinderSlice() for (ca::HitIndex_t ih = 0; ih < frAlgo.fSliceHitIds[iS].size(); ++ih) { const ca::Hit& h = frAlgo.fInputData.GetHit(frAlgo.fSliceHitIds[iS][ih]); - if (h.X() < gridMinX) { gridMinX = h.X(); } - if (h.X() > gridMaxX) { gridMaxX = h.X(); } - if (h.Y() < gridMinY) { gridMinY = h.Y(); } - if (h.Y() > gridMaxY) { gridMaxY = h.Y(); } + if (h.X() < gridMinX) { + gridMinX = h.X(); + } + if (h.X() > gridMaxX) { + gridMaxX = h.X(); + } + if (h.Y() < gridMinY) { + gridMinY = h.Y(); + } + if (h.Y() > gridMaxY) { + gridMaxY = h.Y(); + } const fscal time = h.T(); assert(std::isfinite(time)); - if (timeUninitialised || lasttime < time) { lasttime = time; } - if (timeUninitialised || starttime > time) { starttime = time; } + if (timeUninitialised || lasttime < time) { + lasttime = time; + } + if (timeUninitialised || starttime > time) { + starttime = time; + } timeUninitialised = false; } @@ -273,7 +285,9 @@ void TrackFinderWindow::CaTrackFinderSlice() fscal SigmaTargetY = caIteration.GetTargetPosSigmaY(); // target constraint [cm] // Select magnetic field. For primary tracks - fVtxFieldValue, for secondary tracks - st.fieldSlice - if (caIteration.GetPrimaryFlag()) { frAlgo.fTargB = frAlgo.GetParameters().GetVertexFieldValue(); } + if (caIteration.GetPrimaryFlag()) { + frAlgo.fTargB = frAlgo.GetParameters().GetVertexFieldValue(); + } else { frAlgo.fTargB = frAlgo.GetParameters().GetStation(0).fieldSlice.GetFieldValue(0, 0); } // NOTE: calculates field frAlgo.fTargB in the center of 0th station @@ -353,7 +367,9 @@ void TrackFinderWindow::CaTrackFinderSlice() unsigned int neighStation = frAlgo.TripletId2Station(neighLocation); unsigned int neighTriplet = frAlgo.TripletId2Triplet(neighLocation); - if (nNeighbours > 0) { assert((int) neighStation == istal + 1 || (int) neighStation == istal + 2); } + if (nNeighbours > 0) { + assert((int) neighStation == istal + 1 || (int) neighStation == istal + 2); + } unsigned char level = 0; @@ -364,13 +380,17 @@ void TrackFinderWindow::CaTrackFinderSlice() fscal dchi2 = 0.; if (!checkTripletMatch(tr, neighbour, dchi2)) continue; - if (tr.GetFNeighbour() == 0) { tr.SetFNeighbour(neighLocation); } + if (tr.GetFNeighbour() == 0) { + tr.SetFNeighbour(neighLocation); + } tr.SetNNeighbours(neighLocation - tr.GetFNeighbour() + 1); const unsigned char neighbourLevel = neighbour.GetLevel(); - if (level <= neighbourLevel) { level = neighbourLevel + 1; } + if (level <= neighbourLevel) { + level = neighbourLevel + 1; + } } tr.SetLevel(level); } // neighbour search @@ -390,7 +410,9 @@ void TrackFinderWindow::CaTrackFinderSlice() // min level to start triplet. So min track length = min_level+3. int min_level = std::min(caIteration.GetMinNhits(), caIteration.GetMinNhitsStation0()) - 3; - if (frAlgo.fpCurrentIteration->GetTrackFromTripletsFlag()) { min_level = 0; } + if (frAlgo.fpCurrentIteration->GetTrackFromTripletsFlag()) { + min_level = 0; + } ca::Branch curr_tr; ca::Branch new_tr[constants::size::MaxNstations]; @@ -438,16 +460,22 @@ void TrackFinderWindow::CaTrackFinderSlice() if (!frAlgo.fpCurrentIteration->GetTrackFromTripletsFlag()) { // ghost suppression !!! int nHits = 3 + first_trip.GetLevel(); if (frAlgo.fWindowHits[first_trip.GetLHit()].Station() == 0) { - if (nHits < frAlgo.fpCurrentIteration->GetMinNhitsStation0()) { continue; } + if (nHits < frAlgo.fpCurrentIteration->GetMinNhitsStation0()) { + continue; + } } else { - if (nHits < frAlgo.fpCurrentIteration->GetMinNhits()) { continue; } + if (nHits < frAlgo.fpCurrentIteration->GetMinNhits()) { + continue; + } } } // Collect triplets, which can start a track with length equal to firstTipletLevel + 3. This cut suppresses // ghost tracks, but does not affect the efficiency - if (first_trip.GetLevel() < firstTripletLevel) { continue; } + if (first_trip.GetLevel() < firstTripletLevel) { + continue; + } curr_tr.SetChi2(0.); curr_tr.SetStation(0); @@ -511,7 +539,9 @@ void TrackFinderWindow::CaTrackFinderSlice() repeatCompetition = false; for (ca::Branch& tr : frAlgo.fTrackCandidates) { - if (tr.IsAlive()) { continue; } + if (tr.IsAlive()) { + continue; + } for (auto& hitId : tr.Hits()) { const ca::Hit& h = frAlgo.fInputData.GetHit(hitId); bool isAlive = true; @@ -519,7 +549,9 @@ void TrackFinderWindow::CaTrackFinderSlice() auto& stripF = (frAlgo.fStripToTrack)[h.FrontKey()]; if ((stripF >= 0) && (stripF != tr.Id())) { // strip is used by other candidate const auto& other = frAlgo.fTrackCandidates[stripF]; - if (!other.IsAlive() && tr.IsBetterThan(other)) { stripF = tr.Id(); } + if (!other.IsAlive() && tr.IsBetterThan(other)) { + stripF = tr.Id(); + } else { isAlive = false; } @@ -527,14 +559,18 @@ void TrackFinderWindow::CaTrackFinderSlice() else { stripF = tr.Id(); } - if (!isAlive) { break; } + if (!isAlive) { + break; + } } { // back strip auto& stripB = (frAlgo.fStripToTrack)[h.BackKey()]; if ((stripB >= 0) && (stripB != tr.Id())) { // strip is used by other candidate const auto& other = frAlgo.fTrackCandidates[stripB]; - if (!other.IsAlive() && tr.IsBetterThan(other)) { stripB = tr.Id(); } + if (!other.IsAlive() && tr.IsBetterThan(other)) { + stripB = tr.Id(); + } else { isAlive = false; } @@ -542,7 +578,9 @@ void TrackFinderWindow::CaTrackFinderSlice() else { stripB = tr.Id(); } - if (!isAlive) { break; } + if (!isAlive) { + break; + } } } // loop over hits } // itrack @@ -550,7 +588,9 @@ void TrackFinderWindow::CaTrackFinderSlice() // == Check if some suppressed candidates are still alive for (ca::Branch& tr : frAlgo.fTrackCandidates) { - if (tr.IsAlive()) { continue; } + if (tr.IsAlive()) { + continue; + } tr.SetAlive(true); for (int iHit = 0; tr.IsAlive() && (iHit < (int) tr.Hits().size()); ++iHit) { @@ -562,8 +602,12 @@ void TrackFinderWindow::CaTrackFinderSlice() if (!tr.IsAlive()) { // release strips for (auto hitId : tr.Hits()) { const ca::Hit& h = frAlgo.fInputData.GetHit(hitId); - if (frAlgo.fStripToTrack[h.FrontKey()] == tr.Id()) { frAlgo.fStripToTrack[h.FrontKey()] = -1; } - if (frAlgo.fStripToTrack[h.BackKey()] == tr.Id()) { frAlgo.fStripToTrack[h.BackKey()] = -1; } + if (frAlgo.fStripToTrack[h.FrontKey()] == tr.Id()) { + frAlgo.fStripToTrack[h.FrontKey()] = -1; + } + if (frAlgo.fStripToTrack[h.BackKey()] == tr.Id()) { + frAlgo.fStripToTrack[h.BackKey()] = -1; + } } } else { @@ -581,16 +625,24 @@ void TrackFinderWindow::CaTrackFinderSlice() ca::Branch& tr = frAlgo.fTrackCandidates[iCandidate]; if (!tr.IsAlive()) continue; if (ca::Framework::TrackingMode::kMcbm == frAlgo.fTrackingMode) { - if (tr.NofHits() <= 3) { continue; } + if (tr.NofHits() <= 3) { + continue; + } } else if (ca::Framework::TrackingMode::kGlobal == frAlgo.fTrackingMode) { - if (tr.NofHits() < 3) { continue; } + if (tr.NofHits() < 3) { + continue; + } } else { - if (tr.NofHits() < 3) { continue; } + if (tr.NofHits() < 3) { + continue; + } } if (frAlgo.fpCurrentIteration->GetExtendTracksFlag()) { - if (tr.NofHits() < frAlgo.GetParameters().GetNstationsActive()) { frAlgo.fTrackExtender.ExtendBranch(tr); } + if (tr.NofHits() < frAlgo.GetParameters().GetNstationsActive()) { + frAlgo.fTrackExtender.ExtendBranch(tr); + } } for (auto iHit : tr.Hits()) { @@ -685,7 +737,9 @@ void TrackFinderWindow::CAFindTrack(int ista, ca::Branch& best_tr, const ca::Tri ndf = curr_tr.NofHits() * 2 - 4; } - if (curr_tr.Chi2() > frAlgo.fTrackChi2Cut * ndf) { return; } + if (curr_tr.Chi2() > frAlgo.fTrackChi2Cut * ndf) { + return; + } // -- select the best diff --git a/algo/ca/core/tracking/CaTrackFinderWindow.h b/algo/ca/core/tracking/CaTrackFinderWindow.h index edf3846447..b2c0587847 100644 --- a/algo/ca/core/tracking/CaTrackFinderWindow.h +++ b/algo/ca/core/tracking/CaTrackFinderWindow.h @@ -31,7 +31,7 @@ namespace cbm::algo::ca /// Class implements a clones merger algorithm for the CA track finder /// class TrackFinderWindow { - public: + public: /// Default constructor TrackFinderWindow(ca::Framework& algo); @@ -56,14 +56,14 @@ namespace cbm::algo::ca void CAFindTrack(int ista, ca::Branch& best_tr, const ca::Triplet* curr_trip, ca::Branch& curr_tr, unsigned char min_best_l, ca::Branch* new_tr); - private: + private: ///------------------------------- /// Private methods bool checkTripletMatch(const ca::Triplet& l, const ca::Triplet& r, fscal& dchi2) const; - private: + private: ///------------------------------- /// Data members diff --git a/algo/ca/core/tracking/CaTrackFit.cxx b/algo/ca/core/tracking/CaTrackFit.cxx index 20a00699cd..5a0cb9d96a 100644 --- a/algo/ca/core/tracking/CaTrackFit.cxx +++ b/algo/ca/core/tracking/CaTrackFit.cxx @@ -984,7 +984,8 @@ namespace cbm::algo::ca cnst E2 = fMass2 + p2; fvec i; - if (atomicZ < 13) i = (12. * atomicZ + 7.) * 1.e-9; + if (atomicZ < 13) + i = (12. * atomicZ + 7.) * 1.e-9; else i = (9.76 * atomicZ + 58.8 * std::pow(atomicZ, -0.19)) * 1.e-9; @@ -1200,7 +1201,7 @@ namespace cbm::algo::ca fvec C11) { - fvec chi2x {0.}; + fvec chi2x{0.}; { // filter X measurement fvec zeta = x - m.X(); @@ -1225,7 +1226,7 @@ namespace cbm::algo::ca C11 -= K1 * F1; } - fvec chi2u {0.}; + fvec chi2u{0.}; { // filter U measurement, we need only chi2 here fvec cosPhi = -m.Dxy() / m.Dx2(); diff --git a/algo/ca/core/tracking/CaTrackFit.h b/algo/ca/core/tracking/CaTrackFit.h index aa01221011..6a61583b42 100644 --- a/algo/ca/core/tracking/CaTrackFit.h +++ b/algo/ca/core/tracking/CaTrackFit.h @@ -34,7 +34,7 @@ namespace cbm::algo::ca /// class TrackFit { - public: + public: TrackFit() = default; TrackFit(const TrackParamV& t) { SetTrack(t); } @@ -231,22 +231,22 @@ namespace cbm::algo::ca void GuessTrack(const fvec& trackZ, const fvec hitX[], const fvec hitY[], const fvec hitZ[], const fvec hitT[], const fvec By[], const fmask hitW[], const fmask hitWtime[], int NHits); - private: + private: ///-------------------------- /// Data members - fmask fMask {fmask::One()}; ///< mask of active elements in simd vectors - fvec fMaskF {fvec::One()}; ///< floating point representation of fMask + fmask fMask{fmask::One()}; ///< mask of active elements in simd vectors + fvec fMaskF{fvec::One()}; ///< floating point representation of fMask - TrackParamV fTr {}; ///< track parameters - fvec fQp0 {0.}; + TrackParamV fTr{}; ///< track parameters + fvec fQp0{0.}; - fvec fMass {0.10565800}; ///< particle mass (muon mass by default) - fvec fMass2 {fMass * fMass}; ///< mass squared + fvec fMass{0.10565800}; ///< particle mass (muon mass by default) + fvec fMass2{fMass * fMass}; ///< mass squared - fvec fMaxExtraplationStep {50.}; ///< max extrapolation step [cm] + fvec fMaxExtraplationStep{50.}; ///< max extrapolation step [cm] - bool fDoFitVelocity {0}; // should the track velocity be fitted as an independent parameter + bool fDoFitVelocity{0}; // should the track velocity be fitted as an independent parameter } _fvecalignment; diff --git a/algo/ca/core/tracking/CaTrackFitter.cxx b/algo/ca/core/tracking/CaTrackFitter.cxx index b83eba8191..b1e551c050 100644 --- a/algo/ca/core/tracking/CaTrackFitter.cxx +++ b/algo/ca/core/tracking/CaTrackFitter.cxx @@ -4,13 +4,13 @@ #include "CaTrackFitter.h" -#include <iostream> -#include <vector> - #include "CaFramework.h" #include "CaTrackFit.h" #include "CaTrackParam.h" +#include <iostream> +#include <vector> + using std::cout; using std::endl; using std::vector; @@ -52,7 +52,7 @@ void TrackFitter::FitCaTracks() fit.SetParticleMass(frAlgo.GetDefaultParticleMass()); fit.SetDoFitVelocity(true); - Track* t[fvec::size()] {nullptr}; + Track* t[fvec::size()]{nullptr}; const ca::Station* sta = frAlgo.GetParameters().GetStations().begin(); @@ -142,13 +142,17 @@ void TrackFitter::FitCaTracks() iSta[ih] = ista; w[ista][iVec] = true; - if (sta[ista].timeInfo) { w_time[ista][iVec] = true; } + if (sta[ista].timeInfo) { + w_time[ista][iVec] = true; + } x[ista][iVec] = hit.X(); //x_temp[iVec]; y[ista][iVec] = hit.Y(); //y_temp[iVec]; time[ista][iVec] = hit.T(); dt2[ista][iVec] = hit.dT2(); - if (!sta[ista].timeInfo) { dt2[ista][iVec] = 1.e4; } + if (!sta[ista].timeInfo) { + dt2[ista][iVec] = 1.e4; + } z[ista][iVec] = hit.Z(); fB_temp = sta[ista].fieldSlice.GetFieldValue(x[ista], y[ista]); mxy[ista].X()[iVec] = hit.X(); @@ -303,7 +307,9 @@ void TrackFitter::FitCaTracks() //fit.FilterVi(TrackParamV::kClightNsInv); TrackParamV Tf = fit.Tr(); - if (ca::Framework::TrackingMode::kGlobal == frAlgo.fTrackingMode) { Tf.Qp() = fitpv.Tr().Qp(); } + if (ca::Framework::TrackingMode::kGlobal == frAlgo.fTrackingMode) { + Tf.Qp() = fitpv.Tr().Qp(); + } for (int iVec = 0; iVec < nTracks_SIMD; iVec++) { t[iVec]->fParFirst.Set(Tf, iVec); @@ -313,7 +319,9 @@ void TrackFitter::FitCaTracks() t[iVec]->fParPV.Set(fitpv.Tr(), iVec); } - if (iter == 1) { break; } // only 1.5 iterations + if (iter == 1) { + break; + } // only 1.5 iterations // fit forward @@ -372,7 +380,9 @@ void TrackFitter::FitCaTracks() //fit.FilterVi(TrackParamV::kClightNsInv); TrackParamV Tl = fit.Tr(); - if (ca::Framework::TrackingMode::kGlobal == frAlgo.fTrackingMode) { Tl.Qp() = fitpv.Tr().Qp(); } + if (ca::Framework::TrackingMode::kGlobal == frAlgo.fTrackingMode) { + Tl.Qp() = fitpv.Tr().Qp(); + } for (int iVec = 0; iVec < nTracks_SIMD; iVec++) { t[iVec]->fParLast.Set(Tl, iVec); diff --git a/algo/ca/core/tracking/CaTrackFitter.h b/algo/ca/core/tracking/CaTrackFitter.h index 130a42903f..75ecd3f186 100644 --- a/algo/ca/core/tracking/CaTrackFitter.h +++ b/algo/ca/core/tracking/CaTrackFitter.h @@ -29,7 +29,7 @@ namespace cbm::algo::ca /// Class implements a track fit the CA track finder /// class TrackFitter { - public: + public: /// Default constructor TrackFitter(ca::Framework& algo); @@ -52,11 +52,11 @@ namespace cbm::algo::ca /// Fit tracks, found by the CA tracker void FitCaTracks(); - private: + private: ///------------------------------- /// Private methods - private: + private: ///------------------------------- /// Data members diff --git a/algo/ca/core/tracking/CaTripletConstructor.cxx b/algo/ca/core/tracking/CaTripletConstructor.cxx index df63e6c1cd..3136cee214 100644 --- a/algo/ca/core/tracking/CaTripletConstructor.cxx +++ b/algo/ca/core/tracking/CaTripletConstructor.cxx @@ -4,12 +4,12 @@ #include "CaTripletConstructor.h" -#include <algorithm> -#include <iostream> - #include "CaDefines.h" #include "CaFramework.h" #include "CaGridArea.h" + +#include <algorithm> +#include <iostream> // #include "CaToolsDebugger.h" #include "CaTrackFit.h" #include "CaTrackParam.h" @@ -28,7 +28,9 @@ void TripletConstructor::InitStations(int istal, int istam, int istar) fIstaM = istam; fIstaR = istar; - if (fIstaM >= fAlgo->fParameters.GetNstationsActive()) { return; } + if (fIstaM >= fAlgo->fParameters.GetNstationsActive()) { + return; + } fStaL = &fAlgo->fParameters.GetStation(fIstaL); fStaM = &fAlgo->fParameters.GetStation(fIstaM); @@ -37,8 +39,12 @@ void TripletConstructor::InitStations(int istal, int istam, int istar) { // two stations for approximating the field between the target and the left hit int sta1 = fIstaL; - if (sta1 >= fAlgo->fNfieldStations) { sta1 = fAlgo->fNfieldStations - 1; } - if (sta1 < 1) { sta1 = 1; } + if (sta1 >= fAlgo->fNfieldStations) { + sta1 = fAlgo->fNfieldStations - 1; + } + if (sta1 < 1) { + sta1 = 1; + } int sta0 = sta1 / 2; // station between fIstaL and the target assert(0 <= sta0 && sta0 < sta1 && sta1 < fAlgo->fParameters.GetNstationsActive()); @@ -55,8 +61,12 @@ void TripletConstructor::InitStations(int istal, int istam, int istar) if (sta2 >= fAlgo->fParameters.GetNstationsActive()) { sta2 = fIstaM; sta1 = fIstaM - 1; - if (sta0 >= sta1) { sta0 = sta1 - 1; } - if (sta0 < 0) { sta0 = 0; } + if (sta0 >= sta1) { + sta0 = sta1 - 1; + } + if (sta0 < 0) { + sta0 = 0; + } } if (fAlgo->fParameters.GetNstationsActive() >= 3) { assert(0 <= sta0 && sta0 < sta1 && sta1 < sta2 && sta2 < fAlgo->fParameters.GetNstationsActive()); @@ -68,7 +78,9 @@ void TripletConstructor::InitStations(int istal, int istam, int istar) } fFit.SetParticleMass(fAlgo->GetDefaultParticleMass()); - if (fAlgo->fpCurrentIteration->GetElectronFlag()) { fFit.SetParticleMass(constants::phys::ElectronMass); } + if (fAlgo->fpCurrentIteration->GetElectronFlag()) { + fFit.SetParticleMass(constants::phys::ElectronMass); + } fFit.SetMask(fmask::One()); fIsInitialized = true; @@ -177,7 +189,9 @@ void TripletConstructor::FindDoublets() int iMC = -1; if (fAlgo->fParameters.DevIsMatchDoubletsViaMc()) { iMC = fAlgo->GetMcTrackIdForWindowHit(fIhitL); - if (iMC < 0) { return; } + if (iMC < 0) { + return; + } } CollectHits(fTrL, fIstaM, fAlgo->fDoubletChi2Cut, iMC, fHitsM_2, fAlgo->fParameters.GetMaxDoubletsPerSinglet()); @@ -244,14 +258,20 @@ void TripletConstructor::FitDoublets() if ((staM().timeInfo) && (T2.NdfTime()[0] > -2)) { fscal dt = T2.Time()[0] + tt * dz - hitClone.T(); - if (fabs(dt) > sqrt(30. * T2.C55()[0]) + hitClone.RangeT()) { continue; } + if (fabs(dt) > sqrt(30. * T2.C55()[0]) + hitClone.RangeT()) { + continue; + } } fscal dx = T2.GetX()[0] + tx * dz - hitClone.X(); - if (fabs(dx) > 1.3 * (3.5 * sqrt(T2.C00()[0]) + hitClone.RangeX())) { continue; } + if (fabs(dx) > 1.3 * (3.5 * sqrt(T2.C00()[0]) + hitClone.RangeX())) { + continue; + } fscal dy = T2.Y()[0] + ty * dz - hitClone.Y(); - if (fabs(dy) > 1.6 * (3.5 * sqrt(T2.C11()[0]) + hitClone.RangeY())) { continue; } + if (fabs(dy) > 1.6 * (3.5 * sqrt(T2.C11()[0]) + hitClone.RangeY())) { + continue; + } if (fAlgo->fParameters.DevIsSuppressOverlapHitsViaMc()) { int iMC = fAlgo->GetMcTrackIdForWindowHit(fIhitL); @@ -271,7 +291,9 @@ void TripletConstructor::FitDoublets() void TripletConstructor::FindTriplets() { - if (fIstaR >= fAlgo->fParameters.GetNstationsActive()) { return; } + if (fIstaR >= fAlgo->fParameters.GetNstationsActive()) { + return; + } FindRightHit(); FitTriplets(); StoreTriplets(); @@ -308,7 +330,9 @@ void TripletConstructor::FindRightHit() // ---- Find the triplets(right hit). Reformat data in the portion of triplets. ---- - if (fAlgo->kSts == fAlgo->fTrackingMode && (T2.C44()[0] < 0)) { continue; } + if (fAlgo->kSts == fAlgo->fTrackingMode && (T2.C44()[0] < 0)) { + continue; + } if (T2.C00()[0] < 0 || T2.C11()[0] < 0 || T2.C22()[0] < 0 || T2.C33()[0] < 0 || T2.C55()[0] < 0) continue; if (fabs(T2.Tx()[0]) > fAlgo->fMaxSlope) continue; @@ -318,7 +342,9 @@ void TripletConstructor::FindRightHit() if (fAlgo->fParameters.DevIsMatchTripletsViaMc()) { int indM = fHitsM_2[i2]; iMC = fAlgo->GetMcTrackIdForWindowHit(fIhitL); - if (iMC < 0 || iMC != fAlgo->GetMcTrackIdForWindowHit(indM)) { continue; } + if (iMC < 0 || iMC != fAlgo->GetMcTrackIdForWindowHit(indM)) { + continue; + } } Vector<ca::HitIndex_t> collectedHits; @@ -364,7 +390,9 @@ void TripletConstructor::FitTriplets() ca::TrackFit fit; fit.SetMask(fmask::One()); - if (fAlgo->fpCurrentIteration->GetElectronFlag()) { fit.SetParticleMass(constants::phys::ElectronMass); } + if (fAlgo->fpCurrentIteration->GetElectronFlag()) { + fit.SetParticleMass(constants::phys::ElectronMass); + } else { fit.SetParticleMass(fAlgo->GetDefaultParticleMass()); } @@ -395,7 +423,9 @@ void TripletConstructor::FitTriplets() int mc1 = fAlgo->GetMcTrackIdForCaHit(ihit[0]); int mc2 = fAlgo->GetMcTrackIdForCaHit(ihit[1]); int mc3 = fAlgo->GetMcTrackIdForCaHit(ihit[2]); - if ((mc1 != mc2) || (mc1 != mc3)) { continue; } + if ((mc1 != mc2) || (mc1 != mc3)) { + continue; + } } fscal x[NHits], y[NHits], z[NHits], t[NHits]; @@ -566,12 +596,16 @@ void TripletConstructor::StoreTriplets() CBMCA_DEBUG_ASSERT(ihitr < fAlgo->fStationHitsStartIndex[fIstaR + 1]); if (!fAlgo->fpCurrentIteration->GetTrackFromTripletsFlag()) { - if (chi2 > fAlgo->fTripletFinalChi2Cut) { continue; } + if (chi2 > fAlgo->fTripletFinalChi2Cut) { + continue; + } } // assert(std::isfinite(chi2) && chi2 > 0); - if (!std::isfinite(chi2) || chi2 < 0) { continue; } + if (!std::isfinite(chi2) || chi2 < 0) { + continue; + } //if (!T3.IsEntryConsistent(true, 0)) { continue; } @@ -613,7 +647,9 @@ void TripletConstructor::CollectHits(const TrackParamV& Tr, const int iSta, cons (sqrt(Pick_m22 * T.C00()) + grid.GetMaxRangeX() + fAlgo->fMaxDZ * abs(T.Tx()))[0], (sqrt(Pick_m22 * T.C11()) + grid.GetMaxRangeY() + fAlgo->fMaxDZ * abs(T.Ty()))[0]); - if (fAlgo->fParameters.DevIsIgnoreHitSearchAreas()) { area.DoLoopOverEntireGrid(); } + if (fAlgo->fParameters.DevIsIgnoreHitSearchAreas()) { + area.DoLoopOverEntireGrid(); + } ca::HitIndex_t ih = 0; @@ -625,7 +661,9 @@ void TripletConstructor::CollectHits(const TrackParamV& Tr, const int iSta, cons const ca::Hit& hit = fAlgo->fWindowHits[ih]; if (iMC >= 0) { // match via MC - if (iMC != fAlgo->GetMcTrackIdForWindowHit(ih)) { continue; } + if (iMC != fAlgo->GetMcTrackIdForWindowHit(ih)) { + continue; + } } // check y-boundaries diff --git a/algo/ca/core/tracking/CaTripletConstructor.h b/algo/ca/core/tracking/CaTripletConstructor.h index 477bee185a..5d2c558c79 100644 --- a/algo/ca/core/tracking/CaTripletConstructor.h +++ b/algo/ca/core/tracking/CaTripletConstructor.h @@ -28,7 +28,7 @@ namespace cbm::algo::ca /// Construction of triplets for the CA tracker /// class TripletConstructor { - public: + public: /// ------ Constructors and destructor ------ /// Constructor @@ -79,7 +79,7 @@ namespace cbm::algo::ca void CollectHits(const TrackParamV& Tr, const int iSta, const double chi2Cut, const int iMC, Vector<ca::HitIndex_t>& collectedHits, int maxNhits); - private: + private: /// left station const ca::Station& staL() { return *fStaL; } /// middle station @@ -87,17 +87,17 @@ namespace cbm::algo::ca /// right station const ca::Station& staR() { return *fStaR; } - private: - bool fIsInitialized {false}; ///< is initialized; - ca::Framework* fAlgo {nullptr}; ///< pointer to ca::Framework object + private: + bool fIsInitialized{false}; ///< is initialized; + ca::Framework* fAlgo{nullptr}; ///< pointer to ca::Framework object - int fIstaL {-1}; ///< left station index - int fIstaM {-1}; ///< middle station index - int fIstaR {-1}; ///< right station index + int fIstaL{-1}; ///< left station index + int fIstaM{-1}; ///< middle station index + int fIstaR{-1}; ///< right station index - const ca::Station* fStaL {nullptr}; ///< left station - const ca::Station* fStaM {nullptr}; ///< mid station - const ca::Station* fStaR {nullptr}; ///< right station + const ca::Station* fStaL{nullptr}; ///< left station + const ca::Station* fStaM{nullptr}; ///< mid station + const ca::Station* fStaR{nullptr}; ///< right station const ca::Station* fFld0Sta[2]; // two stations for approximating the field between the target and the left hit const ca::Station* fFld1Sta[3]; // three stations for approximating the field between the left and the right hit @@ -106,14 +106,14 @@ namespace cbm::algo::ca TrackParamV fTrL; ca::FieldRegion fFldL; - Vector<ca::HitIndex_t> fHitsM_2 {"TripletConstructor::fHitsM_2"}; - Vector<TrackParamV> fTracks_2 {"TripletConstructor::fTracks_2"}; + Vector<ca::HitIndex_t> fHitsM_2{"TripletConstructor::fHitsM_2"}; + Vector<TrackParamV> fTracks_2{"TripletConstructor::fTracks_2"}; - Vector<TrackParamV> fTracks_3 {"TripletConstructor::fTracks_3"}; - Vector<ca::HitIndex_t> fHitsM_3 {"TripletConstructor::fHitsM_3"}; - Vector<ca::HitIndex_t> fHitsR_3 {"TripletConstructor::fHitsR_3"}; + Vector<TrackParamV> fTracks_3{"TripletConstructor::fTracks_3"}; + Vector<ca::HitIndex_t> fHitsM_3{"TripletConstructor::fHitsM_3"}; + Vector<ca::HitIndex_t> fHitsR_3{"TripletConstructor::fHitsR_3"}; - Vector<ca::Triplet> fTriplets {"TripletConstructor::fTriplets"}; + Vector<ca::Triplet> fTriplets{"TripletConstructor::fTriplets"}; ca::TrackFit fFit; diff --git a/algo/ca/core/utils/CaEnumArray.h b/algo/ca/core/utils/CaEnumArray.h index a34409ae44..82e685a849 100644 --- a/algo/ca/core/utils/CaEnumArray.h +++ b/algo/ca/core/utils/CaEnumArray.h @@ -33,7 +33,7 @@ namespace cbm::algo::ca using U = typename std::underlying_type<E>::type; ///< Underlying type of enumeration using Arr = std::array<T, static_cast<std::size_t>(E::kEND)>; - public: + public: /// \brief Mutable access operator, indexed by enum entry T& operator[](const E& entry) { diff --git a/algo/ca/core/utils/CaMonitor.h b/algo/ca/core/utils/CaMonitor.h index dcc7912b5b..bb972bb7f1 100644 --- a/algo/ca/core/utils/CaMonitor.h +++ b/algo/ca/core/utils/CaMonitor.h @@ -9,6 +9,9 @@ #pragma once // include this header only once per compilation unit +#include "CaEnumArray.h" +#include "CaMonitorData.h" + #include <algorithm> #include <iomanip> #include <sstream> @@ -16,9 +19,6 @@ #include <string_view> #include <vector> -#include "CaEnumArray.h" -#include "CaMonitorData.h" - namespace cbm::algo::ca { /// \class Monitor @@ -28,7 +28,7 @@ namespace cbm::algo::ca /// template<class ECounterKey, class ETimerKey = EDummy> class Monitor { - public: + public: /// \brief Alias to array, indexed by the monitorable enumeration template<typename T> using CounterArray = EnumArray<ECounterKey, T>; @@ -128,11 +128,11 @@ namespace cbm::algo::ca /// \brief Prints counters summary to string std::string ToString() const; - private: + private: MonitorData<ECounterKey, ETimerKey> fMonitorData; ///< Monitor data - TimerArray<std::string> faTimerNames {}; ///< Array of timer names - CounterArray<std::string> faCounterNames {}; ///< Array of counter names - std::vector<ECounterKey> fvCounterRatioKeys {}; ///< List of keys, which are used as denominators in ratios + TimerArray<std::string> faTimerNames{}; ///< Array of timer names + CounterArray<std::string> faCounterNames{}; ///< Array of counter names + std::vector<ECounterKey> fvCounterRatioKeys{}; ///< List of keys, which are used as denominators in ratios std::string fsName; ///< Name of the monitor }; diff --git a/algo/ca/core/utils/CaMonitorData.h b/algo/ca/core/utils/CaMonitorData.h index 5c1475d40f..d744acfb1c 100644 --- a/algo/ca/core/utils/CaMonitorData.h +++ b/algo/ca/core/utils/CaMonitorData.h @@ -12,6 +12,8 @@ #include "CaEnumArray.h" #include "CaTimer.h" +#include <algorithm> + namespace cbm::algo::ca { /// \class MonitorData @@ -21,7 +23,7 @@ namespace cbm::algo::ca /// template<class ECounterKey, class ETimerKey> class MonitorData { - public: + public: /// \brief Alias to array, indexed by the counter enumeration template<typename T> using CounterArray = EnumArray<ECounterKey, T>; @@ -85,9 +87,9 @@ namespace cbm::algo::ca /// \param key Timer key void StopTimer(ETimerKey key) { faTimers[key].Stop(); } - private: - TimerArray<Timer> faTimers {}; ///< Array of timers - CounterArray<int> faCounters {}; ///< Array of counters + private: + TimerArray<Timer> faTimers{}; ///< Array of timers + CounterArray<int> faCounters{}; ///< Array of counters }; diff --git a/algo/ca/core/utils/CaObjectInitController.h b/algo/ca/core/utils/CaObjectInitController.h index 45b5f7db3d..5af0429dcf 100644 --- a/algo/ca/core/utils/CaObjectInitController.h +++ b/algo/ca/core/utils/CaObjectInitController.h @@ -8,6 +8,8 @@ /// @author Sergei Zharko /// @date 22.02.2022 +#include "AlgoFairloggerCompat.h" + #include <bitset> #include <cassert> #include <iomanip> @@ -15,8 +17,6 @@ #include <sstream> #include <string> -#include "AlgoFairloggerCompat.h" - namespace cbm::algo::ca { /// ObjectInitController is a class, which provides flags system @@ -28,7 +28,7 @@ namespace cbm::algo::ca // TODO: Possible improvement: introduce another template parameter, which represents a local enum class... template<int NumberOfFlags, class InitKeyEnum> class ObjectInitController { - public: + public: /// Gets an initialization status of the flag placed at bitIndex /// \param bitIndex index of bit bool GetFlag(InitKeyEnum bitKey) const; @@ -42,8 +42,8 @@ namespace cbm::algo::ca /// \param indentLevel number of indent charachets int output std::string ToString(int indentLevel = 0) const; - private: - std::bitset<NumberOfFlags> fInitFlags {}; ///< object of flags sets + private: + std::bitset<NumberOfFlags> fInitFlags{}; ///< object of flags sets }; // @@ -80,7 +80,7 @@ namespace cbm::algo::ca template<int NumberOfFlags, class InitKeyEnum> std::string ObjectInitController<NumberOfFlags, InitKeyEnum>::ToString(int indentLevel) const { - std::stringstream aStream {}; + std::stringstream aStream{}; constexpr char indentChar = '\t'; std::string indent(indentLevel, indentChar); aStream << indent << "CaObjectInitController: flag values"; diff --git a/algo/ca/core/utils/CaSimdPseudo.h b/algo/ca/core/utils/CaSimdPseudo.h index 5bd20718e0..557b3da268 100644 --- a/algo/ca/core/utils/CaSimdPseudo.h +++ b/algo/ca/core/utils/CaSimdPseudo.h @@ -6,11 +6,10 @@ #include <boost/serialization/access.hpp> +#include <cmath> #include <iomanip> #include <iostream> -#include <cmath> - namespace cbm::algo::ca { @@ -30,8 +29,8 @@ namespace cbm::algo::ca class fmask { - public: - static constexpr int Size {4}; + public: + static constexpr int Size{4}; static constexpr size_t size() { return Size; } @@ -118,7 +117,7 @@ namespace cbm::algo::ca class fvec { - public: + public: static constexpr size_t size() { return fmask::size(); } fscal v[fmask::Size]; @@ -160,7 +159,9 @@ namespace cbm::algo::ca void setZero(fmask m) { for (size_t i = 0; i < size(); i++) { - if (m[i]) { v[i] = 0.; } + if (m[i]) { + v[i] = 0.; + } } } diff --git a/algo/ca/core/utils/CaSimdVc.h b/algo/ca/core/utils/CaSimdVc.h index 656de918e8..a8a1d1e81f 100644 --- a/algo/ca/core/utils/CaSimdVc.h +++ b/algo/ca/core/utils/CaSimdVc.h @@ -4,12 +4,12 @@ #pragma once // include this header only once per compilation unit +#include "Vc/Vc" + #include <boost/serialization/access.hpp> #include <boost/serialization/array.hpp> #include <boost/serialization/split_free.hpp> -#include "Vc/Vc" - namespace cbm::algo::ca { typedef Vc::float_v fvec; diff --git a/algo/ca/core/utils/CaTimer.h b/algo/ca/core/utils/CaTimer.h index 8ce67e669d..712cb4806d 100644 --- a/algo/ca/core/utils/CaTimer.h +++ b/algo/ca/core/utils/CaTimer.h @@ -20,7 +20,7 @@ namespace cbm::algo::ca /// \brief A timer class for the monitor /// class Timer { - public: + public: using Clock = std::chrono::high_resolution_clock; using Duration = std::chrono::nanoseconds; using DurationCount = Duration::rep; @@ -78,7 +78,7 @@ namespace cbm::algo::ca /// \brief Stops the timer void Stop(); - private: + private: TimePoint fStart = TimePoint(); DurationCount fMin = std::numeric_limits<DurationCount>::max(); ///< Minimal time period DurationCount fMax = std::numeric_limits<DurationCount>::min(); ///< Maximal time period diff --git a/algo/ca/core/utils/CaTrackingMonitor.h b/algo/ca/core/utils/CaTrackingMonitor.h index 04c3192152..c14b4c26b4 100644 --- a/algo/ca/core/utils/CaTrackingMonitor.h +++ b/algo/ca/core/utils/CaTrackingMonitor.h @@ -56,7 +56,7 @@ namespace cbm::algo::ca /// \class cbm::algo::ca::TrackingMonitor /// \brief A monitor specialization for cbm::algo::ca::Framework class class TrackingMonitor : public Monitor<ECounter, ETimer> { - public: + public: /// \brief Default constructor TrackingMonitor() : Monitor<ECounter, ETimer>("CA Framework Monitor") { diff --git a/algo/ca/core/utils/CaUtils.h b/algo/ca/core/utils/CaUtils.h index bd2d6eb175..c77df1d573 100644 --- a/algo/ca/core/utils/CaUtils.h +++ b/algo/ca/core/utils/CaUtils.h @@ -10,12 +10,12 @@ #pragma once // include this header only once per compilation unit -#include <sstream> - #include "AlgoFairloggerCompat.h" #include "CaConstants.h" #include "CaSimd.h" +#include <sstream> + /// Namespace contains compile-time constants definition for the CA tracking algorithm /// namespace cbm::algo::ca::utils @@ -50,7 +50,9 @@ namespace cbm::algo::ca::utils template<typename T> inline bool IsUndefined(T val) { - if constexpr (std::is_same_v<T, float>) { return std::isnan(val); } + if constexpr (std::is_same_v<T, float>) { + return std::isnan(val); + } else if constexpr (std::is_same_v<T, double>) { return std::isnan(val); } @@ -70,7 +72,9 @@ namespace cbm::algo::ca::utils template<typename T> inline bool IsFinite(T val) { - if constexpr (std::is_same_v<T, float>) { return std::isfinite(val); } + if constexpr (std::is_same_v<T, float>) { + return std::isfinite(val); + } else if constexpr (std::is_same_v<T, double>) { return std::isfinite(val); } @@ -103,31 +107,31 @@ namespace cbm::algo::ca::utils template<typename TdataA, typename TdataB, bool TDoAllA, bool TDoAllB> class VecCopySpec { - public: + public: [[gnu::always_inline]] static void CopyEntries(TdataA& a, int ia, const TdataB& b, int ib); }; template<typename TdataA, typename TdataB> class VecCopySpec<TdataA, TdataB, true, true> { - public: + public: [[gnu::always_inline]] static void CopyEntries(TdataA& a, int, const TdataB& b, int) { a = b; } }; template<typename TdataA, typename TdataB> class VecCopySpec<TdataA, TdataB, true, false> { - public: + public: [[gnu::always_inline]] static void CopyEntries(TdataA& a, int, const TdataB& b, int ib) { a = b[ib]; } }; template<typename TdataA, typename TdataB> class VecCopySpec<TdataA, TdataB, false, true> { - public: + public: [[gnu::always_inline]] static void CopyEntries(TdataA& a, int ia, const TdataB& b, int) { a[ia] = b; } }; template<typename TdataA, typename TdataB> class VecCopySpec<TdataA, TdataB, false, false> { - public: + public: [[gnu::always_inline]] static void CopyEntries(TdataA& a, int ia, const TdataB& b, int ib) { a[ia] = b[ib]; } }; @@ -146,11 +150,11 @@ namespace cbm::algo::ca::utils /// \param ib Index of SIMD vector element of the second class template<typename TdataA, typename TdataB, bool TDoAllA, bool TDoAllB> class VecCopy { - public: + public: static void CopyEntries(TdataA& a, int ia, const TdataB& b, int ib) { - constexpr bool allA {TDoAllA || !std::is_same<TdataA, fvec>::value}; - constexpr bool allB {TDoAllB || !std::is_same<TdataB, fvec>::value}; + constexpr bool allA{TDoAllA || !std::is_same<TdataA, fvec>::value}; + constexpr bool allB{TDoAllB || !std::is_same<TdataB, fvec>::value}; VecCopySpec<TdataA, TdataB, allA, allB>::CopyEntries(a, ia, b, ib); } }; diff --git a/algo/ca/core/utils/CaVector.h b/algo/ca/core/utils/CaVector.h index fdb5e1e293..6d0c31b284 100644 --- a/algo/ca/core/utils/CaVector.h +++ b/algo/ca/core/utils/CaVector.h @@ -37,7 +37,7 @@ namespace cbm::algo::ca class Vector : private std::vector<T> { friend class boost::serialization::access; - public: + public: typedef std::vector<T> Tbase; /// \brief Generic constructor from vairadic parameter list @@ -269,9 +269,9 @@ namespace cbm::algo::ca using Tbase::size; using typename Tbase::iterator; - private: - std::string fName {"no name"}; ///< Name of the vector - using Tbase::assign; // use reset() instead + private: + std::string fName{"no name"}; ///< Name of the vector + using Tbase::assign; // use reset() instead using Tbase::at; using Tbase::resize; diff --git a/algo/ca/qa/CaQaBuilder.h b/algo/ca/qa/CaQaBuilder.h index 26615bc76e..8b6078aca0 100644 --- a/algo/ca/qa/CaQaBuilder.h +++ b/algo/ca/qa/CaQaBuilder.h @@ -27,7 +27,7 @@ namespace cbm::algo::ca::qa /// \brief Builder class for the CA tracking QA (header) /// class Builder { - public: + public: using TrackV_t = ca::Vector<ca::Track>; using HitIndexV_t = ca::Vector<std::vector<std::pair<uint32_t, uint32_t>>>; @@ -75,7 +75,7 @@ namespace cbm::algo::ca::qa /// \note Call per run void RegisterParameters(const Parameters* pParameters) { fpParameters = pParameters; } - private: + private: Config fConfig; ///< QA configuration const Parameters* fpParameters = nullptr; ///< Pointer to tracking parameters const Vector<Track>* fpvTracks = nullptr; ///< Pointer to tracks vector diff --git a/algo/ca/qa/CaQaConfig.cxx b/algo/ca/qa/CaQaConfig.cxx index bea2d565e6..e9c696b7da 100644 --- a/algo/ca/qa/CaQaConfig.cxx +++ b/algo/ca/qa/CaQaConfig.cxx @@ -73,7 +73,9 @@ std::string Config::GetPadConfig(const std::vector<std::string>& vHistNames, boo std::stringstream config; config << bGridX << ',' << bGridY << ',' << bLogX << ',' << bLogY << ',' << bLogZ; - if (vHistNames.empty()) { config << ','; } + if (vHistNames.empty()) { + config << ','; + } else { for (auto& name : vHistNames) { config << ",(" << name << ",hist)"; diff --git a/algo/ca/qa/CaQaConfig.h b/algo/ca/qa/CaQaConfig.h index 7f59533574..67f93eeae1 100644 --- a/algo/ca/qa/CaQaConfig.h +++ b/algo/ca/qa/CaQaConfig.h @@ -9,17 +9,17 @@ #pragma once +#include "CaQaDefinitions.h" + #include <string> #include <vector> -#include "CaQaDefinitions.h" - namespace cbm::algo::ca::qa { /// \brief Configuration structure for QA of the tracking /// \struct cbm::algo::ca::qa::Config class Config { - public: + public: /// \brief Default constructor Config(); @@ -49,7 +49,7 @@ namespace cbm::algo::ca::qa /// histogram name and the second string is the QA name (common for all the histograms within the QA module). std::vector<std::pair<std::string, std::string>> GetCanvasConfigs() const; - private: + private: /// \brief Gets pad configuration string static std::string GetPadConfig(const std::vector<std::string>& vHistNames, bool bLogX, bool bLogY); diff --git a/algo/ca/qa/CaQaData.h b/algo/ca/qa/CaQaData.h index d44a8b8a5b..345651740f 100644 --- a/algo/ca/qa/CaQaData.h +++ b/algo/ca/qa/CaQaData.h @@ -9,19 +9,19 @@ #pragma once -#include <string> -#include <vector> - #include "CaQaConfig.h" #include "CaQaDefinitions.h" #include "Histo1D.h" +#include <string> +#include <vector> + namespace cbm::algo::ca::qa { /// \class cbm::algo::ca::qa::Data /// \brief QA data structure for CA tracking class Data { - public: + public: /// \brief Default constructor Data() = delete; @@ -56,7 +56,7 @@ namespace cbm::algo::ca::qa /// \brief String representation of the data status std::string ToString() const; - private: + private: std::vector<Histo1D> fvH1 = {}; ///< Vector of 1D-histograms, indexed by H1Key }; diff --git a/algo/ca/qa/CaQaDefinitions.h b/algo/ca/qa/CaQaDefinitions.h index d5129dd506..2637d1e790 100644 --- a/algo/ca/qa/CaQaDefinitions.h +++ b/algo/ca/qa/CaQaDefinitions.h @@ -9,11 +9,11 @@ #pragma once +#include "CaEnumArray.h" + #include <iomanip> #include <sstream> -#include "CaEnumArray.h" - namespace cbm::algo::ca::qa { /// \struct H1Pars diff --git a/algo/global/RecoResults.h b/algo/global/RecoResults.h index ecc34dd934..1fd92e64ca 100644 --- a/algo/global/RecoResults.h +++ b/algo/global/RecoResults.h @@ -9,14 +9,15 @@ #pragma once -#include <vector> - #include "DigiData.h" #include "PartitionedSpan.h" #include "PartitionedVector.h" #include "ca/core/utils/CaVector.h" #include "sts/Cluster.h" #include "sts/Hit.h" +#include "tof/Hit.h" + +#include <vector> namespace cbm::algo { diff --git a/reco/L1/CbmL1Track.h b/reco/L1/CbmL1Track.h index 9ddedc826f..beeea5ebcc 100644 --- a/reco/L1/CbmL1Track.h +++ b/reco/L1/CbmL1Track.h @@ -126,7 +126,7 @@ class CbmL1Track : public cbm::algo::ca::TrackParamD { double fTrackTime{0.}; ///< Time of the track [ns] ??? std::map<int, int> hitMap; // N hits (second) from each mcTrack (first is a MC track ID) belong to current recoTrack - // FIXME: SZh 14.12.2022: map => unordered_map + // FIXME: SZh 14.12.2022: map => unordered_map private: -- GitLab