From 61a9f40869dafe9a42138b2176c8134bebd7eca1 Mon Sep 17 00:00:00 2001 From: "s.zharko@gsi.de" <s.zharko@gsi.de> Date: Thu, 17 Feb 2022 18:45:02 +0100 Subject: [PATCH] L1Algo: refactoring of small classes + introduction of ToString methods --- reco/L1/L1Algo/L1Algo.cxx | 2 +- reco/L1/L1Algo/L1BaseStationInfo.cxx | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/reco/L1/L1Algo/L1Algo.cxx b/reco/L1/L1Algo/L1Algo.cxx index bebda2986c..fb28467132 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++]; + 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/L1BaseStationInfo.cxx b/reco/L1/L1Algo/L1BaseStationInfo.cxx index 648cb0fd32..0ad560312a 100644 --- a/reco/L1/L1Algo/L1BaseStationInfo.cxx +++ b/reco/L1/L1Algo/L1BaseStationInfo.cxx @@ -439,3 +439,28 @@ 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