ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetRecTools
InDetAssociationTools
src
InDetPRD_Provider.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// InDetPRD_Provider.cxx, (c) ATLAS Detector software
8
9
#include "
InDetAssociationTools/InDetPRD_Provider.h
"
10
#include "
InDetPrepRawData/PixelCluster.h
"
11
#include "
InDetPrepRawData/SCT_Cluster.h
"
12
#include "
InDetPrepRawData/TRT_DriftCircle.h
"
13
//
14
#include "
InDetPrepRawData/SCT_ClusterContainer.h
"
15
16
// AtlasDetDescr
17
#include "
AtlasDetDescr/AtlasDetectorID.h
"
18
#include "Identifier/Identifier.h"
19
#include "
Identifier/IdentifierHash.h
"
20
// InDetIdentifier
21
#include "
InDetIdentifier/PixelID.h
"
22
#include "
InDetIdentifier/SCT_ID.h
"
23
#include "
InDetIdentifier/TRT_ID.h
"
24
25
26
InDet::InDetPRD_Provider::InDetPRD_Provider
(
const
std::string& t,
const
std::string& n,
const
IInterface* p):
27
AthAlgTool
(t,n,p),
28
m_idHelper
(nullptr),
29
m_pixIdHelper
(nullptr),
30
m_sctIdHelper
(nullptr),
31
m_trtIdHelper
(nullptr)
32
{
33
declareInterface<Trk::IPRD_Provider>(
this
);
34
}
35
36
37
StatusCode
InDet::InDetPRD_Provider::initialize
()
38
{
39
ATH_MSG_VERBOSE
(
"Initializing ..."
);
40
// Set up ATLAS ID helper to be able to identify the PRD's det-subsystem
41
ATH_CHECK
(
detStore
()->retrieve(
m_idHelper
,
"AtlasID"
));
42
// Get Pixel helpers
43
ATH_CHECK
(
detStore
()->retrieve(
m_pixIdHelper
,
"PixelID"
));
44
// Get SCT helpers
45
ATH_CHECK
(
detStore
()->retrieve(
m_sctIdHelper
,
"SCT_ID"
));
46
// Get TRT helpers
47
ATH_CHECK
(
detStore
()->retrieve(
m_trtIdHelper
,
"TRT_ID"
));
48
49
ATH_CHECK
(
m_pixClusterContainerKey
.initialize
50
(!
m_pixClusterContainerKey
.key().empty()));
51
ATH_CHECK
(
m_sctClusterContainerKey
.initialize
52
(!
m_sctClusterContainerKey
.key().empty()));
53
ATH_CHECK
(
m_trtDriftCircleContainerKey
.initialize
54
(!
m_trtDriftCircleContainerKey
.key().empty()));
55
56
ATH_CHECK
(
m_pixelDetEleCollKey
.initialize());
57
ATH_CHECK
(
m_SCTDetEleCollKey
.initialize());
58
59
return
StatusCode::SUCCESS;
60
}
61
62
StatusCode
InDet::InDetPRD_Provider::finalize
()
63
{
64
ATH_MSG_VERBOSE
(
"Finalizing ..."
);
65
return
StatusCode::SUCCESS;
66
}
67
69
const
Trk::PrepRawData
*
InDet::InDetPRD_Provider::prdFromIdentifier
(
const
Identifier
& ide,
size_t
& ndof )
const
{
70
71
// check validity of the Identifier
72
if
(!ide.
is_valid
()){
73
ATH_MSG_VERBOSE
(
"The identifier is not valid ! Return 0."
);
74
return
nullptr
;
75
}
76
77
// is pixel case
78
if
(
m_idHelper
->is_pixel(ide) && !
m_pixClusterContainerKey
.key().empty() ){
79
80
SG::ReadHandle<PixelClusterContainer>
pixClusterContainer(
m_pixClusterContainerKey
);
81
if
(!pixClusterContainer.
isValid
())
82
ATH_MSG_ERROR
(
"Invalid PixelClusterContainer"
);
83
84
ndof = 2;
85
// get the Identifier Hash
86
Identifier
idewafer =
m_pixIdHelper
->wafer_id(ide);
87
IdentifierHash
ideHash =
m_pixIdHelper
->wafer_hash(idewafer);
88
ATH_MSG_VERBOSE
(
"Pixel Identifier found as transformed to hash identifier "
<< (
unsigned
int
)ideHash );
89
if
(!ideHash.
is_valid
()){
90
ATH_MSG_VERBOSE
(
"The hash identifier is not valid ! Return 0."
);
91
return
nullptr
;
92
}
93
return
prdFromIdentifierContainer<InDet::PixelCluster>
(*pixClusterContainer,ide,ideHash);
94
}
95
96
if
(
m_idHelper
->is_sct(ide) && !
m_sctClusterContainerKey
.key().empty() ){
97
SG::ReadHandle<SCT_ClusterContainer>
sctClusterContainer(
m_sctClusterContainerKey
);
98
if
(!sctClusterContainer.
isValid
())
99
ATH_MSG_ERROR
(
"Invalid SCT_ClusterContainer"
);
100
101
// get the Identifier Hash
102
ndof = 1;
103
Identifier
idewafer =
m_sctIdHelper
->wafer_id(ide);
104
IdentifierHash
ideHash =
m_sctIdHelper
->wafer_hash(idewafer);
105
ATH_MSG_VERBOSE
(
"SCT Identifier found as transformed to hash identifier "
<< (
unsigned
int
)ideHash );
106
if
(!ideHash.
is_valid
()){
107
ATH_MSG_VERBOSE
(
"The hash identifier is not valid ! Return 0."
);
108
return
nullptr
;
109
}
110
return
prdFromIdentifierContainer<InDet::SCT_Cluster>
(*sctClusterContainer,ide,ideHash);
111
}
112
113
if
(
m_idHelper
->is_trt(ide) && !
m_trtDriftCircleContainerKey
.key().empty() ){
114
SG::ReadHandle<TRT_DriftCircleContainer>
trtDriftCircleContainer(
m_trtDriftCircleContainerKey
);
115
if
(!trtDriftCircleContainer.
isValid
())
116
ATH_MSG_ERROR
(
"Invalid TRT_DriftCircleContainer"
);
117
118
// get the Identifier Hash
119
ndof = 1;
120
Identifier
idestrawlayer =
m_trtIdHelper
->layer_id(
m_trtIdHelper
->barrel_ec(ide),
121
m_trtIdHelper
->phi_module(ide),
122
m_trtIdHelper
->layer_or_wheel(ide),
123
m_trtIdHelper
->straw_layer(ide));
124
IdentifierHash
ideHash =
m_trtIdHelper
->straw_layer_hash(idestrawlayer);
125
ATH_MSG_VERBOSE
(
"TRT Identifier found as transformed to hash identifier "
<< (
unsigned
int
)ideHash );
126
if
(!ideHash.
is_valid
()){
127
ATH_MSG_VERBOSE
(
"The hash identifier is not valid ! Return 0."
);
128
return
nullptr
;
129
}
130
return
prdFromIdentifierContainer<InDet::TRT_DriftCircle>
(*trtDriftCircleContainer,ide,ideHash);
131
}
132
return
nullptr
;
133
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
IdentifierHash.h
InDetPRD_Provider.h
PixelCluster.h
PixelID.h
This is an Identifier helper class for the Pixel subdetector.
SCT_ClusterContainer.h
SCT_Cluster.h
SCT_ID.h
This is an Identifier helper class for the SCT subdetector.
TRT_DriftCircle.h
TRT_ID.h
This is an Identifier helper class for the TRT subdetector.
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
IdentifierHash::is_valid
constexpr bool is_valid() const
Identifier::is_valid
bool is_valid() const
Check if id is in a valid state.
InDet::InDetPRD_Provider::m_pixClusterContainerKey
SG::ReadHandleKey< PixelClusterContainer > m_pixClusterContainerKey
Definition
InDetPRD_Provider.h:91
InDet::InDetPRD_Provider::finalize
StatusCode finalize()
finalize
Definition
InDetPRD_Provider.cxx:62
InDet::InDetPRD_Provider::prdFromIdentifier
const Trk::PrepRawData * prdFromIdentifier(const Identifier &ide, size_t &ndof) const
return the Prd given the Identifier - make a HashId out of the Id and return the associated PRD
Definition
InDetPRD_Provider.cxx:69
InDet::InDetPRD_Provider::m_sctClusterContainerKey
SG::ReadHandleKey< SCT_ClusterContainer > m_sctClusterContainerKey
Definition
InDetPRD_Provider.h:97
InDet::InDetPRD_Provider::InDetPRD_Provider
InDetPRD_Provider(const std::string &t, const std::string &n, const IInterface *p)
Definition
InDetPRD_Provider.cxx:26
InDet::InDetPRD_Provider::initialize
StatusCode initialize()
Athena algtool's Hooks.
Definition
InDetPRD_Provider.cxx:37
InDet::InDetPRD_Provider::m_trtIdHelper
const TRT_ID * m_trtIdHelper
Definition
InDetPRD_Provider.h:101
InDet::InDetPRD_Provider::m_trtDriftCircleContainerKey
SG::ReadHandleKey< TRT_DriftCircleContainer > m_trtDriftCircleContainerKey
Definition
InDetPRD_Provider.h:103
InDet::InDetPRD_Provider::m_SCTDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
Definition
InDetPRD_Provider.h:99
InDet::InDetPRD_Provider::prdFromIdentifierContainer
const Trk::PrepRawData * prdFromIdentifierContainer(const Trk::PrepRawDataContainer< Trk::PrepRawDataCollection< PrdT > > &cont, const Identifier &ideh, const IdentifierHash &ideHash) const
templated method since used for Pixel/SCT/TRT
Definition
InDetPRD_Provider.h:62
InDet::InDetPRD_Provider::m_sctIdHelper
const SCT_ID * m_sctIdHelper
Definition
InDetPRD_Provider.h:95
InDet::InDetPRD_Provider::m_pixelDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
Definition
InDetPRD_Provider.h:93
InDet::InDetPRD_Provider::m_pixIdHelper
const PixelID * m_pixIdHelper
Helper to detect type of sub-detector from PRD->identify().
Definition
InDetPRD_Provider.h:89
InDet::InDetPRD_Provider::m_idHelper
const AtlasDetectorID * m_idHelper
Definition
InDetPRD_Provider.h:87
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Trk::PrepRawData
Definition
PrepRawData.h:62
Identifier
Definition
IdentifierFieldParser.cxx:14
Generated on
for ATLAS Offline Software by
1.17.0