ATLAS Offline Software
Loading...
Searching...
No Matches
Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/src/WriteData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
10
11#include "WriteData.h"
12
13// the user data-class definitions
16
17using namespace AthPoolEx;
18
19//___________________________________________________________________________
20WriteData::WriteData(const std::string& name, ISvcLocator* pSvcLocator)
21 : AthReentrantAlgorithm(name, pSvcLocator)
22{
23}
24//___________________________________________________________________________
25StatusCode WriteData::initialize() {
26 ATH_MSG_INFO("in initialize()");
29 return StatusCode::SUCCESS;
30}
31//___________________________________________________________________________
32StatusCode WriteData::execute (const EventContext& ctx) const {
33 ATH_MSG_DEBUG("in execute()");
34
35 int eventNumber = ctx.eventID().event_number();
36 int runNumber = ctx.eventID().run_number();
37 ATH_MSG_INFO("EventInfo event: " << eventNumber << " run: " << runNumber);
38
40 ATH_CHECK( hits.record( std::make_unique<ExampleHitContainer>() ) );
41 for (int i = 0; i < 10; i++) {
42 auto hitObj = std::make_unique<ExampleHit>();
43 hitObj->setX(1.2346 + eventNumber * 100 + 3.21 * i);
44 hitObj->setY(-2.346 + runNumber * 100 - 5.6789 * i);
45 hitObj->setZ(34.567 - eventNumber * 100 + 87.6 / (i + 0.456));
46 hitObj->setDetector("DummyHitDetector");
47 hits->push_back(std::move (hitObj));
48 }
49
50 if (eventNumber == 14) {
51 ATH_MSG_INFO("Now creating ExampleHit alias for event: " << eventNumber);
52 ATH_CHECK( hits.alias (m_aliasKey) );
53 }
54 ATH_MSG_INFO("registered all data");
55 return StatusCode::SUCCESS;
56}
57//___________________________________________________________________________
58StatusCode WriteData::finalize() {
59 ATH_MSG_INFO("in finalize()");
60 return StatusCode::SUCCESS;
61}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
This file contains the class definition for the WriteData class.
This file contains the class definition for the ExampleHitContainer class.
Handle class for recording to StoreGate.
virtual StatusCode initialize() override final
Gaudi Service Interface method implementations:
An algorithm that can be simultaneously executed in multiple threads.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.