ATLAS Offline Software
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
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 
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
46  // Get TRT helpers
48 
50  (!m_pixClusterContainerKey.key().empty()));
52  (!m_sctClusterContainerKey.key().empty()));
54  (!m_trtDriftCircleContainerKey.key().empty()));
55 
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;
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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
AtlasDetectorID::is_pixel
bool is_pixel(Identifier id) const
Definition: AtlasDetectorID.h:760
IDTPM::ndof
float ndof(const U &p)
Definition: TrackParametersHelper.h:134
TRT_ID::layer_id
Identifier layer_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
For an individual straw layer.
Definition: TRT_ID.h:500
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
AtlasDetectorID::is_sct
bool is_sct(Identifier id) const
Definition: AtlasDetectorID.h:770
PixelCluster.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
InDetPRD_Provider.h
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
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
AtlasDetectorID::is_trt
bool is_trt(Identifier id) const
Definition: AtlasDetectorID.h:782
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
InDet::InDetPRD_Provider::m_trtIdHelper
const TRT_ID * m_trtIdHelper
Definition: InDetPRD_Provider.h:101
SCT_Cluster.h
Identifier::is_valid
bool is_valid() const
Check if id is in a valid state.
InDet::InDetPRD_Provider::InDetPRD_Provider
InDetPRD_Provider(const std::string &t, const std::string &n, const IInterface *p)
Definition: InDetPRD_Provider.cxx:26
PixelID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition: PixelID.h:364
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
InDet::InDetPRD_Provider::m_pixelDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
Definition: InDetPRD_Provider.h:93
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
PixelID::wafer_hash
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
Definition: PixelID.h:387
InDet::InDetPRD_Provider::m_pixIdHelper
const PixelID * m_pixIdHelper
Helper to detect type of sub-detector from PRD->identify().
Definition: InDetPRD_Provider.h:89
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
InDet::InDetPRD_Provider::finalize
StatusCode finalize()
finalize
Definition: InDetPRD_Provider.cxx:62
beamspotman.n
n
Definition: beamspotman.py:731
InDet::InDetPRD_Provider::initialize
StatusCode initialize()
Athena algtool's Hooks.
Definition: InDetPRD_Provider.cxx:37
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SCT_ID::wafer_hash
IdentifierHash wafer_hash(const Identifier &wafer_id) const
wafer hash from id - optimized
Definition: SCT_ID.h:492
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TRT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: TRT_ID.h:866
TRT_ID::straw_layer
int straw_layer(const Identifier &id) const
Definition: TRT_ID.h:893
TRT_ID::layer_or_wheel
int layer_or_wheel(const Identifier &id) const
Definition: TRT_ID.h:884
InDet::InDetPRD_Provider::m_trtDriftCircleContainerKey
SG::ReadHandleKey< TRT_DriftCircleContainer > m_trtDriftCircleContainerKey
Definition: InDetPRD_Provider.h:103
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TRT_DriftCircle.h
Trk::PrepRawData
Definition: PrepRawData.h:62
IdentifierHash.h
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
TRT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: TRT_ID.h:875
InDet::InDetPRD_Provider::m_SCTDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
Definition: InDetPRD_Provider.h:99
SCT_ClusterContainer.h
InDet::InDetPRD_Provider::m_pixClusterContainerKey
SG::ReadHandleKey< PixelClusterContainer > m_pixClusterContainerKey
Definition: InDetPRD_Provider.h:91
AthAlgTool
Definition: AthAlgTool.h:26
SCT_ID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side) const
For a single side of module.
Definition: SCT_ID.h:464
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
TRT_ID::straw_layer_hash
IdentifierHash straw_layer_hash(Identifier straw_layer_id) const
straw_layer hash from id - optimized
Definition: TRT_ID.h:750
InDet::InDetPRD_Provider::m_sctClusterContainerKey
SG::ReadHandleKey< SCT_ClusterContainer > m_sctClusterContainerKey
Definition: InDetPRD_Provider.h:97
InDet::InDetPRD_Provider::m_idHelper
const AtlasDetectorID * m_idHelper
Definition: InDetPRD_Provider.h:87
InDet::InDetPRD_Provider::m_sctIdHelper
const SCT_ID * m_sctIdHelper
Definition: InDetPRD_Provider.h:95
Identifier
Definition: IdentifierFieldParser.cxx:14