24 constexpr float dx = 0.25;
25 constexpr float dy = 0.05;
26 constexpr float dz = 9.00;
27 constexpr float tilt = 14. / 180. *
M_PI;
31 while (!toCluster.empty())
33 const auto *init = *(toCluster.begin());
34 toCluster.pop_front();
35 auto clusteredHits =
findAround(init, toCluster);
43 const float charge =
h->depositedCharge();
44 const float pixX = dx *
h->pixelColIDChip();
45 const float pixY = dy *
h->pixelRowIDChip();
49 sumToT_temp +=
h->timeOverThreshold();
51 if (sumCharge == 0.f){
54 const float xPlane = sumX / sumCharge;
55 const float yPlane = sumY / sumCharge;
57 const int stationID = init->stationID();
58 const int layerID = init->pixelLayerID();
60 const float x = xPlane;
61 const float y = yPlane * std::cos(tilt);
62 const float z = yPlane * std::sin(tilt) + dz * layerID;
64 m_clusters.emplace_back(
x,
y,
z, stationID, layerID, sumToT_temp);
72 while (!toTrack.empty())
74 auto init = *(toTrack.begin());
76 auto trackCandidate =
findAround(init, toTrack);
82 std::vector<std::pair<double, double>> XZ;
83 std::vector<std::pair<double, double>> YZ;
85 for (
const auto& cluster : trackCandidate)
89 XZ.emplace_back(cluster.x, cluster.z);
90 YZ.emplace_back(cluster.y, cluster.z);
93 const auto [
x, xSlope] =
linReg(XZ);
94 const auto [
y, ySlope] =
linReg(YZ);
95 const int station = trackCandidate[0].station;
105 for (
const auto& yx : YX)
114 double numerator = 0;
115 double denumerator = 0;
116 for (
const auto& yx : YX)
118 const double dy = yx.first - meany;
119 const double dx = yx.second - meanx;
120 numerator += dx * dy;
121 denumerator += dx * dx;
124 if(denumerator==0.0) denumerator=1e-6;
125 const double slope = numerator / denumerator;
126 const double position = meany - slope * meanx;
128 return {position, slope};
145 const float dx = lhs.
x - rhs.
x;
146 const float dy = lhs.
y - rhs.
y;
double charge(const T &p)
void reco()
Performs fast reconstruction of clusters and tracks.
static constexpr int s_trackSize
Minimum number of clusters in track.
void recoClusters()
Performs fast cluster reconstruction.
static constexpr float s_clusterDistance
Maximum distance between cluster.
const xAOD::AFPSiHitContainer * m_hitContainer
Pointer to hit container.
std::vector< AFPTrack > m_tracks
Vector of tracks.
std::vector< T > findAround(T init, std::list< T > &toJoin) const
Finds hits/clusters around given init element.
void recoTracks()
Performs fast track reconstruction.
std::pair< double, double > linReg(const std::vector< std::pair< double, double > > &YX) const
Returns parameters of fitted line.
std::vector< AFPCluster > m_clusters
Vector of clusters.
const std::vector< AFPCluster > & clusters() const
Returns vector of clusters.
bool areNeighbours(const xAOD::AFPSiHit *lhs, const xAOD::AFPSiHit *rhs) const
Checks if given hits are neighbours.
Header file for AthHistogramAlgorithm.
int pixelColIDChip() const
Index of the pixel column in chip coordinate system.
int stationID() const
Index of the station with pixel hit.
int pixelLayerID() const
Index of the layer of pixels, i.e.
int pixelRowIDChip() const
Index of the pixel row in chip coordinate system.