ATLAS Offline Software
Loading...
Searching...
No Matches
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
13//
15
16// AtlasDetDescr
18#include "Identifier/Identifier.h"
20// InDetIdentifier
24
25
26InDet::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
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
50 (!m_pixClusterContainerKey.key().empty()));
52 (!m_sctClusterContainerKey.key().empty()));
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
63{
64 ATH_MSG_VERBOSE("Finalizing ...");
65 return StatusCode::SUCCESS;
66}
67
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
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() ){
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() ){
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
This is an Identifier helper class for the TRT subdetector.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
This is a "hash" representation of an Identifier.
bool is_valid() const
Check if id is in a valid state.
bool is_valid() const
Check if id is in a valid state.
SG::ReadHandleKey< PixelClusterContainer > m_pixClusterContainerKey
StatusCode finalize()
finalize
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
SG::ReadHandleKey< SCT_ClusterContainer > m_sctClusterContainerKey
InDetPRD_Provider(const std::string &t, const std::string &n, const IInterface *p)
StatusCode initialize()
Athena algtool's Hooks.
SG::ReadHandleKey< TRT_DriftCircleContainer > m_trtDriftCircleContainerKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
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
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
const PixelID * m_pixIdHelper
Helper to detect type of sub-detector from PRD->identify().
const AtlasDetectorID * m_idHelper
virtual bool isValid() override final
Can the handle be successfully dereferenced?