diff --git a/Trigger/TrigT1/TrigT1CaloSim/CMakeLists.txt b/Trigger/TrigT1/TrigT1CaloSim/CMakeLists.txt index b2021e4367547882713e6571b4ac7ab12ba7cada..7fcdb1dbc5cefba13afc696591ee202587f3b26c 100644 --- a/Trigger/TrigT1/TrigT1CaloSim/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1CaloSim/CMakeLists.txt @@ -35,8 +35,6 @@ atlas_depends_on_subdirs( PRIVATE Control/AthenaKernel Control/CxxUtils - Event/EventInfo - Event/EventInfoUtils Event/xAOD/xAODEventInfo LumiBlock/LumiBlockComps Tools/PathResolver @@ -57,8 +55,8 @@ atlas_add_library( TrigT1CaloSimLib TrigT1CaloCalibToolInterfaces TrigT1CaloToolInterfaces TrigT1Interfaces CaloDetDescrLib PileUpToolsLib StoreGateLib SGtests LArCablingLib TileConditionsLib TrigT1CaloEventLib TrigT1CaloUtilsLib LumiBlockCompsLib - PRIVATE_LINK_LIBRARIES AthenaKernel CxxUtils EventInfo - xAODEventInfo EventInfoUtils + PRIVATE_LINK_LIBRARIES AthenaKernel CxxUtils + xAODEventInfo PathResolver TrigT1CaloCondSvcLib ) atlas_add_component( TrigT1CaloSim diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPMSim.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPMSim.h index 9dc6af85bd67c5294167f2081cdb23961652b0bf..1370f4ebd6403a7301f676a8d2f7efb2c2373c67 100644 --- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPMSim.h +++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/CPMSim.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 */ /*************************************************************************** @@ -13,21 +13,25 @@ * * * * ***************************************************************************/ - #ifndef CPMSim_H - #define CPMSim_H + #ifndef TRIGT1CALOSIM_CPMSIM_H + #define TRIGT1CALOSIM_CPMSIM_H // STL #include <string> #include <vector> // Athena/Gaudi - #include "AthenaBaseComps/AthAlgorithm.h" + #include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" + #include "xAODTrigL1Calo/CPMTowerContainer.h" #include "AthContainers/DataVector.h" #include "GaudiKernel/DataSvc.h" #include "StoreGate/StoreGateSvc.h" + #include "StoreGate/ReadHandleKey.h" + #include "StoreGate/WriteHandleKey.h" + #include "StoreGate/WriteHandleKeyArray.h" #include "TrigT1Interfaces/TrigT1CaloDefs.h" @@ -38,8 +42,12 @@ #include "TrigT1CaloToolInterfaces/IL1CPMTools.h" // For RoI output + #include "TrigT1Interfaces/TrigT1Interfaces_ClassDEF.h" #include "TrigT1Interfaces/SlinkWord.h" + #include "TrigT1CaloEvent/CPMCMXData.h" + #include "TrigT1CaloEvent/CPMTobRoI.h" + namespace LVL1 { @@ -53,7 +61,7 @@ /** The algorithm responsible for simulating the Em/tau calo trigger. */ - class CPMSim : public AthAlgorithm + class CPMSim : public AthReentrantAlgorithm { public: @@ -71,71 +79,57 @@ // Methods used by Athena to run the algorithm //------------------------------------------------------ - StatusCode initialize() ; - StatusCode execute() ; + virtual StatusCode initialize() override; + virtual StatusCode execute(const EventContext& ctx) const override; private: // Private methods - /** Store TOB RoI objects in the TES. */ - void storeModuleRoIs(); - /** Store module outputs in TES as inputs to CMX simulation */ - void storeBackplaneTOBs(); +#if 0 /** Simulate Slink data for RoIB input */ - void storeSlinkObjects(); + StatusCode storeSlinkObjects (const DataVector<CPMTobRoI>& allTOBs, + const EventContext& ctx) const; /** adds slink header */ - void addHeader( DataVector<LVL1CTP::SlinkWord>* slink, unsigned int subDetID, unsigned int moduleId); + void addHeader (DataVector<LVL1CTP::SlinkWord>& slink, + unsigned int subDetID, + unsigned int moduleId, + const EventContext& ctx) const; /** add Slink tail */ - void addTail( DataVector<LVL1CTP::SlinkWord>* slink, unsigned int numberOfDataWords); + void addTail (DataVector<LVL1CTP::SlinkWord>& slink, + unsigned int numberOfDataWords) const; /** creates a new SlinkWord object with the passed word, and returns a pointer.*/ - LVL1CTP::SlinkWord* getWord(unsigned int tword); + std::unique_ptr<LVL1CTP::SlinkWord> getWord(unsigned int tword) const; +#endif /** Debug routine: dump trigger menu at start of run */ - void printTriggerMenu(); + void printTriggerMenu() const; private: // Private attributes - /** CPM Towers (input to algorithm, output to BS simulation) */ - //DataVector<xAOD::CPMTower>* m_cpmTowers; - - /** TOB RoIs for RoIB input and DAQ output simulation */ - DataVector<CPMTobRoI>* m_allTOBs; - - /** Backplane data objects: CPM outputs to CMX */ - DataVector<CPMCMXData>* m_CMXData; - - /** there are 4 CP RoI RODs which have a Slink cable connected to the RoIB. - This array holds pointers to 4 DataVectors containing the Slink words */ - DataVector<LVL1CTP::SlinkWord>* m_CPRoIROD[TrigT1CaloDefs::numOfCPRoIRODs]; - /** Where to store the CPMTowers */ - std::string m_CPMTowerLocation; + SG::ReadHandleKey<xAOD::CPMTowerContainer> m_CPMTowerLocation + { this, "CPMTowerLocation", TrigT1CaloDefs::CPMTowerLocation, "" }; /** Locations of outputs in StoreGate */ - std::string m_CPMTobRoILocation; - std::string m_CPMCMXDataLocation; + SG::WriteHandleKey<DataVector<CPMTobRoI> > m_CPMTobRoILocation + { this, "CPMTobRoILocation", TrigT1CaloDefs::CPMTobRoILocation, "" }; + SG::WriteHandleKey<DataVector<CPMCMXData> > m_CPMCMXDataLocation + { this, "CPMCMXDataLocation", TrigT1CaloDefs::CPMCMXDataLocation, "" }; +#if 0 + // RoIROD is also writing an object of the same name! + // In the previous version, we were recording using overwrite(). + // RoIROD was scheduled second, so it's the one that wins. + // There doesn't appear to be anything in between that reads this. + // So just remove this output from this algorithm. + SG::WriteHandleKeyArray<DataVector<LVL1CTP::SlinkWord> > m_emTauSlinkKeys + { this, "EmTauSlinkKeys", {}, "" }; std::string m_emTauSlinkLocation ; +#endif /** The essentials - data access, configuration, tools */ ServiceHandle<TrigConf::ILVL1ConfigSvc> m_configSvc; ToolHandle<LVL1::IL1CPMTools> m_CPMTool; - - unsigned int m_eventNumber; - - }; } // end of namespace bracket #endif - - - - - - - - - - - - diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/RoIROD.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/RoIROD.h index 767b1d45405d97f90c0bc30ec70eaad530ad5242..98c38be39bd5113ccd03d390a636afcbfa6e7f27 100644 --- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/RoIROD.h +++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/RoIROD.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 */ /*************************************************************************** RoIROD.h - description @@ -9,18 +9,20 @@ ***************************************************************************/ -#ifndef _RoIROD_H_ -#define _RoIROD_H_ +#ifndef TRIGT1CALOSIM_ROIROD_H +#define TRIGT1CALOSIM_ROIROD_H // STL #include <string> #include <vector> //Athena -#include "AthenaBaseComps/AthAlgorithm.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ServiceHandle.h" #include "AthContainers/DataVector.h" #include "StoreGate/StoreGateSvc.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/WriteHandleKeyArray.h" // Specifics #include "TrigT1Interfaces/SlinkWord.h" @@ -44,72 +46,73 @@ i.e. -Cluster (Em & Tau) ROD to RoIB<br> -Jet/Energy ROD to RoIB<br> */ -class RoIROD : public AthAlgorithm +class RoIROD : public AthReentrantAlgorithm { typedef DataVector<LVL1::CPMTobRoI> t_cpmTobRoIContainer; typedef DataVector<LVL1::JEMTobRoI> t_jemTobRoIContainer; typedef CMXRoI t_EnergyRoIContainer; + typedef DataVector<LVL1CTP::SlinkWord> t_SlinkContainer; + typedef std::unique_ptr<t_SlinkContainer> t_SlinkPtr; public: //------------------------- RoIROD( const std::string& name, ISvcLocator* pSvcLocator ) ; - ~RoIROD(); + virtual ~RoIROD(); //------------------------------------------------------ // Methods used by Athena to run the algorithm //------------------------------------------------------ - StatusCode initialize() ; - StatusCode execute() ; - StatusCode finalize() ; + virtual StatusCode initialize() override; + virtual StatusCode execute(const EventContext& ctx) const override; + virtual StatusCode finalize() override; private: // Private methods /** adds slink header */ - void addHeader( DataVector<LVL1CTP::SlinkWord>* slink, unsigned int subDetID, unsigned int moduleId); + void addHeader (t_SlinkContainer& slink, + unsigned int subDetID, + unsigned int moduleId, + const EventContext& ctx) const; /** add Slink tail */ - void addTail( DataVector<LVL1CTP::SlinkWord>* slink, unsigned int numberOfDataWords); + void addTail (t_SlinkContainer& slink, + unsigned int numberOfDataWords) const; /** save Slink Objects to SG */ - void saveSlinkObjects(); + StatusCode saveSlinkObjects (t_SlinkPtr CPRoIROD[TrigT1CaloDefs::numOfCPRoIRODs], + t_SlinkPtr jepRoIROD[TrigT1CaloDefs::numOfJEPRoIRODs], + const EventContext& ctx) const; /** get ROIwords and form Slink words from them, adding header and tail. */ - void formSlinkObjects(); + void formSlinkObjects (t_SlinkPtr CPRoIROD[TrigT1CaloDefs::numOfCPRoIRODs], + t_SlinkPtr jepRoIROD[TrigT1CaloDefs::numOfJEPRoIRODs], + const EventContext& ctx) const; /** Create the object vectors to be stored in SG and clear mult vectors*/ - void assignVectors(); + void assignVectors (t_SlinkPtr CPRoIROD[TrigT1CaloDefs::numOfCPRoIRODs], + t_SlinkPtr jepRoIROD[TrigT1CaloDefs::numOfJEPRoIRODs]) const; /** creates a new SlinkWord object with the passed word, and returns a pointer.*/ - LVL1CTP::SlinkWord* getWord(unsigned int tword); + std::unique_ptr<LVL1CTP::SlinkWord> getWord(unsigned int tword) const; /** prints out the Slink info. */ - void dumpSlinks() const; + void dumpSlinks (t_SlinkPtr CPRoIROD[TrigT1CaloDefs::numOfCPRoIRODs]) const; private: // Private attributes - unsigned int m_eventNumber; - std::string m_emTauRoILocation ; + SG::ReadHandleKey<t_cpmTobRoIContainer> m_emTauRoILocation + { this, "EmTauRoILocation", TrigT1CaloDefs::CPMTobRoILocation, "" }; + SG::ReadHandleKey<t_jemTobRoIContainer> m_JetRoILocation + { this, "JetRoILocation", TrigT1CaloDefs::JEMTobRoILocation, "" }; + SG::ReadHandleKey<t_EnergyRoIContainer> m_energyRoILocation + { this, "EnergyRoILocation", TrigT1CaloDefs::CMXRoILocation, "" }; + std::string m_emTauSlinkLocation ; - std::string m_JetRoILocation ; - std::string m_energyRoILocation; + SG::WriteHandleKeyArray<t_SlinkContainer> m_emTauSlinkKeys + { this, "EmTauSlinkKeys", {}, "" }; + std::string m_jepSlinkLocation ; - /** there are 4 CP RoI RODs which have a Slink cable connected to the RoIB. This array holds pointers to 4 - DataVectors containing the Slink words*/ - DataVector<LVL1CTP::SlinkWord>* m_CPRoIROD[TrigT1CaloDefs::numOfCPRoIRODs]; - /** there are 2 Jet RoI RODs which have a Slink cable connected to the RoIB. This array holds pointers to 2 - DataVectors containing the Slink words*/ - DataVector<LVL1CTP::SlinkWord>* m_jepRoIROD[TrigT1CaloDefs::numOfJEPRoIRODs]; - + SG::WriteHandleKeyArray<t_SlinkContainer> m_jepSlinkKeys + { this, "JEPSlinkKeys", {}, "" }; }; } // end of namespace bracket #endif - - - - - - - - - - - diff --git a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2TriggerTowerMaker.h b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2TriggerTowerMaker.h index aed51bfb39f061eebfcfacc417a0d69ed99923f7..d94a92a38a21798b4d66c3c8bb3e7a2876f6f998 100755 --- a/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2TriggerTowerMaker.h +++ b/Trigger/TrigT1/TrigT1CaloSim/TrigT1CaloSim/Run2TriggerTowerMaker.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // ================================================ @@ -40,7 +40,6 @@ #include "GaudiKernel/ToolHandle.h" #include "AthContainers/DataVector.h" #include "StoreGate/ReadHandleKey.h" -#include "EventInfo/EventInfo.h" #include "xAODEventInfo/EventInfo.h" //Calorimeter tower includes @@ -267,7 +266,6 @@ private: // -------------------------------------------------------------------------- // Read and Write Handlers // -------------------------------------------------------------------------- - SG::ReadHandleKey<EventInfo> m_evtKey; SG::ReadHandleKey<xAOD::EventInfo> m_xaodevtKey; // location of input TriggerTowers (for reprocessing) SG::ReadHandleKey<xAOD::TriggerTowerContainer> m_inputTTLocation; diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/CPMSim.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/CPMSim.cxx index 755f0a3b91ee58d74d1e229d5c57a84aaef7b4b9..0842b14ced57224ccd3369806d6df3a0c6d8d1e3 100644 --- a/Trigger/TrigT1/TrigT1CaloSim/src/CPMSim.cxx +++ b/Trigger/TrigT1/TrigT1CaloSim/src/CPMSim.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 */ // /*************************************************************************** @@ -29,13 +29,13 @@ #include "TrigT1CaloEvent/CPMTobRoI_ClassDEF.h" #include "TrigT1CaloEvent/CPMCMXData_ClassDEF.h" -#include "xAODEventInfo/EventInfo.h" - #include "TrigConfL1Data/CTPConfig.h" #include "TrigConfL1Data/Menu.h" #include "TrigConfL1Data/TriggerThreshold.h" #include "TrigConfL1Data/TriggerThresholdValue.h" #include "TrigConfL1Data/ClusterThresholdValue.h" +#include "StoreGate/ReadHandle.h" +#include "StoreGate/WriteHandle.h" @@ -49,28 +49,13 @@ using namespace TrigConf; CPMSim::CPMSim ( const std::string& name, ISvcLocator* pSvcLocator ) - : AthAlgorithm( name, pSvcLocator ), - //m_cpmTowers(nullptr), - m_allTOBs(nullptr), - m_CMXData(nullptr), - m_CPMTowerLocation(TrigT1CaloDefs::CPMTowerLocation), - m_CPMTobRoILocation(TrigT1CaloDefs::CPMTobRoILocation), - m_CPMCMXDataLocation(TrigT1CaloDefs::CPMCMXDataLocation ), - m_emTauSlinkLocation(TrigT1CaloDefs::EmTauSlinkLocation), + : AthReentrantAlgorithm( name, pSvcLocator ), + //m_emTauSlinkLocation(TrigT1CaloDefs::EmTauSlinkLocation), m_configSvc("TrigConf::LVL1ConfigSvc/LVL1ConfigSvc", name), - m_CPMTool("LVL1::L1CPMTools/L1CPMTools"), - m_eventNumber(0) + m_CPMTool("LVL1::L1CPMTools/L1CPMTools") { - declareProperty( "CPMTOBRoILocation", m_CPMTobRoILocation ); - declareProperty( "CPMCMXDataLocation", m_CPMCMXDataLocation ); declareProperty( "LVL1ConfigSvc", m_configSvc, "LVL1 Config Service"); - declareProperty( "CPMTowerLocation", m_CPMTowerLocation ) ; - declareProperty( "EmTauSlinkLocation", m_emTauSlinkLocation ); - - /** Clear SLink output vectors (RoI output) */ - for (unsigned int i = 0; i < TrigT1CaloDefs::numOfCPRoIRODs; ++i) { - m_CPRoIROD[i] = nullptr; - } + //declareProperty( "EmTauSlinkLocation", m_emTauSlinkLocation ); } @@ -82,6 +67,18 @@ StatusCode CPMSim::initialize() { ATH_CHECK( m_configSvc.retrieve() ); ATH_CHECK( m_CPMTool.retrieve() ); + ATH_CHECK( m_CPMTowerLocation.initialize() ); + ATH_CHECK( m_CPMCMXDataLocation.initialize() ); + ATH_CHECK( m_CPMTobRoILocation.initialize() ); + +#if 0 + m_emTauSlinkKeys.clear(); + m_emTauSlinkKeys.push_back (m_emTauSlinkLocation + "0"); + m_emTauSlinkKeys.push_back (m_emTauSlinkLocation + "1"); + m_emTauSlinkKeys.push_back (m_emTauSlinkLocation + "2"); + m_emTauSlinkKeys.push_back (m_emTauSlinkLocation + "3"); + ATH_CHECK( m_emTauSlinkKeys.initialize() ); +#endif return StatusCode::SUCCESS ; } @@ -92,7 +89,7 @@ StatusCode CPMSim::initialize() // -StatusCode CPMSim::execute( ) +StatusCode CPMSim::execute(const EventContext& ctx) const { /* Retrieve collection of CPMTowers @@ -102,210 +99,143 @@ StatusCode CPMSim::execute( ) Form and store RoI SLink data for RoIB */ - //make a message logging stream - ATH_MSG_DEBUG ( "starting CPMSim" ); - // For RoI output SLink record - const xAOD::EventInfo* evt; - if (StatusCode::SUCCESS == evtStore()->retrieve(evt)){ - m_eventNumber =evt->eventNumber(); - }else{ - ATH_MSG_ERROR(" Unable to retrieve EventInfo from StoreGate "); - } - // Create containers for this event - m_CMXData = new DataVector<CPMCMXData>; //Container of backplane data objects - m_allTOBs = new DataVector<CPMTobRoI>; // Container to hold all TOB RoIs in event - - // Retrieve the CPMTowerContainer - if (evtStore()->contains<xAOD::CPMTowerContainer>(m_CPMTowerLocation)) { - const DataVector<xAOD::CPMTower>* storedCPMTs; - StatusCode sc = evtStore()->retrieve(storedCPMTs, m_CPMTowerLocation); - if ( sc==StatusCode::SUCCESS ) { - // Check size of TriggerTowerCollection - zero would indicate a problem - if (storedCPMTs->size() == 0) - ATH_MSG_WARNING("Empty CPMTowerContainer - looks like a problem" ); + auto CMXData = std::make_unique<DataVector<CPMCMXData> >(); //Container of backplane data objects + auto allTOBs = std::make_unique<DataVector<CPMTobRoI> >(); // Container to hold all TOB RoIs in event + + SG::ReadHandle<xAOD::CPMTowerContainer> storedCPMTs + (m_CPMTowerLocation, ctx); + + if (storedCPMTs->size() == 0) + ATH_MSG_WARNING("Empty CPMTowerContainer - looks like a problem" ); - // Map the CPMTs - xAOD::CPMTowerMap_t* towerMap = new xAOD::CPMTowerMap_t; - m_CPMTool->mapTowers(storedCPMTs, towerMap); + // Map the CPMTs + xAOD::CPMTowerMap_t towerMap; + m_CPMTool->mapTowers(storedCPMTs.cptr(), &towerMap); - // Loop over crates and modules - for (int iCrate = 0; iCrate < 4; ++iCrate) { - for (int iModule = 1; iModule <= 14; ++iModule) { + // Loop over crates and modules + for (int iCrate = 0; iCrate < 4; ++iCrate) { + for (int iModule = 1; iModule <= 14; ++iModule) { - // For each module, find TOBs and backplane data - std::vector<unsigned int> emCMXData; - std::vector<unsigned int> tauCMXData; - m_CPMTool->findCPMResults(towerMap,iCrate,iModule,m_allTOBs,emCMXData,tauCMXData); - // Push backplane data into output DataVectors - CPMCMXData* emBPData = new CPMCMXData(iCrate,iModule,0,emCMXData); - CPMCMXData* tauBPData = new CPMCMXData(iCrate,iModule,1,tauCMXData); - m_CMXData -> push_back(emBPData); - m_CMXData -> push_back(tauBPData); - - } // loop over modules - } // loop over crates - - /// Clean up map - delete towerMap; - - } // found TriggerTowers - - else ATH_MSG_WARNING("Error retrieving CPMTowers" ); - } - else ATH_MSG_WARNING("No CPMTowerContainer at " << m_CPMTowerLocation ); - + // For each module, find TOBs and backplane data + std::vector<unsigned int> emCMXData; + std::vector<unsigned int> tauCMXData; + m_CPMTool->findCPMResults(&towerMap,iCrate,iModule,allTOBs.get(),emCMXData,tauCMXData); + // Push backplane data into output DataVectors + CMXData -> push_back(std::make_unique<CPMCMXData>(iCrate,iModule,0,emCMXData)); + CMXData -> push_back(std::make_unique<CPMCMXData>(iCrate,iModule,1,tauCMXData)); + + } // loop over modules + } // loop over crates + // Store RoIB output, module readout and backplane results in the TES - storeBackplaneTOBs(); - storeSlinkObjects(); - storeModuleRoIs(); + ATH_CHECK( SG::makeHandle(m_CPMCMXDataLocation, ctx).record (std::move (CMXData)) ); + //ATH_CHECK( storeSlinkObjects (*allTOBs, ctx) ); + ATH_CHECK( SG::makeHandle(m_CPMTobRoILocation, ctx).record (std::move (allTOBs)) ); - // Clean up at end of event - m_CMXData = 0; - m_allTOBs = 0; - return StatusCode::SUCCESS ; } -/** place backplane data objects (CPM -> CMX) in StoreGate */ -void CPMSim::storeBackplaneTOBs() { - - // Store backplane data objects - StatusCode sc = evtStore()->overwrite(m_CMXData, m_CPMCMXDataLocation,true); - - if (sc.isSuccess()) { - ATH_MSG_VERBOSE ( "Stored " << m_CMXData->size() - << " CPMCMXData at " << m_CPMCMXDataLocation ); - } - else { - ATH_MSG_ERROR("failed to write CPMCMXData to " - << m_CPMCMXDataLocation ); - } - - return; - -} //end storeBackplaneTOBs - - -/** place final ROI objects in the TES. */ -void CPMSim::storeModuleRoIs() { - - StatusCode sc = evtStore()->overwrite(m_allTOBs, m_CPMTobRoILocation,true); - - if (sc.isSuccess()) { - ATH_MSG_VERBOSE ( "Stored " << m_allTOBs->size() - << " EM & Tau TOBs at " << m_CPMTobRoILocation ); - } - else { - ATH_MSG_ERROR("failed to write CPMTobRoIs to " - << m_CPMTobRoILocation ); - } - - return; - -} //end storeModuleRoIs +#if 0 /** Simulate SLink streams to RoIB */ -void CPMSim::storeSlinkObjects(){ - +StatusCode CPMSim::storeSlinkObjects (const DataVector<CPMTobRoI>& allTOBs, + const EventContext& ctx) const +{ ATH_MSG_DEBUG("storeSlinkObjects" ); + /** there are 4 CP RoI RODs which have a Slink cable connected to the RoIB. + This array holds pointers to 4 DataVectors containing the Slink words */ + std::unique_ptr<DataVector<LVL1CTP::SlinkWord> > CPRoIROD[TrigT1CaloDefs::numOfCPRoIRODs]; + /// Create words and add headers for (unsigned int i = 0; i<TrigT1CaloDefs::numOfCPRoIRODs;i++){ - m_CPRoIROD[i]=new DataVector<LVL1CTP::SlinkWord>; - addHeader(m_CPRoIROD[i],0x72,i);//set modID to crate # + CPRoIROD[i] = std::make_unique<DataVector<LVL1CTP::SlinkWord> >(); + addHeader(*CPRoIROD[i],0x72,i, ctx);//set modID to crate # } /// Push TOBs to ROD vectors /// This version makes no attempt to order them. - DataVector<CPMTobRoI>::const_iterator it = m_allTOBs->begin(); - - for ( ; it != m_allTOBs->end(); ++it) { - int crate = (*it)->crate(); - m_CPRoIROD[crate]->push_back( getWord((*it)->roiWord()) ); + for (const CPMTobRoI* tob : allTOBs) { + int crate = tob->crate(); + CPRoIROD[crate]->push_back( getWord(tob->roiWord()) ); } /// Add tails const unsigned int headerWords=8+1;//8 in Slink head + control word for (unsigned int i = 0; i<TrigT1CaloDefs::numOfCPRoIRODs;i++){ - addTail(m_CPRoIROD[i], (m_CPRoIROD[i]->size()-headerWords) ); + addTail(*CPRoIROD[i], (CPRoIROD[i]->size()-headerWords) ); } - /// Store SLink data in SG - std::string emTauSlinkLocation[4]; - emTauSlinkLocation[0]= m_emTauSlinkLocation+"0"; - emTauSlinkLocation[1]= m_emTauSlinkLocation+"1"; - emTauSlinkLocation[2]= m_emTauSlinkLocation+"2"; - emTauSlinkLocation[3]= m_emTauSlinkLocation+"3"; - /** TEMPORARY: dump contents to log */ /* for (unsigned int slink=0; slink<(TrigT1CaloDefs::numOfCPRoIRODs);slink++){ ATH_MSG_INFO("Slink cable "<<slink - <<" has "<<(m_CPRoIROD[slink]->size())<<" words"); - for (DataVector<LVL1CTP::SlinkWord>::iterator i=m_CPRoIROD[slink]->begin(); - i!=m_CPRoIROD[slink]->end();++i){ + <<" has "<<(CPRoIROD[slink]->size())<<" words"); + for (DataVector<LVL1CTP::SlinkWord>::iterator i=CPRoIROD[slink]->begin(); + i!=CPRoIROD[slink]->end();++i){ ATH_MSG_INFO<<"Word :"<<hex<<(*i)->word()<<dec); } } */ for (unsigned int i = 0; i<TrigT1CaloDefs::numOfCPRoIRODs;++i){ - StatusCode sc = evtStore()->overwrite(m_CPRoIROD[i],emTauSlinkLocation[i],true); - if (sc.isSuccess() ){ - ATH_MSG_DEBUG("Stored EM/Tau Slink object at "<< emTauSlinkLocation[i] <<" with " - <<(m_CPRoIROD[i]->size())<<" words"); - } else { - ATH_MSG_ERROR("Failed to write EM/Tau Slink object!"); - } // endif + ATH_CHECK( SG::makeHandle (m_emTauSlinkKeys[i], ctx).record (std::move (CPRoIROD[i])) ); } - - return; - + return StatusCode::SUCCESS; } /** adds slink header as defined in DAQ-98-129*/ -void CPMSim::addHeader( DataVector<LVL1CTP::SlinkWord>* slink, unsigned int subDetID, unsigned int moduleId){ - slink->push_back(getWord(0xb0f00000)); // beginning of fragment word (control word) - slink->push_back(getWord(0xee1234ee)); // start of header marker - slink->push_back(getWord(8)); // header length - slink->push_back(getWord(4)); // format version number +void CPMSim::addHeader (DataVector<LVL1CTP::SlinkWord>& slink, + unsigned int subDetID, + unsigned int moduleId, + const EventContext& ctx) const +{ + slink.push_back(getWord(0xb0f00000)); // beginning of fragment word (control word) + slink.push_back(getWord(0xee1234ee)); // start of header marker + slink.push_back(getWord(8)); // header length + slink.push_back(getWord(4)); // format version number unsigned int moduleType=0x00; // ROD - slink->push_back(getWord( (moduleType<<16)+(subDetID<<8)+moduleId )); // 1st 8b but source id: CP system - slink->push_back(getWord(m_eventNumber)); // 8b ECR_count (set to 0) | 24b L1 id = evt number - slink->push_back( getWord(1 )); // 8b BCID - slink->push_back( getWord(1 )); // 8b L1 trig type - slink->push_back( getWord(0 )); // detector evt type + slink.push_back(getWord( (moduleType<<16)+(subDetID<<8)+moduleId )); // 1st 8b but source id: CP system + slink.push_back(getWord(ctx.eventID().event_number())); // 8b ECR_count (set to 0) | 24b L1 id = evt number + slink.push_back( getWord(1 )); // 8b BCID + slink.push_back( getWord(1 )); // 8b L1 trig type + slink.push_back( getWord(0 )); // detector evt type } /** add Slink tail */ -void CPMSim::addTail(DataVector<LVL1CTP::SlinkWord>* slink, unsigned int numberOfDataWords){ - slink->push_back(getWord(0 )); // write status word 1 - slink->push_back(getWord(0 )); // write status word 2 +void CPMSim::addTail (DataVector<LVL1CTP::SlinkWord>& slink, + unsigned int numberOfDataWords) const +{ + slink.push_back(getWord(0 )); // write status word 1 + slink.push_back(getWord(0 )); // write status word 2 //^^^ not simulating any errors. - slink->push_back(getWord(2 )); // status block length - slink->push_back(getWord(numberOfDataWords)); // calculated data block length - slink->push_back(getWord(1 )); // status block position + slink.push_back(getWord(2 )); // status block length + slink.push_back(getWord(numberOfDataWords)); // calculated data block length + slink.push_back(getWord(1 )); // status block position // ^^^ indicates that data precedes status block - slink->push_back(getWord(0xe0f00000 )); // end of fragment word + slink.push_back(getWord(0xe0f00000 )); // end of fragment word } /** creates a new SlinkWord object with the passed word, and returns a pointer.*/ -LVL1CTP::SlinkWord* CPMSim::getWord(unsigned int tword){ - return new LVL1CTP::SlinkWord(tword); +std::unique_ptr<LVL1CTP::SlinkWord> +CPMSim::getWord(unsigned int tword) const +{ + return std::make_unique<LVL1CTP::SlinkWord>(tword); } +#endif } // end of LVL1 namespace bracket /** print trigger configuration, for debugging purposes */ -void LVL1::CPMSim::printTriggerMenu(){ +void LVL1::CPMSim::printTriggerMenu() const { /** This is all going to need updating for the new menu structure. Comment out in the meanwhile diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/RoIROD.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/RoIROD.cxx index cf157f22e149d3611ac1b2876b3be3eeafcefbd1..b0273d7b270f58e55f2d1bf55c1f553e93ed1967 100644 --- a/Trigger/TrigT1/TrigT1CaloSim/src/RoIROD.cxx +++ b/Trigger/TrigT1/TrigT1CaloSim/src/RoIROD.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 */ /*************************************************************************** RoIROD.cxx - description @@ -15,7 +15,7 @@ // running in Athena #include "TrigT1CaloSim/RoIROD.h" -#include "xAODEventInfo/EventInfo.h" + #include "TrigT1Interfaces/TrigT1Interfaces_ClassDEF.h" #include <algorithm> @@ -23,27 +23,13 @@ LVL1::RoIROD::RoIROD ( const std::string& name, ISvcLocator* pSvcLocator ) - : AthAlgorithm( name, pSvcLocator ), - m_eventNumber(0), - m_emTauRoILocation(TrigT1CaloDefs::CPMTobRoILocation), + : AthReentrantAlgorithm( name, pSvcLocator ), m_emTauSlinkLocation(TrigT1CaloDefs::EmTauSlinkLocation), - m_JetRoILocation(TrigT1CaloDefs::JEMTobRoILocation), - m_energyRoILocation(TrigT1CaloDefs::CMXRoILocation), m_jepSlinkLocation(TrigT1CaloDefs::jepSlinkLocation) { - declareProperty( "EmTauRoILocation", m_emTauRoILocation ); declareProperty( "EmTauSlinkLocation", m_emTauSlinkLocation ); declareProperty( "JEPSlinkLocation", m_jepSlinkLocation ); - declareProperty( "JetRoILocation", m_JetRoILocation ); - declareProperty( "EnergyRoILocation", m_energyRoILocation ); - - for (unsigned int i = 0; i<TrigT1CaloDefs::numOfCPRoIRODs;i++){ - m_CPRoIROD[i]=0; - } - for (unsigned int i = 0; i<TrigT1CaloDefs::numOfJEPRoIRODs;i++){ - m_jepRoIROD[i]=0; - } } // Destructor @@ -57,6 +43,22 @@ LVL1::RoIROD::~RoIROD() { StatusCode LVL1::RoIROD::initialize() { + ATH_CHECK( m_emTauRoILocation.initialize() ); + ATH_CHECK( m_JetRoILocation.initialize() ); + ATH_CHECK( m_energyRoILocation.initialize() ); + + m_jepSlinkKeys.clear(); + m_jepSlinkKeys.push_back (m_jepSlinkLocation + "0"); + m_jepSlinkKeys.push_back (m_jepSlinkLocation + "1"); + ATH_CHECK( m_jepSlinkKeys.initialize() ); + + m_emTauSlinkKeys.clear(); + m_emTauSlinkKeys.push_back (m_emTauSlinkLocation + "0"); + m_emTauSlinkKeys.push_back (m_emTauSlinkLocation + "1"); + m_emTauSlinkKeys.push_back (m_emTauSlinkLocation + "2"); + m_emTauSlinkKeys.push_back (m_emTauSlinkLocation + "3"); + ATH_CHECK( m_emTauSlinkKeys.initialize() ); + return StatusCode::SUCCESS ; } @@ -77,197 +79,167 @@ StatusCode LVL1::RoIROD::finalize() //---------------------------------------------- // -StatusCode LVL1::RoIROD::execute( ) +StatusCode LVL1::RoIROD::execute (const EventContext& ctx) const { ATH_MSG_DEBUG("Executing" ); - const xAOD::EventInfo* evt; - if (StatusCode::SUCCESS == evtStore()->retrieve(evt)){ - m_eventNumber = evt->eventNumber(); - }else{ - ATH_MSG_ERROR( " Unable to retrieve EventInfo from StoreGate "); - } + /** there are 4 CP RoI RODs which have a Slink cable connected to the RoIB. This array holds pointers to 4 + DataVectors containing the Slink words*/ + t_SlinkPtr CPRoIROD[TrigT1CaloDefs::numOfCPRoIRODs]; - assignVectors(); // create new storage vectors - formSlinkObjects(); // Fill storage vectors - saveSlinkObjects(); // save storage vectors + /** there are 2 Jet RoI RODs which have a Slink cable connected to the RoIB. This array holds pointers to 2 + DataVectors containing the Slink words*/ + t_SlinkPtr jepRoIROD[TrigT1CaloDefs::numOfJEPRoIRODs]; + assignVectors (CPRoIROD, jepRoIROD); // create new storage vectors + formSlinkObjects (CPRoIROD, jepRoIROD, ctx); // Fill storage vectors + ATH_CHECK( saveSlinkObjects (CPRoIROD, jepRoIROD, ctx) ); // save storage vectors return StatusCode::SUCCESS ; } /** get ROIwords and form Slink words from them, adding header and tail. */ -void LVL1::RoIROD::formSlinkObjects(){ +void LVL1::RoIROD::formSlinkObjects (t_SlinkPtr CPRoIROD[TrigT1CaloDefs::numOfCPRoIRODs], + t_SlinkPtr jepRoIROD[TrigT1CaloDefs::numOfJEPRoIRODs], + const EventContext& ctx) const +{ ATH_MSG_DEBUG("formSlinkObjects" ); /** Set SLink headers */ for (unsigned int i = 0; i<TrigT1CaloDefs::numOfCPRoIRODs;i++){ - addHeader(m_CPRoIROD[i],0x72,i);//set modID to crate # + addHeader(*CPRoIROD[i],0x72,i, ctx);//set modID to crate # } for (unsigned int i = 0; i<TrigT1CaloDefs::numOfJEPRoIRODs;i++){ - addHeader(m_jepRoIROD[i],0x73,i);//set modID to crate # + addHeader(*jepRoIROD[i],0x73,i, ctx);//set modID to crate # } /** Retrieve CPMTobRoIs and copy data to SLink vectors */ ATH_MSG_DEBUG("Load and process CPM TOBs"); - const t_cpmTobRoIContainer* EMTaus ; - StatusCode sc1 = evtStore()->retrieve(EMTaus, m_emTauRoILocation); - - if ( sc1==StatusCode::FAILURE ) { - ATH_MSG_DEBUG("No CPMTobRoIs found. "); - } - else{ - /// Push TOBs to ROD vectors - /// This version makes no attempt to order them. - DataVector<CPMTobRoI>::const_iterator it = EMTaus->begin(); - for ( ; it != EMTaus->end(); ++it) { - int crate = (*it)->crate(); - m_CPRoIROD[crate]->push_back( getWord((*it)->roiWord()) ); - } + SG::ReadHandle<t_cpmTobRoIContainer> EMTaus (m_emTauRoILocation, ctx); + /// Push TOBs to ROD vectors + /// This version makes no attempt to order them. + for (const CPMTobRoI* tau : *EMTaus) { + int crate = tau->crate(); + CPRoIROD[crate]->push_back( getWord(tau->roiWord()) ); } /** Retrieve JEMTobRoIs and copy data to SLink vectors */ ATH_MSG_DEBUG("Load and process Jet TOBs"); - const t_jemTobRoIContainer* Jets ; - StatusCode sc2 = evtStore()->retrieve(Jets, m_JetRoILocation); - - if ( sc2==StatusCode::FAILURE ) { - ATH_MSG_DEBUG("No JEMTobRoIs found. "); - } - else{ - /// Push TOBs to ROD vectors - /// This version makes no attempt to order them. - DataVector<JEMTobRoI>::const_iterator it = Jets->begin(); - for ( ; it != Jets->end(); ++it) { - int crate = (*it)->crate(); - m_jepRoIROD[crate]->push_back( getWord((*it)->roiWord()) ); - } + SG::ReadHandle<t_jemTobRoIContainer> Jets (m_JetRoILocation, ctx); + /// Push TOBs to ROD vectors + /// This version makes no attempt to order them. + for (const JEMTobRoI* jet : *Jets) { + int crate = jet->crate(); + jepRoIROD[crate]->push_back( getWord(jet->roiWord()) ); } /** Retrieve EnergySum RoI(s) and add to SLink record */ - const t_EnergyRoIContainer* energy ; - StatusCode sc3 = evtStore()->retrieve(energy, m_energyRoILocation); - - if ( sc3==StatusCode::FAILURE ) { - ATH_MSG_DEBUG("No EnergySum RoIs found."); - } - else{ - /** Add 6 ET RoIWords to crate 1 ROD data. */ - m_jepRoIROD[1]->push_back(getWord(energy->exWord(LVL1::CMXRoI::NORMAL))); - m_jepRoIROD[1]->push_back(getWord(energy->eyWord(LVL1::CMXRoI::NORMAL))); - m_jepRoIROD[1]->push_back(getWord(energy->etWord(LVL1::CMXRoI::NORMAL))); - m_jepRoIROD[1]->push_back(getWord(energy->exWord(LVL1::CMXRoI::MASKED))); - m_jepRoIROD[1]->push_back(getWord(energy->eyWord(LVL1::CMXRoI::MASKED))); - m_jepRoIROD[1]->push_back(getWord(energy->etWord(LVL1::CMXRoI::MASKED))); - } + SG::ReadHandle<t_EnergyRoIContainer> energy (m_energyRoILocation, ctx); + /** Add 6 ET RoIWords to crate 1 ROD data. */ + jepRoIROD[1]->push_back(getWord(energy->exWord(LVL1::CMXRoI::NORMAL))); + jepRoIROD[1]->push_back(getWord(energy->eyWord(LVL1::CMXRoI::NORMAL))); + jepRoIROD[1]->push_back(getWord(energy->etWord(LVL1::CMXRoI::NORMAL))); + jepRoIROD[1]->push_back(getWord(energy->exWord(LVL1::CMXRoI::MASKED))); + jepRoIROD[1]->push_back(getWord(energy->eyWord(LVL1::CMXRoI::MASKED))); + jepRoIROD[1]->push_back(getWord(energy->etWord(LVL1::CMXRoI::MASKED))); /** Set SLink tails */ const unsigned int headerWords=8+1;//8 in Slink head + control word for (unsigned int i = 0; i<TrigT1CaloDefs::numOfCPRoIRODs;i++){ - addTail(m_CPRoIROD[i], (m_CPRoIROD[i]->size()-headerWords) ); + addTail(*CPRoIROD[i], (CPRoIROD[i]->size()-headerWords) ); } for (unsigned int i = 0; i<TrigT1CaloDefs::numOfJEPRoIRODs;i++){ - addTail(m_jepRoIROD[i],(m_jepRoIROD[i]->size()-headerWords) ); + addTail(*jepRoIROD[i], (jepRoIROD[i]->size()-headerWords) ); } return; } /** adds slink header as defined in DAQ-98-129*/ -void LVL1::RoIROD::addHeader( DataVector<LVL1CTP::SlinkWord>* slink, unsigned int subDetID, unsigned int moduleId){ - slink->push_back(getWord(0xb0f00000)); // beginning of fragment word (control word) - slink->push_back(getWord(0xee1234ee)); // start of header marker - slink->push_back(getWord(8)); // header length - slink->push_back(getWord(1)); // format version number +void LVL1::RoIROD::addHeader (t_SlinkContainer& slink, + unsigned int subDetID, + unsigned int moduleId, + const EventContext& ctx) const +{ + slink.push_back(getWord(0xb0f00000)); // beginning of fragment word (control word) + slink.push_back(getWord(0xee1234ee)); // start of header marker + slink.push_back(getWord(8)); // header length + slink.push_back(getWord(1)); // format version number unsigned int moduleType=0x00; // ROD - slink->push_back(getWord( (moduleType<<16)+(subDetID<<8)+moduleId )); // 1st 8b but source id: CP system - slink->push_back(getWord(m_eventNumber)); // 8b ECR_count (set to 0) | 24b L1 id = evt number - slink->push_back( getWord(1 )); // 8b BCID - slink->push_back( getWord(1 )); // 8b L1 trig type - slink->push_back( getWord(0 )); // detector evt type} + slink.push_back(getWord( (moduleType<<16)+(subDetID<<8)+moduleId )); // 1st 8b but source id: CP system + slink.push_back(getWord(ctx.eventID().event_number())); // 8b ECR_count (set to 0) | 24b L1 id = evt number + slink.push_back( getWord(1 )); // 8b BCID + slink.push_back( getWord(1 )); // 8b L1 trig type + slink.push_back( getWord(0 )); // detector evt type} } /** add Slink tail */ -void LVL1::RoIROD::addTail(DataVector<LVL1CTP::SlinkWord>* slink, unsigned int numberOfDataWords){ - slink->push_back(getWord(0 )); // write status word 1 - slink->push_back(getWord(0 )); // write status word 2 +void LVL1::RoIROD::addTail (t_SlinkContainer& slink, + unsigned int numberOfDataWords) const +{ + slink.push_back(getWord(0 )); // write status word 1 + slink.push_back(getWord(0 )); // write status word 2 //^^^ not simulating any errors. - slink->push_back(getWord(2 )); // status block length - slink->push_back(getWord(numberOfDataWords)); // calculated data block length - slink->push_back(getWord(1 )); // status block position + slink.push_back(getWord(2 )); // status block length + slink.push_back(getWord(numberOfDataWords)); // calculated data block length + slink.push_back(getWord(1 )); // status block position // ^^^ indicates that data precedes status block - slink->push_back(getWord(0xe0f00000 )); // end of fragment word + slink.push_back(getWord(0xe0f00000 )); // end of fragment word } /** save Slink Objects to SG */ -void LVL1::RoIROD::saveSlinkObjects(){ +StatusCode LVL1::RoIROD::saveSlinkObjects (t_SlinkPtr CPRoIROD[TrigT1CaloDefs::numOfCPRoIRODs], + t_SlinkPtr jepRoIROD[TrigT1CaloDefs::numOfJEPRoIRODs], + const EventContext& ctx) const +{ ATH_MSG_DEBUG("saveSlinkObjects"); - /**\todo There must be a better way of doing this, but CERN doesn't seem to have sstream.h*/ - std::string emTauSlinkLocation[4]; - emTauSlinkLocation[0]= m_emTauSlinkLocation+"0"; - emTauSlinkLocation[1]= m_emTauSlinkLocation+"1"; - emTauSlinkLocation[2]= m_emTauSlinkLocation+"2"; - emTauSlinkLocation[3]= m_emTauSlinkLocation+"3"; - for (unsigned int i = 0; i<TrigT1CaloDefs::numOfCPRoIRODs;++i){ - - StatusCode sc = evtStore()->overwrite(m_CPRoIROD[i],emTauSlinkLocation[i], true); - - if (sc.isSuccess() ){ - ATH_MSG_DEBUG("Stored EmTau Slink object at "<< emTauSlinkLocation[i] <<" with " - <<(m_CPRoIROD[i]->size())<<" words"); - } else { - ATH_MSG_ERROR("Failed to write EmTau Slink object!"); - } // endif + ATH_CHECK( SG::makeHandle (m_emTauSlinkKeys[i], ctx).record (std::move(CPRoIROD[i])) ); } - std::string jepSlinkLocation[2]; - jepSlinkLocation[0]= m_jepSlinkLocation+"0"; - jepSlinkLocation[1]= m_jepSlinkLocation+"1"; for (unsigned int i = 0; i<TrigT1CaloDefs::numOfJEPRoIRODs;++i){ - StatusCode sc = evtStore()->overwrite(m_jepRoIROD[i],jepSlinkLocation[i], true); - if (sc.isSuccess() ){ - ATH_MSG_DEBUG("Stored JetEnergy Slink object at "<< jepSlinkLocation[i] <<" with " - <<(m_jepRoIROD[i]->size())<<" words"); - } else { - ATH_MSG_ERROR("Failed to write JetEnergy Slink object!"); - } // endif + ATH_CHECK( SG::makeHandle (m_jepSlinkKeys[i], ctx).record (std::move(jepRoIROD[i])) ); } - return; + return StatusCode::SUCCESS; } /** Create the object vectors to be stored in SG and clear mult vectors*/ -void LVL1::RoIROD::assignVectors(){ +void LVL1::RoIROD::assignVectors (t_SlinkPtr CPRoIROD[TrigT1CaloDefs::numOfCPRoIRODs], + t_SlinkPtr jepRoIROD[TrigT1CaloDefs::numOfJEPRoIRODs]) const +{ ATH_MSG_DEBUG("assignVectors" ); for (unsigned int i = 0; i<TrigT1CaloDefs::numOfCPRoIRODs;i++){ - m_CPRoIROD[i]=new DataVector<LVL1CTP::SlinkWord>; + CPRoIROD[i] = std::make_unique<t_SlinkContainer>(); } for (unsigned int i = 0; i<TrigT1CaloDefs::numOfJEPRoIRODs;i++){ - m_jepRoIROD[i]=new DataVector<LVL1CTP::SlinkWord>; + jepRoIROD[i] = std::make_unique<t_SlinkContainer>(); } } -LVL1CTP::SlinkWord* LVL1::RoIROD::getWord(unsigned int tword){ - return new LVL1CTP::SlinkWord(tword); +std::unique_ptr<LVL1CTP::SlinkWord> +LVL1::RoIROD::getWord(unsigned int tword) const +{ + return std::make_unique<LVL1CTP::SlinkWord>(tword); } /** prints out the Slink info. */ -void LVL1::RoIROD::dumpSlinks() const{ +void LVL1::RoIROD::dumpSlinks (t_SlinkPtr CPRoIROD[TrigT1CaloDefs::numOfCPRoIRODs]) const +{ for (unsigned int slink=0; slink<(TrigT1CaloDefs::numOfCPRoIRODs);slink++){ ATH_MSG_INFO("Slink cable "<<slink - <<" has "<<(m_CPRoIROD[slink]->size())<<" words"); - for (DataVector<LVL1CTP::SlinkWord>::iterator i=m_CPRoIROD[slink]->begin(); - i!=m_CPRoIROD[slink]->end();++i){ + <<" has "<<(CPRoIROD[slink]->size())<<" words"); + for (DataVector<LVL1CTP::SlinkWord>::iterator i=CPRoIROD[slink]->begin(); + i!=CPRoIROD[slink]->end();++i){ ATH_MSG_INFO("Word :"<<MSG::hex<<(*i)->word()<<MSG::dec); } } diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/Run2TriggerTowerMaker.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/Run2TriggerTowerMaker.cxx index 8d85eec81fbc66b87d1d5580b78e4f7157a1f8c6..d8ee708a12e336bc46487d3930e5579c12ef4896 100755 --- a/Trigger/TrigT1/TrigT1CaloSim/src/Run2TriggerTowerMaker.cxx +++ b/Trigger/TrigT1/TrigT1CaloSim/src/Run2TriggerTowerMaker.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 */ // ================================================ @@ -95,7 +95,6 @@ namespace LVL1 { m_isDataReprocessing(false), m_doOverlay(false), m_isReco(false) { - declareProperty("EventInfoKey", m_evtKey=std::string{"EventInfo"}); declareProperty("xAODEventInfoKey", m_xaodevtKey=std::string{"EventInfo"}); declareProperty("RndmSvc", m_rndGenSvc, "Random number service"); declareProperty("DigiEngine", m_digiEngine = "TrigT1CaloSim_Digitization"); @@ -188,7 +187,6 @@ namespace LVL1 { // reserve enough storage for the amps m_xaodTowersAmps.assign(7168, std::vector<double>()); - ATH_CHECK(m_evtKey.initialize()); ATH_CHECK(m_xaodevtKey.initialize()); ATH_CHECK(m_inputTTLocation.initialize()); diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/TriggerTowerMaker.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/TriggerTowerMaker.cxx index dc927292050c2d5d7cce99873977ad0633391f70..0020eaa33587fd2e4267d30bce7a2bf4bc9ad58c 100644 --- a/Trigger/TrigT1/TrigT1CaloSim/src/TriggerTowerMaker.cxx +++ b/Trigger/TrigT1/TrigT1CaloSim/src/TriggerTowerMaker.cxx @@ -32,7 +32,6 @@ #include "LumiBlockComps/ILumiBlockMuTool.h" // Utilities -#include "EventInfoUtils/EventIDFromStore.h" #include "PathResolver/PathResolver.h" #include <sys/types.h> @@ -2822,13 +2821,8 @@ void LVL1::TriggerTowerMaker::digitize() void LVL1::TriggerTowerMaker::preProcess() { // Pedestal Correction: Get the BCID number - unsigned int eventBCID=0; - const EventIDBase* evid = EventIDFromStore( evtStore() ); - if( evid ) { - eventBCID = evid->bunch_crossing_id(); - }else{ - ATH_MSG_ERROR(" Unable to retrieve EventInfo from StoreGate "); - } + const EventContext& ctx = Gaudi::Hive::currentContext(); + unsigned int eventBCID = ctx.eventID().bunch_crossing_id(); // Iterator for the InternalTriggerTower map std::map<int, InternalTriggerTower*>::iterator it;