ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetRecTools
SiClusterizationTool
src
HitsToxAODCopier.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
HitsToxAODCopier.h
"
6
namespace
InDet
{
7
HitsToxAODCopier::HitsToxAODCopier
(
const
std::string& name,
8
ISvcLocator* pSvcLocator)
9
:
AthReentrantAlgorithm
(name, pSvcLocator) {}
10
11
12
StatusCode
HitsToxAODCopier::initialize
() {
13
ATH_CHECK
(
m_pixelRDOTool
.retrieve());
14
ATH_CHECK
(
m_pixelRdoContainerKey
.initialize());
15
ATH_CHECK
(
m_pixelOutputKey
.initialize());
16
ATH_CHECK
(
m_stripRdoContainerKey
.initialize());
17
ATH_CHECK
(
m_stripOutputKey
.initialize());
18
19
ATH_CHECK
(
detStore
()->retrieve(
m_pixelIdHelper
,
"PixelID"
));
20
ATH_CHECK
(
detStore
()->retrieve(
m_stripIdHelper
,
"SCT_ID"
));
21
22
return
StatusCode::SUCCESS;
23
}
24
25
StatusCode
HitsToxAODCopier::execute
(
const
EventContext& context)
const
{
26
ATH_CHECK
(
exportPixel
(context));
27
ATH_CHECK
(
exportStrip
(context));
28
return
StatusCode::SUCCESS;
29
}
30
31
StatusCode
HitsToxAODCopier::exportPixel
(
const
EventContext& context)
const
{
32
SG::ReadHandle<PixelRDO_Container>
rdoContainer =
33
SG::makeHandle
(
m_pixelRdoContainerKey
, context);
34
ATH_CHECK
(rdoContainer.
isValid
());
35
36
auto
output = std::make_unique<xAOD::BaseContainer>();
37
auto
outputAux = std::make_unique<xAOD::AuxContainerBase>();
38
output->setStore(outputAux.get());
39
static
const
SG::AuxElement::Accessor<int> col(
"col"
);
40
static
const
SG::AuxElement::Accessor<int> row(
"row"
);
41
static
const
SG::AuxElement::Accessor<int> tot(
"tot"
);
42
static
const
SG::AuxElement::Accessor<int> eta_module(
"eta_module"
);
43
static
const
SG::AuxElement::Accessor<int> phi_module(
"phi_module"
);
44
static
const
SG::AuxElement::Accessor<int> layer_disk(
"layer_disk"
);
45
static
const
SG::AuxElement::Accessor<int> barrel_ec(
"barrel_ec"
);
46
static
const
SG::AuxElement::Accessor<uint64_t> id(
"detid"
);
47
48
for
(
const
auto
*collection : *rdoContainer) {
49
const
InDetDD::SiDetectorElement
* element =
50
m_pixelRDOTool
->checkCollection(*collection, context);
51
if
(element !=
nullptr
) {
52
std::vector<InDet::UnpackedPixelRDO> hits =
53
m_pixelRDOTool
->getUnpackedPixelRDOs(*collection, *
m_pixelIdHelper
,
54
element, context);
55
for
(
auto
hit
: hits) {
56
auto
* item =
new
SG::AuxElement
();
57
output->push_back(item);
58
col(*item) =
hit
.COL;
59
row(*item) =
hit
.ROW;
60
tot(*item) =
hit
.TOT;
61
eta_module(*item) =
m_pixelIdHelper
->eta_module(
hit
.ID);
62
phi_module(*item) =
m_pixelIdHelper
->phi_module(
hit
.ID);
63
layer_disk(*item) =
m_pixelIdHelper
->layer_disk(
hit
.ID);
64
barrel_ec(*item) =
m_pixelIdHelper
->barrel_ec(
hit
.ID);
65
id(*item) =
hit
.ID.get_compact();
66
}
67
}
68
}
69
auto
outputHandle =
SG::makeHandle
(
m_pixelOutputKey
, context);
70
ATH_CHECK
(outputHandle.record(std::move(output), std::move(outputAux)));
71
72
return
StatusCode::SUCCESS;
73
}
74
75
76
StatusCode
HitsToxAODCopier::exportStrip
(
const
EventContext& context)
const
{
77
SG::ReadHandle<SCT_RDO_Container>
rdoContainer =
78
SG::makeHandle
(
m_stripRdoContainerKey
, context);
79
ATH_CHECK
(rdoContainer.
isValid
());
80
81
auto
output = std::make_unique<xAOD::BaseContainer>();
82
auto
outputAux = std::make_unique<xAOD::AuxContainerBase>();
83
output->setStore(outputAux.get());
84
static
const
SG::AuxElement::Accessor<int>
strip
(
"strip"
);
85
static
const
SG::AuxElement::Accessor<int> side(
"side"
);
86
static
const
SG::AuxElement::Accessor<int> eta_module(
"eta_module"
);
87
static
const
SG::AuxElement::Accessor<int> phi_module(
"phi_module"
);
88
static
const
SG::AuxElement::Accessor<int> layer_disk(
"layer_disk"
);
89
static
const
SG::AuxElement::Accessor<int> barrel_ec(
"barrel_ec"
);
90
static
const
SG::AuxElement::Accessor<uint64_t> id(
"detid"
);
91
92
for
(
const
auto
*collection: *rdoContainer) {
93
if
( collection ==
nullptr
)
continue
;
94
// const IdentifierHash idHash = rdos->identifyHash();
95
for
(
const
auto
*
hit
: *collection) {
96
auto
* item =
new
SG::AuxElement
();
97
output->push_back(item);
98
strip
(*item) =
m_stripIdHelper
->strip(
hit
->identify());
99
side(*item) =
m_stripIdHelper
->side(
hit
->identify());
100
eta_module(*item) =
m_stripIdHelper
->eta_module(
hit
->identify());
101
phi_module(*item) =
m_stripIdHelper
->phi_module(
hit
->identify());
102
layer_disk(*item) =
m_stripIdHelper
->layer_disk(
hit
->identify());
103
barrel_ec(*item) =
m_stripIdHelper
->barrel_ec(
hit
->identify());
104
id(*item) =
hit
->identify().get_compact();
105
}
106
}
107
108
auto
outputHandle =
SG::makeHandle
(
m_stripOutputKey
, context);
109
ATH_CHECK
(outputHandle.record(std::move(output), std::move(outputAux)));
110
return
StatusCode::SUCCESS;
111
}
112
113
}
// namespace InDet
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
SiliconTech::strip
@ strip
Definition
FPGATrackSimTypes.h:25
HitsToxAODCopier.h
hit
bool hit(const Container &ids, int pdgId)
Definition
JetIRCSafeLabelTool.cxx:64
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
InDetDD::SiDetectorElement
Class to hold geometrical description of a silicon detector element.
Definition
SiDetectorElement.h:109
InDet::HitsToxAODCopier::m_stripIdHelper
const SCT_ID * m_stripIdHelper
Definition
HitsToxAODCopier.h:50
InDet::HitsToxAODCopier::m_pixelRdoContainerKey
SG::ReadHandleKey< PixelRDO_Container > m_pixelRdoContainerKey
Definition
HitsToxAODCopier.h:38
InDet::HitsToxAODCopier::m_stripOutputKey
SG::WriteHandleKey< xAOD::BaseContainer > m_stripOutputKey
Definition
HitsToxAODCopier.h:46
InDet::HitsToxAODCopier::m_stripRdoContainerKey
SG::ReadHandleKey< SCT_RDO_Container > m_stripRdoContainerKey
Definition
HitsToxAODCopier.h:40
InDet::HitsToxAODCopier::exportStrip
StatusCode exportStrip(const EventContext &context) const
Definition
HitsToxAODCopier.cxx:76
InDet::HitsToxAODCopier::exportPixel
StatusCode exportPixel(const EventContext &context) const
Definition
HitsToxAODCopier.cxx:31
InDet::HitsToxAODCopier::initialize
virtual StatusCode initialize() override
Definition
HitsToxAODCopier.cxx:12
InDet::HitsToxAODCopier::HitsToxAODCopier
HitsToxAODCopier(const std::string &name, ISvcLocator *pSvcLocator)
Definition
HitsToxAODCopier.cxx:7
InDet::HitsToxAODCopier::m_pixelRDOTool
ToolHandle< InDet::PixelRDOTool > m_pixelRDOTool
Definition
HitsToxAODCopier.h:36
InDet::HitsToxAODCopier::m_pixelIdHelper
const PixelID * m_pixelIdHelper
Definition
HitsToxAODCopier.h:49
InDet::HitsToxAODCopier::execute
virtual StatusCode execute(const EventContext &context) const override
Definition
HitsToxAODCopier.cxx:25
InDet::HitsToxAODCopier::m_pixelOutputKey
SG::WriteHandleKey< xAOD::BaseContainer > m_pixelOutputKey
Definition
HitsToxAODCopier.h:43
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
InDet
Primary Vertex Finder.
Definition
VP1ErrorUtils.h:36
SG::AuxElement
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
Generated on
for ATLAS Offline Software by
1.17.0