ATLAS Offline Software
Loading...
Searching...
No Matches
AFPFastReco.h
Go to the documentation of this file.
1#ifndef AFP_MONITORING_AFPFASTRECO_H
2#define AFP_MONITORING_AFPFASTRECO_H
3
4#include <array>
5#include <list>
6#include <utility>
7#include <vector>
8
11
12namespace AFPMon {
13
15{
16 AFPCluster(float x_, float y_, float z_, int s, int l, int sumToT_)
17 : x {x_}, y {y_}, z {z_}, station {s}, layer {l}, sumToT{sumToT_} {}
18
19 float x;
20 float y;
21 float z;
23 int layer;
24 int sumToT;
25 };
26
27inline bool operator==(const AFPCluster& lhs, const AFPCluster& rhs)
28{
29 if (lhs.x != rhs.x) return false;
30 if (lhs.y != rhs.y) return false;
31 if (lhs.z != rhs.z) return false;
32 if (lhs.station != rhs.station) return false;
33 if (lhs.layer != rhs.layer) return false;
34 if (lhs.sumToT != rhs.sumToT) return false;
35
36 return true;
37}
38
39struct AFPTrack
40{
41 AFPTrack(float x_, float y_, int s, std::array<int, 4> a)
42 : x {x_}, y {y_}, station {s}, layerClusters {std::move(a)} {}
43
44 float x;
45 float y;
47 std::array<int, 4> layerClusters;
48};
49
51{
52 public:
55
57 void reco();
58
60 const std::vector<AFPCluster>& clusters() const { return m_clusters; }
61
63 const std::vector<AFPTrack>& tracks() const { return m_tracks; }
64
65 private:
67 void recoClusters();
68
70 void recoTracks();
71
73 std::pair<double, double> linReg(const std::vector<std::pair<double, double>>& YX) const;
74
76 template <class T>
77 std::vector<T> findAround(T init, std::list<T>& toJoin) const;
78
80 bool areNeighbours(const xAOD::AFPSiHit* lhs, const xAOD::AFPSiHit* rhs) const;
81
83 bool areNeighbours(const AFPCluster& lhs, const AFPCluster& rhs) const;
84
87
89 std::vector<AFPCluster> m_clusters;
90
92 std::vector<AFPTrack> m_tracks;
93
95 static constexpr int s_afpStations = 4;
96
98 static constexpr int s_afpLayers = 4;
99
101 static constexpr int s_trackSize = 3;
102
104 static constexpr float s_clusterDistance = 0.4;
105 };
106
107template <class T> std::vector<T> AFPFastReco::findAround(T init, std::list<T>& toJoin) const
108{
109 std::vector<T> element;
110 element.push_back(init);
111
112 std::vector<T> newNeighbours;
113 do
114 {
115 newNeighbours.clear();
116 for (auto& b : toJoin)
117 {
118 bool isNew = false;
119 for (auto& a : element)
120 if (areNeighbours(a, b))
121 {
122 isNew = true;
123 break;
124 }
125
126 if (isNew)
127 {
128 newNeighbours.push_back(b);
129 element.push_back(b);
130 }
131 }
132
133 for (auto& t : newNeighbours)
134 toJoin.remove(t);
135
136 } while (newNeighbours.size() > 0);
137
138 return element;
139 }
140
141} // namespace AFPMon
142
143#endif /* AFP_MONITORING_AFPFASTRECO_H */
144
static Double_t a
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.
const std::vector< AFPTrack > & tracks() const
Returns vector of tracks.
Definition AFPFastReco.h:63
static constexpr float s_clusterDistance
Maximum distance between cluster.
const xAOD::AFPSiHitContainer * m_hitContainer
Pointer to hit container.
Definition AFPFastReco.h:86
std::vector< AFPTrack > m_tracks
Vector of tracks.
Definition AFPFastReco.h:92
std::vector< T > findAround(T init, std::list< T > &toJoin) const
Finds hits/clusters around given init element.
AFPFastReco(const xAOD::AFPSiHitContainer *hits)
Constructor. Sets input hit container.
Definition AFPFastReco.h:54
static constexpr int s_afpLayers
Number of layers in each station.
Definition AFPFastReco.h:98
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.
Definition AFPFastReco.h:89
const std::vector< AFPCluster > & clusters() const
Returns vector of clusters.
Definition AFPFastReco.h:60
bool areNeighbours(const xAOD::AFPSiHit *lhs, const xAOD::AFPSiHit *rhs) const
Checks if given hits are neighbours.
static constexpr int s_afpStations
Number of AFP stations.
Definition AFPFastReco.h:95
bool operator==(const AFPCluster &lhs, const AFPCluster &rhs)
Definition AFPFastReco.h:27
STL namespace.
AFPSiHit_v2 AFPSiHit
Definition AFPSiHit.h:12
AFPSiHitContainer_v2 AFPSiHitContainer
AFPCluster(float x_, float y_, float z_, int s, int l, int sumToT_)
Definition AFPFastReco.h:16
AFPTrack(float x_, float y_, int s, std::array< int, 4 > a)
Definition AFPFastReco.h:41
std::array< int, 4 > layerClusters
Definition AFPFastReco.h:47