ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
MuonIdentification
MuonCombinedDecorationAlgs
src
MuonTrkIDMSScatterDecorAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
MuonTrkIDMSScatterDecorAlg.h
"
6
#include "
StoreGate/WriteDecorHandle.h
"
7
#include "
StoreGate/ReadHandle.h
"
8
#include "
TrkMaterialOnTrack/EnergyLoss.h
"
9
#include "
TrkMaterialOnTrack/MaterialEffectsOnTrack.h
"
10
#include "
TrkMaterialOnTrack/ScatteringAngles.h
"
11
namespace
{
12
using
Decorator =
SG::WriteDecorHandle<xAOD::TrackParticleContainer, float>
;
13
constexpr
float
dummy_val = -999.;
14
}
15
MuonTrkIDMSScatterDecorAlg::MuonTrkIDMSScatterDecorAlg
(
const
std::string& name, ISvcLocator* pSvcLocator):
16
AthReentrantAlgorithm
(name,pSvcLocator){}
17
18
StatusCode
MuonTrkIDMSScatterDecorAlg::initialize
() {
19
20
ATH_CHECK
(
m_TrkContainer
.initialize());
21
22
ATH_CHECK
(
m_deltaPhi1Key
.initialize());
23
ATH_CHECK
(
m_deltaTheta1Key
.initialize());
24
ATH_CHECK
(
m_sigmaDeltaPhi1Key
.initialize());
25
ATH_CHECK
(
m_sigmaDeltaTheta1Key
.initialize());
26
27
ATH_CHECK
(
m_deltaPhi0Key
.initialize());
28
ATH_CHECK
(
m_deltaTheta0Key
.initialize());
29
ATH_CHECK
(
m_sigmaDeltaPhi0Key
.initialize());
30
ATH_CHECK
(
m_sigmaDeltaTheta0Key
.initialize());
31
return
StatusCode::SUCCESS;
32
}
33
34
StatusCode
MuonTrkIDMSScatterDecorAlg::execute
(
const
EventContext& ctx)
const
{
35
SG::ReadHandle<xAOD::TrackParticleContainer>
trkCont{
m_TrkContainer
,ctx};
36
if
(!trkCont.
isValid
()) {
37
ATH_MSG_FATAL
(
"Failed to load track collection "
<<
m_TrkContainer
.fullKey());
38
return
StatusCode::FAILURE;
39
}
40
Decorator dec_deltaphi_1{
m_deltaPhi1Key
,ctx};
41
Decorator dec_deltatheta_1{
m_deltaTheta1Key
, ctx};
42
Decorator dec_sigmadeltaphi_1{
m_sigmaDeltaPhi1Key
, ctx};
43
Decorator dec_sigmadeltatheta_1{
m_sigmaDeltaTheta1Key
, ctx};
44
45
Decorator dec_deltaphi_0{
m_deltaPhi0Key
,ctx};
46
Decorator dec_deltatheta_0{
m_deltaTheta0Key
, ctx};
47
Decorator dec_sigmadeltaphi_0{
m_sigmaDeltaPhi0Key
, ctx};
48
Decorator dec_sigmadeltatheta_0{
m_sigmaDeltaTheta0Key
, ctx};
49
50
for
(
const
xAOD::TrackParticle
* tp : *trkCont) {
51
dec_deltaphi_1(*tp) = dummy_val;
52
dec_deltatheta_1(*tp) = dummy_val;
53
dec_sigmadeltaphi_1(*tp) = dummy_val;
54
dec_sigmadeltatheta_1(*tp) = dummy_val;
55
56
dec_deltaphi_0(*tp) = dummy_val;
57
dec_deltatheta_0(*tp) = dummy_val;
58
dec_sigmadeltaphi_0(*tp) = dummy_val;
59
dec_sigmadeltatheta_0(*tp) = dummy_val;
60
int
nscatter = 0;
61
if
(!tp->track() || !tp->track()->trackStateOnSurfaces())
continue
;
62
for
(
const
Trk::TrackStateOnSurface
* tsos : *tp->track()->trackStateOnSurfaces()) {
63
if
(tsos->materialEffectsOnTrack()) {
64
const
Trk::MaterialEffectsOnTrack
* meot =
dynamic_cast<
const
Trk::MaterialEffectsOnTrack
*
>
(tsos->materialEffectsOnTrack());
65
if
(!meot || !meot->
energyLoss
() || !meot->
scatteringAngles
())
continue
;
66
if
(meot->
energyLoss
()->
deltaE
() == 0) {
// artificial scatterer found
67
if
(nscatter == 0) {
68
dec_deltaphi_0(*tp) = meot->
scatteringAngles
()->
deltaPhi
();
69
dec_deltatheta_0(*tp) = meot->
scatteringAngles
()->
deltaTheta
();
70
dec_sigmadeltaphi_0(*tp) = meot->
scatteringAngles
()->
sigmaDeltaPhi
();
71
dec_sigmadeltatheta_0(*tp) = meot->
scatteringAngles
()->
sigmaDeltaTheta
();
72
}
else
if
(nscatter == 1) {
73
dec_deltaphi_1(*tp) = meot->
scatteringAngles
()->
deltaPhi
();
74
dec_deltatheta_1(*tp) = meot->
scatteringAngles
()->
deltaTheta
();
75
dec_sigmadeltaphi_1(*tp) = meot->
scatteringAngles
()->
sigmaDeltaPhi
();
76
dec_sigmadeltatheta_1(*tp) = meot->
scatteringAngles
()->
sigmaDeltaTheta
();
77
}
78
++nscatter;
79
}
80
}
81
if
(nscatter > 1)
break
;
82
}
83
}
84
return
StatusCode::SUCCESS;
85
}
86
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x,...)
Definition
AthMsgStreamMacros.h:48
EnergyLoss.h
MaterialEffectsOnTrack.h
MuonTrkIDMSScatterDecorAlg.h
ScatteringAngles.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
MuonTrkIDMSScatterDecorAlg::m_TrkContainer
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrkContainer
Definition
MuonTrkIDMSScatterDecorAlg.h:27
MuonTrkIDMSScatterDecorAlg::m_sigmaDeltaTheta0Key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_sigmaDeltaTheta0Key
Definition
MuonTrkIDMSScatterDecorAlg.h:39
MuonTrkIDMSScatterDecorAlg::m_sigmaDeltaPhi0Key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_sigmaDeltaPhi0Key
Definition
MuonTrkIDMSScatterDecorAlg.h:38
MuonTrkIDMSScatterDecorAlg::m_deltaTheta0Key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_deltaTheta0Key
Definition
MuonTrkIDMSScatterDecorAlg.h:36
MuonTrkIDMSScatterDecorAlg::initialize
virtual StatusCode initialize() override
Definition
MuonTrkIDMSScatterDecorAlg.cxx:18
MuonTrkIDMSScatterDecorAlg::m_deltaPhi1Key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_deltaPhi1Key
Definition
MuonTrkIDMSScatterDecorAlg.h:29
MuonTrkIDMSScatterDecorAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
MuonTrkIDMSScatterDecorAlg.cxx:34
MuonTrkIDMSScatterDecorAlg::m_deltaPhi0Key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_deltaPhi0Key
Definition
MuonTrkIDMSScatterDecorAlg.h:35
MuonTrkIDMSScatterDecorAlg::MuonTrkIDMSScatterDecorAlg
MuonTrkIDMSScatterDecorAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
MuonTrkIDMSScatterDecorAlg.cxx:15
MuonTrkIDMSScatterDecorAlg::m_sigmaDeltaTheta1Key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_sigmaDeltaTheta1Key
Definition
MuonTrkIDMSScatterDecorAlg.h:33
MuonTrkIDMSScatterDecorAlg::m_sigmaDeltaPhi1Key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_sigmaDeltaPhi1Key
Definition
MuonTrkIDMSScatterDecorAlg.h:32
MuonTrkIDMSScatterDecorAlg::m_deltaTheta1Key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_deltaTheta1Key
Definition
MuonTrkIDMSScatterDecorAlg.h:30
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
Trk::EnergyLoss::deltaE
double deltaE() const
returns the
Trk::MaterialEffectsOnTrack
represents the full description of deflection and e-loss of a track in material.
Definition
MaterialEffectsOnTrack.h:40
Trk::MaterialEffectsOnTrack::energyLoss
const EnergyLoss * energyLoss() const
returns the energy loss object.
Trk::MaterialEffectsOnTrack::scatteringAngles
const ScatteringAngles * scatteringAngles() const
returns the MCS-angles object.
Trk::ScatteringAngles::sigmaDeltaPhi
double sigmaDeltaPhi() const
returns the
Definition
ScatteringAngles.h:94
Trk::ScatteringAngles::deltaPhi
double deltaPhi() const
returns the
Definition
ScatteringAngles.h:82
Trk::ScatteringAngles::sigmaDeltaTheta
double sigmaDeltaTheta() const
returns the
Definition
ScatteringAngles.h:100
Trk::ScatteringAngles::deltaTheta
double deltaTheta() const
returns the
Definition
ScatteringAngles.h:88
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition
TrackStateOnSurface.h:71
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition
Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
Generated on
for ATLAS Offline Software by
1.17.0