Skip to content
Snippets Groups Projects

Use ActiveStoreSvc to pick event store Fix ATLASSIM-4604

Merged Frank Berghaus requested to merge berghaus/athena:ByteStreamEventStore into master
All threads resolved!
2 files
+ 61
46
Compare changes
  • Side-by-side
  • Inline
Files
2
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
//====================================================================
// EventSelectorByteStream.cxx
//====================================================================
//
// Include files.
/* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */
#include "EventSelectorByteStream.h"
#include <vector>
#include <algorithm>
#include "EventContextByteStream.h"
#include "ByteStreamCnvSvc/ByteStreamInputSvc.h"
#include "ByteStreamCnvSvcBase/ByteStreamAddress.h"
@@ -28,38 +24,61 @@
#include "PersistentDataModel/DataHeader.h"
#include "eformat/StreamTag.h"
#include <vector>
#include <algorithm>
// Constructor.
EventSelectorByteStream::EventSelectorByteStream(const std::string& name, ISvcLocator* svcloc)
: base_class(name, svcloc)
{
declareProperty("HelperTools", m_helperTools);
// RunNumber, OldRunNumber and OverrideRunNumberFromInput are used
// to override the run number coming in on the input stream
m_runNo.verifier().setLower(0);
// The following properties are only for compatibility with
// McEventSelector and are not really used anywhere
// TODO: validate if those are even used
m_eventsPerRun.verifier().setLower(0);
m_firstEventNo.verifier().setLower(0);
m_firstLBNo.verifier().setLower(0);
m_eventsPerLB.verifier().setLower(0);
m_initTimeStamp.verifier().setLower(0);
m_inputCollectionsProp.declareUpdateHandler(&EventSelectorByteStream::inputCollectionsHandler, this);
}
//________________________________________________________________________________
EventSelectorByteStream::EventSelectorByteStream(
const std::string& name,
ISvcLocator* svcloc)
: base_class(name, svcloc)
, m_activeStoreSvc("ActiveStoreSvc", name) {
declareProperty("HelperTools", m_helperTools);
// RunNumber, OldRunNumber and OverrideRunNumberFromInput are used
// to override the run number coming in on the input stream
m_runNo.verifier().setLower(0);
// The following properties are only for compatibility with
// McEventSelector and are not really used anywhere
// TODO(berghaus): validate if those are even used
m_eventsPerRun.verifier().setLower(0);
m_firstEventNo.verifier().setLower(0);
m_firstLBNo.verifier().setLower(0);
m_eventsPerLB.verifier().setLower(0);
m_initTimeStamp.verifier().setLower(0);
m_inputCollectionsProp.declareUpdateHandler(
&EventSelectorByteStream::inputCollectionsHandler,
this);
}
/******************************************************************************/
void EventSelectorByteStream::inputCollectionsHandler(Property&) {
if (this->FSMState() != Gaudi::StateMachine::OFFLINE) {
this->reinit().ignore();
}
if (this->FSMState() != Gaudi::StateMachine::OFFLINE) {
this->reinit().ignore();
}
}
//________________________________________________________________________________
/******************************************************************************/
EventSelectorByteStream::~EventSelectorByteStream() {
}
/******************************************************************************/
StoreGateSvc*
EventSelectorByteStream::eventStore() const {
if (m_activeStoreSvc == 0) {
if (!m_activeStoreSvc.retrieve().isSuccess()) {
ATH_MSG_ERROR("Cannot get ActiveStoreSvc");
throw GaudiException(
"Cannot get ActiveStoreSvc", name(), StatusCode::FAILURE);
}
}
return(m_activeStoreSvc->activeStore());
}
//________________________________________________________________________________
StatusCode EventSelectorByteStream::initialize() {
if (m_isSecondary.value()) {
@@ -92,11 +111,6 @@ StatusCode EventSelectorByteStream::initialize() {
ATH_MSG_FATAL("Cannot cast ByteStreamInputSvc");
return(StatusCode::FAILURE);
}
m_eventSource->addRef();
if (!m_evtStore.retrieve().isSuccess()) {
ATH_MSG_FATAL("Cannot get StoreGateSvc");
return(StatusCode::FAILURE);
}
// Get CounterTool (if configured)
if (!m_counterTool.empty()) {
@@ -653,13 +667,13 @@ StatusCode EventSelectorByteStream::recordAttributeList() const
{
std::string listName("EventInfoAtts");
if (m_evtStore->contains<AthenaAttributeList>(listName)) {
if (eventStore()->contains<AthenaAttributeList>(listName)) {
const AthenaAttributeList* oldAttrList = nullptr;
if (!m_evtStore->retrieve(oldAttrList, listName).isSuccess()) {
if (!eventStore()->retrieve(oldAttrList, listName).isSuccess()) {
ATH_MSG_ERROR("Cannot retrieve old AttributeList from StoreGate.");
return(StatusCode::FAILURE);
}
if (!m_evtStore->removeDataAndProxy(oldAttrList).isSuccess()) {
if (!eventStore()->removeDataAndProxy(oldAttrList).isSuccess()) {
ATH_MSG_ERROR("Cannot remove old AttributeList from StoreGate.");
return(StatusCode::FAILURE);
}
@@ -673,7 +687,7 @@ StatusCode EventSelectorByteStream::recordAttributeList() const
ATH_CHECK(fillAttributeList(attrList.get(), "", false));
// put result in event store
if (m_evtStore->record(std::move(attrList), listName).isFailure()) {
if (eventStore()->record(std::move(attrList), listName).isFailure()) {
return StatusCode::FAILURE;
}
@@ -900,7 +914,7 @@ StatusCode EventSelectorByteStream::readEvent(int maxevt) {
//________________________________________________________________________________
StatusCode EventSelectorByteStream::createAddress(const IEvtSelector::Context& /*it*/,
IOpaqueAddress*& iop) const {
SG::DataProxy* proxy = m_evtStore->proxy(ClassID_traits<DataHeader>::ID(),"ByteStreamDataHeader");
SG::DataProxy* proxy = eventStore()->proxy(ClassID_traits<DataHeader>::ID(),"ByteStreamDataHeader");
if (proxy !=0) {
iop = proxy->address();
return(StatusCode::SUCCESS);
Loading