diff --git a/Calorimeter/CaloInterface/CaloInterface/ILArNoisyROTool.h b/Calorimeter/CaloInterface/CaloInterface/ILArNoisyROTool.h index aa81b52ce2986f34a9a2e3895c258450a0456b2c..eea22f1a4e3f8102d07cf724f83efc6b34989316 100644 --- a/Calorimeter/CaloInterface/CaloInterface/ILArNoisyROTool.h +++ b/Calorimeter/CaloInterface/CaloInterface/ILArNoisyROTool.h @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ // ILArNoisyROTool.h @@ -34,7 +34,7 @@ class ILArNoisyROTool static const InterfaceID& interfaceID(); virtual - std::unique_ptr<LArNoisyROSummary> process(const CaloCellContainer*)=0; + std::unique_ptr<LArNoisyROSummary> process(const CaloCellContainer*) const =0; }; diff --git a/LArCalorimeter/LArCellRec/LArCellRec/LArNoisyROAlg.h b/LArCalorimeter/LArCellRec/LArCellRec/LArNoisyROAlg.h index 7eafff95bd8b9e42f66aba740f6281c6d96a0ae1..e0b78e331e909b56c06e3d47f881439f4b6dd691 100644 --- a/LArCalorimeter/LArCellRec/LArCellRec/LArNoisyROAlg.h +++ b/LArCalorimeter/LArCellRec/LArCellRec/LArNoisyROAlg.h @@ -23,7 +23,11 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ToolHandle.h" #include "CaloInterface/ILArNoisyROTool.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/WriteHandleKey.h" +class CaloCellContainer; +class LArNoisyROSummary; class LArNoisyROAlg : public AthAlgorithm { @@ -36,12 +40,10 @@ class LArNoisyROAlg : public AthAlgorithm private: - //unsigned m_event_counter; - ToolHandle<ILArNoisyROTool> m_noisyROTool; - - std::string m_CaloCellContainerName; - std::string m_outputKey; + + SG::ReadHandleKey<CaloCellContainer> m_CaloCellContainerName; + SG::WriteHandleKey<LArNoisyROSummary> m_outputKey; }; diff --git a/LArCalorimeter/LArCellRec/LArCellRec/LArNoisyROTool.h b/LArCalorimeter/LArCellRec/LArCellRec/LArNoisyROTool.h index c2195f734a1bcc216dbcdaa446a6c03178fc5df5..80d819a7ce1f84f7dfc751cfd62c800b13ebac3d 100644 --- a/LArCalorimeter/LArCellRec/LArCellRec/LArNoisyROTool.h +++ b/LArCalorimeter/LArCellRec/LArCellRec/LArNoisyROTool.h @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ // LArNoisyROTool.h @@ -19,17 +19,16 @@ // FrameWork includes #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" - #include "CaloInterface/ILArNoisyROTool.h" #include "Identifier/HWIdentifier.h" #include "LArIdentifier/LArOnlineID.h" #include "AthenaKernel/IOVSvcDefs.h" +#include "StoreGate/ReadCondHandleKey.h" class LArOnlineID; class CaloCell_ID; -class LArCablingService; +class LArOnOffIdMapping; class LArNoisyROSummary; class CaloCellContainer; @@ -60,7 +59,7 @@ class LArNoisyROTool: virtual StatusCode finalize(); virtual - std::unique_ptr<LArNoisyROSummary> process(const CaloCellContainer*); + std::unique_ptr<LArNoisyROSummary> process(const CaloCellContainer*) const; private: @@ -103,7 +102,7 @@ class LArNoisyROTool: }; - size_t partitionNumber(const HWIdentifier); + size_t partitionNumber(const HWIdentifier) const; typedef std::unordered_map<unsigned int, FEBEvtStat> FEBEvtStatMap; @@ -111,13 +110,10 @@ class LArNoisyROTool: typedef std::unordered_map<unsigned int, FEBEvtStat>::const_iterator FEBEvtStatMapCstIt; private: - std::string m_CaloCellContainerName; - std::string m_outputKey; - //FEBEvtStatMap m_FEBstats; const CaloCell_ID* m_calo_id; const LArOnlineID* m_onlineID; - ToolHandle<LArCablingService> m_cablingService; + SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey; //** Qfactor value above which a channel is considered bad */ unsigned int m_CellQualityCut; @@ -154,13 +150,10 @@ class LArNoisyROTool: std::set<HWIdentifier> m_knownMNBFEBs; //** count bad FEB for job */ - std::unordered_map<unsigned int, unsigned int> m_badFEB_counters; + //std::unordered_map<unsigned int, unsigned int> m_badFEB_counters; //** count bad PA for job */ - std::map<uint64_t, unsigned int> m_badPA_counters; - - //** event counter */ - unsigned int m_invocation_counter; + //std::map<uint64_t, unsigned int> m_badPA_counters; //** Qfactor value above which (>=) a channel is considered with a saturated Qfactor*/ unsigned int m_SaturatedCellQualityCut; @@ -177,10 +170,6 @@ class LArNoisyROTool: float m_MNBLooseCut; float m_MNBTightCut; - //** jobO flag to turn on a summary printout in finalize - bool m_printSummary; - - std::array<uint8_t,4> m_partitionMask; }; @@ -188,7 +177,7 @@ class LArNoisyROTool: -inline size_t LArNoisyROTool::partitionNumber(const HWIdentifier hwid) { +inline size_t LArNoisyROTool::partitionNumber(const HWIdentifier hwid) const { int pn=m_onlineID->pos_neg(hwid); if (m_onlineID->isEMECchannel(hwid)) { diff --git a/LArCalorimeter/LArCellRec/python/LArNoisyROSummaryGetter.py b/LArCalorimeter/LArCellRec/python/LArNoisyROSummaryGetter.py index 63e973b421db7ee50dc59118ffbd2d4361c6534b..b8e9cd20f63c31845d9d93a7622c0178bd675350 100755 --- a/LArCalorimeter/LArCellRec/python/LArNoisyROSummaryGetter.py +++ b/LArCalorimeter/LArCellRec/python/LArNoisyROSummaryGetter.py @@ -3,6 +3,10 @@ from RecExConfig.Configured import Configured from LArCellRec.LArNoisyROFlags import larNoisyROFlags +#Kind of hack to get the MT-version of the LArCabling +from AthenaCommon.Include import Include, IncludeError, include +include("LArRecUtils/LArOnOffMappingAlg.py") + class LArNoisyROSummaryGetter ( Configured ) : _outputType = "LArNoisyROSummary" _output = { _outputType : "LArNoisyROSummary" } @@ -38,8 +42,7 @@ class LArNoisyROSummaryGetter ( Configured ) : print traceback.format_exc() return False - theLArNoisyROTool=LArNoisyROTool(PrintSummary=True, - CellQualityCut=larNoisyROFlags.CellQualityCut(), + theLArNoisyROTool=LArNoisyROTool(CellQualityCut=larNoisyROFlags.CellQualityCut(), BadChanPerFEB=larNoisyROFlags.BadChanPerFEB(), BadFEBCut=larNoisyROFlags.BadFEBCut(), KnownMNBFEBs=larNoisyROFlags.KnownMNBFEBs(), diff --git a/LArCalorimeter/LArCellRec/src/LArNoisyROAlg.cxx b/LArCalorimeter/LArCellRec/src/LArNoisyROAlg.cxx index fba4f67293cce544ddced7cf59236a288041e1a5..fdc24800f0767d605f7c4d37b0d432f8d565ee43 100644 --- a/LArCalorimeter/LArCellRec/src/LArNoisyROAlg.cxx +++ b/LArCalorimeter/LArCellRec/src/LArNoisyROAlg.cxx @@ -11,7 +11,6 @@ #include "CaloIdentifier/CaloIdManager.h" #include "CaloIdentifier/CaloCell_ID.h" #include "LArIdentifier/LArOnlineID.h" -#include "LArCabling/LArCablingService.h" #include "LArRecEvent/LArNoisyROSummary.h" #include "LArRecEvent/LArEventBitInfo.h" #include "xAODEventInfo/EventInfo.h" @@ -30,23 +29,25 @@ LArNoisyROAlg::LArNoisyROAlg(const std::string &name,ISvcLocator *pSvcLocator): declareProperty( "Tool",m_noisyROTool); } -StatusCode LArNoisyROAlg::initialize() -{ - CHECK(m_noisyROTool.retrieve()); +StatusCode LArNoisyROAlg::initialize() { + ATH_CHECK(m_noisyROTool.retrieve()); + ATH_CHECK(m_CaloCellContainerName.initialize()); + ATH_CHECK(m_outputKey.initialize()); return StatusCode::SUCCESS; } -StatusCode LArNoisyROAlg::execute() -{ +StatusCode LArNoisyROAlg::execute() { - const CaloCellContainer* cellContainer(0); - StatusCode sc = evtStore()->retrieve(cellContainer, m_CaloCellContainerName); - if (sc.isFailure() || !cellContainer ) { - ATH_MSG_WARNING( " Could not retreive the CaloCellContainer with name " << m_CaloCellContainerName ); - return StatusCode::RECOVERABLE; - } + SG::ReadHandle<CaloCellContainer> cellContainer(m_CaloCellContainerName); + if (!cellContainer.isValid()) { + ATH_MSG_ERROR( " Can not retrieve CaloCellContainer: " + << m_CaloCellContainerName.key()); + return StatusCode::FAILURE; + } + - std::unique_ptr<LArNoisyROSummary> noisyRO=m_noisyROTool->process(cellContainer); + SG::WriteHandle<LArNoisyROSummary> noisyRO(m_outputKey); + ATH_CHECK(noisyRO.record(m_noisyROTool->process(cellContainer.cptr()))); bool badFEBFlag=noisyRO->BadFEBFlaggedPartitions(); @@ -59,7 +60,7 @@ StatusCode LArNoisyROAlg::execute() { // retrieve EventInfo const xAOD::EventInfo* eventInfo_c=0; - sc = evtStore()->retrieve(eventInfo_c); + StatusCode sc = evtStore()->retrieve(eventInfo_c); if (sc.isFailure()) { ATH_MSG_WARNING( " cannot retrieve EventInfo, will not set LAr bit information " ); @@ -107,8 +108,6 @@ StatusCode LArNoisyROAlg::execute() } - CHECK(evtStore()->record(std::move(noisyRO),m_outputKey)); - return StatusCode::SUCCESS; } diff --git a/LArCalorimeter/LArCellRec/src/LArNoisyROTool.cxx b/LArCalorimeter/LArCellRec/src/LArNoisyROTool.cxx index 4592e0b8f248cf9bf671bcdc09cc76d4c9ab265d..709369729ed4e20832d36682233d6edd94dd9955 100644 --- a/LArCalorimeter/LArCellRec/src/LArNoisyROTool.cxx +++ b/LArCalorimeter/LArCellRec/src/LArNoisyROTool.cxx @@ -11,28 +11,24 @@ // LArCellRec includes #include "LArCellRec/LArNoisyROTool.h" -// FrameWork includes -//#include "GaudiKernel/IToolSvc.h" - #include "CaloEvent/CaloCellContainer.h" #include "LArRecEvent/LArNoisyROSummary.h" #include "CaloIdentifier/CaloCell_ID.h" #include "LArIdentifier/LArOnlineID.h" -#include "LArCabling/LArCablingService.h" +#include "LArCabling/LArOnOffIdMapping.h" #include "LArRecEvent/LArNoisyROSummary.h" +#include "StoreGate/ReadCondHandle.h" LArNoisyROTool::LArNoisyROTool( const std::string& type, const std::string& name, const IInterface* parent ) : ::AthAlgTool ( type, name, parent ), m_calo_id(0), m_onlineID(0), - m_cablingService("LArCablingService"), - m_invocation_counter(0),m_SaturatedCellTightCutEvents(0), + m_cablingKey("LArOnOffIdMap"), m_partitionMask({{LArNoisyROSummary::EMECAMask,LArNoisyROSummary::EMBAMask,LArNoisyROSummary::EMBCMask,LArNoisyROSummary::EMECCMask}}) //beware: The order matters! { declareInterface<ILArNoisyROTool >(this); declareProperty( "BadChanPerFEB", m_BadChanPerFEB=30 ); - // declareProperty( "BadChanPerPA", m_BadChanPerPA=2 ); declareProperty( "CellQualityCut", m_CellQualityCut=4000 ); declareProperty( "IgnoreMaskedCells", m_ignore_masked_cells=false ); declareProperty( "IgnoreFrontInnerWheelCells", m_ignore_front_innerwheel_cells=true ); @@ -68,13 +64,9 @@ LArNoisyROTool::LArNoisyROTool( const std::string& type, declareProperty( "MNBLooseCut",m_MNBLooseCut=5,"Number of cells above CellQualityCut"); declareProperty( "MNBTightCut",m_MNBTightCut=17,"Number of cells above CellQualityCut"); - - declareProperty( "OutputKey", m_outputKey="LArNoisyROSummary"); declareProperty( "SaturatedCellQualityCut", m_SaturatedCellQualityCut=65535); declareProperty( "SaturatedCellEnergyTightCut", m_SaturatedCellEnergyTightCut=1000.); declareProperty( "SaturatedCellTightCut", m_SaturatedCellTightCut=20); - declareProperty( "PrintSummary", m_printSummary=false); - } // Destructor @@ -96,9 +88,9 @@ StatusCode LArNoisyROTool::initialize() { return StatusCode::FAILURE; } - CHECK(detStore()->retrieve(m_calo_id,"CaloCell_ID")); - CHECK(detStore()->retrieve(m_onlineID,"LArOnlineID")); - ATH_CHECK( m_cablingService.retrieve() ); + ATH_CHECK(detStore()->retrieve(m_calo_id,"CaloCell_ID")); + ATH_CHECK(detStore()->retrieve(m_onlineID,"LArOnlineID")); + ATH_CHECK( m_cablingKey.initialize() ); //convert std::vector (jobO) to std::set (internal representation) m_knownBadFEBs.insert(m_knownBadFEBsVec.begin(),m_knownBadFEBsVec.end()); @@ -111,10 +103,13 @@ StatusCode LArNoisyROTool::initialize() { -std::unique_ptr<LArNoisyROSummary> LArNoisyROTool::process(const CaloCellContainer* cellContainer) { +std::unique_ptr<LArNoisyROSummary> LArNoisyROTool::process(const CaloCellContainer* cellContainer) const{ - ++m_invocation_counter; std::unique_ptr<LArNoisyROSummary> noisyRO(new LArNoisyROSummary); + + SG::ReadCondHandle<LArOnOffIdMapping> larCablingHdl(m_cablingKey); + const LArOnOffIdMapping* cabling=*larCablingHdl; + FEBEvtStatMap FEBStats; //counter per FEB @@ -163,7 +158,7 @@ std::unique_ptr<LArNoisyROSummary> LArNoisyROTool::process(const CaloCellContain if ( m_calo_id->is_em(id) ) { // get FEB ID and channel number - HWIdentifier hwid = m_cablingService->createSignalChannelID(id); + HWIdentifier hwid = cabling->createSignalChannelID(id); HWIdentifier febid = m_onlineID->feb_Id(hwid); unsigned int FEBindex = febid.get_identifier32().get_compact(); unsigned int channel = m_onlineID->channel(hwid); @@ -179,19 +174,11 @@ std::unique_ptr<LArNoisyROSummary> LArNoisyROTool::process(const CaloCellContain bool badSaturatedTightCut = (SatTightPartitions != 0); if ( badSaturatedTightCut ) noisyRO-> SetSatTightFlaggedPartitions(SatTightPartitions); - // Too many saturated cells ? - if ( badSaturatedTightCut ) { - //ATH_MSG_INFO( "Too many saturated cells " ); - m_SaturatedCellTightCutEvents++; - } - // are there any bad FEB or preamp ? for ( FEBEvtStatMapCstIt it = FEBStats.begin(); it != FEBStats.end(); it++ ) { ATH_MSG_DEBUG(" bad FEB " << it->first << " with " << it->second.badChannels() << " bad channels"); if ( it->second.badChannels() > m_BadChanPerFEB ) { noisyRO->add_noisy_feb(HWIdentifier(it->first)); - if (m_printSummary) m_badFEB_counters[it->first]++; - //BadFEBCount++; } // Tight MNBs @@ -317,26 +304,6 @@ std::unique_ptr<LArNoisyROSummary> LArNoisyROTool::process(const CaloCellContain StatusCode LArNoisyROTool::finalize() { - if (m_printSummary) { - - ATH_MSG_INFO( "List of bad FEBs found in all events " ); - for ( std::unordered_map<unsigned int, unsigned int>::const_iterator it = m_badFEB_counters.begin(); it != m_badFEB_counters.end(); it++ ) { - ATH_MSG_INFO( "FEB " << it->first << " declared noisy in " << it->second << " events " ); - } - -// ATH_MSG_INFO( "List of bad preamps found in at least max(2,0.1%) events" ); -// unsigned int cut = static_cast<unsigned int>(0.001*static_cast<float>(m_invocation_counter)); -// if ( cut < 2 ) cut = 2; -// uint64_t PAfactor = 1000000000L; -// for ( std::map<uint64_t, unsigned int>::const_iterator it = m_badPA_counters.begin(); it != m_badPA_counters.end(); it++ ) -// { -// if ( it->second > cut ) -// ATH_MSG_INFO( "Preamplifier " << (it->first)/PAfactor << " of FEB " << (it->first)%PAfactor << " declared noisy in " << it->second << " events " ); -// } - - ATH_MSG_INFO( "Number of events with too many saturated QFactor cells (Tight cuts): " << m_SaturatedCellTightCutEvents ); - } - return StatusCode::SUCCESS; } diff --git a/LArCalorimeter/LArMonTools/src/LArDigitMon.cxx b/LArCalorimeter/LArMonTools/src/LArDigitMon.cxx index 0239fa0446e5a3e97f8fd561250f803ed7464544..6c68b1724247ff9df419994e113580dc2f143962 100755 --- a/LArCalorimeter/LArMonTools/src/LArDigitMon.cxx +++ b/LArCalorimeter/LArMonTools/src/LArDigitMon.cxx @@ -315,7 +315,7 @@ LArDigitMon::fillHistograms() m_eventsCounter++; // retrieve LArNoisyROSummary and skip the event if number of FEB is greater than the one declare in JO. - LArNoisyROSummary* noisyRO; + const LArNoisyROSummary* noisyRO; StatusCode sc = evtStore()->retrieve(noisyRO,"LArNoisyROSummary"); if (sc.isFailure()) { diff --git a/Trigger/TrigHypothesis/TrigCaloHypo/python/TrigCaloHypoConfig.py b/Trigger/TrigHypothesis/TrigCaloHypo/python/TrigCaloHypoConfig.py index d666b247a36dbd95a2adacf8508bd58268e19951..65227acaa1ad3790cccd0f33da54b8da74111243 100644 --- a/Trigger/TrigHypothesis/TrigCaloHypo/python/TrigCaloHypoConfig.py +++ b/Trigger/TrigHypothesis/TrigCaloHypo/python/TrigCaloHypoConfig.py @@ -5,6 +5,10 @@ from AthenaCommon.SystemOfUnits import GeV from TrigCaloHypo.TrigCaloHypoConf import TrigEFCaloHypoNoise from LArCellRec.LArCellRecConf import LArNoisyROTool +#Kind of hack to get the MT-version of the LArCalbing +from AthenaCommon.Include import Include, IncludeError, include +include("LArRecUtils/LArOnOffMappingAlg.py") + class EFCaloHypoNoiseConfig (TrigEFCaloHypoNoise): __slots__ = [] def __init__(self, name = "EFCaloHypoNoiseConfig",ef_thr=20*GeV,etaMin=0,etaMax=10):