ATLAS Offline Software
InDetPRD_Provider.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 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_pixClusterContainerName(""),
31  m_pixClusterContainer(nullptr),
32  m_sctIdHelper(nullptr),
33  m_sctClusterContainerName(""),
34  m_sctClusterContainer(nullptr),
35  m_trtIdHelper(nullptr),
36  m_trtDriftCircleContainerName(""),
37  m_trtDriftCircleContainer(nullptr)
38 {
39  declareInterface<Trk::IPRD_Provider>(this);
40  // PRD container name
41  declareProperty("PixelClusterContainer", m_pixClusterContainerName);
42  declareProperty("SCT_ClusterContainer", m_sctClusterContainerName);
43  declareProperty("TRT_DriftCircleContainer", m_trtDriftCircleContainerName);
44 }
45 
46 
48 {
49  ATH_MSG_VERBOSE("Initializing ...");
50  // Set up ATLAS ID helper to be able to identify the PRD's det-subsystem
51  ATH_CHECK(detStore()->retrieve(m_idHelper, "AtlasID"));
52  // Get Pixel helpers
53  ATH_CHECK(detStore()->retrieve(m_pixIdHelper, "PixelID"));
54  // Get SCT helpers
56  // Get TRT helpers
58 
61 
62  return StatusCode::SUCCESS;
63 }
64 
66 {
67  ATH_MSG_VERBOSE("Finalizing ...");
68  return StatusCode::SUCCESS;
69 }
70 
72  if (not m_pixClusterContainerName.empty()){
74  }
75  if (not m_sctClusterContainerName.empty()){
77  }
78  if (not m_trtDriftCircleContainerName.empty()){
80  }
81  return StatusCode::SUCCESS;
82 }
83 
84 
87 
88  // check validity of the Identifier
89  if (!ide.is_valid()){
90  ATH_MSG_VERBOSE("The identifier is not valid ! Return 0.");
91  return nullptr;
92  }
93  // is pixel case
95  ndof = 2;
96  // get the Identifier Hash
97  Identifier idewafer = m_pixIdHelper->wafer_id(ide);
98  IdentifierHash ideHash = m_pixIdHelper->wafer_hash(idewafer);
99  ATH_MSG_VERBOSE("Pixel Identifier found as transformed to hash identifier " << (unsigned int)ideHash );
100  if (!ideHash.is_valid()){
101  ATH_MSG_VERBOSE("The hash identifier is not valid ! Return 0.");
102  return nullptr;
103  }
104  return prdFromIdentifierContainer<InDet::PixelCluster>(*m_pixClusterContainer,ide,ideHash);
105  }
106 
107  if ( m_idHelper->is_sct(ide) && m_sctClusterContainer ){
108  // get the Identifier Hash
109  ndof = 1;
110  Identifier idewafer = m_sctIdHelper->wafer_id(ide);
111  IdentifierHash ideHash = m_sctIdHelper->wafer_hash(idewafer);
112  ATH_MSG_VERBOSE("SCT Identifier found as transformed to hash identifier " << (unsigned int)ideHash );
113  if (!ideHash.is_valid()){
114  ATH_MSG_VERBOSE("The hash identifier is not valid ! Return 0.");
115  return nullptr;
116  }
117  return prdFromIdentifierContainer<InDet::SCT_Cluster>(*m_sctClusterContainer,ide,ideHash);
118  }
119 
121  // get the Identifier Hash
122  ndof = 1;
126  m_trtIdHelper->straw_layer(ide));
127  IdentifierHash ideHash = m_trtIdHelper->straw_layer_hash(idestrawlayer);
128  ATH_MSG_VERBOSE("TRT Identifier found as transformed to hash identifier " << (unsigned int)ideHash );
129  if (!ideHash.is_valid()){
130  ATH_MSG_VERBOSE("The hash identifier is not valid ! Return 0.");
131  return nullptr;
132  }
133  return prdFromIdentifierContainer<InDet::TRT_DriftCircle>(*m_trtDriftCircleContainer,ide,ideHash);
134  }
135  return nullptr;
136 }
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:142
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...
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
AtlasDetectorID::is_sct
bool is_sct(Identifier id) const
Definition: AtlasDetectorID.h:770
PixelCluster.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
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:86
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
InDet::InDetPRD_Provider::m_sctClusterContainerName
std::string m_sctClusterContainerName
Definition: InDetPRD_Provider.h:97
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
InDet::InDetPRD_Provider::m_trtIdHelper
const TRT_ID * m_trtIdHelper
Definition: InDetPRD_Provider.h:102
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_pixClusterContainerName
std::string m_pixClusterContainerName
Definition: InDetPRD_Provider.h:91
InDet::InDetPRD_Provider::retrieveCollection
StatusCode retrieveCollection()
retrieve the PRD collection from StoreGate
Definition: InDetPRD_Provider.cxx:71
InDet::InDetPRD_Provider::m_pixelDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
Definition: InDetPRD_Provider.h:94
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
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:90
InDet::InDetPRD_Provider::finalize
StatusCode finalize()
finalize
Definition: InDetPRD_Provider.cxx:65
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
beamspotman.n
n
Definition: beamspotman.py:731
InDet::InDetPRD_Provider::initialize
StatusCode initialize()
Athena algtool's Hooks.
Definition: InDetPRD_Provider.cxx:47
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
InDet::InDetPRD_Provider::m_trtDriftCircleContainer
const TRT_DriftCircleContainer * m_trtDriftCircleContainer
Definition: InDetPRD_Provider.h:104
SCT_ID::wafer_hash
IdentifierHash wafer_hash(const Identifier &wafer_id) const
wafer hash from id - optimized
Definition: SCT_ID.h:492
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
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_pixClusterContainer
const PixelClusterContainer * m_pixClusterContainer
Definition: InDetPRD_Provider.h:92
InDet::InDetPRD_Provider::m_SCTDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
Definition: InDetPRD_Provider.h:100
SCT_ClusterContainer.h
InDet::InDetPRD_Provider::m_sctClusterContainer
const SCT_ClusterContainer * m_sctClusterContainer
Definition: InDetPRD_Provider.h:98
InDet::InDetPRD_Provider::m_trtDriftCircleContainerName
std::string m_trtDriftCircleContainerName
Definition: InDetPRD_Provider.h:103
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
Definition: IdentifierHash.h:38
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_idHelper
const AtlasDetectorID * m_idHelper
Definition: InDetPRD_Provider.h:88
InDet::InDetPRD_Provider::m_sctIdHelper
const SCT_ID * m_sctIdHelper
Definition: InDetPRD_Provider.h:96