diff --git a/algo/ca/core/data/CaHit.h b/algo/ca/core/data/CaHit.h index 71ec43e75a5d6617ed3eb6295756a9f8e1020c8d..b013a13da058695b54f4b75b7349207c6233578c 100644 --- a/algo/ca/core/data/CaHit.h +++ b/algo/ca/core/data/CaHit.h @@ -12,7 +12,6 @@ #include <boost/serialization/access.hpp> -#include <sstream> #include <string> namespace cbm::algo::ca diff --git a/algo/ca/core/tracking/CaTrackExtender.cxx b/algo/ca/core/tracking/CaTrackExtender.cxx index 8c7f292b1abd2d0175484d5f5c2a9eb9b6642969..4cea6693ee3fa5c03bd8667c76c85b2225aab200 100644 --- a/algo/ca/core/tracking/CaTrackExtender.cxx +++ b/algo/ca/core/tracking/CaTrackExtender.cxx @@ -4,6 +4,7 @@ #include "CaTrackExtender.h" +#include "AlgoFairloggerCompat.h" #include "CaBranch.h" #include "CaDefines.h" #include "CaFramework.h" @@ -15,10 +16,7 @@ #include <iostream> -// using namespace std; using cbm::algo::ca::Vector; // TMP!! -using std::cout; -using std::endl; using namespace cbm::algo::ca; diff --git a/algo/ca/core/tracking/CaTrackFinderWindow.cxx b/algo/ca/core/tracking/CaTrackFinderWindow.cxx index ab625fc587fa97e64f0722fa342da32ac83365f7..0a26c0d3a39414dd5a66740925ffd9c4d321ae14 100644 --- a/algo/ca/core/tracking/CaTrackFinderWindow.cxx +++ b/algo/ca/core/tracking/CaTrackFinderWindow.cxx @@ -21,6 +21,7 @@ #include "CaTrackFinderWindow.h" +#include "AlgoFairloggerCompat.h" #include "CaBranch.h" #include "CaFramework.h" #include "CaGrid.h" @@ -35,13 +36,10 @@ #include <iostream> #include <list> #include <map> +#include <sstream> // #include "CaToolsDebugger.h" - -// using namespace std; -using std::cout; -using std::endl; using Track = cbm::algo::ca::Track; using namespace cbm::algo::ca; @@ -140,11 +138,11 @@ void TrackFinderWindow::ReadWindowData() } if constexpr (fDebug) { - std::cout << "===== Sliding Window hits: " << std::endl; + LOG(info) << "===== Sliding Window hits: "; for (int i = 0; i < nHits; ++i) { - std::cout << " " << frAlgo.fWindowHits[i].ToString() << std::endl; + LOG(info) << " " << frAlgo.fWindowHits[i].ToString(); } - std::cout << "===== " << std::endl; + LOG(info) << "===== "; } frAlgo.fHitFirstTriplet.reset(nHits, 0); @@ -520,13 +518,13 @@ void TrackFinderWindow::CaTrackFinderSlice() tr.SetId(frAlgo.fTrackCandidates.size() - 1); tr.SetAlive(true); if constexpr (fDebug) { - cout << "iter " << frAlgo.fCurrentIterationIndex << ", track candidate " - << frAlgo.fTrackCandidates.size() - 1 << " found, L = " << best_tr.NofHits() - << " chi2= " << best_tr.Chi2() << " hits: "; + std::stringstream s; + s << "iter " << frAlgo.fCurrentIterationIndex << ", track candidate " << frAlgo.fTrackCandidates.size() - 1 + << " found, L = " << best_tr.NofHits() << " chi2= " << best_tr.Chi2() << " hits: "; for (auto hitId : tr.Hits()) { - cout << hitId << " (mc " << frAlgo.GetMcTrackIdForCaHit(hitId) << ") "; + s << hitId << " (mc " << frAlgo.GetMcTrackIdForCaHit(hitId) << ") "; } - cout << endl; + LOG(info) << s.str(); } } // itrip } // istaF @@ -623,7 +621,7 @@ void TrackFinderWindow::CaTrackFinderSlice() } // competitions - // cout << " N Competitions: " << iComp << endl; + // LOG(info) << " N Competitions: " << iComp ; // == @@ -631,8 +629,8 @@ void TrackFinderWindow::CaTrackFinderSlice() ca::Branch& tr = frAlgo.fTrackCandidates[iCandidate]; if constexpr (fDebug) { - cout << "iter " << frAlgo.fCurrentIterationIndex << ", track candidate " << iCandidate - << ": alive = " << tr.IsAlive() << std::endl; + LOG(info) << "iter " << frAlgo.fCurrentIterationIndex << ", track candidate " << iCandidate + << ": alive = " << tr.IsAlive(); } if (!tr.IsAlive()) continue; @@ -657,12 +655,13 @@ void TrackFinderWindow::CaTrackFinderSlice() t.fNofHits = tr.NofHits(); frAlgo.fSliceRecoTracks.push_back(t); if (0) { // SG debug - cout << "store track " << iCandidate << " chi2= " << tr.Chi2() << endl; - cout << " hits: "; + std::stringstream s; + s << "store track " << iCandidate << " chi2= " << tr.Chi2() << "\n"; + s << " hits: "; for (unsigned int ih = 0; ih < tr.Hits().size(); ih++) { - cout << frAlgo.GetMcTrackIdForCaHit(tr.Hits()[ih]) << " "; + s << frAlgo.GetMcTrackIdForCaHit(tr.Hits()[ih]) << " "; } - cout << '\n'; + LOG(info) << s.str(); } } // tracks @@ -786,11 +785,11 @@ void TrackFinderWindow::CAFindTrack(int ista, ca::Branch& best_tr, const ca::Tri int mc12 = frAlgo.GetMcTrackIdForWindowHit(new_trip.GetMHit()); int mc13 = frAlgo.GetMcTrackIdForWindowHit(new_trip.GetRHit()); if ((mc01 == mc02) && (mc02 == mc03)) { - cout << " sta " << ista << " mc0 " << mc01 << " " << mc02 << " " << mc03 << " mc1 " << mc11 << " " << mc12 - << " " << mc13 << " chi2 " << curr_tr.Chi2() / (2 * (curr_tr.NofHits() + 2) - 4) << " new " - << new_chi2 / (2 * (new_L + 2) - 4) << endl; - cout << " hits " << curr_trip->GetLHit() << " " << curr_trip->GetMHit() << " " << curr_trip->GetRHit() - << " " << new_trip.GetLHit() << endl; + LOG(info) << " sta " << ista << " mc0 " << mc01 << " " << mc02 << " " << mc03 << " mc1 " << mc11 << " " + << mc12 << " " << mc13 << " chi2 " << curr_tr.Chi2() / (2 * (curr_tr.NofHits() + 2) - 4) + << " new " << new_chi2 / (2 * (new_L + 2) - 4); + LOG(info) << " hits " << curr_trip->GetLHit() << " " << curr_trip->GetMHit() << " " + << curr_trip->GetRHit() << " " << new_trip.GetLHit(); } } diff --git a/algo/ca/core/tracking/CaTrackFitter.cxx b/algo/ca/core/tracking/CaTrackFitter.cxx index f58e2ef8ac786261d66f1e1a3e8efcbdf5f1c46f..c5a8e6386a49af27a060e22e1e214f743b78c1de 100644 --- a/algo/ca/core/tracking/CaTrackFitter.cxx +++ b/algo/ca/core/tracking/CaTrackFitter.cxx @@ -11,8 +11,6 @@ #include <iostream> #include <vector> -using std::cout; -using std::endl; using std::vector; using Track = cbm::algo::ca::Track; @@ -32,7 +30,7 @@ TrackFitter::~TrackFitter() {} // void TrackFitter::FitCaTracks() { - // cout << " Start CA Track Fitter " << endl; + // LOG(info) << " Start CA Track Fitter "; int start_hit = 0; // for interation in frAlgo.fSliceRecoHits[] // static ca::FieldValue fldB0, fldB1, fldB2 _fvecalignment; diff --git a/algo/ca/core/tracking/CaTripletConstructor.cxx b/algo/ca/core/tracking/CaTripletConstructor.cxx index 53ddcc1d9de12c2e57ebdb0fc3b3c5363be69f85..e88613a7a5e1b15bd95ef4f1995c3beddc207800 100644 --- a/algo/ca/core/tracking/CaTripletConstructor.cxx +++ b/algo/ca/core/tracking/CaTripletConstructor.cxx @@ -11,6 +11,7 @@ #include <algorithm> #include <iostream> // #include "CaToolsDebugger.h" +#include "AlgoFairloggerCompat.h" #include "CaTrackFit.h" #include "CaTrackParam.h" @@ -339,12 +340,12 @@ void TripletConstructor::FindRightHit() const ca::Hit& h0 = fAlgo->fInputData.GetHit(ih0); const ca::Hit& h1 = fAlgo->fInputData.GetHit(ih1); - std::cout << "\n====== Extrapolated Doublet : " + LOG(info) << "\n====== Extrapolated Doublet : " << " iter " << fAlgo->fCurrentIterationIndex << " hits: {" << fIstaL << "/" << ih0 << " " << fIstaM << "/" << ih1 << " " << fIstaR << "/?} xyz: {" << h0.X() << " " << h0.Y() << " " << h0.Z() << "}, {" << h1.X() << " " << h1.Y() << " " << h1.Z() << "} chi2 " << T2.GetChiSq()[0] << " ndf " << T2.Ndf()[0] - << " chi2time " << T2.ChiSqTime()[0] << " ndfTime " << T2.NdfTime()[0] << std::endl; - std::cout << " extr. track: " << T2.ToString(0) << std::endl; + << " chi2time " << T2.ChiSqTime()[0] << " ndfTime " << T2.NdfTime()[0]; + LOG(info) << " extr. track: " << T2.ToString(0); } // ---- Find the triplets(right hit). Reformat data in the portion of triplets. ---- @@ -375,11 +376,11 @@ void TripletConstructor::FindRightHit() if constexpr (fDebugDublets) { if (isDoubletGood) { - std::cout << " extrapolated doublet accepted" << std::endl; + LOG(info) << " extrapolated doublet accepted"; } else { - std::cout << " extrapolated doublet rejected" << std::endl; - std::cout << "======== end of extrapolated doublet ==== \n" << std::endl; + LOG(info) << " extrapolated doublet rejected"; + LOG(info) << "======== end of extrapolated doublet ==== \n"; } } @@ -397,18 +398,18 @@ void TripletConstructor::FindRightHit() collectedHits.clear(); } if constexpr (fDebugDublets) { - std::cout << " collected " << collectedHits.size() << " hits on the right station " << std::endl; + LOG(info) << " collected " << collectedHits.size() << " hits on the right station "; } for (unsigned int ih = 0; ih < collectedHits.size(); ih++) { ca::HitIndex_t irh = collectedHits[ih]; if constexpr (fDebugDublets) { ca::HitIndex_t ihit = fAlgo->fWindowHits[irh].Id(); const ca::Hit& h = fAlgo->fInputData.GetHit(ihit); - std::cout << " hit " << ihit << " " << h.ToString() << std::endl; + LOG(info) << " hit " << ihit << " " << h.ToString(); } if (fAlgo->fIsWindowHitSuppressed[irh]) { if constexpr (fDebugDublets) { - std::cout << " the hit is suppressed" << std::endl; + LOG(info) << " the hit is suppressed"; } continue; } @@ -417,7 +418,7 @@ void TripletConstructor::FindRightHit() fHitsR_3.push_back(irh); } // search area if constexpr (fDebugDublets) { - std::cout << "======== end of extrapolated doublet ==== \n" << std::endl; + LOG(info) << "======== end of extrapolated doublet ==== \n"; } } // i2 } @@ -608,12 +609,12 @@ void TripletConstructor::FitTriplets() const ca::Hit& h1 = fAlgo->fInputData.GetHit(ih1); const ca::Hit& h2 = fAlgo->fInputData.GetHit(ih2); //const CbmL1MCTrack& mctr = CbmL1::Instance()->GetMcTracks()[mc1]; - std::cout << "== fitted triplet: " + LOG(info) << "== fitted triplet: " << " iter " << fAlgo->fCurrentIterationIndex << " hits: {" << fIstaL << "/" << ih0 << " " << fIstaM << "/" << ih1 << " " << fIstaR << "/" << ih2 << "} xyz: {" << h0.X() << " " << h0.Y() << " " << h0.Z() << "}, {" << h1.X() << " " << h1.Y() << " " << h1.Z() << "}, {" << h2.X() << ", " << h2.Y() << ", " << h2.Z() << "} chi2 " << T.GetChiSq()[0] << " ndf " << T.Ndf()[0] << " chi2time " << T.ChiSqTime()[0] - << " ndfTime " << T.NdfTime()[0] << std::endl; + << " ndfTime " << T.NdfTime()[0]; /* cbm::ca::tools::Debugger::Instance().FillNtuple( "triplets", mctr.iEvent, fAlgo->fCurrentIterationIndex, ih0, h0.X(), h0.Y(), h0.Z(), ih1, h1.X(), h1.Y(), @@ -692,7 +693,7 @@ void TripletConstructor::CollectHits(const TrackParamV& Tr, const int iSta, cons fFit.SetTrack(Tr); TrackParamV& T = fFit.Tr(); - //std::cout << T.chi2[0] << std::endl; + //LOG(info) << T.chi2[0] ; T.ChiSq() = 0.; // if make it bigger the found hits will be rejected later because of the chi2 cut. const fvec Pick_m22 = (fvec(chi2Cut) - T.GetChiSq()); @@ -705,9 +706,9 @@ void TripletConstructor::CollectHits(const TrackParamV& Tr, const int iSta, cons (sqrt(Pick_m22 * T.C00()) + grid.GetMaxRangeX() + fAlgo->fMaxDZ * abs(T.Tx()))[0], (sqrt(Pick_m22 * T.C11()) + grid.GetMaxRangeY() + fAlgo->fMaxDZ * abs(T.Ty()))[0]); if constexpr (fDebugCollectHits) { - std::cout << "search area: " << T.X()[0] << " " << T.Y()[0] << " " + LOG(info) << "search area: " << T.X()[0] << " " << T.Y()[0] << " " << (sqrt(Pick_m22 * T.C00()) + grid.GetMaxRangeX() + fAlgo->fMaxDZ * abs(T.Tx()))[0] << " " - << (sqrt(Pick_m22 * T.C11()) + grid.GetMaxRangeY() + fAlgo->fMaxDZ * abs(T.Ty()))[0] << std::endl; + << (sqrt(Pick_m22 * T.C11()) + grid.GetMaxRangeY() + fAlgo->fMaxDZ * abs(T.Ty()))[0]; } if (fAlgo->fParameters.DevIsIgnoreHitSearchAreas()) { area.DoLoopOverEntireGrid(); @@ -722,13 +723,13 @@ void TripletConstructor::CollectHits(const TrackParamV& Tr, const int iSta, cons const ca::Hit& hit = fAlgo->fWindowHits[ih]; if constexpr (fDebugCollectHits) { - std::cout << "hit in the search area: " << hit.ToString() << std::endl; - std::cout << " check the hit.. " << std::endl; + LOG(info) << "hit in the search area: " << hit.ToString(); + LOG(info) << " check the hit.. "; } if (iMC >= 0) { // match via MC if (iMC != fAlgo->GetMcTrackIdForWindowHit(ih)) { if constexpr (fDebugCollectHits) { - std::cout << " hit mc does not match" << std::endl; + LOG(info) << " hit mc does not match"; } continue; } @@ -740,7 +741,7 @@ void TripletConstructor::CollectHits(const TrackParamV& Tr, const int iSta, cons if ((sta.timeInfo) && (T.NdfTime()[0] >= 0)) { if (fabs(time - hit.T()) > 1.4 * (3.5 * sqrt(timeError2) + hit.RangeT())) { if constexpr (fDebugCollectHits) { - std::cout << " hit time does not match" << std::endl; + LOG(info) << " hit time does not match"; } continue; } @@ -762,7 +763,7 @@ void TripletConstructor::CollectHits(const TrackParamV& Tr, const int iSta, cons if (fabs(dY) > dy_est) { if constexpr (fDebugCollectHits) { - std::cout << " hit Y does not match" << std::endl; + LOG(info) << " hit Y does not match"; } continue; } @@ -776,7 +777,7 @@ void TripletConstructor::CollectHits(const TrackParamV& Tr, const int iSta, cons if (fabs(dX) > dx_est) { if constexpr (fDebugCollectHits) { - std::cout << " hit X does not match" << std::endl; + LOG(info) << " hit X does not match"; } continue; } @@ -793,19 +794,19 @@ void TripletConstructor::CollectHits(const TrackParamV& Tr, const int iSta, cons if (!fAlgo->fpCurrentIteration->GetTrackFromTripletsFlag()) { if (chi2x[0] > chi2Cut) { if constexpr (fDebugCollectHits) { - std::cout << " hit chi2X is too large" << std::endl; + LOG(info) << " hit chi2X is too large"; } continue; } if (chi2x[0] + chi2u[0] > chi2Cut) { if constexpr (fDebugCollectHits) { - std::cout << " hit chi2U is too large" << std::endl; + LOG(info) << " hit chi2U is too large"; } continue; } } if constexpr (fDebugCollectHits) { - std::cout << " hit passed all the checks" << std::endl; + LOG(info) << " hit passed all the checks"; } collectedHits.push_back(ih); diff --git a/algo/ca/core/utils/CaDefines.h b/algo/ca/core/utils/CaDefines.h index abb188ba3ae2b0819983cf4b3ba4d1c52c06ab03..791a8ef786562deccd32b48a000722d7648d9db6 100644 --- a/algo/ca/core/utils/CaDefines.h +++ b/algo/ca/core/utils/CaDefines.h @@ -8,8 +8,10 @@ #pragma once // include this header only once per compilation unit +#include "AlgoFairloggerCompat.h" + #include <cassert> -#include <iostream> +#include <sstream> // #define CBMCA_DEBUG_MODE @@ -17,20 +19,21 @@ #define CBMCA_DEBUG_ASSERT(v) \ if (!(v)) { \ - std::cerr << __FILE__ << ":" << __LINE__ << " assertion failed: " << #v << " = " << (v) << std::endl; \ + LOG(error) << __FILE__ << ":" << __LINE__ << " assertion failed: " << #v << " = " << (v); \ assert(v); \ } #define CBMCA_DEBUG_SHOW(expr) \ - std::cout << __FILE__ << ":" << __LINE__ << ": \033[01;38;5;208m" << (#expr) << "\033[0m = " << (expr) << "\n" + LOG(info) << __FILE__ << ":" << __LINE__ << ": \033[01;38;5;208m" << (#expr) << "\033[0m = " << (expr); #define CBMCA_DEBUG_SHOWF(msg) \ - std::cout << "(!) " << __FILE__ << ":" << __LINE__ << ": \033[01;38;5;208m" << (#msg) << "\033[0m\n" + LOG(info) << "(!) " << __FILE__ << ":" << __LINE__ << ": \033[01;38;5;208m" << (#msg) << "\033[0m"; #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'; + std::stringstream ss; \ + ss << __FILE__ << ":" << __LINE__ << ": \033[01;38;5;208m" << (#cont) << "\033[0m: "; \ + std::for_each(cont.cbegin(), cont.cend(), [](const auto& el) { ss << el << " "; }); \ + LOG(info) << ss.str(); #else // not CBMCA_DEBUG_MODE diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index 37921f3ba0b7d0eacc40bafa3faf2d00c6e3cc8c..3dd2f3eab48060d9fdade1d55baced9d9e031211 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -62,14 +62,11 @@ #include <chrono> #include <fstream> #include <iomanip> -#include <iostream> #include <list> +#include <sstream> using namespace cbm::algo; // TODO: remove this line -using std::cout; -using std::endl; -using std::ios; using CaTrack = cbm::algo::ca::Track; using cbm::algo::ca::Parameters; using cbm::ca::MCModule; @@ -163,22 +160,25 @@ InitStatus CbmL1::Init() char W[20] = " [1;37;44m"; // white bold char o[20] = " [0m\n"; // color off Y[0] = y[0] = W[0] = o[0] = 0x1B; // escape character - - cout << endl << endl; - cout << " " << W << " " << o; - cout << " " << W << " ===////====================================================== " << o; - cout << " " << W << " = = " << o; - cout << " " << W << " = " << Y << "L1 on-line finder" << W << " = " << o; - cout << " " << W << " = = " << o; - cout << " " << W << " = " << W << "Cellular Automaton 3.1 Vector" << y << " with " << W << "KF Quadro" << y - << " technology" << W << " = " << o; - cout << " " << W << " = = " << o; - cout << " " << W << " = " << y << "Designed for CBM collaboration" << W << " = " << o; - cout << " " << W << " = " << y << "All rights reserved" << W << " = " << o; - cout << " " << W << " = = " << o; - cout << " " << W << " ========================================================////= " << o; - cout << " " << W << " " << o; - cout << endl << endl; + std::stringstream ss; + + ss << "\n\n"; + ss << " " << W << " " << o; + ss << " " << W << " ===////====================================================== " << o; + ss << " " << W << " = = " << o; + ss << " " << W << " = " << Y << "L1 on-line finder" << W << " = " << o; + ss << " " << W << " = = " << o; + ss << " " << W << " = " << W << "Cellular Automaton 3.1 Vector" << y << " with " << W << "KF Quadro" << y + << " technology" << W << " = " << o; + ss << " " << W << " = = " << o; + ss << " " << W << " = " << y << "Designed for CBM collaboration" << W << " = " << o; + ss << " " << W << " = " << y << "All rights reserved" << W << " = " << o; + ss << " " << W << " = = " << o; + ss << " " << W << " ========================================================////= " << o; + ss << " " << W << " " << o; + ss << "\n\n"; + + LOG(info) << ss.str(); } cbm::ca::tools::SetOriginalCbmField(); diff --git a/reco/L1/CbmL1Counters.h b/reco/L1/CbmL1Counters.h index 7619f1e0cf1b47cc719db40304242791e89cb702..c8b6951f7b1be0507c6ae36f3b4583d66cd30338 100644 --- a/reco/L1/CbmL1Counters.h +++ b/reco/L1/CbmL1Counters.h @@ -5,13 +5,14 @@ #ifndef CbmL1Counters_H #define CbmL1Counters_H +#include "AlgoFairloggerCompat.h" #include "CaVector.h" #include "TString.h" #include <fstream> #include <iomanip> -#include <iostream> #include <map> +#include <sstream> namespace { @@ -35,9 +36,9 @@ struct TL1TracksCatCounters // counters for different tracks categories TL1TracksCatCounters& operator+=(TL1TracksCatCounters& a) { if (GetNcounters() != a.GetNcounters()) { - std::cout << " TL1TracksCatCounters: Error. Addition of counters of " - "different sizes: " - << GetNcounters() << " " << a.GetNcounters() << std::endl; + LOG(error) << " TL1TracksCatCounters: Error. Addition of counters of " + "different sizes: " + << GetNcounters() << " " << a.GetNcounters(); } else { for (int iC = 0; iC < GetNcounters(); iC++) { @@ -59,9 +60,9 @@ struct TL1TracksCatCounters // counters for different tracks categories { TL1TracksCatCounters<double> b(GetNcounters()); if (GetNcounters() != a.GetNcounters()) { - std::cout << " TL1TracksCatCounters: Error. Addition of counters of " - "different sizes: " - << GetNcounters() << " " << a.GetNcounters() << std::endl; + LOG(error) << " TL1TracksCatCounters: Error. Addition of counters of " + "different sizes: " + << GetNcounters() << " " << a.GetNcounters(); } else { for (int iC = 0; iC < GetNcounters(); iC++) { @@ -145,7 +146,7 @@ struct TL1Efficiencies { const TString& name); // increment counters according to parameters void IncNEvents() { nEvents++; }; - void PrintEff(); + std::string ToString() const; std::vector<TString> names; // names counters indexed by index of counter @@ -205,26 +206,27 @@ inline void TL1Efficiencies::Inc(bool isReco, const TString& name) if (isReco) reco.counters[index]++; }; -inline void TL1Efficiencies::PrintEff() +inline std::string TL1Efficiencies::ToString() const { - std::ios_base::fmtflags coutFlags(std::cout.flags()); - std::cout.setf(std::ios::fixed); - std::cout.setf(std::ios::showpoint); - std::cout.precision(3); - std::cout.setf(std::ios::right); - std::cout << "Track category : " - << " Eff " - << " | " - << "All MC" << std::endl; + std::stringstream ss; + ss.setf(std::ios::fixed); + ss.setf(std::ios::showpoint); + ss.precision(3); + ss.setf(std::ios::right); + ss << "Track category : " + << " Eff " + << " | " + << "All MC" + << "\n"; int NCounters = mc.GetNcounters(); for (int iC = 0; iC < NCounters; iC++) { - std::cout << names[iC] << " : " << ratio_reco.counters[iC] << " | " << mc.counters[iC] << std::endl; + ss << names[iC] << " : " << ratio_reco.counters[iC] << " | " << mc.counters[iC] << "\n"; } - std::cout << "Clone probability : " << ratio_clones << " | " << clones << std::endl; - std::cout << "Ghost probability : " << ratio_ghosts << " | " << ghosts << std::endl; - std::cout.flags(coutFlags); + ss << "Clone probability : " << ratio_clones << " | " << clones << "\n"; + ss << "Ghost probability : " << ratio_ghosts << " | " << ghosts << "\n"; + return ss.str(); }; #endif diff --git a/reco/L1/CbmL1MCTrack.cxx b/reco/L1/CbmL1MCTrack.cxx index 9aff8bdc4f04ac69ea8e5430aa941866cf58cd88..dadc4f2c3d9b1fae31cc5e8d7d6245c7c715fedb 100644 --- a/reco/L1/CbmL1MCTrack.cxx +++ b/reco/L1/CbmL1MCTrack.cxx @@ -20,6 +20,7 @@ #include "CbmL1MCTrack.h" +#include "AlgoFairloggerCompat.h" #include "CaConstants.h" #include "CaHit.h" #include "CbmL1.h" @@ -171,7 +172,7 @@ void CbmL1MCTrack::CalculateMaxNStaMC() }; if (cur_maxNStaMC > maxNStaMC) maxNStaMC = cur_maxNStaMC; if (cur_maxNSensorMC > maxNSensorMC) maxNSensorMC = cur_maxNSensorMC; - // cout << pdg << " " << p << " " << Points.size() << " > " << maxNStaMC << " " << maxNSensorMC << endl; + // LOG(info) << pdg << " " << p << " " << Points.size() << " > " << maxNStaMC << " " << maxNSensorMC; }; // void CbmL1MCTrack::CalculateMaxNStaMC() diff --git a/reco/L1/CbmL1Performance.cxx b/reco/L1/CbmL1Performance.cxx index a14fa56e468519d53abbf1e713f0a54093936303..2ee6f2bd069bcc696585eb068bb174702b51ad7b 100644 --- a/reco/L1/CbmL1Performance.cxx +++ b/reco/L1/CbmL1Performance.cxx @@ -18,6 +18,7 @@ *==================================================================== */ +#include "AlgoFairloggerCompat.h" #include "CaFramework.h" #include "CaToolsDebugger.h" #include "CaTrackFit.h" @@ -51,20 +52,15 @@ #include <boost/filesystem.hpp> #include <cmath> -#include <iostream> #include <list> #include <map> +#include <sstream> #include <vector> using namespace cbm::algo::ca; using cbm::ca::tools::Debugger; -using std::cout; -using std::endl; -using std::ios; using std::map; -using std::pair; -using std::setw; using std::vector; struct TL1PerfEfficiencies : public TL1Efficiencies { @@ -192,7 +188,7 @@ struct TL1PerfEfficiencies : public TL1Efficiencies { aTable->SetCell(NCounters + 1, 0, ghosts); if (ifPrintTableToLog) { - cout << *aTable; // print a table to log + LOG(info) << *aTable; // print a table to log } if (!ifDeleteTable) { aTable->SetDirectory(fOutDir); @@ -237,27 +233,26 @@ void CbmL1::EfficienciesPerformance() ntra.ghosts += rtraIt->IsGhost(); if (0 && rtraIt->IsGhost()) { // Debug. TrackParamV tr(*rtraIt); - - cout << " L1: ghost track: nhits " << rtraIt->GetNofHits() << " p " << 1. / rtraIt->GetQp() << " purity " - << rtraIt->GetMaxPurity() << " | hits "; + std::stringstream ss; + ss << " L1: ghost track: nhits " << rtraIt->GetNofHits() << " p " << 1. / rtraIt->GetQp() << " purity " + << rtraIt->GetMaxPurity() << " | hits "; for (map<int, int>::iterator posIt = rtraIt->hitMap.begin(); posIt != rtraIt->hitMap.end(); posIt++) { - cout << " (" << posIt->second << " " << posIt->first << ") "; + ss << " (" << posIt->second << " " << posIt->first << ") "; } - cout << endl; + LOG(info) << ss.str(); for (map<int, int>::iterator posIt = rtraIt->hitMap.begin(); posIt != rtraIt->hitMap.end(); posIt++) { const auto& mcTrk = fMCData.GetTrack(posIt->first); - cout << "mc " << posIt->first << " pdg " << mcTrk.GetPdgCode() << " mother: " << mcTrk.GetMotherId() - << " chain " << mcTrk.GetChainId(); - cout << " n mc stations: " << mcTrk.GetNofConsStationsWithPoint() << endl; + LOG(info) << "mc " << posIt->first << " pdg " << mcTrk.GetPdgCode() << " mother: " << mcTrk.GetMotherId() + << " chain " << mcTrk.GetChainId() << " n mc stations: " << mcTrk.GetNofConsStationsWithPoint(); } for (unsigned int i = 0; i < rtraIt->Hits.size(); i++) { const ca::Hit& h = fpAlgo->GetInputData().GetHit(rtraIt->Hits[i]); const CbmL1HitDebugInfo& s = fvHitDebugInfo[rtraIt->Hits[i]]; - cout << " x y z t " << s.x << " " << s.y << " " << h.Z() << " dx " << s.dx << " dy " << s.dy << std::endl; + LOG(info) << " x y z t " << s.x << " " << s.y << " " << h.Z() << " dx " << s.dx << " dy " << s.dy; cbm::ca::tools::Debugger::Instance().FillNtuple("ghost", statNghost, i, fabs(1. / tr.GetQp()[0]), s.x, s.y, h.Z(), h.T(), s.dx, s.dy); } - std::cout << tr.ToString(0); + LOG(info) << tr.ToString(0); statNghost++; } } @@ -301,9 +296,9 @@ void CbmL1::EfficienciesPerformance() // if (nclones){ // Debug. Look at clones // for (int irt = 0; irt < rTracks.size(); irt++){ // const int ista = fvHitDebugInfo[rTracks[irt]->Hits[0]].iStation; - // cout << rTracks[irt]->GetNOfHits() << "(" << ista << ") "; + // LOG(info) << rTracks[irt]->GetNOfHits() << "(" << ista << ") "; // } - // cout << mtra.NStations() << endl; + // LOG(info) << mtra.NStations(); // } if (mcTrk.IsAdditional()) { // short @@ -395,25 +390,24 @@ void CbmL1::EfficienciesPerformance() ntra.CalcEff(); L1_NTRA.CalcEff(); - // cout.precision(3); if (fVerbose) { if (fVerbose > 1) { ntra.PrintEff(true, true); - cout << "Number of true and fake hits in stations: " << endl; + std::stringstream ss; + ss << "Number of true and fake hits in stations: \n"; for (int i = 0; i < fpAlgo->GetParameters().GetNstationsActive(); i++) { - cout << sta_nhits[i] - sta_nfakes[i] << "+" << sta_nfakes[i] << " "; + ss << sta_nhits[i] - sta_nfakes[i] << "+" << sta_nfakes[i] << " "; } - cout << endl; + LOG(info) << ss.str(); } // fVerbose > 1 - cout << endl; - cout << "L1 ACCUMULATED STAT : " << L1_NEVENTS << " EVENTS " << endl << endl; + LOG(info) << "\n" + << "L1 ACCUMULATED STAT : " << L1_NEVENTS << " EVENTS \n"; L1_NTRA.PrintEff(/*ifPrintTableToLog = */ true, false); - cout << "Reconstructible MC tracks/event: " - << (double(L1_NTRA.mc.counters[L1_NTRA.indices["total"]]) / double(L1_NEVENTS)) << endl; - cout << "Reconstructed MC tracks/event: " - << (double(L1_NTRA.reco.counters[L1_NTRA.indices["total"]]) / double(L1_NEVENTS)) << endl; - cout << endl; - cout << "CA Track Finder: " << L1_CATIME / L1_NEVENTS << " s/time slice" << endl << endl; + LOG(info) << "Reconstructible MC tracks/event: " + << (double(L1_NTRA.mc.counters[L1_NTRA.indices["total"]]) / double(L1_NEVENTS)); + LOG(info) << "Reconstructed MC tracks/event: " + << (double(L1_NTRA.reco.counters[L1_NTRA.indices["total"]]) / double(L1_NEVENTS)); + LOG(info) << "\nCA Track Finder: " << L1_CATIME / L1_NEVENTS << " s/time slice \n"; } } // void CbmL1::Performance() @@ -1311,7 +1305,7 @@ void CbmL1::TrackFitPerformance() (iSta >= 0) && (iSta < fNStations) && (dir * (mc.GetStartZ() - fpAlgo->GetParameters().GetStation(iSta).fZ[0]) > 0); iSta += dir) { - // cout << iSta << " " << dir << endl; + // LOG(info) << iSta << " " << dir; auto radThick = fpAlgo->GetParameters().GetMaterialThickness(iSta, fit.Tr().GetX(), fit.Tr().GetY()); fit.MultipleScattering(radThick); fit.EnergyLossCorrection(radThick, fvec::One()); @@ -1326,7 +1320,7 @@ void CbmL1::TrackFitPerformance() // continue; // } // else good++; - // cout << "bad\\good" << bad << " " << good << endl; + // LOG(info) << "bad\\good" << bad << " " << good; // calculate pulls //h_fitSV[0]->Fill( (mc.x-tr.GetX()[0]) *1.e4); @@ -1762,7 +1756,7 @@ void CbmL1::DumpMCTripletsToTree() std::string dir = p.parent_path().string(); if (dir.empty()) dir = "."; std::string filename = dir + "/" + fsMcTripletsOutputFilename + "." + p.filename().string(); - std::cout << "\033[1;31mSAVING A TREE: " << filename << "\033[0m\n"; + LOG(info) << "\033[1;31mSAVING A TREE: " << filename << "\033[0m"; fpMcTripletsOutFile = new TFile(filename.c_str(), "RECREATE"); fpMcTripletsOutFile->cd(); diff --git a/reco/L1/L1Algo/inactive/L1Event.cxx b/reco/L1/L1Algo/inactive/L1Event.cxx index 935fa82dc8f20b648cb6da1454859e48c7f0bdc1..88e6ed56be109dd75f812d6fb791ff947d4cf63a 100644 --- a/reco/L1/L1Algo/inactive/L1Event.cxx +++ b/reco/L1/L1Algo/inactive/L1Event.cxx @@ -13,5 +13,4 @@ void L1Event::TopoReconstructor() fTopoReconstructor.ReconstructPrimVertex(); fTopoReconstructor.SortTracks(); fTopoReconstructor.ReconstructParticles(); - //cout<<"fTopoReconstructor "<<fTopoReconstructor.GetParticles().size(); } diff --git a/reco/L1/L1Algo/inactive/L1EventEfficiencies.h b/reco/L1/L1Algo/inactive/L1EventEfficiencies.h index 5e5e7cccdbacf7486f90bcdc7630a5a805de8e5c..8079858d0b755879a1af68b6d8a612ff3e22bee4 100644 --- a/reco/L1/L1Algo/inactive/L1EventEfficiencies.h +++ b/reco/L1/L1Algo/inactive/L1EventEfficiencies.h @@ -6,6 +6,7 @@ #include <cstring> #include <iostream> +#include <sstream> class L1EventEfficiencies { public: @@ -74,29 +75,30 @@ class L1EventEfficiencies { void AddGhost(int i) { ghosts += i; } - void PrintEff() + std::string ToString() { - - std::cout.setf(std::ios::fixed); - std::cout.setf(std::ios::showpoint); - std::cout.precision(3); - std::cout << "Event category normalised to: " - << " Eff " - << " / " - << "Clones" - << " / " - << "All Reco" - << " | " - << "All MC" << std::endl; + std::stringstream ss; + ss.setf(std::ios::fixed); + ss.setf(std::ios::showpoint); + ss.precision(3); + ss << "Event category normalised to: " + << " Eff " + << " / " + << "Clones" + << " / " + << "All Reco" + << " | " + << "All MC \n"; int NCounters = mc.GetNcounters(); for (int iC = 0; iC < NCounters; iC++) { - std::cout << names[iC] << " : " << ratio_reco.counters[iC] << " / " - << ratio_clone.counters[iC] // nCloneTracks/nMCTracks - << " / " << std::setw(8) << reco.counters[iC] / double(nEvents) << " | " << std::setw(8) - << mc.counters[iC] / double(nEvents) << std::endl; + ss << names[iC] << " : " << ratio_reco.counters[iC] << " / " + << ratio_clone.counters[iC] // nCloneTracks/nMCTracks + << " / " << std::setw(8) << reco.counters[iC] / double(nEvents) << " | " << std::setw(8) + << mc.counters[iC] / double(nEvents) << "\n"; } - std::cout << "Ghost probability : " << ratio_ghosts << " | " << ghosts << std::endl; + ss << "Ghost probability : " << ratio_ghosts << " | " << ghosts << "\n"; + return ss.str(); } private: diff --git a/reco/L1/L1Algo/utils/CaUvConverter.cxx b/reco/L1/L1Algo/utils/CaUvConverter.cxx index 836288b1e63d9b6100edc6577c52c2c296a8ed6b..2f84196e2294dd6b61634eff18eb42eb6b82c74c 100644 --- a/reco/L1/L1Algo/utils/CaUvConverter.cxx +++ b/reco/L1/L1Algo/utils/CaUvConverter.cxx @@ -63,6 +63,6 @@ void CaUvConverter::SetFromXYCovMatrix(double phiU, double dx2, double dxy, doub LOG(error) << "can not define V coordinate from XY covariance matrix"; } - //std::cout << " u " << phiU / M_PI * 180. << "v " << phiV / M_PI * 180. << " du " << sqrt(du2) << " dv " << sqrt(dv2) - // << " duv " << duv << std::endl; + //LOG(info) << " u " << phiU / M_PI * 180. << "v " << phiV / M_PI * 180. << " du " << sqrt(du2) << " dv " << sqrt(dv2) + // << " duv " << duv; } diff --git a/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h b/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h index b8388d28d2ecd519b5d534995288d589918b17e2..36f97483603db5660055fba1a64f51601d9f7123 100644 --- a/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h +++ b/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h @@ -12,6 +12,7 @@ * Reconstructable mcTracklet is one, which has all 3 hits and momentum bigger than fL1->MinRecoMom. */ +#include "AlgoFairloggerCompat.h" #include "CbmL1.h" #include "CbmL1Counters.h" #include "CbmL1MCTrack.h" @@ -19,8 +20,6 @@ #include <iostream> #include <vector> -using std::cout; -using std::endl; using std::vector; @@ -120,9 +119,9 @@ class L1AlgoEfficiencyPerformance { bool AddOne(ca::HitIndex_t* ih_); // add one recoTracklets. Return is it reconstructed or not void CalculateEff(); - void Print(); // Print efficiencies + void Print(TString title = "Triplets performance statistic", - bool station = 0); // Print efficiencies + bool station = 0) const; // Print efficiencies static constexpr int MaxNStations = 10; @@ -275,14 +274,14 @@ void L1AlgoEfficiencyPerformance<NHits>::MatchTracks() const int NRecoTrlets = recoTracklets.size(); const int NMCTrlets = mcTracklets.size(); - // cout << NMCTrlets << " " << NRecoTrlets << " " << endl; + // LOG(info) << NMCTrlets << " " << NRecoTrlets; for (int iReco = 0, iMC = 0; (iReco < NRecoTrlets) && (iMC < NMCTrlets);) { L1MCTracklet& mcTrlet = mcTracklets[iMC]; L1RecoTracklet& recoTrlet = recoTracklets[iReco]; // if (recoTrlet.mcTrackId >= 0) - // cout << iMC << " " << mcTrlet.iStation << " " << mcTrlet.mcTrackId << " " << mcTrlet.p << " | " - // << iReco << " " << recoTrlet.iStation << " " << recoTrlet.mcTrackId << " " << endl; + // LOG(info) << iMC << " " << mcTrlet.iStation << " " << mcTrlet.mcTrackId << " " << mcTrlet.p << " | " + // << iReco << " " << recoTrlet.iStation << " " << recoTrlet.mcTrackId; if (recoTrlet != mcTrlet) { if (recoTrlet < mcTrlet) @@ -291,8 +290,8 @@ void L1AlgoEfficiencyPerformance<NHits>::MatchTracks() iMC++; } else { - // cout << iMC << " " << mcTrlet.iStation << " " << mcTrlet.mcTrackId << " " << mcTrlet.p << " | " - // << iReco << " " << recoTrlet.iStation << " " << recoTrlet.mcTrackId << " " << endl; + // LOG(info) << iMC << " " << mcTrlet.iStation << " " << mcTrlet.mcTrackId << " " << mcTrlet.p << " | " + // << iReco << " " << recoTrlet.iStation << " " << recoTrlet.mcTrackId; // check if same tracklet has been matched, and save it if not. bool flag = 1; const int nReco = mcTrlet.recoIds.size(); @@ -336,15 +335,14 @@ void L1AlgoEfficiencyPerformance<NHits>::CalculateEff() // // Debug // if (!reco){ - // cout << "iMC/N " << iMC << "/" << NMCTrlets << " sta " << mtra.iStation << " trackId " << mtra.mcTrackId << " momentum " << mtra.p << ". MotherTrackId " << mtra.mcMotherTrackId << endl; + // LOG(info) << "iMC/N " << iMC << "/" << NMCTrlets << " sta " << mtra.iStation << " trackId " << mtra.mcTrackId << " momentum " << mtra.p << ". MotherTrackId " << mtra.mcMotherTrackId; // for (int iSta2 = 0; iSta2 < NHits; iSta2++){ - // cout << iSta2 << ": "; + // LOG(info) << iSta2 << ": "; // const int NPointHits = mtra.hitIds[iSta2].size(); // for (int iH = 0; iH < NPointHits; iH++){ - // cout << mtra.hitIds[iSta2][iH] << ""; - // cout << "(" << fL1->fvHitDebugInfo[mtra.hitIds[iSta2][iH]].x << "\\" << fL1->fvHitDebugInfo[mtra.hitIds[iSta2][iH]].y << "= " << fL1->fvHitDebugInfo[mtra.hitIds[iSta2][iH]].x/fL1->fvHitDebugInfo[mtra.hitIds[iSta2][iH]].y << " ) "; + // LOG(info) << mtra.hitIds[iSta2][iH] << ""; + // LOG(info) << "(" << fL1->fvHitDebugInfo[mtra.hitIds[iSta2][iH]].x << "\\" << fL1->fvHitDebugInfo[mtra.hitIds[iSta2][iH]].y << "= " << fL1->fvHitDebugInfo[mtra.hitIds[iSta2][iH]].x/fL1->fvHitDebugInfo[mtra.hitIds[iSta2][iH]].y << " ) "; // } - // cout << endl; // } // } } @@ -377,26 +375,18 @@ void L1AlgoEfficiencyPerformance<NHits>::CalculateEff() template<int NHits> -inline void L1AlgoEfficiencyPerformance<NHits>::Print(TString title, bool stations) +inline void L1AlgoEfficiencyPerformance<NHits>::Print(TString title, bool stations) const { - // cout << endl; - // cout << "-------- Triplets performance ----------" << endl; - // ntra.PrintEff(); - - cout << endl; - cout << "-------- " << title << " ----------" << endl; - NTRA.PrintEff(); - cout << endl; + LOG(info) << "\n-------- " << title << " ----------"; + LOG(info) << NTRA.ToString() << "\n"; if (stations) { for (int iSta = 0; iSta < fL1->fNStations - NHits + 1; iSta++) { TString title_sta = title; title_sta += " station "; title_sta += iSta; - cout << endl; - cout << "-------- " << title_sta << " ----------" << endl; - NTRA_STA[iSta].PrintEff(); - cout << endl; + LOG(info) << "\n-------- " << title_sta << " ----------"; + LOG(info) << NTRA_STA[iSta].ToString() << "\n"; } } }; diff --git a/reco/L1/L1Algo/utils/L1AlgoPulls.cxx b/reco/L1/L1Algo/utils/L1AlgoPulls.cxx index 2eb4ca5ce56df36394771d2f47ffaac3f245d59d..c41e0cb6a8a4c9f7518d298606ca639f75fa49cf 100644 --- a/reco/L1/L1Algo/utils/L1AlgoPulls.cxx +++ b/reco/L1/L1Algo/utils/L1AlgoPulls.cxx @@ -4,6 +4,8 @@ #include "L1AlgoPulls.h" +#include "AlgoFairloggerCompat.h" + using namespace cbm::algo::ca; const TString L1TrackParametersNames[TL1TrackParameters::NParameters] = {"x", "y", "tx", "ty", "qp"}; @@ -150,15 +152,16 @@ void L1AlgoPulls::AddOne(TrackParamV& T_, int i, ca::HitIndex_t ih) #endif // BUILD_HISTO_FOR_EACH_STANTION }; -void L1AlgoPulls::Print() +std::string L1AlgoPulls::ToString() const { // TODO: renew - cout << "All pulls: " << fNAllPulls << endl; - cout << "Correct pulls: " << fGPulls.size() << endl; - cout << "x y tx ty qp" << endl; + std::stringstream ss; + ss << "All pulls: " << fNAllPulls << "\n"; + ss << "Correct pulls: " << fGPulls.size() << "\n"; + ss << "x y tx ty qp \n"; for (unsigned int i = 0; i < fGPulls.size(); i++) { - TL1TrackParameters& pull = fGPulls[i]; - pull.Print(); + ss << fGPulls[i].ToString() << "\n"; } + return ss.str(); }; void L1AlgoPulls::Build(bool draw) @@ -224,19 +227,19 @@ void L1AlgoPulls::Build(bool draw) chdir(".."); // --- print information --- - cout << "All entries: " << fNAllPulls << endl; - cout << "Correct entries: " << fGPulls.size() << endl; - cout << "Pulls sigma & RMS: " << endl; + LOG(info) << "All entries: " << fNAllPulls; + LOG(info) << "Correct entries: " << fGPulls.size(); + LOG(info) << "Pulls sigma & RMS: "; for (int ih = 0; ih < (NStations + 1) * TL1TrackParameters::NParameters; ih++) { int ipar = ih % TL1TrackParameters::NParameters; int ista = ih / TL1TrackParameters::NParameters; - if ((ista > 0) && (ipar == 0)) cout << "Station " << ista - 1 << endl; - cout << L1TrackParametersNames[ipar] << "\t" << pulls[ih][0] << "\t" << pulls[ih][1] << endl; + if ((ista > 0) && (ipar == 0)) LOG(info) << "Station " << ista - 1; + LOG(info) << L1TrackParametersNames[ipar] << "\t" << pulls[ih][0] << "\t" << pulls[ih][1]; } - cout << "Residuals sigma & RMS: " << endl; + LOG(info) << "Residuals sigma & RMS: "; for (int ih = 0; ih < (0 + 1) * TL1TrackParameters::NParameters; ih++) { int ipar = ih % TL1TrackParameters::NParameters; - cout << L1TrackParametersNames[ipar] << "\t" << residuals[ih][0] << "\t" << residuals[ih][1] << endl; + LOG(info) << L1TrackParametersNames[ipar] << "\t" << residuals[ih][0] << "\t" << residuals[ih][1]; } } @@ -260,6 +263,6 @@ void L1AlgoPulls::makeUpHisto(TH1* hist, TString title, float& sigma) hist->GetYaxis()->SetTitleOffset(1.05); // good then entries per bit <= 9999 } else { - std::cout << " E: Read hists error! " << std::endl; + LOG(info) << " E: Read hists error! "; } } diff --git a/reco/L1/L1Algo/utils/L1AlgoPulls.h b/reco/L1/L1Algo/utils/L1AlgoPulls.h index 1014b9c77558c9b94563b499cc723763c20a61f1..a7e63f75c05d6115ba5b84cbfa3c8b9806152ad8 100644 --- a/reco/L1/L1Algo/utils/L1AlgoPulls.h +++ b/reco/L1/L1Algo/utils/L1AlgoPulls.h @@ -21,10 +21,9 @@ const int NStations = 0; #include "TStyle.h" #include <iostream> +#include <sstream> #include <vector> -using std::cout; -using std::endl; using std::vector; struct TL1TrackParameters { @@ -84,7 +83,12 @@ struct TL1TrackParameters { return c; } - void Print() { cout << x << " " << y << " " << tx << " " << ty << " " << qp << endl; } + std::string ToString() const + { + std::stringstream ss; + ss << x << " " << y << " " << tx << " " << ty << " " << qp; + return ss.str(); + } }; class L1AlgoPulls { @@ -95,7 +99,7 @@ class L1AlgoPulls { // void AddVec(TrackParamV& T, ca::HitIndex_t ih); void AddOne(cbm::algo::ca::TrackParamV& T, int i, ca::HitIndex_t ih); - void Print(); // fast method to see pulls :) + std::string ToString() const; // fast method to see pulls :) void Build(bool draw = 1); int fNAllPulls{0}; // number of AddOne calls diff --git a/reco/L1/OffLineInterface/CbmGlobalFindTracksEvents.cxx b/reco/L1/OffLineInterface/CbmGlobalFindTracksEvents.cxx index 079a3f803a163e96fea7cf9fe7a3572ad2d6346c..0ef3414a10c30981c59af619a20bfef439c43889 100644 --- a/reco/L1/OffLineInterface/CbmGlobalFindTracksEvents.cxx +++ b/reco/L1/OffLineInterface/CbmGlobalFindTracksEvents.cxx @@ -36,8 +36,6 @@ #include <iomanip> #include <iostream> -using std::cout; -using std::endl; using std::fixed; using std::left; using std::pair; @@ -203,8 +201,7 @@ InitStatus CbmGlobalFindTracksEvents::Init() // ----- End-of-run action --------------------------------------------- void CbmGlobalFindTracksEvents::Finish() { - std::cout << std::endl; - LOG(info) << "====================================="; + LOG(info) << "\n====================================="; LOG(info) << GetName() << ": Run summary"; LOG(info) << "Time slices : " << fNofTs; LOG(info) << "Hits / TS : " << fixed << setprecision(2) << Double_t(fNofHits) / Double_t(fNofTs); diff --git a/reco/L1/OffLineInterface/CbmL1GlobalFindTracksEvents.cxx b/reco/L1/OffLineInterface/CbmL1GlobalFindTracksEvents.cxx index 67d62569aeb7ef20229466a193007de77a983332..55ca8b6fbc0b921647ad32b9fb767c8457edd4a6 100644 --- a/reco/L1/OffLineInterface/CbmL1GlobalFindTracksEvents.cxx +++ b/reco/L1/OffLineInterface/CbmL1GlobalFindTracksEvents.cxx @@ -36,8 +36,6 @@ #include <iomanip> #include <iostream> -using std::cout; -using std::endl; using std::fixed; using std::left; using std::pair; @@ -214,8 +212,7 @@ InitStatus CbmL1GlobalFindTracksEvents::Init() // ----- End-of-run action --------------------------------------------- void CbmL1GlobalFindTracksEvents::Finish() { - std::cout << std::endl; - LOG(info) << "====================================="; + LOG(info) << "\n====================================="; LOG(info) << GetName() << ": Run summary"; LOG(info) << "Time slices : " << fNofTs; LOG(info) << "Hits / TS : " << fixed << setprecision(2) << Double_t(fNofHits) / Double_t(fNofTs); diff --git a/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.cxx b/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.cxx index 6fef8e32b9845250c47b3cb17a3d918705ea4e1c..fa8b55181b54ccc42badb203b8347bcb22d92655 100644 --- a/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.cxx +++ b/reco/L1/OffLineInterface/CbmL1GlobalTrackFinder.cxx @@ -34,12 +34,8 @@ #include "TClonesArray.h" #include "TDatabasePDG.h" -#include <iostream> #include <vector> - -using std::cout; -using std::endl; using std::vector; ClassImp(CbmL1GlobalTrackFinder) diff --git a/reco/L1/OffLineInterface/CbmL1StsTrackFinder.cxx b/reco/L1/OffLineInterface/CbmL1StsTrackFinder.cxx index 7d05c41994b52a4641fbe1f50f46381f06ee3333..f0b3f5ea29eda9e9dda664581cf7edb381ade7af 100644 --- a/reco/L1/OffLineInterface/CbmL1StsTrackFinder.cxx +++ b/reco/L1/OffLineInterface/CbmL1StsTrackFinder.cxx @@ -32,9 +32,6 @@ #include <iostream> #include <vector> - -using std::cout; -using std::endl; using std::vector; ClassImp(CbmL1StsTrackFinder) diff --git a/reco/L1/catools/CaToolsMaterialHelper.cxx b/reco/L1/catools/CaToolsMaterialHelper.cxx index bf87789fe7af71823c4ede712e512edd1342b352..860ba5d99fe4409a8ec2fabfb9bf67fc4bcb870a 100644 --- a/reco/L1/catools/CaToolsMaterialHelper.cxx +++ b/reco/L1/catools/CaToolsMaterialHelper.cxx @@ -5,6 +5,7 @@ #include "CaToolsMaterialHelper.h" +#include "AlgoFairloggerCompat.h" #include "Logger.h" #include "TGeoManager.h" #include "TGeoMedium.h" @@ -13,7 +14,7 @@ #include "TGeoPhysicalNode.h" #include "TGeoVoxelFinder.h" -#include <iostream> +#include <sstream> #include <thread> using cbm::ca::tools::MaterialHelper; @@ -287,7 +288,7 @@ MaterialMap MaterialHelper::GenerateMaterialMap(double zRef, double zMin, double double x = rayX + tx * (z - zRef); double y = rayY + ty * (z - zRef); if (doPrint) { - std::cout << "ray at " << x << " " << y << " " << z << " zMin " << zMin << " zMax " << zMax << std::endl; + LOG(info) << "ray at " << x << " " << y << " " << z << " zMin " << zMin << " zMax " << zMax; } TGeoNode* node = navi->InitTrack(x, y, z, tx / t, ty / t, 1. / t); @@ -328,8 +329,8 @@ MaterialMap MaterialHelper::GenerateMaterialMap(double zRef, double zMin, double nThreadCrosses[iThread]++; if (doPrint) { - std::cout << " RL " << radLen << " next pt " << navi->GetCurrentPoint()[0] << " " - << navi->GetCurrentPoint()[1] << " " << navi->GetCurrentPoint()[2] << std::endl; + LOG(info) << " RL " << radLen << " next pt " << navi->GetCurrentPoint()[0] << " " + << navi->GetCurrentPoint()[1] << " " << navi->GetCurrentPoint()[2]; } double zNew = navi->GetCurrentPoint()[2]; @@ -339,7 +340,7 @@ MaterialMap MaterialHelper::GenerateMaterialMap(double zRef, double zMin, double } //if (zNew < z) { - //std::cout << " z curr " << z << " z new " << zNew << " dz " << zNew - z << std::endl; } + //LOG(info) << " z curr " << z << " z new " << zNew << " dz " << zNew - z ; } double dz = zNew - z; if (dz < 0.) { if (iStep == 0 && dz > -1.e-8) { @@ -367,7 +368,7 @@ MaterialMap MaterialHelper::GenerateMaterialMap(double zRef, double zMin, double } radThick /= nRays; if (doPrint) { - std::cout << " radThick " << radThick << std::endl; + LOG(info) << " radThick " << radThick; } //doPrint = (radThick > 0.01); matBudget.SetRadThickBin(iBinX, iBinY, radThick);