ATLAS Offline Software
Loading...
Searching...
No Matches
TGC_RawDataProviderTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8
9//================ Constructor =================================================
10
12 const std::string& t,
13 const std::string& n,
14 const IInterface* p) :
15 base_class(t, n, p)
16{
17}
18
19//================ Initialisation =================================================
20
22{
23 // call base class initialise
25
26 ATH_MSG_INFO( "initialize() successful in " << name() );
27 return StatusCode::SUCCESS;
28}
29
30//============================================================================================
31
32StatusCode Muon::TGC_RawDataProviderTool::convert(const ROBFragmentList& vecRobs) const {
33 return this->convert( vecRobs, Gaudi::Hive::currentContext() );
34}
35
36StatusCode Muon::TGC_RawDataProviderTool::convert(const ROBFragmentList& vecRobs, const EventContext& ctx) const
37{
38
39 SG::WriteHandle<TgcRdoContainer> rdoContainerHandle(m_rdoContainerKey, ctx);
40
41 TgcRdoContainer* rdoContainer = nullptr;
42
43 // if the container is already in store gate, then we have to retrieve from SG
44 if (rdoContainerHandle.isPresent()) {
45 const TgcRdoContainer* rdoContainer_c = nullptr;
46 ATH_CHECK( evtStore()->retrieve( rdoContainer_c, m_rdoContainerKey.key() ) );
47 rdoContainer = const_cast<TgcRdoContainer*>(rdoContainer_c);
48 } else {
49 ATH_CHECK( rdoContainerHandle.record( std::make_unique<TgcRdoContainer> (m_maxhashtoUse) ) );
50 ATH_MSG_DEBUG( "Created TGC container" );
51 rdoContainer = rdoContainerHandle.ptr();
52 }
53
54 // this should never happen, but since we dereference the pointer, we should check
55 if(!rdoContainer) {
56 ATH_MSG_ERROR("TGC RDO Container is null, cannot decode TGC data");
57 return StatusCode::FAILURE;
58 }
59
60 return convertIntoContainer(vecRobs, *rdoContainer);
61}
62
63StatusCode Muon::TGC_RawDataProviderTool::convert(const ROBFragmentList& vecRobs, const std::vector<IdentifierHash>&) const {
64 // This function does not use the IdentifierHash so we pass to the EventContext function which also does not use it
65 return this->convert( vecRobs, Gaudi::Hive::currentContext() );
66}
67
68StatusCode Muon::TGC_RawDataProviderTool::convert(const ROBFragmentList& vecRobs, const std::vector<IdentifierHash>& /*ids*/, const EventContext& ctx) const
69{
70 return convert(vecRobs, ctx);
71}
72
74 return this->convert( Gaudi::Hive::currentContext() );
75}
76
77StatusCode Muon::TGC_RawDataProviderTool::convert(const EventContext& ctx) const
78{
79 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> vecOfRobf;
80 const std::vector<uint32_t>& robIds = m_hid2re.allRobIds();
81
82 m_robDataProvider->getROBData(ctx, robIds, vecOfRobf);
83
84 return convert(vecOfRobf, ctx);
85}
86
87StatusCode Muon::TGC_RawDataProviderTool::convert(const std::vector<IdentifierHash>& rdoIdhVect) const {
88 return this->convert( rdoIdhVect, Gaudi::Hive::currentContext() );
89}
90
91
92StatusCode Muon::TGC_RawDataProviderTool::convert(const std::vector<IdentifierHash>& rdoIdhVect, const EventContext& ctx) const
93{
94 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> vecOfRobf = getROBData(rdoIdhVect, ctx);
95
96 return convert(vecOfRobf, rdoIdhVect, ctx);
97}
98
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
virtual StatusCode initialize()
Standard AlgTool method.
virtual StatusCode convert() const override
New decoding methods which do not use IROBDataProviderSvc in TgcRdoToPrepDataTool.
TGC_RawDataProviderTool(const std::string &t, const std::string &n, const IInterface *p)
Default constructor.
virtual StatusCode convert(const ROBFragmentList &vecRobs) const override
Old decoding method which uses IROBDataProviderSvc in TgcRdoToPrepDataTool.
virtual StatusCode initialize() override
Standard AlgTool method.
bool isPresent() const
Is the referenced object present in SG?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.