Reconstructs tracks properties from track candidates.
156{
159 {
160
161 return StatusCode::SUCCESS;
162 }
163
164
165 std::list<const xAOD::AFPSiHitsCluster*> clustersInStation;
166 std::copy_if(
clusters->begin(),
clusters->end(), std::back_inserter(clustersInStation),
167 [this](auto cluster) { return cluster->stationID() == m_stationID; });
168
170
171
172
173 while (!clustersInStation.empty())
174 {
175
176 const auto *const initialCluster = clustersInStation.front();
177 clustersInStation.pop_front();
178
179
181
182
184 ATH_MSG_DEBUG(
"track candidate of size " << clusterOfClusters.size() <<
" did not pass selection.");
185 continue;
186 }
187
188 auto *
track = outputContainer->push_back(std::make_unique<xAOD::AFPTrack>());
189
190
192
193
194 for (const auto *const cluster : clusterOfClusters) {
195 ElementLink<xAOD::AFPSiHitsClusterContainer> clusterLink;
197 track->addCluster(clusterLink);
198 }
199
200 const int nClusters =
track->clusters().size();
201
202 if(nClusters>0)
203 {
204 track->setNClusters(nClusters);
205 }
206 else
207 {
209 outputContainer->pop_back();
210 continue;
211 }
212
213
216 double xSlope = 0.;
217 double ySlope = 0.;
219
220 if (nClusters == 1) {
221 x = (*(
track->clusters().at(0)))->xLocal();
222 y = (*(
track->clusters().at(0)))->yLocal();
223 }
224 else
225 {
226 std::vector<std::pair<double, double>> XZ;
227 std::vector<std::pair<double, double>> YZ;
228
229 for (
int i = 0;
i < nClusters;
i++) {
231
234 }
235
238
239 std::tie(
x, xSlope) = linregx;
240 std::tie(
y, ySlope) = linregy;
241
242 for (
int i = 0;
i < nClusters;
i++) {
244
245 const double z = cluster->
zLocal();
248
249 const double dx = cluster->
xLocal() - (
x + xSlope *
z);
250 const double dy = cluster->
yLocal() - (
y + ySlope *
z);
251
254 }
255 }
256
257
260 track->setXSlope(xSlope);
262 track->setYSlope(ySlope);
263 track->setZLocal(0.);
264
266
267 std::vector<int> clustersPlane{0, 0, 0, 0};
268 for (
const auto& cl :
track->clusters()) {
269 ++clustersPlane[(*cl)->pixelLayerID()];
270 }
271 auto HasNoClusters = [](
int n) {
return n == 0; };
272 track->setNHoles(std::count_if(clustersPlane.begin(), clustersPlane.end(), HasNoClusters));
273
274
276 <<
", y: " <<
track->yLocal() <<
", sx: " <<
track->xSlope()
277 <<
", sy: " <<
track->ySlope() <<
", chi2: " <<
track->chi2());
278 for (
auto&& cluster :
track->clusters())
279 {
280 ATH_MSG_DEBUG(
'\t' << (*cluster)->xLocal() <<
" " << (*cluster)->yLocal() <<
" " << (*cluster)->zLocal());
281 }
282 }
283
284 return StatusCode::SUCCESS;
285}
bool toContainedElement(BaseConstReference data, ElementType element, IProxyDict *sg=0)
Set from element pointer and a reference to the container (storable)
float zLocal() const
Cluster position along Z axis in station local coordinate system.
float yLocalErr() const
Uncertainty of cluster position along Y axis in station local coordinate system.
float xLocal() const
Cluster position along X axis in station local coordinate system.
float yLocal() const
Cluster position along Y axis in station local coordinate system.
float xLocalErr() const
Uncertainty of cluster position along X axis in station local coordinate system.
static constexpr int linReg
linear regression algorithm id=1
double chi2(TH1 *h0, TH1 *h1)
AFPSiHitsCluster_v1 AFPSiHitsCluster