ATLAS Offline Software
BCM_RawDataProvider.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // BCM_RawDataProvider.cxx
7 // Implementation file for class BCM_RawDataProvider
9 // Version 00-00-01 12/05/2008 Daniel Dobos
10 // Version 00-00-02 19/05/2008 Daniel Dobos
11 // Version 00-00-11 09/02/2009 Daniel Dobos
13 
17 
19 // destructor
22 }
23 
25 // initialize() -
28 
29  if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "BCM_RawDataProvider::initialize" << endmsg;
30 
31  // Get ROBDataProviderSvc
32  if (m_robDataProvider.retrieve().isFailure()) {
33  if (msgLvl(MSG::FATAL)) msg(MSG::FATAL) << "Failed to retrieve service " << m_robDataProvider << endmsg;
34  return StatusCode::FAILURE;
35  } else
36  if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Retrieved service " << m_robDataProvider << endmsg;
37 
38  // Get BCMRawDataProviderTool
39  if (m_rawDataTool.retrieve().isFailure()) {
40  if (msgLvl(MSG::FATAL)) msg(MSG::FATAL) << "Failed to retrieve tool " << m_rawDataTool << endmsg;
41  return StatusCode::FAILURE;
42  } else
43  if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Retrieved tool " << m_rawDataTool << endmsg;
44 
46 
47  return StatusCode::SUCCESS;
48 }
49 
51 // execute() -
53 StatusCode BCM_RawDataProvider::execute(const EventContext& ctx) const {
54 
55  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Create BCM RDO Container" << endmsg;
56  auto container = std::make_unique<BCM_RDO_Container>();
57 
58  // ask ROBDataProviderSvc for the vector of ROBFragment for all BCM ROBIDs
59  // std::vector<const ROBFragment*> listOfRobf_all;
60  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> listOfRobf;
61 
62  // std::vector<unsigned int> ROBIDs_all;
63  std::vector<unsigned int> ROBIDs;
64  // changed 0x0081000A -> 0x0081004A and 0x0081000C -> 0x0081004C
65  /*
66  // Run-1 IDs
67  ROBIDs_all.push_back(0x0081000A);
68  ROBIDs_all.push_back(0x0081000C);
69 
70  //Run-2 IDs
71  ROBIDs_all.push_back(0x0081004A);
72  ROBIDs_all.push_back(0x0081004C);
73  */
74  //Run-1 ID
75  ROBIDs.push_back(0x0081000A);
76  ROBIDs.push_back(0x0081000C);
77  //Run-2 IDs
78  ROBIDs.push_back(0x0081004A);
79  ROBIDs.push_back(0x0081004C);
80 
81  //m_robDataProvider->getROBData(ROBIDs_all, listOfRobf_all);
82 
83  m_robDataProvider->getROBData(ctx,ROBIDs, listOfRobf);
84 
85  // For Run-1 if 4 fragment present select only the PRO BCM
86  /*
87  if( listOfRobf_all.size() == 4 ) {
88  ROBIDs.push_back(0x0081000A);
89  ROBIDs.push_back(0x0081000C);
90  }
91  */
92 
93  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Number of ROB fragments is " << listOfRobf.size() << endmsg;
94 
95  // ask BCM_RawDataProviderTool to decode it and to fill the container
96  if (m_rawDataTool->convert(listOfRobf,container.get()).isFailure())
97  if (msgLvl(MSG::ERROR)) msg(MSG::ERROR) << "BS conversion into RDOs failed" << endmsg;
98 
99  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Number of collections in container is " << container->size() << endmsg;
100 
101  ATH_CHECK( SG::makeHandle (m_RDO_Key,ctx).record (std::move (container)) );
102 
103  return StatusCode::SUCCESS;
104 }
105 
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
AthCommonMsg< Gaudi::Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
BCM_RawDataProvider::initialize
virtual StatusCode initialize() override
Initialize.
Definition: BCM_RawDataProvider.cxx:27
BCM_RawDataProvider.h
BCM_RawDataProvider::~BCM_RawDataProvider
virtual ~BCM_RawDataProvider()
Destructor.
Definition: BCM_RawDataProvider.cxx:21
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
BCM_RawDataProviderTool.h
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
BCM_RawDataProvider::m_rawDataTool
ToolHandle< BCM_RawDataProviderTool > m_rawDataTool
Definition: BCM_RawDataProvider.h:44
BCM_RawDataProvider::execute
virtual StatusCode execute(const EventContext &ctx) const override
Execute.
Definition: BCM_RawDataProvider.cxx:53
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
BCM_RawDataProvider::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Definition: BCM_RawDataProvider.h:43
BCM_RDO_Container.h
BCM_RawDataProvider::m_RDO_Key
SG::WriteHandleKey< BCM_RDO_Container > m_RDO_Key
Definition: BCM_RawDataProvider.h:45
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24