ATLAS Offline Software
SgStressConsumer.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // SgStressConsumer.cxx
8 // Implementation file for class SgStressConsumer
9 // Author: S.Binet<binet@cern.ch>
11 
12 
13 // STL includes
14 #include <sstream>
15 
16 // FrameWork includes
17 #include "Gaudi/Property.h"
18 
19 // StoreGate
20 #include "StoreGate/StoreGateSvc.h"
21 
22 // StoreGateTests includes
23 #include "StoreGateTests/PayLoad.h"
24 #include "SgStressConsumer.h"
25 
27 // Public methods:
29 
30 // Constructors
33  ISvcLocator* pSvcLocator ) :
34  AthAlgorithm( name, pSvcLocator )
35 {
36  //
37  // Property declaration
38  //
39  //declareProperty( "Property", m_nProperty );
40 
41  declareProperty( "DataName",
42  m_dataName = "MyData",
43  "Output location of 'Data' objects" );
44 
45  declareProperty( "NbrOfObjects",
46  m_nObjs = 1000,
47  "Number of 'Data' objects to be stored each event" );
48 
49 }
50 
51 // Destructor
54 {
55  ATH_MSG_DEBUG ( "Calling destructor" );
56 }
57 
58 // Athena Algorithm's Hooks
61 {
62  // configure our MsgStream
63  msg().setLevel( msgLevel() );
64 
65  ATH_MSG_INFO ( "Initializing " << name() << "..." );
66 
67  return StatusCode::SUCCESS;
68 }
69 
71 {
72  ATH_MSG_INFO( "Finalizing " << name() << "..." );
73  return StatusCode::SUCCESS;
74 }
75 
77 {
78  ATH_MSG_DEBUG ( "Executing " << name() << "..." );
79  return readData();
80 }
81 
83 // Non-const methods:
85 
87 {
88  bool allGood = true;
89  for ( std::size_t iObj = 0; iObj != m_nObjs; ++iObj ) {
90  std::ostringstream outName;
91  outName << m_dataName << "_payload_" << iObj;
92  const SgTests::PayLoad * data = 0;
93  const SgTests::PayLoadDv* dv = 0;
94  if ( !evtStore()->retrieve( dv, outName.str() ).isSuccess() ) {
95  ATH_MSG_ERROR( "Could not retrieve payload !!" );
96  allGood = false;
97  }
98 
99  data = (*dv)[0];
100  if ( data->m_data.empty() ) {
101  ATH_MSG_ERROR( "**NOT** my data !!" );
102  allGood = false;
103  }
104  }
105 
106  return allGood ? StatusCode::SUCCESS : StatusCode::FAILURE;
107 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
SgTests::PayLoadDv
Definition: PayLoad.h:34
PlotCalibFromCool.dv
dv
Definition: PlotCalibFromCool.py:762
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
SgStressConsumer::finalize
virtual StatusCode finalize()
Definition: SgStressConsumer.cxx:70
SgStressConsumer::~SgStressConsumer
virtual ~SgStressConsumer()
Destructor:
Definition: SgStressConsumer.cxx:53
SgStressConsumer::m_nObjs
std::size_t m_nObjs
Number of payload objects.
Definition: SgStressConsumer.h:75
SgStressConsumer::initialize
virtual StatusCode initialize()
Definition: SgStressConsumer.cxx:60
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
checkRpcDigits.allGood
bool allGood
Loop over the SDOs & Digits.
Definition: checkRpcDigits.py:171
AthAlgorithm
Definition: AthAlgorithm.h:47
TestSUSYToolsAlg.outName
string outName
Definition: TestSUSYToolsAlg.py:173
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
PayLoad.h
SgStressConsumer::SgStressConsumer
SgStressConsumer()
Default constructor:
SgStressConsumer.h
SgStressConsumer::readData
StatusCode readData()
Retrieve data.
Definition: SgStressConsumer.cxx:86
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
SgStressConsumer::execute
virtual StatusCode execute()
Definition: SgStressConsumer.cxx:76
StoreGateSvc.h
SgStressConsumer::m_dataName
std::string m_dataName
Name of the input data.
Definition: SgStressConsumer.h:72
SgTests::PayLoad
Definition: PayLoad.h:28