ATLAS Offline Software
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 
32 StatusCode Muon::TGC_RawDataProviderTool::convert(const ROBFragmentList& vecRobs) const {
33  return this->convert( vecRobs, Gaudi::Hive::currentContext() );
34 }
35 
36 StatusCode 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 
63 StatusCode 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 
68 StatusCode 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 
77 StatusCode 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 
87 StatusCode Muon::TGC_RawDataProviderTool::convert(const std::vector<IdentifierHash>& rdoIdhVect) const {
88  return this->convert( rdoIdhVect, Gaudi::Hive::currentContext() );
89 }
90 
91 
92 StatusCode 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 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TgcRdoContainer
Definition: TgcRdoContainer.h:25
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Muon::TGC_RawDataProviderTool::initialize
virtual StatusCode initialize() override
Standard AlgTool method.
Definition: TGC_RawDataProviderTool.cxx:21
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TgcRdoContainer.h
Muon::TGC_RawDataProviderToolCore::initialize
virtual StatusCode initialize()
Standard AlgTool method.
Definition: TGC_RawDataProviderToolCore.cxx:23
Muon::TGC_RawDataProviderTool::TGC_RawDataProviderTool
TGC_RawDataProviderTool(const std::string &t, const std::string &n, const IInterface *p)
Default constructor.
Definition: TGC_RawDataProviderTool.cxx:11
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TMVAToMVAUtils::convert
std::unique_ptr< MVAUtils::BDT > convert(TMVA::MethodBDT *bdt, bool isRegression=true, bool useYesNoLeaf=false)
Definition: TMVAToMVAUtils.h:114
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Muon::TGC_RawDataProviderTool::convert
virtual StatusCode convert() const override
New decoding methods which do not use IROBDataProviderSvc in TgcRdoToPrepDataTool.
Definition: TGC_RawDataProviderTool.cxx:73
TGC_RawDataProviderTool.h
SG::VarHandleBase::isPresent
bool isPresent() const
Is the referenced object present in SG?
Definition: StoreGate/src/VarHandleBase.cxx:394