CbmRoot
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 #include <algorithm>
8 #include <vector>
9 
10 using std::vector;
11 
13  vector<L1HitPoint>& points,
14  vector<THitI>& indices,
15  const L1Grid* grid,
16  THitI* iStart,
17  THitI* iStop,
18  int nStations,
19  int nDontUsedHits)
20  : fD()
21  , fHits(hits)
22  , fPoints(points)
23  , fIndices(indices)
24  , fGrid(grid)
25  , fStsHitsUnusedStartIndex(iStart)
26  , fStsHitsUnusedStopIndex(iStop)
27  , fNStations(nStations)
28  , fnDontUsedHits(nDontUsedHits) {
29  L1_ASSERT(hits.size() == points.size(), hits.size() << " " << points.size());
30  const int NHits = fnDontUsedHits;
31  fD.resize(NHits);
32  //float x,y=0;
33  for (int iS = 0; iS < fNStations; ++iS)
34  for (THitI i = fStsHitsUnusedStartIndex[iS];
36  i++) {
37  fD[i].h = &(hits[i]);
38  fD[i].p = &(points[i]);
39  fD[i].i = indices[i];
40  // StripsToCoor(fD[i].p->U(),fD[i].p->V(), x, y, vStations[iS]);
41  // fD[i].bin = fGrid[iS].GetBinBounded(x[0], y[0]);
42  }
43 }
44 
46  for (int iS = 0; iS < fNStations; ++iS) {
47  std::sort(fD.begin() + fStsHitsUnusedStartIndex[iS],
48  fD.begin() + fStsHitsUnusedStopIndex[iS],
50  }
51 
52  vector<L1StsHit> hits = fHits;
53  vector<L1HitPoint> points = fPoints;
54  const int NHits = fD.size();
55  for (int i = 0; i < NHits; i++) {
56  hits[i] = *fD[i].h;
57  points[i] = *fD[i].p;
58  fIndices[i] = fD[i].i;
59  }
60  fHits = hits;
61  fPoints = points;
62 }
L1Grid
Definition: L1Grid.h:39
L1HitsSortHelper::fNStations
int fNStations
Definition: L1HitsSortHelper.h:44
L1HitsSortHelper::fPoints
vector< L1HitPoint > & fPoints
Definition: L1HitsSortHelper.h:40
L1HitsSortHelper::Sort
void Sort()
Definition: L1HitsSortHelper.cxx:45
L1HitsSortHelper::fStsHitsUnusedStopIndex
THitI * fStsHitsUnusedStopIndex
Definition: L1HitsSortHelper.h:43
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
L1HitsSortHelper::fD
vector< L1HitsSortHelperData > fD
Definition: L1HitsSortHelper.h:38
THitI
unsigned int THitI
Definition: L1StsHit.h:8
L1HitsSortHelper::fHits
vector< L1StsHit > & fHits
Definition: L1HitsSortHelper.h:39
L1HitsSortHelperData::compare
static bool compare(const L1HitsSortHelperData &a, const L1HitsSortHelperData &b)
Definition: L1HitsSortHelper.h:18
L1HitsSortHelper::fStsHitsUnusedStartIndex
THitI * fStsHitsUnusedStartIndex
Definition: L1HitsSortHelper.h:43
L1HitPoint.h
L1HitsSortHelper::fnDontUsedHits
int fnDontUsedHits
Definition: L1HitsSortHelper.h:45
L1HitsSortHelper.h
points
TClonesArray * points
Definition: Analyze_matching.h:18
L1StsHit.h
hits
static vector< vector< QAHit > > hits
Definition: CbmTofHitFinderTBQA.cxx:114
L1HitsSortHelper::fIndices
vector< THitI > & fIndices
Definition: L1HitsSortHelper.h:41
L1HitsSortHelper::L1HitsSortHelper
L1HitsSortHelper(vector< L1StsHit > &hits, vector< L1HitPoint > &points, vector< THitI > &indices, const L1Grid *grid, THitI *iStart, THitI *iStop, int nStations, int nDontUsedHits)
Definition: L1HitsSortHelper.cxx:12
L1_ASSERT
#define L1_ASSERT(v, msg)
Definition: CbmL1Def.h:48
L1Grid.h