diff --git a/core/base/CMakeLists.txt b/core/base/CMakeLists.txt index 4f2cce4b560d924ba916968572a0030ef5d161f7..00ff9e160c7873077696ce4bf984c3e6fe512511 100644 --- a/core/base/CMakeLists.txt +++ b/core/base/CMakeLists.txt @@ -15,6 +15,7 @@ set(SRCS CbmRadDamage.cxx CbmHistManager.cxx CbmMatchRecoToMC.cxx + CbmTrackingDetectorInterfaceBase.cxx draw/CbmDrawHist.cxx report/CbmReport.cxx report/CbmStudyReport.cxx diff --git a/core/base/CbmTrackingDetectorInterfaceBase.cxx b/core/base/CbmTrackingDetectorInterfaceBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7e394603ab419959ed989c9aa3081d5380757a9e --- /dev/null +++ b/core/base/CbmTrackingDetectorInterfaceBase.cxx @@ -0,0 +1,91 @@ +/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Sergey Gorbunov, Sergei Zharko [committer] */ + +/// \file CbmTrackingDetectorInterfaceBase.h +/// \brief Base abstract class for tracking detector interface to L1 (implementation of Checker) +/// \since 31.05.2022 +/// \author S.Zharko (s.zharko@gsi.de) + +#include "CbmTrackingDetectorInterfaceBase.h" + +#include <Logger.h> + +#include <limits> +#include <set> +#include <vector> + +bool CbmTrackingDetectorInterfaceBase::Check() const +{ + bool res = true; + std::string prefix = std::string("Detector interface for ") + this->GetDetectorName() + ": "; + + // Number of stations + if (this->GetNtrackingStations() < 1) { + LOG(error) << prefix << "Number of stations is less then 1(" << this->GetNtrackingStations() << ")"; + res = false && res; + } + else { + // Position along beam axis + std::vector<double> zPositions(this->GetNtrackingStations()); + for (int iSt = 0; iSt < this->GetNtrackingStations(); ++iSt) { + zPositions[iSt] = this->GetZ(iSt); + } + std::set<double> zPositionSet(zPositions.begin(), zPositions.end()); + if (zPositions.size() != zPositionSet.size()) { + LOG(error) << prefix << "Some of stations have the same z position component:"; + for (size_t iSt = 0; iSt < zPositions.size(); ++iSt) { + LOG(error) << "\tstation " << iSt << ", z = " << zPositions[iSt] << " cm"; + } + res = false && res; + } + + // Station sizes check + for (int iSt = 0; iSt < this->GetNtrackingStations(); ++iSt) { + // Size along X-axis + if (this->GetXmax(iSt) < std::numeric_limits<double>::epsilon()) { + LOG(error) << prefix << "Station " << iSt << " has zero or negative X-size (" << this->GetXmax(iSt) << " cm)"; + res = false && res; + } + + // Size along Y-axis + if (this->GetYmax(iSt) < std::numeric_limits<double>::epsilon()) { + LOG(error) << prefix << "Station " << iSt << " has zero or negative Y-size (" << this->GetYmax(iSt) << " cm)"; + res = false && res; + } + + // Max station radius + if (this->GetRmax(iSt) < std::numeric_limits<double>::epsilon()) { + LOG(error) << prefix << "Station " << iSt << " has zero or negative outer radius (" << this->GetRmax(iSt) + << " cm)"; + res = false && res; + } + + // Min station radius + if (this->GetRmin(iSt) < 0) { + LOG(error) << prefix << "Station " << iSt << " has negative inner radius (" << this->GetRmin(iSt) << " cm)"; + res = false && res; + } + + // Front strips spatial resolution + if (this->GetStripsSpatialRmsFront(iSt) < std::numeric_limits<double>::epsilon()) { + LOG(error) << prefix << "Station " << iSt << " has zero or negative front strips spatial resolution (" + << this->GetStripsSpatialRmsFront(iSt) << " cm)"; + res = false && res; + } + + // Back strips spatial resolution + if (this->GetStripsSpatialRmsBack(iSt) < std::numeric_limits<double>::epsilon()) { + LOG(error) << prefix << "Station " << iSt << " has zero or negative back strips spatial resolution (" + << this->GetStripsSpatialRmsBack(iSt) << " cm)"; + res = false && res; + } + } + } + if (!res) { + LOG(error) << "\033[4mErrors above mean that CA tracking cannot be used for the current version of " + << this->GetDetectorName() << " setup. Please, check if the " << this->GetDetectorName() + << " setup parameters and the corresponding tracking detector interface are initialized properly\033[0m"; + } + return res; +} diff --git a/core/base/CbmTrackingDetectorInterfaceBase.h b/core/base/CbmTrackingDetectorInterfaceBase.h index 436c0a88b8e18174dbdee6949fb9c78f2e982e8e..349df6208683a635797a00ec31a7acc1462304c8 100644 --- a/core/base/CbmTrackingDetectorInterfaceBase.h +++ b/core/base/CbmTrackingDetectorInterfaceBase.h @@ -12,6 +12,8 @@ #ifndef CbmTrackingDetectorInterfaceBase_h #define CbmTrackingDetectorInterfaceBase_h 1 +#include <string> + class CbmPixelHit; /// Abstract class, which should be inherited by every detecting subsystem tracking interface class @@ -21,6 +23,9 @@ public: /// Virtual destructor virtual ~CbmTrackingDetectorInterfaceBase() {} + /// Returns the name of the detector subsystem + virtual std::string GetDetectorName() const = 0; + /// Gets actual number of stations, provided by the current geometry setup virtual int GetNtrackingStations() const = 0; @@ -104,6 +109,10 @@ public: // (decreases computting time, but can cause bugs) static constexpr bool kUseDynamicCast {true}; + + + /// Checks detector interface: boundary conditions of the parameters + bool Check() const; }; #endif // CbmTrackingDetectorInterfaceBase_h diff --git a/core/detectors/much/CbmMuchTrackingInterface.cxx b/core/detectors/much/CbmMuchTrackingInterface.cxx index dbce00539be2303c48f7bf71c8a66512d24b96d0..6aa020b4a9a0a5549b61cbd7093a0d118637d5a6 100644 --- a/core/detectors/much/CbmMuchTrackingInterface.cxx +++ b/core/detectors/much/CbmMuchTrackingInterface.cxx @@ -57,7 +57,7 @@ InitStatus CbmMuchTrackingInterface::Init() // Check initialization of the MuCh digi parameters file if (!fGeoScheme->IsInitialized()) { - LOG(fatal) << "CbmMuchTrackingInterface::Init: MuCh digi parameters were not initialized\n" + LOG(error) << "CbmMuchTrackingInterface::Init: MuCh digi parameters were not initialized\n" << "\033[4;1;32mNOTE\033[0m: For the MuCh digi parameters initialization please place the following " << "code to your macro:\n" << "\n\t// ----- MuCh digi parameters initialization --------------------------------------" @@ -74,6 +74,14 @@ InitStatus CbmMuchTrackingInterface::Init() << "\n\t if (!muchGeoScheme->IsInitialized()) { muchGeoScheme->Init(parFile, muchFlag); }" << "\n\t}" << "\n\t// --------------------------------------------------------------------------------"; + return kFATAL; + } + + // Check the validity of the parameters + if (!this->Check()) { + LOG(error) + << "Some errors occurred in the tracking detector interface initialization for MuCh (see information above)"; + return kFATAL; } return kSUCCESS; diff --git a/core/detectors/much/CbmMuchTrackingInterface.h b/core/detectors/much/CbmMuchTrackingInterface.h index 467bd8d4c40cdd30b9dcb259cfc7dbf4dfb87df1..260c79d1d11555f37173914d41624ffdf32e9894 100644 --- a/core/detectors/much/CbmMuchTrackingInterface.h +++ b/core/detectors/much/CbmMuchTrackingInterface.h @@ -51,6 +51,9 @@ public: /// Gets pointer to the instance of the CbmMuchTrackingInterface static CbmMuchTrackingInterface* Instance() { return fpInstance; } + /// Gets name of this subsystem + std::string GetDetectorName() const { return "MuCh"; } + /// Gets actual number of tracking stations, provided by the current geometry setup int GetNtrackingStations() const; diff --git a/core/detectors/sts/CbmStsTrackingInterface.cxx b/core/detectors/sts/CbmStsTrackingInterface.cxx index 3fc81ac48d371445a91f750b0e21206176a446f9..e7605fac0d513efa7ee7c9ec8ca5b6f131d5f4cd 100644 --- a/core/detectors/sts/CbmStsTrackingInterface.cxx +++ b/core/detectors/sts/CbmStsTrackingInterface.cxx @@ -65,6 +65,14 @@ InitStatus CbmStsTrackingInterface::Init() if (!stsSetup->IsSensorParsInit()) { stsSetup->SetSensorParameters(fStsParSetSensor); } if (!stsSetup->IsSensorCondInit()) { stsSetup->SetSensorConditions(fStsParSetSensorCond); } + + // Check the validity of the parameters + if (!this->Check()) { + LOG(error) + << "Some errors occurred in the tracking detector interface initialization for STS (see information above)"; + return kFATAL; + } + return kSUCCESS; } diff --git a/core/detectors/sts/CbmStsTrackingInterface.h b/core/detectors/sts/CbmStsTrackingInterface.h index 830efa4ee2a1410798aef3cbe1e557d4fc863e01..edc503e37e1994ffc0e1c1f1849177bb835c37d5 100644 --- a/core/detectors/sts/CbmStsTrackingInterface.h +++ b/core/detectors/sts/CbmStsTrackingInterface.h @@ -47,6 +47,9 @@ public: /// Gets pointer to the instance of the CbmStsTrackingInterface class static CbmStsTrackingInterface* Instance() { return fpInstance; } + /// Gets name of this subsystem + std::string GetDetectorName() const { return "STS"; } + /// Gets actual number of the tracking stations, provided by the current geometry setup int GetNtrackingStations() const { return CbmStsSetup::Instance()->GetNofStations(); } @@ -137,7 +140,7 @@ public: /// FairTask: sets parameter containers up void SetParContainers(); - /// Copy and move constructers and assign operators are forbidden + /// Copy and move constructors and assign operators are forbidden CbmStsTrackingInterface(const CbmStsTrackingInterface&) = delete; CbmStsTrackingInterface(CbmStsTrackingInterface&&) = delete; CbmStsTrackingInterface& operator=(const CbmStsTrackingInterface&) = delete; diff --git a/core/detectors/tof/CbmTofTrackingInterface.cxx b/core/detectors/tof/CbmTofTrackingInterface.cxx index 4f5a4dfc8a5734d673f307d6fa6cbc6d429a8ed9..ff5e3885590049815da59c8f4005898b881de88a 100644 --- a/core/detectors/tof/CbmTofTrackingInterface.cxx +++ b/core/detectors/tof/CbmTofTrackingInterface.cxx @@ -81,6 +81,13 @@ InitStatus CbmTofTrackingInterface::Init() fTofStationZ[iSt] = fTofStationZ[iSt] / nTofStationModules[iSt]; } + // Check the validity of the parameters + if (!this->Check()) { + LOG(error) + << "Some errors occurred in the tracking detector interface initialization for TOF (see information above)"; + return kFATAL; + } + return kSUCCESS; } diff --git a/core/detectors/tof/CbmTofTrackingInterface.h b/core/detectors/tof/CbmTofTrackingInterface.h index 5e53e389d559633e2d8a2cd75dbb18c6ce26d9c1..2f57e16a4402850a0cdd6f99041d50deb08bbdea 100644 --- a/core/detectors/tof/CbmTofTrackingInterface.h +++ b/core/detectors/tof/CbmTofTrackingInterface.h @@ -47,6 +47,9 @@ public: /// Gets pointer to the instance of the CbmTofTrackingInterface static CbmTofTrackingInterface* Instance() { return fpInstance; } + /// Gets name of this subsystem + std::string GetDetectorName() const { return "TOF"; } + /// Gets actual number of tracking stations, provided by the current geometry setup int GetNtrackingStations() const { return fDigiBdfPar->GetNbTrackingStations(); } diff --git a/core/detectors/trd/CbmTrdTrackingInterface.cxx b/core/detectors/trd/CbmTrdTrackingInterface.cxx index 4d044b4474c016cd64ea829ea316cb10eb77da5a..1a1722712071dcaf80b5b0fd3d475f4a0933c5b4 100644 --- a/core/detectors/trd/CbmTrdTrackingInterface.cxx +++ b/core/detectors/trd/CbmTrdTrackingInterface.cxx @@ -68,6 +68,13 @@ InitStatus CbmTrdTrackingInterface::Init() } } + // Check the validity of the parameters + if (!this->Check()) { + LOG(error) + << "Some errors occurred in the tracking detector interface initialization for TRD (see information above)"; + return kFATAL; + } + return kSUCCESS; } diff --git a/core/detectors/trd/CbmTrdTrackingInterface.h b/core/detectors/trd/CbmTrdTrackingInterface.h index 411a42bb0b6575af24f55abb80ef2cc73cf67357..197d4dcde85e597365c0dc6c0edbe87f7f71c22c 100644 --- a/core/detectors/trd/CbmTrdTrackingInterface.h +++ b/core/detectors/trd/CbmTrdTrackingInterface.h @@ -47,6 +47,9 @@ public: /// Gets pointer to the instance of the CbmTrdTrackingInterface static CbmTrdTrackingInterface* Instance() { return fpInstance; } + /// Gets name of this subsystem + std::string GetDetectorName() const { return "TRD"; } + /// Gets actual number of tracking stations, provided by the current geometry setup int GetNtrackingStations() const; diff --git a/mvd/CbmMvdTrackingInterface.cxx b/mvd/CbmMvdTrackingInterface.cxx index c7fb9961da6ee339307ff6a4c76dfba713ef8467..f3e9655ade94324d20d88832f61ba8c5e60eefc3 100644 --- a/mvd/CbmMvdTrackingInterface.cxx +++ b/mvd/CbmMvdTrackingInterface.cxx @@ -41,6 +41,13 @@ InitStatus CbmMvdTrackingInterface::Init() if (!fMvdStationPar) { return kFATAL; } + // Check the validity of the parameters + if (!this->Check()) { + LOG(error) + << "Some errors occurred in the tracking detector interface initialization for MuCh (see information above)"; + return kFATAL; + } + return kSUCCESS; } diff --git a/mvd/CbmMvdTrackingInterface.h b/mvd/CbmMvdTrackingInterface.h index f7604cbb4a7986b0fff88d209e0f1f0651031dca..b319bb9527cdff7c0d53436444ebc6f69cd056ea 100644 --- a/mvd/CbmMvdTrackingInterface.h +++ b/mvd/CbmMvdTrackingInterface.h @@ -46,6 +46,9 @@ public: /// Gets pointer to the instance of the CbmMvdTrackingInterface static CbmMvdTrackingInterface* Instance() { return fpInstance; } + /// Gets name of this subsystem + std::string GetDetectorName() const { return "MVD"; } + /// Gets actual number of tracking stations, provided by the current geometry setup int GetNtrackingStations() const { return fMvdStationPar->GetStationCount(); } diff --git a/reco/KF/CbmTrackingDetectorInterfaceInit.cxx b/reco/KF/CbmTrackingDetectorInterfaceInit.cxx index 759b78b803f3017581b91434ff7d22a02b82c5c6..25fdaceb7ceee72e7a1fc9d3f29159580a93981b 100644 --- a/reco/KF/CbmTrackingDetectorInterfaceInit.cxx +++ b/reco/KF/CbmTrackingDetectorInterfaceInit.cxx @@ -31,26 +31,26 @@ CbmTrackingDetectorInterfaceInit::CbmTrackingDetectorInterfaceInit() : FairTask( if (!fpInstance) { fpInstance = this; - /** Check presence of the desired detectors **/ - bool useMvd = CbmSetup::Instance()->IsActive(ECbmModuleId::kMvd); - bool useSts = CbmSetup::Instance()->IsActive(ECbmModuleId::kSts); - bool useMuch = CbmSetup::Instance()->IsActive(ECbmModuleId::kMuch); - bool useTrd = CbmSetup::Instance()->IsActive(ECbmModuleId::kTrd); - bool useTof = CbmSetup::Instance()->IsActive(ECbmModuleId::kTof); - - /** Invoke the detector interfaces **/ - if (useMvd) { fpMvdTrackingInterface = new CbmMvdTrackingInterface(); } - if (useSts) { fpStsTrackingInterface = new CbmStsTrackingInterface(); } - if (useMuch) { fpMuchTrackingInterface = new CbmMuchTrackingInterface(); } - if (useTrd) { fpTrdTrackingInterface = new CbmTrdTrackingInterface(); } - if (useTof) { fpTofTrackingInterface = new CbmTofTrackingInterface(); } - - /** Add subtasks - tracker detector interfaces **/ - if (useMvd) { this->Add(fpMvdTrackingInterface); } - if (useSts) { this->Add(fpStsTrackingInterface); } - if (useMuch) { this->Add(fpMuchTrackingInterface); } - if (useTrd) { this->Add(fpTrdTrackingInterface); } - if (useTof) { this->Add(fpTofTrackingInterface); } + // Check presence of the desired detectors + fbUseMvd = CbmSetup::Instance()->IsActive(ECbmModuleId::kMvd); + fbUseSts = CbmSetup::Instance()->IsActive(ECbmModuleId::kSts); + fbUseMuch = CbmSetup::Instance()->IsActive(ECbmModuleId::kMuch); + fbUseTrd = CbmSetup::Instance()->IsActive(ECbmModuleId::kTrd); + fbUseTof = CbmSetup::Instance()->IsActive(ECbmModuleId::kTof); + + // Invoke the detector interfaces + if (fbUseMvd) { fpMvdTrackingInterface = new CbmMvdTrackingInterface(); } + if (fbUseSts) { fpStsTrackingInterface = new CbmStsTrackingInterface(); } + if (fbUseMuch) { fpMuchTrackingInterface = new CbmMuchTrackingInterface(); } + if (fbUseTrd) { fpTrdTrackingInterface = new CbmTrdTrackingInterface(); } + if (fbUseTof) { fpTofTrackingInterface = new CbmTofTrackingInterface(); } + + // Add subtasks - tracker detector interfaces + if (fbUseMvd) { this->Add(fpMvdTrackingInterface); } + if (fbUseSts) { this->Add(fpStsTrackingInterface); } + if (fbUseMuch) { this->Add(fpMuchTrackingInterface); } + if (fbUseTrd) { this->Add(fpTrdTrackingInterface); } + if (fbUseTof) { this->Add(fpTofTrackingInterface); } } } @@ -60,6 +60,3 @@ CbmTrackingDetectorInterfaceInit::~CbmTrackingDetectorInterfaceInit() { if (fpInstance == this) { fpInstance = nullptr; } } - -//------------------------------------------------------------------------------------------------------------------------------------- -// diff --git a/reco/KF/CbmTrackingDetectorInterfaceInit.h b/reco/KF/CbmTrackingDetectorInterfaceInit.h index 0c488d65d6d6cbbbbdb5d4054731e77d37e6993d..9e55e65145861c066b2876d3298a9facd7787193 100644 --- a/reco/KF/CbmTrackingDetectorInterfaceInit.h +++ b/reco/KF/CbmTrackingDetectorInterfaceInit.h @@ -35,6 +35,7 @@ public: /// Returns a pointer to the class instance static CbmTrackingDetectorInterfaceInit* Instance() { return fpInstance; } + // Copy and move of the instance is prohibited CbmTrackingDetectorInterfaceInit(const CbmTrackingDetectorInterfaceInit&) = delete; CbmTrackingDetectorInterfaceInit(CbmTrackingDetectorInterfaceInit&&) = delete; @@ -48,6 +49,7 @@ public: CbmTrdTrackingInterface* GetTrdTrackingInterface() { return fpTrdTrackingInterface; } CbmTofTrackingInterface* GetTofTrackingInterface() { return fpTofTrackingInterface; } + private: static CbmTrackingDetectorInterfaceInit* fpInstance; ///< Instance of the class @@ -57,6 +59,13 @@ private: CbmTrdTrackingInterface* fpTrdTrackingInterface {nullptr}; ///< Instance of the TRD tracker interface CbmTofTrackingInterface* fpTofTrackingInterface {nullptr}; ///< Instance of the TOF tracker interface + bool fbUseMvd = false; ///< If MVD used in a setup + bool fbUseSts = false; ///< If STS used in a setup + bool fbUseMuch = false; ///< If MuCh used in a setup + bool fbUseTrd = false; ///< If TRD used in a setup + bool fbUseTof = false; ///< If TOF used in a setup + + ClassDef(CbmTrackingDetectorInterfaceInit, 0); }; diff --git a/reco/L1/L1Algo/L1CAIteration.cxx b/reco/L1/L1Algo/L1CAIteration.cxx index 6fc58614647e525a2b8c787b0894a9987f0a27c4..f643ba9ef484d8620bce56a6245371fd7fc70b9d 100644 --- a/reco/L1/L1Algo/L1CAIteration.cxx +++ b/reco/L1/L1Algo/L1CAIteration.cxx @@ -70,7 +70,7 @@ std::string L1CAIteration::ToString(int indentLevel) const std::stringstream aStream {}; constexpr char indCh = '\t'; std::string indent(indentLevel, indCh); - aStream << indent << "L1CAIteration: " << fName << '\n'; + aStream << indent << "\033[1;30m" << fName << "\033[0m\n"; aStream << indent << indCh << "Is primary: " << fIsPrimary << '\n'; aStream << indent << indCh << "Is electron: " << fIsElectron << '\n'; aStream << indent << indCh << "Are tracks created from triplets: " << fIsTrackFromTriplets << '\n'; diff --git a/reco/L1/L1Algo/L1Constants.h b/reco/L1/L1Algo/L1Constants.h index fa60945a4650f9661e474f1c618b1791496e4c51..e9517af00b4970434f33736fe1dffc38a0e8fe74 100644 --- a/reco/L1/L1Algo/L1Constants.h +++ b/reco/L1/L1Algo/L1Constants.h @@ -90,6 +90,109 @@ namespace L1Constants constexpr int k32I = L1NaN::SetNaN<int>(); constexpr unsigned int k32U = L1NaN::SetNaN<unsigned int>(); } // namespace noin + + + // Colors of terminal log + namespace clrs + { + // NOTE: To be used first, because different users may have different console bg and fg colors + constexpr char kCL[] = "\e[0m"; ///< clear + constexpr char kCLb[] = "\e[1m"; ///< clear bold + constexpr char kCLi[] = "\e[3m"; ///< clear italic + constexpr char kCLu[] = "\e[4m"; ///< clear underline + constexpr char kCLr[] = "\e[7m"; ///< clear reverse + constexpr char kCLbi[] = "\e[1;3m"; ///< clear bold-italic + constexpr char kCLbu[] = "\e[1;4m"; ///< clear bold-underline + constexpr char kCLbr[] = "\e[1;7m"; ///< clear bold-reverse + + // regular + constexpr char kBK[] = "\e[30m"; ///< normal black + constexpr char kRD[] = "\e[31m"; ///< normal red + constexpr char kGN[] = "\e[32m"; ///< normal green + constexpr char kYL[] = "\e[33m"; ///< normal yellow + constexpr char kBL[] = "\e[34m"; ///< normal blue + constexpr char kMG[] = "\e[35m"; ///< normal magenta + constexpr char kCY[] = "\e[36m"; ///< normal cyan + constexpr char kGY[] = "\e[37m"; ///< normal grey + constexpr char kWT[] = "\e[38m"; ///< normal white + + // bold + constexpr char kBKb[] = "\e[1;30m"; ///< bold black + constexpr char kRDb[] = "\e[1;31m"; ///< bold red + constexpr char kGNb[] = "\e[1;32m"; ///< bold green + constexpr char kYLb[] = "\e[1;33m"; ///< bold yellow + constexpr char kBLb[] = "\e[1;34m"; ///< bold blue + constexpr char kMGb[] = "\e[1;35m"; ///< bold magenta + constexpr char kCYb[] = "\e[1;36m"; ///< bold cyan + constexpr char kGYb[] = "\e[1;37m"; ///< bold grey + constexpr char kWTb[] = "\e[1;38m"; ///< bold white + + // italic + constexpr char kBKi[] = "\e[3;30m"; ///< italic black + constexpr char kRDi[] = "\e[3;31m"; ///< italic red + constexpr char kGNi[] = "\e[3;32m"; ///< italic green + constexpr char kYLi[] = "\e[3;33m"; ///< italic yellow + constexpr char kBLi[] = "\e[3;34m"; ///< italic blue + constexpr char kMGi[] = "\e[3;35m"; ///< italic magenta + constexpr char kCYi[] = "\e[3;36m"; ///< italic cyan + constexpr char kGYi[] = "\e[3;37m"; ///< italic grey + constexpr char kWTi[] = "\e[3;38m"; ///< italic white + + // underline + constexpr char kBKu[] = "\e[4;30m"; ///< underline black + constexpr char kRDu[] = "\e[4;31m"; ///< underline red + constexpr char kGNu[] = "\e[4;32m"; ///< underline green + constexpr char kYLu[] = "\e[4;33m"; ///< underline yellow + constexpr char kBLu[] = "\e[4;34m"; ///< underline blue + constexpr char kMGu[] = "\e[4;35m"; ///< underline magenta + constexpr char kCYu[] = "\e[4;36m"; ///< underline cyan + constexpr char kGYu[] = "\e[4;37m"; ///< underline grey + constexpr char kWTu[] = "\e[4;38m"; ///< underline white + + // reverse + constexpr char kBKr[] = "\e[7;30m"; ///< reverse black + constexpr char kRDr[] = "\e[7;31m"; ///< reverse red + constexpr char kGNr[] = "\e[7;32m"; ///< reverse green + constexpr char kYLr[] = "\e[7;33m"; ///< reverse yellow + constexpr char kBLr[] = "\e[7;34m"; ///< reverse blue + constexpr char kMGr[] = "\e[7;35m"; ///< reverse magenta + constexpr char kCYr[] = "\e[7;36m"; ///< reverse cyan + constexpr char kGYr[] = "\e[7;37m"; ///< reverse grey + constexpr char kWTr[] = "\e[7;38m"; ///< reverse white + + // bold-underline + constexpr char kBKbu[] = "\e[1;4;30m"; ///< bold-underline black + constexpr char kRDbu[] = "\e[1;4;31m"; ///< bold-underline red + constexpr char kGNbu[] = "\e[1;4;32m"; ///< bold-underline green + constexpr char kYLbu[] = "\e[1;4;33m"; ///< bold-underline yellow + constexpr char kBLbu[] = "\e[1;4;34m"; ///< bold-underline blue + constexpr char kMGbu[] = "\e[1;4;35m"; ///< bold-underline magenta + constexpr char kCYbu[] = "\e[1;4;36m"; ///< bold-underline cyan + constexpr char kGYbu[] = "\e[1;4;37m"; ///< bold-underline grey + constexpr char kWTbu[] = "\e[1;4;38m"; ///< bold-underline white + + // bold-italic + constexpr char kBKbi[] = "\e[1;3;30m"; ///< bold-italic black + constexpr char kRDbi[] = "\e[1;3;31m"; ///< bold-italic red + constexpr char kGNbi[] = "\e[1;3;32m"; ///< bold-italic green + constexpr char kYLbi[] = "\e[1;3;33m"; ///< bold-italic yellow + constexpr char kBLbi[] = "\e[1;3;34m"; ///< bold-italic blue + constexpr char kMGbi[] = "\e[1;3;35m"; ///< bold-italic magenta + constexpr char kCYbi[] = "\e[1;3;36m"; ///< bold-italic cyan + constexpr char kGYbi[] = "\e[1;3;37m"; ///< bold-italic grey + constexpr char kWTbi[] = "\e[1;3;38m"; ///< bold-italic white + + // bold-reverse + constexpr char kBKbr[] = "\e[1;7;30m"; ///< bold-reverse black + constexpr char kRDbr[] = "\e[1;7;31m"; ///< bold-reverse red + constexpr char kGNbr[] = "\e[1;7;32m"; ///< bold-reverse green + constexpr char kYLbr[] = "\e[1;7;33m"; ///< bold-reverse yellow + constexpr char kBLbr[] = "\e[1;7;34m"; ///< bold-reverse blue + constexpr char kMGbr[] = "\e[1;7;35m"; ///< bold-reverse magenta + constexpr char kCYbr[] = "\e[1;7;36m"; ///< bold-reverse cyan + constexpr char kGYbr[] = "\e[1;7;37m"; ///< bold-reverse grey + constexpr char kWTbr[] = "\e[1;7;38m"; ///< bold-reverse white + } // namespace clrs } // end namespace L1Constants diff --git a/reco/L1/L1Algo/L1InitManager.cxx b/reco/L1/L1Algo/L1InitManager.cxx index eb27a04ba5ecc028a901cca2b1810422d1aaf47c..cd35b13995aae3d3f8eb74fdc72aa2471cfdb4d1 100644 --- a/reco/L1/L1Algo/L1InitManager.cxx +++ b/reco/L1/L1Algo/L1InitManager.cxx @@ -282,9 +282,7 @@ void L1InitManager::ReadParametersObject(const std::string& fileName) bool L1InitManager::SendParameters(L1Algo* pAlgo) { assert(pAlgo); - std::cout << "\033[1;32m" << fParameters.ToString() << "\033[0m\n"; pAlgo->ReceiveParameters(std::move(fParameters)); - std::cout << "\033[1;31m" << fParameters.ToString() << "\033[0m\n"; return true; } diff --git a/reco/L1/L1Algo/L1Parameters.cxx b/reco/L1/L1Algo/L1Parameters.cxx index debee2427a0be8de719e13c6d1dacb7d3b1decc3..78b3aebc776cdd77e0e7e1ca77dba61a871b21fa 100644 --- a/reco/L1/L1Algo/L1Parameters.cxx +++ b/reco/L1/L1Algo/L1Parameters.cxx @@ -216,36 +216,40 @@ void L1Parameters::Print(int /*verbosityLevel*/) const { LOG(info) << ToString() std::string L1Parameters::ToString(int verbosity, int indentLevel) const { // FIXME: SZh: Fill it with other parameters + using namespace L1Constants::clrs; // color the log text std::stringstream aStream {}; constexpr char indentChar = '\t'; std::string indent(indentLevel, indentChar); aStream << '\n'; - aStream << indent << "--------------------------------------------------------------------------------\n"; - aStream << indent << " L1 parameters list\n"; - aStream << indent << "--------------------------------------------------------------------------------\n"; - aStream << indent << "COMPILE TIME CONSTANTS:\n"; + aStream << indent + << "----- L1 parameters list -------------------------------------------------------------------------\n"; + + aStream << indent << kCLb << "COMPILE TIME CONSTANTS:\n" << kCL; aStream << indent << indentChar << "Bits to code one station: " << L1Constants::size::kStationBits << '\n'; aStream << indent << indentChar << "Bits to code one thread: " << L1Constants::size::kThreadBits << '\n'; aStream << indent << indentChar << "Bits to code one triplet: " << L1Constants::size::kTripletBits << '\n'; aStream << indent << indentChar << "Max number of stations: " << L1Constants::size::kMaxNstations << '\n'; aStream << indent << indentChar << "Max number of threads: " << L1Constants::size::kMaxNthreads << '\n'; aStream << indent << indentChar << "Max number of triplets: " << L1Constants::size::kMaxNtriplets << '\n'; - aStream << indent << "RUNTIME CONSTANTS:\n"; + aStream << indent << kCLb << "RUNTIME CONSTANTS:\n" << kCL; aStream << indent << indentChar << "Max number of doublets per singlet: " << fMaxDoubletsPerSinglet << '\n'; aStream << indent << indentChar << "Max number of triplets per doublet: " << fMaxTripletPerDoublets << '\n'; - aStream << indent << "CA TRACK FINDER ITERATIONS:\n"; + aStream << indent << indentChar << "Tracking level: " << fTrackingLevel << '\n'; + aStream << indent << indentChar << "Ghost suppresion: " << fGhostSuppression << '\n'; + aStream << indent << indentChar << "Min tracks momentum: " << fMomentumCutOff << '\n'; + aStream << indent << indentChar << "Max number of triplets per doublet: " << fMaxTripletPerDoublets << '\n'; + aStream << indent << kCLb << "CA TRACK FINDER ITERATIONS:\n" << kCL; for (int idx = 0; idx < static_cast<int>(fCAIterations.size()); ++idx) { - aStream << idx << ") " << fCAIterations[idx].ToString(indentLevel + 1) << '\n'; + aStream << indent << indentChar << idx << ") " << fCAIterations[idx].ToString(indentLevel + 1) << '\n'; } - aStream << indent << "GEOMETRY:\n"; - - aStream << indent << indentChar << "TARGET:\n"; + aStream << indent << kCLb << "GEOMETRY:\n" << kCL; + aStream << indent << indentChar << kCLb << "TARGET:\n" << kCL; aStream << indent << indentChar << indentChar << "Position:\n"; for (int dim = 0; dim < 3 /*nDimensions*/; ++dim) { aStream << indent << indentChar << indentChar << indentChar << char(120 + dim) << " = " << fTargetPos[dim][0] << " cm\n"; } - aStream << indent << indentChar << "NUMBER OF STATIONS:\n"; + aStream << indent << indentChar << kCLb << "NUMBER OF STATIONS:\n" << kCL; aStream << indent << indentChar << indentChar << "Number of stations (Geometry): "; for (int idx = 0; idx < int(fNstationsGeometry.size()); ++idx) { aStream << std::setw(2) << std::setfill(' ') << fNstationsGeometry[idx] << ' '; @@ -259,17 +263,22 @@ std::string L1Parameters::ToString(int verbosity, int indentLevel) const aStream << " | total = " << std::setw(2) << std::setfill(' ') << fNstationsActiveTotal; aStream << '\n'; aStream << indent << indentChar << indentChar << "Active station indexes: "; - for (int idx = 0; idx < *(fNstationsActive.end() - 1); ++idx) { + for (int idx = 0; idx < fNstationsActiveTotal; ++idx) { aStream << std::setw(3) << std::setfill(' ') << fActiveStationGlobalIDs[idx] << ' '; } aStream << '\n'; - aStream << indent << indentChar << "STATIONS:\n "; - for (int idx = 0; idx < *(fNstationsActive.end() - 1); ++idx) { - aStream << indent << indentChar << indentChar << fStations[idx].ToString(verbosity) << '\n'; + aStream << indent << indentChar << kCLb << "STATIONS:\n" << kCL; + for (int idx = 0; idx < fNstationsActiveTotal; ++idx) { + aStream << indent << indentChar << idx << ") " << fStations[idx].ToString(verbosity, indentLevel + 2) << '\n'; } - aStream << indent << "FLAGS:\n"; - aStream << indent << "--------------------------------------------------------------------------------\n"; + aStream << indent << kCLb << "DEV FLAGS:" << kCL << " (for debug only)\n"; + aStream << indent << indentChar << "Hits search area is ignored: " << fDevIsIgnoreHitSearchAreas << '\n'; + aStream << indent << indentChar << "Non-approx. field is used: " << fDevIsMatchDoubletsViaMc << '\n'; + aStream << indent << indentChar << "Doublets vs. MC matching: " << fDevIsMatchDoubletsViaMc << '\n'; + aStream << indent << indentChar << "Triplets vs. MC matching: " << fDevIsMatchTripletsViaMc << '\n'; + aStream << indent + << "--------------------------------------------------------------------------------------------------\n"; return aStream.str(); } diff --git a/reco/L1/L1Algo/L1Station.cxx b/reco/L1/L1Algo/L1Station.cxx index e6671a197898006fa44bcd5702e6d7d1ce17e0fc..17fa68f124c30d2534c2fcd404ff90cbac8c2376 100644 --- a/reco/L1/L1Algo/L1Station.cxx +++ b/reco/L1/L1Algo/L1Station.cxx @@ -113,34 +113,34 @@ std::string L1Station::ToString(int verbosityLevel, int indentLevel) const std::stringstream aStream {}; constexpr char indentChar = '\t'; std::string indent(indentLevel, indentChar); - if (verbosityLevel > 1) { - // TODO: probably we can have verbosity level and address for each underlying object (S.Zharko) - } - if (verbosityLevel == 0) { aStream << "L1Station at z = " << z[0] << " cm"; } + if (verbosityLevel == 0) { aStream << "station type = " << type << ", z = " << z[0] << " cm"; } else { - aStream << '\n' << indent << "Address: " << this << '\n'; - aStream << indent << "Station type ID: " << std::setw(12) << std::setfill(' ') << type << '\n'; - aStream << indent << "Is time info used: " << std::setw(12) << std::setfill(' ') << timeInfo << '\n'; - aStream << indent << "Is station placed in field: " << std::setw(12) << std::setfill(' ') << fieldStatus << '\n'; - aStream << indent << "z position [cm]: " << std::setw(12) << std::setfill(' ') << z[0] << '\n'; - aStream << indent << "Rmin [cm]: " << std::setw(12) << std::setfill(' ') << Rmin[0] << '\n'; - aStream << indent << "Rmax [cm]: " << std::setw(12) << std::setfill(' ') << Rmax[0] << '\n'; + aStream << '\n'; + aStream << indent << "z pos [cm]: " << std::setw(12) << std::setfill(' ') << z[0] << '\n'; + aStream << indent << "R_min [cm]: " << std::setw(12) << std::setfill(' ') << Rmin[0] << '\n'; + aStream << indent << "R_max [cm]: " << std::setw(12) << std::setfill(' ') << Rmax[0] << '\n'; + aStream << indent << "Station type: " << std::setw(12) << std::setfill(' ') << type << '\n'; + aStream << indent << "Is time used: " << std::setw(12) << std::setfill(' ') << timeInfo << '\n'; + aStream << indent << "Is in field: " << std::setw(12) << std::setfill(' ') << fieldStatus << '\n'; aStream << materialInfo.ToString(indentLevel) << '\n'; - if (verbosityLevel > 1) { + + if (verbosityLevel > 3) { aStream << indent << "Field approcimation coefficients:\n"; aStream << fieldSlice.ToString(indentLevel + 1) << '\n'; } - aStream << indent << "Strips geometry:\n"; - aStream << indent << indentChar << "Front:\n"; - aStream << frontInfo.ToString(indentLevel + 2) << '\n'; - aStream << indent << indentChar << "Back:\n"; - aStream << backInfo.ToString(indentLevel + 2) << '\n'; - aStream << indent << indentChar << "XY cov matrix:\n"; - aStream << XYInfo.ToString(indentLevel + 2) << '\n'; - aStream << indent << indentChar << "X layer:\n"; - aStream << xInfo.ToString(indentLevel + 2) << '\n'; - aStream << indent << indentChar << "Y layer:\n"; - aStream << yInfo.ToString(indentLevel + 2) << '\n'; + if (verbosityLevel > 2) { + aStream << indent << "Strips geometry:\n"; + aStream << indent << indentChar << "Front:\n"; + aStream << frontInfo.ToString(indentLevel + 2) << '\n'; + aStream << indent << indentChar << "Back:\n"; + aStream << backInfo.ToString(indentLevel + 2) << '\n'; + aStream << indent << indentChar << "XY cov matrix:\n"; + aStream << XYInfo.ToString(indentLevel + 2) << '\n'; + aStream << indent << indentChar << "X layer:\n"; + aStream << xInfo.ToString(indentLevel + 2) << '\n'; + aStream << indent << indentChar << "Y layer:\n"; + aStream << yInfo.ToString(indentLevel + 2) << '\n'; + } } return aStream.str(); }