From 507daed9119f43c7d0b57573805a1b64978e7f9f Mon Sep 17 00:00:00 2001 From: Xueting Yang Date: Thu, 30 Oct 2025 10:30:42 +0100 Subject: [PATCH 1/2] update --- .../src/FTLiteClusterMonitor.cpp | 79 ++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/FT/FTDigitisation/src/FTLiteClusterMonitor.cpp b/FT/FTDigitisation/src/FTLiteClusterMonitor.cpp index 493d36246..db347c2a4 100644 --- a/FT/FTDigitisation/src/FTLiteClusterMonitor.cpp +++ b/FT/FTDigitisation/src/FTLiteClusterMonitor.cpp @@ -282,6 +282,8 @@ namespace LHCb::FT { this, "HitEfficiency/TimeMCHit", "Time of flight of MCHit; #it{t}(MCHit) [ns]; MCHits", { 60, 20., 80. } }; mutable Gaudi::Accumulators::StaticHistogram<1> m_effP{ this, "HitEfficiency/MomentumMCHit", "Momentum of MCHit; #it{p} [GeV]; MCHits", { 80, 0., 20. } }; + mutable Gaudi::Accumulators::StaticHistogram<1> m_effPt{ + this, "HitEfficiency/TransverseMomentumMCHit", "Transverse Momentum of MCHit; #it{pt} [GeV]; MCHits", { 40, 0., 10. } }; mutable Gaudi::Accumulators::StaticHistogram<1> m_effEFound{ this, "HitEfficiency/EnergyLossMCHitFound", "Energy loss of MCHit; #Delta#it{E} [MeV]; MCHits", @@ -290,6 +292,45 @@ namespace LHCb::FT { this, "HitEfficiency/TimeMCHitFound", "Time of flight of MCHit; #it{t}(MCHit) [ns]; MCHits", { 60, 20., 80. } }; mutable Gaudi::Accumulators::StaticHistogram<1> m_effPFound{ this, "HitEfficiency/MomentumMCHitFound", "Momentum of MCHit; #it{p} [GeV]; MCHits", { 80, 0., 20. } }; + + mutable Gaudi::Accumulators::StaticHistogram<1> m_effPtFound{ + this, "HitEfficiency/TransverseMomentumMCHitFound", "Transverse Momentum of MCHit; #it{pt} [GeV]; MCHits", { 40, 0., 10. } }; + mutable Gaudi::Accumulators::StaticProfileHistogram<1> m_effVsP{ + this, + "HitEfficiency/EfficiencyVsMomentum", + "Hit efficiency vs log(p); log(#it{p} [GeV]); Efficiency", + { 100, std::log10( 2. ), 2. } }; + mutable Gaudi::Accumulators::StaticProfileHistogram<1> m_effVsPt{ + this, + "HitEfficiency/EfficiencyVsTransverseMomentum", + "Hit efficiency vs log(pt); log(#it{pt} [GeV]); Efficiency", + { 100, std::log10( 0.4 ), 1. } }; + mutable Gaudi::Accumulators::HistogramMap> + m_effVsPPerLayer{ + this, + []( unsigned int layer ) { + return fmt::format( "HitEfficiency/Layer{}EfficiencyVsMomentum", layer ); + }, + []( unsigned int layer ) { + return fmt::format( "Hit efficiency vs log(p) (Layer {}); log(#it{{p}} [GeV]); Efficiency", layer ); + }, + { 100, std::log10( 2. ), 2. } }; + mutable Gaudi::Accumulators::HistogramMap> + m_effVsPtPerLayer{ + this, + []( unsigned int layer ) { + return fmt::format( "HitEfficiency/Layer{}EfficiencyVsTransverseMomentum", layer ); + }, + []( unsigned int layer ) { + return fmt::format( "Hit efficiency vs log(pt) (Layer {}); log(#it{{pt}} [GeV]); Efficiency", layer ); + }, + { 100, std::log10( 0.4 ), 1. } }; + mutable Gaudi::Accumulators::StaticProfileHistogram<1> m_effVsnCluster{ + this, + "HitEfficiency/EfficiencyVsnCluster", + "Hit efficiency vs Number of clusters; Clusters/event; Efficiency", + { 100, 0., 15.e3 } }; + mutable Gaudi::Accumulators::StaticHistogram<1> m_clusEff{ this, "ClustersEfficiency", "Cluster efficiency ; Efficiency [%]; Events", { 150, 75.05, 100.05 } }; mutable Gaudi::Accumulators::StaticHistogram<1> m_clusEffHighP{ @@ -496,17 +537,47 @@ void LHCb::FT::FTLiteClusterMonitor::operator()( const FTLiteCluster::FTLiteClus ++m_effE[mcHit->energy() / Gaudi::Units::MeV]; ++m_effTime[mcHit->time() / Gaudi::Units::ns]; ++m_effP[mcHit->p() / Gaudi::Units::GeV]; + ++m_effPt[mcPart->pt() / Gaudi::Units::GeV]; if ( mcHit->p() > 5 * Gaudi::Units::GeV ) { nMCHitsHighP++; } nMCHits++; - if ( efficientMCHits.find( mcHit ) != efficientMCHits.end() ) { // skip non-efficient hits + + // Efficiency vs Momentum calculation and plotting + bool isEfficient = efficientMCHits.find( mcHit ) != efficientMCHits.end(); + if ( mcHit->p() > 0. ) { + m_effVsP[std::log10( mcHit->p() / Gaudi::Units::GeV )] += isEfficient ? 1.0 : 0.0; + } + if ( mcPart->pt() > 0. ) { + m_effVsPt[std::log10( mcPart->pt() / Gaudi::Units::GeV )] += isEfficient ? 1.0 : 0.0; + } + + // Efficiency vs Momentum per Layer + const auto mat = det.findMat( mcHit->midPoint() ); + if ( mat ) { + const int layer_idx_signed = mat->elementID().globalLayerID() - FTConstants::nLayers; + if ( layer_idx_signed >= 0 ) { + const unsigned int layer_idx = static_cast( layer_idx_signed ); + + if ( mcHit->p() > 0. ) { + m_effVsPPerLayer[layer_idx][std::log10(mcHit->p() / Gaudi::Units::GeV)] += isEfficient ? 1.0 : 0.0; + } + + if ( mcPart->pt() > 0. ) { + m_effVsPtPerLayer[layer_idx][std::log10(mcPart->pt() / Gaudi::Units::GeV)] += isEfficient ? 1.0 : 0.0; + } + } + } + + if ( isEfficient ) { // skip non-efficient hits ++m_effE[mcHit->energy() / Gaudi::Units::MeV]; ++m_effTime[mcHit->time() / Gaudi::Units::ns]; ++m_effP[mcHit->p() / Gaudi::Units::GeV]; + ++m_effPt[mcPart->pt() / Gaudi::Units::GeV]; std::string histName = "Found"; ++m_effEFound[mcHit->energy() / Gaudi::Units::MeV]; ++m_effTimeFound[mcHit->time() / Gaudi::Units::ns]; ++m_effPFound[mcHit->p() / Gaudi::Units::GeV]; + ++m_effPtFound[mcPart->pt() / Gaudi::Units::GeV]; if ( mcHit->p() > 5 * Gaudi::Units::GeV ) { nMCHitsHighPFound++; } nMCHitsFound++; @@ -519,6 +590,12 @@ void LHCb::FT::FTLiteClusterMonitor::operator()( const FTLiteCluster::FTLiteClus ++m_clusEff[clusEff]; float clusEffHighP = ( nMCHitsHighP != 0 ) ? 100. * float( nMCHitsHighPFound ) / float( nMCHitsHighP ) : 0; ++m_clusEffHighP[clusEffHighP]; + + // Hit efficiency vs Number of clusters + if ( nMCHits != 0 ) { + float effValue = static_cast( nMCHitsFound ) / static_cast( nMCHits ); + m_effVsnCluster[clusters.size()] += effValue; + } if ( msgLevel( MSG::VERBOSE ) ) { debug() << "Cluster effiency (> 5 GeV) = " << format( "%4.1f", clusEff ) << "% (" -- GitLab From c96a8c708b38e8f5cc2300b34c6e3c1127dd1f04 Mon Sep 17 00:00:00 2001 From: Gitlab CI Date: Thu, 30 Oct 2025 09:34:36 +0000 Subject: [PATCH 2/2] pre-commit fixes patch generated by https://gitlab.cern.ch/lhcb/Boole/-/jobs/63804192 --- .../src/FTLiteClusterMonitor.cpp | 58 +++++++++---------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/FT/FTDigitisation/src/FTLiteClusterMonitor.cpp b/FT/FTDigitisation/src/FTLiteClusterMonitor.cpp index db347c2a4..1ef191940 100644 --- a/FT/FTDigitisation/src/FTLiteClusterMonitor.cpp +++ b/FT/FTDigitisation/src/FTLiteClusterMonitor.cpp @@ -282,8 +282,10 @@ namespace LHCb::FT { this, "HitEfficiency/TimeMCHit", "Time of flight of MCHit; #it{t}(MCHit) [ns]; MCHits", { 60, 20., 80. } }; mutable Gaudi::Accumulators::StaticHistogram<1> m_effP{ this, "HitEfficiency/MomentumMCHit", "Momentum of MCHit; #it{p} [GeV]; MCHits", { 80, 0., 20. } }; - mutable Gaudi::Accumulators::StaticHistogram<1> m_effPt{ - this, "HitEfficiency/TransverseMomentumMCHit", "Transverse Momentum of MCHit; #it{pt} [GeV]; MCHits", { 40, 0., 10. } }; + mutable Gaudi::Accumulators::StaticHistogram<1> m_effPt{ this, + "HitEfficiency/TransverseMomentumMCHit", + "Transverse Momentum of MCHit; #it{pt} [GeV]; MCHits", + { 40, 0., 10. } }; mutable Gaudi::Accumulators::StaticHistogram<1> m_effEFound{ this, "HitEfficiency/EnergyLossMCHitFound", "Energy loss of MCHit; #Delta#it{E} [MeV]; MCHits", @@ -292,9 +294,11 @@ namespace LHCb::FT { this, "HitEfficiency/TimeMCHitFound", "Time of flight of MCHit; #it{t}(MCHit) [ns]; MCHits", { 60, 20., 80. } }; mutable Gaudi::Accumulators::StaticHistogram<1> m_effPFound{ this, "HitEfficiency/MomentumMCHitFound", "Momentum of MCHit; #it{p} [GeV]; MCHits", { 80, 0., 20. } }; - - mutable Gaudi::Accumulators::StaticHistogram<1> m_effPtFound{ - this, "HitEfficiency/TransverseMomentumMCHitFound", "Transverse Momentum of MCHit; #it{pt} [GeV]; MCHits", { 40, 0., 10. } }; + + mutable Gaudi::Accumulators::StaticHistogram<1> m_effPtFound{ this, + "HitEfficiency/TransverseMomentumMCHitFound", + "Transverse Momentum of MCHit; #it{pt} [GeV]; MCHits", + { 40, 0., 10. } }; mutable Gaudi::Accumulators::StaticProfileHistogram<1> m_effVsP{ this, "HitEfficiency/EfficiencyVsMomentum", @@ -308,23 +312,21 @@ namespace LHCb::FT { mutable Gaudi::Accumulators::HistogramMap> m_effVsPPerLayer{ this, - []( unsigned int layer ) { - return fmt::format( "HitEfficiency/Layer{}EfficiencyVsMomentum", layer ); - }, + []( unsigned int layer ) { return fmt::format( "HitEfficiency/Layer{}EfficiencyVsMomentum", layer ); }, []( unsigned int layer ) { return fmt::format( "Hit efficiency vs log(p) (Layer {}); log(#it{{p}} [GeV]); Efficiency", layer ); }, { 100, std::log10( 2. ), 2. } }; mutable Gaudi::Accumulators::HistogramMap> - m_effVsPtPerLayer{ - this, - []( unsigned int layer ) { - return fmt::format( "HitEfficiency/Layer{}EfficiencyVsTransverseMomentum", layer ); - }, - []( unsigned int layer ) { - return fmt::format( "Hit efficiency vs log(pt) (Layer {}); log(#it{{pt}} [GeV]); Efficiency", layer ); - }, - { 100, std::log10( 0.4 ), 1. } }; + m_effVsPtPerLayer{ this, + []( unsigned int layer ) { + return fmt::format( "HitEfficiency/Layer{}EfficiencyVsTransverseMomentum", layer ); + }, + []( unsigned int layer ) { + return fmt::format( + "Hit efficiency vs log(pt) (Layer {}); log(#it{{pt}} [GeV]); Efficiency", layer ); + }, + { 100, std::log10( 0.4 ), 1. } }; mutable Gaudi::Accumulators::StaticProfileHistogram<1> m_effVsnCluster{ this, "HitEfficiency/EfficiencyVsnCluster", @@ -540,16 +542,12 @@ void LHCb::FT::FTLiteClusterMonitor::operator()( const FTLiteCluster::FTLiteClus ++m_effPt[mcPart->pt() / Gaudi::Units::GeV]; if ( mcHit->p() > 5 * Gaudi::Units::GeV ) { nMCHitsHighP++; } nMCHits++; - + // Efficiency vs Momentum calculation and plotting bool isEfficient = efficientMCHits.find( mcHit ) != efficientMCHits.end(); - if ( mcHit->p() > 0. ) { - m_effVsP[std::log10( mcHit->p() / Gaudi::Units::GeV )] += isEfficient ? 1.0 : 0.0; - } - if ( mcPart->pt() > 0. ) { - m_effVsPt[std::log10( mcPart->pt() / Gaudi::Units::GeV )] += isEfficient ? 1.0 : 0.0; - } - + if ( mcHit->p() > 0. ) { m_effVsP[std::log10( mcHit->p() / Gaudi::Units::GeV )] += isEfficient ? 1.0 : 0.0; } + if ( mcPart->pt() > 0. ) { m_effVsPt[std::log10( mcPart->pt() / Gaudi::Units::GeV )] += isEfficient ? 1.0 : 0.0; } + // Efficiency vs Momentum per Layer const auto mat = det.findMat( mcHit->midPoint() ); if ( mat ) { @@ -558,15 +556,15 @@ void LHCb::FT::FTLiteClusterMonitor::operator()( const FTLiteCluster::FTLiteClus const unsigned int layer_idx = static_cast( layer_idx_signed ); if ( mcHit->p() > 0. ) { - m_effVsPPerLayer[layer_idx][std::log10(mcHit->p() / Gaudi::Units::GeV)] += isEfficient ? 1.0 : 0.0; + m_effVsPPerLayer[layer_idx][std::log10( mcHit->p() / Gaudi::Units::GeV )] += isEfficient ? 1.0 : 0.0; } - + if ( mcPart->pt() > 0. ) { - m_effVsPtPerLayer[layer_idx][std::log10(mcPart->pt() / Gaudi::Units::GeV)] += isEfficient ? 1.0 : 0.0; + m_effVsPtPerLayer[layer_idx][std::log10( mcPart->pt() / Gaudi::Units::GeV )] += isEfficient ? 1.0 : 0.0; } } } - + if ( isEfficient ) { // skip non-efficient hits ++m_effE[mcHit->energy() / Gaudi::Units::MeV]; ++m_effTime[mcHit->time() / Gaudi::Units::ns]; @@ -590,7 +588,7 @@ void LHCb::FT::FTLiteClusterMonitor::operator()( const FTLiteCluster::FTLiteClus ++m_clusEff[clusEff]; float clusEffHighP = ( nMCHitsHighP != 0 ) ? 100. * float( nMCHitsHighPFound ) / float( nMCHitsHighP ) : 0; ++m_clusEffHighP[clusEffHighP]; - + // Hit efficiency vs Number of clusters if ( nMCHits != 0 ) { float effValue = static_cast( nMCHitsFound ) / static_cast( nMCHits ); -- GitLab