1616
1717#include " DataFormatsITS/TrackITS.h"
1818
19+ #include " ITStracking/TrackHelpers.h"
1920#include " ITStrackingGPU/TrackerTraitsGPU.h"
2021#include " ITStrackingGPU/TrackingKernels.h"
2122#include " ITStracking/Constants.h"
@@ -184,6 +185,7 @@ void TrackerTraitsGPU<NLayers>::computeLayerCells(const int iteration)
184185 this ->mTrkParams [iteration].MaxChi2ClusterAttachment ,
185186 this ->mTrkParams [iteration].CellDeltaTanLambdaSigma ,
186187 this ->mTrkParams [iteration].NSigmaCut ,
188+ this ->mTrkParams [iteration].LayerxX0 ,
187189 mTimeFrameGPU ->getFrameworkAllocator (),
188190 mTimeFrameGPU ->getStreams ());
189191 mTimeFrameGPU ->createCellsBuffers (iLayer);
@@ -204,6 +206,7 @@ void TrackerTraitsGPU<NLayers>::computeLayerCells(const int iteration)
204206 this ->mTrkParams [iteration].MaxChi2ClusterAttachment ,
205207 this ->mTrkParams [iteration].CellDeltaTanLambdaSigma ,
206208 this ->mTrkParams [iteration].NSigmaCut ,
209+ this ->mTrkParams [iteration].LayerxX0 ,
207210 mTimeFrameGPU ->getStreams ());
208211 }
209212}
@@ -263,6 +266,10 @@ void TrackerTraitsGPU<NLayers>::findCellsNeighbours(const int iteration)
263266template <int NLayers>
264267void TrackerTraitsGPU<NLayers>::findRoads(const int iteration)
265268{
269+ bounded_vector<bounded_vector<int >> firstClusters (this ->mTrkParams [iteration].NLayers , bounded_vector<int >(this ->getMemoryPool ().get ()), this ->getMemoryPool ().get ());
270+ bounded_vector<bounded_vector<int >> sharedFirstClusters (this ->mTrkParams [iteration].NLayers , bounded_vector<int >(this ->getMemoryPool ().get ()), this ->getMemoryPool ().get ());
271+ firstClusters.resize (this ->mTrkParams [iteration].NLayers );
272+ sharedFirstClusters.resize (this ->mTrkParams [iteration].NLayers );
266273 for (int startLevel{this ->mTrkParams [iteration].CellsPerRoad ()}; startLevel >= this ->mTrkParams [iteration].CellMinimumLevel (); --startLevel) {
267274 const int minimumLayer{startLevel - 1 };
268275 bounded_vector<TrackSeed<NLayers>> trackSeeds (this ->getMemoryPool ().get ());
@@ -281,10 +288,11 @@ void TrackerTraitsGPU<NLayers>::findRoads(const int iteration)
281288 mTimeFrameGPU ->getDeviceArrayTrackingFrameInfo (),
282289 trackSeeds,
283290 this ->mBz ,
284- this ->mTrkParams [0 ].MaxChi2ClusterAttachment ,
285- this ->mTrkParams [0 ].MaxChi2NDF ,
291+ this ->mTrkParams [iteration].MaxChi2ClusterAttachment ,
292+ this ->mTrkParams [iteration].MaxChi2NDF ,
293+ this ->mTrkParams [iteration].LayerxX0 ,
286294 mTimeFrameGPU ->getDevicePropagator (),
287- this ->mTrkParams [0 ].CorrType ,
295+ this ->mTrkParams [iteration ].CorrType ,
288296 mTimeFrameGPU ->getFrameworkAllocator ());
289297 }
290298 // fixme: I don't want to move tracks back and forth, but I need a way to use a thrust::allocator that is aware of our managed memory.
@@ -302,16 +310,17 @@ void TrackerTraitsGPU<NLayers>::findRoads(const int iteration)
302310 mTimeFrameGPU ->getDeviceTrackSeedsLUT (),
303311 this ->mTrkParams [iteration].LayerRadii ,
304312 this ->mTrkParams [iteration].MinPt ,
313+ this ->mTrkParams [iteration].LayerxX0 ,
305314 trackSeeds.size (),
306315 this ->mBz ,
307316 startLevel,
308- this ->mTrkParams [0 ].MaxChi2ClusterAttachment ,
309- this ->mTrkParams [0 ].MaxChi2NDF ,
310- this ->mTrkParams [0 ].ReseedIfShorter ,
311- this ->mTrkParams [0 ].RepeatRefitOut ,
312- this ->mTrkParams [0 ].ShiftRefToCluster ,
317+ this ->mTrkParams [iteration ].MaxChi2ClusterAttachment ,
318+ this ->mTrkParams [iteration ].MaxChi2NDF ,
319+ this ->mTrkParams [iteration ].ReseedIfShorter ,
320+ this ->mTrkParams [iteration ].RepeatRefitOut ,
321+ this ->mTrkParams [iteration ].ShiftRefToCluster ,
313322 mTimeFrameGPU ->getDevicePropagator (),
314- this ->mTrkParams [0 ].CorrType ,
323+ this ->mTrkParams [iteration ].CorrType ,
315324 mTimeFrameGPU ->getFrameworkAllocator ());
316325 mTimeFrameGPU ->createTrackITSExtDevice (trackSeeds.size ());
317326 computeTrackSeedHandler (mTimeFrameGPU ->getDeviceTrackSeeds (),
@@ -321,65 +330,26 @@ void TrackerTraitsGPU<NLayers>::findRoads(const int iteration)
321330 mTimeFrameGPU ->getDeviceTrackSeedsLUT (),
322331 this ->mTrkParams [iteration].LayerRadii ,
323332 this ->mTrkParams [iteration].MinPt ,
333+ this ->mTrkParams [iteration].LayerxX0 ,
324334 trackSeeds.size (),
325335 mTimeFrameGPU ->getNTrackSeeds (),
326336 this ->mBz ,
327337 startLevel,
328- this ->mTrkParams [0 ].MaxChi2ClusterAttachment ,
329- this ->mTrkParams [0 ].MaxChi2NDF ,
330- this ->mTrkParams [0 ].ReseedIfShorter ,
331- this ->mTrkParams [0 ].RepeatRefitOut ,
332- this ->mTrkParams [0 ].ShiftRefToCluster ,
338+ this ->mTrkParams [iteration ].MaxChi2ClusterAttachment ,
339+ this ->mTrkParams [iteration ].MaxChi2NDF ,
340+ this ->mTrkParams [iteration ].ReseedIfShorter ,
341+ this ->mTrkParams [iteration ].RepeatRefitOut ,
342+ this ->mTrkParams [iteration ].ShiftRefToCluster ,
333343 mTimeFrameGPU ->getDevicePropagator (),
334- this ->mTrkParams [0 ].CorrType ,
344+ this ->mTrkParams [iteration ].CorrType ,
335345 mTimeFrameGPU ->getFrameworkAllocator ());
336346 mTimeFrameGPU ->downloadTrackITSExtDevice ();
337347
338348 auto & tracks = mTimeFrameGPU ->getTrackITSExt ();
339-
340- for (auto & track : tracks) {
341- if (!track.getChi2 ()) {
342- continue ; // this is to skip the unset tracks that are put at the beginning of the vector by the sorting. To see if this can be optimised.
343- }
344- int nShared = 0 ;
345- bool isFirstShared{false };
346- for (int iLayer{0 }; iLayer < this ->mTrkParams [0 ].NLayers ; ++iLayer) {
347- if (track.getClusterIndex (iLayer) == constants::UnusedIndex) {
348- continue ;
349- }
350- nShared += int (mTimeFrameGPU ->isClusterUsed (iLayer, track.getClusterIndex (iLayer)));
351- isFirstShared |= !iLayer && mTimeFrameGPU ->isClusterUsed (iLayer, track.getClusterIndex (iLayer));
352- }
353-
354- if (nShared > this ->mTrkParams [0 ].ClusterSharing ) {
355- continue ;
356- }
357-
358- bool firstCls{true };
359- TimeEstBC ts;
360- for (int iLayer{0 }; iLayer < this ->mTrkParams [0 ].NLayers ; ++iLayer) {
361- if (track.getClusterIndex (iLayer) == constants::UnusedIndex) {
362- continue ;
363- }
364- mTimeFrameGPU ->markUsedCluster (iLayer, track.getClusterIndex (iLayer));
365- int currentROF = mTimeFrameGPU ->getClusterROF (iLayer, track.getClusterIndex (iLayer));
366- auto rofTS = mTimeFrameGPU ->getROFOverlapTableView ().getLayer (iLayer).getROFTimeBounds (currentROF, true );
367- if (firstCls) {
368- ts = rofTS;
369- } else {
370- if (!ts.isCompatible (rofTS)) {
371- LOGP (fatal, " TS {}+/-{} are incompatible with {}+/-{}, this should not happen!" , rofTS.getTimeStamp (), rofTS.getTimeStampError (), ts.getTimeStamp (), ts.getTimeStampError ());
372- }
373- ts += rofTS;
374- }
375- }
376- track.getTimeStamp () = ts.makeSymmetrical ();
377- track.setUserField (0 );
378- track.getParamOut ().setUserField (0 );
379- mTimeFrameGPU ->getTracks ().emplace_back (track);
380- }
349+ this ->acceptTracks (iteration, tracks, firstClusters, sharedFirstClusters);
381350 mTimeFrameGPU ->loadUsedClustersDevice ();
382351 }
352+ this ->markTracks (iteration, sharedFirstClusters);
383353 // wipe the artefact memory
384354 mTimeFrameGPU ->popMemoryStack (iteration);
385355};
0 commit comments