14 constexpr
unsigned int ETA = 1;
15 constexpr
unsigned int PHI = 0;
30 std::vector<FPGATrackSimHit>
hits = tower.
hits();
32 std::vector<std::vector<FPGATrackSimHit>> hitsPerModule;
33 std::vector<FPGATrackSimCluster> towerClusters;
36 for (
auto &hit :
hits)
48 clusters.reserve(towerClusters.size());
50 ATH_MSG_WARNING(
"more than one tower, m_clusters is only going to contain those from the last one");
52 unsigned cluster_count = 0;
53 for (
auto &cluster: towerClusters){
60 tower.
addHit(cluster_as_FPGATrackSimhit);
68 return StatusCode::SUCCESS;
73 std::vector<FPGATrackSimCluster> moduleClusters;
75 for(
auto& moduleHits:sorted_hits){
79 clusters.insert(
clusters.end(), moduleClusters.begin(), moduleClusters.end());
81 moduleClusters.clear();
86 std::vector<FPGATrackSimCluster> tempClusters;
88 bool newCluster, newHit;
92 for(
auto& hit: moduleHits){
93 bool is_clustered_hit =
false;
96 for(
auto& cluster: tempClusters){
99 is_clustered_hit =
true;
103 is_clustered_hit =
true;
108 if((is_clustered_hit==0) or (tempClusters.size()==0)){
113 }
else if(hit.isStrip()){
117 tempClusters.push_back(cluster);
122 for (
auto& cluster : tempClusters) {
125 for (
auto& finalCluster : moduleClusters) {
126 int cPhi = cluster.getClusterEquiv().getPhiIndex();
127 int cPhiWidth = cluster.getClusterEquiv().getPhiWidth();
128 int cEta = cluster.getClusterEquiv().getEtaIndex();
129 int cEtaWidth = cluster.getClusterEquiv().getEtaWidth();
130 int fCPhi = finalCluster.getClusterEquiv().getPhiIndex();
131 int fCPhiWidth = finalCluster.getClusterEquiv().getPhiWidth();
132 int fCEta = finalCluster.getClusterEquiv().getEtaIndex();
133 int fCEtaWidth = finalCluster.getClusterEquiv().getEtaWidth();
136 if ((fCPhi > cPhi + cPhiWidth - 1) ||
137 (cPhi > fCPhi + fCPhiWidth - 1))
141 if ((fCEta > cEta + cEtaWidth - 1) ||
142 (cEta > fCEta + fCEtaWidth - 1))
146 unsigned int sharedhits = 0;
147 for (
auto & hit : cluster.getHitList()) {
149 for (
auto & finalHit : finalCluster.getHitList()) {
150 if (hit.getEtaIndex() == finalHit.getEtaIndex() &&
151 hit.getPhiIndex() == finalHit.getPhiIndex())
165 clusterEquiv = finalCluster.getClusterEquiv();
170 if (cPhi + cPhiWidth < fCPhi + fCPhiWidth)
171 clusterEquiv.
setPhiWidth(fCPhiWidth + (fCPhi - cPhi));
176 if (!(cPhi + cPhiWidth < fCPhi + fCPhiWidth))
177 clusterEquiv.
setPhiWidth(cPhiWidth + (cPhi - fCPhi));
185 if (cEta + cEtaWidth < fCEta + fCEtaWidth)
186 clusterEquiv.
setEtaWidth(fCEtaWidth + (fCEta - cEta));
191 if (!(cEta + cEtaWidth < fCEta + fCEtaWidth))
192 clusterEquiv.
setEtaWidth(cEtaWidth + (cEta - fCEta));
197 finalCluster.setClusterEquiv(clusterEquiv);
199 for (
auto & hit : cluster.getHitList()) {
201 for (
auto & finalHit : finalCluster.getHitList()) {
202 if (hit.getEtaIndex() == finalHit.getEtaIndex() &&
203 hit.getPhiIndex() == finalHit.getPhiIndex())
207 clusterEquiv = finalCluster.getClusterEquiv();
208 float xOld = clusterEquiv.
getX();
209 float yOld = clusterEquiv.
getY();
210 float zOld = clusterEquiv.
getZ();
211 float xNew = hit.getX();
212 float yNew = hit.getY();
213 float zNew = hit.getZ();
214 int n = finalCluster.getHitList().size();
216 clusterEquiv.
setX((xOld*
n + xNew) / (
n+1));
217 clusterEquiv.
setY((yOld*
n + yNew) / (
n+1));
218 clusterEquiv.
setZ((zOld*
n + zNew) / (
n+1));
219 finalCluster.setClusterEquiv(clusterEquiv);
220 finalCluster.push_backHitList(hit);
226 moduleClusters.push_back(cluster);
244 std::vector<FPGATrackSimHit> currentModule;
247 for (
auto& hit:
hits){
249 currentModule.push_back(hit);
250 hashing = hit.getIdentifierHash();
251 }
else if (hit.getIdentifierHash() == hashing) {
252 currentModule.push_back(hit);
254 hitsPerModule.push_back(currentModule);
255 currentModule.clear();
256 hashing = hit.getIdentifierHash();
257 currentModule.push_back(hit);
262 if (currentModule.size() > 0) hitsPerModule.push_back(currentModule);
267 for (
auto&
module:hitsPerModule){
273 if (
module.at(0).isStrip())
277 if (
module.at(0).isStrip())
284 if (
module.at(0).isStrip())
288 if (
module.at(0).isStrip())
297 for (
auto&
module:hitsPerModule){
299 if (
module.at(0).isStrip())
303 if (
module.at(0).isStrip())
326 cluster.setClusterEquiv(clusterEquiv);
400 for(
auto& hit :
hits) {
403 if(!hit.getTruth().isEmpty()) {
404 mt.
add(hit.getTruth());
408 mt.
maximize(uniquecode, hit.getBarcodePt());
442 if ((hitCol == clusterCol + clusterColWidth) && (hitRow == clusterRow + clusterRowWidth)) {
447 }
else if ((hitCol == clusterCol + clusterColWidth) && (hitRow == clusterRow - 1)) {
453 }
else if ((hitCol >= clusterCol) && (hitCol < clusterCol + clusterColWidth) && (hitRow == clusterRow + clusterRowWidth)) {
457 }
else if ((hitCol == clusterCol + clusterColWidth) && (hitRow >= clusterRow) && (hitRow < clusterRow + clusterRowWidth)) {
461 }
else if ((hitCol >= clusterCol) && (hitCol < clusterCol + clusterColWidth) && (hitRow == clusterRow - 1)) {
466 }
else if ((hitCol == clusterCol - 1) && (hitRow == clusterRow - 1)) {
473 }
else if ((hitCol == clusterCol - 1) && (hitRow >= clusterRow) && (hitRow < clusterRow + clusterRowWidth)) {
478 }
else if ((hitCol == clusterCol - 1) && (hitRow == clusterRow + clusterRowWidth)) {
484 }
else if ((hitCol >= clusterCol) && (hitCol < clusterCol + clusterColWidth) && (hitRow >= clusterRow) && (hitRow < clusterRow + clusterRowWidth)) {
531 clusterCol = clusterCol - clusterColWidth;
533 clusterColWidth = clusterColWidth+tempWidth+1;
535 clusterCol = clusterCol + clusterColWidth;
546 bool isConnected =
false;
550 for (
auto & hit : currentCluster.
getHitList()) {
552 auto hitPhi = hit.getPhiIndex();
556 if (((inHitEta == hitEta - 1) && (inHitPhi == hitPhi - 1)) ||
557 ((inHitEta == hitEta + 1) && (inHitPhi == hitPhi - 1)) ||
558 ((inHitEta == hitEta - 1) && (inHitPhi == hitPhi + 1)) ||
559 ((inHitEta == hitEta + 1) && (inHitPhi == hitPhi + 1)) ||
560 ((inHitEta == hitEta) && (inHitPhi == hitPhi - 1)) ||
561 ((inHitEta == hitEta) && (inHitPhi == hitPhi + 1)) ||
562 ((inHitEta == hitEta - 1) && (inHitPhi == hitPhi)) ||
563 ((inHitEta == hitEta + 1) && (inHitPhi == hitPhi))) {
579 float xOld = clusterEquiv.
getX();
580 float yOld = clusterEquiv.
getY();
581 float zOld = clusterEquiv.
getZ();
582 float xNew = incomingHit.
getX();
583 float yNew = incomingHit.
getY();
584 float zNew = incomingHit.
getZ();
589 clusterEquiv.
setX((xOld*
n + xNew) / (
n+1));
590 clusterEquiv.
setY((yOld*
n + yNew) / (
n+1));
591 clusterEquiv.
setZ((zOld*
n + zNew) / (
n+1));
598 clusterEquiv.
setX((xOld*
N + xNew*newN) / (
N+newN));
599 clusterEquiv.
setY((yOld*
N + yNew*newN) / (
N+newN));
600 clusterEquiv.
setZ((zOld*
N + zNew*newN) / (
N+newN));