diff --git a/algo/ca/TrackingChain.cxx b/algo/ca/TrackingChain.cxx index b6c968d377cc5e26ef8a58179814b8e573428b20..cffede81ec2f89f36b88f324108032358e57ce59 100644 --- a/algo/ca/TrackingChain.cxx +++ b/algo/ca/TrackingChain.cxx @@ -80,9 +80,9 @@ void TrackingChain::Init() // ------ Used detector subsystem flags fbDetUsed.fill(false); - fbDetUsed[EDetectorID::Sts] = Opts().Has(fles::Subsystem::STS) && parameters.IsActive(EDetectorID::Sts); - fbDetUsed[EDetectorID::Tof] = Opts().Has(fles::Subsystem::TOF) && parameters.IsActive(EDetectorID::Tof); - fbDetUsed[EDetectorID::Trd] = Opts().Has(fles::Subsystem::TRD) && parameters.IsActive(EDetectorID::Trd); + fbDetUsed[EDetectorID::kSts] = Opts().Has(fles::Subsystem::STS) && parameters.IsActive(EDetectorID::kSts); + fbDetUsed[EDetectorID::kTof] = Opts().Has(fles::Subsystem::TOF) && parameters.IsActive(EDetectorID::kTof); + fbDetUsed[EDetectorID::kTrd] = Opts().Has(fles::Subsystem::TRD) && parameters.IsActive(EDetectorID::kTrd); // ------ Initialize CA framework fCaMonitor.Reset(); @@ -143,14 +143,14 @@ void TrackingChain::PrepareInput(Input_t recoResults) fCaDataManager.ResetInputData(nHitsTot); faHitExternalIndices.clear(); faHitExternalIndices.reserve(nHitsTot); - if (fbDetUsed[EDetectorID::Sts]) { - ReadHits<EDetectorID::Sts>(recoResults.stsHits); + if (fbDetUsed[EDetectorID::kSts]) { + ReadHits<EDetectorID::kSts>(recoResults.stsHits); } - if (fbDetUsed[EDetectorID::Trd]) { - ReadHits<EDetectorID::Trd>(recoResults.trdHits); + if (fbDetUsed[EDetectorID::kTrd]) { + ReadHits<EDetectorID::kTrd>(recoResults.trdHits); } - if (fbDetUsed[EDetectorID::Tof]) { - ReadHits<EDetectorID::Tof>(recoResults.tofHits); + if (fbDetUsed[EDetectorID::kTof]) { + ReadHits<EDetectorID::kTof>(recoResults.tofHits); } faHitExternalIndices.shrink_to_fit(); fCaDataManager.SetNhitKeys(fNofHitKeys); @@ -180,9 +180,9 @@ TrackingChain::Output_t TrackingChain::PrepareOutput() int iHitInternal = fCaFramework.GetInputData().GetHit(fCaFramework.fRecoHits[trackFirstHit + iHit]).Id(); const auto [detID, iPartition, iPartHit] = faHitExternalIndices[iHitInternal]; switch (detID) { - case ca::EDetectorID::Sts: output.stsHitIndices[iTrk].push_back(std::make_pair(iPartition, iPartHit)); break; - case ca::EDetectorID::Tof: output.tofHitIndices[iTrk].push_back(std::make_pair(iPartition, iPartHit)); break; - case ca::EDetectorID::Trd: output.trdHitIndices[iTrk].push_back(std::make_pair(iPartition, iPartHit)); break; + case ca::EDetectorID::kSts: output.stsHitIndices[iTrk].push_back(std::make_pair(iPartition, iPartHit)); break; + case ca::EDetectorID::kTof: output.tofHitIndices[iTrk].push_back(std::make_pair(iPartition, iPartHit)); break; + case ca::EDetectorID::kTrd: output.trdHitIndices[iTrk].push_back(std::make_pair(iPartition, iPartHit)); break; default: break; } } @@ -238,11 +238,11 @@ void TrackingChain::ReadHits(PartitionedSpan<const ca::HitTypes_t::at<DetID>> hi int nSt = fCaFramework.GetParameters().GetNstationsActive(); using Hit_t = ca::HitTypes_t::at<DetID>; - constexpr bool IsMvd = (DetID == EDetectorID::Mvd); - constexpr bool IsSts = (DetID == EDetectorID::Sts); - constexpr bool IsMuch = (DetID == EDetectorID::Much); - constexpr bool IsTrd = (DetID == EDetectorID::Trd); - constexpr bool IsTof = (DetID == EDetectorID::Tof); + constexpr bool IsMvd = (DetID == EDetectorID::kMvd); + constexpr bool IsSts = (DetID == EDetectorID::kSts); + constexpr bool IsMuch = (DetID == EDetectorID::kMuch); + constexpr bool IsTrd = (DetID == EDetectorID::kTrd); + constexpr bool IsTof = (DetID == EDetectorID::kTof); xpu::t_add_bytes(hits.NElements() * sizeof(Hit_t)); // Assumes call from Run, for existence of timer! diff --git a/algo/ca/TrackingDefs.h b/algo/ca/TrackingDefs.h index e388167b8e0fb3711e61ffc82c698032e6af86c7..f4b9dadeeacca4432a079212d1cc0d9341220e51 100644 --- a/algo/ca/TrackingDefs.h +++ b/algo/ca/TrackingDefs.h @@ -10,6 +10,7 @@ #pragma once #include "CaEnumArray.h" +#include "CbmDefs.h" #include "MicrosliceDescriptor.hpp" // For fles::Subsystem #include <tuple> @@ -39,62 +40,48 @@ namespace cbm::algo namespace ca { - /// \enum cbm::algo::ca::EDetectorID - /// \brief Enumeration for the detector subsystems used in CBM online tracking - /// \note It is important, that the subsystems are specified in the actual order. - /// \note The enumeration must not contain jumps in the ordering and the first entry must be equal 0 - enum class EDetectorID - { - Mvd = 0, - Sts, - Much, - Trd, - Tof, - kEND ///< End of enumeration - }; - template<fles::Subsystem subsys> constexpr EDetectorID FromFlesSubsystem() { if constexpr (subsys == fles::Subsystem::STS) { - return EDetectorID::Sts; + return EDetectorID::kSts; } else if constexpr (subsys == fles::Subsystem::MVD) { - return EDetectorID::Mvd; + return EDetectorID::kMvd; } else if constexpr (subsys == fles::Subsystem::MUCH) { - return EDetectorID::Much; + return EDetectorID::kMuch; } else if constexpr (subsys == fles::Subsystem::TRD) { - return EDetectorID::Trd; + return EDetectorID::kTrd; } if constexpr (subsys == fles::Subsystem::TOF) { - return EDetectorID::Tof; + return EDetectorID::kTof; } else { - return EDetectorID::kEND; + return EDetectorID::END; } } template<EDetectorID detID> constexpr fles::Subsystem ToFlesSubsystem() { - if constexpr (detID == EDetectorID::Mvd) { + if constexpr (detID == EDetectorID::kMvd) { return fles::Subsystem::MVD; } - else if constexpr (detID == EDetectorID::Sts) { + else if constexpr (detID == EDetectorID::kSts) { return fles::Subsystem::STS; } - else if constexpr (detID == EDetectorID::Much) { + else if constexpr (detID == EDetectorID::kMuch) { return fles::Subsystem::MUCH; } - else if constexpr (detID == EDetectorID::Trd) { + else if constexpr (detID == EDetectorID::kTrd) { return fles::Subsystem::TRD; } - else if constexpr (detID == EDetectorID::Tof) { + else if constexpr (detID == EDetectorID::kTof) { return fles::Subsystem::TOF; } - else if constexpr (detID == EDetectorID::kEND) { + else if constexpr (detID == EDetectorID::END) { return fles::Subsystem::FLES; // Default () } } diff --git a/algo/ca/core/utils/CaEnumArray.h b/algo/ca/core/utils/CaEnumArray.h index a51e090ab239b83c7ebf60c345d8bd808828cc12..5acd385893cffa7941e92182c268f44adbe0aed8 100644 --- a/algo/ca/core/utils/CaEnumArray.h +++ b/algo/ca/core/utils/CaEnumArray.h @@ -22,39 +22,39 @@ namespace cbm::algo::ca /// This enumeration is to be used as the default template parameter enum class EDummy { - kEND + END }; /// \class cbm::algo::ca::EnumArray /// \brief Class of arrays, which can be accessed by an enum class entry as an index - /// \note The enum-array must contain an entry kEND, which represents the number of the enumeration entries and + /// \note The enum-array must contain an entry END, which represents the number of the enumeration entries and /// is used, as an array size /// \tparam E The enum class type /// \tparam T Type of data in the underlying array template<class E, class T> - class EnumArray : public std::array<T, static_cast<std::size_t>(E::kEND)> { + class EnumArray : public std::array<T, static_cast<std::size_t>(E::END)> { using U = typename std::underlying_type<E>::type; ///< Underlying type of enumeration - using Arr = std::array<T, static_cast<std::size_t>(E::kEND)>; + using Arr = std::array<T, static_cast<std::size_t>(E::END)>; public: /// \brief Mutable access operator, indexed by enum entry T& operator[](const E& entry) { - return std::array<T, static_cast<std::size_t>(E::kEND)>::operator[](static_cast<U>(entry)); + return std::array<T, static_cast<std::size_t>(E::END)>::operator[](static_cast<U>(entry)); } /// \brief Mutable access operator, indexed by underlying index type - T& operator[](U index) { return std::array<T, static_cast<std::size_t>(E::kEND)>::operator[](index); } + T& operator[](U index) { return std::array<T, static_cast<std::size_t>(E::END)>::operator[](index); } /// \brief Constant access operator, indexed by enum entry const T& operator[](const E& entry) const { - return std::array<T, static_cast<std::size_t>(E::kEND)>::operator[](static_cast<U>(entry)); + return std::array<T, static_cast<std::size_t>(E::END)>::operator[](static_cast<U>(entry)); } /// \brief Constant access operator, indexed by underlying index type /// \param index Index of the element - const T& operator[](U index) const { return std::array<T, static_cast<std::size_t>(E::kEND)>::operator[](index); } + const T& operator[](U index) const { return std::array<T, static_cast<std::size_t>(E::END)>::operator[](index); } /// \brief Convertion operator to the base array class operator Arr&() const { return *this; } diff --git a/algo/ca/core/utils/CaMonitorData.h b/algo/ca/core/utils/CaMonitorData.h index c1f0f8d7e88ec497f0a1e5c607235badf5e16dd5..09b3d0e1174cc385357d17eaff108538cc7d80ec 100644 --- a/algo/ca/core/utils/CaMonitorData.h +++ b/algo/ca/core/utils/CaMonitorData.h @@ -62,10 +62,10 @@ namespace cbm::algo::ca int GetCounterValue(ECounterKey key) const { return faCounters[key]; } /// \brief Gets number of counters - int GetNofCounters() const { return static_cast<int>(ECounterKey::kEND); } + int GetNofCounters() const { return static_cast<int>(ECounterKey::END); } /// \brief Gets number of timers - int GetNofTimers() const { return static_cast<int>(ETimerKey::kEND); } + int GetNofTimers() const { return static_cast<int>(ETimerKey::END); } /// \brief Gets timer const Timer& GetTimer(ETimerKey key) const { return faTimers[key]; } diff --git a/algo/ca/core/utils/CaTrackingMonitor.h b/algo/ca/core/utils/CaTrackingMonitor.h index da37a1632af59443b2af6eea71b6d2cafbaa56a9..f91de1d75ac356d14bbe01c330800d188b33788e 100644 --- a/algo/ca/core/utils/CaTrackingMonitor.h +++ b/algo/ca/core/utils/CaTrackingMonitor.h @@ -41,7 +41,7 @@ namespace cbm::algo::ca UndefinedMuchHit, ///< number of undefined MuCh hits UndefinedTrdHit, ///< number of undefined TRD hits UndefinedTofHit, ///< number of undefined TOF hits - kEND + END }; /// \enum ETimer @@ -71,8 +71,7 @@ namespace cbm::algo::ca StoreTracksWindow, StoreTracksFinal, Qa, - - kEND + END }; /* clang-format on */ diff --git a/algo/ca/qa/CaQa.h b/algo/ca/qa/CaQa.h index dc687a4221440491a6f0698975c7adc412bf3bf5..f0c0175a3bd4635d6dd5e449231d35365b915bf5 100644 --- a/algo/ca/qa/CaQa.h +++ b/algo/ca/qa/CaQa.h @@ -42,7 +42,7 @@ namespace cbm::algo::ca { Input, ///< Input hits Used, ///< Hits used in tracks - kEND + END }; /// \brief Definition of enum array over EHitSet entries diff --git a/core/data/CbmDefs.h b/core/data/CbmDefs.h index 09b9994427244a5cee7d7a82fb07b48b288008e6..65938836ea3aa7f2b5a159df2298a6dc915fb01b 100644 --- a/core/data/CbmDefs.h +++ b/core/data/CbmDefs.h @@ -165,6 +165,24 @@ enum class ECbmRecoMode Undefined }; +/** @brief CBM-specific definitions for CA-tracking + **/ +namespace cbm::algo::ca +{ + /** @enum EDetectorID + ** @brief Enumeration for the tracking detector subsystems in CBM-CA + **/ + enum class EDetectorID + { + kMvd = 0, + kSts, + kMuch, + kTrd, + kTof, + END + }; +} // namespace cbm::algo::ca + /** Global functions for particle masses **/ inline double CbmProtonMass() { return 0.938272046; } diff --git a/reco/L1/CbmCaMCModule.h b/reco/L1/CbmCaMCModule.h index a7c6eb2f4af3eefc437a46f6cafc91e9e0abfe7b..ce93b7500ee369bcf3317fbcab01d31351a93a8e 100644 --- a/reco/L1/CbmCaMCModule.h +++ b/reco/L1/CbmCaMCModule.h @@ -219,7 +219,7 @@ namespace cbm::ca kMissedMatchesMuch, ///< Number of missed matches in MuCh kMissedMatchesTrd, ///< Number of missed matches in TRD kMissedMatchesTof, ///< Number of missed TOF matches - kEND + END }; ca::Monitor<EMonitorKey> fMonitor{"CA MC Module"}; ///< Monitor diff --git a/reco/L1/CbmL1DetectorID.h b/reco/L1/CbmL1DetectorID.h index a56c8af09b15a8490a605be42543a6428323cdc0..c9899dc9d1556100c5b8fdcc9d59ad46b4a12f66 100644 --- a/reco/L1/CbmL1DetectorID.h +++ b/reco/L1/CbmL1DetectorID.h @@ -15,24 +15,6 @@ #include <string> -namespace cbm::algo::ca -{ - /// \enum cbm::algo::ca::EDetectorID - /// \brief Enumeration for the detector subsystems used in L1 tracking - /// It is important for the subsystems to be specified in the actual order. The order is used - /// for the ca::Station array filling. - /// \note The enumeration must not contain jumps in the ordering and the first entry must be equal 0 - enum class EDetectorID - { - kMvd = 0, - kSts, - kMuch, - kTrd, - kTof, - END ///< End of enumeration - }; -} // namespace cbm::algo::ca - /// ************************************************* /// ** Detector-dependent common definitions ** /// ************************************************* diff --git a/reco/L1/qa/CbmCaInputQaBase.h b/reco/L1/qa/CbmCaInputQaBase.h index 4fe628abc930c2373ca4e033f950208aa67f323a..acf00d0092e41331b135ea86a19b2e99ed3e85be 100644 --- a/reco/L1/qa/CbmCaInputQaBase.h +++ b/reco/L1/qa/CbmCaInputQaBase.h @@ -163,7 +163,7 @@ class CbmCaInputQaBase : public CbmQaTask { kHitAccepted, kMcPoint, kMcPointWrongStation, - kEND + END }; cbm::algo::ca::Monitor<EMonitorKey> fMonitor{}; ///< Monitor for the input QA diff --git a/reco/L1/qa/CbmCaOutputQa.cxx b/reco/L1/qa/CbmCaOutputQa.cxx index 2f6bfb721443d9c0dd82aab7b28c6ee3d5b8af3a..b86d12ba47066828cb44b623903ed9a62d5643a2 100644 --- a/reco/L1/qa/CbmCaOutputQa.cxx +++ b/reco/L1/qa/CbmCaOutputQa.cxx @@ -773,7 +773,7 @@ void OutputQa::CreateSummary() // ** Pulls and residuals ** // NOTE: stored in a subdirectory for a given track type and point type - for (int iType = 0; iType < ETrackType::kEND; ++iType) { + for (int iType = 0; iType < ETrackType::END; ++iType) { if (fvbTrackTypeOn[iType] && fvpTrackHistograms[iType]->IsMCUsed()) { fvpTrackHistograms[iType]->fpFitQaFirstHit->CreateResidualPlot(); fvpTrackHistograms[iType]->fpFitQaFirstHit->CreatePullPlot(); @@ -902,7 +902,7 @@ try { fvpTrackHistograms[type]->Init(); }; - //for (int i = 0; i < ETrackType::kEND; ++i) { + //for (int i = 0; i < ETrackType::END; ++i) { //LOG(info) << i << ' ' << fvpTrackHistograms[i].get() << ' ' << fvbTrackTypeOn[i]; //} diff --git a/reco/L1/qa/CbmCaOutputQa.h b/reco/L1/qa/CbmCaOutputQa.h index 3d0be68af90f7807b393fcedf5f8e05fb7cd0ed4..e832104c5255eb49606bc8ed43477b0dcb59df29 100644 --- a/reco/L1/qa/CbmCaOutputQa.h +++ b/reco/L1/qa/CbmCaOutputQa.h @@ -89,7 +89,7 @@ namespace cbm::ca // kPrim4HEBAR, // kSec4HE, // kSec4HEBAR, - kEND + END }; /// \brief QA-task for CA tracking output results @@ -104,7 +104,7 @@ namespace cbm::ca /// Array for track type properties template<typename T> - using TTypeArr_t = std::array<T, ETrackType::kEND>; + using TTypeArr_t = std::array<T, ETrackType::END>; /// \brief Structure to keep drawing attributes of histograms struct DrawAtt { @@ -274,7 +274,7 @@ namespace cbm::ca kHit, kMcTrack, kMcPoint, - kEND + END }; ca::Monitor<EMonitorKey> fMonitor{"Output tracking QA"}; diff --git a/reco/L1/qa/CbmCaTrackFitQa.cxx b/reco/L1/qa/CbmCaTrackFitQa.cxx index 4639814ea8413efa659238a6bbd867bd9f2d6ea8..ddaae1eaa142edf02a5b13a10552da46ef02bb65 100644 --- a/reco/L1/qa/CbmCaTrackFitQa.cxx +++ b/reco/L1/qa/CbmCaTrackFitQa.cxx @@ -52,7 +52,7 @@ CbmQaCanvas* TrackFitQa::CreateResidualPlot() pCanv->Divide2D(7); - for (int iType = static_cast<int>(ETrackParType::kBEGIN); iType < static_cast<int>(ETrackParType::kEND); ++iType) { + for (int iType = static_cast<int>(ETrackParType::BEGIN); iType < static_cast<int>(ETrackParType::END); ++iType) { ETrackParType type = static_cast<ETrackParType>(iType); if (fvbParIgnored[type]) { continue; @@ -71,7 +71,7 @@ CbmQaCanvas* TrackFitQa::CreatePullPlot() auto* pCanv = MakeQaObject<CbmQaCanvas>(fsPrefix + "_canv_pulls", " pulls", kCXSIZEPX * 4, kCYSIZEPX * 2); pCanv->Divide2D(7); - for (int iType = static_cast<int>(ETrackParType::kBEGIN); iType < static_cast<int>(ETrackParType::kEND); ++iType) { + for (int iType = static_cast<int>(ETrackParType::BEGIN); iType < static_cast<int>(ETrackParType::END); ++iType) { ETrackParType type = static_cast<ETrackParType>(iType); if (fvbParIgnored[type]) { continue; diff --git a/reco/L1/qa/CbmCaTrackFitQa.h b/reco/L1/qa/CbmCaTrackFitQa.h index 9f0e3474d8508d40a01572f1b6a2e2d1f3170c15..2b1e4ed4cb7178f36d26c4213e8040a43e93aa38 100644 --- a/reco/L1/qa/CbmCaTrackFitQa.h +++ b/reco/L1/qa/CbmCaTrackFitQa.h @@ -49,8 +49,8 @@ namespace cbm::ca kQP, ///< charge over total momentum kTIME, ///< time kVI, ///< inverse speed - kEND, ///< end of enumeration - kBEGIN = 0 ///< begin of enumeration + END, ///< end of enumeration + BEGIN = 0 ///< begin of enumeration }; /// @brief Prefix increment operator for ETrackParType