100 std::vector<FPGATrackSimCluster> tempClusters;
102 bool newCluster, newHit;
106 for(
auto& hit: moduleHits){
107 bool is_clustered_hit =
false;
110 for(
auto& cluster: tempClusters){
113 is_clustered_hit =
true;
117 is_clustered_hit =
true;
122 if((is_clustered_hit==0) or (tempClusters.size()==0)){
127 }
else if(hit.isStrip()){
131 tempClusters.push_back(cluster);
136 for (
auto& cluster : tempClusters) {
139 for (
auto& finalCluster : moduleClusters) {
140 int cPhi =
cluster.getClusterEquiv().getPhiIndex();
141 int cPhiWidth =
cluster.getClusterEquiv().getPhiWidth();
142 int cEta =
cluster.getClusterEquiv().getEtaIndex();
143 int cEtaWidth =
cluster.getClusterEquiv().getEtaWidth();
144 int fCPhi = finalCluster.getClusterEquiv().getPhiIndex();
145 int fCPhiWidth = finalCluster.getClusterEquiv().getPhiWidth();
146 int fCEta = finalCluster.getClusterEquiv().getEtaIndex();
147 int fCEtaWidth = finalCluster.getClusterEquiv().getEtaWidth();
150 if ((fCPhi > cPhi + cPhiWidth - 1) ||
151 (cPhi > fCPhi + fCPhiWidth - 1))
155 if ((fCEta > cEta + cEtaWidth - 1) ||
156 (cEta > fCEta + fCEtaWidth - 1))
160 unsigned int sharedhits = 0;
161 for (
auto & hit :
cluster.getHitList()) {
163 for (
auto & finalHit : finalCluster.getHitList()) {
164 if (hit.getEtaIndex() == finalHit.getEtaIndex() &&
165 hit.getPhiIndex() == finalHit.getPhiIndex())
179 clusterEquiv = finalCluster.getClusterEquiv();
184 if (cPhi + cPhiWidth < fCPhi + fCPhiWidth)
185 clusterEquiv.
setPhiWidth(fCPhiWidth + (fCPhi - cPhi));
190 if (!(cPhi + cPhiWidth < fCPhi + fCPhiWidth))
191 clusterEquiv.
setPhiWidth(cPhiWidth + (cPhi - fCPhi));
199 if (cEta + cEtaWidth < fCEta + fCEtaWidth)
200 clusterEquiv.
setEtaWidth(fCEtaWidth + (fCEta - cEta));
205 if (!(cEta + cEtaWidth < fCEta + fCEtaWidth))
206 clusterEquiv.
setEtaWidth(cEtaWidth + (cEta - fCEta));
211 finalCluster.setClusterEquiv(clusterEquiv);
213 for (
auto & hit :
cluster.getHitList()) {
215 for (
auto & finalHit : finalCluster.getHitList()) {
216 if (hit.getEtaIndex() == finalHit.getEtaIndex() &&
217 hit.getPhiIndex() == finalHit.getPhiIndex())
222 clusterEquiv = finalCluster.getClusterEquiv();
223 float xOld = clusterEquiv.
getX();
224 float yOld = clusterEquiv.
getY();
225 float zOld = clusterEquiv.
getZ();
230 float xNew = hit.getX();
231 float yNew = hit.getY();
232 float zNew = hit.getZ();
233 float xPhiNew = hit.getPhiCoord();
234 float xEtaNew = hit.getEtaCoord();
235 float cPhiNew = hit.getPhiIndex();
236 float cEtaNew = hit.getEtaIndex();
237 int tot = clusterEquiv.
getToT();
238 int totNew = hit.getToT();
241 int n = finalCluster.getHitList().size();
242 clusterEquiv.
setX((xOld*
n + xNew) / (
n+1));
243 clusterEquiv.
setY((yOld*
n + yNew) / (
n+1));
244 clusterEquiv.
setZ((zOld*
n + zNew) / (
n+1));
250 clusterEquiv.
setX((xOld*tot + xNew*totNew) / (tot+totNew));
251 clusterEquiv.
setY((yOld*tot + yNew*totNew) / (tot+totNew));
252 clusterEquiv.
setZ((zOld*tot + zNew*totNew) / (tot+totNew));
253 clusterEquiv.
setPhiCoord((xPhiOld*tot + xPhiNew*totNew) / (tot+totNew));
254 clusterEquiv.
setEtaCoord((xEtaOld*tot + xEtaNew*totNew) / (tot+totNew));
258 clusterEquiv.
setToT(tot + totNew);
259 finalCluster.setClusterEquiv(clusterEquiv);
260 finalCluster.push_backHitList(hit);
266 moduleClusters.push_back(cluster);