From 44d647a91341f3034c7c691e3a59c1613495b082 Mon Sep 17 00:00:00 2001 From: Fabio Cossutti Date: Tue, 21 Feb 2023 18:05:02 +0100 Subject: [PATCH] Update debug printouts for MTD in several packages, fix simulation LogDebug --- .../plugins/BTLUncalibRecHitAlgo.cc | 13 +++++++--- RecoMTD/DetLayers/src/MTDDetTray.cc | 8 ++++--- .../plugins/TrackExtenderWithMTD.cc | 8 +++++++ .../FastTimingCommon/test/MTDDigiDump.cc | 24 +++++++++---------- SimG4Core/Notification/src/SimTrackManager.cc | 2 +- 5 files changed, 36 insertions(+), 19 deletions(-) diff --git a/RecoLocalFastTime/FTLCommonAlgos/plugins/BTLUncalibRecHitAlgo.cc b/RecoLocalFastTime/FTLCommonAlgos/plugins/BTLUncalibRecHitAlgo.cc index 7ef8da92c0686..62de44479f121 100644 --- a/RecoLocalFastTime/FTLCommonAlgos/plugins/BTLUncalibRecHitAlgo.cc +++ b/RecoLocalFastTime/FTLCommonAlgos/plugins/BTLUncalibRecHitAlgo.cc @@ -1,6 +1,7 @@ +#include "FWCore/MessageLogger/interface/MessageLogger.h" + #include "RecoLocalFastTime/FTLCommonAlgos/interface/MTDUncalibratedRecHitAlgoBase.h" #include "RecoLocalFastTime/FTLClusterizer/interface/BTLRecHitsErrorEstimatorIM.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "CommonTools/Utils/interface/FormulaEvaluator.h" @@ -58,6 +59,9 @@ FTLUncalibratedRecHit BTLUncalibRecHitAlgo::makeRecHit(const BTLDataFrame& dataF double nHits = 0.; + LogDebug("BTLUncalibRecHit") << "Original input time t1,t2 " << float(sampleRight.toa()) * toaLSBToNS_ << ", " + << float(sampleLeft.toa()) * toaLSBToNS_ << std::endl; + if (sampleRight.data() > 0) { amplitude.first = float(sampleRight.data()) * adcLSB_; time.first = float(sampleRight.toa()) * toaLSBToNS_; @@ -90,14 +94,17 @@ FTLUncalibratedRecHit BTLUncalibRecHitAlgo::makeRecHit(const BTLDataFrame& dataF // Calculate the position // Distance from center of bar to hit + float position = 0.5f * (c_LYSO_ * (time.second - time.first)); float positionError = BTLRecHitsErrorEstimatorIM::positionError(); + LogDebug("BTLUncalibRecHit") << "DetId: " << dataFrame.id().rawId() << " x position = " << position << " +/- " + << positionError; LogDebug("BTLUncalibRecHit") << "ADC+: set the charge to: (" << amplitude.first << ", " << amplitude.second << ") (" - << sampleRight.data() << ", " << sampleLeft.data() << " " << adcLSB_ << ' ' + << sampleRight.data() << ", " << sampleLeft.data() << ") " << adcLSB_ << ' ' << std::endl; LogDebug("BTLUncalibRecHit") << "TDC+: set the time to: (" << time.first << ", " << time.second << ") (" - << sampleRight.toa() << ", " << sampleLeft.toa() << " " << toaLSBToNS_ << ' ' + << sampleRight.toa() << ", " << sampleLeft.toa() << ") " << toaLSBToNS_ << ' ' << std::endl; return FTLUncalibratedRecHit( diff --git a/RecoMTD/DetLayers/src/MTDDetTray.cc b/RecoMTD/DetLayers/src/MTDDetTray.cc index 8f59e41811aad..cd26dc486148a 100644 --- a/RecoMTD/DetLayers/src/MTDDetTray.cc +++ b/RecoMTD/DetLayers/src/MTDDetTray.cc @@ -44,9 +44,11 @@ vector MTDDetTray::compatibleDets(const Trajec const Propagator& prop, const MeasurementEstimator& est) const { LogTrace("MTDDetLayers") << "MTDDetTray::compatibleDets, Surface at R,phi: " << surface().position().perp() << "," - << surface().position().phi() << " DetRod pos."; - // FIXME << " TS at R,phi: " << startingState.position().perp() << "," - // << startingState.position().phi() + << surface().position().phi() << " DetRod pos." + << " TS at R,phi: " << startingState.globalPosition().perp() << "," + << startingState.globalPosition().phi() << " TSOS dx/dy " + << std::sqrt(startingState.localError().positionError().xx()) << " " + << std::sqrt(startingState.localError().positionError().yy()); vector result; diff --git a/RecoMTD/TrackExtender/plugins/TrackExtenderWithMTD.cc b/RecoMTD/TrackExtender/plugins/TrackExtenderWithMTD.cc index 2216e28aeefd0..9a7be1438f779 100644 --- a/RecoMTD/TrackExtender/plugins/TrackExtenderWithMTD.cc +++ b/RecoMTD/TrackExtender/plugins/TrackExtenderWithMTD.cc @@ -958,6 +958,14 @@ namespace { if (!est.first) continue; + LogTrace("TrackExtenderWithMTD") + << "Spatial compatibility DetId " << detWithState.first->geographicalId().rawId() << " TSOS dx/dy " + << std::fixed << std::setw(14) << std::sqrt(detWithState.second.localError().positionError().xx()) + << " " << std::fixed << std::setw(14) + << std::sqrt(detWithState.second.localError().positionError().yy()) << " hit dx/dy " << std::fixed + << std::setw(14) << std::sqrt(hit.localPositionError().xx()) << " " << std::fixed << std::setw(14) + << std::sqrt(hit.localPositionError().yy()) << " chi2 " << std::fixed << std::setw(14) << est.second; + TrackTofPidInfo tof = computeTrackTofPidInfo(lastpmag2, std::abs(pl.second), trs0, diff --git a/SimFastTiming/FastTimingCommon/test/MTDDigiDump.cc b/SimFastTiming/FastTimingCommon/test/MTDDigiDump.cc index 646cc67dfac7d..1e9fa24bcf8c1 100644 --- a/SimFastTiming/FastTimingCommon/test/MTDDigiDump.cc +++ b/SimFastTiming/FastTimingCommon/test/MTDDigiDump.cc @@ -55,14 +55,12 @@ void MTDDigiDump::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu if (!h_BTL_digi->empty()) { std::cout << " ----------------------------------------" << std::endl; - std::cout << " BTL DIGI collection:" << std::endl; + std::cout << " BTL DIGI collection: \n" << std::endl; for (const auto& dataFrame : *h_BTL_digi) { // --- detector element ID: - std::cout << " det ID: det = " << dataFrame.id().det() << " subdet = " << dataFrame.id().mtdSubDetector() - << " side = " << dataFrame.id().mtdSide() << " rod = " << dataFrame.id().mtdRR() - << " mod = " << dataFrame.id().module() << " type = " << dataFrame.id().modType() - << " crystal = " << dataFrame.id().crystal() << std::endl; + std::cout << "\n BTL DIGI: row = " << dataFrame.row() << " col = " << dataFrame.column() + << " BTLDetId = " << dataFrame.id(); // --- loop over the dataFrame samples for (int isample = 0; isample < dataFrame.size(); ++isample) { @@ -74,7 +72,8 @@ void MTDDigiDump::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu continue; } std::cout << " amplitude = " << sample.data() << " time1 = " << sample.toa() << " time2 = " << sample.toa2() - << std::endl; + << " r/c = " << (uint32_t)sample.row() << " / " << (uint32_t)sample.column() + << " th = " << sample.threshold() << " mode = " << sample.mode() << std::endl; } // isaple loop @@ -85,14 +84,13 @@ void MTDDigiDump::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu // --- ETL DIGIs: if (!h_ETL_digi->empty()) { - std::cout << " ----------------------------------------" << std::endl; - std::cout << " ETL DIGI collection:" << std::endl; + std::cout << "\n ----------------------------------------" << std::endl; + std::cout << " ETL DIGI collection: \n" << std::endl; for (const auto& dataFrame : *h_ETL_digi) { // --- detector element ID: - std::cout << " det ID: det = " << dataFrame.id().det() << " subdet = " << dataFrame.id().mtdSubDetector() - << " side = " << dataFrame.id().mtdSide() << " ring = " << dataFrame.id().mtdRR() - << " mod = " << dataFrame.id().module() << " type = " << dataFrame.id().modType() << std::endl; + std::cout << "\n ETL DIGI: row = " << dataFrame.row() << " col = " << dataFrame.column() + << " ETLDetId = " << dataFrame.id(); // --- loop over the dataFrame samples for (int isample = 0; isample < dataFrame.size(); ++isample) { @@ -103,7 +101,9 @@ void MTDDigiDump::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu std::cout << std::endl; continue; } - std::cout << " amplitude = " << sample.data() << " time = " << sample.toa() << std::endl; + std::cout << " amplitude = " << sample.data() << " time = " << sample.toa() << " r/c = " << sample.row() + << " / " << sample.column() << " th = " << sample.threshold() << " mode = " << sample.mode() + << std::endl; } // isample loop diff --git a/SimG4Core/Notification/src/SimTrackManager.cc b/SimG4Core/Notification/src/SimTrackManager.cc index 3daa4473374ff..140c84a7dcd96 100644 --- a/SimG4Core/Notification/src/SimTrackManager.cc +++ b/SimG4Core/Notification/src/SimTrackManager.cc @@ -339,7 +339,7 @@ void SimTrackManager::cleanTracksWithHistory() { #ifdef DebugLog LogDebug("SimTrackManager") << " AFTER CLEANING, I GET " << (*m_trksForThisEvent).size() << " tracks to be saved persistently"; - for (unsigned int it < (*m_trksForThisEvent).size(); ++it) { + for (unsigned int it = 0; it < (*m_trksForThisEvent).size(); ++it) { LogDebug("SimTrackManager") << " Track in position " << it << " G4 track number " << (*m_trksForThisEvent)[it]->trackID() << " mother " << (*m_trksForThisEvent)[it]->parentID() << " Status "