diff --git a/Calo/CaloDAQ/CaloDAQ/ICaloDigitFilterTool.h b/Calo/CaloDAQ/CaloDAQ/ICaloDigitFilterTool.h deleted file mode 100644 index 564bc8a4df8cf0f2f0ff67ea8ae6e110c260c2f0..0000000000000000000000000000000000000000 --- a/Calo/CaloDAQ/CaloDAQ/ICaloDigitFilterTool.h +++ /dev/null @@ -1,40 +0,0 @@ -/*****************************************************************************\ -* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration * -* * -* This software is distributed under the terms of the GNU General Public * -* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -#ifndef ICALODIGITFILTERTOOL_H -#define ICALODIGITFILTERTOOL_H 1 - -// Include files -// from STL -#include <string> - -// from Gaudi -#include "Event/CaloDigit.h" -#include "GaudiKernel/IAlgTool.h" - -/** @class ICaloDigitFilterTool ICaloDigitFilterTool.h - * - * - * @author Olivier Deschamps - * @date 2010-12-13 - */ -struct ICaloDigitFilterTool : extend_interfaces<IAlgTool> { - - // Return the interface ID - DeclareInterfaceID( ICaloDigitFilterTool, 3, 0 ); - - virtual int getScale() = 0; - virtual bool cleanDigits( const std::string& det, bool substr = true, bool mask = true, bool spd = false ) = 0; - virtual int method( const std::string& det ) = 0; - virtual double offset( LHCb::CaloCellID id, bool spd = false ) = 0; - virtual double offsetRMS( LHCb::CaloCellID id, bool spd = false ) = 0; -}; - -#endif // ICALODIGITFILTERTOOL_H diff --git a/Calo/CaloDAQ/dict/CaloDAQDict.h b/Calo/CaloDAQ/dict/CaloDAQDict.h index 7c75d8d1649ae73c52a2236c553340d548ebf102..3d9403bb0066829ee73c414da3b93beb74bc38c0 100644 --- a/Calo/CaloDAQ/dict/CaloDAQDict.h +++ b/Calo/CaloDAQ/dict/CaloDAQDict.h @@ -12,7 +12,6 @@ #define DICT_CALODAQDICT_H 1 #include "CaloDAQ/ICaloDataProvider.h" -#include "CaloDAQ/ICaloDigitFilterTool.h" #include "CaloDAQ/ICaloEnergyFromRaw.h" #include "CaloDAQ/ICaloL0DataProvider.h" #include "CaloDAQ/ICaloReadoutTool.h" diff --git a/Calo/CaloDAQ/dict/CaloDAQDict.xml b/Calo/CaloDAQ/dict/CaloDAQDict.xml index d53a6be600fa5b4be5af13eafc808d33a137c16a..edc5967f2085fc1b6fabf3c439875b0d351404a2 100644 --- a/Calo/CaloDAQ/dict/CaloDAQDict.xml +++ b/Calo/CaloDAQ/dict/CaloDAQDict.xml @@ -16,6 +16,5 @@ <class name = "ICaloReadoutTool" /> <class name = "ICaloTriggerAdcsFromRaw" /> <class name = "ICaloTriggerBitsFromRaw" /> - <class name = "ICaloDigitFilterTool" /> </lcgdict> diff --git a/Calo/CaloDAQ/src/CaloDigitFilterAlg.cpp b/Calo/CaloDAQ/src/CaloDigitFilterAlg.cpp deleted file mode 100644 index 297d5a85f554bc3006344da5857c7861f9e1bf6c..0000000000000000000000000000000000000000 --- a/Calo/CaloDAQ/src/CaloDigitFilterAlg.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/*****************************************************************************\ -* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration * -* * -* This software is distributed under the terms of the GNU General Public * -* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -// Include files - -// from Gaudi -#include "CaloDet/DeCalorimeter.h" -// local -#include "CaloDigitFilterAlg.h" - -// Declaration of the Algorithm Factory -DECLARE_COMPONENT( CaloDigitFilterAlg ) - -//----------------------------------------------------------------------------- -// Implementation file for class : CaloDigitFilterAlg -// -// 2010-12-21 : Olivier Deschamps -//----------------------------------------------------------------------------- -namespace { - constexpr bool mask( int val ) { return ( val & 0x1 ) != 0; } - constexpr bool offset( int val ) { return ( val & 0x2 ) != 0; } -} // namespace - -//============================================================================= -// Initialization -//============================================================================= -StatusCode CaloDigitFilterAlg::initialize() { - StatusCode sc = GaudiAlgorithm::initialize(); // must be executed first - if ( sc.isFailure() ) return sc; // error printed already by GaudiAlgorithm - - if ( msgLevel( MSG::DEBUG ) ) debug() << "==> Initialize" << endmsg; - - m_filter = tool<ICaloDigitFilterTool>( "CaloDigitFilterTool", "FilterTool" ); - - return StatusCode::SUCCESS; -} - -//============================================================================= -// Main execution -//============================================================================= -StatusCode CaloDigitFilterAlg::execute() { - - if ( msgLevel( MSG::DEBUG ) ) debug() << "==> Execute" << endmsg; - - if ( mask( m_ecal ) || offset( m_ecal ) ) - if ( !m_filter->cleanDigits( "Ecal", offset( m_ecal ), mask( m_ecal ) ) ) - Warning( "Ecal digits filtering failed", StatusCode::SUCCESS ).ignore(); - - if ( mask( m_hcal ) || offset( m_hcal ) ) - if ( !m_filter->cleanDigits( "Hcal", offset( m_hcal ), mask( m_hcal ) ) ) - Warning( "Hcal digits filtering failed", StatusCode::SUCCESS ).ignore(); - - if ( mask( m_prs ) || offset( m_prs ) ) - if ( !m_filter->cleanDigits( "Prs", offset( m_prs ), mask( m_prs ) ) ) - Warning( "Prs digit filtering failed", StatusCode::SUCCESS ).ignore(); - - if ( mask( m_spd ) || offset( m_spd ) ) - if ( !m_filter->cleanDigits( "Spd", offset( m_spd ), mask( m_spd ) ) ) - Warning( "Spd digit filtering failed", StatusCode::SUCCESS ).ignore(); - - return StatusCode::SUCCESS; -} - -//============================================================================= diff --git a/Calo/CaloDAQ/src/CaloDigitFilterAlg.h b/Calo/CaloDAQ/src/CaloDigitFilterAlg.h deleted file mode 100644 index c3b2809e5b2c7730e3f365a4fbc122df0bb866e0..0000000000000000000000000000000000000000 --- a/Calo/CaloDAQ/src/CaloDigitFilterAlg.h +++ /dev/null @@ -1,41 +0,0 @@ -/*****************************************************************************\ -* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration * -* * -* This software is distributed under the terms of the GNU General Public * -* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -#ifndef CALODIGITFILTERALG_H -#define CALODIGITFILTERALG_H 1 - -// Include files -// from Gaudi -#include "CaloDAQ/ICaloDigitFilterTool.h" -#include "GaudiAlg/GaudiAlgorithm.h" - -/** @class CaloDigitFilterAlg CaloDigitFilterAlg.h - * - * @author Olivier Deschamps - * @date 2010-12-21 - */ - -class CaloDigitFilterAlg : public GaudiAlgorithm { -public: - /// Standard constructor - using GaudiAlgorithm::GaudiAlgorithm; - - StatusCode initialize() override; ///< Algorithm initialization - StatusCode execute() override; ///< Algorithm execution - -private: - Gaudi::Property<int> m_ecal{this, "EcalFilter", 0x3}; // 1 = Mask , 2=Offset , 3 = both, 0 = none - Gaudi::Property<int> m_hcal{this, "HcalFilter", 0x3}; // 1 = Mask , 2=Offset , 3 = both, 0 = none - Gaudi::Property<int> m_prs{this, "PrsFilter", 0x3}; // 1 = Mask , 2=Offset , 3 = both, 0 = none - Gaudi::Property<int> m_spd{this, "SpdFilter", 0x1}; // 1 = Mask , 2=Offset , 3 = both, 0 = none - ICaloDigitFilterTool* m_filter = nullptr; -}; - -#endif // CALODIGITFILTERALG_H diff --git a/Calo/CaloDAQ/src/CaloDigitFilterTool.cpp b/Calo/CaloDAQ/src/CaloDigitFilterTool.cpp deleted file mode 100644 index 694da83f57361ff540610ffe968b3213d0f27e36..0000000000000000000000000000000000000000 --- a/Calo/CaloDAQ/src/CaloDigitFilterTool.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/*****************************************************************************\ -* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration * -* * -* This software is distributed under the terms of the GNU General Public * -* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -// Include files -// local -#include "CaloDigitFilterTool.h" - -//----------------------------------------------------------------------------- -// Implementation file for class : CaloDigitFilterTool -// -// 2010-12-13 : Olivier Deschamps -//----------------------------------------------------------------------------- - -// Declaration of the Tool Factory -DECLARE_COMPONENT( CaloDigitFilterTool ) - -//============================================================================= -// Standard constructor, initializes variables -//============================================================================= -CaloDigitFilterTool::CaloDigitFilterTool( const std::string& type, const std::string& name, const IInterface* parent ) - : base_class( type, name, parent ) { - declareInterface<ICaloDigitFilterTool>( this ); - declareProperty( "MaskMap", m_maskMap ); - declareProperty( "UseCondDB", m_useCondDB = true ); - declareProperty( "EcalOffset", m_ecalMaps.offsets ); - declareProperty( "HcalOffset", m_hcalMaps.offsets ); - declareProperty( "PrsOffset", m_prsMaps.offsets ); - declareProperty( "EcalOffsetRMS", m_ecalMaps.offsetsRMS ); - declareProperty( "HcalOffsetRMS", m_hcalMaps.offsetsRMS ); - declareProperty( "PrsOffsetRMS", m_prsMaps.offsetsRMS ); - declareProperty( "EcalOffsetSPD", m_ecalMaps.offsetsSPD ); - declareProperty( "HcalOffsetSPD", m_hcalMaps.offsetsSPD ); - declareProperty( "PrsOffsetSPD", m_prsMaps.offsetsSPD ); - declareProperty( "EcalOffsetSPDRMS", m_ecalMaps.offsetsSPDRMS ); - declareProperty( "HcalOffsetSPDRMS", m_hcalMaps.offsetsSPDRMS ); - declareProperty( "PrsOffsetSPDRMS", m_prsMaps.offsetsSPDRMS ); - declareProperty( "ScalingMethod", m_scalingMethod = 0 ); // 0 : SpdMult ; 1 = nPV (+10 for clusters) - declareProperty( "ScalingBin", m_scalingBin = 50 ); - declareProperty( "ScalingMin", m_scalingMin = 150. ); - m_maskMap["Default"] = CaloCellQuality::OfflineMask; - declareProperty( "VertexLoc", m_vertLoc = "" ); - declareProperty( "UsePV3D", m_usePV3D = false ); - declareProperty( "SetCounterLevel", m_setCounters = 1 ); -} -//============================================================================= - -StatusCode CaloDigitFilterTool::initialize() { - StatusCode sc = base_class::initialize(); // must be executed first - if ( sc.isFailure() ) return sc; // error printed already by Calo2Dview - if ( m_vertLoc.empty() ) { - m_vertLoc = ( m_usePV3D ) ? LHCb::RecVertexLocation::Velo3D : LHCb::RecVertexLocation::Primary; - } - - // check - for ( const auto& i : m_maskMap ) { - if ( ( i.second & CaloCellQuality::OfflineMask ) == 0 ) - Warning( "OfflineMask flag is disabled for " + i.first + " - Are you sure ?", StatusCode::SUCCESS ).ignore(); - } - // subscribe to incident Svc - incSvc()->addListener( this, IncidentType::BeginEvent ); - - return sc; -} - -//----------------------- -StatusCode CaloDigitFilterTool::caloUpdate() { - // loop over all current maps and recreate - for ( auto& maps : m_offsetMap ) { createMaps( maps.first, false ); } - const auto offsets = m_offsetMap.find( m_calo ); - setMaps( offsets != m_offsetMap.end() ? *( offsets->second ) : createMaps( m_calo ) ); - return StatusCode::SUCCESS; -} - -//----------------------- -const CaloDigitFilterTool::CondMaps& CaloDigitFilterTool::createMaps( DeCalorimeter* calo, const bool regUpdate ) { - // Map new set of maps for this calo - m_offsetMap[calo].reset( new CondMaps() ); - auto* maps = m_offsetMap[calo].get(); - // clear, just in case.. - maps->offsets.clear(); - maps->offsetsRMS.clear(); - maps->offsetsSPD.clear(); - maps->offsetsSPDRMS.clear(); - // fill the maps from the Calo DetElem - for ( const auto& c : calo->cellParams() ) { - const auto id = c.cellID(); - if ( !calo->valid( id ) || id.isPin() ) continue; - maps->offsets[id] = c.pileUpOffset(); - maps->offsetsRMS[id] = c.pileUpOffsetRMS(); - maps->offsetsSPD[id] = c.pileUpOffsetSPD(); - maps->offsetsSPDRMS[id] = c.pileUpOffsetSPDRMS(); - } - // if first time, register callback for future updates - if ( regUpdate ) { updMgrSvc()->registerCondition( this, calo, &CaloDigitFilterTool::caloUpdate ); } - // return the new maps - return *maps; -} - -//----------------------- -bool CaloDigitFilterTool::setDet( const std::string& det ) { - if ( m_caloName == det ) return true; - m_caloName = LHCb::CaloAlgUtils::CaloNameFromAlg( det ); - m_calo = getDet<DeCalorimeter>( LHCb::CaloAlgUtils::DeCaloLocation( m_caloName ) ); - if ( nullptr == m_calo ) return false; - m_mask = getMask( m_caloName ); - getOffsetMap( m_caloName ); - return true; -} - -//----------------------- -void CaloDigitFilterTool::getOffsetMap( const std::string& det ) { - if ( m_useCondDB ) { - m_scalingMethod = m_calo->pileUpSubstractionMethod(); - m_scalingMin = m_calo->pileUpSubstractionMin(); - m_scalingBin = m_calo->pileUpSubstractionBin(); - if ( m_scalingMethod < 0 ) { - setMaps( m_nullMaps ); - } else { - const auto caloOffs = m_offsetMap.find( m_calo ); - setMaps( caloOffs != m_offsetMap.end() ? *( caloOffs->second ) : createMaps( m_calo ) ); - } - } else { - setMaps( det == "Ecal" ? m_ecalMaps : det == "Hcal" ? m_hcalMaps : det == "Prs" ? m_prsMaps : m_nullMaps ); - } -} - -//----------------------- -double CaloDigitFilterTool::getOffset( LHCb::CaloCellID id, int scale, bool spd ) { - if ( 0 == scale ) return 0; - if ( scale <= m_scalingMin ) return 0; - const auto& table = ( spd ) ? offsetsSPD() : offsets(); - const auto it = table.find( id ); - if ( it == table.end() ) return 0.; - const auto& ref = it->second; - // overlap probabilty (approximate) - constexpr double ncells = 6016.; - double rscale = scale / ( 1. - scale / ncells ); - const double aa = 4 * scale / ncells; - if ( aa < 1 ) { rscale = 0.5 * ncells * ( 1. - std::sqrt( 1. - aa ) ); } - const double step = double( m_scalingBin ); - const double bin = double( rscale - m_scalingMin ); - const double aaa = bin / step; - const double offset = aaa * ref; - m_offsetRMS = std::sqrt( aaa ) * ref; - return offset; -} - -//----------------------- -int CaloDigitFilterTool::getMask( const std::string& det ) { - auto it = m_maskMap.find( det ); - if ( it != m_maskMap.end() ) return it->second; - it = m_maskMap.find( "Default" ); - return it != m_maskMap.end() ? it->second : 0; -} - -//----------------------- -void CaloDigitFilterTool::setMaskMap( const std::map<std::string, int>& maskMap ) { m_maskMap = maskMap; } - -//----------------------- -int CaloDigitFilterTool::getScale() { - if ( !m_reset ) return m_scale; - m_reset = false; - m_scale = 0; - m_scaling = "None"; - if ( m_scalingMethod == 0 || m_scalingMethod == 10 ) { // SpdMult - m_scaling = "SpdMult"; - m_scale = nSpd(); - } else if ( m_scalingMethod == 1 || m_scalingMethod == 11 ) { // nPV - m_scaling = "nPV"; - m_scale = nVertices(); - } - return m_scale; -} - -double CaloDigitFilterTool::offset( LHCb::CaloCellID id, bool spd ) { - if ( id.caloName() != m_caloName ) { - if ( !setDet( id.caloName() ) ) return 0.; - } - int scale = getScale(); - return getOffset( id, scale, spd ); -} - -double CaloDigitFilterTool::offsetRMS( LHCb::CaloCellID id, bool spd ) { - offset( id, spd ); - return m_offsetRMS; -} - -//----------------------- -bool CaloDigitFilterTool::cleanDigits( const std::string& det, bool substr, bool mask, bool spd ) { - if ( !setDet( det ) ) return false; - - std::string container = LHCb::CaloAlgUtils::CaloDigitLocation( det ); - m_digits = getIfExists<LHCb::CaloDigits>( evtSvc(), container ); - if ( !m_digits ) return false; - - // - int scale = getScale(); - if ( m_setCounters > 0 ) counter( "offset scale (" + m_scaling + ")" ) += scale; - m_nMask = 0; - m_mOffs = 0.; - int nOffs = 0; - for ( LHCb::CaloDigit* digit : *m_digits ) { - if ( digit ) cleanDigit( *digit, substr, scale, mask, spd ); - nOffs++; - } - - if ( m_setCounters > 0 ) { - if ( m_nMask != 0 ) counter( "Masked " + m_caloName + " digits" ) += m_nMask; - double ave = ( nOffs != 0 ) ? m_mOffs / double( nOffs ) : 0; - if ( m_scalingMethod < 10 && substr && offsets().size() != 0 ) - counter( m_caloName + " average offset in ADC (method = " + Gaudi::Utils::toString( m_scalingMethod ) + ")" ) -= - ave; - } - return true; -} - -//----------------------- -void CaloDigitFilterTool::cleanDigit( LHCb::CaloDigit& digit, bool substr, int scale, bool mask, bool spd ) { - LHCb::CaloCellID id = digit.cellID(); - - // apply mask - if ( mask && m_mask != 0 && m_calo->hasQuality( id, (CaloCellQuality::Flag)m_mask ) ) { - digit.setE( 0. ); - m_nMask++; - } - - // apply offset to channel (method < 10) - if ( m_scalingMethod < 10 && substr && offsets().size() != 0 ) { - if ( m_caloName == "Spd" ) return; - if ( scale < 0 ) scale = getScale(); - double offset = getOffset( id, scale, spd ); - if ( 0. != offset ) { - double e = digit.e() - offset; - if ( e < 0. ) e = 0.; - digit.setE( e ); - m_mOffs += offset / m_calo->cellGain( id ); // offset (in ADC) - } - } -} - -//================= Scale accessors - -unsigned int CaloDigitFilterTool::nVertices() { - int nVert = 0; - if ( !m_usePV3D ) { - LHCb::RecVertices* verts = getIfExists<LHCb::RecVertices>( evtSvc(), m_vertLoc ); - if ( verts ) return verts->size(); - } - // try PV3D if explicitely requested or if RecVertices not found - if ( !m_usePV3D ) m_vertLoc = LHCb::RecVertexLocation::Velo3D; - LHCb::VertexBases* verts = getIfExists<LHCb::VertexBases>( m_vertLoc ); - if ( verts ) nVert = verts->size(); - return nVert; -} - -unsigned int CaloDigitFilterTool::nSpd() { - const auto loc = LHCb::CaloAlgUtils::CaloDigitLocation( "SPD" ); - const auto* digits = getIfExists<LHCb::CaloDigits>( evtSvc(), loc ); - return digits ? digits->size() : 0; -} - -StatusCode CaloDigitFilterTool::finalize() { - if ( msgLevel( MSG::DEBUG ) ) debug() << "==> Finalize" << endmsg; - incSvc()->removeListener( this ); - return base_class::finalize(); // must be called after all other actions -} diff --git a/Calo/CaloDAQ/src/CaloDigitFilterTool.h b/Calo/CaloDAQ/src/CaloDigitFilterTool.h deleted file mode 100644 index e4128602bd7f4aff8725b855afc79e06c7945340..0000000000000000000000000000000000000000 --- a/Calo/CaloDAQ/src/CaloDigitFilterTool.h +++ /dev/null @@ -1,121 +0,0 @@ -/*****************************************************************************\ -* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration * -* * -* This software is distributed under the terms of the GNU General Public * -* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -#ifndef CALODIGITFILTERTOOL_H -#define CALODIGITFILTERTOOL_H 1 - -class StatusCode; -#include "CaloDAQ/ICaloDigitFilterTool.h" // Interface -#include "CaloDet/DeCalorimeter.h" -#include "CaloUtils/CaloAlgUtils.h" -#include "Event/CaloDigit.h" -#include "Event/RecVertex.h" -#include "GaudiAlg/GaudiTool.h" -#include "GaudiKernel/IIncidentListener.h" -#include "GaudiKernel/IIncidentSvc.h" -#include "GaudiKernel/Incident.h" -#include "Kernel/CaloCellID.h" - -#include <memory> -#include <unordered_map> - -/** @class CaloDigitFilterTool CaloDigitFilterTool.h - * - * - * @author Olivier Deschamps - * @date 2010-12-13 - */ -class CaloDigitFilterTool final : public extends<GaudiTool, ICaloDigitFilterTool, IIncidentListener> { -public: - /// Standard constructor - CaloDigitFilterTool( const std::string& type, const std::string& name, const IInterface* parent ); - - StatusCode initialize() override; ///< Algorithm initialization - StatusCode finalize() override; ///< Algorithm finalization - - // - bool setDet( const std::string& det ); - void getOffsetMap( const std::string& det ); - int getMask( const std::string& det ); - double getOffset( LHCb::CaloCellID id, int scale, bool spd = false ); - void setMaskMap( const std::map<std::string, int>& maskMap ); - int getScale() override; - bool cleanDigits( const std::string& det, bool substr = true, bool mask = true, bool spd = false ) override; - int method( const std::string& det ) override { - if ( det != m_caloName ) { setDet( det ); } - return m_scalingMethod; - } - unsigned int nVertices(); - unsigned int nSpd(); - double offset( LHCb::CaloCellID id, bool spd = false ) override; - double offsetRMS( LHCb::CaloCellID id, bool spd = false ) override; - /// Triggered by calo updates - StatusCode caloUpdate(); - -private: - void handle( const Incident& /* inc */ ) override { - if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) debug() << "IIncident Svc reset" << endmsg; - m_reset = true; - } - - using Offsets = std::map<LHCb::CaloCellID, double>; - inline const Offsets& offsets() const noexcept { return *m_offsets; } - inline const Offsets& offsetsRMS() const noexcept { return *m_offsetsRMS; } - inline const Offsets& offsetsSPD() const noexcept { return *m_offsetsSPD; } - inline const Offsets& offsetsSPDRMS() const noexcept { return *m_offsetsSPDRMS; } - struct CondMaps { - Offsets offsets, offsetsRMS, offsetsSPD, offsetsSPDRMS; - }; - const CondMaps& createMaps( DeCalorimeter* calo, const bool regUpdate = true ); - inline void setMaps( const CondMaps& maps ) const { - m_offsets = &maps.offsets; - m_offsetsRMS = &maps.offsetsRMS; - m_offsetsSPD = &maps.offsetsSPD; - m_offsetsSPDRMS = &maps.offsetsSPDRMS; - } - -protected: - void cleanDigit( LHCb::CaloDigit& digit, bool substr = true, int scale = -1, bool mask = true, bool spd = false ); - -private: - std::map<std::string, int> m_maskMap; - int m_mask{0}; - std::map<DeCalorimeter*, std::unique_ptr<CondMaps>> m_offsetMap; - mutable const Offsets* m_offsets = nullptr; - mutable const Offsets* m_offsetsRMS = nullptr; - mutable const Offsets* m_offsetsSPD = nullptr; - mutable const Offsets* m_offsetsSPDRMS = nullptr; - - LHCb::CaloDigits* m_digits = nullptr; - DeCalorimeter* m_calo = nullptr; - std::string m_caloName{"None"}; - int m_scalingMethod{0}; - bool m_useCondDB{true}; - - CondMaps m_ecalMaps; - CondMaps m_hcalMaps; - CondMaps m_prsMaps; - CondMaps m_nullMaps; - - int m_scalingBin; - double m_scalingMin; - double m_mOffs{0.0}; - int m_nMask{0}; - std::string m_vertLoc; - bool m_usePV3D; - std::string m_scaling{"None"}; - double m_offsetRMS{0.0}; - bool m_reset{true}; - int m_scale{0}; - - int m_setCounters; -}; - -#endif // CALODIGITFILTERTOOL_H