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
64b38667
Commit
64b38667
authored
1 year ago
by
Christopher Rob Jones
Browse files
Options
Downloads
Patches
Plain Diff
Add new algorithm DecodedDataAddMCInfo
parent
16cf7bcd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!4386
Merge master into FTRetinaSeedRawBanks
,
!4315
Add new algorithm DecodedDataAddMCInfo
Pipeline
#6313649
passed
1 year ago
Stage: test
Stage: .post
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Rich/RichFutureMCUtils/CMakeLists.txt
+1
-0
1 addition, 0 deletions
Rich/RichFutureMCUtils/CMakeLists.txt
Rich/RichFutureMCUtils/src/component/DecodedDataAddMCInfo.cpp
+137
-0
137 additions, 0 deletions
.../RichFutureMCUtils/src/component/DecodedDataAddMCInfo.cpp
with
138 additions
and
0 deletions
Rich/RichFutureMCUtils/CMakeLists.txt
+
1
−
0
View file @
64b38667
...
...
@@ -33,6 +33,7 @@ gaudi_add_module(RichFutureMCUtils
SOURCES
src/component/TrackToMCParticleRelations.cpp
src/component/DecodedDataFromMCRichHits.cpp
src/component/DecodedDataAddMCInfo.cpp
LINK
LHCb::LHCbAlgsLib
LHCb::LinkerEvent
...
...
This diff is collapsed.
Click to expand it.
Rich/RichFutureMCUtils/src/component/DecodedDataAddMCInfo.cpp
0 → 100644
+
137
−
0
View file @
64b38667
/*****************************************************************************\
* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
// Rich (Future) Kernel
#include
"RichFutureKernel/RichAlgBase.h"
// Gaudi Functional
#include
"LHCbAlgs/Transformer.h"
// Rich Utils
#include
"RichFutureUtils/RichDecodedData.h"
#include
"RichUtils/RichSmartIDSorter.h"
// Event Model
#include
"Event/MCRichHit.h"
#include
<map>
#include
<memory>
#include
<tuple>
namespace
Rich
::
Future
::
MC
{
using
namespace
Rich
::
Future
::
DAQ
;
/** @class DecodedDataFromMCRichHits
*
* Update decoded data with MC information (e.g. time)
*
* @author Chris Jones
* @date 2016-12-07
*/
class
DecodedDataAddMCInfo
final
:
public
LHCb
::
Algorithm
::
Transformer
<
DecodedData
(
DecodedData
const
&
,
LHCb
::
MCRichHits
const
&
),
Gaudi
::
Functional
::
Traits
::
BaseClass_t
<
AlgBase
<>>>
{
public:
/// Standard constructor
DecodedDataAddMCInfo
(
const
std
::
string
&
name
,
ISvcLocator
*
pSvcLocator
)
:
Transformer
(
name
,
pSvcLocator
,
// inputs
{
KeyValue
{
"InDecodedDataLocation"
,
DecodedDataLocation
::
Default
},
KeyValue
{
"MCRichHitsLocation"
,
LHCb
::
MCRichHitLocation
::
Default
}},
// output
{
KeyValue
{
"OutDecodedDataLocation"
,
DecodedDataLocation
::
Default
}}
)
{
// setProperty( "OutputLevel", MSG::VERBOSE ).ignore();
}
public
:
/// Algorithm execution via transform
DecodedData
operator
()(
DecodedData
const
&
data
,
LHCb
::
MCRichHits
const
&
mchits
)
const
override
{
// Collect all the (signal) hits in the same pixel
std
::
map
<
LHCb
::
RichSmartID
,
std
::
vector
<
LHCb
::
MCRichHit
*>>
hitsPerPix
;
for
(
const
auto
mchit
:
mchits
)
{
auto
id
=
mchit
->
sensDetID
().
channelDataOnly
();
#ifdef USE_DD4HEP
if
(
m_detdescMCinput
)
{
// If built for DD4HEP apply correction to PMT module numbers to account
// for different numbering scheme between DD4HEP and DetDesc.
// Option needs to be explicitly activated only when input is known to
// be DetDesc based MC.
// ***** To eventually be removed when DetDesc finally dies completely *****
const
Rich
::
DetectorArray
<
Rich
::
PanelArray
<
LHCb
::
RichSmartID
::
DataType
>>
mod_corr
{{{
0
,
0
},
{
6
,
18
}}};
const
auto
pdMod
=
id
.
pdMod
()
+
mod_corr
[
id
.
rich
()][
id
.
panel
()];
const
auto
pdNumInMod
=
id
.
pdNumInMod
();
id
.
setPD
(
pdMod
,
pdNumInMod
);
}
#endif
if
(
id
.
isValid
()
)
{
hitsPerPix
[
id
].
push_back
(
mchit
);
}
}
// Clone decoded data
DecodedData
out_data
=
data
;
// Loop over data and add MC time info
// First, RICH detectors
for
(
auto
&
rD
:
out_data
)
{
// sides per RICH
for
(
auto
&
pD
:
rD
)
{
// PD modules per side
for
(
auto
&
mD
:
pD
)
{
// PDs per module
for
(
auto
&
pd
:
mD
)
{
// IDs per PD
for
(
auto
&
id
:
pd
.
smartIDs
()
)
{
// Do we have any MChits for this ID
const
auto
&
pix_mchits
=
hitsPerPix
[
id
];
if
(
!
pix_mchits
.
empty
()
)
{
// Find best MCHit to use. Either first labelled as single, otherwise
// just the first in the container
const
auto
*
mch
=
pix_mchits
.
front
();
for
(
const
auto
*
h
:
pix_mchits
)
{
if
(
h
->
isSignal
()
)
{
mch
=
h
;
break
;
}
}
if
(
m_useMCTime
)
{
// Set time in ID
id
.
setTime
(
mch
->
timeOfFlight
()
);
_ri_verbo
<<
id
<<
endmsg
;
}
}
}
}
}
}
}
// return
return
out_data
;
}
private
:
// properties
/** Temporary workaround for processing DetDesc MC as input.
* When active, applies corrections to the data to make compatible
* with the dd4hep builds. */
Gaudi
::
Property
<
bool
>
m_detdescMCinput
{
this
,
"IsDetDescMC"
,
true
};
/// Enable use of MC time info
Gaudi
::
Property
<
bool
>
m_useMCTime
{
this
,
"UseMCTime"
,
true
};
};
// Declaration of the Algorithm Factory
DECLARE_COMPONENT
(
DecodedDataAddMCInfo
)
}
// namespace Rich::Future::MC
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