ATLAS Offline Software
ALFA_RawDataProvider.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // ALFA_RawDataProvider.cxx
7 // Implementation file for class ALFA_RawDataProvider
9 // (c) ATLAS ALFA Detector software
11 
13 
15 // constructor
17 ALFA_RawDataProvider::ALFA_RawDataProvider(const std::string& name, ISvcLocator* pSvcLocator):
18  AthAlgorithm (name, pSvcLocator),
19  m_robDataProvider("ROBDataProviderSvc",name),
20  m_rawDataTool("ALFA_RawDataProviderTool"),
21  m_ALFA_RawDataCollectionKey(),
22  m_collection()
23 {
24  declareProperty("ALFA_RawDataCollectionKey", m_ALFA_RawDataCollectionKey = "ALFA_RawData");
25  declareProperty ("ProviderTool", m_rawDataTool);
26 }
27 
29 // destructor
32 
34 // initialize() -
37 {
38 
39  msg(MSG::DEBUG) << "ALFA_RawDataProvider::initialize" << endmsg;
40 
41  // Get ROBDataProviderSvc
42  if (m_robDataProvider.retrieve().isFailure())
43  {
44  msg(MSG::FATAL) << "Failed to retrieve service " << m_robDataProvider << endmsg;
45  return StatusCode::FAILURE;
46  } else
47  msg(MSG::DEBUG) << "Retrieved service " << m_robDataProvider << endmsg;
48 
49  // Get ALFARawDataProviderTool
50  if (m_rawDataTool.retrieve().isFailure())
51  {
52  msg(MSG::FATAL) << "Failed to retrieve service " << m_rawDataTool << endmsg;
53  return StatusCode::FAILURE;
54  } else
55  msg(MSG::DEBUG) << "Retrieved service " << m_rawDataTool << endmsg;
56 
57  return StatusCode::SUCCESS;
58 }
59 
60 
61 
62 
63 
65 // execute() -
68 {
69 
70  msg(MSG::DEBUG) << "ALFA_RawDataProvider::EXECUTE" << endmsg;
71 
72 
74  msg(MSG::DEBUG) << " Created ALFA RDO Container" << endmsg;
75 
76  StatusCode sc;
77 
78  sc = evtStore()->record(container, m_ALFA_RawDataCollectionKey);
79 
80  if (sc.isFailure())
81  {
82  msg(MSG::FATAL) << "Unable to record ALFA RDO Container" << endmsg;
83  return StatusCode::FAILURE;
84  } else if (sc.isSuccess()){
85  msg(MSG::DEBUG) << "ALFA RDO Container recorded" << endmsg;
86  }
87 
88 
89 
90  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> listOfRobf;
91  std::vector<unsigned int> ROBIDs;
92  ROBIDs.push_back(0x00840000);
93  ROBIDs.push_back(0x00840001);
94 
95  m_robDataProvider->getROBData(Gaudi::Hive::currentContext(), ROBIDs, listOfRobf);
96 
97 
98  msg(MSG::DEBUG) << " ROB ID " << std::hex <<ROBIDs <<MSG::dec<< endmsg;
99 
100  msg(MSG::DEBUG) << " Number of ROB fragments is " << listOfRobf.size() << endmsg;
101 
102  // ask ALFA_RawDataProviderTool to decode it and to fill the container
103 
104  if (m_rawDataTool->convert(listOfRobf,container).isFailure())
105  {
106  msg(MSG::ERROR) << "BS conversion into RDOs failed" << endmsg;
107  return StatusCode::RECOVERABLE;
108  } else
109  msg(MSG::DEBUG) << " Number of collections in container is " << container->size() << endmsg;
110 
111 
112  // check retrieve from StoreGate ///////////////////////////////////////////////////////////
113 
114  sc = evtStore()->retrieve(container, m_ALFA_RawDataCollectionKey);
115  if (sc.isSuccess())
116  {
117  msg(MSG::DEBUG) << "ALFA RDO Container retrieved" << endmsg;
118  } // end check
119 
120  return StatusCode::SUCCESS;
121 }
122 
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
ALFA_RawDataProvider::~ALFA_RawDataProvider
~ALFA_RawDataProvider()
Destructor.
Definition: ALFA_RawDataProvider.cxx:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
ALFA_RawDataProvider::m_ALFA_RawDataCollectionKey
std::string m_ALFA_RawDataCollectionKey
Definition: ALFA_RawDataProvider.h:62
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ALFA_RawDataProvider::ALFA_RawDataProvider
ALFA_RawDataProvider(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: ALFA_RawDataProvider.cxx:17
ALFA_RawDataProvider::initialize
virtual StatusCode initialize()
Initialize.
Definition: ALFA_RawDataProvider.cxx:36
ALFA_RawDataProvider::m_rawDataTool
ToolHandle< ALFA_RawDataProviderTool > m_rawDataTool
Tool that does the actual work.
Definition: ALFA_RawDataProvider.h:61
ALFA_RawDataProvider::execute
virtual StatusCode execute()
Execute.
Definition: ALFA_RawDataProvider.cxx:67
AthAlgorithm
Definition: AthAlgorithm.h:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ALFA_RawDataProvider.h
ALFA_RawDataProvider::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Service for reading bytestream.
Definition: ALFA_RawDataProvider.h:58
ALFA_RawDataContainer
This container provides acces to the PMF RDOs.
Definition: ALFA_RawDataContainer.h:21
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.