BmnRoot 26.10.0-210-gc52d34b0
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
L1HitsSortHelper.cxx
Go to the documentation of this file.
1
2#include "L1HitsSortHelper.h"
3
4#include "L1Grid.h"
5#include "L1HitPoint.h"
6#include "L1StsHit.h"
7
8#include <algorithm>
9#include <vector>
10
11using std::vector;
12
14 vector<L1HitPoint>& points,
15 vector<THitI>& indices,
16 const L1Grid* grid,
17 THitI* iStart,
18 THitI* iStop,
19 int nStations)
20 : fD()
21 , fHits(hits)
22 , fPoints(points)
23 , fIndices(indices)
24 , fGrid(grid)
27 , fNStations(nStations)
28{
29 L1_ASSERT(hits.size() == points.size(), hits.size() << " " << points.size());
30 const int NHits = hits.size();
31 fD.resize(NHits);
32 for (int iS = 0; iS < fNStations; ++iS)
34 fD[i].h = &(hits[i]);
35 fD[i].p = &(points[i]);
36 fD[i].i = indices[i];
37 fD[i].bin = fGrid[iS].GetBinBounded(fD[i].p->Xs(), fD[i].p->Ys());
38 }
39}
40
42{
43 for (int iS = 0; iS < fNStations; ++iS) {
44 std::sort(fD.begin() + fStsHitsUnusedStartIndex[iS], fD.begin() + fStsHitsUnusedStopIndex[iS],
46 }
47
48 vector<L1StsHit> hits = fHits;
49 vector<L1HitPoint> points = fPoints;
50 const int NHits = fD.size();
51 for (int i = 0; i < NHits; i++) {
52 hits[i] = *fD[i].h;
53 points[i] = *fD[i].p;
54 fIndices[i] = fD[i].i;
55 }
56 fHits = hits;
57 fPoints = points;
58}
#define L1_ASSERT(v, msg)
Definition CbmL1Def.h:42
unsigned int THitI
Definition L1StsHit.h:6
int i
Definition P4_F32vec4.h:22
2-dimensional grid of pointers.
Definition L1Grid.h:49
vector< L1HitPoint > & fPoints
vector< L1HitsSortHelperData > fD
THitI * fStsHitsUnusedStartIndex
const L1Grid * fGrid
THitI * fStsHitsUnusedStopIndex
L1HitsSortHelper(vector< L1StsHit > &hits, vector< L1HitPoint > &points, vector< THitI > &indices, const L1Grid *grid, THitI *iStart, THitI *iStop, int nStations)
vector< THitI > & fIndices
vector< L1StsHit > & fHits
static bool compare(const L1HitsSortHelperData &a, const L1HitsSortHelperData &b)