Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LHCb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
LHCb
LHCb
Commits
d9e05676
Commit
d9e05676
authored
1 year ago
by
Christopher Rob Jones
Browse files
Options
Downloads
Patches
Plain Diff
DecodedDataFromMCRichHits: Also create MCRichDigitSummarys when decoding from MCRichHits
parent
9b513daa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!4255
DecodedDataFromMCRichHits: Also create MCRichDigitSummarys when decoding from MCRichHits
Pipeline
#6114902
passed
1 year ago
Stage: test
Stage: .post
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Rich/RichFutureMCUtils/src/component/DecodedDataFromMCRichHits.cpp
+37
-10
37 additions, 10 deletions
...FutureMCUtils/src/component/DecodedDataFromMCRichHits.cpp
with
37 additions
and
10 deletions
Rich/RichFutureMCUtils/src/component/DecodedDataFromMCRichHits.cpp
+
37
−
10
View file @
d9e05676
...
...
@@ -20,15 +20,18 @@
#include
"RichUtils/RichSmartIDSorter.h"
// Event Model
#include
"Event/MCRichDigitSummary.h"
#include
"Event/MCRichHit.h"
#include
<map>
#include
<memory>
#include
<tuple>
namespace
Rich
::
Future
::
MC
{
namespace
{
/// Output data
using
OutData
=
Rich
::
Future
::
DAQ
::
DecodedData
;
using
OutData
=
std
::
tuple
<
Rich
::
Future
::
DAQ
::
DecodedData
,
LHCb
::
MCRichDigitSummarys
>
;
}
// namespace
using
namespace
Rich
::
Future
::
DAQ
;
...
...
@@ -41,17 +44,18 @@ namespace Rich::Future::MC {
* @date 2016-12-07
*/
class
DecodedDataFromMCRichHits
final
:
public
LHCb
::
Algorithm
::
Transformer
<
OutData
(
LHCb
::
MCRichHits
const
&
),
Gaudi
::
Functional
::
Traits
::
BaseClass_t
<
AlgBase
<>>>
{
:
public
LHCb
::
Algorithm
::
Multi
Transformer
<
OutData
(
LHCb
::
MCRichHits
const
&
),
Gaudi
::
Functional
::
Traits
::
BaseClass_t
<
AlgBase
<>>>
{
public:
/// Standard constructor
DecodedDataFromMCRichHits
(
const
std
::
string
&
name
,
ISvcLocator
*
pSvcLocator
)
:
Transformer
(
name
,
pSvcLocator
,
// inputs
{
KeyValue
{
"MCRichHitsLocation"
,
LHCb
::
MCRichHitLocation
::
Default
}},
// output
{
KeyValue
{
"DecodedDataLocation"
,
DecodedDataLocation
::
Default
}}
)
{
:
MultiTransformer
(
name
,
pSvcLocator
,
// inputs
{
KeyValue
{
"MCRichHitsLocation"
,
LHCb
::
MCRichHitLocation
::
Default
}},
// output
{
KeyValue
{
"DecodedDataLocation"
,
DecodedDataLocation
::
Default
},
KeyValue
{
"DigitSummaryLocation"
,
LHCb
::
MCRichDigitSummaryLocation
::
Default
}}
)
{
// setProperty( "OutputLevel", MSG::VERBOSE ).ignore();
}
...
...
@@ -59,6 +63,10 @@ namespace Rich::Future::MC {
/// Algorithm execution via transform
OutData
operator
()(
LHCb
::
MCRichHits
const
&
mchits
)
const
override
{
OutData
out_data
;
auto
&
decoded_data
=
std
::
get
<
Rich
::
Future
::
DAQ
::
DecodedData
>
(
out_data
);
auto
&
summaries
=
std
::
get
<
LHCb
::
MCRichDigitSummarys
>
(
out_data
);
// Collect all the hits in the same pixel
std
::
map
<
LHCb
::
RichSmartID
,
std
::
vector
<
LHCb
::
MCRichHit
*>>
hitsPerPix
;
for
(
const
auto
mchit
:
mchits
)
{
...
...
@@ -95,8 +103,13 @@ namespace Rich::Future::MC {
// Form list of unique IDs
LHCb
::
RichSmartID
::
Vector
ids
;
ids
.
reserve
(
mchits
.
size
()
);
summaries
.
reserve
(
mchits
.
size
()
);
for
(
const
auto
&
[
id
,
hits
]
:
hitsPerPix
)
{
// temporary copy of SmartID
auto
newID
=
id
;
// Add best time for this ID
if
(
m_includeTimeInfo
)
{
// attempt to select the 'best' time for this ID ...
if
(
!
hits
.
empty
()
)
{
// should never fail ...
...
...
@@ -110,15 +123,29 @@ namespace Rich::Future::MC {
newID
.
setTime
(
hitTime
);
}
}
// Add ID to decoded list
ids
.
emplace_back
(
newID
);
// Form MC summaries for each MCHit
for
(
const
auto
hit
:
hits
)
{
auto
summary
=
std
::
make_unique
<
LHCb
::
MCRichDigitSummary
>
();
summary
->
setRichSmartID
(
id
);
// Use version without time
summary
->
setMCParticle
(
hit
->
mcParticle
()
);
summary
->
setHistory
(
hit
->
mcRichDigitHistoryCode
()
);
summaries
.
add
(
summary
.
release
()
);
}
}
// Sort
SmartIDSorter
::
sortByRegion
(
ids
);
for
(
const
auto
id
:
ids
)
{
ri_debug
(
id
,
endmsg
);
}
// create, fill, and return decoded data structure
return
OutData
(
ids
);
// fill decoded data structure
decoded_data
.
addSmartIDs
(
ids
);
// return
return
out_data
;
}
private
:
...
...
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