ATLAS Offline Software
ALFA_RawDataProvider_charge.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_charge
9 // (c) ATLAS ALFA Detector software
11 
13 
15 // constructor
17 ALFA_RawDataProvider_charge::ALFA_RawDataProvider_charge(const std::string& name, ISvcLocator* pSvcLocator):
18  AthAlgorithm (name, pSvcLocator),
19  m_robDataProvider("ROBDataProviderSvc",name),
20  m_rawDataTool_charge("ALFA_RawDataProviderTool_charge"),
21  m_ALFA_RawDataCollectionKey_charge(),
22  m_collection()
23 {
24  declareProperty("ALFA_RawDataCollectionKey_charge", m_ALFA_RawDataCollectionKey_charge = "ALFA_RawData_charge");
25  declareProperty ("ProviderTool_charge", m_rawDataTool_charge);
26 }
27 
29 // destructor
32 }
33 
35 // initialize() -
38 
39  msg(MSG::DEBUG) << "ALFA_RawDataProvider_charge::initialize" << endmsg;
40 
41  // Get ROBDataProviderSvc
42  if (m_robDataProvider.retrieve().isFailure()) {
43  msg(MSG::FATAL) << "Failed to retrieve service " << m_robDataProvider << endmsg;
44  return StatusCode::FAILURE;
45  } else
46  msg(MSG::DEBUG) << "Retrieved service " << m_robDataProvider << endmsg;
47 
48  // Get ALFARawDataProviderTool
49  if (m_rawDataTool_charge.retrieve().isFailure()) {
50  msg(MSG::FATAL) << "Failed to retrieve service " << m_rawDataTool_charge << endmsg;
51  return StatusCode::FAILURE;
52  } else
53  msg(MSG::DEBUG) << "Retrieved service " << m_rawDataTool_charge << endmsg;
54 
55  return StatusCode::SUCCESS;
56 }
57 
58 
59 
60 
61 
63 // execute() -
66 
67 msg(MSG::DEBUG) << "ALFA_RawDataProvider_charge::EXECUTE" << endmsg;
68 
69 
71  msg(MSG::DEBUG) << " Created ALFA RDO Container_charge" << endmsg;
72 
73  StatusCode sc;
74 
75  sc = evtStore()->record(container, m_ALFA_RawDataCollectionKey_charge);
76 
77  if (sc.isFailure()) {
78  msg(MSG::FATAL) << "Unable to record ALFA RDO Container_charge" << endmsg;
79  return StatusCode::FAILURE;
80  } else if (sc.isSuccess()){
81  msg(MSG::DEBUG) << "ALFA RDO Container_charge recorded" << endmsg;
82  }
83 
84 
85 
86  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> listOfRobf;
87  std::vector<unsigned int> ROBIDs;
88  ROBIDs.push_back(0x00840000);
89  ROBIDs.push_back(0x00840001);
90 
91  m_robDataProvider->getROBData(ROBIDs, listOfRobf);
92 
93 
94  msg(MSG::DEBUG) << " ROB ID " << std::hex <<ROBIDs <<MSG::dec<< endmsg;
95 
96  msg(MSG::DEBUG) << " Number of ROB fragments is " << listOfRobf.size() << endmsg;
97 
98  // ask ALFA_RawDataProviderTool to decode it and to fill the container
99 
100  if (m_rawDataTool_charge->convert_charge(listOfRobf,container).isFailure()){
101  msg(MSG::ERROR) << "BS conversion into RDOs failed" << endmsg;
102 } else
103  msg(MSG::DEBUG) << " Number of collections in container is " << container->size() << endmsg;
104 
105 
106  // check retrieve from StoreGate ///////////////////////////////////////////////////////////
107 
108  sc = evtStore()->retrieve(container, m_ALFA_RawDataCollectionKey_charge);
109  if (sc.isSuccess())
110  {
111  msg(MSG::DEBUG) << "ALFA RDO Container retrieved" << endmsg;
112  } // end check
113 
114  return StatusCode::SUCCESS;
115 }
116 
ALFA_RawDataProvider_charge::m_rawDataTool_charge
ToolHandle< ALFA_RawDataProviderTool_charge > m_rawDataTool_charge
Tool that does the actual work.
Definition: ALFA_RawDataProvider_charge.h:63
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
ALFA_RawDataProvider_charge::ALFA_RawDataProvider_charge
ALFA_RawDataProvider_charge(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: ALFA_RawDataProvider_charge.cxx:17
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
ALFA_RawDataProvider_charge::m_ALFA_RawDataCollectionKey_charge
std::string m_ALFA_RawDataCollectionKey_charge
Definition: ALFA_RawDataProvider_charge.h:65
ALFA_RawDataProvider_charge::initialize
virtual StatusCode initialize()
Initialize.
Definition: ALFA_RawDataProvider_charge.cxx:37
ALFA_RawDataProvider_charge::~ALFA_RawDataProvider_charge
~ALFA_RawDataProvider_charge()
Destructor.
Definition: ALFA_RawDataProvider_charge.cxx:31
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
ALFA_RawDataProvider_charge::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Service for reading bytestream.
Definition: ALFA_RawDataProvider_charge.h: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
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_charge::execute
virtual StatusCode execute()
Execute.
Definition: ALFA_RawDataProvider_charge.cxx:65
AthAlgorithm
Definition: AthAlgorithm.h:47
ALFA_RawDataProvider_charge.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ALFA_RawDataContainer_charge
This container provides acces to the PMF RDOs.
Definition: ALFA_RawDataContainer_charge.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.