diff --git a/LArCalorimeter/LArMonTools/share/LArRODMonTool_jobOptions.py b/LArCalorimeter/LArMonTools/share/LArRODMonTool_jobOptions.py index 7c4b78f442261daef8ecddece2c4a0d0af75c4af..b9a2c21f7e6f88361d81f766b989e360516ff853 100755 --- a/LArCalorimeter/LArMonTools/share/LArRODMonTool_jobOptions.py +++ b/LArCalorimeter/LArMonTools/share/LArRODMonTool_jobOptions.py @@ -42,10 +42,6 @@ else: #timeoffset = (firstsample - 3) or (3 - firstsample) ... to be checked. -#from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -#theCaloNoiseTool = CaloNoiseToolDefault() -#ToolSvc += theCaloNoiseTool - from LArMonTools.LArMonToolsConf import LArRODMonTool theLArRODMonTool = LArRODMonTool(name="LArRODMonTool", LArDigitContainerKey = LArMonFlags.LArDigitKey(), diff --git a/LArCalorimeter/LArMonTools/share/LArRawChannelMonTool_jobOptions.py b/LArCalorimeter/LArMonTools/share/LArRawChannelMonTool_jobOptions.py index b840058010b2bc398dfc8293fa86107c34e3df49..e46a8dc3f376792c0eff3d27289427b9bd15a9c4 100755 --- a/LArCalorimeter/LArMonTools/share/LArRawChannelMonTool_jobOptions.py +++ b/LArCalorimeter/LArMonTools/share/LArRawChannelMonTool_jobOptions.py @@ -2,10 +2,8 @@ # For Atlas Ready Filter. Not needed. from AthenaMonitoring.AtlasReadyFilterTool import GetAtlasReadyFilterTool -# --- CaloNoiseTool configuration --- -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -lar_raw_channel_noise_tool = CaloNoiseToolDefault() -ToolSvc += lar_raw_channel_noise_tool +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg ('totalNoise') # ---- Local Variables ---- @@ -94,9 +92,6 @@ LArRawChannelMon = LArRawChannelMonTool( 10 ],# FCALC - # --- Noise type ---- Decide if TotalNoise(Electronic + Pileup) or electronic Noise only - UseElecNoiseOnly = False, - # --- Histogram Types --- monitor_occupancy = False, monitor_signal = LArMonFlags.doLArRawMonitorSignal(), @@ -117,8 +112,6 @@ LArRawChannelMon = LArRawChannelMonTool( # --- histogram registration --- interval = "run", - # --- noise tool to use --- - calo_noise_tool = lar_raw_channel_noise_tool, masking_tool = theLArBadChannelsMasker, # Number of luminosity blocks to display in histograms @@ -130,7 +123,8 @@ LArRawChannelMon = LArRawChannelMonTool( ## Monitor signal and noise if cosmic run is being taken. Feb 2012 - VB from AthenaCommon.BeamFlags import jobproperties if jobproperties.Beam.beamType.get_Value() == 'cosmics': - LArRawChannelMon.UseElecNoiseOnly=True + CaloNoiseCondAlg ('electronicNoise') + LArRawChannelMon.NoiseKey = 'electronicNoise' LArRawChannelMon.monitor_signal=True LArRawChannelMon.monitor_positive_noise=True LArRawChannelMon.monitor_negative_noise=True diff --git a/LArCalorimeter/LArMonTools/src/LArCoverage.cxx b/LArCalorimeter/LArMonTools/src/LArCoverage.cxx index 674a0e6240bda6938b381c81a1ea742b1089fc54..d573c0d950ecb1cc248efb2f0fd9eb86131bae29 100644 --- a/LArCalorimeter/LArMonTools/src/LArCoverage.cxx +++ b/LArCalorimeter/LArMonTools/src/LArCoverage.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -62,9 +62,9 @@ LArCoverage::LArCoverage(const std::string& type, m_hCoverageHWHECC(NULL), m_hCoverageHWFCALA(NULL), m_hCoverageHWFCALC(NULL), - m_hCaloNoiseToolEM(), - m_hCaloNoiseToolHEC(), - m_hCaloNoiseToolFCAL() + m_hCaloNoiseEM(), + m_hCaloNoiseHEC(), + m_hCaloNoiseFCAL() { declareProperty("LArBadChannelMask",m_badChannelMask); declareProperty("Nevents",m_nevents = 50); @@ -467,39 +467,39 @@ LArCoverage::bookHistograms() CovGroupShift.regHist(m_hCoverageHWFCALC).ignore(); // - // CaloNoiseTool histograms - per FT/Slot + // CaloNoise histograms - per FT/Slot // MonGroup CaloNoiseGroupShift( this, "/LAr/CoverageOldTool/CaloNoiseTool", run, ATTRIB_MANAGED, "", "lowerLB"); // EM histos for (int i=0; i<4;i++){ - m_hCaloNoiseToolEM[i] = TProfile_LW::create(Form("CaloNoiseEMSampling%i",i), - Form("DBNoise in EM Sampling %i - LB %4d",i,lb1), - 320, -3.2,3.2); - m_hCaloNoiseToolEM[i]->GetXaxis()->SetTitle("#eta"); - m_hCaloNoiseToolEM[i]->GetYaxis()->SetTitle("[MeV]"); - CaloNoiseGroupShift.regHist(m_hCaloNoiseToolEM[i]).ignore(); + m_hCaloNoiseEM[i] = TProfile_LW::create(Form("CaloNoiseEMSampling%i",i), + Form("DBNoise in EM Sampling %i - LB %4d",i,lb1), + 320, -3.2,3.2); + m_hCaloNoiseEM[i]->GetXaxis()->SetTitle("#eta"); + m_hCaloNoiseEM[i]->GetYaxis()->SetTitle("[MeV]"); + CaloNoiseGroupShift.regHist(m_hCaloNoiseEM[i]).ignore(); } // HEC histos for (int i=0; i<4;i++){ - m_hCaloNoiseToolHEC[i] = TProfile_LW::create(Form("CaloNoiseHECSampling%i",i), - Form("DBNoise in HEC Sampling %i - LB %4d",i,lb1), - 320, -3.2,3.2); - m_hCaloNoiseToolHEC[i]->GetXaxis()->SetTitle("#eta"); - m_hCaloNoiseToolHEC[i]->GetYaxis()->SetTitle("[MeV]"); - CaloNoiseGroupShift.regHist(m_hCaloNoiseToolHEC[i]).ignore(); + m_hCaloNoiseHEC[i] = TProfile_LW::create(Form("CaloNoiseHECSampling%i",i), + Form("DBNoise in HEC Sampling %i - LB %4d",i,lb1), + 320, -3.2,3.2); + m_hCaloNoiseHEC[i]->GetXaxis()->SetTitle("#eta"); + m_hCaloNoiseHEC[i]->GetYaxis()->SetTitle("[MeV]"); + CaloNoiseGroupShift.regHist(m_hCaloNoiseHEC[i]).ignore(); } // FCAL histos for (int i=1; i<4;i++){ - m_hCaloNoiseToolFCAL[i] = TProfile_LW::create(Form("CaloNoiseFCALSampling%i",i), - Form("DBNoise in FCAL Sampling %i - LB %4d",i,lb1), - 500, -5.0,5.0); - m_hCaloNoiseToolFCAL[i]->GetXaxis()->SetTitle("#eta"); - m_hCaloNoiseToolFCAL[i]->GetYaxis()->SetTitle("[MeV]"); - CaloNoiseGroupShift.regHist(m_hCaloNoiseToolFCAL[i]).ignore(); + m_hCaloNoiseFCAL[i] = TProfile_LW::create(Form("CaloNoiseFCALSampling%i",i), + Form("DBNoise in FCAL Sampling %i - LB %4d",i,lb1), + 500, -5.0,5.0); + m_hCaloNoiseFCAL[i]->GetXaxis()->SetTitle("#eta"); + m_hCaloNoiseFCAL[i]->GetYaxis()->SetTitle("[MeV]"); + CaloNoiseGroupShift.regHist(m_hCaloNoiseFCAL[i]).ignore(); } // @@ -597,22 +597,21 @@ LArCoverage::fillHistograms() // Retrieve expected noise float noise = noiseCDO->getNoise(offlineID,m_highestGain[caloDetElement->getSubCalo()]); - //->getNoise(caloDetElement,ICalorimeterNoiseTool::ELECTRONICNOISE); if(m_eventsCounter == 1){ // Plot the average expected noise vs eta for reference if(m_LArOnlineIDHelper->isEMBchannel(id) || m_LArOnlineIDHelper->isEMECchannel(id)){ int sampling = m_LArEM_IDHelper->sampling(offlineID); - m_hCaloNoiseToolEM[sampling]->Fill(etaChan, noise); + m_hCaloNoiseEM[sampling]->Fill(etaChan, noise); } if(m_LArOnlineIDHelper->isHECchannel(id)){ int sampling = m_LArHEC_IDHelper->sampling(offlineID); - m_hCaloNoiseToolHEC[sampling]->Fill(etaChan, noise); + m_hCaloNoiseHEC[sampling]->Fill(etaChan, noise); } if(m_LArOnlineIDHelper->isFCALchannel(id)){ int sampling = m_LArFCAL_IDHelper->module(offlineID); - m_hCaloNoiseToolFCAL[sampling]->Fill(etaChan, noise); + m_hCaloNoiseFCAL[sampling]->Fill(etaChan, noise); } // Fill Bad Channels histograms diff --git a/LArCalorimeter/LArMonTools/src/LArCoverage.h b/LArCalorimeter/LArMonTools/src/LArCoverage.h index 8aaa3231cd2acbe86dcf3a42cdf1ecc50784719f..8e035960853c4fafdd7553c6423794cfc7202f33 100644 --- a/LArCalorimeter/LArMonTools/src/LArCoverage.h +++ b/LArCalorimeter/LArMonTools/src/LArCoverage.h @@ -1,6 +1,6 @@ //Dear emacs, this is -*-c++-*- /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /** @@ -124,10 +124,10 @@ private: TH2I_LW* m_hCoverageHWHECA; TH2I_LW* m_hCoverageHWHECC; TH2I_LW* m_hCoverageHWFCALA; TH2I_LW* m_hCoverageHWFCALC; - // CaloNoiseTool histograms - TProfile_LW* m_hCaloNoiseToolEM[4]; - TProfile_LW* m_hCaloNoiseToolHEC[4]; - TProfile_LW* m_hCaloNoiseToolFCAL[4]; + // CaloNoise histograms + TProfile_LW* m_hCaloNoiseEM[4]; + TProfile_LW* m_hCaloNoiseHEC[4]; + TProfile_LW* m_hCaloNoiseFCAL[4]; // Bad Channels from DB TH2I_LW* m_hBadChannelsBarrelA; diff --git a/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.cxx b/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.cxx index f826fdcf5a13b70f2b6f111efd51fff321629c0e..9f5eaeae45aae69d4bf2e11d177e86c02ccfc1b6 100644 --- a/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.cxx +++ b/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "LArRawChannelMonTool.h" @@ -21,6 +21,9 @@ #include "LArRawEvent/LArRawChannel.h" #include "LArRecEvent/LArEventBitInfo.h" #include "AthenaKernel/Units.h" +#include "StoreGate/ReadCondHandle.h" +#include "CaloConditions/CaloNoise.h" +#include "GaudiKernel/ThreadLocalContext.h" #include "LWHists/TH1F_LW.h" #include "LWHists/TH1I_LW.h" @@ -113,7 +116,6 @@ LArRawChannelMonTool::LArRawChannelMonTool( const std::string & type, { declareProperty( "dataNameBase", m_data_name_base = "LArRawChannel" ); - declareProperty( "calo_noise_tool", m_calo_noise_tool ); declareProperty( "masking_tool", m_masking_tool ); declareProperty( "ATLASReadyFilterTool", m_filterAtlasReady_tools ); @@ -129,8 +131,6 @@ LArRawChannelMonTool::LArRawChannelMonTool( const std::string & type, declareProperty( "noise_burst_percent_threshold", m_noise_burst_percent_thresholds ); declareProperty( "noise_burst_nChannel_threshold", m_noise_burst_nChannel_thresholds ); - declareProperty( "UseElecNoiseOnly", m_useElecNoiseOnly = false ); - declareProperty( "monitor_occupancy", m_monitor_occupancy = false ); declareProperty( "monitor_signal", m_monitor_signal = true ); declareProperty( "monitor_positive_noise", m_monitor_positive_noise = true ); @@ -178,10 +178,11 @@ StatusCode LArRawChannelMonTool::initialize() ATH_CHECK( detStore()->retrieve( m_lar_online_id_ptr, "LArOnlineID" ) ); ATH_CHECK( detStore()->retrieve( m_calo_id_mgr_ptr ) ); ATH_CHECK( m_cable_service_tool.retrieve() ); - ATH_CHECK( m_calo_noise_tool.retrieve() ); ATH_CHECK( m_masking_tool.retrieve() ); ATH_CHECK( m_filterAtlasReady_tools.retrieve() ); + ATH_CHECK( m_noiseKey.initialize() ); + // --- // Get Michel's LArOnlineIDStrHelper: All names are Expert view m_lar_online_id_str_helper_ptr = new @@ -1188,6 +1189,7 @@ StatusCode LArRawChannelMonTool::fillHistograms() ATH_MSG_DEBUG( "===> start " << name() << "::fillHistograms boulou <=== " ); + const EventContext& ctx = Gaudi::Hive::currentContext(); // -- Set ATLAS Ready Filter setIsATLASReady(); @@ -1200,7 +1202,7 @@ StatusCode LArRawChannelMonTool::fillHistograms() ATH_CHECK( detStore()->retrieve (ddman, "CaloMgr") ); // --- retrieve raw channels --- - SG::ReadHandle<LArRawChannelContainer> raw_channels{m_LArRawChannel_container_key}; + SG::ReadHandle<LArRawChannelContainer> raw_channels (m_LArRawChannel_container_key, ctx); if ( !raw_channels.isValid() ) { ATH_MSG_WARNING( "Cannot retrieve LArRawChannelContainer with key: " @@ -1210,7 +1212,7 @@ StatusCode LArRawChannelMonTool::fillHistograms() } // --- retrieve event information --- - SG::ReadHandle<xAOD::EventInfo> event_info{m_EventInfoKey}; + SG::ReadHandle<xAOD::EventInfo> event_info (m_EventInfoKey, ctx); uint32_t bunch_crossing_id = 0; uint32_t lumi_block = 0; bool isEventFlaggedByLArNoisyROAlg = false; // keep default as false @@ -1362,6 +1364,8 @@ StatusCode LArRawChannelMonTool::fillHistograms() //bool firstsampling=true; //Sampling lastsampling(presampler); + SG::ReadCondHandle<CaloNoise> noiseH (m_noiseKey, ctx); + // --- Loop over RawChannels --- for( const LArRawChannel &chan : *raw_channels ){ @@ -1444,24 +1448,9 @@ StatusCode LArRawChannelMonTool::fillHistograms() //eta = calo_element_ptr->eta(); //phi = calo_element_ptr->phi(); // This noise get the value at HIGH gain - // noise = m_calo_noise_tool->getNoise( calo_element_ptr, ICalorimeterNoiseTool::TOTALNOISE ); // Get hold of noise (electronic + Pileup) at the gain the channel is configured to. - noise = m_calo_noise_tool->totalNoiseRMS( calo_element_ptr, chan.gain()); - if (m_useElecNoiseOnly) noise = m_calo_noise_tool->elecNoiseRMS( calo_element_ptr, chan.gain(), -1); // Setting NminBias to -1 as it is not set in ICaloNoiseTool by default + noise = noiseH->getNoise (offline_id, chan.gain()); - /* - if (noise1 != noise) { - std::cout << "Vikas says: Detector and channel HWID are " << det << " " << chan.hardwareID() << std::endl; - std::cout << "Vikas says PROBLEM: noise1 - noise is " << noise1-noise << std::endl; - std::cout << "Vikas says : noise and channel gain are " << noise << " " << chan.gain()<< std::endl; - std::cout << "Vikas says : Elec noise and pileup noise are " << m_calo_noise_tool->getNoise( calo_element_ptr, ICalorimeterNoiseTool::ELECTRONICNOISE ) - << " " << m_calo_noise_tool->getNoise( calo_element_ptr, ICalorimeterNoiseTool::PILEUPNOISE )<< std::endl; - std::cout << "Vikas says : noise1 (gain 2-LOW), noise1 (gain 1-MED), noise1 (gain 0-High ) are " << m_calo_noise_tool->totalNoiseRMS( calo_element_ptr, CaloGain::LARLOWGAIN) - << " " << m_calo_noise_tool->totalNoiseRMS( calo_element_ptr, CaloGain::LARMEDIUMGAIN) - << " " << m_calo_noise_tool->totalNoiseRMS( calo_element_ptr, CaloGain::LARHIGHGAIN ) << std::endl; - - } - */ significance = energy / noise ; //quality = short( chan.quality() ); diff --git a/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.h b/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.h index ff6bc10bbce1692b7b091af99d419df9880f1fff..271ac18890c0bf6555866dd9cf4ace8a8eb354b3 100644 --- a/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.h +++ b/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef LARMONTOOLS_LARRAWCHANNELMONTOOL_H @@ -17,10 +17,10 @@ #include "AthenaMonitoring/DQAtlasReadyFilterTool.h" //#include "AthenaMonitoring/IDQFilterTool.h" #include "CaloIdentifier/CaloIdManager.h" -#include "CaloInterface/ICaloNoiseTool.h" #include "LArCabling/LArCablingLegacyService.h" #include "LArRecConditions/ILArBadChannelMasker.h" #include "LArRawEvent/LArRawChannelContainer.h" +#include "StoreGate/ReadCondHandleKey.h" // --- boost --- #include <boost/shared_ptr.hpp> @@ -43,6 +43,7 @@ class TProfile2D_LW; class TH2F_LW; class TH1I_LW; class LWHist; +class CaloNoise; //! A monitor for the LArg's Raw Channels /*! @@ -68,9 +69,7 @@ class LArRawChannelMonTool: public ManagedMonitorToolBase //! Connects to services and tools /*! - The LArOnlineID and LArCablingService are retrieved. The - CaloNoiseTool and LArBadChannelMasker configurables are also - retrieved. The LArOnlineIDStrHelper is instantiated. Mapping + The LArOnlineID and LArCablingService are retrieved. Mapping from FEB hash to feedthrough hash, from FEB hash to sub-detector, and from superslot (Halfcrate+slot number) to sparcified axis bin are created. @@ -112,7 +111,6 @@ class LArRawChannelMonTool: public ManagedMonitorToolBase private: // --- Job Option Variables --- - bool m_useElecNoiseOnly; bool m_monitor_occupancy; bool m_monitor_signal; bool m_monitor_positive_noise; @@ -150,9 +148,11 @@ class LArRawChannelMonTool: public ManagedMonitorToolBase const CaloIdManager *m_calo_id_mgr_ptr; //!< offline calo structure ToolHandle<LArCablingLegacyService> m_cable_service_tool;//!< LAr connections - ToolHandle<ICaloNoiseTool> m_calo_noise_tool; //!< Calorimeter noise ToolHandle<ILArBadChannelMasker> m_masking_tool; //!< LAr Masking + SG::ReadCondHandleKey<CaloNoise> m_noiseKey + { this, "NoiseKey", "totalNoise", "SG key for noise" }; + // -- for ATLAS Ready Filter bool isATLASReady() { return m_atlas_ready; } void setIsATLASReady();