diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/EventTagAlgs/EventSplitter.h b/PhysicsAnalysis/EventTag/EventTagAlgs/EventTagAlgs/EventSplitter.h index 15daae5957b56b0f70bf35047fa58d090c2fdca9..c1d29a1da0134631b1092bfe12bafab782920c71 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/EventTagAlgs/EventSplitter.h +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/EventTagAlgs/EventSplitter.h @@ -8,13 +8,13 @@ #include <inttypes.h> #include <string> #include <vector> -#include "GaudiKernel/Algorithm.h" +#include "AthenaBaseComps/AthAlgorithm.h" #include "EventTagAlgs/TagBuilderBase.h" class StoreGateSvc; class TagAthenaAttributeList; -class EventSplitter : public Algorithm, public TagBuilderBase +class EventSplitter : public AthAlgorithm, public TagBuilderBase { public: EventSplitter (const std::string& name, ISvcLocator* pSvcLocator); @@ -26,8 +26,6 @@ public: private: void setSuccess(bool f); - StoreGateSvc* m_StoreGate; - // Name for attribute in tag (absent if not specified) TagAthenaAttributeList* m_attribList; std::string m_attrName; diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/cmt/requirements b/PhysicsAnalysis/EventTag/EventTagAlgs/cmt/requirements index 52ebc67e0d826bb85219809f3d4cfc689d45b09e..a82563c415aae02d328514c2cf2be5ad04115672 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/cmt/requirements +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/cmt/requirements @@ -9,13 +9,13 @@ use AtlasPolicy AtlasPolicy-* use TagEvent TagEvent-* PhysicsAnalysis/EventTag use AthenaPoolUtilities AthenaPoolUtilities-* Database/AthenaPOOL use GaudiInterface GaudiInterface-* External +use AthenaBaseComps AthenaBaseComps-* Control private use AtlasCLHEP AtlasCLHEP-* External use AtlasPOOL AtlasPOOL-* External use StoreGate StoreGate-* Control -use AthenaBaseComps AthenaBaseComps-* Control use xAODEventInfo xAODEventInfo-* Event/xAOD use EventTagUtils EventTagUtils-* PhysicsAnalysis/EventTag diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/ElectronTagBuilder.cxx b/PhysicsAnalysis/EventTag/EventTagAlgs/src/ElectronTagBuilder.cxx index 85ccb8a08bf9ac8a12ab5a33b9206bac4a79f92a..8fbec75df38adec0095512ac920aaac04f466f71 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/ElectronTagBuilder.cxx +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/ElectronTagBuilder.cxx @@ -11,12 +11,10 @@ #include "AthenaPoolUtilities/TagAthenaAttributeList.h" #include "StoreGate/StoreGateSvc.h" -#include "GaudiKernel/MsgStream.h" - #include <sstream> ElectronTagBuilder::ElectronTagBuilder( const std::string& name, ISvcLocator* pSvcLocator ) - : Algorithm(name, pSvcLocator), + : AthAlgorithm(name, pSvcLocator), TagBuilderBase(), m_electronTagTool("ElectronTagTool", this) { declareProperty("ElectronTagTool", m_electronTagTool); @@ -30,34 +28,15 @@ ElectronTagBuilder::~ElectronTagBuilder() StatusCode ElectronTagBuilder::initialize() { - StatusCode sc; - - MsgStream mLog( messageService(), name() ); - mLog << MSG::DEBUG << "Initializing " << name() << endreq; - - /** get StoreGate service */ - sc = service( "StoreGateSvc", m_storeGateSvc ); - if (sc.isFailure()) { - mLog << MSG::ERROR << "Unable to get StoreGate service" << endreq; - return sc; - } + ATH_MSG_DEBUG( "Initializing " << name() ); - /** get the Electron Tag Tools */ - sc = m_electronTagTool.retrieve(); - if ( sc.isFailure() ) { - mLog << MSG::ERROR<< "Error retrieving the ElectronTagTool" << endreq; - return sc; - } + ATH_CHECK( m_electronTagTool.retrieve() ); /** define attributes */ - mLog << MSG::DEBUG << "Defining the attribute list specification." << endreq; + ATH_MSG_DEBUG( "Defining the attribute list specification." ); std::map<std::string,AthenaAttributeType> attrMap; - sc = m_electronTagTool->attributeSpecification(attrMap, m_MAX_NUMBER); - if ( sc.isFailure() ) { - mLog << MSG::ERROR << "Fail to build Attribute List Specification " << endreq; - return sc; - } + ATH_CHECK( m_electronTagTool->attributeSpecification(attrMap, m_MAX_NUMBER) ); std::map<std::string,AthenaAttributeType>::iterator bMap = attrMap.begin(); std::map<std::string,AthenaAttributeType>::iterator eMap = attrMap.end(); @@ -69,8 +48,7 @@ StatusCode ElectronTagBuilder::initialize() { //m_attrMap[(*bMap).first] = ((*bMap).second).typeName(); addAttribute( (*bMap).first, (*bMap).second ); } else { - mLog << MSG::WARNING << "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" - << endreq; + ATH_MSG_WARNING( "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" ); } } @@ -80,25 +58,17 @@ StatusCode ElectronTagBuilder::initialize() { StatusCode ElectronTagBuilder::execute() { - StatusCode sc; - - MsgStream mLog( messageService(), name() ); - - mLog << MSG::DEBUG << "Executing " << name() << endreq; + ATH_MSG_DEBUG( "Executing " << name() ); /** retrieve TagAthenaAttributeList */ TagAthenaAttributeList* attribList; - sc = m_storeGateSvc->retrieve( attribList, m_attributeListName); - if (sc.isFailure()) { - mLog << MSG::ERROR << "No attribute list in SG" << endreq; - return sc; - } + ATH_CHECK( evtStore()->retrieve( attribList, m_attributeListName) ); /** aggregate the electorn tag fragment */ TagFragmentCollection electronTagColl; - sc = m_electronTagTool->execute( electronTagColl, m_MAX_NUMBER ); + StatusCode sc = m_electronTagTool->execute( electronTagColl, m_MAX_NUMBER ); if (sc.isFailure()) { - mLog << MSG::WARNING << "Cannot Execute ElectronTagToool" << endreq; + ATH_MSG_WARNING( "Cannot Execute ElectronTagToool" ); } else fillAttribute(attribList, electronTagColl); /** decrease number of builders */ @@ -106,15 +76,14 @@ StatusCode ElectronTagBuilder::execute() /** if this is the last builder, lock the Attribute List */ if (TagBuilderBase::lastBuilder()) - sc = m_storeGateSvc->setConst(attribList); + sc = evtStore()->setConst(attribList); if (sc.isFailure()) { - mLog << MSG::WARNING << "Could not set const to attribList" << endreq; + ATH_MSG_WARNING( "Could not set const to attribList" ); } - mLog << MSG::DEBUG << "Finished " << name() << endreq; - + ATH_MSG_DEBUG( "Finished " << name() ); return StatusCode::SUCCESS; } diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/ElectronTagBuilder.h b/PhysicsAnalysis/EventTag/EventTagAlgs/src/ElectronTagBuilder.h index 8646f64bc02f77311f96793afec630a88c016ca8..d9ee806dca79b29787b89696c652c7dd613d00d9 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/ElectronTagBuilder.h +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/ElectronTagBuilder.h @@ -11,13 +11,11 @@ #include "ElectronPhotonTagTools/ElectronTagTool.h" -class StoreGateSvc; - #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Algorithm.h" +#include "AthenaBaseComps/AthAlgorithm.h" #include "EventTagAlgs/TagBuilderBase.h" -class ElectronTagBuilder : public Algorithm, public TagBuilderBase +class ElectronTagBuilder : public AthAlgorithm, public TagBuilderBase { public: @@ -39,12 +37,8 @@ private: //! number of particles int m_MAX_NUMBER; - //! StoreGate service. - StoreGateSvc* m_storeGateSvc; - //! Electron Tag Builder Tool ToolHandle<ElectronTagTool> m_electronTagTool; - }; #endif diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/EventSplitter.cxx b/PhysicsAnalysis/EventTag/EventTagAlgs/src/EventSplitter.cxx index 447a1793b993e8233991e3b0de0fdc295c6aecde..d737436d1847816ce6105a229f9a323ae2c272d8 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/EventSplitter.cxx +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/EventSplitter.cxx @@ -14,7 +14,7 @@ #include "StoreGate/StoreGateSvc.h" EventSplitter::EventSplitter(const std::string& name, ISvcLocator* pSvcLocator) - : Algorithm(name, pSvcLocator), + : AthAlgorithm(name, pSvcLocator), TagBuilderBase(), m_attribList(0), m_attrName ("NONE"), @@ -55,38 +55,29 @@ EventSplitter::EventSplitter(const std::string& name, ISvcLocator* pSvcLocator) StatusCode EventSplitter::initialize() { - MsgStream log(msgSvc(), name()); - log << MSG::INFO << "in initialize()" << endreq; + ATH_MSG_INFO( "in initialize()" ); // Check to see if it should be added to the tags if (m_attrName != "NONE") { // define attribute //std::string name("Filter"+name()); - log << MSG::DEBUG << "Defining the attribute list specification." << endreq; - log << MSG::DEBUG << "Adding attribute " << name() << " to tags" << endreq; + ATH_MSG_DEBUG( "Defining the attribute list specification." ); + ATH_MSG_DEBUG( "Adding attribute " << name() << " to tags" ); if (m_attribListSpec!=0) addAttribute( name(), "bool" ); else { - log << MSG::DEBUG << "AttribListSpec not initialized" << endreq; + ATH_MSG_DEBUG( "AttribListSpec not initialized" ); m_attribListSpec = new AthenaAttributeListSpecification; - } + } } - // Locate the StoreGateSvc - StatusCode sc = service("StoreGateSvc", m_StoreGate); - if (sc.isFailure()) - { - log << MSG::ERROR << "Could not find StoreGateSvc" << endreq; - return sc; - } return StatusCode::SUCCESS; } StatusCode EventSplitter::execute() { - MsgStream log(msgSvc(), name()); - log << MSG::DEBUG << "in execute()" << endreq; + ATH_MSG_DEBUG( "in execute()" ); // set attribute list to not filled, yet m_attribList=0; @@ -102,43 +93,33 @@ StatusCode EventSplitter::execute() const DataHandle<xAOD::EventInfo> eventInfo; const DataHandle<xAOD::EventInfo> eventInfoEnd; - StatusCode sc = m_StoreGate->retrieve(eventInfo, eventInfoEnd); - if (sc.isFailure()) - { - log << MSG::ERROR << "Cannot get event info" << endreq; - return sc; - } + ATH_CHECK( evtStore()->retrieve(eventInfo, eventInfoEnd) ); if (eventInfo == eventInfoEnd) { - log << MSG::ERROR << "No event info objects" << endreq; - return sc; + ATH_MSG_ERROR( "No event info objects" ); + return StatusCode::FAILURE; } uint32_t triggerTypeWord = eventInfo->level1TriggerType(); // get CTP_Decision const CTP_Decision * ctpDecision = 0; - sc =m_StoreGate->retrieve(ctpDecision, m_KeyCTP_Decision); + StatusCode sc =evtStore()->retrieve(ctpDecision, m_KeyCTP_Decision); if (sc.isFailure()) { - log << MSG::ERROR << "could not find CTP_Decision" << endreq; + ATH_MSG_ERROR( "could not find CTP_Decision" ); //return sc; } // HLT word - const FakeHLTWord * hltWord; - sc =m_StoreGate->retrieve(hltWord, m_KeyHLTWord); - if (sc.isFailure()) - { - log << MSG::ERROR << "could not find CTP_Decision" << endreq; - return sc; - } + const FakeHLTWord * hltWord = nullptr; + ATH_CHECK( evtStore()->retrieve(hltWord, m_KeyHLTWord) ); // check Trigger Type Word for (int iN=0; iN<MaxN; ++iN) { - log << MSG::DEBUG << "TTW: " << MSG::hex << triggerTypeWord << " Mask: " << m_MaskTTW[iN] << " reqN: " << -iN << endreq; + ATH_MSG_DEBUG( "TTW: " << MSG::hex << triggerTypeWord << " Mask: " << m_MaskTTW[iN] << " reqN: " << + iN ); uint32_t maskedWord = triggerTypeWord & m_MaskTTW[iN]; int nItem = 0; for (int iBit=0; iBit<32; ++iBit) @@ -169,7 +150,7 @@ iN << endreq; ctpWord = ctpWords[iCTP]; mask = m_MaskCTP[iN][iCTP]; maskedWord = ctpWord & mask; - log << MSG::DEBUG << "CTP" << iCTP << ": " << MSG::hex << ctpWord << " Mask: " << mask << " reqN: " << iN << endreq; + ATH_MSG_DEBUG( "CTP" << iCTP << ": " << MSG::hex << ctpWord << " Mask: " << mask << " reqN: " << iN ); for (int iBit=0; iBit<32; ++iBit) if ((0x1 << iBit) & maskedWord) ++nItem; @@ -187,8 +168,8 @@ iN << endreq; // check HLT word for (int iN=0; iN<MaxN; ++iN) { - log << MSG::DEBUG << "HLT: " << MSG::hex << hltWord->word() << " Mask: " << m_MaskHLT[iN] << " reqN: " << -iN << endreq; + ATH_MSG_DEBUG( "HLT: " << MSG::hex << hltWord->word() << " Mask: " << m_MaskHLT[iN] << " reqN: " << + iN ); uint32_t maskedWord = (hltWord->word()) & m_MaskHLT[iN]; int nItem = 0; for (int iBit=0; iBit<32; ++iBit) @@ -209,22 +190,20 @@ iN << endreq; StatusCode EventSplitter::finalize() { - MsgStream log(msgSvc(), name()); - log << MSG::INFO << "in finalize()" << endreq; + ATH_MSG_INFO( "in finalize()" ); return StatusCode::SUCCESS; } void EventSplitter::setSuccess(bool flag) { - MsgStream log(msgSvc(), name()); // Fetch attrib list if not done already - log << MSG::DEBUG << "in setSuccess" << endreq; + ATH_MSG_DEBUG( "in setSuccess" ); if (m_attrName != "NONE" && m_attribList==0) { // retrieve TagAthenaAttributeList - StatusCode sc = m_StoreGate->retrieve( m_attribList, m_attrName); + StatusCode sc = evtStore()->retrieve( m_attribList, m_attrName); if (sc.isFailure()) { - log << MSG::ERROR << "No attribute list in SG" << endreq; + ATH_MSG_ERROR( "No attribute list in SG" ); //return sc; } } @@ -247,8 +226,9 @@ void EventSplitter::setSuccess(bool flag) // decrease number of builders TagBuilderBase::decNumOfBuilder(); // if this is the last builder, lock the Attribute List - //if (TagBuilderBase::lastBuilder()) sc = m_StoreGate->setConst(m_attribList); - if (TagBuilderBase::lastBuilder()) m_StoreGate->setConst(m_attribList); + //if (TagBuilderBase::lastBuilder()) evtStore()->setConst(m_attribList); + if (TagBuilderBase::lastBuilder()) + evtStore()->setConst(m_attribList).ignore(); } } diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalEventTagBuilder.cxx b/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalEventTagBuilder.cxx index 4882ff8ef773c8cbb7d92e9b87488baa349362e1..f8910a5c26ef34ef6e9d525686b9c4740f02fb8e 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalEventTagBuilder.cxx +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalEventTagBuilder.cxx @@ -18,7 +18,7 @@ #include <vector> GlobalEventTagBuilder::GlobalEventTagBuilder( const std::string& name, ISvcLocator* pSvcLocator ) - : Algorithm(name, pSvcLocator), + : AthAlgorithm(name, pSvcLocator), TagBuilderBase(), m_globalEventTagTool("GlobalEventTagTool/GlobalEventTagTool",this) { declareProperty("GlobalEventTagTool", m_globalEventTagTool); @@ -30,35 +30,18 @@ GlobalEventTagBuilder::~GlobalEventTagBuilder() {} StatusCode GlobalEventTagBuilder::initialize() { - MsgStream mLog( messageService(), name() ); - mLog << MSG::DEBUG << "Initializing " << name() << endreq; + ATH_MSG_DEBUG( "Initializing " << name() ); - /** get StoreGate service */ - StatusCode sc = service( "StoreGateSvc", m_storeGateSvc ); - if (sc.isFailure()) { - mLog << MSG::ERROR << "Unable to get StoreGate service" << endreq; - return sc; - } - - /** get the Global Event Tag Tools */ - sc = m_globalEventTagTool.retrieve(); - if ( sc.isFailure() ) { - mLog << MSG::ERROR<< "Error retrieving " << m_globalEventTagTool.typeAndName() << endreq; - return sc; - } + ATH_CHECK( m_globalEventTagTool.retrieve() ); /** initialize attribute list spec pointer */ m_attribListSpec = new AthenaAttributeListSpecification; /** define attributes */ - mLog << MSG::DEBUG << "Defining the attribute list specification." << endreq; + ATH_MSG_DEBUG( "Defining the attribute list specification." ); std::vector<std::pair<std::string,AthenaAttributeType> > attrMap; - sc = m_globalEventTagTool->attributeSpecification(attrMap); - if ( sc.isFailure() ) { - mLog << MSG::ERROR << "Fail to build Attribute List Specification " << endreq; - return sc; - } + ATH_CHECK( m_globalEventTagTool->attributeSpecification(attrMap) ); std::vector<std::pair<std::string,AthenaAttributeType> >::iterator bMap = attrMap.begin(); std::vector<std::pair<std::string,AthenaAttributeType> >::iterator eMap = attrMap.end(); @@ -67,8 +50,7 @@ StatusCode GlobalEventTagBuilder::initialize() { for (; bMap != eMap; ++bMap) { bool check = checkAttribute((*bMap).first, EventAttributeSpecs, Evt::NevtAttr); if (!check) { - mLog << MSG::WARNING << "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" - << endreq; + ATH_MSG_WARNING( "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" ); } else { addAttribute( (*bMap).first, (*bMap).second ); @@ -90,9 +72,7 @@ StatusCode GlobalEventTagBuilder::initialize() { StatusCode GlobalEventTagBuilder::execute() { - MsgStream mLog( messageService(), name() ); - - mLog << MSG::DEBUG << "Executing " << name() << endreq; + ATH_MSG_DEBUG( "Executing " << name() ); /** reset number of builders */ TagBuilderBase::setNumOfBuilderToMax(); @@ -103,9 +83,8 @@ StatusCode GlobalEventTagBuilder::execute() { attribList = new TagAthenaAttributeList( *m_attribListSpec ); } catch (pool::Exception& e) { - mLog << MSG::ERROR - << "Caught exception during creation of TagAthenaAttributeList object. " - << "Message: " << e.what() << endreq; + ATH_MSG_ERROR( "Caught exception during creation of TagAthenaAttributeList object. " + << "Message: " << e.what() ); return StatusCode::FAILURE; } @@ -113,29 +92,25 @@ StatusCode GlobalEventTagBuilder::execute() { TagFragmentCollection globalEventTag; StatusCode sc = m_globalEventTagTool->execute( globalEventTag ); if (sc.isFailure()) { - mLog << MSG::WARNING << "Cannot Execute GlobalEventTagTool" << endreq; + ATH_MSG_WARNING( "Cannot Execute GlobalEventTagTool" ); } else fillAttribute(attribList, globalEventTag); /** record attribute list to SG */ - sc = m_storeGateSvc->record( attribList, m_attributeListName ); - if (sc.isFailure()) { - mLog << MSG::ERROR << "Could not record TagAthenaAttributeList" << endreq; - return sc; - } + ATH_CHECK( evtStore()->record( attribList, m_attributeListName ) ); /** decrease number of builders */ TagBuilderBase::decNumOfBuilder(); /** if this is the last builder, lock the Attribute List */ if (TagBuilderBase::lastBuilder()) - sc = m_storeGateSvc->setConst(attribList); + sc = evtStore()->setConst(attribList); if (sc.isFailure()) { - mLog << MSG::WARNING << "Could not set const to attribList" << endreq; + ATH_MSG_WARNING( "Could not set const to attribList" ); } - mLog << MSG::DEBUG << "Finished " << name() << endreq; + ATH_MSG_DEBUG( "Finished " << name() ); return StatusCode::SUCCESS; } diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalEventTagBuilder.h b/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalEventTagBuilder.h index a11192579fd0442a90666f258daeb21709dd8b9c..10808431441f80ebbda41948f189b87878ecdb9e 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalEventTagBuilder.h +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalEventTagBuilder.h @@ -35,13 +35,11 @@ inclusion in an event tag database. */ #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Algorithm.h" +#include "AthenaBaseComps/AthAlgorithm.h" #include "EventTagAlgs/TagBuilderBase.h" #include "EventTagUtils/GlobalEventTagTool.h" -class StoreGateSvc; - -class GlobalEventTagBuilder : public Algorithm, public TagBuilderBase { +class GlobalEventTagBuilder : public AthAlgorithm, public TagBuilderBase { public: /// Standard constructor. @@ -59,12 +57,8 @@ private: /// Attribute list name std::string m_attributeListName; - /// StoreGate service. - StoreGateSvc* m_storeGateSvc; - /// Global Event Tag Tool ToolHandle<GlobalEventTagTool> m_globalEventTagTool; - }; #endif // EVENTTAGALGS_GLOBALEVENTTAGBUILDER_H diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalTriggerTagBuilder.cxx b/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalTriggerTagBuilder.cxx index a2debc05abd696a4424d149d99e974a845425c90..0607977573d4b7e72967bb67c18af56f0f927d7b 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalTriggerTagBuilder.cxx +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalTriggerTagBuilder.cxx @@ -12,12 +12,10 @@ #include "AthenaPoolUtilities/TagAthenaAttributeList.h" #include "StoreGate/StoreGateSvc.h" -#include "GaudiKernel/MsgStream.h" - #include <sstream> GlobalTriggerTagBuilder::GlobalTriggerTagBuilder( const std::string& name, ISvcLocator* pSvcLocator ) - : Algorithm(name, pSvcLocator), + : AthAlgorithm(name, pSvcLocator), TagBuilderBase(), m_globalTriggerTagTool("GlobalTriggerTagTool/GlobalTriggerTagTool",this) { declareProperty("GlobalTriggerTagTool", m_globalTriggerTagTool); @@ -32,34 +30,15 @@ GlobalTriggerTagBuilder::~GlobalTriggerTagBuilder() StatusCode GlobalTriggerTagBuilder::initialize() { - StatusCode sc; - - MsgStream mLog( messageService(), name() ); - mLog << MSG::DEBUG << "Initializing " << name() << endreq; - - /** get StoreGate service */ - sc = service( "StoreGateSvc", m_storeGateSvc ); - if (sc.isFailure()) { - mLog << MSG::ERROR << "Unable to get StoreGate service" << endreq; - return sc; - } + ATH_MSG_DEBUG( "Initializing " << name() ); - /** get the Global Trigger Tag Tools */ - sc = m_globalTriggerTagTool.retrieve(); - if ( sc.isFailure() ) { - mLog << MSG::ERROR<< "Error retrieving the GlobalTriggerTagTool" << endreq; - return sc; - } + ATH_CHECK( m_globalTriggerTagTool.retrieve() ); /** define attributes */ - mLog << MSG::DEBUG << "Defining the attribute list specification." << endreq; + ATH_MSG_DEBUG( "Defining the attribute list specification." ); std::map<std::string,AthenaAttributeType> attrMap; - sc = m_globalTriggerTagTool->attributeSpecification(attrMap, m_MAX_NUMBER); - if ( sc.isFailure() ) { - mLog << MSG::ERROR << "Fail to build Attribute List Specification " << endreq; - return sc; - } + ATH_CHECK( m_globalTriggerTagTool->attributeSpecification(attrMap, m_MAX_NUMBER) ); std::map<std::string,AthenaAttributeType>::iterator bMap = attrMap.begin(); std::map<std::string,AthenaAttributeType>::iterator eMap = attrMap.end(); @@ -71,8 +50,7 @@ StatusCode GlobalTriggerTagBuilder::initialize() { //m_attrMap[(*bMap).first] = ((*bMap).second).typeName(); addAttribute( (*bMap).first, (*bMap).second ); } else { - mLog << MSG::WARNING << "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" - << endreq; + ATH_MSG_WARNING( "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" ); } } @@ -80,25 +58,17 @@ StatusCode GlobalTriggerTagBuilder::initialize() { } StatusCode GlobalTriggerTagBuilder::execute() { - StatusCode sc; - - MsgStream mLog( messageService(), name() ); - - mLog << MSG::DEBUG << "Executing " << name() << endreq; + ATH_MSG_DEBUG( "Executing " << name() ); /** retrieve TagAthenaAttributeList */ - TagAthenaAttributeList* attribList; - sc = m_storeGateSvc->retrieve( attribList, m_attributeListName); - if (sc.isFailure()) { - mLog << MSG::ERROR << "No attribute list in SG" << endreq; - return sc; - } + TagAthenaAttributeList* attribList = nullptr; + ATH_CHECK( evtStore()->retrieve( attribList, m_attributeListName) ); /** create a GlobalTrigger Tag and ask the tool to fill it */ TagFragmentCollection globalTriggerTag; - sc = m_globalTriggerTagTool->execute( globalTriggerTag, m_MAX_NUMBER ); + StatusCode sc = m_globalTriggerTagTool->execute( globalTriggerTag, m_MAX_NUMBER ); if (sc.isFailure()) { - mLog << MSG::WARNING << "Cannot Execute GlobalTriggerTagTool - for Trigger" << endreq; + ATH_MSG_WARNING( "Cannot Execute GlobalTriggerTagTool - for Trigger" ); } else fillAttribute(attribList, globalTriggerTag); /** decrease number of builders */ @@ -106,15 +76,14 @@ StatusCode GlobalTriggerTagBuilder::execute() { /** if this is the last builder, lock the Attribute List */ if (TagBuilderBase::lastBuilder()) - sc = m_storeGateSvc->setConst(attribList); + sc = evtStore()->setConst(attribList); if (sc.isFailure()) { - mLog << MSG::WARNING << "Could not set const to attribList" << endreq; + ATH_MSG_WARNING( "Could not set const to attribList" ); } - mLog << MSG::DEBUG << "Finished " << name() << endreq; - + ATH_MSG_DEBUG( "Finished " << name() ); return StatusCode::SUCCESS; } diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalTriggerTagBuilder.h b/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalTriggerTagBuilder.h index 6eb7c0964247e3ef1b54061e1b67cecc535f9c47..a8da1e9a3c4cb3a1490b90d602b7663b3c5761f3 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalTriggerTagBuilder.h +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/GlobalTriggerTagBuilder.h @@ -9,16 +9,14 @@ Tag Builder for Trigger */ -class StoreGateSvc; - #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Algorithm.h" +#include "AthenaBaseComps/AthAlgorithm.h" #include "EventTagAlgs/TagBuilderBase.h" #include "EventTagUtils/GlobalTriggerTagTool.h" #include <vector> -class GlobalTriggerTagBuilder : public Algorithm, public TagBuilderBase +class GlobalTriggerTagBuilder : public AthAlgorithm, public TagBuilderBase { public: @@ -37,9 +35,6 @@ private: //! Attribute list name std::string m_attributeListName; - //! StoreGate service. - StoreGateSvc* m_storeGateSvc; - //! global event tag tool ToolHandle<GlobalTriggerTagTool> m_globalTriggerTagTool; diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/MissingETTagBuilder.cxx b/PhysicsAnalysis/EventTag/EventTagAlgs/src/MissingETTagBuilder.cxx index 3575f28d2959726c5c1340d71790249c641dda5a..8975ce7009029fa2d7c5d8184f35c85e677cf4ec 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/MissingETTagBuilder.cxx +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/MissingETTagBuilder.cxx @@ -12,12 +12,10 @@ #include "AthenaPoolUtilities/TagAthenaAttributeList.h" #include "StoreGate/StoreGateSvc.h" -#include "GaudiKernel/MsgStream.h" - #include <sstream> MissingETTagBuilder::MissingETTagBuilder( const std::string& name, ISvcLocator* pSvcLocator ) - : Algorithm(name, pSvcLocator), + : AthAlgorithm(name, pSvcLocator), TagBuilderBase(), m_jetMissingEtTagTool("JetMissingEtTagTool", this) { declareProperty("JetMissingEtTagTool", m_jetMissingEtTagTool); @@ -32,34 +30,15 @@ MissingETTagBuilder::~MissingETTagBuilder() StatusCode MissingETTagBuilder::initialize() { - StatusCode sc; - - MsgStream mLog( messageService(), name() ); - mLog << MSG::DEBUG << "Initializing " << name() << endreq; - - /** get StoreGate service */ - sc = service( "StoreGateSvc", m_storeGateSvc ); - if (sc.isFailure()) { - mLog << MSG::ERROR << "Unable to get StoreGate service" << endreq; - return sc; - } + ATH_MSG_DEBUG( "Initializing " << name() ); - /** get the JetMissingEt Tag Tools */ - sc = m_jetMissingEtTagTool.retrieve(); - if ( sc.isFailure() ) { - mLog << MSG::ERROR<< "Error retrieving the JetMissingEtTagTool" << endreq; - return sc; - } + ATH_CHECK( m_jetMissingEtTagTool.retrieve() ); /** define attributes */ - mLog << MSG::DEBUG << "Defining the attribute list specification." << endreq; + ATH_MSG_DEBUG( "Defining the attribute list specification." ); std::map<std::string,AthenaAttributeType> attrMap; - sc = m_jetMissingEtTagTool->attributeSpecification(attrMap); - if ( sc.isFailure() ) { - mLog << MSG::ERROR << "Fail to build Attribute List Specification " << endreq; - return sc; - } + ATH_CHECK( m_jetMissingEtTagTool->attributeSpecification(attrMap) ); std::map<std::string,AthenaAttributeType>::iterator bMap = attrMap.begin(); std::map<std::string,AthenaAttributeType>::iterator eMap = attrMap.end(); @@ -71,8 +50,7 @@ StatusCode MissingETTagBuilder::initialize() //m_attrMap[(*bMap).first] = ((*bMap).second).typeName(); addAttribute( (*bMap).first, (*bMap).second ); } else { - mLog << MSG::WARNING << "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" - << endreq; + ATH_MSG_WARNING( "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" ); } } @@ -80,25 +58,17 @@ StatusCode MissingETTagBuilder::initialize() } StatusCode MissingETTagBuilder::execute() { - StatusCode sc; - - MsgStream mLog( messageService(), name() ); - - mLog << MSG::DEBUG << "Executing " << name() << endreq; + ATH_MSG_DEBUG( "Executing " << name() ); /** retrieve TagAthenaAttributeList */ - TagAthenaAttributeList* attribList; - sc = m_storeGateSvc->retrieve( attribList, m_attributeListName); - if (sc.isFailure()) { - mLog << MSG::ERROR << "No attribute list in SG" << endreq; - return sc; - } + TagAthenaAttributeList* attribList = nullptr; + ATH_CHECK( evtStore()->retrieve( attribList, m_attributeListName) ); /** create a MissingEt Tag and ask the tool to fill it */ TagFragmentCollection missingEtTag; - sc = m_jetMissingEtTagTool->execute( missingEtTag ); + StatusCode sc = m_jetMissingEtTagTool->execute( missingEtTag ); if (sc.isFailure()) { - mLog << MSG::WARNING << "Cannot Execute JetMissingEtTagTool" << endreq; + ATH_MSG_WARNING( "Cannot Execute JetMissingEtTagTool" ); } else fillAttribute(attribList, missingEtTag); /** decrease number of builders */ @@ -106,14 +76,14 @@ StatusCode MissingETTagBuilder::execute() { /** if this is the last builder, lock the Attribute List */ if (TagBuilderBase::lastBuilder()) - sc = m_storeGateSvc->setConst(attribList); + sc = evtStore()->setConst(attribList); if (sc.isFailure()) { - mLog << MSG::WARNING << "Could not set const to attribList" << endreq; + ATH_MSG_WARNING( "Could not set const to attribList" ); } - mLog << MSG::DEBUG << "Finished" << name() << endreq; + ATH_MSG_DEBUG( "Finished" << name() ); return StatusCode::SUCCESS; } diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/MissingETTagBuilder.h b/PhysicsAnalysis/EventTag/EventTagAlgs/src/MissingETTagBuilder.h index 79b5008865cc634c7d6296db1e7415aa55cf2cbc..b31c1de537de1f4a784086d2b884c37cad802a14 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/MissingETTagBuilder.h +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/MissingETTagBuilder.h @@ -11,13 +11,11 @@ #include "JetMissingEtTagTools/JetMissingEtTagTool.h" -class StoreGateSvc; - #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Algorithm.h" +#include "AthenaBaseComps/AthAlgorithm.h" #include "EventTagAlgs/TagBuilderBase.h" -class MissingETTagBuilder : public Algorithm, public TagBuilderBase +class MissingETTagBuilder : public AthAlgorithm, public TagBuilderBase { public: @@ -36,12 +34,8 @@ private: //! Attribute list name std::string m_attributeListName; - //! StoreGate service. - StoreGateSvc* m_storeGateSvc; - //! Jet and Missing Tag Tool ToolHandle<JetMetTagTool> m_jetMissingEtTagTool; - }; #endif diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/MuonTagBuilder.cxx b/PhysicsAnalysis/EventTag/EventTagAlgs/src/MuonTagBuilder.cxx index 8675424d6cecb1d74e6f83ab2947eb81606f67e5..efe4e148cfc32eef4d78099f29bb9721dbd474fa 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/MuonTagBuilder.cxx +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/MuonTagBuilder.cxx @@ -11,12 +11,10 @@ #include "AthenaPoolUtilities/TagAthenaAttributeList.h" #include "StoreGate/StoreGateSvc.h" -#include "GaudiKernel/MsgStream.h" - #include <sstream> MuonTagBuilder::MuonTagBuilder( const std::string& name, ISvcLocator* pSvcLocator ) - : Algorithm(name, pSvcLocator), + : AthAlgorithm(name, pSvcLocator), TagBuilderBase(), m_muonTagTool("MuonTagTool",this) { declareProperty("MuonTagTool", m_muonTagTool); @@ -30,34 +28,15 @@ MuonTagBuilder::~MuonTagBuilder() StatusCode MuonTagBuilder::initialize() { - StatusCode sc; - - MsgStream mLog( messageService(), name() ); - mLog << MSG::DEBUG << "Initializing " << name() << endreq; - - /** get StoreGate service */ - sc = service( "StoreGateSvc", m_storeGateSvc ); - if (sc.isFailure()) { - mLog << MSG::ERROR << "Unable to get StoreGate service" << endreq; - return sc; - } + ATH_MSG_DEBUG( "Initializing " << name() ); - /** get the Muon Tag Tools */ - sc = m_muonTagTool.retrieve(); - if ( sc.isFailure() ) { - mLog << MSG::ERROR<< "Error retrieving the MuonTagTool" << endreq; - return sc; - } + ATH_CHECK( m_muonTagTool.retrieve() ); /** define attributes */ - mLog << MSG::DEBUG << "Defining the attribute list specification." << endreq; + ATH_MSG_DEBUG( "Defining the attribute list specification." ); std::map<std::string,AthenaAttributeType> attrMap; - sc = m_muonTagTool->attributeSpecification(attrMap, m_MAX_NUMBER); - if ( sc.isFailure() ) { - mLog << MSG::ERROR << "Fail to build Attribute List Specification " << endreq; - return sc; - } + ATH_CHECK( m_muonTagTool->attributeSpecification(attrMap, m_MAX_NUMBER) ); std::map<std::string,AthenaAttributeType>::iterator bMap = attrMap.begin(); std::map<std::string,AthenaAttributeType>::iterator eMap = attrMap.end(); @@ -69,8 +48,7 @@ StatusCode MuonTagBuilder::initialize() { //m_attrMap[(*bMap).first] = ((*bMap).second).typeName(); addAttribute( (*bMap).first, (*bMap).second ) ; } else { - mLog << MSG::WARNING << "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" - << endreq; + ATH_MSG_WARNING( "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" ); } } @@ -79,25 +57,17 @@ StatusCode MuonTagBuilder::initialize() { StatusCode MuonTagBuilder::execute() { - StatusCode sc; - - MsgStream mLog( messageService(), name() ); - - mLog << MSG::DEBUG << "Executing " << name() << endreq; + ATH_MSG_DEBUG( "Executing " << name() ); /** retrieve TagAthenaAttributeList */ TagAthenaAttributeList* attribList; - sc = m_storeGateSvc->retrieve( attribList, m_attributeListName); - if (sc.isFailure()) { - mLog << MSG::ERROR << "No attribute list in SG" << endreq; - return sc; - } + ATH_CHECK( evtStore()->retrieve( attribList, m_attributeListName) ); /** clear the MuonTagCollection and ask the tool to fill it */ TagFragmentCollection muonTagColl; - sc = m_muonTagTool->execute( muonTagColl, m_MAX_NUMBER ); + StatusCode sc = m_muonTagTool->execute( muonTagColl, m_MAX_NUMBER ); if (sc.isFailure()) { - mLog << MSG::WARNING << "Cannot Execute MuonTagToool" << endreq; + ATH_MSG_WARNING( "Cannot Execute MuonTagToool" ); } else fillAttribute(attribList, muonTagColl); /** decrease number of builders */ @@ -105,15 +75,14 @@ StatusCode MuonTagBuilder::execute() { /** if this is the last builder, lock the Attribute List */ if (TagBuilderBase::lastBuilder()) - sc = m_storeGateSvc->setConst(attribList); + sc = evtStore()->setConst(attribList); if (sc.isFailure()) { - mLog << MSG::WARNING << "Could not set const to attribList" << endreq; + ATH_MSG_WARNING( "Could not set const to attribList" ); } - mLog << MSG::DEBUG << "Finished " << name() << endreq; - + ATH_MSG_DEBUG( "Finished " << name() ); return StatusCode::SUCCESS; } diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/MuonTagBuilder.h b/PhysicsAnalysis/EventTag/EventTagAlgs/src/MuonTagBuilder.h index af25526b29179d6091ca1e260233513d7f00cb7a..a55acb8f86df940355a9564dfbef10ab7f648879 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/MuonTagBuilder.h +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/MuonTagBuilder.h @@ -14,10 +14,10 @@ class StoreGateSvc; #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Algorithm.h" +#include "AthenaBaseComps/AthAlgorithm.h" #include "EventTagAlgs/TagBuilderBase.h" -class MuonTagBuilder : public Algorithm, public TagBuilderBase +class MuonTagBuilder : public AthAlgorithm, public TagBuilderBase { public: @@ -39,12 +39,8 @@ private: //! number of particles int m_MAX_NUMBER; - //! StoreGate service. - StoreGateSvc* m_storeGateSvc; - //! Muon Tag Tool ToolHandle<MuonTagTool> m_muonTagTool; - }; #endif diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/ParticleJetTagBuilder.cxx b/PhysicsAnalysis/EventTag/EventTagAlgs/src/ParticleJetTagBuilder.cxx index cd98ee876d64cd5aa271c7dccd837164cca8a5e0..bdd46348ad0b3273a9a20243d72aca44a50468ab 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/ParticleJetTagBuilder.cxx +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/ParticleJetTagBuilder.cxx @@ -12,12 +12,10 @@ #include "AthenaPoolUtilities/TagAthenaAttributeList.h" #include "StoreGate/StoreGateSvc.h" -#include "GaudiKernel/MsgStream.h" - #include <sstream> ParticleJetTagBuilder::ParticleJetTagBuilder( const std::string& name, ISvcLocator* pSvcLocator ) - : Algorithm(name, pSvcLocator), + : AthAlgorithm(name, pSvcLocator), TagBuilderBase(), m_jetMissingEtTagTool("JetMissingEtTagTool", this) { declareProperty("JetMissingEtTagTool", m_jetMissingEtTagTool); @@ -31,34 +29,15 @@ ParticleJetTagBuilder::~ParticleJetTagBuilder() StatusCode ParticleJetTagBuilder::initialize() { - StatusCode sc; - - MsgStream mLog( messageService(), name() ); - mLog << MSG::DEBUG << "Initializing " << name() << endreq; - - /** get StoreGate service */ - sc = service( "StoreGateSvc", m_storeGateSvc ); - if (sc.isFailure()) { - mLog << MSG::ERROR << "Unable to get StoreGate service" << endreq; - return sc; - } + ATH_MSG_DEBUG( "Initializing " << name() ); - /** get the JetMissingEt Tag Tools */ - sc = m_jetMissingEtTagTool.retrieve(); - if ( sc.isFailure() ) { - mLog << MSG::ERROR<< "Error retrieving the JetMissingEtTagTool" << endreq; - return sc; - } + ATH_CHECK( m_jetMissingEtTagTool.retrieve() ); /** define attributes */ - mLog << MSG::DEBUG << "Defining the attribute list specification." << endreq; + ATH_MSG_DEBUG( "Defining the attribute list specification." ); std::map<std::string,AthenaAttributeType> attrMap; - sc = m_jetMissingEtTagTool->attributeSpecification(attrMap, m_MAX_NUMBER); - if ( sc.isFailure() ) { - mLog << MSG::ERROR << "Fail to build Attribute List Specification " << endreq; - return sc; - } + ATH_CHECK( m_jetMissingEtTagTool->attributeSpecification(attrMap, m_MAX_NUMBER) ); std::map<std::string,AthenaAttributeType>::iterator bMap = attrMap.begin(); std::map<std::string,AthenaAttributeType>::iterator eMap = attrMap.end(); @@ -70,8 +49,7 @@ StatusCode ParticleJetTagBuilder::initialize() //m_attrMap[(*bMap).first] = ((*bMap).second).typeName(); addAttribute( (*bMap).first, (*bMap).second ); } else { - mLog << MSG::WARNING << "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" - << endreq; + ATH_MSG_WARNING( "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" ); } } @@ -80,25 +58,17 @@ StatusCode ParticleJetTagBuilder::initialize() StatusCode ParticleJetTagBuilder::execute() { - StatusCode sc; - - MsgStream mLog( messageService(), name() ); - - mLog << MSG::DEBUG << "Executing " << name() << endreq; + ATH_MSG_DEBUG( "Executing " << name() ); // retrieve TagAthenaAttributeList - TagAthenaAttributeList* attribList; - sc = m_storeGateSvc->retrieve( attribList, m_attributeListName); - if (sc.isFailure()) { - mLog << MSG::ERROR << "No attribute list in SG" << endreq; - return sc; - } + TagAthenaAttributeList* attribList = nullptr; + ATH_CHECK( evtStore()->retrieve( attribList, m_attributeListName) ); /** ask the tool to fill particle jet tag collection */ TagFragmentCollection particleJetTagColl; - sc = m_jetMissingEtTagTool->execute( particleJetTagColl, m_MAX_NUMBER ); + StatusCode sc = m_jetMissingEtTagTool->execute( particleJetTagColl, m_MAX_NUMBER ); if (sc.isFailure()) { - mLog << MSG::WARNING << "Cannot Execute JetMissingEtTagToool" << endreq; + ATH_MSG_WARNING( "Cannot Execute JetMissingEtTagToool" ); } else fillAttribute(attribList, particleJetTagColl); /** decrease number of builders */ @@ -106,14 +76,14 @@ StatusCode ParticleJetTagBuilder::execute() { /** if this is the last builder, lock the Attribute List */ if (TagBuilderBase::lastBuilder()) - sc = m_storeGateSvc->setConst(attribList); + sc = evtStore()->setConst(attribList); if (sc.isFailure()) { - mLog << MSG::WARNING << "Could not set const to attribList" << endreq; + ATH_MSG_WARNING( "Could not set const to attribList" ); } - mLog << MSG::DEBUG << "Finished" << name() << endreq; + ATH_MSG_DEBUG( "Finished" << name() ); return StatusCode::SUCCESS; } diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/ParticleJetTagBuilder.h b/PhysicsAnalysis/EventTag/EventTagAlgs/src/ParticleJetTagBuilder.h index ea811f0c6633d096eb41885761ee3be4f352a9a0..8e2db99b9c4053f7b1017eda2e6b478902281e1c 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/ParticleJetTagBuilder.h +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/ParticleJetTagBuilder.h @@ -11,13 +11,11 @@ #include "JetMissingEtTagTools/JetMissingEtTagTool.h" -class StoreGateSvc; - #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Algorithm.h" +#include "AthenaBaseComps/AthAlgorithm.h" #include "EventTagAlgs/TagBuilderBase.h" -class ParticleJetTagBuilder : public Algorithm, public TagBuilderBase +class ParticleJetTagBuilder : public AthAlgorithm, public TagBuilderBase { public: @@ -39,12 +37,8 @@ private: //! number of particles int m_MAX_NUMBER; - //! StoreGate service. - StoreGateSvc* m_storeGateSvc; - //! Jet and Missing Tag Tool ToolHandle<JetMetTagTool> m_jetMissingEtTagTool; - }; #endif diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/PhotonTagBuilder.cxx b/PhysicsAnalysis/EventTag/EventTagAlgs/src/PhotonTagBuilder.cxx index 685ea11f4bbc658fcdbbe09998c55d47455c915a..2758840a281a9319f562234423d9fc097b2a74c8 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/PhotonTagBuilder.cxx +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/PhotonTagBuilder.cxx @@ -16,7 +16,7 @@ #include <sstream> PhotonTagBuilder::PhotonTagBuilder( const std::string& name, ISvcLocator* pSvcLocator ) - : Algorithm(name, pSvcLocator), + : AthAlgorithm(name, pSvcLocator), TagBuilderBase(), m_photonTagTool("PhotonTagTool", this) { declareProperty("PhotonTagTool", m_photonTagTool); @@ -29,34 +29,15 @@ PhotonTagBuilder::~PhotonTagBuilder() {} StatusCode PhotonTagBuilder::initialize() { - StatusCode sc; + ATH_MSG_DEBUG( "Initializing " << name() ); - MsgStream mLog( messageService(), name() ); - mLog << MSG::DEBUG << "Initializing " << name() << endreq; - - /** get StoreGate service */ - sc = service( "StoreGateSvc", m_storeGateSvc ); - if (sc.isFailure()) { - mLog << MSG::ERROR << "Unable to get StoreGate service" << endreq; - return sc; - } - - /** get the Photon Tag Tools */ - sc = m_photonTagTool.retrieve(); - if ( sc.isFailure() ) { - mLog << MSG::ERROR<< "Error retrieving the PhotonTagTool" << endreq; - return sc; - } + ATH_CHECK( m_photonTagTool.retrieve() ); /** define attributes */ - mLog << MSG::DEBUG << "Defining the attribute list specification." << endreq; + ATH_MSG_DEBUG( "Defining the attribute list specification." ); std::map<std::string,AthenaAttributeType> attrMap; - sc = m_photonTagTool->attributeSpecification(attrMap, m_MAX_NUMBER); - if ( sc.isFailure() ) { - mLog << MSG::ERROR << "Fail to build Attribute List Specification " << endreq; - return sc; - } + ATH_CHECK( m_photonTagTool->attributeSpecification(attrMap, m_MAX_NUMBER) ); std::map<std::string,AthenaAttributeType>::iterator bMap = attrMap.begin(); std::map<std::string,AthenaAttributeType>::iterator eMap = attrMap.end(); @@ -68,8 +49,7 @@ StatusCode PhotonTagBuilder::initialize() { //m_attrMap[(*bMap).first] = ((*bMap).second).typeName(); addAttribute( (*bMap).first, (*bMap).second ); } else { - mLog << MSG::WARNING << "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" - << endreq; + ATH_MSG_WARNING( "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" ); } } @@ -77,25 +57,17 @@ StatusCode PhotonTagBuilder::initialize() { } StatusCode PhotonTagBuilder::execute() { - StatusCode sc; - - MsgStream mLog( messageService(), name() ); - - mLog << MSG::DEBUG << "Executing " << name() << endreq; + ATH_MSG_DEBUG( "Executing " << name() ); /** retrieve TagAthenaAttributeList */ TagAthenaAttributeList* attribList; - sc = m_storeGateSvc->retrieve( attribList, m_attributeListName); - if (sc.isFailure()) { - mLog << MSG::WARNING << "No attribute list in SG" << endreq; - return sc; - } + ATH_CHECK( evtStore()->retrieve( attribList, m_attributeListName) ); /** ask the tool to fill the photon tag fragment */ TagFragmentCollection photonTagColl; - sc = m_photonTagTool->execute( photonTagColl, m_MAX_NUMBER ); + StatusCode sc = m_photonTagTool->execute( photonTagColl, m_MAX_NUMBER ); if (sc.isFailure()) { - mLog << MSG::WARNING << "Cannot Execute PhotonTagToool" << endreq; + ATH_MSG_WARNING( "Cannot Execute PhotonTagToool" ); } else fillAttribute(attribList, photonTagColl); /** decrease number of builders */ @@ -103,14 +75,14 @@ StatusCode PhotonTagBuilder::execute() { /** if this is the last builder, lock the Attribute List */ if (TagBuilderBase::lastBuilder()) - sc = m_storeGateSvc->setConst(attribList); + sc = evtStore()->setConst(attribList); if (sc.isFailure()) { - mLog << MSG::WARNING << "Could not set const to attribList" << endreq; + ATH_MSG_WARNING( "Could not set const to attribList" ); } - mLog << MSG::DEBUG << "Finished " << name() << endreq; + ATH_MSG_DEBUG( "Finished " << name() ); return StatusCode::SUCCESS; } diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/PhotonTagBuilder.h b/PhysicsAnalysis/EventTag/EventTagAlgs/src/PhotonTagBuilder.h index 82ccdab7dbe965ad5342712216d335cf090b0924..4bc406d3beadf43435d4f6c719624ee2997e5222 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/PhotonTagBuilder.h +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/PhotonTagBuilder.h @@ -11,13 +11,11 @@ #include "ElectronPhotonTagTools/PhotonTagTool.h" -class StoreGateSvc; - #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Algorithm.h" +#include "AthenaBaseComps/AthAlgorithm.h" #include "EventTagAlgs/TagBuilderBase.h" -class PhotonTagBuilder : public Algorithm, public TagBuilderBase +class PhotonTagBuilder : public AthAlgorithm, public TagBuilderBase { public: @@ -39,12 +37,8 @@ private: //! number of particles int m_MAX_NUMBER; - //! StoreGate service. - StoreGateSvc* m_storeGateSvc; - //! the photon tag tool ToolHandle<PhotonTagTool> m_photonTagTool; - }; #endif diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/TauJetTagBuilder.cxx b/PhysicsAnalysis/EventTag/EventTagAlgs/src/TauJetTagBuilder.cxx index 907749522d6189360078f71fc7f773a388220a32..d78f2a756b4b577850c0201a7675d24f584ceeac 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/TauJetTagBuilder.cxx +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/TauJetTagBuilder.cxx @@ -12,12 +12,10 @@ #include "AthenaPoolUtilities/TagAthenaAttributeList.h" #include "StoreGate/StoreGateSvc.h" -#include "GaudiKernel/MsgStream.h" - #include <sstream> TauJetTagBuilder::TauJetTagBuilder( const std::string& name, ISvcLocator* pSvcLocator ) - : Algorithm(name, pSvcLocator), + : AthAlgorithm(name, pSvcLocator), TagBuilderBase(), m_tauJetTagTool("TauJetTagTool", this) { declareProperty("TauJetTagTool", m_tauJetTagTool); @@ -33,35 +31,15 @@ TauJetTagBuilder::~TauJetTagBuilder() StatusCode TauJetTagBuilder::initialize() { - StatusCode sc; - - MsgStream mLog( messageService(), name() ); - mLog << MSG::DEBUG << "Initializing " << name() << endreq; - - // get StoreGate service - sc = service( "StoreGateSvc", m_storeGateSvc ); - if (sc.isFailure()) - { - mLog << MSG::ERROR << "Unable to get StoreGate service" << endreq; - return sc; - } + ATH_MSG_DEBUG( "Initializing " << name() ); - /** get the TauJet Tag Tools */ - sc = m_tauJetTagTool.retrieve(); - if ( sc.isFailure() ) { - mLog << MSG::ERROR<< "Error retrieving the TauJetTagTool" << endreq; - return sc; - } + ATH_CHECK( m_tauJetTagTool.retrieve() ); // define attributes - mLog << MSG::DEBUG << "Defining the attribute list specification." << endreq; + ATH_MSG_DEBUG( "Defining the attribute list specification." ); std::map<std::string,AthenaAttributeType> attrMap; - sc = m_tauJetTagTool->attributeSpecification(attrMap, m_MAX_NUMBER); - if ( sc.isFailure() ) { - mLog << MSG::ERROR << "Fail to build Attribute List Specification " << endreq; - return sc; - } + ATH_CHECK( m_tauJetTagTool->attributeSpecification(attrMap, m_MAX_NUMBER) ); std::map<std::string,AthenaAttributeType>::iterator bMap = attrMap.begin(); std::map<std::string,AthenaAttributeType>::iterator eMap = attrMap.end(); @@ -73,36 +51,26 @@ StatusCode TauJetTagBuilder::initialize() //m_attrMap[(*bMap).first] = ((*bMap).second).typeName(); addAttribute( (*bMap).first, (*bMap).second ); } else { - mLog << MSG::WARNING << "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" - << endreq; + ATH_MSG_WARNING( "Removing " << (*bMap).first << " from the attribute List: not in TAG EDM" ); } } - return StatusCode::SUCCESS; } StatusCode TauJetTagBuilder::execute() { - StatusCode sc; - - MsgStream mLog( messageService(), name() ); - - mLog << MSG::DEBUG << "Executing " << name() << endreq; + ATH_MSG_DEBUG( "Executing " << name() ); /** retrieve TagAthenaAttributeList */ TagAthenaAttributeList* attribList; - sc = m_storeGateSvc->retrieve( attribList, m_attributeListName); - if (sc.isFailure()) { - mLog << MSG::ERROR << "No attribute list in SG" << endreq; - return sc; - } + ATH_CHECK( evtStore()->retrieve( attribList, m_attributeListName) ); /** clear the TauJetTagCollection and ask the tool to fill it */ TagFragmentCollection tauJetTagColl; - sc = m_tauJetTagTool->execute( tauJetTagColl, m_MAX_NUMBER ); + StatusCode sc = m_tauJetTagTool->execute( tauJetTagColl, m_MAX_NUMBER ); if (sc.isFailure()) { - mLog << MSG::WARNING << "Cannot Execute TauJetTagToool" << endreq; + ATH_MSG_WARNING( "Cannot Execute TauJetTagToool" ); } else fillAttribute(attribList, tauJetTagColl); // decrease number of builders @@ -110,14 +78,14 @@ StatusCode TauJetTagBuilder::execute() { // if this is the last builder, lock the Attribute List if (TagBuilderBase::lastBuilder()) - sc = m_storeGateSvc->setConst(attribList); + sc = evtStore()->setConst(attribList); if (sc.isFailure()) { - mLog << MSG::WARNING << "Could not set const to attribList" << endreq; + ATH_MSG_WARNING( "Could not set const to attribList" ); } - mLog << MSG::DEBUG << "Finished" << name() << endreq; + ATH_MSG_DEBUG( "Finished" << name() ); return StatusCode::SUCCESS; } diff --git a/PhysicsAnalysis/EventTag/EventTagAlgs/src/TauJetTagBuilder.h b/PhysicsAnalysis/EventTag/EventTagAlgs/src/TauJetTagBuilder.h index 94ab0c5e6f127ae4399afe80b4ddb5d2420005a8..ae94d64bdb611dead2df6573e154e9955562cfdd 100755 --- a/PhysicsAnalysis/EventTag/EventTagAlgs/src/TauJetTagBuilder.h +++ b/PhysicsAnalysis/EventTag/EventTagAlgs/src/TauJetTagBuilder.h @@ -14,10 +14,10 @@ class StoreGateSvc; #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Algorithm.h" +#include "AthenaBaseComps/AthAlgorithm.h" #include "EventTagAlgs/TagBuilderBase.h" -class TauJetTagBuilder : public Algorithm, public TagBuilderBase +class TauJetTagBuilder : public AthAlgorithm, public TagBuilderBase { public: @@ -39,12 +39,8 @@ private: //! number of particles int m_MAX_NUMBER; - //! StoreGate service. - StoreGateSvc* m_storeGateSvc; - //! TauJet Tag Tool ToolHandle<TauJetTagTool> m_tauJetTagTool; - }; #endif