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
03c21547
Commit
03c21547
authored
Feb 21, 2022
by
Wouter Deconinck
Browse files
JugDigi::SimTrackerHitsCollector to deal with demuxed readouts
parent
fc911f3c
Changes
2
Hide whitespace changes
Inline
Side-by-side
JugDigi/CMakeLists.txt
View file @
03c21547
...
...
@@ -10,6 +10,7 @@ gaudi_add_module(JugDigiPlugins
src/components/PhotoMultiplierDigi.cpp
src/components/UFSDTrackerDigi.cpp
src/components/SiliconTrackerDigi.cpp
src/components/SimTrackerHitsCollector.cpp
LINK
Gaudi::GaudiAlgLib Gaudi::GaudiKernel
JugBase
...
...
JugDigi/src/components/SimTrackerHitsCollector.cpp
0 → 100644
View file @
03c21547
// 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 inputTrackingHits [in] vector of collection names
* \param trackingHits [out] hits combined into one collection.
*
* \ingroup digi
*/
class
SimTrackerHitsCollector
:
public
GaudiAlgorithm
{
public:
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
};
std
::
vector
<
DataHandle
<
edm4hep
::
SimTrackerHitCollection
>*>
m_hitCollections
;
public:
SimTrackerHitsCollector
(
const
std
::
string
&
name
,
ISvcLocator
*
svcLoc
)
:
GaudiAlgorithm
(
name
,
svcLoc
)
{
declareProperty
(
"outputSimTrackerHits"
,
m_outputSimTrackerHits
,
"output hits combined into single collection"
);
}
~
SimTrackerHitsCollector
()
{
for
(
auto
col
:
m_hitCollections
)
{
if
(
col
)
{
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
;
}
};
DECLARE_COMPONENT
(
SimTrackerHitsCollector
)
}
// 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