Skip to content
Snippets Groups Projects
Commit 2d25d5e8 authored by Johannes Elmsheuser's avatar Johannes Elmsheuser
Browse files

Merge branch 'trigevent_svcloc' into 'main'

TrigEvent: remove usage of deprecated ISvcLoc APIs

See merge request atlas/athena!74518
parents 45c96c16 8fb6c63d
No related branches found
No related tags found
No related merge requests found
Showing
with 49 additions and 75 deletions
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
/**********************************************************************************
......@@ -11,9 +11,6 @@
*
* @author Andrew Hamilton <Andrew.Hamilton@cern.ch> - U. Geneva
* @author Francesca Bucci <f.bucci@cern.ch> - U. Geneva
*
* File and Version Information:
* $Id: TrigInDetTrackCnv_p4.h,v 1.4 demelian Exp $
**********************************************************************************/
#ifndef TRIGINDETEVENTTPCNV_TRIGINDETTRACKCNV_P4_H
#define TRIGINDETEVENTTPCNV_TRIGINDETTRACKCNV_P4_H
......@@ -25,13 +22,8 @@
#include "TrigInDetEventTPCnv/TrigInDetTrack_p4.h"
#include "StoreGate/StoreGateSvc.h"
#include "InDetIdentifier/PixelID.h"
//this include is needed by CombinedMuonFeatureCnv
//an incorrect dependency which should be fixed
// #include "TrigInDetEventTPCnv/TrigInDetTrackFitParCnv_p1.h" // not needed at all ?!
class MsgStream;
class TrigInDetTrackCnv_p4: public T_AthenaPoolTPCnvBase<TrigInDetTrack, TrigInDetTrack_p4>
......@@ -50,7 +42,6 @@ protected:
ITPConverterFor<TrigInDetTrackFitPar> *m_fpCnv;
// TrigInDetTrackFitParCnv_p1 *m_fpCnv;
const PixelID *m_pixId;
StoreGateSvc *m_storeGate;
bool m_isInitialized;
StatusCode initialize(MsgStream &log);
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include "TrigInDetEvent/TrigInDetTrack.h"
#include "TrigInDetEventTPCnv/TrigInDetTrackCnv_p4.h"
#include "TrigInDetEventTPCnv/TrigInDetTrack_p4.h"
#include "StoreGate/StoreGateSvc.h"
//-----------------------------------------------------------------------------
// Persistent to transient
......@@ -82,35 +83,20 @@ StatusCode TrigInDetTrackCnv_p4::initialize(MsgStream &log) {
// Do not initialize again:
m_isInitialized=true;
// Get Storegate, ID helpers, and so on
ISvcLocator* svcLocator = Gaudi::svcLocator();
// get StoreGate service
StatusCode sc = svcLocator->service("StoreGateSvc", m_storeGate);
if (sc.isFailure()) {
log << MSG::FATAL << "StoreGate service not found !" << endmsg;
return StatusCode::FAILURE;
}
// get DetectorStore service
StoreGateSvc *detStore{nullptr};
sc = svcLocator->service("DetectorStore", detStore);
if (sc.isFailure()) {
SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service("DetectorStore")};
if (!detStore) {
log << MSG::FATAL << "DetectorStore service not found !" << endmsg;
return StatusCode::FAILURE;
}
// else {
// if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "Found DetectorStore." << endmsg;
// }
// Get the sct helper from the detector store
sc = detStore->retrieve(m_pixId, "PixelID");
StatusCode sc = detStore->retrieve(m_pixId, "PixelID");
if (sc.isFailure()) {
log << MSG::FATAL << "Could not get PixelID helper !" << endmsg;
return StatusCode::FAILURE;
}
// if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "Converter initialized." << endmsg;
return StatusCode::SUCCESS;
}
......
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
/**
* @file TrigInDetEventTPCnv/test/TrigInDetTrackCnv_p1_test.cxx
......@@ -191,9 +191,8 @@ void make_dd()
IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml");
pix_id->initialize_from_dictionary (idd);
ISvcLocator* svcLoc = Gaudi::svcLocator();
StoreGateSvc* sg = 0;
assert ( svcLoc->service("DetectorStore", sg).isSuccess() );
SmartIF<StoreGateSvc> sg{Gaudi::svcLocator()->service("DetectorStore")};
assert ( sg.isValid() );
assert ( sg->record (std::move (pix_id), "PixelID") );
}
......
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
/**
* @file TrigInDetEventTPCnv/test/TrigInDetTrackCnv_p2_test.cxx
......@@ -188,9 +188,8 @@ void make_dd()
IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml");
pix_id->initialize_from_dictionary (idd);
ISvcLocator* svcLoc = Gaudi::svcLocator();
StoreGateSvc* sg = 0;
assert ( svcLoc->service("DetectorStore", sg).isSuccess() );
SmartIF<StoreGateSvc> sg{Gaudi::svcLocator()->service("DetectorStore")};
assert ( sg.isValid() );
assert ( sg->record (std::move (pix_id), "PixelID") );
}
......
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
/**
* @file TrigInDetEventTPCnv/test/TrigInDetTrackCnv_p3_test.cxx
......@@ -188,9 +188,8 @@ void make_dd()
IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml");
pix_id->initialize_from_dictionary (idd);
ISvcLocator* svcLoc = Gaudi::svcLocator();
StoreGateSvc* sg = 0;
assert ( svcLoc->service("DetectorStore", sg).isSuccess() );
SmartIF<StoreGateSvc> sg{Gaudi::svcLocator()->service("DetectorStore")};
assert ( sg.isValid() );
assert ( sg->record (std::move (pix_id), "PixelID") );
}
......
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
/**
* @file TrigInDetEventTPCnv/test/TrigInDetTrackCnv_p4_test.cxx
......@@ -189,9 +189,8 @@ void make_dd()
IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml");
pix_id->initialize_from_dictionary (idd);
ISvcLocator* svcLoc = Gaudi::svcLocator();
StoreGateSvc* sg = 0;
assert ( svcLoc->service("DetectorStore", sg).isSuccess() );
SmartIF<StoreGateSvc> sg{Gaudi::svcLocator()->service("DetectorStore")};
assert ( sg.isValid() );
assert ( sg->record (std::move (pix_id), "PixelID") );
}
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include <stdint.h>
......@@ -165,8 +165,8 @@ int main() {
// initialize Gaudi, SG
ISvcLocator* pSvcLoc{nullptr};
assert( Athena_test::initGaudi(pSvcLoc) );
StoreGateSvc* pSG(nullptr);
assert( pSvcLoc->service("StoreGateSvc", pSG, true).isSuccess() );
SmartIF<StoreGateSvc> pSG{pSvcLoc->service("StoreGateSvc")};
assert ( pSG.isValid() );
// Create a context
IProxyDict* xdict = &*pSG;
......
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include <stdexcept>
......@@ -306,8 +306,8 @@ int main() {
// initialize Gaudi, SG
ISvcLocator* pSvcLoc{nullptr};
assert( Athena_test::initGaudi(pSvcLoc) );
StoreGateSvc* pSG(nullptr);
assert( pSvcLoc->service("StoreGateSvc", pSG, true).isSuccess() );
SmartIF<StoreGateSvc> pSG{pSvcLoc->service("StoreGateSvc")};
assert ( pSG.isValid() );
// Create a context
IProxyDict* xdict = &*pSG;
......
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include <stdint.h>
......@@ -197,8 +197,8 @@ int main() {
// initialize Gaudi, SG
ISvcLocator* pSvcLoc{nullptr};
assert( Athena_test::initGaudi(pSvcLoc) );
StoreGateSvc* pSG(nullptr);
assert( pSvcLoc->service("StoreGateSvc", pSG, true).isSuccess() );
SmartIF<StoreGateSvc> pSG{pSvcLoc->service("StoreGateSvc")};
assert ( pSG.isValid() );
// Create a context
IProxyDict* xdict = &*pSG;
......
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
......@@ -28,7 +28,7 @@
#include "CxxUtils/checker_macros.h"
ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // testing code
StoreGateSvc* pStore(0);
SmartIF<StoreGateSvc> pStore;
double interval( struct timeval& begin, struct timeval& end) {
return (end.tv_sec - begin.tv_sec)*1000. + (end.tv_usec - begin.tv_usec)*1e-3;
......@@ -817,17 +817,16 @@ bool run () {
msglog = &log;
pStore = pSvcLoc->service("StoreGateSvc");
if( pSvcLoc->service("StoreGateSvc", pStore, true).isSuccess() ) {
if( pStore ) {
log << MSG::DEBUG << "SG pointer: " << pStore << endmsg;
} else REPORT_AND_STOP( "no SG available" );
IToolSvc* toolSvc{nullptr};
SmartIF<IToolSvc> toolSvc{pSvcLoc->service("ToolSvc")};
if( pSvcLoc->service("ToolSvc", toolSvc, true).isSuccess() ) {
if( toolSvc ) {
log << MSG::DEBUG << "ToolSvc pointer: " << toolSvc << endmsg;
} else {
ABORT ( "no ToolSvc available" );
......
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include "iostream"
......@@ -29,7 +29,7 @@ using namespace std;
using namespace HLTNavDetails;
using namespace TrigNavTest;
StoreGateSvc* pStore(0);
SmartIF<StoreGateSvc> pStore;
asg::AsgMessaging logger("Holder_test");
typedef TrigSerializeConverter<TestBContainer> TestBContainerSerCnv;
......@@ -371,7 +371,8 @@ int main() {
Gaudi::Hive::setCurrentContextEvt(0);
if( pSvcLoc->service("StoreGateSvc", pStore, true).isSuccess() ) {
pStore = pSvcLoc->service("StoreGateSvc");
if( pStore ) {
*msglog << MSG::DEBUG << "SG pointer: " << pStore << endmsg;
} else {
ABORT( "ERROR no SG available" );
......
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include "iostream"
......@@ -29,7 +29,7 @@ using namespace TrigNavTest;
//const int OK=1;
//const int FAILED=0;
StoreGateSvc* pStore{nullptr};
SmartIF<StoreGateSvc> pStore;
HLT::Navigation* hns{nullptr};
......@@ -176,15 +176,17 @@ int main() {
MsgStream log(Athena::getMessageSvc(), "Ownership_test");
msglog = &log;
if( pSvcLoc->service("StoreGateSvc", pStore, true).isSuccess() ) {
pStore = pSvcLoc->service("StoreGateSvc");
if( pStore ) {
*msglog << MSG::DEBUG << "SG pointer: " << pStore << endmsg;
} else {
ABORT( "ERROR no SG available" );
}
IToolSvc* toolSvc{nullptr};
SmartIF<IToolSvc> toolSvc{pSvcLoc->service("ToolSvc")};
if( pSvcLoc->service("ToolSvc", toolSvc, true).isSuccess() ) {
if( toolSvc ) {
log << MSG::DEBUG << "ToolSvc pointer: " << toolSvc << endmsg;
} else {
ABORT ( "no ToolSvc available" );
......
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include <sys/time.h>
......@@ -46,18 +46,17 @@ int main () {
StoreGateSvc* pStore{nullptr};
SmartIF<StoreGateSvc> pStore{ pSvcLoc->service("StoreGateSvc")};
if( pSvcLoc->service("StoreGateSvc", pStore, true).isSuccess() ) {
if( pStore ) {
log << MSG::DEBUG << "SG pointer: " << pStore << endmsg;
} else {
ABORT ( "ERROR no SG available" );
}
IToolSvc* toolSvc{nullptr};
SmartIF<IToolSvc> toolSvc{pSvcLoc->service("ToolSvc")};
if( pSvcLoc->service("ToolSvc", toolSvc, true).isSuccess() ) {
if( toolSvc ) {
log << MSG::DEBUG << "ToolSvc pointer: " << toolSvc << endmsg;
} else {
ABORT( "ERROR no ToolSvc available" );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment