Verified Commit caffa707 authored by Tadej Novak's avatar Tadej Novak
Browse files

Remove obsolete OverlayAlgBase package

parent 27804279
Pipeline #778773 failed with stage
in 0 seconds
################################################################################
# Package: OverlayAlgBase
################################################################################
# Declare the package name:
atlas_subdir( OverlayAlgBase )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
Control/StoreGate
GaudiKernel )
# Component(s) in the package:
atlas_add_library( OverlayAlgBase
src/*.cxx
PUBLIC_HEADERS OverlayAlgBase
LINK_LIBRARIES AthenaBaseComps GaudiKernel StoreGateLib SGtests )
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// Dear emacs, this is -*-c++-*-
/**
* @file
*
* A resource-acquisition-in-initialization class, which can be used
* in a code that manipulates active store to guarantee that
* ActiveStoreSvc is set back to the state expected by the rest of the
* program.
*
* @author Andrei Gaponenko, 2006
*/
#ifndef ACTIVE_STORE_SWITCHER_H
#define ACTIVE_STORE_SWITCHER_H
#include "StoreGate/ActiveStoreSvc.h"
class StoreGateSvc;
class ActiveStoreSwitcher {
ActiveStoreSvc *m_aSvc;
StoreGateSvc *m_oldStore;
public:
ActiveStoreSwitcher(ActiveStoreSvc *aSvc, StoreGateSvc *newStore)
: m_aSvc(aSvc), m_oldStore( aSvc->operator->() )
{
m_aSvc->setStore(newStore);
}
~ActiveStoreSwitcher()
{
m_aSvc->setStore(m_oldStore);
}
};
#endif/*ACTIVE_STORE_SWITCHER_H*/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// Dear emacs, this is -*-c++-*-
/**
* @file
*
* Code to set up access to two StoreGate-s for overlaying algorithms.
* Factored out from InDetOverlay.
*
* @author Andrei Gaponenko, 2006-2009
*/
#ifndef OVERLAYALGBASE_H
#define OVERLAYALGBASE_H
#include <string>
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ServiceHandle.h"
class StoreGateSvc;
/**
* This class sets up acces to the two event stores and makes sure
* they are syncronized. It also handles McEventCollection.
*
* Algorithms inheriting from OverlayAlgBase should not redefine
* initialize(), execute() and finalize() but provide
* overlayInitialize() etc. instead.
*/
class OverlayAlgBase : public AthAlgorithm
{
public:
OverlayAlgBase(const std::string &name,ISvcLocator *pSvcLocator);
virtual StatusCode initialize();
virtual StatusCode execute();
virtual StatusCode finalize();
//----------------
virtual StatusCode overlayInitialize();
virtual StatusCode overlayExecute();
virtual StatusCode overlayFinalize();
protected:
// ----------------------------------------------------------------
ServiceHandle<StoreGateSvc> m_storeGateData;
ServiceHandle<StoreGateSvc> m_storeGateMC;
ServiceHandle<StoreGateSvc> m_storeGateOutput; //FIXME this should be dropped in favour of the evtStore method of AthAlgorithm
template<class TypeToBeRemoved> void removeAllObjectsOfType(StoreGateSvc *sg);
template<class TypeToBeCopied> void copyAllObjectsOfType(StoreGateSvc *to, StoreGateSvc *from);
};
#include "OverlayAlgBase/OverlayAlgBase.icc"
#endif/*OVERLAYALGBASE_H*/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "StoreGate/DataHandle.h"
#include "StoreGate/StoreGateSvc.h"
#include "AthenaBaseComps/AthMsgStreamMacros.h"
#include <typeinfo>
//================================================================
template <class TypeToBeRemoved>
void OverlayAlgBase::removeAllObjectsOfType(StoreGateSvc* sg) {
// could use: templateClassName = abi::__cxa_demangle(typeid(TypeToBeRemoved).name(), 0, 0, &status);
// but this would be gcc-specific. So templateClassName is mangled on the output.
const std::string templateClassName = typeid(TypeToBeRemoved).name();
const DataHandle<TypeToBeRemoved> data;
const DataHandle<TypeToBeRemoved> dataEnd;
if(sg->retrieve(data, dataEnd).isSuccess()) {
ATH_MSG_DEBUG("removeAllObjectsOfType<"<<templateClassName<<">(): retrieved data for removal");
for( ; data != dataEnd; data++ ) {
ATH_MSG_DEBUG("removeAllObjectsOfType<"<<templateClassName<<">(): Working on p="<<data.cptr()<<", key="<<sg->proxy(data.cptr())->name());
if(!sg->removeDataAndProxy(data.cptr()).isSuccess()) {
ATH_MSG_WARNING("removeAllObjectsOfType<"<<templateClassName<<">(): problem removing object p="<<data.cptr()<<", key="<<sg->proxy(data.cptr())->name());
}
}
}
else {
ATH_MSG_WARNING("removeAllObjectsOfType<"<<templateClassName<<">(): Problem retrieving data for removal");
}
}
//================================================================
template <class TypeToBeCopied>
void OverlayAlgBase::copyAllObjectsOfType(StoreGateSvc* to, StoreGateSvc *from) {
// could use: templateClassName = abi::__cxa_demangle(typeid(TypeToBeCopied).name(), 0, 0, &status);
// but this would be gcc-specific. So templateClassName is mangled on the output.
const std::string templateClassName = typeid(TypeToBeCopied).name();
typedef std::vector<std::string> KeyList;
KeyList keys = from->keys<TypeToBeCopied>();
if(keys.empty()) {
ATH_MSG_WARNING("copyAllObjectsOfType<"<<templateClassName<<">(): no keys found");
}
for(KeyList::const_iterator k=keys.begin(); k!=keys.end(); ++k) {
std::auto_ptr<TypeToBeCopied> ap(from->retrievePrivateCopy<TypeToBeCopied>(*k));
ATH_MSG_DEBUG("copyAllObjectsOfType<"<<templateClassName<<">(): Working on p="<<ap.get()<<", key="<<*k);
if(!to->record(ap, *k).isSuccess()) {
ATH_MSG_WARNING("copyAllObjectsOfType<"<<templateClassName<<">(): problem recording object p="<<ap.get()<<", key="<<*k);
}
}
}
//================================================================
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// Andrei Gaponenko, 2006-2009
#include "OverlayAlgBase/OverlayAlgBase.h"
#include "AthenaBaseComps/AthMsgStreamMacros.h"
#include "StoreGate/StoreGateSvc.h"
//================================================================
OverlayAlgBase::OverlayAlgBase(const std::string &name, ISvcLocator *pSvcLocator) :
AthAlgorithm(name, pSvcLocator),
m_storeGateData("StoreGateSvc/OriginalEvent_SG", name),
m_storeGateMC("StoreGateSvc/BkgEvent_0_SG", name),
m_storeGateOutput("StoreGateSvc/StoreGateSvc", name)
{
declareProperty("DataStore", m_storeGateData, "help");
declareProperty("MCStore", m_storeGateMC, "help");
declareProperty("OutputStore", m_storeGateOutput, "help"); //FIXME this should be dropped in favour of the evtStore method of AthAlgorithm
}
//================================================================
StatusCode OverlayAlgBase::initialize()
{
ATH_MSG_DEBUG("OverlayAlgBase::initialize()");
if (m_storeGateData.retrieve().isFailure()) {
ATH_MSG_FATAL("OverlayAlgBase::initialize): StoreGate[data] service not found !");
return StatusCode::FAILURE;
}
if (m_storeGateMC.retrieve().isFailure()) {
ATH_MSG_FATAL("OverlayAlgBase::initialize): StoreGate[MC] service not found !");
return StatusCode::FAILURE;
}
if (m_storeGateOutput.retrieve().isFailure()) {
ATH_MSG_FATAL("OverlayAlgBase::initialize): StoreGate[output] service not found !");
return StatusCode::FAILURE;
}
// Call initialization() of a derived class.
return overlayInitialize();
}
//================================================================
StatusCode OverlayAlgBase::execute() {
ATH_MSG_DEBUG("OverlayAlgBase::execute() begin. Calling derived class execute()");
StatusCode ret = overlayExecute();
ATH_MSG_DEBUG("OverlayAlgBase::execute() end");
return ret;
}
//================================================================
StatusCode OverlayAlgBase::finalize() {
return overlayFinalize();
}
//================================================================
StatusCode OverlayAlgBase::overlayInitialize()
{
ATH_MSG_WARNING("OverlayAlgBase::overlayInitialize() should not be called directly and will be removed in the future.");
return StatusCode::SUCCESS;
}
//================================================================
StatusCode OverlayAlgBase::overlayExecute()
{
ATH_MSG_WARNING("OverlayAlgBase::overlayExecute() should not be called directly and will be removed in the future.");
return StatusCode::SUCCESS;
}
//================================================================
StatusCode OverlayAlgBase::overlayFinalize()
{
ATH_MSG_WARNING("OverlayAlgBase::overlayFinalize() should not be called directly and will be removed in the future.");
return StatusCode::SUCCESS;
}
//================================================================
//EOF
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment