From 9deda761b0dcc740491ac463880fba3ed8c6f710 Mon Sep 17 00:00:00 2001 From: pagarcia <pagarcia@pluscc05.lbdaq.cern.ch> Date: Mon, 2 May 2022 16:58:07 +0200 Subject: [PATCH 1/3] Thread safe histograms for calo monitoring --- .../src/CaloFutureDigitMonitor.cpp | 47 +++++++++++++------ .../CaloFutureMoniDst/src/CaloFutureMoniAlg.h | 4 +- .../src/CaloFutureTimeAlignment.cpp | 40 ++++------------ 3 files changed, 44 insertions(+), 47 deletions(-) diff --git a/CaloFuture/CaloFutureMoniDst/src/CaloFutureDigitMonitor.cpp b/CaloFuture/CaloFutureMoniDst/src/CaloFutureDigitMonitor.cpp index adf9a92042c..71938fd0002 100644 --- a/CaloFuture/CaloFutureMoniDst/src/CaloFutureDigitMonitor.cpp +++ b/CaloFuture/CaloFutureMoniDst/src/CaloFutureDigitMonitor.cpp @@ -14,7 +14,9 @@ #include "CaloFutureUtils/CaloFutureAlgUtils.h" #include "DetDesc/GenericConditionAccessorHolder.h" #include "Event/CaloDigits_v2.h" -#include "LHCbAlgs/Consumer.h" +#include "GaudiAlg/Consumer.h" +#include <Gaudi/Accumulators/Histogram.h> +#include <mutex> // ============================================================================= @@ -53,6 +55,13 @@ public: private: Gaudi::Property<bool> m_spectrum{this, "Spectrum", false, "activate spectrum per channel histogramming"}; + //Define thread safe histograms + mutable Gaudi::Accumulators::Histogram<1> histo1{this, "4", "Hypo X", {m_xBin, m_xMin, m_xMax}}; + mutable Gaudi::Accumulators::Histogram<1> histo2{this, "5", "Hypo Y (thread save)", {m_yBin, m_yMin, m_yMax}}; + mutable Gaudi::Accumulators::Histogram<2> histo3{this, "6", "Digit position x vs y",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; + mutable Gaudi::Accumulators::WeightedHistogram<2> histoweighted7{this, "7", "energy weight",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; + mutable Gaudi::Accumulators::WeightedHistogram<2> histoweighted8{this, "8", detData() + " digits position 2D view",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; + mutable Gaudi::Accumulators::WeightedHistogram<2> histoweighted9{this, "9", detData() + " ADC 2D view",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; }; // ============================================================================= @@ -74,11 +83,16 @@ StatusCode CaloFutureDigitMonitor::initialize() { StatusCode sc = Consumer::initialize(); if ( sc.isFailure() ) return sc; - hBook1( "1", detData() + " : # of Digits", m_multMin, m_multMax, m_multBin ); - hBook1( "4", "Hypo X " + inputLocation(), m_xMin, m_xMax, m_xBin ); - hBook1( "5", "Hypo Y " + inputLocation(), m_yMin, m_yMax, m_yBin ); - hBook2( "6", "Digit position x vs y " + inputLocation(), m_xMin, m_xMax, m_xBin, m_yMin, m_yMax, m_yBin ); - info() << detData() << " digits from " << inputLocation() << endmsg; + if ( "Ecal" == detData() ) { + m_calo = getDet<DeCalorimeter>( DeCalorimeterLocation::Ecal ); + } else if ( "Hcal" == detData() ) { + m_calo = getDet<DeCalorimeter>( DeCalorimeterLocation::Hcal ); + } else { + return Error( "Unknown detector name " + detData() ); + } + + // hBook1( "1", detData() + " : # of Digits", m_multMin, m_multMax, m_multBin ); + info() << detData() << " digits from " << inputLocation() << endmsg; return StatusCode::SUCCESS; } @@ -112,14 +126,17 @@ void CaloFutureDigitMonitor::operator()( const Input& digits, const DeCalorimete if ( adc < m_adcFilter ) continue; count( id ); hFill1( id, "2", e ); - const double x = calo.cellCenter( id ).X(); - const double y = calo.cellCenter( id ).Y(); - hFill1( id, "4", x ); - hFill1( id, "5", y ); - hFill2( id, "6", x, y ); - if ( doHisto( "7" ) ) fillCaloFuture2D( "7", id, e, detData() + " energy weighted" ); - if ( doHisto( "8" ) ) fillCaloFuture2D( "8", id, 1., detData() + " digits position 2D view" ); - if ( doHisto( "9" ) ) fillCaloFuture2D( "9", id, adc, detData() + " ADC 2D view" ); + const double x = m_calo->cellCenter( id ).X(); + const double y = m_calo->cellCenter( id ).Y(); + // fill thread safe histograms + ++histo1[x]; + ++histo2[y]; + ++histo3[{x,y}]; + + histoweighted7[{x,y}] += e; + histoweighted9[{x,y}] += adc; + histoweighted8[{x,y}] += 1.; + if ( m_spectrum ) { if ( msgLevel( MSG::DEBUG ) ) debug() << "Filling cell by cell histograms" << endmsg; @@ -140,6 +157,6 @@ void CaloFutureDigitMonitor::operator()( const Input& digits, const DeCalorimete } } } - fillFutureCounters( "1" ); + //fillFutureCounters( "1" ); return; // StatusCode::SUCCESS; } diff --git a/CaloFuture/CaloFutureMoniDst/src/CaloFutureMoniAlg.h b/CaloFuture/CaloFutureMoniDst/src/CaloFutureMoniAlg.h index 225503e38eb..2f1a4d99c36 100644 --- a/CaloFuture/CaloFutureMoniDst/src/CaloFutureMoniAlg.h +++ b/CaloFuture/CaloFutureMoniDst/src/CaloFutureMoniAlg.h @@ -108,8 +108,8 @@ protected: Gaudi::Property<int> m_multBin{this, "HistoMultiplicityBin", 100}; Gaudi::Property<int> m_sizeBin{this, "HistoSizeBin", 25}; - Gaudi::Property<float> m_eFilter{this, "EnergyFilter", -100.}; - Gaudi::Property<float> m_etFilter{this, "EtFilter", -100.}; + Gaudi::Property<float> m_eFilter{this, "EnergyFilter", -9999999.}; + Gaudi::Property<float> m_etFilter{this, "EtFilter", -9999999.}; Gaudi::Property<float> m_adcFilter{this, "ADCFilter", -100.}; Gaudi::Property<float> m_massFilterMin{this, "MassWindowMin", -9999999.}; Gaudi::Property<float> m_massFilterMax{this, "MassWindowMax", +9999999.}; diff --git a/CaloFuture/CaloFutureMoniDst/src/CaloFutureTimeAlignment.cpp b/CaloFuture/CaloFutureMoniDst/src/CaloFutureTimeAlignment.cpp index 316c638e342..22a924488d3 100644 --- a/CaloFuture/CaloFutureMoniDst/src/CaloFutureTimeAlignment.cpp +++ b/CaloFuture/CaloFutureMoniDst/src/CaloFutureTimeAlignment.cpp @@ -15,7 +15,9 @@ #include "DetDesc/GenericConditionAccessorHolder.h" #include "Event/CaloDigits_v2.h" #include "Event/ODIN.h" -#include "LHCbAlgs/Consumer.h" +#include "GaudiAlg/Consumer.h" +#include <Gaudi/Accumulators/Histogram.h> +#include <mutex> // ============================================================================= @@ -52,16 +54,16 @@ class CaloFutureTimeAlignment final LHCb::DetDesc::usesBaseAndConditions<CaloFutureMoniAlg, DeCalorimeter>> { public: StatusCode initialize() override; - void operator()( const Input&, const LHCb::ODIN&, const DeCalorimeter& ) const override; - + void operator()( const Input&, const LHCb::ODIN& ) const override; CaloFutureTimeAlignment( const std::string& name, ISvcLocator* pSvcLocator ); private: - Gaudi::Property<bool> m_spectrum{this, "Spectrum", false, "activate spectrum per channel histogramming"}; - Gaudi::Property<bool> m_perCrate{this, "PerCrate", true, "activate spectrum per crate"}; - Gaudi::Property<std::vector<int>> m_TAE_BXIDs{this, "TAE_BXIDs"}; + mutable Gaudi::Accumulators::Histogram<2> histoTA_E{this, "TA_E", "Energy per BX " + inputLocation(),{{3600, 0, 3600}, {m_yBinTA, m_energyMin, m_energyMax}}}; + mutable Gaudi::Accumulators::Histogram<2> histoTA_ADC{this, "TA_ADC", "ADC per BX " + inputLocation(),{{3600, 0, 3600}, {m_yBinTA, m_adcMin, m_adcMax}}}; + }; + // ============================================================================= DECLARE_COMPONENT( CaloFutureTimeAlignment ) @@ -87,8 +89,6 @@ StatusCode CaloFutureTimeAlignment::initialize() { m_xMax = 3600; m_xBin = m_xMax - m_xMin; - hBook2( "TA_E", "Energy per BX " + inputLocation(), m_xMin, m_xMax, m_xBin, m_energyMin, m_energyMax, m_yBinTA ); - hBook2( "TA_ADC", "ADC per BX " + inputLocation(), m_xMin, m_xMax, m_xBin, m_adcMin, m_adcMax, m_yBinTA ); info() << "Using digits from " << inputLocation() << endmsg; @@ -113,28 +113,8 @@ void CaloFutureTimeAlignment::operator()( const Input& digits, const LHCb::ODIN& for ( const auto& digit : digits ) { if ( digit.adc() < m_adcFilter ) continue; - hFill2( "TA_E", bcID, digit.energy() ); - hFill2( "TA_ADC", bcID, digit.adc() ); - - // Fill per crate histograms (TAE mode) - if ( m_perCrate.value() ) { - const auto crate = calo.cardCrate( calo.cardNumber( digit.cellID() ) ); - plot2D( bcID, digit.adc(), fmt::format( "TAE_crate{}", crate ), 0, 3600, m_adcMin, m_adcMax, 3600, m_yBinTA ); - } - // Fill cell by cell histograms (TAE mode) - if ( m_spectrum.value() ) { - const auto id = digit.cellID(); - int TAEwindow = -9999; - for ( auto TAEbx : m_TAE_BXIDs ) { - if ( ( bcID < TAEbx + 5 ) & ( bcID > TAEbx - 5 ) ) { TAEwindow = bcID - TAEbx; } - plot1D( TAEbx, "TAE BXIDs", "TAE BXIDs", 0, 4000, 4000, 1. ); // safety check on which BX we read on - } - if ( TAEwindow > -9999 ) { - std::string tit = fmt::format( "{} channel : {}", detData(), Gaudi::Utils::toString( id ) ); - std::string name_tae = fmt::format( "{}Cells/{}/{}_{}_tae", detData(), id.areaName(), id.row(), id.col() ); - plot1D( TAEwindow, name_tae, tit, -5, 6, 11, digit.adc() ); - } - } + ++histoTA_E[{bcID,digit.energy() }]; + ++histoTA_ADC[{bcID,digit.adc() }]; } return; // StatusCode::SUCCESS; -- GitLab From ab03a4e6b777b2ce83cecc5e064b05e921ba60fc Mon Sep 17 00:00:00 2001 From: pagarcia <pagarcia@pluscc02.lbdaq.cern.ch> Date: Tue, 17 May 2022 15:10:26 +0200 Subject: [PATCH 2/3] thread safe --- .../src/CaloFutureDigitMonitor.cpp | 24 +++++++++++++++---- .../src/CaloFutureTimeAlignment.cpp | 11 +++++++-- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/CaloFuture/CaloFutureMoniDst/src/CaloFutureDigitMonitor.cpp b/CaloFuture/CaloFutureMoniDst/src/CaloFutureDigitMonitor.cpp index 71938fd0002..a2bbf7845b8 100644 --- a/CaloFuture/CaloFutureMoniDst/src/CaloFutureDigitMonitor.cpp +++ b/CaloFuture/CaloFutureMoniDst/src/CaloFutureDigitMonitor.cpp @@ -56,12 +56,14 @@ public: private: Gaudi::Property<bool> m_spectrum{this, "Spectrum", false, "activate spectrum per channel histogramming"}; //Define thread safe histograms + mutable Gaudi::Accumulators::Histogram<1> histo1{this, "4", "Hypo X", {m_xBin, m_xMin, m_xMax}}; mutable Gaudi::Accumulators::Histogram<1> histo2{this, "5", "Hypo Y (thread save)", {m_yBin, m_yMin, m_yMax}}; mutable Gaudi::Accumulators::Histogram<2> histo3{this, "6", "Digit position x vs y",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; mutable Gaudi::Accumulators::WeightedHistogram<2> histoweighted7{this, "7", "energy weight",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; mutable Gaudi::Accumulators::WeightedHistogram<2> histoweighted8{this, "8", detData() + " digits position 2D view",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; mutable Gaudi::Accumulators::WeightedHistogram<2> histoweighted9{this, "9", detData() + " ADC 2D view",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; + }; // ============================================================================= @@ -90,8 +92,13 @@ StatusCode CaloFutureDigitMonitor::initialize() { } else { return Error( "Unknown detector name " + detData() ); } - - // hBook1( "1", detData() + " : # of Digits", m_multMin, m_multMax, m_multBin ); + /* + hBook1( "1", detData() + " : # of Digits", m_multMin, m_multMax, m_multBin ); + hBook1( "1", detData() + " : # of Digits", m_multMin, m_multMax, m_multBin ); + hBook1( "4", "Hypo X " + inputLocation(), m_xMin, m_xMax, m_xBin ); + hBook1( "5", "Hypo Y " + inputLocation(), m_yMin, m_yMax, m_yBin ); + hBook2( "6", "Digit position x vs y " + inputLocation(), m_xMin, m_xMax, m_xBin, m_yMin, m_yMax, m_yBin ); + */ info() << detData() << " digits from " << inputLocation() << endmsg; return StatusCode::SUCCESS; @@ -125,10 +132,19 @@ void CaloFutureDigitMonitor::operator()( const Input& digits, const DeCalorimete if ( et < m_etFilter ) continue; if ( adc < m_adcFilter ) continue; count( id ); - hFill1( id, "2", e ); + //hFill1( id, "2", e ); const double x = m_calo->cellCenter( id ).X(); const double y = m_calo->cellCenter( id ).Y(); + /* + hFill1( id, "4", x ); + hFill1( id, "5", y ); + hFill2( id, "6", x, y ); + if ( doHisto( "7" ) ) fillCaloFuture2D( "7", id, e, detData() + " energy weighted" ); + if ( doHisto( "8" ) ) fillCaloFuture2D( "8", id, 1., detData() + " digits position 2D view" ); + if ( doHisto( "9" ) ) fillCaloFuture2D( "9", id, adc, detData() + " ADC 2D view" ); + */ // fill thread safe histograms + ++histo1[x]; ++histo2[y]; ++histo3[{x,y}]; @@ -136,7 +152,7 @@ void CaloFutureDigitMonitor::operator()( const Input& digits, const DeCalorimete histoweighted7[{x,y}] += e; histoweighted9[{x,y}] += adc; histoweighted8[{x,y}] += 1.; - + if ( m_spectrum ) { if ( msgLevel( MSG::DEBUG ) ) debug() << "Filling cell by cell histograms" << endmsg; diff --git a/CaloFuture/CaloFutureMoniDst/src/CaloFutureTimeAlignment.cpp b/CaloFuture/CaloFutureMoniDst/src/CaloFutureTimeAlignment.cpp index 22a924488d3..61f7400270b 100644 --- a/CaloFuture/CaloFutureMoniDst/src/CaloFutureTimeAlignment.cpp +++ b/CaloFuture/CaloFutureMoniDst/src/CaloFutureTimeAlignment.cpp @@ -56,11 +56,11 @@ public: StatusCode initialize() override; void operator()( const Input&, const LHCb::ODIN& ) const override; CaloFutureTimeAlignment( const std::string& name, ISvcLocator* pSvcLocator ); - + /* private: mutable Gaudi::Accumulators::Histogram<2> histoTA_E{this, "TA_E", "Energy per BX " + inputLocation(),{{3600, 0, 3600}, {m_yBinTA, m_energyMin, m_energyMax}}}; mutable Gaudi::Accumulators::Histogram<2> histoTA_ADC{this, "TA_ADC", "ADC per BX " + inputLocation(),{{3600, 0, 3600}, {m_yBinTA, m_adcMin, m_adcMax}}}; - + */ }; @@ -89,6 +89,8 @@ StatusCode CaloFutureTimeAlignment::initialize() { m_xMax = 3600; m_xBin = m_xMax - m_xMin; + hBook2( "TA_E", "Energy per BX " + inputLocation(), m_xMin, m_xMax, m_xBin, m_energyMin, m_energyMax, m_yBinTA ); + hBook2( "TA_ADC", "ADC per BX " + inputLocation(), m_xMin, m_xMax, m_xBin, m_adcMin, m_adcMax, m_yBinTA ); info() << "Using digits from " << inputLocation() << endmsg; @@ -113,8 +115,13 @@ void CaloFutureTimeAlignment::operator()( const Input& digits, const LHCb::ODIN& for ( const auto& digit : digits ) { if ( digit.adc() < m_adcFilter ) continue; + /* ++histoTA_E[{bcID,digit.energy() }]; ++histoTA_ADC[{bcID,digit.adc() }]; + */ + hFill2( "TA_E", bcID, digit.energy() ); + hFill2( "TA_ADC", bcID, digit.adc() ); + } return; // StatusCode::SUCCESS; -- GitLab From 810087348b0db636029803bd7f73c642a32a378d Mon Sep 17 00:00:00 2001 From: Paula <Paula paula.garc96@gmail.com> Date: Thu, 4 Aug 2022 10:13:19 +0200 Subject: [PATCH 3/3] thread safe new changes --- .../src/CaloFutureDigitMonitor.cpp | 57 ++++++------------- .../src/CaloFutureTimeAlignment.cpp | 37 ++++++++---- 2 files changed, 44 insertions(+), 50 deletions(-) diff --git a/CaloFuture/CaloFutureMoniDst/src/CaloFutureDigitMonitor.cpp b/CaloFuture/CaloFutureMoniDst/src/CaloFutureDigitMonitor.cpp index a2bbf7845b8..a260a44a40a 100644 --- a/CaloFuture/CaloFutureMoniDst/src/CaloFutureDigitMonitor.cpp +++ b/CaloFuture/CaloFutureMoniDst/src/CaloFutureDigitMonitor.cpp @@ -15,6 +15,7 @@ #include "DetDesc/GenericConditionAccessorHolder.h" #include "Event/CaloDigits_v2.h" #include "GaudiAlg/Consumer.h" +#include "LHCbAlgs/Consumer.h" #include <Gaudi/Accumulators/Histogram.h> #include <mutex> @@ -57,13 +58,14 @@ private: Gaudi::Property<bool> m_spectrum{this, "Spectrum", false, "activate spectrum per channel histogramming"}; //Define thread safe histograms - mutable Gaudi::Accumulators::Histogram<1> histo1{this, "4", "Hypo X", {m_xBin, m_xMin, m_xMax}}; - mutable Gaudi::Accumulators::Histogram<1> histo2{this, "5", "Hypo Y (thread save)", {m_yBin, m_yMin, m_yMax}}; - mutable Gaudi::Accumulators::Histogram<2> histo3{this, "6", "Digit position x vs y",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; - mutable Gaudi::Accumulators::WeightedHistogram<2> histoweighted7{this, "7", "energy weight",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; - mutable Gaudi::Accumulators::WeightedHistogram<2> histoweighted8{this, "8", detData() + " digits position 2D view",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; - mutable Gaudi::Accumulators::WeightedHistogram<2> histoweighted9{this, "9", detData() + " ADC 2D view",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; - + mutable Gaudi::Accumulators::Histogram<1> histoDigitX{this, "DigitX", "Digit X", {m_xBin, m_xMin, m_xMax}}; + mutable Gaudi::Accumulators::Histogram<1> histoDigitY{this, "DigitY", "Digit Y", {m_yBin, m_yMin, m_yMax}}; + mutable Gaudi::Accumulators::Histogram<2> histoDigitXY{this, "DigitXY", "Digit position x vs y",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; + mutable Gaudi::Accumulators::WeightedHistogram<2> histoweightedE{this, "Energy2D", "energy weight",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; + mutable Gaudi::Accumulators::WeightedHistogram<2> histoDigit2D{this, "Digits2D", detData() + " digits position 2D view",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; + mutable Gaudi::Accumulators::WeightedHistogram<2> histoweightedADC{this, "ADC2D", detData() + " ADC 2D view",{{m_xBin, m_xMin, m_xMax}, {m_yBin, m_yMin, m_yMax}}}; + mutable Gaudi::Accumulators::Histogram<1> histoET{this, "ET", "ET", {m_etBin, m_etMin, m_etMax}}; + mutable Gaudi::Accumulators::Histogram<1> histoADC{this, "ADC", "ADC", {m_adcBin, m_adcMin, m_adcMax}}; }; // ============================================================================= @@ -84,21 +86,6 @@ CaloFutureDigitMonitor::CaloFutureDigitMonitor( const std::string& name, ISvcLoc StatusCode CaloFutureDigitMonitor::initialize() { StatusCode sc = Consumer::initialize(); if ( sc.isFailure() ) return sc; - - if ( "Ecal" == detData() ) { - m_calo = getDet<DeCalorimeter>( DeCalorimeterLocation::Ecal ); - } else if ( "Hcal" == detData() ) { - m_calo = getDet<DeCalorimeter>( DeCalorimeterLocation::Hcal ); - } else { - return Error( "Unknown detector name " + detData() ); - } - /* - hBook1( "1", detData() + " : # of Digits", m_multMin, m_multMax, m_multBin ); - hBook1( "1", detData() + " : # of Digits", m_multMin, m_multMax, m_multBin ); - hBook1( "4", "Hypo X " + inputLocation(), m_xMin, m_xMax, m_xBin ); - hBook1( "5", "Hypo Y " + inputLocation(), m_yMin, m_yMax, m_yBin ); - hBook2( "6", "Digit position x vs y " + inputLocation(), m_xMin, m_xMax, m_xBin, m_yMin, m_yMax, m_yBin ); - */ info() << detData() << " digits from " << inputLocation() << endmsg; return StatusCode::SUCCESS; @@ -132,26 +119,17 @@ void CaloFutureDigitMonitor::operator()( const Input& digits, const DeCalorimete if ( et < m_etFilter ) continue; if ( adc < m_adcFilter ) continue; count( id ); - //hFill1( id, "2", e ); const double x = m_calo->cellCenter( id ).X(); const double y = m_calo->cellCenter( id ).Y(); - /* - hFill1( id, "4", x ); - hFill1( id, "5", y ); - hFill2( id, "6", x, y ); - if ( doHisto( "7" ) ) fillCaloFuture2D( "7", id, e, detData() + " energy weighted" ); - if ( doHisto( "8" ) ) fillCaloFuture2D( "8", id, 1., detData() + " digits position 2D view" ); - if ( doHisto( "9" ) ) fillCaloFuture2D( "9", id, adc, detData() + " ADC 2D view" ); - */ // fill thread safe histograms - ++histo1[x]; - ++histo2[y]; - ++histo3[{x,y}]; + ++histoDigitX[x]; + ++histoDigitY[y]; + ++histoDigitXY[{x,y}]; - histoweighted7[{x,y}] += e; - histoweighted9[{x,y}] += adc; - histoweighted8[{x,y}] += 1.; + histoweightedE[{x,y}] += e; + histoweightedADC[{x,y}] += adc; + histoDigit2D[{x,y}] += 1.; if ( m_spectrum ) { @@ -168,11 +146,10 @@ void CaloFutureDigitMonitor::operator()( const Input& digits, const DeCalorimete verbose() << " et " << et << " cell " << unit_et << endmsg; verbose() << " adc " << adc << " cell " << unit_adc << endmsg; } else { - plot1D( et, unit_et, tit.str(), m_etMin, m_etMax, m_etBin ); - plot1D( adc, unit_adc, tit.str(), m_adcMin, m_adcMax, m_adcBin ); + ++histoET[et]; + ++histoADC[adc]; } } } - //fillFutureCounters( "1" ); return; // StatusCode::SUCCESS; } diff --git a/CaloFuture/CaloFutureMoniDst/src/CaloFutureTimeAlignment.cpp b/CaloFuture/CaloFutureMoniDst/src/CaloFutureTimeAlignment.cpp index 61f7400270b..736bd7776c4 100644 --- a/CaloFuture/CaloFutureMoniDst/src/CaloFutureTimeAlignment.cpp +++ b/CaloFuture/CaloFutureMoniDst/src/CaloFutureTimeAlignment.cpp @@ -16,6 +16,7 @@ #include "Event/CaloDigits_v2.h" #include "Event/ODIN.h" #include "GaudiAlg/Consumer.h" +#include "LHCbAlgs/Consumer.h" #include <Gaudi/Accumulators/Histogram.h> #include <mutex> @@ -54,13 +55,19 @@ class CaloFutureTimeAlignment final LHCb::DetDesc::usesBaseAndConditions<CaloFutureMoniAlg, DeCalorimeter>> { public: StatusCode initialize() override; - void operator()( const Input&, const LHCb::ODIN& ) const override; + void operator()( const Input&, const LHCb::ODIN&, const DeCalorimeter& ) const override; CaloFutureTimeAlignment( const std::string& name, ISvcLocator* pSvcLocator ); - /* + private: + Gaudi::Property<bool> m_spectrum{this, "Spectrum", false, "activate spectrum per channel histogramming"}; + Gaudi::Property<bool> m_perCrate{this, "PerCrate", true, "activate spectrum per crate"}; + Gaudi::Property<std::vector<int>> m_TAE_BXIDs{this, "TAE_BXIDs"}; + mutable Gaudi::Accumulators::Histogram<2> histoTA_E{this, "TA_E", "Energy per BX " + inputLocation(),{{3600, 0, 3600}, {m_yBinTA, m_energyMin, m_energyMax}}}; mutable Gaudi::Accumulators::Histogram<2> histoTA_ADC{this, "TA_ADC", "ADC per BX " + inputLocation(),{{3600, 0, 3600}, {m_yBinTA, m_adcMin, m_adcMax}}}; - */ + mutable Gaudi::Accumulators::Histogram<2> histoTA_ADC_perCrate{this, "TA_ADC", "ADC per BX " + inputLocation(),{{3600, 0, 3600}, {m_yBinTA, m_adcMin, m_adcMax}}}; + mutable Gaudi::Accumulators::Histogram<1> histoTAEbx{this, "TAEbx", "TAEbx", {4000, 0, 4000}}; + mutable Gaudi::Accumulators::Histogram<1> histoTA_w{this, "TAEw", "TAEw", {11, -5, 6}}; }; @@ -89,9 +96,6 @@ StatusCode CaloFutureTimeAlignment::initialize() { m_xMax = 3600; m_xBin = m_xMax - m_xMin; - hBook2( "TA_E", "Energy per BX " + inputLocation(), m_xMin, m_xMax, m_xBin, m_energyMin, m_energyMax, m_yBinTA ); - hBook2( "TA_ADC", "ADC per BX " + inputLocation(), m_xMin, m_xMax, m_xBin, m_adcMin, m_adcMax, m_yBinTA ); - info() << "Using digits from " << inputLocation() << endmsg; return StatusCode::SUCCESS; @@ -115,13 +119,26 @@ void CaloFutureTimeAlignment::operator()( const Input& digits, const LHCb::ODIN& for ( const auto& digit : digits ) { if ( digit.adc() < m_adcFilter ) continue; - /* + ++histoTA_E[{bcID,digit.energy() }]; ++histoTA_ADC[{bcID,digit.adc() }]; - */ - hFill2( "TA_E", bcID, digit.energy() ); - hFill2( "TA_ADC", bcID, digit.adc() ); + if ( m_perCrate.value() ) { + const auto crate = calo.cardCrate( calo.cardNumber( digit.cellID() ) ); + ++histoTA_ADC_perCrate[{bcID,digit.adc() }]; + } + // Fill cell by cell histograms (TAE mode) + if ( m_spectrum.value() ) { + const auto id = digit.cellID(); + int TAEwindow = -9999; + for ( auto TAEbx : m_TAE_BXIDs ) { + if ( ( bcID < TAEbx + 5 ) & ( bcID > TAEbx - 5 ) ) { TAEwindow = bcID - TAEbx; } + ++histoTAEbx[TAEbx]; + } + if ( TAEwindow > -9999 ) { + std::string tit = fmt::format( "{} channel : {}", detData(), Gaudi::Utils::toString( id ) ); + std::string name_tae = fmt::format( "{}Cells/{}/{}_{}_tae", detData(), id.areaName(), id.row(), id.col() ); + ++histoTAE_w[TAEwindow]; } return; // StatusCode::SUCCESS; -- GitLab