ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonPhaseII
MuonCnv
xAODMuonTrkPrepDataCnv
src
xTgcMeasToTrkPrdCnvAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
xTgcMeasToTrkPrdCnvAlg.h
"
6
7
#include "
StoreGate/WriteHandle.h
"
8
9
10
namespace
{
11
using
Link_t
=
ElementLink<Muon::TgcPrepDataCollection>
;
12
static
const
SG::Decorator<Link_t>
dec_link{
"tgcTrkPrdLink"
};
13
}
14
15
namespace
MuonR4
{
16
StatusCode
xTgcMeasToTrkPrdCnvAlg::initialize
() {
17
ATH_CHECK
(
m_idHelperSvc
.retrieve());
18
ATH_CHECK
(
m_readKey
.initialize());
19
ATH_CHECK
(
m_writeKey
.initialize());
20
ATH_CHECK
(
m_detMgrKey
.initialize());
21
ATH_CHECK
(
m_linkKey
.initialize());
22
return
StatusCode::SUCCESS;
23
}
24
25
StatusCode
xTgcMeasToTrkPrdCnvAlg::execute
(
const
EventContext& ctx)
const
{
26
const
MuonGM::MuonDetectorManager
* detMgr{};
27
const
xAOD::TgcStripContainer
* strips{
nullptr
};
28
ATH_CHECK
(
SG::get
(detMgr,
m_detMgrKey
, ctx));
29
ATH_CHECK
(
SG::get
(strips,
m_readKey
, ctx));
30
std::vector<std::unique_ptr<Muon::TgcPrepDataCollection>> prdCollections{};
31
const
TgcIdHelper
& idHelper{
m_idHelperSvc
->tgcIdHelper()};
32
prdCollections.resize(idHelper.
module_hash_max
());
33
34
for
(
const
xAOD::TgcStrip
* meas : *strips) {
35
const
Identifier
measId = meas->identify();
36
const
IdentifierHash
modHash{
m_idHelperSvc
->moduleHash(measId)};
37
38
std::unique_ptr<Muon::TgcPrepDataCollection>& coll = prdCollections[modHash];
39
if
(!coll) {
40
coll = std::make_unique<Muon::TgcPrepDataCollection>(modHash);
41
coll->setIdentifier(
m_idHelperSvc
->chamberId(measId));
42
}
43
const
MuonGM::TgcReadoutElement
* outEle = detMgr->
getTgcReadoutElement
(measId);
44
Amg::Vector2D
locPos = meas->localMeasurementPos().block<2,1>(0,0);
45
auto
outPrd = std::make_unique<Muon::TgcPrepData>(meas->identify(),
46
outEle->
identifyHash
(),
47
std::move(locPos),
48
std::vector<Identifier>{meas->identify()},
49
xAOD::toEigen(meas->localCovariance<1>()),
50
outEle,
51
meas->bcBitMap());
52
outPrd->setHashAndIndex(coll->identifyHash(), coll->size());
53
dec_link(*meas) =
Link_t
{*coll, coll->size()};
54
coll->push_back(std::move(outPrd));
55
56
}
57
58
60
auto
outContainer = std::make_unique<Muon::TgcPrepDataContainer>(idHelper.
module_hash_max
());
61
for
(std::unique_ptr<Muon::TgcPrepDataCollection>& coll : prdCollections){
62
if
(!coll)
continue
;
63
const
IdentifierHash
hash = coll->identifyHash();
64
ATH_CHECK
(outContainer->addCollection(coll.release(), hash));
65
}
66
SG::WriteHandle
writeHandle{
m_writeKey
, ctx};
67
ATH_CHECK
(writeHandle.
record
(std::move(outContainer)));
68
return
StatusCode::SUCCESS;
69
}
70
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
Link_t
ElementLink< xAOD::TruthParticleContainer > Link_t
Definition
MuonToTruthAssocAlg.cxx:14
WriteHandle.h
Handle class for recording to StoreGate.
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:51
MuonGM::MuonDetectorManager::getTgcReadoutElement
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition
MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:259
MuonGM::MuonReadoutElement::identifyHash
IdentifierHash identifyHash() const override final
Returns the IdentifierHash of the MuonStation, i.e.
Definition
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:174
MuonGM::TgcReadoutElement
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Definition
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h:42
MuonIdHelper::module_hash_max
size_type module_hash_max() const
the maximum hash value
Definition
MuonIdHelper.cxx:755
MuonR4::xTgcMeasToTrkPrdCnvAlg::m_linkKey
SG::WriteDecorHandleKey< xAOD::TgcStripContainer > m_linkKey
Definition
xTgcMeasToTrkPrdCnvAlg.h:35
MuonR4::xTgcMeasToTrkPrdCnvAlg::m_readKey
SG::ReadHandleKey< xAOD::TgcStripContainer > m_readKey
Definition
xTgcMeasToTrkPrdCnvAlg.h:33
MuonR4::xTgcMeasToTrkPrdCnvAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
xTgcMeasToTrkPrdCnvAlg.cxx:25
MuonR4::xTgcMeasToTrkPrdCnvAlg::m_detMgrKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_detMgrKey
Definition
xTgcMeasToTrkPrdCnvAlg.h:39
MuonR4::xTgcMeasToTrkPrdCnvAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition
xTgcMeasToTrkPrdCnvAlg.h:31
MuonR4::xTgcMeasToTrkPrdCnvAlg::initialize
virtual StatusCode initialize() override final
Definition
xTgcMeasToTrkPrdCnvAlg.cxx:16
MuonR4::xTgcMeasToTrkPrdCnvAlg::m_writeKey
SG::WriteHandleKey< Muon::TgcPrepDataContainer > m_writeKey
Definition
xTgcMeasToTrkPrdCnvAlg.h:37
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
TgcIdHelper
Definition
TgcIdHelper.h:50
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition
GeoPrimitives.h:48
Identifier
Definition
IdentifierFieldParser.cxx:14
MuonR4
This header ties the generic definitions in this package.
Definition
GlobalPattern.h:14
SG::Decorator
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
Definition
AuxElement.h:576
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition
ReadCondHandle.h:282
xAOD::TgcStrip
TgcStrip_v1 TgcStrip
Definition
TgcStripFwd.h:9
xAOD::TgcStripContainer
TgcStripContainer_v1 TgcStripContainer
Definition
TgcStripContainer.h:14
xTgcMeasToTrkPrdCnvAlg.h
Generated on
for ATLAS Offline Software by
1.17.0