Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Project Juggler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
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
Merge requests
!484
SiliconTrackerDigi: include in algorithms and use in juggler
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
SiliconTrackerDigi: include in algorithms and use in juggler
silicon-tracker-digi
into
main
Overview
0
Commits
5
Pipelines
0
Changes
7
Open
Wouter Deconinck
requested to merge
silicon-tracker-digi
into
main
2 years ago
Overview
0
Commits
5
Pipelines
0
Changes
7
Expand
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
072dbf78
5 commits,
2 years ago
7 files
+
73
−
274
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
7
Search (e.g. *.vue) (Ctrl+P)
Conflict: This file was modified in both the source and target branches. Ask someone with write access to resolve it.
JugDigi/src/components/SiliconTrackerDigi.cpp
+
3
−
96
Options
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright (C) 2022 Whitney Armstrong, Wouter Deconinck, Sylvester Joosten
#include
<
a
lgorithm>
#include
<
cmat
h>
#include
<
JugAlgo/A
lgorithm
.h
>
#include
<
algorithms/tracking/SiliconTrackerDigi.
h>
#include
"Gaudi/Property.h"
#include
"GaudiAlg/GaudiTool.h"
#include
"GaudiAlg/Transformer.h"
#include
"GaudiKernel/PhysicalConstants.h"
#include
"GaudiKernel/RndmGenerators.h"
#include
"JugBase/DataHandle.h"
// Event Model related classes
// edm4hep's tracker hit is the input collectiopn
#include
"edm4hep/MCParticle.h"
#include
"edm4hep/SimTrackerHitCollection.h"
// edm4eic's RawTrackerHit is the output
#include
"edm4eic/RawTrackerHitCollection.h"
namespace
Jug
::
Digi
{
/** Silicon detector digitization.
*
* \ingroup digi
*/
class
SiliconTrackerDigi
:
public
GaudiAlgorithm
{
private:
Gaudi
::
Property
<
double
>
m_timeResolution
{
this
,
"timeResolution"
,
10
};
// todo : add units
Gaudi
::
Property
<
double
>
m_threshold
{
this
,
"threshold"
,
0.
*
Gaudi
::
Units
::
keV
};
Rndm
::
Numbers
m_gaussDist
;
DataHandle
<
edm4hep
::
SimTrackerHitCollection
>
m_inputHitCollection
{
"inputHitCollection"
,
Gaudi
::
DataHandle
::
Reader
,
this
};
DataHandle
<
edm4eic
::
RawTrackerHitCollection
>
m_outputHitCollection
{
"outputHitCollection"
,
Gaudi
::
DataHandle
::
Writer
,
this
};
public
:
// ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
SiliconTrackerDigi
(
const
std
::
string
&
name
,
ISvcLocator
*
svcLoc
)
:
GaudiAlgorithm
(
name
,
svcLoc
)
{
declareProperty
(
"inputHitCollection"
,
m_inputHitCollection
,
""
);
declareProperty
(
"outputHitCollection"
,
m_outputHitCollection
,
""
);
}
StatusCode
initialize
()
override
{
if
(
GaudiAlgorithm
::
initialize
().
isFailure
())
{
return
StatusCode
::
FAILURE
;
}
IRndmGenSvc
*
randSvc
=
svc
<
IRndmGenSvc
>
(
"RndmGenSvc"
,
true
);
StatusCode
sc
=
m_gaussDist
.
initialize
(
randSvc
,
Rndm
::
Gauss
(
0.0
,
m_timeResolution
.
value
()));
if
(
!
sc
.
isSuccess
())
{
return
StatusCode
::
FAILURE
;
}
return
StatusCode
::
SUCCESS
;
}
StatusCode
execute
()
override
{
// input collection
const
auto
*
const
simhits
=
m_inputHitCollection
.
get
();
// Create output collections
auto
*
rawhits
=
m_outputHitCollection
.
createAndPut
();
// edm4eic::RawTrackerHitCollection* rawHitCollection = new edm4eic::RawTrackerHitCollection();
std
::
map
<
long
long
,
int
>
cell_hit_map
;
for
(
const
auto
&
ahit
:
*
simhits
)
{
if
(
msgLevel
(
MSG
::
DEBUG
))
{
debug
()
<<
"--------------------"
<<
ahit
.
getCellID
()
<<
endmsg
;
debug
()
<<
"Hit in cellID = "
<<
ahit
.
getCellID
()
<<
endmsg
;
debug
()
<<
" position = ("
<<
ahit
.
getPosition
().
x
<<
","
<<
ahit
.
getPosition
().
y
<<
","
<<
ahit
.
getPosition
().
z
<<
")"
<<
endmsg
;
debug
()
<<
" xy_radius = "
<<
std
::
hypot
(
ahit
.
getPosition
().
x
,
ahit
.
getPosition
().
y
)
<<
endmsg
;
debug
()
<<
" momentum = ("
<<
ahit
.
getMomentum
().
x
<<
","
<<
ahit
.
getMomentum
().
y
<<
","
<<
ahit
.
getMomentum
().
z
<<
")"
<<
endmsg
;
}
if
(
ahit
.
getEDep
()
*
Gaudi
::
Units
::
keV
<
m_threshold
)
{
if
(
msgLevel
(
MSG
::
DEBUG
))
{
debug
()
<<
" edep = "
<<
ahit
.
getEDep
()
<<
" (below threshold of "
<<
m_threshold
/
Gaudi
::
Units
::
keV
<<
" keV)"
<<
endmsg
;
}
continue
;
}
else
{
if
(
msgLevel
(
MSG
::
DEBUG
))
{
debug
()
<<
" edep = "
<<
ahit
.
getEDep
()
<<
endmsg
;
}
}
if
(
cell_hit_map
.
count
(
ahit
.
getCellID
())
==
0
)
{
cell_hit_map
[
ahit
.
getCellID
()]
=
rawhits
->
size
();
edm4eic
::
RawTrackerHit
rawhit
(
ahit
.
getCellID
(),
ahit
.
getMCParticle
().
getTime
()
*
1e6
+
m_gaussDist
()
*
1e3
,
// ns->fs
std
::
llround
(
ahit
.
getEDep
()
*
1e6
));
rawhits
->
push_back
(
rawhit
);
}
else
{
auto
hit
=
(
*
rawhits
)[
cell_hit_map
[
ahit
.
getCellID
()]];
hit
.
setTimeStamp
(
ahit
.
getMCParticle
().
getTime
()
*
1e6
+
m_gaussDist
()
*
1e3
);
auto
ch
=
hit
.
getCharge
();
hit
.
setCharge
(
ch
+
std
::
llround
(
ahit
.
getEDep
()
*
1e6
));
}
}
return
StatusCode
::
SUCCESS
;
}
};
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DECLARE_COMPONENT
(
SiliconTracker
Digi
)
JUGALGO_DEFINE_ALGORITHM
(
SiliconTrackerDigi
,
algorithms
::
tracking
::
SiliconTrackerDigi
,
Jug
::
Digi
)
}
// namespace Jug::Digi
Loading