16 const std::string&
name,
17 const IInterface*
parent ) :
27 m_selectionFunction = [](
const std::vector<const xAOD::AFPSiHitsCluster*>&) {
return true; };
32 std::vector<int> plane{0, 0, 0, 0};
34 for (
auto&& cluster :
t) {
35 const int p = cluster->pixelLayerID();
39 auto HasAnyClusters = [](
int n) {
return n > 0; };
47 std::vector<int> plane{0, 0, 0, 0};
49 for (
auto&& cluster :
t) {
50 const int p = cluster->pixelLayerID();
54 auto HasMultipleClusters = [](
int n) {
return n > 1; };
56 if (std::any_of(plane.begin(), plane.end(), HasMultipleClusters)) {
return false; }
67 return StatusCode::FAILURE;
72 return StatusCode::SUCCESS;
80 const double xa =
a->xLocal();
81 const double ya =
a->yLocal();
83 const double xb =
b->xLocal();
84 const double yb =
b->yLocal();
87 const double dy = ya - yb;
89 return dx *
dx +
dy *
dy <= maxDistanceSq;
96 std::vector<const xAOD::AFPSiHitsCluster*>
track;
99 std::vector<const xAOD::AFPSiHitsCluster*> newNeighbours;
103 newNeighbours.clear();
104 for (
auto&&
b : toJoin) {
111 newNeighbours.push_back(
b);
117 for (
auto&
t : newNeighbours) {
121 }
while (!newNeighbours.empty());
131 double meanx = 0, meany = 0;
132 for (
const auto& [
y,
x] : YX) {
140 for (
const auto& [
y,
x] : YX) {
141 const double dy =
y - meany;
142 const double dx =
x - meanx;
144 numerator +=
dx *
dy;
149 const double position = meany - slope * meanx;
151 return {position, slope};
161 return StatusCode::SUCCESS;
165 std::list<const xAOD::AFPSiHitsCluster*> clustersInStation;
167 [
this](
auto cluster) { return cluster->stationID() == m_stationID; });
173 while (!clustersInStation.empty())
176 const auto *
const initialCluster = clustersInStation.front();
177 clustersInStation.pop_front();
184 ATH_MSG_DEBUG(
"track candidate of size " << clusterOfClusters.size() <<
" did not pass selection.");
188 auto *
track = outputContainer->
push_back(std::make_unique<xAOD::AFPTrack>());
194 for (
const auto *
const cluster : clusterOfClusters) {
197 track->addCluster(clusterLink);
200 const int nClusters =
track->clusters().size();
204 track->setNClusters(nClusters);
220 if (nClusters == 1) {
221 x = (*(
track->clusters().at(0)))->xLocal();
222 y = (*(
track->clusters().at(0)))->yLocal();
226 std::vector<std::pair<double, double>> XZ;
227 std::vector<std::pair<double, double>> YZ;
229 for (
int i = 0;
i < nClusters;
i++) {
239 std::tie(
x, xSlope) = linregx;
240 std::tie(
y, ySlope) = linregy;
242 for (
int i = 0;
i < nClusters;
i++) {
245 const double z = cluster->
zLocal();
249 const double dx = cluster->
xLocal() - (
x + xSlope *
z);
250 const double dy = cluster->
yLocal() - (
y + ySlope *
z);
260 track->setXSlope(xSlope);
262 track->setYSlope(ySlope);
263 track->setZLocal(0.);
267 std::vector<int> clustersPlane{0, 0, 0, 0};
268 for (
const auto&
cl :
track->clusters()) {
269 ++clustersPlane[(*cl)->pixelLayerID()];
271 auto HasNoClusters = [](
int n) {
return n == 0; };
272 track->setNHoles(std::count_if(clustersPlane.begin(), clustersPlane.end(), HasNoClusters));
276 <<
", y: " <<
track->yLocal() <<
", sx: " <<
track->xSlope()
277 <<
", sy: " <<
track->ySlope() <<
", chi2: " <<
track->chi2());
278 for (
auto&& cluster :
track->clusters())
280 ATH_MSG_DEBUG(
'\t' << (*cluster)->xLocal() <<
" " << (*cluster)->yLocal() <<
" " << (*cluster)->zLocal());
284 return StatusCode::SUCCESS;