diff --git a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileDigitsFromPulse.h b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileDigitsFromPulse.h index a9fa8ce47c34323b256b4a17d0fa682e77d72761..d2371cf227ca6e596bd154e442ccc810986ddd18 100644 --- a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileDigitsFromPulse.h +++ b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileDigitsFromPulse.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //**************************************************************************** @@ -74,7 +74,7 @@ class TilePulseShape; class TileHWID; class TileInfo; -class IAtRndmGenSvc; +class IAthRNGSvc; class TH1F; class TFile; @@ -114,8 +114,7 @@ private: SG::WriteHandleKey m_rawChannelContainerKey{this, "TileRawChannelContainer", "TrueAmp", "Output Tile raw channel container key"}; - CLHEP::HepRandomEngine * m_pHRengine; //!< Random number generator engine to use - ServiceHandle m_rndmSvc; //!< Random number service to use + ServiceHandle m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""}; //!< Random number service to use //Parameters diff --git a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileDigitsMaker.h b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileDigitsMaker.h index 870dfbe8050b3c59c7425bb6c90e725b3758e843..fb7fb3ef82635d6e2cce986907499f0dc6348c35 100644 --- a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileDigitsMaker.h +++ b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileDigitsMaker.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //**************************************************************************** @@ -50,7 +50,7 @@ #include "TileEvent/TileHitContainer.h" -class IAtRndmGenSvc; +class IAthRNGSvc; class PileUpMergeSvc; class TileID; class TileTBID; @@ -153,9 +153,7 @@ class TileDigitsMaker: public AthAlgorithm { int m_binTime0Lo; //!< Index of time=0 bin for low gain pulse shape double m_timeStepLo; //!< Time step in low gain pulse shape: 25.0 / nBinsPerXLo - CLHEP::HepRandomEngine * m_pHRengine; //!< Random number generator engine to use - - ServiceHandle m_rndmSvc; //!< Random number service to use + ServiceHandle m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""}; //!< Random number service to use ToolHandle m_tileToolNoiseSample{this, "TileCondToolNoiseSample", "TileCondToolNoiseSample", "Tile sample noise tool"}; diff --git a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToRawChannel.h b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToRawChannel.h index f8dda86c1804c6a8d106f8be4759952eb759cd09..a628d57fb737795014f805265f2f2c566dc0f0b8 100644 --- a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToRawChannel.h +++ b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToRawChannel.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //**************************************************************************** @@ -51,7 +51,7 @@ #include -class IAtRndmGenSvc; +class IAthRNGSvc; class TileID; class TileTBID; class TileHWID; @@ -111,8 +111,7 @@ class TileHitToRawChannel: public AthAlgorithm { double m_threshHi; //!< Value of the mimimal amplitude required to do the conversion to raw channel in high gain (not used for low gain) double m_ampMaxHi; //!< Value of the maximum amplitude to be stored as a high gain channel. For larger amplitudes, the channel is converted to low gain - IAtRndmGenSvc * m_atRndmGenSvc; //!< Random number generator engine to use - CLHEP::HepRandomEngine * m_pHRengine; //!< Random number service to use + ServiceHandle m_atRndmGenSvc{this, "RndmSvc", "AthRNGSvc", ""}; //!< Random number generator engine to use ToolHandle m_tileToolEmscale{this, "TileCondToolEmscale", "TileCondToolEmscale", "Tile EM scale calibration tool"}; diff --git a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToTTL1.h b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToTTL1.h index d40163eb4a7a44e0eaa39b6c41afb770779c6354..faae77d0af7d8772c2247aafc70e5ec7b5b2ff64 100644 --- a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToTTL1.h +++ b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitToTTL1.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //**************************************************************************** @@ -42,11 +42,9 @@ #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" -#include "CLHEP/Random/RandomEngine.h" - #include -class IAtRndmGenSvc; +class IAthRNGSvc; class TileID; class TileTBID; class TileHWID; @@ -118,9 +116,7 @@ class TileHitToTTL1: public AthAlgorithm { bool m_tileNoise; //!< If true => generate noise for the TileTTL1 creation bool m_tileThresh; //!< If true => apply threshold on the conversion to TileTTL1 - CLHEP::HepRandomEngine* m_pHRengine; //!< Random number service to use - - ServiceHandle m_rndmSvc; //!< Random number generator engine to use + ServiceHandle m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""}; //!< Random number generator engine to use ToolHandle m_tileToolEmscale{this, "TileCondToolEmscale", "TileCondToolEmscale", "Tile EM scale calibration tool"}; diff --git a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitVecToCntTool.h b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitVecToCntTool.h index fa3f0d0525305535c99cdd1fb39d3f20b761d091..a8a7ed378dae47b0427f4d299aa044eb8d677fd6 100644 --- a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitVecToCntTool.h +++ b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileHitVecToCntTool.h @@ -37,7 +37,8 @@ // Athena includes #include "PileUpTools/PileUpToolBase.h" #include "StoreGate/WriteHandleKey.h" -#include "AthenaKernel/IAtRndmGenSvc.h" +#include "AthenaKernel/IAthRNGSvc.h" + #include "AthenaKernel/ITriggerTime.h" // Gaudi includes @@ -94,8 +95,8 @@ class TileHitVecToCntTool: public PileUpToolBase { StatusCode createContainers(); void processHitVectorForOverlay(const TileHitVector* inputHits, int& nHit, double& eHitTot); void processHitVectorForPileUp(const TileHitVector* inputHits, double SubEvtTimOffset, int& nHit, double& eHitTot, bool isSignal = false); - void processHitVectorWithoutPileUp(const TileHitVector* inputHits, int& nHit, double& eHitTot, TileHitNonConstContainer* &hitCont); - double applyPhotoStatistics(double energy, Identifier pmt_id); //!< Method to apply photostatistics effect + void processHitVectorWithoutPileUp(const TileHitVector* inputHits, int& nHit, double& eHitTot, TileHitNonConstContainer* &hitCont, CLHEP::HepRandomEngine * engine); + double applyPhotoStatistics(double energy, Identifier pmt_id, CLHEP::HepRandomEngine * engine); //!< Method to apply photostatistics effect void findAndMergeE1(TileHitCollection* coll, int frag_id, TileHitNonConstContainer* &hitCont); void findAndMergeMBTS(TileHitCollection* coll, int frag_id, TileHitNonConstContainer* &hitCont); @@ -131,8 +132,7 @@ class TileHitVecToCntTool: public PileUpToolBase { const TileDetDescrManager* m_tileMgr; //!< Pointer to TileDetDescrManager float m_nPhotoElectrons[7]; //!< number of photo electrons per GeV in samplings - CLHEP::HepRandomEngine* m_pHRengine; //!< Random number service to use - ServiceHandle m_rndmSvc; //!< Random number generator engine to use + ServiceHandle m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""}; //!< Random number generator engine to use std::vector m_allHits; //!< vector for all TileHits std::vector m_allHits_DigiHSTruth; //!< vector for all TileHits diff --git a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TilePulseForTileMuonReceiver.h b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TilePulseForTileMuonReceiver.h index 9d0b66c21b1f513dde75cdc4708c88925fa4c419..ddfa17f2d891f8c1500bfaa2200cce06a27d8daf 100644 --- a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TilePulseForTileMuonReceiver.h +++ b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TilePulseForTileMuonReceiver.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //**************************************************************************** @@ -53,9 +53,7 @@ #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" -#include "CLHEP/Random/RandomEngine.h" - -class IAtRndmGenSvc; +class IAthRNGSvc; class PileUpMergeSvc; class HWIdentifier; @@ -127,8 +125,7 @@ class TilePulseForTileMuonReceiver: public AthAlgorithm { // std::vector m_shapeMuonReceiver;//!< Muon receiver pulse shape - CLHEP::HepRandomEngine* m_pHRengine; //!< Random number generator engine to use - ServiceHandle m_rndmSvc; //!< Random number service to use + ServiceHandle m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""}; //!< Random number service to use ToolHandle m_tileToolNoiseSample{this, "TileCondToolNoiseSample", "TileCondToolNoiseSample", "Tile sample noise tool"}; diff --git a/TileCalorimeter/TileSimAlgs/python/TileDigitsGetter.py b/TileCalorimeter/TileSimAlgs/python/TileDigitsGetter.py index 40dd0f6f39e2d9b9516adb95d01ef47fbfb9e44d..f83c2a867bed519d14ae099b961094e38d0987eb 100644 --- a/TileCalorimeter/TileSimAlgs/python/TileDigitsGetter.py +++ b/TileCalorimeter/TileSimAlgs/python/TileDigitsGetter.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # Author: J. Poveda (Ximo.Poveda@cern.ch) # TileDigits creation from TileHit @@ -65,10 +65,6 @@ class TileDigitsGetter ( Configured ) : theTileDigitsMaker.CalibrationRun=False - # Random number engine - theTileDigitsMaker.RndmSvc=digitizationFlags.rndmSvc() - digitizationFlags.rndmSeedList.addSeed("Tile_DigitsMaker", 4789899, 989240512) - # Save integer numbers in digits vector if not pile-up premixing theTileDigitsMaker.IntegerDigits = not digitizationFlags.PileUpPremixing() diff --git a/TileCalorimeter/TileSimAlgs/python/TileRawChannelFromHitsGetter.py b/TileCalorimeter/TileSimAlgs/python/TileRawChannelFromHitsGetter.py index 3994a819cf73848589dbb568104229aaf1fbde9c..64e2e6748cf1b227a375197fab71d86e4e702125 100644 --- a/TileCalorimeter/TileSimAlgs/python/TileRawChannelFromHitsGetter.py +++ b/TileCalorimeter/TileSimAlgs/python/TileRawChannelFromHitsGetter.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # Author: J. Poveda (Ximo.Poveda@cern.ch) # TileRawChannel creation from TileHit @@ -65,11 +65,6 @@ class TileRawChannelFromHitsGetter ( Configured ) : objKeyStore.addStreamESD(self.outputType(),self.outputKey()) - # Random number engine - from Digitization.DigitizationFlags import digitizationFlags - digitizationFlags.rndmSeedList.addSeed("Tile_DigitsMaker", 4789899, 989240512) - - # now add algorithm to topSequence # this should always come at the end diff --git a/TileCalorimeter/TileSimAlgs/python/TileSimAlgsConfig.py b/TileCalorimeter/TileSimAlgs/python/TileSimAlgsConfig.py index 8ffb0575f19fcaa98b137d7c0ba1de109ac9c536..6a5cf4fe333cb50e437618e1c6645133167173c2 100644 --- a/TileCalorimeter/TileSimAlgs/python/TileSimAlgsConfig.py +++ b/TileCalorimeter/TileSimAlgs/python/TileSimAlgsConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration from Digitization.DigitizationFlags import digitizationFlags from AthenaCommon import CfgMgr @@ -40,10 +40,6 @@ def TileHitVecToCntTool(name="TileHitVecToCntTool", **kwargs): kwargs.setdefault("HitTimeFlag", 2) kwargs.setdefault("UseTriggerTime", True) - # Random number engine - kwargs.setdefault("RndmSvc", digitizationFlags.rndmSvc()) - digitizationFlags.rndmSeedList.addSeed("Tile_HitVecToCnt", 4789899, 989240512) - if digitizationFlags.doXingByXingPileUp(): # PileUpTool approach kwargs.setdefault("FirstXing", Tile_FirstXing() ) kwargs.setdefault("LastXing", Tile_LastXing() ) diff --git a/TileCalorimeter/TileSimAlgs/share/TileFitDigitization_jobOptions.py b/TileCalorimeter/TileSimAlgs/share/TileFitDigitization_jobOptions.py index e482a3694fcd210ab8e9f90b42d1ea2f117e649a..a022e6194614af6dd1f22a73f163a67997a4432a 100644 --- a/TileCalorimeter/TileSimAlgs/share/TileFitDigitization_jobOptions.py +++ b/TileCalorimeter/TileSimAlgs/share/TileFitDigitization_jobOptions.py @@ -80,11 +80,6 @@ if doTileHitToDigit: theTileDigitsMaker.UseCoolPulseShapes=False theTileDigitsMaker.MaskBadChannels=False theTileDigitsMaker.RndmEvtOverlay=False - - # Random number engine - from Digitization.DigitizationFlags import jobproperties - theTileDigitsMaker.RndmSvc=jobproperties.Digitization.rndmSvc() - jobproperties.Digitization.rndmSeedList.addSeed("Tile_DigitsMaker", 4789899, 989240512) if doTileDigitToRawChannel: diff --git a/TileCalorimeter/TileSimAlgs/share/TileMuonReceiver_jobOptions.py b/TileCalorimeter/TileSimAlgs/share/TileMuonReceiver_jobOptions.py index 01464381ac2d9c2e6bc233d2908c2b73657b4f2c..32f162bbe779ad08fa9b1413f849f8260dc96e70 100644 --- a/TileCalorimeter/TileSimAlgs/share/TileMuonReceiver_jobOptions.py +++ b/TileCalorimeter/TileSimAlgs/share/TileMuonReceiver_jobOptions.py @@ -48,12 +48,9 @@ topSequence += CfgMgr.TilePulseForTileMuonReceiver('TilePulseForTileMuonReceiver , UseCoolPedestal = False , UseCoolPulseShapes = True , TileCondToolPulseShape = toolSvc.TileCondToolMuRcvPulseShape - , TileRawChannelBuilderMF = toolSvc.TileMuRcvRawChannelBuilderMF - , RndmSvc = jobproperties.Digitization.rndmSvc()) + , TileRawChannelBuilderMF = toolSvc.TileMuRcvRawChannelBuilderMF) -jobproperties.Digitization.rndmSeedList.addSeed("Tile_PulseForTileMuonReceiver", 4789899, 989240512) - topSequence += CfgMgr.TileMuonReceiverDecision('TileMuonReceiverDecision' # , OutputLevel = VERBOSE , MuonReceiverEneThreshCellD6Low = 500 diff --git a/TileCalorimeter/TileSimAlgs/share/TileTTL1_jobOptions.py b/TileCalorimeter/TileSimAlgs/share/TileTTL1_jobOptions.py index 4e40fd9f75e0b20f2e4e938a3994bccdae9cfbbc..41f01c71eac43e94b2a68108d678b2abe997270f 100644 --- a/TileCalorimeter/TileSimAlgs/share/TileTTL1_jobOptions.py +++ b/TileCalorimeter/TileSimAlgs/share/TileTTL1_jobOptions.py @@ -5,8 +5,6 @@ from TileSimAlgs.TileTTL1FromHitsGetter import TileTTL1FromHitsGetter theTileTTL1FromHitsGetter = TileTTL1FromHitsGetter() from Digitization.DigitizationFlags import jobproperties -topSequence.TileHitToTTL1.RndmSvc = jobproperties.Digitization.rndmSvc() -jobproperties.Digitization.rndmSeedList.addSeed("Tile_HitToTTL1", 4789899, 989240512) from AthenaCommon.BeamFlags import jobproperties if jobproperties.Beam.beamType == 'cosmics': @@ -17,7 +15,4 @@ if jobproperties.Beam.beamType == 'cosmics': TileTTL1Container = "TileTTL1CosmicsCnt", TileMBTSTTL1Container = "TileMBTSTTL1CosmicsContainer" ) - theTileTTL1Cosmics.RndmSvc=jobproperties.Digitization.rndmSvc() - jobproperties.Digitization.rndmSeedList.addSeed("Tile_TTL1Cosmics", 4789899, 989240512) - topSequence += theTileTTL1Cosmics diff --git a/TileCalorimeter/TileSimAlgs/src/TileDigitsFromPulse.cxx b/TileCalorimeter/TileSimAlgs/src/TileDigitsFromPulse.cxx index d26dac72a08c3c313a736ed9a639bdebe9c3472b..378bdee6eb5117eab0c39205f6009d58d581edfe 100644 --- a/TileCalorimeter/TileSimAlgs/src/TileDigitsFromPulse.cxx +++ b/TileCalorimeter/TileSimAlgs/src/TileDigitsFromPulse.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //***************************************************************************** @@ -35,7 +35,8 @@ #include "AthAllocators/DataPool.h" #include "PathResolver/PathResolver.h" //Random number service -#include "AthenaKernel/IAtRndmGenSvc.h" +#include "AthenaKernel/IAthRNGSvc.h" +#include "AthenaKernel/RNGWrapper.h" #include #include @@ -60,10 +61,7 @@ using CLHEP::RandFlat; TileDigitsFromPulse::TileDigitsFromPulse(std::string name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_tileHWID(0), - m_tileInfo(0), - m_pHRengine(0), - m_rndmSvc("AtRndmGenSvc", name) - + m_tileInfo(0) { m_rChUnit = TileRawChannelUnit::ADCcounts; m_rChType = TileFragHash::Default; @@ -205,8 +203,6 @@ StatusCode TileDigitsFromPulse::initialize() { if (!m_rndmSvc.retrieve().isSuccess()) { ATH_MSG_FATAL("Could not initialize find Random Number Service."); return StatusCode::FAILURE; - } else { - m_pHRengine = m_rndmSvc->GetEngine("Tile_DigitsMaker"); } if (m_chanNoise) m_gaussNoise = kFALSE; //Make sure channel noise overrides gaussian noise. @@ -223,6 +219,10 @@ StatusCode TileDigitsFromPulse::execute() { ATH_MSG_DEBUG("in execute()"); + // Prepare RNG service + ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this); + rngWrapper->setSeed( name(), Gaudi::Hive::currentContext() ); + // Create new container for digits auto digitsContainer = std::make_unique(true, TileFragHash::Digitizer, @@ -321,8 +321,8 @@ StatusCode TileDigitsFromPulse::execute() { double Hfn1 = m_tileToolNoiseSample->getHfn1(drawerIdx, channel, gain); double Hfn2 = m_tileToolNoiseSample->getHfn2(drawerIdx, channel, gain); double Norm = m_tileToolNoiseSample->getHfnNorm(drawerIdx, channel, gain); - RandGaussQ::shootArray(m_pHRengine, samples.size(), Rndm, 0.0, 1.0); - RandFlat::shootArray(m_pHRengine, 1, Rndm_dG, 0.0, 1.0); + RandGaussQ::shootArray(*rngWrapper, samples.size(), Rndm, 0.0, 1.0); + RandFlat::shootArray(*rngWrapper, 1, Rndm_dG, 0.0, 1.0); for (unsigned int js = 0; js < samples.size(); ++js) { //using the same gaussian(sigma) for all samples in one channel in one event if (Rndm_dG[0] < Norm) diff --git a/TileCalorimeter/TileSimAlgs/src/TileDigitsMaker.cxx b/TileCalorimeter/TileSimAlgs/src/TileDigitsMaker.cxx index 00da31feb79f25699188b479ddf424a81683845d..0f2e466ac388d999c9239231b1f6f3545bc679f0 100644 --- a/TileCalorimeter/TileSimAlgs/src/TileDigitsMaker.cxx +++ b/TileCalorimeter/TileSimAlgs/src/TileDigitsMaker.cxx @@ -34,7 +34,9 @@ // Atlas include #include "AthenaKernel/errorcheck.h" // For the Athena-based random numbers. -#include "AthenaKernel/IAtRndmGenSvc.h" +#include "AthenaKernel/IAthRNGSvc.h" +#include "AthenaKernel/RNGWrapper.h" + #include "AthenaKernel/Units.h" #include "StoreGate/ReadHandle.h" #include "StoreGate/WriteHandle.h" @@ -87,16 +89,13 @@ TileDigitsMaker::TileDigitsMaker(std::string name, ISvcLocator* pSvcLocator) m_nShapeLo(0), m_nBinsPerXLo(0), m_binTime0Lo(0), - m_timeStepLo(0.0), - m_pHRengine(0), - m_rndmSvc ("AtRndmGenSvc", name) + m_timeStepLo(0.0) { declareProperty("FilterThreshold", m_filterThreshold = 100.0 * MeV, "Threshold on filtered digits (default - 100 MeV)"); declareProperty("FilterThresholdMBTS", m_filterThresholdMBTS = 0.0 * MeV, "Threshold on filtered digits of MBTS (default - 0 MeV)"); declareProperty("TileInfoName", m_infoName = "TileInfo"); declareProperty("IntegerDigits", m_integerDigits = true); declareProperty("CalibrationRun", m_calibRun = false); - declareProperty("RndmSvc", m_rndmSvc, "Random Number Service used in TileDigitsMaker"); declareProperty("RndmEvtOverlay",m_rndmEvtOverlay = false,"Pileup and/or noise added by overlaying random events (default=false)"); declareProperty("UseCoolPulseShapes",m_useCoolPulseShapes = true,"Pulse shapes from database (default=true)"); declareProperty("MaskBadChannels",m_maskBadChannels = false,"Remove channels tagged bad (default=false)"); @@ -173,7 +172,6 @@ StatusCode TileDigitsMaker::initialize() { if (m_tileNoise || m_tileCoherNoise || m_rndmEvtOverlay) { ATH_CHECK( m_rndmSvc.retrieve()); - m_pHRengine = m_rndmSvc->GetEngine("Tile_DigitsMaker"); } ATH_MSG_DEBUG( "Event Overlay: " << ((m_rndmEvtOverlay)?"true":"false")); @@ -361,6 +359,13 @@ StatusCode TileDigitsMaker::execute() { const EventContext& ctx = Gaudi::Hive::currentContext(); + // Prepare RNG service + ATHRNG::RNGWrapper* rngWrapper = nullptr; + if (m_tileNoise || m_tileCoherNoise || m_rndmEvtOverlay) { + rngWrapper = m_rndmSvc->getEngine(this); + rngWrapper->setSeed( name(), ctx ); + } + static bool first = (msgLvl(MSG::VERBOSE) && !m_rndmEvtOverlay ); if (first) { ATH_MSG_VERBOSE( "Dumping 2G noise parameters"); @@ -802,13 +807,13 @@ StatusCode TileDigitsMaker::execute() { //NOTE: ShootArray's inputs are : the engine, the size, the vector, the mean, the standard dev for (int k = 0; k < m_nSamples; ++k) { double * RndmVec = CorrRndmVec[k]; - RandGaussQ::shootArray(m_pHRengine, nchMax, RndmVec, 0.0, 1.0); + RandGaussQ::shootArray(*rngWrapper, nchMax, RndmVec, 0.0, 1.0); } if (m_calibRun) { for (int k = 0; k < m_nSamples; ++k) { double * RndmVecLo = CorrRndmVecLo[k]; - RandGaussQ::shootArray(m_pHRengine, nchMax, RndmVecLo, 0.0, 1.0); + RandGaussQ::shootArray(*rngWrapper, nchMax, RndmVecLo, 0.0, 1.0); } } } @@ -891,11 +896,11 @@ StatusCode TileDigitsMaker::execute() { /* If tileNoise is requested, generate array of random numbers. */ if (tileNoiseLG) { // true if tileNoise is set or noise is needed for low gain in overlay - RandGaussQ::shootArray(m_pHRengine, m_nSamples, Rndm, 0.0, 1.0); - RandFlat::shootArray(m_pHRengine, 1, Rndm_dG, 0.0, 1.0); + RandGaussQ::shootArray(*rngWrapper, m_nSamples, Rndm, 0.0, 1.0); + RandFlat::shootArray(*rngWrapper, 1, Rndm_dG, 0.0, 1.0); if (m_calibRun) { - RandGaussQ::shootArray(m_pHRengine, m_nSamples, RndmLo, 0.0, 1.0); - RandFlat::shootArray(m_pHRengine, 1, RndmLo_dG, 0.0, 1.0); + RandGaussQ::shootArray(*rngWrapper, m_nSamples, RndmLo, 0.0, 1.0); + RandFlat::shootArray(*rngWrapper, 1, RndmLo_dG, 0.0, 1.0); } } diff --git a/TileCalorimeter/TileSimAlgs/src/TileHitToRawChannel.cxx b/TileCalorimeter/TileSimAlgs/src/TileHitToRawChannel.cxx index 8a2a56261508656b374e416529fef978b134a7a6..f42a18023d5222499c0642de261bc541ef471c76 100644 --- a/TileCalorimeter/TileSimAlgs/src/TileHitToRawChannel.cxx +++ b/TileCalorimeter/TileSimAlgs/src/TileHitToRawChannel.cxx @@ -34,7 +34,8 @@ #include "StoreGate/WriteHandle.h" #include "AthenaKernel/errorcheck.h" // For the Athena-based random numbers. -#include "AthenaKernel/IAtRndmGenSvc.h" +#include "AthenaKernel/IAthRNGSvc.h" +#include "AthenaKernel/RNGWrapper.h" //CLHEP includes #include @@ -59,8 +60,6 @@ TileHitToRawChannel::TileHitToRawChannel(std::string name, ISvcLocator* pSvcLoca , m_tileThresh(false) , m_threshHi(0.0) , m_ampMaxHi(0.0) - , m_atRndmGenSvc(0) - , m_pHRengine(0) { m_rChUnit = TileRawChannelUnit::ADCcounts; m_rChType = TileFragHash::Default; @@ -103,9 +102,7 @@ StatusCode TileHitToRawChannel::initialize() { ATH_CHECK( m_tileToolNoiseSample.retrieve() ); if (m_tileNoise) { - static const bool CREATEIFNOTTHERE_RNDM(true); - CHECK( service("AtRndmGenSvc", m_atRndmGenSvc, CREATEIFNOTTHERE_RNDM)); - m_pHRengine = m_atRndmGenSvc->GetEngine("Tile_DigitsMaker"); + ATH_CHECK(m_atRndmGenSvc.retrieve()); } m_cabling = TileCablingService::getInstance(); @@ -169,6 +166,9 @@ StatusCode TileHitToRawChannel::execute() { ATH_MSG_DEBUG( "Executing TileHitToRawChannel" ); + ATHRNG::RNGWrapper* rngWrapper = m_atRndmGenSvc->getEngine(this); + rngWrapper->setSeed( name(), Gaudi::Hive::currentContext() ); + // step1: read hits from TES SG::ReadHandle hitContainer(m_hitContainerKey); ATH_CHECK( hitContainer.isValid() ); @@ -226,7 +226,7 @@ StatusCode TileHitToRawChannel::execute() { // If tileNoise is requested, generate random numbers to give noise if (m_tileNoise) { - RandGaussQ::shootArray(m_pHRengine, nChMax, random, 0.0, 1.0); + RandGaussQ::shootArray(*rngWrapper, nChMax, random, 0.0, 1.0); for (ch = 0; ch < nChMax; ++ch) { adc_gain[ch] = TileID::HIGHGAIN; diff --git a/TileCalorimeter/TileSimAlgs/src/TileHitToTTL1.cxx b/TileCalorimeter/TileSimAlgs/src/TileHitToTTL1.cxx index 6d4dd7210bd9871ec9876d6f6abfb28af17294de..a4946a1d371578e53410b4829af9b1ca92910575 100644 --- a/TileCalorimeter/TileSimAlgs/src/TileHitToTTL1.cxx +++ b/TileCalorimeter/TileSimAlgs/src/TileHitToTTL1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //***************************************************************************** @@ -40,7 +40,8 @@ #include "StoreGate/WriteHandle.h" #include "AthenaKernel/errorcheck.h" // For the Athena-based random numbers. -#include "AthenaKernel/IAtRndmGenSvc.h" +#include "AthenaKernel/IAthRNGSvc.h" +#include "AthenaKernel/RNGWrapper.h" // Gaudi includes #include "GaudiKernel/ISvcLocator.h" @@ -74,15 +75,12 @@ TileHitToTTL1::TileHitToTTL1(std::string name, ISvcLocator* pSvcLocator) , m_lastTower(0) , m_tileNoise(false) , m_tileThresh(false) - , m_pHRengine(0) - , m_rndmSvc ("AtRndmGenSvc", name) { m_infoName = "TileInfo"; m_TileTTL1Type = "Standard"; declareProperty("TileInfoName", m_infoName); declareProperty("TileTTL1Type", m_TileTTL1Type); - declareProperty("RndmSvc", m_rndmSvc, "Random Number Service used in TileHitToTTL1"); declareProperty("maskBadChannels", m_maskBadChannels = true); } @@ -113,9 +111,8 @@ StatusCode TileHitToTTL1::initialize() { //=== get TileCondToolEmscale CHECK( m_tileToolEmscale.retrieve() ); - CHECK( m_rndmSvc.retrieve() ); - m_pHRengine = m_rndmSvc->GetEngine("Tile_HitToTTL1"); - + //=== Get rndm number service + ATH_CHECK( m_rndmSvc.retrieve() ); m_cabling = TileCablingService::getInstance(); @@ -214,6 +211,10 @@ StatusCode TileHitToTTL1::execute() { // declare array for random number generation for noise in samples. double Rndm[16]; // Can't use variable size array + // Prepare RNG Service + ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this); + rngWrapper->setSeed( name(), Gaudi::Hive::currentContext() ); + /*........................................................................*/ // Get hit container from TES and create TTL1 and MBTS container // Note that hit container has 256 collections (one for each drawer), @@ -540,7 +541,7 @@ StatusCode TileHitToTTL1::execute() { double ttL1Max = m_tileInfo->MBTSL1Max(MBTS_id); if (m_tileNoise) - RandGaussQ::shootArray(m_pHRengine, m_MBTSnSamples, Rndm); + RandGaussQ::shootArray(*rngWrapper, m_MBTSnSamples, Rndm); for (int jsamp = 0; jsamp < m_MBTSnSamples; ++jsamp) { MBTSAmp[jsamp] *= ttL1Calib; // convert pCb to mV MBTSsamples[jsamp] = MBTSAmp[jsamp] + ttL1Ped; @@ -596,7 +597,7 @@ StatusCode TileHitToTTL1::execute() { } // end loop over samples if (m_tileNoise) - peakAmp += ttL1NoiseSigma * RandGaussQ::shoot(m_pHRengine); + peakAmp += ttL1NoiseSigma * RandGaussQ::shoot(*rngWrapper); ttL1samples[0] = peakAmp; if (m_tileThresh) { if (ttL1samples[0] - ttL1Ped < ttL1Thresh) @@ -622,7 +623,7 @@ StatusCode TileHitToTTL1::execute() { double ttL1Max = m_tileInfo->TTL1Max(ttId[ieta]); if (m_tileNoise) - RandGaussQ::shootArray(m_pHRengine, m_nSamples, Rndm); + RandGaussQ::shootArray(*rngWrapper, m_nSamples, Rndm); for (int jsamp = 0; jsamp < m_nSamples; ++jsamp) { ttAmp[ieta][jsamp] *= ttL1Calib; // convert pCb to mV ttL1samples[jsamp] = ttAmp[ieta][jsamp] + ttL1Ped; diff --git a/TileCalorimeter/TileSimAlgs/src/TileHitVecToCntTool.cxx b/TileCalorimeter/TileSimAlgs/src/TileHitVecToCntTool.cxx index b78f6245c41b7240f4e81bef79c608625b977c36..3ec21273efb0abf08fa410f2ff2f1c003c199a29 100644 --- a/TileCalorimeter/TileSimAlgs/src/TileHitVecToCntTool.cxx +++ b/TileCalorimeter/TileSimAlgs/src/TileHitVecToCntTool.cxx @@ -31,7 +31,9 @@ #include "AthenaKernel/ITriggerTime.h" #include "AthenaKernel/errorcheck.h" // For the Athena-based random numbers. -#include "AthenaKernel/IAtRndmGenSvc.h" +#include "AthenaKernel/IAthRNGSvc.h" +#include "AthenaKernel/RNGWrapper.h" +#include "CLHEP/Random/RandomEngine.h" // Gaudi includes #include "GaudiKernel/SystemOfUnits.h" @@ -69,8 +71,6 @@ TileHitVecToCntTool::TileHitVecToCntTool(const std::string& type, , m_tileTBID(0) , m_tileInfo(0) , m_tileMgr(0) - , m_pHRengine(0) - , m_rndmSvc("AtRndmGenSvc",name) , m_hits(0) , m_hits_DigiHSTruth(0) , m_mbtsOffset(0) @@ -91,7 +91,6 @@ TileHitVecToCntTool::TileHitVecToCntTool(const std::string& type, declareProperty("MaxHitTime", m_maxHitTime, "All sub-hits with time above m_maxHitTime will be ignored"); declareProperty("PhotostatWindow", m_photoStatisticsWindow, "Sum up energy in [-m_photoStatWindow,+m_photoStatWindow] and use it for photostatistics"); declareProperty("PhotostatType", m_photoElectronStatistics, "Method to apply photostatistics (default=2)"); - declareProperty("RndmSvc", m_rndmSvc, "Random Number Service used in TileHitVecToCnt"); declareProperty("SkipNoHit",m_skipNoHit, "Skip events with no Tile hits (default=false)"); declareProperty("RndmEvtOverlay",m_rndmEvtOverlay = false, "Pileup and/or noise added by overlaying random events (default=false)"); declareProperty("DoHSTruthReconstruction",m_doDigiTruth = true, "DigiTruth reconstruction"); @@ -104,8 +103,7 @@ StatusCode TileHitVecToCntTool::initialize() { bool error = false; - CHECK(m_rndmSvc.retrieve()); - m_pHRengine = m_rndmSvc->GetEngine("Tile_HitVecToCnt"); + ATH_CHECK(m_rndmSvc.retrieve()); // retrieve Tile detector manager, TileID helper and TileInfo from det store @@ -377,6 +375,9 @@ StatusCode TileHitVecToCntTool::prepareEvent(unsigned int /*nInputEvents*/) { ATH_MSG_DEBUG("TileHitVecToCntTool prepareEvent finished"); + ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this); + rngWrapper->setSeed( name(), Gaudi::Hive::currentContext() ); + return StatusCode::SUCCESS; } @@ -556,7 +557,7 @@ void TileHitVecToCntTool::processHitVectorForPileUp(const TileHitVector* inputHi return; } -void TileHitVecToCntTool::processHitVectorWithoutPileUp(const TileHitVector* inputHits, int& nHit, double& eHitTot, TileHitNonConstContainer* &hitCont) { +void TileHitVecToCntTool::processHitVectorWithoutPileUp(const TileHitVector* inputHits, int& nHit, double& eHitTot, TileHitNonConstContainer* &hitCont, CLHEP::HepRandomEngine * engine) { TileHitVecConstIterator inpItr = inputHits->begin(); TileHitVecConstIterator end = inputHits->end(); @@ -673,7 +674,7 @@ void TileHitVecToCntTool::processHitVectorWithoutPileUp(const TileHitVector* inp } } ATH_MSG_DEBUG("Minimal time in input event " << avtime); - double shift = RandFlat::shoot(m_pHRengine, m_triggerTime, 0.0); + double shift = RandFlat::shoot(engine, m_triggerTime, 0.0); ATH_MSG_DEBUG("Minimal time after random shift " << shift); avtime -= shift; // subtracting negative shift value here @@ -760,6 +761,9 @@ StatusCode TileHitVecToCntTool::processBunchXing(int bunchXing ATH_MSG_DEBUG("Inside TileHitVecToCntTool processBunchXing" << bunchXing); // setFilterPassed(true); + ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this); + CLHEP::HepRandomEngine * engine = *rngWrapper; + SubEventIterator iEvt(bSubEvents); if (m_rndmEvtOverlay && bunchXing != 0) iEvt = eSubEvents; // in overlay skip all events except BC=0 @@ -789,7 +793,7 @@ StatusCode TileHitVecToCntTool::processBunchXing(int bunchXing } else { ATH_MSG_DEBUG(" New HitCont. TimeOffset=" << SubEvtTimOffset << ", size =" << inputHits->size()); this->processHitVectorForOverlay(inputHits, nHit, eHitTot); - //if( m_doDigiTruth && iEvt == bSubEvents) this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_signalHits); + //if( m_doDigiTruth && iEvt == bSubEvents) this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_signalHits, engine); } } else if (m_pileUp) { // pileup code bool isSignal = false; @@ -805,8 +809,8 @@ StatusCode TileHitVecToCntTool::processBunchXing(int bunchXing ATH_MSG_ERROR(" Tile Hit container not found for event key " << hitVectorName); } - this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_hits); - if(m_doDigiTruth) this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_hits_DigiHSTruth); + this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_hits, engine); + if(m_doDigiTruth) this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_hits_DigiHSTruth, engine); } // to pile-up or not } // end of the loop over different input hitVectorNames (normal hits and MBTS hits) @@ -831,6 +835,9 @@ StatusCode TileHitVecToCntTool::processAllSubEvents() { int nHit(0); double eHitTot(0.0); + ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this); + CLHEP::HepRandomEngine * engine = *rngWrapper; + std::vector::const_iterator hitVecNamesItr = m_hitVectorNames.begin(); std::vector::const_iterator hitVecNamesEnd = m_hitVectorNames.end(); for (; hitVecNamesItr != hitVecNamesEnd; ++hitVecNamesItr) { @@ -860,7 +867,7 @@ StatusCode TileHitVecToCntTool::processAllSubEvents() { const TileHitVector* inputHits = &(*(iCont->second)); ATH_MSG_DEBUG(" New HitCont. TimeOffset=" << SubEvtTimOffset << ", size =" << inputHits->size()); this->processHitVectorForOverlay(inputHits, nHit, eHitTot); - if(m_doDigiTruth) this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_hits_DigiHSTruth); + if(m_doDigiTruth) this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_hits_DigiHSTruth, engine); } } } else if (m_pileUp) { // pileup code @@ -886,8 +893,8 @@ StatusCode TileHitVecToCntTool::processAllSubEvents() { ATH_MSG_WARNING("Hit Vector "<< hitVectorName << " not found in StoreGate"); continue; // continue to the next hit vector } - this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_hits); - if(m_doDigiTruth) this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_hits_DigiHSTruth); + this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_hits, engine); + if(m_doDigiTruth) this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_hits_DigiHSTruth, engine); } } // end of the loop over different input hitVectorNames (normal hits and MBTS hits) @@ -960,6 +967,9 @@ StatusCode TileHitVecToCntTool::mergeEvent() { //photoelectron statistics. //loop over all hits in TileHitContainer and take energy deposited in certain period of time //std::vector::const_iterator hitVecNamesEnd = m_hitVectorNames.end(); + + ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this); + CLHEP::HepRandomEngine * engine = *rngWrapper; TileHitNonConstContainer::iterator collIt_DigiHSTruth; TileHitNonConstContainer::iterator endColl_DigiHSTruth; @@ -990,7 +1000,7 @@ StatusCode TileHitVecToCntTool::mergeEvent() { //channel_id = m_cabling->s2h_channel_id(pmt_id); } - double scaleFactor = applyPhotoStatistics(ehit, pmt_id); + double scaleFactor = applyPhotoStatistics(ehit, pmt_id, engine); pHit->scale(scaleFactor); if(m_doDigiTruth){ @@ -1071,7 +1081,7 @@ StatusCode TileHitVecToCntTool::finalize() { } -double TileHitVecToCntTool::applyPhotoStatistics(double energy, Identifier pmt_id) { +double TileHitVecToCntTool::applyPhotoStatistics(double energy, Identifier pmt_id, CLHEP::HepRandomEngine * engine) { // pmt_sample = 0-3 for normal cells 4 for inner MBTS, 5 for outer MBTS, 6 for E4' int pmt_sample = (m_tileTBID->is_tiletb(pmt_id)) ? TileID::SAMP_X + m_tileTBID->channel(pmt_id) : m_tileID->sample(pmt_id); @@ -1081,19 +1091,19 @@ double TileHitVecToCntTool::applyPhotoStatistics(double energy, Identifier pmt_i switch (m_photoElectronStatistics) { case 2: if (pe > 20.0) { - RndmPois = std::max(0.0, RandGaussQ::shoot(m_pHRengine, pe, sqrt(pe))); // FIXME CLHEP::RandGaussZiggurat is faster and more accurate. + RndmPois = std::max(0.0, RandGaussQ::shoot(engine, pe, sqrt(pe))); // FIXME CLHEP::RandGaussZiggurat is faster and more accurate. pe_scale = RndmPois / pe; } else { // pe<=20 if (pe > 0.) { double singleMEAN = 1.0; //Parameterization of monoelectron spectra double singleSIGMA = 1.0; - RndmPois = RandPoissonT::shoot(m_pHRengine, pe); + RndmPois = RandPoissonT::shoot(engine, pe); if (RndmPois > 0) { pe_scale = 0; for (int i = 0; i < RndmPois; i++) - pe_scale += 1 / (1.08332) * std::max(0., RandGaussQ::shoot(m_pHRengine, singleMEAN, singleSIGMA)); // FIXME CLHEP::RandGaussZiggurat is faster and more accurate. + pe_scale += 1 / (1.08332) * std::max(0., RandGaussQ::shoot(engine, singleMEAN, singleSIGMA)); // FIXME CLHEP::RandGaussZiggurat is faster and more accurate. pe_scale /= RndmPois; } else @@ -1104,7 +1114,7 @@ double TileHitVecToCntTool::applyPhotoStatistics(double energy, Identifier pmt_i case 0: if (pe > 0.0) { - RndmPois = RandPoissonT::shoot(m_pHRengine, pe); + RndmPois = RandPoissonT::shoot(engine, pe); pe_scale = RndmPois / pe; } break; @@ -1112,7 +1122,7 @@ double TileHitVecToCntTool::applyPhotoStatistics(double energy, Identifier pmt_i case 1: if (pe > 0.0) { if (pe > 10.0) { - RndmPois = std::max(0.0, RandGaussQ::shoot(m_pHRengine, pe, sqrt(pe))); // FIXME CLHEP::RandGaussZiggurat is faster and more accurate. + RndmPois = std::max(0.0, RandGaussQ::shoot(engine, pe, sqrt(pe))); // FIXME CLHEP::RandGaussZiggurat is faster and more accurate. } else { int nn = std::max(10, (int) (pe * 10.0)); double * ProbFunc = new double[nn]; @@ -1121,7 +1131,7 @@ double TileHitVecToCntTool::applyPhotoStatistics(double energy, Identifier pmt_i ProbFunc[i] = ProbFunc[i - 1] * pe / i; } RandGeneral* RandG = new RandGeneral(ProbFunc, nn, 0); - RndmPois = RandG->shoot(m_pHRengine) * nn; + RndmPois = RandG->shoot(engine) * nn; //here RndmPois is continuously distributed random value obtained from Poisson //distribution by approximation. delete RandG; diff --git a/TileCalorimeter/TileSimAlgs/src/TileMuonReceiverDecision.cxx b/TileCalorimeter/TileSimAlgs/src/TileMuonReceiverDecision.cxx index ac75cea888b94fa26a1450a9f037a79a4bb54b1b..8c9fcd54db9288b92175460beeddc56e013808b4 100644 --- a/TileCalorimeter/TileSimAlgs/src/TileMuonReceiverDecision.cxx +++ b/TileCalorimeter/TileSimAlgs/src/TileMuonReceiverDecision.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //**************************************************************************** @@ -36,8 +36,6 @@ #include "StoreGate/ReadHandle.h" #include "StoreGate/WriteHandle.h" #include "AthenaKernel/errorcheck.h" -#include "AthenaKernel/IAtRndmGenSvc.h" - TileMuonReceiverDecision::TileMuonReceiverDecision(std::string name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), diff --git a/TileCalorimeter/TileSimAlgs/src/TilePulseForTileMuonReceiver.cxx b/TileCalorimeter/TileSimAlgs/src/TilePulseForTileMuonReceiver.cxx index c7c9dfec82dbb39f168c53839e7914fda11a1f27..d532b76cb6b57e8073221d0c8fd804da192509f3 100644 --- a/TileCalorimeter/TileSimAlgs/src/TilePulseForTileMuonReceiver.cxx +++ b/TileCalorimeter/TileSimAlgs/src/TilePulseForTileMuonReceiver.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ //*************************************************************************************** @@ -48,7 +48,9 @@ #include "StoreGate/ReadHandle.h" #include "StoreGate/WriteHandle.h" #include "AthenaKernel/errorcheck.h" -#include "AthenaKernel/IAtRndmGenSvc.h" +#include "AthenaKernel/IAthRNGSvc.h" +#include "AthenaKernel/RNGWrapper.h" + // external #include @@ -76,8 +78,6 @@ TilePulseForTileMuonReceiver::TilePulseForTileMuonReceiver(std::string name, ISv , m_nBinsPerX(0) , m_binTime0(0) , m_timeStep(0.0) - , m_pHRengine(0) - , m_rndmSvc("AtRndmGenSvc", name) , m_MuRcvBuildTool("TileRawChannelBuilderMF") , m_run2(true) { @@ -89,7 +89,6 @@ TilePulseForTileMuonReceiver::TilePulseForTileMuonReceiver(std::string name, ISv declareProperty("UseCoolPulseShapes" , m_useCoolPulseShapes = false, "Pulse shapes from database (default=false)"); declareProperty("UseCoolNoise" , m_tileNoise = false, "Noise from database (default=false)"); declareProperty("UseCoolPedestal" , m_tilePedestal = false, "Pedestal from database (default=false)"); - declareProperty("RndmSvc" , m_rndmSvc, "Random Number Service used in TilePulseForTileMuonReceiver"); declareProperty("TileRawChannelBuilderMF" , m_MuRcvBuildTool, "The tool by default is the Matched Filter"); } @@ -136,7 +135,7 @@ StatusCode TilePulseForTileMuonReceiver::initialize() { << " ADC saturation value: " << m_adcMax << " TileCal Threshold LOW GAIN: " << m_tileThresh); - m_pHRengine = m_rndmSvc->GetEngine("Tile_PulseForTileMuonReceiver"); + ATH_CHECK(m_rndmSvc.retrieve()); m_nShape = m_tileInfo->MuRcvNBins(); m_nBinsPerX = m_tileInfo->MuRcvBinsPerX(); @@ -263,6 +262,10 @@ StatusCode TilePulseForTileMuonReceiver::execute() { // std::vector digitsBuffer(m_nSamples); + // Prepare RNG service + ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this); + rngWrapper->setSeed( name(), Gaudi::Hive::currentContext() ); + ///////////////////////////////////////////////////////////////////////////////// // (a.0) iterate over collections in the HIT container: access 'ros' and 'drawer' // @@ -496,7 +499,7 @@ StatusCode TilePulseForTileMuonReceiver::execute() { // Generate an array to randomize the noise for each digit // - RandGaussQ::shootArray(m_pHRengine, m_nSamples, Rndm, 0.0, 1.0); + RandGaussQ::shootArray(*rngWrapper, m_nSamples, Rndm, 0.0, 1.0); ATH_MSG_VERBOSE( "(D.02) Pulse digits [MeV]:" << " " << pDigitSamples[0] @@ -531,7 +534,7 @@ StatusCode TilePulseForTileMuonReceiver::execute() { // Collecting noise from the database // if (m_tileNoise) { - RandFlat::shootArray(m_pHRengine, 1, Rndm_dG, 0.0, 1.0); + RandFlat::shootArray(*rngWrapper, 1, Rndm_dG, 0.0, 1.0); sigma_Hfn1 = m_tileToolNoiseSample->getHfn1(idhash, TMDBchan, TileID::LOWGAIN); sigma_Hfn2 = m_tileToolNoiseSample->getHfn2(idhash, TMDBchan, TileID::LOWGAIN); if (sigma_Hfn1 > 0 || sigma_Hfn2) { diff --git a/Tools/PROCTools/python/RunTier0TestsTools.py b/Tools/PROCTools/python/RunTier0TestsTools.py index d795f8d7d0114306fcd2f31170e551316c5da0bc..467e7d7e23b2e6f6c06d869fef2a42d6c609be6a 100644 --- a/Tools/PROCTools/python/RunTier0TestsTools.py +++ b/Tools/PROCTools/python/RunTier0TestsTools.py @@ -24,5 +24,5 @@ ciRefFileMap = { 's3126-22.0' : 'v3', # OverlayTier0Test_required-test 'overlay-d1498-21.0' : 'v1', - 'overlay-d1498-22.0' : 'v10', + 'overlay-d1498-22.0' : 'v11', }