BmnRoot
26.10.0-210-gc52d34b0
Software framework of the BM@N experiment
Toggle main menu visibility
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
11
using
std::vector;
12
13
L1HitsSortHelper::L1HitsSortHelper
(vector<L1StsHit>& hits,
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)
25
,
fStsHitsUnusedStartIndex
(iStart)
26
,
fStsHitsUnusedStopIndex
(iStop)
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)
33
for
(
THitI
i
=
fStsHitsUnusedStartIndex
[iS];
i
<
fStsHitsUnusedStopIndex
[iS];
i
++) {
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
41
void
L1HitsSortHelper::Sort
()
42
{
43
for
(
int
iS = 0; iS <
fNStations
; ++iS) {
44
std::sort(
fD
.begin() +
fStsHitsUnusedStartIndex
[iS],
fD
.begin() +
fStsHitsUnusedStopIndex
[iS],
45
L1HitsSortHelperData::compare
);
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
}
L1_ASSERT
#define L1_ASSERT(v, msg)
Definition
CbmL1Def.h:42
L1Grid.h
L1HitPoint.h
L1HitsSortHelper.h
L1StsHit.h
THitI
unsigned int THitI
Definition
L1StsHit.h:6
i
int i
Definition
P4_F32vec4.h:22
L1Grid
2-dimensional grid of pointers.
Definition
L1Grid.h:49
L1HitsSortHelper::fPoints
vector< L1HitPoint > & fPoints
Definition
L1HitsSortHelper.h:42
L1HitsSortHelper::fD
vector< L1HitsSortHelperData > fD
Definition
L1HitsSortHelper.h:40
L1HitsSortHelper::fStsHitsUnusedStartIndex
THitI * fStsHitsUnusedStartIndex
Definition
L1HitsSortHelper.h:45
L1HitsSortHelper::fGrid
const L1Grid * fGrid
Definition
L1HitsSortHelper.h:44
L1HitsSortHelper::fStsHitsUnusedStopIndex
THitI * fStsHitsUnusedStopIndex
Definition
L1HitsSortHelper.h:45
L1HitsSortHelper::fNStations
int fNStations
Definition
L1HitsSortHelper.h:46
L1HitsSortHelper::Sort
void Sort()
Definition
L1HitsSortHelper.cxx:41
L1HitsSortHelper::L1HitsSortHelper
L1HitsSortHelper(vector< L1StsHit > &hits, vector< L1HitPoint > &points, vector< THitI > &indices, const L1Grid *grid, THitI *iStart, THitI *iStop, int nStations)
Definition
L1HitsSortHelper.cxx:13
L1HitsSortHelper::fIndices
vector< THitI > & fIndices
Definition
L1HitsSortHelper.h:43
L1HitsSortHelper::fHits
vector< L1StsHit > & fHits
Definition
L1HitsSortHelper.h:41
L1HitsSortHelperData::compare
static bool compare(const L1HitsSortHelperData &a, const L1HitsSortHelperData &b)
Definition
L1HitsSortHelper.h:20
reconstruction
cat
L1Algo
L1HitsSortHelper.cxx
Generated on
for BmnRoot by
1.17.0