From 11d516a98f9c7e0add6665170688daa3329917d9 Mon Sep 17 00:00:00 2001 From: Alexandru Bercuci <abercuci@niham.nipne.ro> Date: Thu, 5 May 2022 15:43:28 +0200 Subject: [PATCH] add verbosity, fix format --- core/data/trd/CbmTrdHit.cxx | 3 ++- core/data/trd/CbmTrdPoint.cxx | 15 +++++++---- reco/L1/qa/CbmTrackerInputQaTrd.cxx | 39 ++++++++++++----------------- reco/L1/qa/CbmTrackerInputQaTrd.h | 8 +++--- 4 files changed, 32 insertions(+), 33 deletions(-) diff --git a/core/data/trd/CbmTrdHit.cxx b/core/data/trd/CbmTrdHit.cxx index e07956e3b2..3b0d42252b 100644 --- a/core/data/trd/CbmTrdHit.cxx +++ b/core/data/trd/CbmTrdHit.cxx @@ -43,7 +43,8 @@ std::string CbmTrdHit::ToString() const { stringstream ss; ss << CbmPixelHit::ToString(); - ss << "CbmTrdHit" << (GetClassType() ? "2" : "1")<< "D: time[ns]=" << GetTime() << "+-" << GetTimeError() << " eloss=" << GetELoss(); + ss << "CbmTrdHit" << (GetClassType() ? "2" : "1") << "D: time[ns]=" << GetTime() << "+-" << GetTimeError() + << " eloss=" << GetELoss(); if (GetClassType()) ss << " Max=" << (GetMaxType() ? "T" : "R"); ss << " RC=" << (IsRowCross() ? 'y' : 'n') << " Ovf=" << (HasOverFlow() ? 'y' : 'n') << endl; return ss.str(); diff --git a/core/data/trd/CbmTrdPoint.cxx b/core/data/trd/CbmTrdPoint.cxx index 523cd523f8..07340f12f4 100644 --- a/core/data/trd/CbmTrdPoint.cxx +++ b/core/data/trd/CbmTrdPoint.cxx @@ -56,11 +56,16 @@ std::string CbmTrdPoint::ToString() const { std::stringstream ss; ss << "CbmTrdPoint: Track " << fTrackID << " Detector " << fDetectorID << "\n"; - ss << " Position In (" << fX << ", " << fY << ", " << fZ << ") cm" << "\n"; - ss << " Momentum In (" << fPx << ", " << fPy << ", " << fPz << ") GeV" << "\n"; - ss << " Position Out (" << fX_out << ", " << fY_out << ", " << fZ_out << ") cm" << "\n"; - ss << " Momentum Out (" << fPx_out << ", " << fPy_out << ", " << fPz_out << ") GeV" << "\n"; - ss << " Time " << fTime << " ns, Length " << fLength << " cm, Energy loss " << fELoss * 1.0e06 << " keV" << "\n"; + ss << " Position In (" << fX << ", " << fY << ", " << fZ << ") cm" + << "\n"; + ss << " Momentum In (" << fPx << ", " << fPy << ", " << fPz << ") GeV" + << "\n"; + ss << " Position Out (" << fX_out << ", " << fY_out << ", " << fZ_out << ") cm" + << "\n"; + ss << " Momentum Out (" << fPx_out << ", " << fPy_out << ", " << fPz_out << ") GeV" + << "\n"; + ss << " Time " << fTime << " ns, Length " << fLength << " cm, Energy loss " << fELoss * 1.0e06 << " keV" + << "\n"; return ss.str(); } // ------------------------------------------------------------------------- diff --git a/reco/L1/qa/CbmTrackerInputQaTrd.cxx b/reco/L1/qa/CbmTrackerInputQaTrd.cxx index ecc587141e..2832b33044 100644 --- a/reco/L1/qa/CbmTrackerInputQaTrd.cxx +++ b/reco/L1/qa/CbmTrackerInputQaTrd.cxx @@ -501,7 +501,7 @@ void CbmTrackerInputQaTrd::ResolutionQa() CbmTrdHitMC* hmc = new ((*fHitsMc)[imc++]) CbmTrdHitMC(*hit); hmc->AddCluster(cluster); uint64_t tdigi = 0; - + // custom finder of the digi matches CbmMatch myHitMatch; for (Int_t iDigi = 0; iDigi < nClusterDigis; iDigi++) { @@ -525,23 +525,15 @@ void CbmTrackerInputQaTrd::ResolutionQa() } switch (digi->GetType()) { case CbmTrdDigi::eCbmTrdAsicType::kFASP: - { - int dt; - double t, r = digi->GetCharge(t, dt); if (!tdigi) tdigi = digi->GetTimeDAQ(); - if (t > 0) hmc->AddSignal(t, digi->GetTimeDAQ() - tdigi); - if (r > 0) hmc->AddSignal(r, digi->GetTimeDAQ() - tdigi + dt); break; - } case CbmTrdDigi::eCbmTrdAsicType::kSPADIC: - hmc->AddSignal(digi->GetCharge(), digi->GetTime()); + if (!tdigi) tdigi = digi->GetTime(); break; - default: - LOG(fatal) << "TRD digi type neither SPADIC or FASP"; - return; + default: LOG(fatal) << "TRD digi type neither SPADIC or FASP"; return; } - - + hmc->AddSignal(digi, tdigi); + const CbmMatch* match = dynamic_cast<const CbmMatch*>(fDigiManager->GetMatch(ECbmModuleId::kTrd, digiIdx)); if (!match) { LOG(fatal) << "TRD digi match " << digiIdx << " not found"; @@ -549,6 +541,8 @@ void CbmTrackerInputQaTrd::ResolutionQa() } myHitMatch.AddLinks(*match); } + hmc->PurgeSignals(); + if (myHitMatch.GetNofLinks() == 0) { continue; } const CbmLink& bestLink = myHitMatch.GetMatchedLink(); @@ -603,13 +597,13 @@ void CbmTrackerInputQaTrd::ResolutionQa() // take corresponding MC point // skip hits from the noise digis - if (bestLink.GetIndex() < 0) { + if (bestLink.GetIndex() < 0) { std::stringstream ss; ss << "hit from noise [INFO]"; hmc->SetErrorMsg(ss.str()); - continue; + continue; } - + CbmTrdPoint* p = dynamic_cast<CbmTrdPoint*>(fMcPoints->Get(bestLink)); if (p == nullptr) { std::stringstream ss; @@ -643,7 +637,7 @@ void CbmTrackerInputQaTrd::ResolutionQa() if ((staZ < p->GetZIn() - 1.) || (staZ > p->GetZOut() + 1.)) { std::stringstream ss; ss << "TRD station " << StationIndex << ": active material Z[" << p->GetZIn() << " cm," << p->GetZOut() - << " cm] is too far from the nominal station Z " << staZ << " cm"; + << " cm] is too far from the nominal station Z " << staZ << " cm"; hmc->SetErrorMsg(ss.str()); LOG(error) << ss.str(); return; @@ -652,7 +646,7 @@ void CbmTrackerInputQaTrd::ResolutionQa() if (fabs(hit->GetZ() - staZ) > 1.) { std::stringstream ss; ss << "TRD station " << StationIndex << ": hit Z " << hit->GetZ() - << " cm, is too far from the nominal station Z " << staZ << " cm"; + << " cm, is too far from the nominal station Z " << staZ << " cm"; hmc->SetErrorMsg(ss.str()); LOG(error) << ss.str(); return; @@ -714,16 +708,15 @@ void CbmTrackerInputQaTrd::ResolutionQa() } hmc->AddPoint(p, t0, pdg); //std::cout << hmc->ToString() << "\n"; - constexpr double speedOfLight = 29.979246; // cm/ns TVector3 mom3; p->Momentum(mom3); t += dz / (pz * speedOfLight) * sqrt(mass * mass + mom3.Mag2()); - double du = hit->GetX() - x; //hmc->GetDx(); //hit->GetX() - x; - double dv = hit->GetY() - y; //hmc->GetDy(); //hit->GetY() - y; + double du = hmc->GetDx(); //hit->GetX() - x; + double dv = hit->GetY() - y; //hmc->GetDy(); //hit->GetY() - y; double dt = hit->GetTime() - t; // hmc->GetDt(); //hit->GetTime() - t; - double su = hit->GetDx(); + double su = hmc->GetSx(); double sv = hit->GetDy(); double st = hit->GetTimeError(); @@ -758,7 +751,7 @@ void CbmTrackerInputQaTrd::ResolutionQa() fh1DpullT.Fill(dt / st); } else { - fh2DpullX.Fill(6.2 * du / su); + fh2DpullX.Fill(du / su); fh2DpullY.Fill(dv / sv); fh2DpullT.Fill(dt / st); } diff --git a/reco/L1/qa/CbmTrackerInputQaTrd.h b/reco/L1/qa/CbmTrackerInputQaTrd.h index 3404ed5b9e..6e76a5ac25 100644 --- a/reco/L1/qa/CbmTrackerInputQaTrd.h +++ b/reco/L1/qa/CbmTrackerInputQaTrd.h @@ -119,17 +119,17 @@ private: CbmQaHist<TH1D> fh1DresidualV {"h1DresidualV", "Trd1D: Residual V;(V_{reco} - V_{MC})(cm)", 100, -10, 10}; CbmQaHist<TH1D> fh1DresidualT {"h1DresidualT", "Trd1D: Residual T;(T_{reco} - T_{MC})(ns)", 100, -50, 50}; - CbmQaHist<TH1D> fh2DresidualX {"h2DresidualX", "Trd2D: Residual X;(X_{reco} - X_{MC})(cm)", 1000, -1, 1}; + CbmQaHist<TH1D> fh2DresidualX {"h2DresidualX", "Trd2D: Residual X;(X_{reco} - X_{MC})(cm)", 100, -0.05, 0.05}; CbmQaHist<TH1D> fh2DresidualY {"h2DresidualY", "Trd2D: Residual Y;(Y_{reco} - Y_{MC})(cm)", 1000, -2, 2}; - CbmQaHist<TH1D> fh2DresidualT {"h2DresidualT", "Trd2D: Residual T;(T_{reco} - T_{MC})(ns)", 100, -1000, 1000}; + CbmQaHist<TH1D> fh2DresidualT {"h2DresidualT", "Trd2D: Residual T;(T_{reco} - T_{MC})(ns)", 100, -100, 100}; /// Histogram for PULL Distribution CbmQaHist<TH1D> fh1DpullU {"h1DpullU", "Trd1D: Pull U;(U_{reco} - U_{MC}) / #sigmaU_{reco}", 100, -5, 5}; CbmQaHist<TH1D> fh1DpullV {"h1DpullV", "Trd1D: Pull V;(V_{reco} - V_{MC}) / #sigmaV_{reco}", 100, -5, 5}; CbmQaHist<TH1D> fh1DpullT {"h1DpullT", "Trd1D: Pull T;(T_{reco} - T_{MC}) / #sigmaT_{reco}", 100, -5, 5}; - CbmQaHist<TH1D> fh2DpullX {"h2DpullX", "Trd2D: Pull X;(X_{reco} - X_{MC}) / #sigmaX_{reco}", 1000, -5, 5}; - CbmQaHist<TH1D> fh2DpullY {"h2DpullY", "Trd2D: Pull Y;(Y_{reco} - Y_{MC}) / #sigmaY_{reco}", 1000, -5, 5}; + CbmQaHist<TH1D> fh2DpullX {"h2DpullX", "Trd2D: Pull X;(X_{reco} - X_{MC}) / #sigmaX_{reco}", 100, -5, 5}; + CbmQaHist<TH1D> fh2DpullY {"h2DpullY", "Trd2D: Pull Y;(Y_{reco} - Y_{MC}) / #sigmaY_{reco}", 100, -5, 5}; CbmQaHist<TH1D> fh2DpullT {"h2DpullT", "Trd2D: Pull T;(T_{reco} - T_{MC}) / #sigmaT_{reco}", 100, -5, 5}; /// List of the above histogramms -- GitLab