diff --git a/algo/ca/core/utils/CaDefines.h b/algo/ca/core/utils/CaDefines.h index ae101e651f80a85f94ae0543357d13e90c1d4ce7..04e58e80136a5cfc82cf8803709cc70ab9c9ffc4 100644 --- a/algo/ca/core/utils/CaDefines.h +++ b/algo/ca/core/utils/CaDefines.h @@ -21,8 +21,26 @@ std::cerr << __FILE__ << ":" << __LINE__ << " assertion failed: " << #v << " = " << (v) << std::endl; \ assert(v); \ } + +#define CBMCA_DEBUG_SHOW(expr) \ + std::cout << __FILE__ << ":" << __LINE__ << ": \033[01;38;5;208m" << (#expr) << "\033[0m = " << (expr) << "\n" + +#define CBMCA_DEBUG_SHOWF(msg) \ + std::cout << "(!) " << __FILE__ << ":" << __LINE__ << ": \033[01;38;5;208m" << (#msg) << "\033[0m\n" + +#define CBMCA_DEBUG_SHOWCONTAINER(cont) \ + std::cout << __FILE__ << ":" << __LINE__ << ": \033[01;38;5;208m" << (#cont) << "\033[0m: "; \ + std::for_each(cont.cbegin(), cont.cend(), [](const auto& el) { std::cout << el << ' '; }); \ + std::cout << '\n'; + #else // not CBMCA_DEBUG_MODE #define CBMCA_DEBUG_ASSERT(v) +#define CBMCA_DEBUG_SHOW(expr) + +#define CBMCA_DEBUG_SHOWF(msg) + +#define CBMCA_DEBUG_SHOWCONTAINER(cont) + #endif // CBMCA_DEBUG_MODE diff --git a/reco/KF/ParticleFitter/CbmL1PFFitter.cxx b/reco/KF/ParticleFitter/CbmL1PFFitter.cxx index 8118377e9d09dcb68114b78699a35e5179183f85..b4a6162c7a9387bd2ef526ab018b7cbc3c228e6d 100644 --- a/reco/KF/ParticleFitter/CbmL1PFFitter.cxx +++ b/reco/KF/ParticleFitter/CbmL1PFFitter.cxx @@ -41,7 +41,6 @@ #include "CaTrackParam.h" #include "KFParticleDatabase.h" #include "L1Algo.h" // Also defines L1Parameters -#include "L1Def.h" //typedef ca::TrackFit1 ca::TrackFit; diff --git a/reco/KF/obsolete/CbmL1TofMerger.cxx b/reco/KF/obsolete/CbmL1TofMerger.cxx index 791cc190211ef8364ba75e9e7e83cac6377f77fe..a3cf09a6644d56f87ff7ad10b3d2e5cad3565d43 100644 --- a/reco/KF/obsolete/CbmL1TofMerger.cxx +++ b/reco/KF/obsolete/CbmL1TofMerger.cxx @@ -22,8 +22,6 @@ #include <map> #include <utility> -#include "L1Def.h" - using std::cout; using std::endl; using std::make_pair; diff --git a/reco/KF/obsolete/CbmL1TrackMerger.cxx b/reco/KF/obsolete/CbmL1TrackMerger.cxx index 2acf4de2e1736e0b5335e5b814127ca8b6d7090d..f4c93462fb17cbc27ea6c0c83795cb8b2c440401 100644 --- a/reco/KF/obsolete/CbmL1TrackMerger.cxx +++ b/reco/KF/obsolete/CbmL1TrackMerger.cxx @@ -23,8 +23,6 @@ #include <iostream> #include <map> -#include "L1Def.h" - using std::cout; using std::endl; using std::map; diff --git a/reco/L1/CMakeLists.txt b/reco/L1/CMakeLists.txt index d86fb29b54707ea5067c0fd29683a562416ce820..3ab91e31e305edf2c3c06c5f19a96572f1848252 100644 --- a/reco/L1/CMakeLists.txt +++ b/reco/L1/CMakeLists.txt @@ -89,7 +89,6 @@ set(HEADERS CbmL1Hit.h CbmL1Track.h CbmL1Vtx.h - L1Algo/L1Def.h L1Algo/utils/CaUvConverter.h catools/CaToolsWindowFinder.h catools/CaToolsLinkKey.h @@ -181,15 +180,10 @@ generate_cbm_library() add_dependencies(G__L1 KFPARTICLE) install(FILES CbmL1Counters.h -# L1Algo/L1Assert.h - L1Algo/L1Utils.h utils/CbmCaIdealHitProducer.h utils/CbmCaIdealHitProducerDet.h L1Algo/utils/CaUvConverter.h qa/CbmCaInputQaBase.h -# L1Algo/inactive/L1EventEfficiencies.h -# L1Algo/inactive/L1Event.h -# L1Algo/inactive/L1EventMatch.h DESTINATION include ) diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index 79f9218e4ff1e6538a229eabf625ea798beff795..f32cff1496a7c8269905801f604c861d1acc0a25 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -421,7 +421,6 @@ InitStatus CbmL1::Init() } fInitManager.SetDetectorNames(cbm::ca::kDetName); - L1_SHOW(fInitManager.GetDetectorName(ca::EDetectorID::kSts)); auto mvdInterface = CbmMvdTrackingInterface::Instance(); auto stsInterface = CbmStsTrackingInterface::Instance(); @@ -1103,7 +1102,6 @@ void CbmL1::DefineSTAPNames(const char* dirName) TString sDirName = TString(dirName); if (sDirName.Length() == 0) { fSTAPDataDir = pathToRecoOutput.parent_path().string(); - L1_SHOW(fSTAPDataDir); } else if (bfs::exists(sDirName.Data()) && bfs::is_directory(sDirName.Data())) { fSTAPDataDir = sDirName; diff --git a/reco/L1/CbmL1Performance.cxx b/reco/L1/CbmL1Performance.cxx index 83cdcf733afdc9c06611465fb1183b0e12345f0e..51d507a1bb582609dba313dd20c38a123544aaaa 100644 --- a/reco/L1/CbmL1Performance.cxx +++ b/reco/L1/CbmL1Performance.cxx @@ -57,8 +57,7 @@ #include "CaToolsDebugger.h" #include "CaTrackFit.h" -#include "L1Algo/L1Algo.h" -#include "L1Algo/L1Def.h" +#include "L1Algo.h" using cbm::ca::tools::Debugger; using std::cout; diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h index 9ed463c9df57504e8b5a9d6f84e41388fb452358..e625198f28e0704481fa293a012ad9198313094a 100644 --- a/reco/L1/L1Algo/L1Algo.h +++ b/reco/L1/L1Algo/L1Algo.h @@ -12,7 +12,6 @@ // #define DRAW // event display #ifdef DRAW class L1AlgoDraw; -#include "CbmL1Track.h" #endif //#define XXX // time debug //#define COUNTERS // diff counters (hits, doublets, ... ) @@ -20,8 +19,6 @@ class L1AlgoDraw; //#define GLOBAL //#define mCBM -#define FIND_GAPED_TRACKS // use triplets with gaps - #include <array> #include <iomanip> #include <iostream> @@ -43,7 +40,6 @@ class L1AlgoDraw; #include "CaTriplet.h" #include "CaVector.h" #include "L1CloneMerger.h" -#include "L1Utils.h" using namespace cbm::algo::ca; //TODO: remove @@ -219,7 +215,6 @@ public: #ifdef DRAW L1AlgoDraw* draw {nullptr}; - void DrawRecoTracksTime(const Vector<CbmL1Track>& tracks); #endif /// TODO: Move to L1 @@ -363,19 +358,19 @@ private: 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 {L1Utils::kNaN}; + fvec fMaxDZ {constants::Undef<fvec>}; /// parameters which are different for different iterations. Set in the begin of CAL1TrackFinder - float fPickGather {L1Utils::kNaN}; ///< same for attaching additional hits to track - float fTripletLinkChi2 {L1Utils::kNaN}; ///< (dp2/dp_error2 < fTripletLinkChi2) => triplets are neighbours - fvec fMaxInvMom {L1Utils::kNaN}; ///< max considered q/p for tracks - fvec fMaxSlopePV {L1Utils::kNaN}; ///< max slope (tx\ty) in prim vertex - float fMaxSlope {L1Utils::kNaN}; ///< 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 {L1Utils::kNaN}; ///< target position x coordinate for the current iteration (modifiable) - fvec fTargY {L1Utils::kNaN}; ///< target position y coordinate for the current iteration (modifiable) - fvec fTargZ {L1Utils::kNaN}; ///< 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 diff --git a/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx b/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx index f5e481871dc8939c88967cc6505ad03305943ed0..ca2249227bca77dda5f6fc01dcb328250fe07d3e 100644 --- a/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx +++ b/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx @@ -865,12 +865,3 @@ void L1Algo::CAFindTrack(int ista, ca::Branch& best_tr, const ca::Triplet* curr_ } // for neighbours } // level = 0 } - -#ifdef DRAW -void L1Algo::DrawRecoTracksTime(const cbm::algo::ca::Vector<CbmL1Track>& tracks) -{ - // TODO: find where the DrawRecoTracksTime is. It is missing in the git repository. - //draw->DrawRecoTracksTime(tracks); - draw->SaveCanvas(" "); -} -#endif diff --git a/reco/L1/L1Algo/L1CloneMerger.cxx b/reco/L1/L1Algo/L1CloneMerger.cxx index c592bec15fe08ea54ec07db05cbaa217b45d79a2..707d12ba6c27af5aa420ca1b55334d4403a82905 100644 --- a/reco/L1/L1Algo/L1CloneMerger.cxx +++ b/reco/L1/L1Algo/L1CloneMerger.cxx @@ -63,9 +63,6 @@ void L1CloneMerger::Exec(Vector<Track>& extTracks, Vector<ca::HitIndex_t>& extRe ca::HitIndex_t start_hit = 0; -#ifdef OMP -#pragma omp parallel for -#endif for (int iTr = 0; iTr < nTracks; iTr++) { firstHit[iTr] = start_hit; firstStation[iTr] = frAlgo.GetInputData().GetHit(extRecoHits[start_hit]).Station(); @@ -98,9 +95,6 @@ void L1CloneMerger::Exec(Vector<Track>& extTracks, Vector<ca::HitIndex_t>& extRe // Max length for merging unsigned char maxLengthForMerge = static_cast<unsigned char>(frAlgo.GetParameters()->GetNstationsActive() - 3); -#ifdef OMP -#pragma omp parallel for -#endif for (int iTr = 0; iTr < nTracks; iTr++) { if (extTracks[iTr].fNofHits > maxLengthForMerge) continue; for (int jTr = 0; jTr < nTracks; jTr++) { diff --git a/reco/L1/L1Algo/L1CloneMerger.h b/reco/L1/L1Algo/L1CloneMerger.h index 41a16f16a948a6e3f5f6d4e65926d943c27a094d..d115dac8c5596ab79cc48b08f2d3553acb121d55 100644 --- a/reco/L1/L1Algo/L1CloneMerger.h +++ b/reco/L1/L1Algo/L1CloneMerger.h @@ -13,7 +13,6 @@ #include "CaHit.h" // For ca::HitIndex_t #include "CaSimd.h" // TEMPORARY FOR fvec, fscal #include "CaVector.h" -//#include "L1Def.h" using namespace cbm::algo::ca; //TODO: remove diff --git a/reco/L1/L1Algo/L1Def.h b/reco/L1/L1Algo/L1Def.h deleted file mode 100644 index 3db98677f681111f33a267252e1ee1acdfc25770..0000000000000000000000000000000000000000 --- a/reco/L1/L1Algo/L1Def.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 2010-2021 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt - SPDX-License-Identifier: GPL-3.0-only - Authors: Maksym Zyzak, Igor Kulakov [committer], Sergey Gorbunov */ - -#ifndef L1Def_h -#define L1Def_h - -// #define FAST_CODE // FAST_CODE = more unsafe - -#include <iostream> - -#ifdef FAST_CODE - -#define L1_NO_ASSERT // use with asserts, etc. - -#else // FAST_CODE - - -#endif // FAST_CODE - - -#if defined(NDEBUG) || defined(L1_NO_ASSERT) - -// Prints expression value to the std::cout -#define L1_SHOW(expr) - -// Prints file and line information to the std::cout -#define L1_SHOWF(msg) - -#else - -#define L1_SHOW(expr) \ - std::cout << __FILE__ << ":" << __LINE__ << ": \033[01;38;5;208m" << (#expr) << "\033[0m = " << (expr) << "\n" -#define L1_SHOWF(msg) \ - std::cout << "(!) " << __FILE__ << ":" << __LINE__ << ": \033[01;38;5;208m" << (#msg) << "\033[0m\n" -#define L1_SHOWCONTAINER(cont) \ - std::cout << __FILE__ << ":" << __LINE__ << ": \033[01;38;5;208m" << (#cont) << "\033[0m: "; \ - std::for_each(cont.cbegin(), cont.cend(), [](const auto& el) { std::cout << el << ' '; }); \ - std::cout << '\n'; - -#endif - -#endif diff --git a/reco/L1/L1Algo/L1Utils.h b/reco/L1/L1Algo/L1Utils.h deleted file mode 100644 index cfd3f0c5c0e6731fd7a7f8d7e152b5591320f214..0000000000000000000000000000000000000000 --- a/reco/L1/L1Algo/L1Utils.h +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Sergey Gorbunov, Sergei Zharko [committer] */ - -/************************************************************************************************************ - * @file L1Utils.h - * @brief File contains some general purpose functions for L1Algo - * @since 12.01.2022 - ***********************************************************************************************************/ -#ifndef L1Utils_h -#define L1Utils_h 1 - -#include <chrono> -#include <iomanip> -#include <limits> -#include <map> -#include <sstream> -#include <string> -#include <type_traits> -#include <unordered_map> - -#include <cmath> - -#include "AlgoFairloggerCompat.h" -#include "CaSimd.h" -#include "CaUtils.h" -#include "L1Def.h" - -// TODO: SZh 16.05.2023: Split this class into several headers and place them into L1Algo::utils - - -/// Class contains some utility functions for L1Algo -namespace L1Utils -{ - /// NaN value for float - // TODO: SZh 16.05.2023: Replace this kNaN with L1Undef::kF - constexpr float kNaN {std::numeric_limits<float>::signaling_NaN()}; - - /// Comparison method for floats - /// \param lhs Left floating point to compare - /// \param rhs Right floating point to compare - /// \return Comparison result: true - equals within epsilon - template<typename T, typename std::enable_if<std::is_floating_point<T>::value, T>::type* = nullptr> - [[gnu::always_inline]] inline bool CmpFloats(T lhs, T rhs) - { - return fabs(lhs - rhs) < 2. * std::numeric_limits<T>::epsilon() * fabs(lhs + rhs) - || fabs(lhs - rhs) < std::numeric_limits<T>::min(); - } - - using cbm::algo::ca::utils::CheckSimdVectorEquality; - - /// Hash for unordered_map with enum class keys - struct EnumClassHash { - template<typename T> - int operator()(T t) const - { - return static_cast<int>(t); - } - }; - - /// A time profiler for measuring performace of scopes - class TimeProfiler { - public: - /// Constructor - TimeProfiler(const char* scopeName) : fScopeName(scopeName), fStart(std::chrono::high_resolution_clock::now()) - { - LOG(info) << "---------- Time measurement in scope \033[1;32m" << fScopeName << "\033[0m: Start"; - } - - /// Destructor - ~TimeProfiler() - { - auto stop = std::chrono::high_resolution_clock::now(); - auto time = std::chrono::duration_cast<std::chrono::nanoseconds>(stop - fStart).count(); - LOG(info) << "---------- Time measurement in scope \033[1;32m" << fScopeName - << "\033[0m: Finish. Result: " << time << " ns"; - } - - private: - const char* fScopeName {}; - const std::chrono::high_resolution_clock::time_point fStart {}; - }; -} // namespace L1Utils - -#endif // L1Utils_h diff --git a/reco/L1/L1Algo/utils/CaUvConverter.h b/reco/L1/L1Algo/utils/CaUvConverter.h index 236ab406af46d1b060475743eea88e2fc289869b..5f356f05d8b43a082cf66d88cfd4aec416634209 100644 --- a/reco/L1/L1Algo/utils/CaUvConverter.h +++ b/reco/L1/L1Algo/utils/CaUvConverter.h @@ -7,7 +7,6 @@ #include "CaConstants.h" -#include "L1Def.h" namespace cbm::ca { diff --git a/reco/L1/L1Algo/utils/L1AlgoDraw.h b/reco/L1/L1Algo/utils/L1AlgoDraw.h index a58c2e770a5010ba632dc6b09cf2699a03d2c252..dbb0d68b08028ddd643d1b7a34bbb5f7267a5dc0 100644 --- a/reco/L1/L1Algo/utils/L1AlgoDraw.h +++ b/reco/L1/L1Algo/utils/L1AlgoDraw.h @@ -13,7 +13,6 @@ #include "CaHit.h" #include "CaStation.h" #include "CaTriplet.h" -#include "L1Def.h" namespace { diff --git a/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h b/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h index d4f0cb52b303149b9671cc173bec13f6d8f0bddd..07656bb9c18ed44b2bc737897f6fcd33abf56459 100644 --- a/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h +++ b/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h @@ -19,7 +19,6 @@ #include <vector> #include "L1Algo.h" -#include "L1Def.h" using std::cout; using std::endl; diff --git a/reco/L1/L1Algo/utils/L1AlgoPulls.h b/reco/L1/L1Algo/utils/L1AlgoPulls.h index 3b105391a93eec34c892eb365a0f913971ad4e62..e82bc5cf25e9cdbbcdf44afabb2ecc6411ffe147 100644 --- a/reco/L1/L1Algo/utils/L1AlgoPulls.h +++ b/reco/L1/L1Algo/utils/L1AlgoPulls.h @@ -25,7 +25,6 @@ const int NStations = 0; #include "CaTrackParam.h" #include "L1Algo.h" -#include "L1Def.h" using std::cout; using std::endl; diff --git a/reco/L1/qa/CbmCaTrackFitQa.cxx b/reco/L1/qa/CbmCaTrackFitQa.cxx index 7a8f8b3ee73b4bdad63010e045f1d9b5f486ea1a..97875b5c4b1bcda45c3605793edc984452ec0f0b 100644 --- a/reco/L1/qa/CbmCaTrackFitQa.cxx +++ b/reco/L1/qa/CbmCaTrackFitQa.cxx @@ -24,7 +24,6 @@ #include "CaToolsField.h" #include "CaToolsMCData.h" #include "CaTrackFit.h" -#include "L1Utils.h" using namespace cbm::algo::ca; diff --git a/reco/L1/utils/CbmCaIdealHitProducerDet.h b/reco/L1/utils/CbmCaIdealHitProducerDet.h index 0673146101f7a617d85121ce6e93d40b23fc8496..e196a632778f02c1258bac994a1f57438177c14f 100644 --- a/reco/L1/utils/CbmCaIdealHitProducerDet.h +++ b/reco/L1/utils/CbmCaIdealHitProducerDet.h @@ -56,7 +56,6 @@ #include "CaAlgoRandom.h" #include "CaConstants.h" #include "CaUvConverter.h" -#include "L1Def.h" namespace cbm::ca {