Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cbmroot
Manage
Activity
Members
Labels
Plan
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computing
cbmroot
Merge requests
!1372
Ca: rewrite and restructure of the hit data stored in 2D grids, move grid data to /algo
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Ca: rewrite and restructure of the hit data stored in 2D grids, move grid data to /algo
se.gorbunov/cbmroot:CaGrid
into
master
Overview
1
Commits
3
Pipelines
3
Changes
21
Merged
Sergey Gorbunov
requested to merge
se.gorbunov/cbmroot:CaGrid
into
master
1 year ago
Overview
1
Commits
3
Pipelines
3
Changes
21
Expand
rewrite and restructure of the hit data stored in 2D grids
move the grid structures to /algo library
0
0
Merge request reports
Compare
master
version 2
bb770ce0
1 year ago
version 1
742df625
1 year ago
master (base)
and
latest version
latest version
360e1745
3 commits,
1 year ago
version 2
bb770ce0
3 commits,
1 year ago
version 1
742df625
3 commits,
1 year ago
21 files
+
701
−
756
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
21
Search (e.g. *.vue) (Ctrl+P)
algo/ca/core/data/CaGrid.cxx
0 → 100644
+
121
−
0
Options
/* Copyright (C) 2017-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Maksym Zyzak [committer], Valentina Akishina */
/// \file L1Grid.cxx
/// \brief Class for storing 2d objects in a grid
#include
"CaGrid.h"
#include
<algorithm>
#include
<string.h>
#include
"CaHit.h"
using
namespace
cbm
::
algo
::
ca
;
using
namespace
cbm
::
algo
;
void
Grid
::
BuildBins
(
fscal
xMin
,
fscal
xMax
,
fscal
yMin
,
fscal
yMax
,
fscal
binWidthX
,
fscal
binWidthY
)
{
fMinX
=
std
::
min
(
xMin
,
xMax
);
fMinY
=
std
::
min
(
yMin
,
yMax
);
xMax
=
std
::
max
(
xMin
,
xMax
);
yMax
=
std
::
max
(
yMin
,
yMax
);
fBinWidthX
=
binWidthX
;
fBinWidthY
=
binWidthY
;
// some sanity checks
if
(
fBinWidthX
<
0.001
)
{
fBinWidthX
=
0.001
;
}
if
(
fBinWidthY
<
0.001
)
{
fBinWidthY
=
0.001
;
}
fBinWidthXinv
=
1.
/
fBinWidthX
;
fBinWidthYinv
=
1.
/
fBinWidthY
;
fNx
=
static_cast
<
int
>
(
std
::
ceil
((
xMax
-
fMinX
)
/
fBinWidthX
));
fNy
=
static_cast
<
int
>
(
std
::
ceil
((
yMax
-
fMinY
)
/
fBinWidthY
));
// some sanity checks
if
(
fNx
<
1
)
fNx
=
1
;
if
(
fNy
<
1
)
fNy
=
1
;
fN
=
fNx
*
fNy
;
fEntries
.
clear
();
fFirstBinEntryIndex
.
reset
(
fN
+
1
,
0
);
fNofBinEntries
.
reset
(
fN
+
1
,
0
);
}
void
Grid
::
StoreHits
(
const
Vector
<
ca
::
Hit
>&
hits
,
ca
::
HitIndex_t
hitStartIndex
,
ca
::
HitIndex_t
nHits
,
const
Vector
<
unsigned
char
>&
hitKeyFlags
)
{
fFirstBinEntryIndex
.
reset
(
fN
+
1
,
0
);
fNofBinEntries
.
reset
(
fN
+
1
,
0
);
int
nEntries
=
0
;
for
(
ca
::
HitIndex_t
ih
=
0
;
ih
<
nHits
;
ih
++
)
{
const
ca
::
Hit
&
hit
=
hits
[
hitStartIndex
+
ih
];
if
(
!
(
hitKeyFlags
[
hit
.
f
]
||
hitKeyFlags
[
hit
.
b
]))
{
fNofBinEntries
[
GetBin
(
hit
.
x
,
hit
.
y
)]
++
;
nEntries
++
;
}
}
fEntries
.
reset
(
nEntries
);
for
(
int
bin
=
0
;
bin
<
fN
;
bin
++
)
{
fFirstBinEntryIndex
[
bin
+
1
]
=
fFirstBinEntryIndex
[
bin
]
+
fNofBinEntries
[
bin
];
fNofBinEntries
[
bin
]
=
0
;
}
fNofBinEntries
[
fN
]
=
0
;
fMaxRangeX
=
0.
;
fMaxRangeY
=
0.
;
fMaxRangeT
=
0.
;
for
(
ca
::
HitIndex_t
ih
=
0
;
ih
<
nHits
;
ih
++
)
{
const
ca
::
Hit
&
hit
=
hits
[
hitStartIndex
+
ih
];
if
(
!
(
hitKeyFlags
[
hit
.
f
]
||
hitKeyFlags
[
hit
.
b
]))
{
int
bin
=
GetBin
(
hit
.
x
,
hit
.
y
);
fEntries
[
fFirstBinEntryIndex
[
bin
]
+
fNofBinEntries
[
bin
]].
Set
(
hit
,
hitStartIndex
+
ih
);
fNofBinEntries
[
bin
]
++
;
fMaxRangeX
=
std
::
max
(
fMaxRangeX
,
hit
.
rangeX
);
fMaxRangeY
=
std
::
max
(
fMaxRangeY
,
hit
.
rangeY
);
fMaxRangeT
=
std
::
max
(
fMaxRangeT
,
hit
.
rangeT
);
}
}
}
void
Grid
::
RemoveUsedHits
(
const
Vector
<
ca
::
Hit
>&
hits
,
const
Vector
<
unsigned
char
>&
hitKeyFlags
)
{
int
nEntries
=
0
;
fMaxRangeX
=
0.
;
fMaxRangeY
=
0.
;
fMaxRangeT
=
0.
;
for
(
int
bin
=
0
;
bin
<
fN
;
bin
++
)
{
ca
::
HitIndex_t
firstEntryOld
=
fFirstBinEntryIndex
[
bin
];
fFirstBinEntryIndex
[
bin
]
=
nEntries
;
fNofBinEntries
[
bin
]
=
0
;
for
(
ca
::
HitIndex_t
i
=
firstEntryOld
;
i
<
fFirstBinEntryIndex
[
bin
+
1
];
i
++
)
{
const
ca
::
Hit
&
hit
=
hits
[
fEntries
[
i
].
GetObjectId
()];
if
(
!
(
hitKeyFlags
[
hit
.
f
]
||
hitKeyFlags
[
hit
.
b
]))
{
fEntries
[
nEntries
]
=
fEntries
[
i
];
nEntries
++
;
fNofBinEntries
[
bin
]
++
;
fMaxRangeX
=
std
::
max
(
fMaxRangeX
,
hit
.
rangeX
);
fMaxRangeY
=
std
::
max
(
fMaxRangeY
,
hit
.
rangeY
);
fMaxRangeT
=
std
::
max
(
fMaxRangeT
,
hit
.
rangeT
);
}
}
}
fFirstBinEntryIndex
[
fN
]
=
nEntries
;
fNofBinEntries
[
fN
]
=
0
;
fEntries
.
reduce
(
nEntries
);
}
Loading