Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
EIC
Project Juggler
Commits
46db96c3
Commit
46db96c3
authored
Jun 18, 2022
by
Wouter Deconinck
Browse files
New SimTrackerHitMerger
parent
1b3eedfa
Pipeline
#32161
passed with stages
in 4 minutes and 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
JugDigi/src/components/SimTrackerHitsMerger.cpp
0 → 100644
View file @
46db96c3
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright (C) 2022 Wouter Deconinck, Whitney Armstrong, Chao Peng
// Gaudi
#include
"GaudiAlg/GaudiAlgorithm.h"
#include
"Gaudi/Property.h"
#include
"GaudiAlg/GaudiTool.h"
#include
"GaudiAlg/Transformer.h"
#include
"JugBase/DataHandle.h"
// Event Model related classes
#include
"edm4hep/SimTrackerHitCollection.h"
namespace
Jug
::
Digi
{
/** Collect the tracking hits into a single collection.
*
* \param inputSimTrackerHits [in] vector of collection names
* \param outputSimTrackerHits [out] hits combined into one collection.
*
* \ingroup digi
*/
class
SimTrackerHitsMerger
:
public
GaudiAlgorithm
{
private:
Gaudi
::
Property
<
std
::
vector
<
std
::
string
>>
m_inputSimTrackerHits
{
this
,
"inputSimTrackerHits"
,
{},
"Tracker hits to be aggregated"
};
DataHandle
<
edm4hep
::
SimTrackerHitCollection
>
m_outputSimTrackerHits
{
"outputSimTrackerHits"
,
Gaudi
::
DataHandle
::
Writer
,
this
};
Gaudi
::
Property
<
std
::
vector
<
double
>>
m_inputProbabilities
{
this
,
"probabilities"
,
{}};
std
::
vector
<
DataHandle
<
edm4hep
::
SimTrackerHitCollection
>*>
m_hitCollections
;
public:
SimTrackerHitsMerger
(
const
std
::
string
&
name
,
ISvcLocator
*
svcLoc
)
:
GaudiAlgorithm
(
name
,
svcLoc
)
{
declareProperty
(
"outputSimTrackerHits"
,
m_outputSimTrackerHits
,
"output hits combined into single collection"
);
}
~
SimTrackerHitsMerger
()
{
for
(
auto
*
col
:
m_hitCollections
)
{
delete
col
;
}
}
StatusCode
initialize
()
override
{
if
(
GaudiAlgorithm
::
initialize
().
isFailure
())
{
return
StatusCode
::
FAILURE
;
}
for
(
auto
colname
:
m_inputSimTrackerHits
)
{
debug
()
<<
"initializing collection: "
<<
colname
<<
endmsg
;
m_hitCollections
.
push_back
(
new
DataHandle
<
edm4hep
::
SimTrackerHitCollection
>
{
colname
,
Gaudi
::
DataHandle
::
Reader
,
this
});
}
return
StatusCode
::
SUCCESS
;
}
StatusCode
execute
()
override
{
auto
*
outputHits
=
m_outputSimTrackerHits
.
createAndPut
();
if
(
msgLevel
(
MSG
::
DEBUG
))
{
debug
()
<<
"execute collector"
<<
endmsg
;
}
for
(
const
auto
&
hits
:
m_hitCollections
)
{
const
edm4hep
::
SimTrackerHitCollection
*
hitCol
=
hits
->
get
();
if
(
msgLevel
(
MSG
::
DEBUG
))
{
debug
()
<<
"col n hits: "
<<
hitCol
->
size
()
<<
endmsg
;
}
for
(
const
auto
&
ahit
:
*
hitCol
)
{
outputHits
->
push_back
(
ahit
.
clone
());
}
}
return
StatusCode
::
SUCCESS
;
}
};
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DECLARE_COMPONENT
(
SimTrackerHitsMerger
)
}
// namespace Jug::Digi
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment