Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Project Juggler
Manage
Activity
Members
Labels
Plan
Issues
32
Issue boards
Milestones
Wiki
Code
Merge requests
21
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
EIC
Project Juggler
Commits
4d98591b
Commit
4d98591b
authored
9 months ago
by
Wouter Deconinck
Browse files
Options
Downloads
Patches
Plain Diff
fix: "Immutable objects can only be added to subset collections" exception
parent
f9677c23
No related branches found
No related tags found
1 merge request
!543
fix: "Immutable objects can only be added to subset collections" exception
Pipeline
#93389
passed with stages
in 2 hours, 53 minutes, and 24 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
JugReco/src/components/CalorimeterHitsMerger.cpp
+16
-18
16 additions, 18 deletions
JugReco/src/components/CalorimeterHitsMerger.cpp
with
16 additions
and
18 deletions
JugReco/src/components/CalorimeterHitsMerger.cpp
+
16
−
18
View file @
4d98591b
...
...
@@ -114,31 +114,28 @@ public:
auto
&
outputs
=
*
m_outputHitCollection
.
createAndPut
();
// find the hits that belong to the same group (for merging)
std
::
unordered_map
<
long
long
,
std
::
vector
<
edm4eic
::
CalorimeterHit
>>
merge_map
;
std
::
unordered_map
<
long
long
,
std
::
vector
<
size_t
>>
merge_map
;
std
::
size_t
ix
=
0
;
for
(
const
auto
&
h
:
inputs
)
{
int64_t
id
=
h
.
getCellID
()
&
id_mask
;
// use the reference field position
auto
it
=
merge_map
.
find
(
id
);
if
(
it
==
merge_map
.
end
())
{
merge_map
[
id
]
=
{
h
};
}
else
{
it
->
second
.
push_back
(
h
);
}
merge_map
[
id
].
push_back
(
ix
);
ix
++
;
}
// sort hits by energy from large to small
std
::
for_each
(
merge_map
.
begin
(),
merge_map
.
end
(),
[](
auto
&
it
)
{
std
::
sort
(
it
.
second
.
begin
(),
it
.
second
.
end
(),
[](
const
auto
&
h1
,
const
auto
&
h
2
)
{
return
h1
.
getEnergy
()
>
h2
.
getEnergy
();
});
}
);
for
(
auto
&
it
:
merge_map
)
{
std
::
sort
(
it
.
second
.
begin
(),
it
.
second
.
end
(),
[
&
](
std
::
size_t
ix1
,
std
::
size_t
ix
2
)
{
return
inputs
[
ix1
]
.
getEnergy
()
>
inputs
[
ix2
]
.
getEnergy
();
});
}
// reconstruct info for merged hits
// dd4hep decoders
auto
poscon
=
m_converter
;
auto
volman
=
m_geoSvc
->
getDetector
()
->
volumeManager
();
for
(
auto
&
[
id
,
hit
s
]
:
merge_map
)
{
for
(
auto
&
[
id
,
ix
s
]
:
merge_map
)
{
// reference fields id
const
uint64_t
ref_id
=
id
|
ref_mask
;
// global positions
...
...
@@ -152,17 +149,18 @@ public:
float
energyError
=
0.
;
float
time
=
0
;
float
timeError
=
0
;
for
(
auto
&
hit
:
hits
)
{
for
(
auto
ix
:
ixs
)
{
auto
hit
=
inputs
[
ix
];
energy
+=
hit
.
getEnergy
();
energyError
+=
hit
.
getEnergyError
()
*
hit
.
getEnergyError
();
time
+=
hit
.
getTime
();
timeError
+=
hit
.
getTimeError
()
*
hit
.
getTimeError
();
}
energyError
=
sqrt
(
energyError
);
time
/=
hit
s
.
size
();
timeError
=
sqrt
(
timeError
)
/
hit
s
.
size
();
time
/=
ix
s
.
size
();
timeError
=
sqrt
(
timeError
)
/
ix
s
.
size
();
const
auto
&
href
=
hit
s
.
front
();
const
auto
&
href
=
inputs
[
ix
s
.
front
()
]
;
// create const vectors for passing to hit initializer list
const
decltype
(
edm4eic
::
CalorimeterHitData
::
position
)
position
(
...
...
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