ATLAS Offline Software
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
FPGATrackSimClusteringTool Class Reference

#include <FPGATrackSimClusteringTool.h>

Inheritance diagram for FPGATrackSimClusteringTool:
Collaboration diagram for FPGATrackSimClusteringTool:

Public Member Functions

 FPGATrackSimClusteringTool (const std::string &, const std::string &, const IInterface *)
 
virtual ~FPGATrackSimClusteringTool ()=default
 
virtual StatusCode initialize () override
 
virtual StatusCode DoClustering (FPGATrackSimLogicalEventInputHeader &, std::vector< FPGATrackSimCluster > &) const override
 

Private Types

using HitPtrCollection = std::vector< std::unique_ptr< FPGATrackSimHit > >
 
using HitPtrContainer = std::vector< HitPtrCollection >
 

Private Member Functions

void SortedClustering (HitPtrContainer &&sorted_hits, std::vector< FPGATrackSimCluster > &) const
 
void Clustering (HitPtrCollection &&, std::vector< FPGATrackSimCluster > &) const
 
void reduceGlobalCoordPrecision (FPGATrackSimCluster &cluster) const
 
void reduceGlobalCoordPrecision (FPGATrackSimHit &hit) const
 
void splitAndSortHits (HitPtrCollection &&hits, HitPtrContainer &hitsPerModule, int &eta_phi) const
 
void splitAndSortHits (HitPtrCollection &&hits, HitPtrContainer &hitsPerModule) const
 
void splitHitsToModules (HitPtrCollection &&hits, HitPtrContainer &hitsPerModule) const
 
void normaliseClusters (std::vector< FPGATrackSimCluster > &clusters) const
 
void sortHitsOnModules (HitPtrContainer &hitsPerModule, int &eta_phi) const
 
void sortHitsOnModules (HitPtrContainer &hitsPerModule) const
 
bool etaOrPhi (const FPGATrackSimHit &hit) const
 
bool sortIBLInput (const std::unique_ptr< FPGATrackSimHit > &i, const std::unique_ptr< FPGATrackSimHit > &j) const
 
bool sortPixelInput (const std::unique_ptr< FPGATrackSimHit > &i, const std::unique_ptr< FPGATrackSimHit > &j) const
 
void SetMinMaxIndicies (FPGATrackSimCluster &cluster) const
 

Private Attributes

Gaudi::Property< bool > m_digitalClustering {this, "DigitalClustering", true, "flag to enable digital clustering instead of ToT weighted position calculation" }
 
Gaudi::Property< bool > m_reduceCoordPrecision {this, "ReduceCoordPrecision", false, "flag to enable reducing the precision of global coordinates" }
 
Gaudi::Property< float > m_coordRPrecision {this, "CoordRPrecision", 1./64., "fixed point precision of r coordinate" }
 
Gaudi::Property< float > m_coordPhiPrecision {this, "CoordPhiPrecision", 1./8192., "fixed point precision of phi coordinate" }
 
Gaudi::Property< float > m_coordZPrecision {this, "CoordZPrecision", 1./32., "fixed point precision of z coordinate" }
 
Gaudi::Property< int > m_LorentzAngleShift { this, "LorentzAngleShift", -1, "flag for Lorentz angle shift. -1 means off, 0 means full corrections from first version, 1 means smaller LUT, 2 means very small LUT" }
 
ToolHandle< FPGATrackSim::LorentzAngleToolm_lorentzAngleTool {this, "LorentzAngleTool", "", "FPGATrackSim tool to retrieve Lorentz angle"}
 

Detailed Description

Definition at line 33 of file FPGATrackSimClusteringTool.h.

Member Typedef Documentation

◆ HitPtrCollection

using FPGATrackSimClusteringTool::HitPtrCollection = std::vector<std::unique_ptr<FPGATrackSimHit> >
private

Definition at line 54 of file FPGATrackSimClusteringTool.h.

◆ HitPtrContainer

Definition at line 55 of file FPGATrackSimClusteringTool.h.

Constructor & Destructor Documentation

◆ FPGATrackSimClusteringTool()

FPGATrackSimClusteringTool::FPGATrackSimClusteringTool ( const std::string &  algname,
const std::string &  name,
const IInterface *  ifc 
)

Definition at line 20 of file FPGATrackSimClusteringTool.cxx.

20  :
21  base_class(algname, name, ifc)
22 {
23 }

◆ ~FPGATrackSimClusteringTool()

virtual FPGATrackSimClusteringTool::~FPGATrackSimClusteringTool ( )
virtualdefault

Member Function Documentation

◆ Clustering()

void FPGATrackSimClusteringTool::Clustering ( HitPtrCollection &&  moduleHits,
std::vector< FPGATrackSimCluster > &  moduleClusters 
) const
private

Definition at line 132 of file FPGATrackSimClusteringTool.cxx.

132  {
133  FPGATrackSimHit clusterEquiv;
134  bool newHit;
135 
136  //To hold the current cluster vars for comparison
137  //loop over the hits that we have been passed for this module
138  for( auto& hit: moduleHits){
139  bool is_clustered_hit = false;
141 
142  //Loop over the clusters we have already made, check if this hit should be added to them?
143  for(std::vector<FPGATrackSimCluster>::iterator it = moduleClusters.begin(); it != moduleClusters.end(); ++it) {
144  if(hit->isPixel()) {
146  if (!is_clustered_hit) {
147  is_clustered_hit = true;
148  it_added_clus = it;
149  } else {
150  int cPhi = it->getClusterEquiv().getPhiIndex();
151  int cPhiWidth = it->getClusterEquiv().getPhiWidth();
152  int cEta = it->getClusterEquiv().getEtaIndex();
153  int cEtaWidth = it->getClusterEquiv().getEtaWidth();
154  int fCPhi = it_added_clus->getClusterEquiv().getPhiIndex();
155  int fCPhiWidth = it_added_clus->getClusterEquiv().getPhiWidth();
156  int fCEta = it_added_clus->getClusterEquiv().getEtaIndex();
157  int fCEtaWidth = it_added_clus->getClusterEquiv().getEtaWidth();
158 
159  clusterEquiv = it_added_clus->getClusterEquiv();
160 
161  // set new phi & phi width
162  if (cPhi < fCPhi) {
163  clusterEquiv.setPhiIndex(cPhi);
164  if (cPhi + cPhiWidth < fCPhi + fCPhiWidth)
165  clusterEquiv.setPhiWidth(fCPhiWidth + (fCPhi - cPhi));
166  else
167  clusterEquiv.setPhiWidth(cPhiWidth);
168  } else {
169  clusterEquiv.setPhiIndex(fCPhi);
170  if (!(cPhi + cPhiWidth < fCPhi + fCPhiWidth))
171  clusterEquiv.setPhiWidth(cPhiWidth + (cPhi - fCPhi));
172  else
173  clusterEquiv.setPhiWidth(fCPhiWidth);
174  }
175 
176  // set new eta & eta width
177  if (cEta < fCEta) {
178  clusterEquiv.setEtaIndex(cEta);
179  if (cEta + cEtaWidth < fCEta + fCEtaWidth)
180  clusterEquiv.setEtaWidth(fCEtaWidth + (fCEta - cEta));
181  else
182  clusterEquiv.setEtaWidth(cEtaWidth);
183  } else {
184  clusterEquiv.setEtaIndex(fCEta);
185  if (!(cEta + cEtaWidth < fCEta + fCEtaWidth))
186  clusterEquiv.setEtaWidth(cEtaWidth + (cEta - fCEta));
187  else
188  clusterEquiv.setEtaWidth(fCEtaWidth);
189  }
190 
191  it_added_clus->setClusterEquiv(clusterEquiv);
192 
193  for (auto& hit : it->getHitList()) {
194  newHit = true;
195  for (auto& finalHit : it_added_clus->getHitList()) {
196  if (hit.getEtaIndex() == finalHit.getEtaIndex() &&
197  hit.getPhiIndex() == finalHit.getPhiIndex())
198  newHit = false;
199  }
200  if (newHit) {
202  clusterEquiv = it_added_clus->getClusterEquiv();
203  float xOld = clusterEquiv.getX();
204  float yOld = clusterEquiv.getY();
205  float zOld = clusterEquiv.getZ();
206  float xPhiOld = clusterEquiv.getPhiCoord();
207  float xEtaOld = clusterEquiv.getEtaCoord();
208  float cPhiOld = clusterEquiv.getCentroidPhiIndex();
209  float cEtaOld = clusterEquiv.getCentroidEtaIndex();
210  float xNew = hit.getX();
211  float yNew = hit.getY();
212  float zNew = hit.getZ();
213  float xPhiNew = hit.getPhiCoord();
214  float xEtaNew = hit.getEtaCoord();
215  float cPhiNew = hit.getPhiIndex();
216  float cEtaNew = hit.getEtaIndex();
217  int tot = clusterEquiv.getToT();
218  int totNew = hit.getToT();
219  if (m_digitalClustering) {
220  // n+1 because that is old + new now
221  int n = it_added_clus->getHitList().size();
222  clusterEquiv.setX((xOld*n + xNew) / (n+1));
223  clusterEquiv.setY((yOld*n + yNew) / (n+1));
224  clusterEquiv.setZ((zOld*n + zNew) / (n+1));
225  clusterEquiv.setPhiCoord((xPhiOld*n + xPhiNew) / (n+1));
226  clusterEquiv.setEtaCoord((xEtaOld*n + xEtaNew) / (n+1));
227  clusterEquiv.setCentroidPhiIndex((cPhiOld*n + cPhiNew) / (n+1));
228  clusterEquiv.setCentroidEtaIndex((cEtaOld*n + cEtaNew) / (n+1));
229  } else {
230  clusterEquiv.setX((xOld*tot + xNew*totNew) / (tot+totNew));
231  clusterEquiv.setY((yOld*tot + yNew*totNew) / (tot+totNew));
232  clusterEquiv.setZ((zOld*tot + zNew*totNew) / (tot+totNew));
233  clusterEquiv.setPhiCoord((xPhiOld*tot + xPhiNew*totNew) / (tot+totNew));
234  clusterEquiv.setEtaCoord((xEtaOld*tot + xEtaNew*totNew) / (tot+totNew));
235  clusterEquiv.setCentroidPhiIndex((cPhiOld*tot + cPhiNew*totNew) / (tot+totNew));
236  clusterEquiv.setCentroidEtaIndex((cEtaOld*tot + cEtaNew*totNew) / (tot+totNew));
237  }
238  clusterEquiv.setToT(tot + totNew);
239  it_added_clus->setClusterEquiv(clusterEquiv);
240  it_added_clus->push_backHitList(hit);
241  }
242  }
243 
244  // move the last cluster to the newly freed spot in the cluster array if the merged cluster was not
245  // already the last cluster, decrease loop counter by one, so that this cluster gets also checked
246  // against the current hit
247  if (it != moduleClusters.end() - 1) {
248  *it = moduleClusters.back();
249  moduleClusters.pop_back();
250  it -= 1;
251  } else {
252  moduleClusters.pop_back();
253  break;
254  }
255  }
256  }
257  }
258  if(hit->isStrip()){
260  is_clustered_hit = true;
261  }
262  }
263 
264  //If it is the first hit or a not clustered hit, then start a new cluster and add it to the output vector
265  if((!is_clustered_hit) || (moduleClusters.size() == 0)){
266  FPGATrackSimCluster cluster;
267  if(hit->isPixel()){
268  // No need to check the return code here
270  } else if(hit->isStrip()){
272  }
273  //Put this cluster into the output hits. Will update it in place.
274  moduleClusters.push_back(cluster);
275  }
276  }
277  moduleHits.clear();
278 }

◆ DoClustering()

StatusCode FPGATrackSimClusteringTool::DoClustering ( FPGATrackSimLogicalEventInputHeader header,
std::vector< FPGATrackSimCluster > &  clusters 
) const
overridevirtual

Definition at line 31 of file FPGATrackSimClusteringTool.cxx.

32 {
33  for (int i = 0; i<header.nTowers(); i++)
34  {
35  // Retreive the hits from the tower
36  FPGATrackSimTowerInputHeader& tower = *header.getTower(i);
38  hits.reserve(tower.hits().size());
39  for (auto& hit : tower.hits()) {
40  hits.push_back(std::make_unique<FPGATrackSimHit>(hit));
41  }
42 
43  HitPtrContainer hitsPerModule;
44  std::vector<FPGATrackSimCluster> towerClusters;
45 
47  for (auto &hit : hits)
49  }
50 
51  splitAndSortHits(std::move(hits), hitsPerModule);
52  SortedClustering(std::move(hitsPerModule), towerClusters);
53  normaliseClusters(towerClusters);
54 
55  //remove the old hits from the tower...
56  tower.clearHits();
57  tower.reserveHits(towerClusters.size());
58  clusters.clear();
59  clusters.reserve(towerClusters.size());
60  if(i > 1)
61  ATH_MSG_WARNING("more than one tower, m_clusters is only going to contain those from the last one");
62 
63  unsigned cluster_count = 0;
64  unsigned int pixelCounter = 0;
65  unsigned int stripCounter = 0;
66  for ( auto &cluster: towerClusters){
67  SetMinMaxIndicies(cluster);
70 
71  FPGATrackSimHit cluster_as_FPGATrackSimhit = cluster.getClusterEquiv();
72  cluster_as_FPGATrackSimhit.setHitType(HitType::clustered);
73  cluster_as_FPGATrackSimhit.setParentageMask(cluster_count); // making use of unused m_parentageMask to keep track of cluster index
74 
75  if(cluster_as_FPGATrackSimhit.getDetType() == SiliconTech::pixel)
76  {
77  cluster_as_FPGATrackSimhit.setCluster1ID(pixelCounter);
78  pixelCounter++;
79  }
80  else if(cluster_as_FPGATrackSimhit.getDetType() == SiliconTech::strip)
81  {
82  cluster_as_FPGATrackSimhit.setCluster1ID(stripCounter);
83  stripCounter++;
84  }
85  if(m_LorentzAngleShift>= 0){
86  ATH_CHECK(m_lorentzAngleTool->updateHitPosition(cluster_as_FPGATrackSimhit, m_LorentzAngleShift));
87  }
88  tower.addHit(cluster_as_FPGATrackSimhit);
89  cluster.setClusterEquiv(cluster_as_FPGATrackSimhit);
90  //send back a copy for monitoring and to check when writing out hits in each road
91  clusters.push_back(cluster);
92  cluster_count++;
93  }
94  }
95  ATH_MSG_DEBUG("Produced "<< clusters.size()<< " clusters");
96  return StatusCode::SUCCESS;
97 }

◆ etaOrPhi()

bool FPGATrackSimClusteringTool::etaOrPhi ( const FPGATrackSimHit hit) const
private

Definition at line 385 of file FPGATrackSimClusteringTool.cxx.

385  {
386 
387  /*This currently might get complicated as eta/phi ordering varies depending on the position in the detector.
388  * For ITK-20-00-00 Step 2.2 inclined duals layout, worked out by Naoki.
389  * Detector position | Module Type (# chip) | Column | Row |
390  * =============================================================================
391  * Barrel Layer 0 Eta module 1-6 | 2 (double) | eta | phi |
392  * Barrel Layer 0 Eta module 7-22 | 1 (single) | phi | eta |
393  * Barrel Layer 1 Eta module 1-6 | 3 (quad) | eta | phi |
394  * Barrel Layer 1 Eta module 7-19 | 3 | phi | eta |
395  * Barrel Layer 2 Eta module 1-11 | 3 | eta | phi |
396  * Barrel Layer 2 Eta module 12-22 | 2 | phi | eta |
397  * Barrel Layer 3 Eta module 1-12 | 3 | eta | phi |
398  * Barrel Layer 3 Eta module 13-25 | 2 | phi | eta |
399  * Barrel Layer 4 Eta module 1-13 | 3 | eta | phi |
400  * Barrel Layer 4 Eta module 14-26 | 2 | phi | eta |
401  * All Endcap modules | 3 | eta | phi |
402  * =============================================================================
403  * Module Type 1 = Single, 2, Dual, 3 Quad
404  * 328x400 blocks
405  * Hit type is essentially isPixel
406  * DetectorZone 0 = Barrel, -ive/+ive = endcaps
407  */
408 
409  //Check if the two hits are from the same module
410  //If it is not a barrel module then sort eta as column
412  return ETA;
413  }
414  //Otherwise it is a barrel module and now things get more complicated
415  else {
416  //Start by looking at what layer it is in
417  if (hit.getPhysLayer() == 0 || hit.getPhysLayer() == 1) {
418  if (hit.getEtaModule() <=6) {
419  return ETA;
420  } else {
421  return PHI;
422  }
423  } else if (hit.getPhysLayer() == 2) {
424  if (hit.getEtaModule() <=11) {
425  return ETA;
426  } else {
427  return PHI;
428  }
429  } else if (hit.getPhysLayer() == 3) {
430  if (hit.getEtaModule() <=12) {
431  return ETA;
432  } else {
433  return PHI;
434  }
435  } else if (hit.getPhysLayer() == 4) {
436  if (hit.getEtaModule() <=13) {
437  return ETA;
438  } else {
439  return PHI;
440  }
441  }
442  }
443  //Default to ETA, but shouldn't reach here
444  return ETA;
445 }

◆ initialize()

StatusCode FPGATrackSimClusteringTool::initialize ( )
overridevirtual

Definition at line 25 of file FPGATrackSimClusteringTool.cxx.

25  {
26  ATH_CHECK(m_lorentzAngleTool.retrieve(EnableTool{m_LorentzAngleShift >=0}));
27  return StatusCode::SUCCESS;
28 }

◆ normaliseClusters()

void FPGATrackSimClusteringTool::normaliseClusters ( std::vector< FPGATrackSimCluster > &  clusters) const
private

Definition at line 362 of file FPGATrackSimClusteringTool.cxx.

362  {
363  for( auto &cluster:clusters){
364  //Grab the cluster equiv
365  FPGATrackSimHit clusterEquiv = cluster.getClusterEquiv();
366  //Update the clusterEquiv's position and width
367  if(clusterEquiv.isStrip()){
368  //Clear the groupsize, set this to be one as we are only clustering one row.
369  clusterEquiv.setEtaWidth(1);
371  clusterEquiv.setPhiWidth(clusterEquiv.getPhiWidth()+1);
372  } else {
373  // Nothing to normalise for pixel clusters
374  continue;
375  }
376  cluster.setClusterEquiv(clusterEquiv);
377  }
378 }

◆ reduceGlobalCoordPrecision() [1/2]

void FPGATrackSimClusteringTool::reduceGlobalCoordPrecision ( FPGATrackSimCluster cluster) const
private

Definition at line 722 of file FPGATrackSimClusteringTool.cxx.

722  {
723  FPGATrackSimHit clusterEquiv = cluster.getClusterEquiv();
724  float pos[3] = { clusterEquiv.getR(), clusterEquiv.getGPhi(), clusterEquiv.getZ() };
725 
726  pos[0] = std::trunc(pos[0] / m_coordRPrecision) * m_coordRPrecision;
727  pos[1] = std::trunc(pos[1] / m_coordPhiPrecision) * m_coordPhiPrecision;
728  pos[2] = std::trunc(pos[2] / m_coordZPrecision) * m_coordZPrecision;
729 
730  clusterEquiv.setX(pos[0] * std::cos(pos[1]));
731  clusterEquiv.setY(pos[0] * std::sin(pos[1]));
732  clusterEquiv.setZ(pos[2]);
733 
734  cluster.setClusterEquiv(clusterEquiv);
735 }

◆ reduceGlobalCoordPrecision() [2/2]

void FPGATrackSimClusteringTool::reduceGlobalCoordPrecision ( FPGATrackSimHit hit) const
private

Definition at line 737 of file FPGATrackSimClusteringTool.cxx.

737  {
738  float pos[3] = { hit.getR(), hit.getGPhi(), hit.getZ() };
739 
740  pos[0] = std::trunc(pos[0] / m_coordRPrecision) * m_coordRPrecision;
741  pos[1] = std::trunc(pos[1] / m_coordPhiPrecision) * m_coordPhiPrecision;
742  pos[2] = std::trunc(pos[2] / m_coordZPrecision) * m_coordZPrecision;
743 
744  hit.setX(pos[0] * std::cos(pos[1]));
745  hit.setY(pos[0] * std::sin(pos[1]));
746  hit.setZ(pos[2]);
747 }

◆ SetMinMaxIndicies()

void FPGATrackSimClusteringTool::SetMinMaxIndicies ( FPGATrackSimCluster cluster) const
private

Definition at line 99 of file FPGATrackSimClusteringTool.cxx.

99  {
100  //Set the min and max indices for the cluster equivalent
101  FPGATrackSimHit clusterEquiv = cluster.getClusterEquiv();
102  int maxPhiIdx{-std::numeric_limits<int>::max()}, maxEtaIdx{-std::numeric_limits<int>::max()};
103  int minPhiIdx{std::numeric_limits<int>::max()}, minEtaIdx{std::numeric_limits<int>::max()};
104  for (const FPGATrackSimHit& hit : cluster.getHitList()){
105  maxPhiIdx = std::max(maxPhiIdx, static_cast<int>(hit.getPhiIndex()));
106  minPhiIdx = std::min(minPhiIdx, static_cast<int>(hit.getPhiIndex()));
107  maxEtaIdx = std::max(maxEtaIdx, static_cast<int>(hit.getEtaIndex()));
108  minEtaIdx = std::min(minEtaIdx, static_cast<int>(hit.getEtaIndex()));
109  }
110  clusterEquiv.setMinPhiIndex(minPhiIdx);
111  clusterEquiv.setMaxPhiIndex(maxPhiIdx);
112  clusterEquiv.setMinEtaIndex(minEtaIdx);
113  clusterEquiv.setMaxEtaIndex(maxEtaIdx);
114  cluster.setClusterEquiv(clusterEquiv);
115 }

◆ SortedClustering()

void FPGATrackSimClusteringTool::SortedClustering ( HitPtrContainer &&  sorted_hits,
std::vector< FPGATrackSimCluster > &  clusters 
) const
private

Definition at line 118 of file FPGATrackSimClusteringTool.cxx.

118  {
119  std::vector<FPGATrackSimCluster> moduleClusters;
120  //Loop over the sorted modules that we have
121  for( HitPtrCollection & moduleHits: sorted_hits){
122  //Make the clusters for this module
123  Clustering(std::move(moduleHits), moduleClusters);
124  //Put these clusters into the output list
125  clusters.insert(clusters.end(), moduleClusters.begin(), moduleClusters.end());
126  //Clear the vector or this will get messy
127  moduleClusters.clear();
128  }
129 }

◆ sortHitsOnModules() [1/2]

void FPGATrackSimClusteringTool::sortHitsOnModules ( HitPtrContainer hitsPerModule) const
private

Definition at line 345 of file FPGATrackSimClusteringTool.cxx.

345  {
346  //Loop over the module separated hits
347  for ( auto& module:hitsPerModule){
348  if (module.size() > 1) {
349  if (module.at(0)->isStrip())
351  }
352  if (module.size() > 1) {
353  if (module.at(0)->isStrip())
355  }
356  }
357 }

◆ sortHitsOnModules() [2/2]

void FPGATrackSimClusteringTool::sortHitsOnModules ( HitPtrContainer hitsPerModule,
int &  eta_phi 
) const
private

Definition at line 315 of file FPGATrackSimClusteringTool.cxx.

315  {
316  //Loop over the module separated hits
317  for ( auto& module:hitsPerModule){
318  //Work out if columns are ETA (1) || PHI (0)
319  if(etaOrPhi(*module.at(0)) == true){
320  //Sort by ETA first
321  eta_phi = ETA;
322  if (module.size() > 1) {
323  if (module.at(0)->isStrip())
325  }
326  if (module.size() > 1) {
327  if (module.at(0)->isStrip())
329  }
330  } else {
331  //Sort by PHI first
332  eta_phi = PHI;
333  if (module.size() > 1) {
334  if (module.at(0)->isStrip())
336  }
337  if (module.size() > 1) {
338  if (module.at(0)->isStrip())
340  }
341  }
342  }
343 }

◆ sortIBLInput()

bool FPGATrackSimClusteringTool::sortIBLInput ( const std::unique_ptr< FPGATrackSimHit > &  i,
const std::unique_ptr< FPGATrackSimHit > &  j 
) const
private

◆ sortPixelInput()

bool FPGATrackSimClusteringTool::sortPixelInput ( const std::unique_ptr< FPGATrackSimHit > &  i,
const std::unique_ptr< FPGATrackSimHit > &  j 
) const
private

◆ splitAndSortHits() [1/2]

void FPGATrackSimClusteringTool::splitAndSortHits ( HitPtrCollection &&  hits,
HitPtrContainer hitsPerModule 
) const
private

Definition at line 286 of file FPGATrackSimClusteringTool.cxx.

286  {
287  splitHitsToModules(std::move(hits), hitsPerModule);
288  sortHitsOnModules(hitsPerModule);
289 }

◆ splitAndSortHits() [2/2]

void FPGATrackSimClusteringTool::splitAndSortHits ( HitPtrCollection &&  hits,
HitPtrContainer hitsPerModule,
int &  eta_phi 
) const
private

Definition at line 280 of file FPGATrackSimClusteringTool.cxx.

280  {
281  splitHitsToModules(std::move(hits), hitsPerModule);
282  sortHitsOnModules(hitsPerModule, eta_phi);
283 }

◆ splitHitsToModules()

void FPGATrackSimClusteringTool::splitHitsToModules ( HitPtrCollection &&  hits,
HitPtrContainer hitsPerModule 
) const
private

Definition at line 293 of file FPGATrackSimClusteringTool.cxx.

293  {
294  //To hold the current module
295  HitPtrCollection currentModule;
296  uint hashing = 0;
297  //Split the incoming hits into hits by module
298  for ( auto& hit:hits){
299  if(hashing == 0){
300  hashing = hit->getIdentifierHash();
301  currentModule.push_back(std::move(hit));
302  } else if (hit->getIdentifierHash() == hashing) {
303  currentModule.push_back(std::move(hit));
304  } else {
305  hitsPerModule.push_back(std::exchange(currentModule, HitPtrCollection{}));
306  hashing = hit->getIdentifierHash();
307  currentModule.push_back(std::move(hit));
308  }
309  }
310 
311  // Now push that last one
312  if (currentModule.size() > 0) hitsPerModule.push_back(std::move(currentModule));
313 }

Member Data Documentation

◆ m_coordPhiPrecision

Gaudi::Property<float> FPGATrackSimClusteringTool::m_coordPhiPrecision {this, "CoordPhiPrecision", 1./8192., "fixed point precision of phi coordinate" }
private

Definition at line 48 of file FPGATrackSimClusteringTool.h.

◆ m_coordRPrecision

Gaudi::Property<float> FPGATrackSimClusteringTool::m_coordRPrecision {this, "CoordRPrecision", 1./64., "fixed point precision of r coordinate" }
private

Definition at line 47 of file FPGATrackSimClusteringTool.h.

◆ m_coordZPrecision

Gaudi::Property<float> FPGATrackSimClusteringTool::m_coordZPrecision {this, "CoordZPrecision", 1./32., "fixed point precision of z coordinate" }
private

Definition at line 49 of file FPGATrackSimClusteringTool.h.

◆ m_digitalClustering

Gaudi::Property<bool> FPGATrackSimClusteringTool::m_digitalClustering {this, "DigitalClustering", true, "flag to enable digital clustering instead of ToT weighted position calculation" }
private

Definition at line 45 of file FPGATrackSimClusteringTool.h.

◆ m_LorentzAngleShift

Gaudi::Property<int> FPGATrackSimClusteringTool::m_LorentzAngleShift { this, "LorentzAngleShift", -1, "flag for Lorentz angle shift. -1 means off, 0 means full corrections from first version, 1 means smaller LUT, 2 means very small LUT" }
private

Definition at line 50 of file FPGATrackSimClusteringTool.h.

◆ m_lorentzAngleTool

ToolHandle<FPGATrackSim::LorentzAngleTool> FPGATrackSimClusteringTool::m_lorentzAngleTool {this, "LorentzAngleTool", "", "FPGATrackSim tool to retrieve Lorentz angle"}
private

Definition at line 52 of file FPGATrackSimClusteringTool.h.

◆ m_reduceCoordPrecision

Gaudi::Property<bool> FPGATrackSimClusteringTool::m_reduceCoordPrecision {this, "ReduceCoordPrecision", false, "flag to enable reducing the precision of global coordinates" }
private

Definition at line 46 of file FPGATrackSimClusteringTool.h.


The documentation for this class was generated from the following files:
FPGATrackSimClusteringTool::SetMinMaxIndicies
void SetMinMaxIndicies(FPGATrackSimCluster &cluster) const
Definition: FPGATrackSimClusteringTool.cxx:99
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
FPGATrackSimCLUSTERING::updateStripCluster
bool updateStripCluster(FPGATrackSimCluster &currentCluster, FPGATrackSimHit &incomingHit, bool newCluster, bool digitalClustering)
Definition: FPGATrackSimClusteringTool.cxx:550
FPGATrackSimTowerInputHeader::clearHits
void clearHits()
Definition: FPGATrackSimTowerInputHeader.h:49
CXXUTILS_TRAPPING_FP
#define CXXUTILS_TRAPPING_FP
Definition: trapping_fp.h:24
FPGATrackSimClusteringTool::Clustering
void Clustering(HitPtrCollection &&, std::vector< FPGATrackSimCluster > &) const
Definition: FPGATrackSimClusteringTool.cxx:132
getMenu.algname
algname
Definition: getMenu.py:54
FPGATrackSimCluster::getHitList
hitVector const & getHitList() const
Definition: FPGATrackSimCluster.h:30
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
SiliconTech::strip
@ strip
FPGATrackSimHit::getEtaModule
int getEtaModule(bool old=false) const
Definition: FPGATrackSimHit.h:87
FPGATrackSimHit::isStrip
bool isStrip() const
Definition: FPGATrackSimHit.h:65
header
Definition: hcg.cxx:526
FPGATrackSimHit::getToT
unsigned getToT() const
Definition: FPGATrackSimHit.h:164
FPGATrackSimClusteringTool::m_lorentzAngleTool
ToolHandle< FPGATrackSim::LorentzAngleTool > m_lorentzAngleTool
Definition: FPGATrackSimClusteringTool.h:52
FPGATrackSimCluster
Definition: FPGATrackSimCluster.h:24
FPGATrackSimHit::setMinEtaIndex
void setMinEtaIndex(int v)
Definition: FPGATrackSimHit.h:117
FPGATrackSimHit::setEtaIndex
void setEtaIndex(unsigned v)
Definition: FPGATrackSimHit.h:102
FPGATrackSimCLUSTERING::updatePixelCluster
bool updatePixelCluster(FPGATrackSimCluster &currentCluster, FPGATrackSimHit &incomingHit, bool newCluster, bool digitalClustering)
Definition: FPGATrackSimClusteringTool.cxx:468
FPGATrackSimHit::setPhiCoord
void setPhiCoord(float v)
Definition: FPGATrackSimHit.h:105
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
FPGATrackSimHit::setCentroidPhiIndex
void setCentroidPhiIndex(float v)
Definition: FPGATrackSimHit.h:103
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
FPGATrackSimHit::getX
float getX() const
Definition: FPGATrackSimHit.h:149
FPGATrackSimClusteringTool::sortHitsOnModules
void sortHitsOnModules(HitPtrContainer &hitsPerModule, int &eta_phi) const
Definition: FPGATrackSimClusteringTool.cxx:315
FPGATrackSimHit::setMaxEtaIndex
void setMaxEtaIndex(int v)
Definition: FPGATrackSimHit.h:116
FPGATrackSimClusteringTool::HitPtrCollection
std::vector< std::unique_ptr< FPGATrackSimHit > > HitPtrCollection
Definition: FPGATrackSimClusteringTool.h:54
skel.it
it
Definition: skel.GENtoEVGEN.py:407
FPGATrackSimHit::setEtaWidth
void setEtaWidth(unsigned v)
Definition: FPGATrackSimHit.h:78
FPGATrackSimClusteringTool::m_coordPhiPrecision
Gaudi::Property< float > m_coordPhiPrecision
Definition: FPGATrackSimClusteringTool.h:48
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
RoiUtil::PHI
@ PHI
Definition: RoiSerialise.cxx:31
FPGATrackSimHit::setY
void setY(float v)
Definition: FPGATrackSimHit.h:147
FPGATrackSimCluster::setClusterEquiv
void setClusterEquiv(const FPGATrackSimHit &input)
Definition: FPGATrackSimCluster.h:35
FPGATrackSimCLUSTERING::sortITkInputPhi
bool sortITkInputPhi(const std::unique_ptr< FPGATrackSimHit > &hitA, const std::unique_ptr< FPGATrackSimHit > &HitB)
Definition: FPGATrackSimClusteringTool.cxx:714
FPGATrackSimClusteringTool::splitAndSortHits
void splitAndSortHits(HitPtrCollection &&hits, HitPtrContainer &hitsPerModule, int &eta_phi) const
Definition: FPGATrackSimClusteringTool.cxx:280
std::stable_sort
void stable_sort(std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, std::reverse_iterator< DataModel_detail::iterator< DVL > > end, Compare comp)
Specialization of stable_sort for DataVector/List.
Definition: DVL_algorithms.h:711
FPGATrackSimTowerInputHeader::addHit
void addHit(const FPGATrackSimHit &s)
Definition: FPGATrackSimTowerInputHeader.h:48
FPGATrackSimHit
Definition: FPGATrackSimHit.h:41
FPGATrackSimHit::getGPhi
float getGPhi() const
Definition: FPGATrackSimHit.h:153
FPGATrackSimHit::setMaxPhiIndex
void setMaxPhiIndex(int v)
Definition: FPGATrackSimHit.h:114
FPGATrackSimClusteringTool::etaOrPhi
bool etaOrPhi(const FPGATrackSimHit &hit) const
Definition: FPGATrackSimClusteringTool.cxx:385
FPGATrackSimHit::getPhiCoord
float getPhiCoord() const
Definition: FPGATrackSimHit.h:111
python.PyAthena.module
module
Definition: PyAthena.py:131
FPGATrackSimHit::setMinPhiIndex
void setMinPhiIndex(int v)
Definition: FPGATrackSimHit.h:115
FPGATrackSimHit::setX
void setX(float v)
Definition: FPGATrackSimHit.h:146
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
FPGATrackSimHit::setToT
void setToT(unsigned v)
Definition: FPGATrackSimHit.h:157
FPGATrackSimHit::setPhiIndex
void setPhiIndex(unsigned v)
Definition: FPGATrackSimHit.h:101
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:727
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
FPGATrackSimHit::setEtaCoord
void setEtaCoord(float v)
Definition: FPGATrackSimHit.h:106
FPGATrackSimClusteringTool::normaliseClusters
void normaliseClusters(std::vector< FPGATrackSimCluster > &clusters) const
Definition: FPGATrackSimClusteringTool.cxx:362
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
FPGATrackSimHit::getY
float getY() const
Definition: FPGATrackSimHit.h:150
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
FPGATrackSimClusteringTool::m_coordZPrecision
Gaudi::Property< float > m_coordZPrecision
Definition: FPGATrackSimClusteringTool.h:49
FPGATrackSimHit::setCluster1ID
void setCluster1ID(int v)
Definition: FPGATrackSimHit.h:191
FPGATrackSimCLUSTERING::sortITkInputEta
bool sortITkInputEta(const std::unique_ptr< FPGATrackSimHit > &hitA, const std::unique_ptr< FPGATrackSimHit > &hitB)
Definition: FPGATrackSimClusteringTool.cxx:705
FPGATrackSimHit::getZ
float getZ() const
Definition: FPGATrackSimHit.h:151
FPGATrackSimHit::getDetectorZone
DetectorZone getDetectorZone() const
Definition: FPGATrackSimHit.h:59
FPGATrackSimClusteringTool::SortedClustering
void SortedClustering(HitPtrContainer &&sorted_hits, std::vector< FPGATrackSimCluster > &) const
Definition: FPGATrackSimClusteringTool.cxx:118
PixelCalibrationConfig.tot
tot
Definition: PixelCalibrationConfig.py:28
FPGATrackSimCluster::getClusterEquiv
FPGATrackSimHit const & getClusterEquiv() const
Definition: FPGATrackSimCluster.h:31
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
FPGATrackSimHit::getCentroidPhiIndex
float getCentroidPhiIndex() const
Definition: FPGATrackSimHit.h:109
HitType::clustered
@ clustered
FPGATrackSimClusteringTool::m_reduceCoordPrecision
Gaudi::Property< bool > m_reduceCoordPrecision
Definition: FPGATrackSimClusteringTool.h:46
FPGATrackSimHit::setPhiWidth
void setPhiWidth(unsigned v)
Definition: FPGATrackSimHit.h:79
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
RoiUtil::ETA
@ ETA
Definition: RoiSerialise.cxx:30
FPGATrackSimHit::getEtaCoord
float getEtaCoord() const
Definition: FPGATrackSimHit.h:112
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
FPGATrackSimHit::setZ
void setZ(float v)
Definition: FPGATrackSimHit.h:148
FPGATrackSimClusteringTool::m_digitalClustering
Gaudi::Property< bool > m_digitalClustering
Definition: FPGATrackSimClusteringTool.h:45
FPGATrackSimHit::getCentroidEtaIndex
float getCentroidEtaIndex() const
Definition: FPGATrackSimHit.h:110
fpgatracksim::scaleHitFactor
constexpr float scaleHitFactor
Definition: FPGATrackSimConstants.h:18
FPGATrackSimHit::getR
float getR() const
Definition: FPGATrackSimHit.h:152
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
FPGATrackSimTowerInputHeader::reserveHits
void reserveHits(size_t size)
Definition: FPGATrackSimTowerInputHeader.h:50
FPGATrackSimHit::getDetType
SiliconTech getDetType() const
Definition: FPGATrackSimHit.h:58
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
DetectorZone::barrel
@ barrel
FPGATrackSimTowerInputHeader::hits
const std::vector< FPGATrackSimHit > & hits() const
Definition: FPGATrackSimTowerInputHeader.h:46
FPGATrackSimClusteringTool::splitHitsToModules
void splitHitsToModules(HitPtrCollection &&hits, HitPtrContainer &hitsPerModule) const
Definition: FPGATrackSimClusteringTool.cxx:293
FPGATrackSimHit::getPhysLayer
unsigned getPhysLayer(bool old=false) const
Definition: FPGATrackSimHit.cxx:72
FPGATrackSimClusteringTool::reduceGlobalCoordPrecision
void reduceGlobalCoordPrecision(FPGATrackSimCluster &cluster) const
Definition: FPGATrackSimClusteringTool.cxx:722
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
FPGATrackSimHit::setCentroidEtaIndex
void setCentroidEtaIndex(float v)
Definition: FPGATrackSimHit.h:104
FPGATrackSimHit::setParentageMask
void setParentageMask(unsigned long v)
Definition: FPGATrackSimHit.h:162
FPGATrackSimTowerInputHeader
Definition: FPGATrackSimTowerInputHeader.h:18
FPGATrackSimHit::getPhiWidth
unsigned getPhiWidth() const
Definition: FPGATrackSimHit.h:86
SiliconTech::pixel
@ pixel
FPGATrackSimHit::setHitType
void setHitType(HitType type)
Definition: FPGATrackSimHit.h:54
FPGATrackSimClusteringTool::m_LorentzAngleShift
Gaudi::Property< int > m_LorentzAngleShift
Definition: FPGATrackSimClusteringTool.h:50
FPGATrackSimClusteringTool::m_coordRPrecision
Gaudi::Property< float > m_coordRPrecision
Definition: FPGATrackSimClusteringTool.h:47