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
Commits
05aac4ce
Commit
05aac4ce
authored
1 year ago
by
Dominik Smith
Committed by
Dominik Smith
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Switched from std::sort to insert-sort in cbm::algo::tof::Calibrate (faster for pre-sorted data).
parent
7c451e71
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1483
Replacement of std::unordered_map in cbm::algo::tof::Calibrate.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
algo/detectors/tof/Calibrate.cxx
+19
-8
19 additions, 8 deletions
algo/detectors/tof/Calibrate.cxx
with
19 additions
and
8 deletions
algo/detectors/tof/Calibrate.cxx
+
19
−
8
View file @
05aac4ce
...
...
@@ -52,8 +52,7 @@ namespace cbm::algo::tof
std
::
fill
(
mChannelDeadTime
.
begin
(),
mChannelDeadTime
.
end
(),
std
::
numeric_limits
<
double
>::
quiet_NaN
());
for
(
const
auto
&
entry
:
digiIn
)
{
CbmTofDigi
digi
=
entry
;
for
(
const
auto
&
digi
:
digiIn
)
{
const
double
SmType
=
digi
.
GetType
();
const
double
Sm
=
digi
.
GetSm
();
const
double
Rpc
=
digi
.
GetRpc
();
...
...
@@ -81,14 +80,14 @@ namespace cbm::algo::tof
}
mChannelDeadTime
[
chanIdx
]
=
digi
.
GetTime
()
+
rpcPar
.
channelDeadtime
;
// Create calibrated digi
CbmTofDigi
&
pCalDigi
=
calDigiOut
.
emplace_back
(
digi
);
// Check if channel sides need to be swapped
if
(
rpcPar
.
swapChannelSides
&&
5
!=
SmType
&&
8
!=
SmType
)
{
d
igi
.
SetAddress
(
Sm
,
Rpc
,
Chan
,
(
0
==
Side
)
?
1
:
0
,
SmType
);
pCalD
igi
.
SetAddress
(
Sm
,
Rpc
,
Chan
,
(
0
==
Side
)
?
1
:
0
,
SmType
);
}
// Create calibrated digi
CbmTofDigi
&
pCalDigi
=
calDigiOut
.
emplace_back
(
digi
);
// calibrate Digi Time
pCalDigi
.
SetTime
(
pCalDigi
.
GetTime
()
-
chanPar
.
vCPTOff
[
Side
]);
...
...
@@ -120,8 +119,20 @@ namespace cbm::algo::tof
}
/// Sort the buffers of hits due to the time offsets applied
std
::
sort
(
calDigiOut
.
begin
(),
calDigiOut
.
end
(),
[](
const
CbmTofDigi
&
a
,
const
CbmTofDigi
&
b
)
->
bool
{
return
a
.
GetTime
()
<
b
.
GetTime
();
});
// (insert-sort faster than std::sort due to pre-sorting)
for
(
std
::
size_t
i
=
1
;
i
<
calDigiOut
.
size
();
++
i
)
{
CbmTofDigi
digi
=
calDigiOut
[
i
];
std
::
size_t
j
=
i
;
while
(
j
>
0
&&
calDigiOut
[
j
-
1
].
GetTime
()
>
digi
.
GetTime
())
{
calDigiOut
[
j
]
=
calDigiOut
[
j
-
1
];
--
j
;
}
calDigiOut
[
j
]
=
digi
;
}
// Kept for possible unsorted input
// std::sort(calDigiOut.begin(), calDigiOut.end(),
// [](const CbmTofDigi& a, const CbmTofDigi& b) -> bool { return a.GetTime() < b.GetTime(); });
monitor
.
fTime
=
xpu
::
pop_timer
();
//L_(info) << MakeReport("CalibrateTime", monitor.fTime);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment