Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
calypso
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Charlotte Cavanagh
calypso
Commits
40f66c6e
Commit
40f66c6e
authored
2 years ago
by
Carl Gwilliam
Browse files
Options
Downloads
Patches
Plain Diff
Speed up scint/calo digi by factorising e and time loops
parent
53fcd3e6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Calorimeter/CaloDigiAlgs/src/CaloWaveformDigiAlg.cxx
+14
-2
14 additions, 2 deletions
Calorimeter/CaloDigiAlgs/src/CaloWaveformDigiAlg.cxx
Scintillator/ScintDigiAlgs/src/ScintWaveformDigiAlg.cxx
+51
-25
51 additions, 25 deletions
Scintillator/ScintDigiAlgs/src/ScintWaveformDigiAlg.cxx
with
65 additions
and
27 deletions
Calorimeter/CaloDigiAlgs/src/CaloWaveformDigiAlg.cxx
+
14
−
2
View file @
40f66c6e
...
...
@@ -99,12 +99,24 @@ CaloWaveformDigiAlg::execute(const EventContext& ctx) const {
// Create structure to store pulse for each channel
std
::
map
<
Identifier
,
std
::
vector
<
uint16_t
>>
waveforms
=
m_digiTool
->
create_waveform_map
(
m_ecalID
);
// Sum energy for each channel (i.e. identifier)
std
::
map
<
unsigned
int
,
float
>
esum
;
for
(
const
auto
&
hit
:
*
caloHitHandle
)
{
esum
[
hit
.
identify
()]
+=
hit
.
energyLoss
();
}
// Loop over time samples
for
(
const
auto
&
tk
:
m_timekernel
)
{
std
::
map
<
unsigned
int
,
float
>
counts
;
// Convolve hit energy with evaluated kernel and sum for each hit id (i.e. channel)
for
(
const
auto
&
hit
:
*
caloHitHandle
)
{
counts
[
hit
.
identify
()]
+=
tk
*
hit
.
energyLoss
();
//for (const auto& hit : *caloHitHandle) {
// counts[hit.identify()] += tk * hit.energyLoss();
//}
// Convolve summed energy with evaluated kernel for each hit id (i.e. channel)
for
(
const
auto
&
e
:
esum
)
{
counts
[
e
.
first
]
=
tk
*
e
.
second
;
}
// Subtract count from basleine and add result to correct waveform vector
...
...
This diff is collapsed.
Click to expand it.
Scintillator/ScintDigiAlgs/src/ScintWaveformDigiAlg.cxx
+
51
−
25
View file @
40f66c6e
...
...
@@ -110,35 +110,61 @@ ScintWaveformDigiAlg::execute(const EventContext& ctx) const {
waveforms
=
m_digiTool
->
create_waveform_map
(
m_preshowerID
);
}
// Sum energy for each channel (i.e. identifier)
std
::
map
<
Identifier
,
float
>
esum
;
Identifier
id
;
for
(
const
auto
&
hit
:
*
scintHitHandle
)
{
if
(
first
.
isTrigger
())
{
Identifier
plate_id
=
m_triggerID
->
plate_id
(
hit
.
getIdentifier
());
// Need to do something better here, but for now just fill both
id
=
m_triggerID
->
pmt_id
(
plate_id
,
0
);
// ID for PMT 0
esum
[
id
]
+=
hit
.
energyLoss
();
id
=
m_triggerID
->
pmt_id
(
plate_id
,
1
);
// ID for PMT 1
esum
[
id
]
+=
hit
.
energyLoss
();
}
else
{
// All others have only 1 PMT
// Use detector id (not hit id) throughout
id
=
hit
.
getIdentifier
();
esum
[
id
]
+=
hit
.
energyLoss
();
}
}
// Loop over time samples
// Should really do sums first, as repeating these in the loop is a waste
for
(
const
auto
&
tk
:
m_timekernel
)
{
std
::
map
<
Identifier
,
float
>
counts
;
// Convolve hit energy with evaluated kernel and sum for each hit id (i.e. channel)
Identifier
id
;
for
(
const
auto
&
hit
:
*
scintHitHandle
)
{
// Special handling for trigger scintillator
if
(
first
.
isTrigger
())
{
// Hits are created per plate
// Need to split between 2 PMTs
// Identifier from hit is plate ID
Identifier
plate_id
=
m_triggerID
->
plate_id
(
hit
.
getIdentifier
());
// Need to do something better here, but for now just fill both
id
=
m_triggerID
->
pmt_id
(
plate_id
,
0
);
// ID for PMT 0
counts
[
id
]
+=
tk
*
hit
.
energyLoss
();
id
=
m_triggerID
->
pmt_id
(
plate_id
,
1
);
// ID for PMT 1
counts
[
id
]
+=
tk
*
hit
.
energyLoss
();
}
else
{
// All others have only 1 PMT
// Use detector id (not hit id) throughout
id
=
hit
.
getIdentifier
();
counts
[
id
]
+=
tk
*
hit
.
energyLoss
();
}
// // Convolve hit energy with evaluated kernel and sum for each hit id (i.e. channel)
// Identifier id;
// for (const auto& hit : *scintHitHandle) {
//
// // Special handling for trigger scintillator
// if (first.isTrigger()) {
// // Hits are created per plate
// // Need to split between 2 PMTs
//
// // Identifier from hit is plate ID
// Identifier plate_id = m_triggerID->plate_id(hit.getIdentifier());
//
// // Need to do something better here, but for now just fill both
// id = m_triggerID->pmt_id(plate_id, 0); // ID for PMT 0
// counts[id] += tk * hit.energyLoss();
// id = m_triggerID->pmt_id(plate_id, 1); // ID for PMT 1
// counts[id] += tk * hit.energyLoss();
//
// } else {
// // All others have only 1 PMT
// // Use detector id (not hit id) throughout
// id = hit.getIdentifier();
// counts[id] += tk * hit.energyLoss();
// }
// }
// Convolve summed energy with evaluated kernel for each hit id (i.e. channel)
for
(
const
auto
&
e
:
esum
)
{
// Convert hit id to Identifier and store
id
=
e
.
first
;
counts
[
id
]
=
tk
*
e
.
second
;
}
// Subtract count from basleine and add result to correct waveform vector
...
...
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