ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::UnassociatedHitsGetterTool Class Reference

#include <UnassociatedHitsGetterTool.h>

Inheritance diagram for DerivationFramework::UnassociatedHitsGetterTool:
Collaboration diagram for DerivationFramework::UnassociatedHitsGetterTool:

Public Member Functions

 UnassociatedHitsGetterTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~UnassociatedHitsGetterTool ()
virtual StatusCode initialize () override
virtual const MinBiasPRDAssociationget (const EventContext &ctx, bool allowMissing=false) const override
 get method: compute the number of unassociated his wrap the info in a MinBiasPRDAssociation object
virtual void releaseObject (const MinBiasPRDAssociation *p) const override
 delete the pointer created by get

Private Attributes

SG::ReadHandleKey< TrackCollectionm_trackCollection { this, "TrackCollection", "Tracks", "" }
SG::ReadHandleKey< InDet::PixelClusterContainer > m_pixelClusterContainer { this, "PixelClusters", "PixelClusters", ""}
SG::ReadHandleKey< InDet::SCT_ClusterContainer > m_SCTClusterContainer { this, "SCTClusterContainer", "SCT_Clusters", ""}
SG::ReadHandleKey< InDet::TRT_DriftCircleContainer > m_TRTDriftCircleContainer { this, "TRTDriftCircleContainer", "TRT_DriftCircles", ""}
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollectionm_SCTDetEleCollKey {this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"}
ToolHandle< Trk::IPRDtoTrackMapToolm_assoTool {this, "AssociationTool", "InDet::InDetPRDtoTrackMapToolGangedPixels" }
SG::ReadHandleKey< Trk::PRDtoTrackMapm_prdToTrackMapKey {this, "PRDtoTrackMap", "",""}

Detailed Description

Definition at line 31 of file UnassociatedHitsGetterTool.h.

Constructor & Destructor Documentation

◆ UnassociatedHitsGetterTool()

DerivationFramework::UnassociatedHitsGetterTool::UnassociatedHitsGetterTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 20 of file UnassociatedHitsGetterTool.cxx.

22 :
23 base_class(type, name, parent)
24{
25}

◆ ~UnassociatedHitsGetterTool()

DerivationFramework::UnassociatedHitsGetterTool::~UnassociatedHitsGetterTool ( )
virtualdefault

Member Function Documentation

◆ get()

const MinBiasPRDAssociation * DerivationFramework::UnassociatedHitsGetterTool::get ( const EventContext & ctx,
bool allowMissing = false ) const
overridevirtual

get method: compute the number of unassociated his wrap the info in a MinBiasPRDAssociation object

Definition at line 47 of file UnassociatedHitsGetterTool.cxx.

47 {
48
49 // If we fail to find something we need in SG on the first call,
50 // issue a warning and don't try again (this can happen if we're
51 // reading an AOD). But consider it an ERROR if it happens
52 // after the first call.
53
54 // retrieve track collection
55 SG::ReadHandle<TrackCollection> trackCollection(m_trackCollection,ctx);
56 if(!trackCollection.isValid()) {
57 ATH_MSG_FATAL("Track collection " << m_trackCollection.key() << " not found in StoreGate");
58 return nullptr;
59 }
60
61 // Get empty state for PRD association tool.
62 const Trk::PRDtoTrackMap *prd_to_track_map;
63 std::unique_ptr<Trk::PRDtoTrackMap> prd_to_track_map_cleanup;
64 if (!m_prdToTrackMapKey.key().empty()) {
65 SG::ReadHandle<Trk::PRDtoTrackMap> prd_to_track_map_handle(m_prdToTrackMapKey,ctx);
66 if (!prd_to_track_map_handle.isValid()) {
67 ATH_MSG_ERROR( "Failed to get PRDs to track map " << m_prdToTrackMapKey.key());
68 return nullptr;
69 }
70 prd_to_track_map=prd_to_track_map_handle.cptr();
71 }
72 else {
73 prd_to_track_map_cleanup = m_assoTool->createPRDtoTrackMap();
74 // Loop over tracks and add PRDs to the PRD association tool
75 for (const Trk::Track* track : *trackCollection) {
76 StatusCode sc = m_assoTool->addPRDs(*prd_to_track_map_cleanup, *track);
77 if(sc.isFailure()){
78 ATH_MSG_FATAL( "Could not add PRDs to track");
79 return nullptr;
80 }
81 }
82 prd_to_track_map = prd_to_track_map_cleanup.get();
83 }
84
85 std::unique_ptr<MinBiasPRDAssociation> PRDAssociation(std::make_unique<MinBiasPRDAssociation>());
86 if (!m_pixelClusterContainer.key().empty()) {
87 // retrieve pixel clusters
88 SG::ReadHandle<InDet::PixelClusterContainer> pixelClusters(m_pixelClusterContainer,ctx);
89 if(!pixelClusters.isValid()) {
90 ATH_MSG_FATAL("Pixel cluster container '" << m_pixelClusterContainer.key() << "' not found in StoreGate");
91 return nullptr;
92 }
93 // Loop on pixel clusters
94 InDet::PixelClusterContainer::const_iterator pixCollItr = pixelClusters->begin();
95 InDet::PixelClusterContainer::const_iterator pixCollEnd = pixelClusters->end();
96 for(; pixCollItr!=pixCollEnd; ++pixCollItr){
97
98 InDet::PixelClusterCollection::const_iterator pixItr = (*pixCollItr)->begin();
99 InDet::PixelClusterCollection::const_iterator pixEnd = (*pixCollItr)->end();
100 for(; pixItr!=pixEnd; ++pixItr){
101
102 // ask the association tool if the hit was associated
103 if(prd_to_track_map->isUsed(*(*pixItr))) continue;
104
105 // count number of unassociated pixel hits
106 PRDAssociation->nPixelUA++;
107
108 // find out which detector element the hit belongs to
109 const InDetDD::SiDetectorElement *det = (*pixItr)->detectorElement();
110
111 // count pixel barrel unassociated hits
112 if(det->isBarrel()) PRDAssociation->nPixelBarrelUA++;
113
114 // count pixel endcap unassociated hits: use hit Z position to determin A/C side
115 if(det->isEndcap()){
116 if((*pixItr)->globalPosition().z()<0){
117 PRDAssociation->nPixelEndCapCUA++;
118 }else{
119 PRDAssociation->nPixelEndCapAUA++;
120 }
121 }
122
123 // count B-Layer unassociated hits
124 if(det->isBlayer()) PRDAssociation->nBlayerUA++;
125 }
126 }
127 }
128
129 // retrieve SCT clusters
130 if (!m_SCTClusterContainer.key().empty()) {
131 SG::ReadHandle<InDet::SCT_ClusterContainer> SCTClusters(m_SCTClusterContainer,ctx);
132 if(!SCTClusters.isValid()) {
133 ATH_MSG_FATAL("SCT cluster container '" << m_SCTClusterContainer.key() << "' not found in StoreGate");
134 return nullptr;
135 }
136 // Loop on SCT clusters
137 InDet::SCT_ClusterContainer::const_iterator sctCollItr = SCTClusters->begin();
138 InDet::SCT_ClusterContainer::const_iterator sctCollEnd = SCTClusters->end();
139 for(; sctCollItr!=sctCollEnd; ++sctCollItr){
140
141 InDet::SCT_ClusterCollection::const_iterator sctItr = (*sctCollItr)->begin();
142 InDet::SCT_ClusterCollection::const_iterator sctEnd = (*sctCollItr)->end();
143 for(; sctItr!=sctEnd; ++sctItr){
144
145 // ask the association tool if the hit was associated
146 if(prd_to_track_map->isUsed(*(*sctItr))) continue;
147
148 // count number of unassociated SCT hits
149 PRDAssociation->nSCTUA++;
150
151 // find out which detector element the hit belongs to
152 const InDetDD::SiDetectorElement *det = (*sctItr)->detectorElement();
153
154 // count SCT barrel unassociated hits
155 if(det->isBarrel()) PRDAssociation->nSCTBarrelUA++;
156
157 // count SCT endcap unassociated hits: use hit Z position to determin A/C side
158 if(det->isEndcap()){
159 if((*sctItr)->globalPosition().z()<0){
160 PRDAssociation->nSCTEndCapCUA++;
161 }else{
162 PRDAssociation->nSCTEndCapAUA++;
163 }
164 }
165 }
166 }
167 }
168
169 // retrieve TRT drift circles
170 if (!m_TRTDriftCircleContainer.key().empty()) {
171 SG::ReadHandle<InDet::TRT_DriftCircleContainer> TRTDriftCircles(m_TRTDriftCircleContainer,ctx);
172 if(!TRTDriftCircles.isValid()) {
173 ATH_MSG_FATAL("TRT drift circle container '" << m_TRTDriftCircleContainer << "' not found in StoreGate");
174 return nullptr;
175 }
176 // Loop on TRT clusters
177 InDet::TRT_DriftCircleContainer::const_iterator trtCollItr = TRTDriftCircles->begin();
178 InDet::TRT_DriftCircleContainer::const_iterator trtCollEnd = TRTDriftCircles->end();
179 for(; trtCollItr!=trtCollEnd; ++trtCollItr){
180
181 InDet::TRT_DriftCircleCollection::const_iterator trtItr = (*trtCollItr)->begin();
182 InDet::TRT_DriftCircleCollection::const_iterator trtEnd = (*trtCollItr)->end();
183 for(; trtItr!=trtEnd; ++trtItr){
184
185 // ask the association tool if the hit was associated
186 if(prd_to_track_map->isUsed(*(*trtItr))) continue;
187
188 // count number of unassociated TRT hits
189 PRDAssociation->nTRTUA++;
190
191 // find out which detector element the hit belongs to
192 const InDetDD::TRT_BaseElement *det = (*trtItr)->detectorElement();
193
195
196 // count TRT barrel unassociated hits
197 if(type == InDetDD::TRT_BaseElement::BARREL) PRDAssociation->nTRTBarrelUA++;
198
199 // count TRT endcap unassociated hits: use hit Z position to determin A/C side
201 if(det->center().z()<0){
202 PRDAssociation->nTRTEndCapCUA++;
203 }else{
204 PRDAssociation->nTRTEndCapAUA++;
205 }
206 }
207 }
208 }
209 }
210
211 return PRDAssociation.release();
212}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
static Double_t sc
SG::ReadHandleKey< Trk::PRDtoTrackMap > m_prdToTrackMapKey
SG::ReadHandleKey< TrackCollection > m_trackCollection
SG::ReadHandleKey< InDet::PixelClusterContainer > m_pixelClusterContainer
SG::ReadHandleKey< InDet::SCT_ClusterContainer > m_SCTClusterContainer
SG::ReadHandleKey< InDet::TRT_DriftCircleContainer > m_TRTDriftCircleContainer
bool isUsed(const PrepRawData &prd) const
does this PRD belong to at least one track?
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ initialize()

StatusCode DerivationFramework::UnassociatedHitsGetterTool::initialize ( )
overridevirtual

Definition at line 29 of file UnassociatedHitsGetterTool.cxx.

29 {
30
31 CHECK(AthAlgTool::initialize());
32
33 // retrieve PRD association tool
34 ATH_CHECK( m_prdToTrackMapKey.initialize(!m_prdToTrackMapKey.key().empty()));
35 ATH_CHECK( m_assoTool.retrieve(DisableTool{!m_prdToTrackMapKey.key().empty()} ) );
36 ATH_CHECK( m_trackCollection.initialize());
37 ATH_CHECK( m_pixelClusterContainer.initialize( !m_pixelClusterContainer.key().empty()) );
38 ATH_CHECK( m_SCTClusterContainer.initialize( !m_SCTClusterContainer.key().empty()) );
39 // Read Cond Handle Key
40 ATH_CHECK( m_SCTDetEleCollKey.initialize(!m_SCTClusterContainer.key().empty()) );
41
43
44 return StatusCode::SUCCESS;
45}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define CHECK(...)
Evaluate an expression and check for errors.
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey

◆ releaseObject()

void DerivationFramework::UnassociatedHitsGetterTool::releaseObject ( const MinBiasPRDAssociation * p) const
overridevirtual

delete the pointer created by get

Definition at line 214 of file UnassociatedHitsGetterTool.cxx.

214 {
215 if(p) delete p;
216}

Member Data Documentation

◆ m_assoTool

ToolHandle<Trk::IPRDtoTrackMapTool> DerivationFramework::UnassociatedHitsGetterTool::m_assoTool {this, "AssociationTool", "InDet::InDetPRDtoTrackMapToolGangedPixels" }
private

Definition at line 68 of file UnassociatedHitsGetterTool.h.

69{this, "AssociationTool", "InDet::InDetPRDtoTrackMapToolGangedPixels" };

◆ m_pixelClusterContainer

SG::ReadHandleKey<InDet::PixelClusterContainer> DerivationFramework::UnassociatedHitsGetterTool::m_pixelClusterContainer { this, "PixelClusters", "PixelClusters", ""}
private

Definition at line 58 of file UnassociatedHitsGetterTool.h.

59{ this, "PixelClusters", "PixelClusters", ""};

◆ m_prdToTrackMapKey

SG::ReadHandleKey<Trk::PRDtoTrackMap> DerivationFramework::UnassociatedHitsGetterTool::m_prdToTrackMapKey {this, "PRDtoTrackMap", "",""}
private

Definition at line 70 of file UnassociatedHitsGetterTool.h.

71{this, "PRDtoTrackMap", "",""};

◆ m_SCTClusterContainer

SG::ReadHandleKey<InDet::SCT_ClusterContainer> DerivationFramework::UnassociatedHitsGetterTool::m_SCTClusterContainer { this, "SCTClusterContainer", "SCT_Clusters", ""}
private

Definition at line 60 of file UnassociatedHitsGetterTool.h.

61{ this, "SCTClusterContainer", "SCT_Clusters", ""};

◆ m_SCTDetEleCollKey

SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> DerivationFramework::UnassociatedHitsGetterTool::m_SCTDetEleCollKey {this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"}
private

Definition at line 66 of file UnassociatedHitsGetterTool.h.

66{this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"};

◆ m_trackCollection

SG::ReadHandleKey<TrackCollection> DerivationFramework::UnassociatedHitsGetterTool::m_trackCollection { this, "TrackCollection", "Tracks", "" }
private

Definition at line 56 of file UnassociatedHitsGetterTool.h.

57{ this, "TrackCollection", "Tracks", "" };

◆ m_TRTDriftCircleContainer

SG::ReadHandleKey<InDet::TRT_DriftCircleContainer> DerivationFramework::UnassociatedHitsGetterTool::m_TRTDriftCircleContainer { this, "TRTDriftCircleContainer", "TRT_DriftCircles", ""}
private

Definition at line 62 of file UnassociatedHitsGetterTool.h.

63{ this, "TRTDriftCircleContainer", "TRT_DriftCircles", ""};

The documentation for this class was generated from the following files: