ATLAS Offline Software
Loading...
Searching...
No Matches
NnPixelClusterSplitter.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
18
19
21#include "VxVertex/RecVertex.h"
28
29
30
31
33 const std::string &name,
34 const IInterface *parent) :
35 base_class(type,name,parent)
36{
37}
38
40
41 if (m_NnClusterizationFactory.retrieve().isFailure())
42 {
43 ATH_MSG_ERROR(" Unable to retrieve "<< m_NnClusterizationFactory );
44 return StatusCode::FAILURE;
45 }
46
47 ATH_CHECK(m_beamSpotKey.initialize());
48
49 ATH_MSG_DEBUG(" Cluster splitter initialized successfully "<< m_NnClusterizationFactory );
50 return StatusCode::SUCCESS;
51}
52
54 return StatusCode::SUCCESS;
55}
56
57/* default method which simply splits cluster into 2 */
58std::vector<InDet::PixelClusterParts> InDet::NnPixelClusterSplitter::splitCluster(const InDet::PixelCluster& origCluster ) const
59{
60
61 //add treatment for b-layer only HERE
62
63
64 const std::vector<Identifier>& rdos = origCluster.rdoList();
65 const std::vector<int>& totList = origCluster.totList();
66
67 //fill lvl1group all with the same value... (not best way but ...)
68 std::vector<int> lvl1group(rdos.size(),origCluster.LVL1A());
69
70
71
72 std::vector<Amg::Vector2D> allLocalPositions;
73 std::vector<Amg::MatrixX> allErrorMatrix;
74
75
76 std::vector<Amg::MatrixX> errorMatrix;
77
78 Amg::Vector3D beamSpotPosition(0,0,0);
81 beamSpotPosition = beamSpotHandle->beamPos();
82 }
83
84 std::vector<Amg::Vector2D> localPosition=m_NnClusterizationFactory->estimatePositions(origCluster,
85 beamSpotPosition,
86 errorMatrix,
87 2);
88
89
90
91 if (errorMatrix.size()!=2 || localPosition.size()!=2)
92 {
93 ATH_MSG_WARNING("Error matrix or local position vector size is not 2, it is:" << errorMatrix.size() << " or " << localPosition.size() << ".");
94 }
95
96 std::vector<InDet::PixelClusterParts> allMultiPClusters;
97
98
99 allMultiPClusters.emplace_back(rdos,totList,lvl1group,localPosition[0],errorMatrix[0]);
100 allMultiPClusters.emplace_back(rdos,totList,lvl1group,localPosition[1],errorMatrix[1]);
101
102
103 return allMultiPClusters;
104
105}
106
107std::vector<InDet::PixelClusterParts> InDet::NnPixelClusterSplitter::splitCluster(const InDet::PixelCluster& origCluster,
108 const InDet::PixelClusterSplitProb& splitProb) const
109{
110
111
113 {
114 const InDetDD::SiDetectorElement* element=origCluster.detectorElement();
115 if (element==nullptr) {
116 ATH_MSG_WARNING("Could not get detector element");
117 return {};
118 }
119 const AtlasDetectorID* aid = element->getIdHelper();
120 if (aid==nullptr)
121 {
122 ATH_MSG_WARNING("Could not get ATLASDetectorID");
123 return {};
124 }
125
127 {
128 ATH_MSG_WARNING("Not a PixelID helper");
129 return {};
130 }
131 const PixelID* pixelIDp=static_cast<const PixelID*>(aid);
132 //check if original pixel is on b-layer and if yes continue, otherwise interrupt...
133 Identifier pixelId = origCluster.identify();
134 if (!pixelIDp->is_blayer(pixelId))
135 {
136 //return empty object...
137 ATH_MSG_VERBOSE(" Cluster not on b-layer. Return empty object-->back to default clustering." );
138
139 return {};
140 }
141 }
142
143 //add treatment for b-layer only HERE
144
145 const std::vector<Identifier>& rdos = origCluster.rdoList();
146 const std::vector<int>& totList = origCluster.totList();
147
148 //fill lvl1group all with the same value... (not best way but ...)
149 std::vector<int> lvl1group(rdos.size(), origCluster.LVL1A());
150
151
152
153 if (splitProb.getHighestSplitMultiplicityStored()<3) return {};
154
155 double splitProb2=splitProb.splitProbability(2);
156 double splitProb3rel=splitProb.splitProbability(3);
157
158 double splitProb3=splitProb3rel/(splitProb3rel+splitProb2);
159
160 ATH_MSG_VERBOSE( " SplitProb -->2 " << splitProb2 << " SplitProb -->3 " << splitProb3 );
161
162 int nParticles=1;
163
165 {
167 {
168 nParticles=3;
169 }
170 else
171 {
172 nParticles=2;
173 }
174 }
175
176
177 ATH_MSG_VERBOSE( " Decided for n. particles: " << nParticles << "." );
178
179 std::vector<Amg::Vector2D> allLocalPositions;
180 std::vector<Amg::MatrixX> allErrorMatrix;
181
182 Amg::Vector3D beamSpotPosition(0,0,0);
185 beamSpotPosition = beamSpotHandle->beamPos();
186 }
187
188 std::vector<InDet::PixelClusterParts> allMultiPClusters;
189
190 if (nParticles==1)
191 {
192 std::vector<Amg::MatrixX> errorMatrix;
193 std::vector<Amg::Vector2D> localPosition=m_NnClusterizationFactory->estimatePositions(origCluster,
194 beamSpotPosition,
195 errorMatrix,
196 1);
197
198 if (errorMatrix.size()!=1 || localPosition.size()!=1)
199 {
200 ATH_MSG_ERROR("Error matrix or local position vector size is not 1, it is:" << errorMatrix.size() << " or " << localPosition.size() << ".");
201 }
202
203 allMultiPClusters.emplace_back(rdos,totList,lvl1group,localPosition[0],errorMatrix[0]);
204 }
205 else if (nParticles==2)
206 {
207
208 std::vector<Amg::MatrixX> errorMatrix;
209 std::vector<Amg::Vector2D> localPosition=m_NnClusterizationFactory->estimatePositions(origCluster,
210 beamSpotPosition,
211 errorMatrix,
212 2);
213
214 if (errorMatrix.size()!=2 || localPosition.size()!=2)
215 {
216 ATH_MSG_ERROR("Error matrix or local position vector size is not 2, it is:" << errorMatrix.size() << " or " << localPosition.size() << ".");
217 }
218
219 allMultiPClusters.emplace_back(rdos,totList,lvl1group,localPosition[0],errorMatrix[0]);
220 allMultiPClusters.emplace_back(rdos,totList,lvl1group,localPosition[1],errorMatrix[1]);
221 }
222 else if (nParticles==3)
223 {
224
225 std::vector<Amg::MatrixX> errorMatrix;
226 std::vector<Amg::Vector2D> localPosition=m_NnClusterizationFactory->estimatePositions(origCluster,
227 beamSpotPosition,
228 errorMatrix,
229 3);
230
231 if (errorMatrix.size()!=3 || localPosition.size()!=3)
232 {
233 ATH_MSG_ERROR("Error matrix or local position vector size is not 2, it is:" << errorMatrix.size() << " or " << localPosition.size() << ".");
234 }
235
236
237 allMultiPClusters.emplace_back(rdos,totList,lvl1group,localPosition[0],errorMatrix[0]);
238 allMultiPClusters.emplace_back(rdos,totList,lvl1group,localPosition[1],errorMatrix[1]);
239 allMultiPClusters.emplace_back(rdos,totList,lvl1group,localPosition[2],errorMatrix[2]);
240 }
241
242 return allMultiPClusters;
243
244}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
This is an Identifier helper class for the Pixel subdetector.
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
virtual HelperType helper() const
Type of helper, defaulted to 'Unimplemented'.
Class to hold geometrical description of a silicon detector element.
const AtlasDetectorID * getIdHelper() const
Returns the id helper (inline)
virtual StatusCode initialize() override
AthAlgTool interface methods.
ToolHandle< NnClusterizationFactory > m_NnClusterizationFactory
NnPixelClusterSplitter(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
virtual std::vector< InDet::PixelClusterParts > splitCluster(const InDet::PixelCluster &origCluster) const override
take one, give zero or many
virtual StatusCode finalize() override
return object of the IPixelClusterSplitProbTool
double splitProbability(unsigned int nParticles=2) const
return method : total split probability
unsigned int getHighestSplitMultiplicityStored() const
return method : numberOfProbabilitiesStored
virtual const InDetDD::SiDetectorElement * detectorElement() const override final
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
This is an Identifier helper class for the Pixel subdetector.
Definition PixelID.h:67
bool is_blayer(const Identifier &id) const
Test for b-layer - WARNING: id MUST be pixel id, otherwise answer is not accurate....
Definition PixelID.h:614
Identifier identify() const
return the identifier
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
Eigen::Matrix< double, 3, 1 > Vector3D