From 5af486797f5ef09d035cf34e10aaa45f0d1bea27 Mon Sep 17 00:00:00 2001 From: "s.zharko@gsi.de" <s.zharko@gsi.de> Date: Fri, 4 Mar 2022 22:23:01 +0100 Subject: [PATCH] Rebased to L1AlgoDev2 --- reco/L1/CbmL1.cxx | 2 +- reco/L1/L1Algo/L1Algo.cxx | 2 +- reco/L1/L1Algo/L1Algo.h | 2 +- reco/L1/L1Algo/L1Assert.h | 33 +++++++++++++++++----------- reco/L1/L1Algo/L1BaseStationInfo.cxx | 25 --------------------- 5 files changed, 23 insertions(+), 41 deletions(-) diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index d5e83ce1fa..0182c1ad2a 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -68,10 +68,10 @@ #include <list> #include "L1Algo/L1Algo.h" +#include "L1Algo/L1Assert.h" #include "L1Algo/L1Branch.h" #include "L1Algo/L1Field.h" #include "L1Algo/L1Hit.h" -#include "L1Algo/L1Assert.h" #include "L1AlgoInputData.h" #include "L1Event.h" diff --git a/reco/L1/L1Algo/L1Algo.cxx b/reco/L1/L1Algo/L1Algo.cxx index fb28467132..81b39ed6ad 100644 --- a/reco/L1/L1Algo/L1Algo.cxx +++ b/reco/L1/L1Algo/L1Algo.cxx @@ -130,7 +130,7 @@ void L1Algo::Init(const L1Vector<fscal>& geo, const bool UseHitErrors, const Tra double f_sigma = geo[ind++]; double b_phi = geo[ind++]; double b_sigma = geo[ind++]; - double dt = geo[ind++]; //TODO: Add this field to L1BaseStationInfo and to ToString fcn (S.Zharko) + double dt = geo[ind++]; //TODO: Add this field to L1BaseStationInfo and to ToString fcn (S.Zharko) double c_f = cos(f_phi); double s_f = sin(f_phi); double c_b = cos(b_phi); diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h index 670211ee1c..b80d01f9c5 100644 --- a/reco/L1/L1Algo/L1Algo.h +++ b/reco/L1/L1Algo/L1Algo.h @@ -40,7 +40,7 @@ class L1AlgoDraw; /********************************************************************************* ************ TEMPORARY MACROS, SHOULD BE REMOVED (TODO!!, S. Zharko) *********** * */ - + #define FEATURING_L1ALGO_INIT 1 // If defined, new initialization will be used, if not - the old one // Macro: 1 - new track finder loop, other - old track finder loop #define FEATURING_L1ALGO_CATRACKFINDER_ITERATIONLOOP 1 diff --git a/reco/L1/L1Algo/L1Assert.h b/reco/L1/L1Algo/L1Assert.h index a08eca9315..d285846274 100644 --- a/reco/L1/L1Algo/L1Assert.h +++ b/reco/L1/L1Algo/L1Assert.h @@ -21,23 +21,26 @@ #define L1ASSERT(LEVEL, COND) #define L1MASSERT(LEVEL, COND, MSG) #else -#define L1ASSERT(LEVEL, COND) L1Assert::DoAssertion<(LEVEL) <= L1Assert::kAssertionLevel>((LEVEL), (COND), (#COND), __FILE__, __LINE__) -#define L1MASSERT(LEVEL, COND, MSG) L1Assert::DoAssertion<(LEVEL) <= L1Assert::kAssertionLevel>((LEVEL), (COND), (MSG), __FILE__, __LINE__) -#endif // defined(NDEBUG) || defined(L1_NO_ASSERT) +#define L1ASSERT(LEVEL, COND) \ + L1Assert::DoAssertion<(LEVEL) <= L1Assert::kAssertionLevel>((LEVEL), (COND), (#COND), __FILE__, __LINE__) +#define L1MASSERT(LEVEL, COND, MSG) \ + L1Assert::DoAssertion<(LEVEL) <= L1Assert::kAssertionLevel>((LEVEL), (COND), (MSG), __FILE__, __LINE__) +#endif // defined(NDEBUG) || defined(L1_NO_ASSERT) -namespace L1Assert { +namespace L1Assert +{ /// Assertion levels - /// 0 - - /// 1 - - /// 2 - + /// 0 - + /// 1 - + /// 2 - constexpr int kAssertionLevel {1}; - + /// Basic template function. Usage: place "level >= L1Assert::kAssertionLevel" //template <bool IsAsserted> //int DoAssertion (int level, bool condition, const char* msg, const char* fileName, int lineNo); /// Specialization in case of IsAsserted = true, i.e. the assertion is made - template <bool IsAsserted> + template<bool IsAsserted> int DoAssertion(int level, bool condition, const char* msg, const char* fileName, int lineNo) { if (!condition) { @@ -48,8 +51,12 @@ namespace L1Assert { } /// Specialization in case of IsAsserted = false, i.e. the assertion is not made - template <> - constexpr int DoAssertion<false>(int /*level*/, bool /*condition*/, const char* /*msg*/, const char* /*fileName*/, int /*lineNo*/) { return 0; } -}; + template<> + constexpr int DoAssertion<false>(int /*level*/, bool /*condition*/, const char* /*msg*/, const char* /*fileName*/, + int /*lineNo*/) + { + return 0; + } +}; // namespace L1Assert -#endif // L1Assert_h +#endif // L1Assert_h diff --git a/reco/L1/L1Algo/L1BaseStationInfo.cxx b/reco/L1/L1Algo/L1BaseStationInfo.cxx index 0ad560312a..648cb0fd32 100644 --- a/reco/L1/L1Algo/L1BaseStationInfo.cxx +++ b/reco/L1/L1Algo/L1BaseStationInfo.cxx @@ -439,28 +439,3 @@ std::string L1BaseStationInfo::ToString(int verbosityLevel, int indentLevel) con } return aStream.str(); } - -//----------------------------------------------------------------------------------------------------------------------// -// -std::string L1BaseStationInfo::ToString(int verbosityLevel, int indentLevel) const -{ - std::stringstream aStream {}; - constexpr char indentChar = '\t'; - std::string indent(indentLevel, indentChar); - - if (verbosityLevel == 0) { - aStream << indent << "L1BaseStationInfo object: {stationID, detectorID, address} = {" << fStationID << ", " - << static_cast<int>(fDetectorID) << ", " << this << '}'; - } - else if (verbosityLevel > 0) { - aStream << indent << "L1BaseStationInfo object: at " << this << '\n'; - aStream << indent << indentChar << "Station ID: " << fStationID << '\n'; - aStream << indent << indentChar << "Detector ID: " << static_cast<int>(fDetectorID) << '\n'; - aStream << indent << indentChar << "L1Station object:" << '\n'; - aStream << fL1Station.ToString(verbosityLevel - 1, indentLevel + 1) << '\n'; - aStream << indent << indentChar << "Additional fields:\n"; - aStream << indent << indentChar << indentChar << "Xmax: " << fXmax << '\n'; - aStream << indent << indentChar << indentChar << "Ymax: " << fYmax << '\n'; - } - return aStream.str(); -} -- GitLab