BmnRoot
Loading...
Searching...
No Matches
L1HitsSortHelper.cxx
Go to the documentation of this file.
1
2#include "L1HitsSortHelper.h"
3
4#include <vector>
5#include <algorithm>
6#include "L1StsHit.h"
7#include "L1HitPoint.h"
8#include "L1Grid.h"
9
10using std::vector;
11
12L1HitsSortHelper::L1HitsSortHelper( vector<L1StsHit> &hits, vector<L1HitPoint> &points, vector<THitI> &indices, const L1Grid* grid, THitI* iStart, THitI* iStop, int nStations ): fD(), fHits(hits), fPoints(points), fIndices(indices), fGrid(grid), fStsHitsUnusedStartIndex( iStart ), fStsHitsUnusedStopIndex( iStop ), fNStations(nStations) {
13 L1_ASSERT( hits.size() == points.size(), hits.size() << " " << points.size() );
14 const int NHits = hits.size();
15 fD.resize( NHits );
16 for ( int iS = 0; iS < fNStations; ++iS )
17 for( THitI i = fStsHitsUnusedStartIndex[iS]; i < fStsHitsUnusedStopIndex[iS]; i++ )
18 {
19 fD[i].h = &(hits[i]);
20 fD[i].p = &(points[i]);
21 fD[i].i = indices[i];
22 fD[i].bin = fGrid[iS].GetBinBounded( fD[i].p->Xs(), fD[i].p->Ys() );
23 }
24}
25
27 for ( int iS = 0; iS < fNStations; ++iS ) {
28 std::sort(fD.begin()+fStsHitsUnusedStartIndex[iS], fD.begin()+fStsHitsUnusedStopIndex[iS], L1HitsSortHelperData::compare);
29 }
30
31 vector<L1StsHit> hits = fHits;
32 vector<L1HitPoint> points = fPoints;
33 const int NHits = fD.size();
34 for ( int i = 0; i < NHits; i++ ) {
35 hits[i] = *fD[i].h;
36 points[i] = *fD[i].p;
37 fIndices[i] = fD[i].i;
38 }
39 fHits = hits;
40 fPoints = points;
41}
42
#define L1_ASSERT(v, msg)
Definition CbmL1Def.h:44
unsigned int THitI
Definition L1StsHit.h:6
int i
Definition P4_F32vec4.h:22
unsigned int GetBinBounded(const float &Y, const float &Z) const
Definition L1Grid.h:85
L1HitsSortHelper(vector< L1StsHit > &hits, vector< L1HitPoint > &points, vector< THitI > &indices, const L1Grid *grid, THitI *iStart, THitI *iStop, int nStations)
static bool compare(const L1HitsSortHelperData &a, const L1HitsSortHelperData &b)