5#include "GaudiKernel/ConcurrencyFlags.h"
19 ISvcLocator* svc) : base_class(name, svc),
24 declareProperty(
"NSlots",
m_nSlots,
"number of event slots");
38 Gaudi::Concurrency::ConcurrencyFlags::setNumProcs(numProcs);
50 return StatusCode::SUCCESS;
59 StatusCode
rc(StatusCode::FAILURE);
61 rc=
m_slots[slotIndex].pEvtStore->clearStore();
66 if (!
rc.isSuccess()) {
79 if(FSMState() == Gaudi::StateMachine::INITIALIZED) {
80 SG_MSG_FATAL (
"Too late to change the number of slots!");
81 return StatusCode::FAILURE;
86 Gaudi::Concurrency::ConcurrencyFlags::setNumConcEvents( slots );
87 return StatusCode::SUCCESS;
105 SG_MSG_ERROR (
"No slots available for event number {}", evtNumber);
106 return std::string::npos;
111 SG_MSG_ERROR (
"Attempt to allocate an event slot for an event that is still active: event number {}", evtNumber);
112 return std::string::npos;
120 SG_MSG_ERROR (
"No slots available for event number {}", evtNumber);
121 return std::string::npos;
132 if (
m_slots[slotIndex].eventNumber == -1) {
136 m_slots[slotIndex].eventNumber = -1;
140 return StatusCode::SUCCESS;
143 return StatusCode::FAILURE;
158 return std::string::npos;
168 std::string key =
id.key();
169 key.erase(0,key.find(
'+')+1);
171 if (
id.clid() == 0) {
175 std::string cl =
id.fullKey();
176 cl.erase(cl.find(
'/'),cl.length());
178 DataObjID d2(std::move(cl),key);
179 return m_hiveStore->transientContains(d2.clid(), key);
181 return m_hiveStore->transientContains(
id.clid(), key);
189 if ( !(Service::initialize().isSuccess()) ) {
191 return StatusCode::FAILURE;
196 return StatusCode::FAILURE;
203 for(
size_t i = 0; i<
m_nSlots; ++i) {
204 std::ostringstream oss;
205 std::print (oss,
"{}_{}", i,
m_hiveStore->currentStore()->name());
207 child->initialize().isSuccess() &&
208 0 != (pSG =
dynamic_cast<SGImplSvc*
>(child)) )
213 SG_MSG_FATAL (
"Unable to clone event store {}", oss.str());
214 return StatusCode::FAILURE;
219 Gaudi::Concurrency::ConcurrencyFlags::setNumConcEvents(
m_nSlots );
230 CHECK( s.pEvtStore->finalize() );
231 s.pEvtStore->release();
234 return StatusCode::SUCCESS;
245 slot.pEvtStore->mergeStringPool (*
m_hiveStore->currentStore());
247 return StatusCode::SUCCESS;
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
__thread HiveEventSlot * s_current(0)
#define SG_MSG_DEBUG(x,...)
#define SG_MSG_VERBOSE(x,...)
#define SG_MSG_INFO(x,...)
#define SG_MSG_FATAL(x,...)
#define SG_MSG_ERROR(x,...)
The Athena Transient Store API.
void setSlotNumber(int slot, int numSlots)
Set the Hive slot number for this store.
virtual StatusCode start() override
virtual size_t allocateStore(int evtnumber) override
Allocate a store slot for new event.
HiveMgrSvc(const std::string &name, ISvcLocator *svc)
Standard Service Constructor. sets active store to default event store.
virtual size_t getNumberOfStores() const override
Get the number of 'slots'.
static void setNumProcs(size_t numProcs)
Set number of concurrent processes.
virtual bool exists(const DataObjID &) override
Check if a data object exists in store.
std::atomic< size_t > m_freeSlots
virtual size_t freeSlots() override
Get free slots number.
virtual size_t getPartitionNumber(int eventnumber) const override
Get the slot number corresponding to a given event.
virtual StatusCode selectStore(size_t slotIndex) override
Activate an given 'slot' for all subsequent calls within the same thread id.
ServiceHandle< StoreGateSvc > m_hiveStore
virtual StatusCode clearStore(size_t slotIndex) override
Clear a given 'slot'.
virtual StatusCode setNumberOfStores(size_t slots) override
Set the number of 'slots'.
std::vector< SG::HiveEventSlot > m_slots
virtual StatusCode initialize() override
virtual StatusCode freeStore(size_t slotIndex) override
Free a store slot.
virtual StatusCode finalize() override
static void setSlot(SG::HiveEventSlot *pSlot)
set the hive event slot pointer: used by the event loop mgrs
defines an enum used by address providers to decide what kind of StoreGateSvc they are providing addr...
StatusCode clone(const IService *parent, const std::string &childName, Service *&child)
given a reference to a parent svc sets a reference to a cloned child
virtual void lock() override
Lock the container.