ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetValidation
InDetPhysValMonitoring
src
ParameterErrDecoratorAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
9
#include "
ParameterErrDecoratorAlg.h
"
10
#include "
TrkEventPrimitives/JacobianThetaPToCotThetaPt.h
"
11
#include "
EventPrimitives/EventPrimitivesHelpers.h
"
12
#include "
GeoPrimitives/GeoPrimitivesHelpers.h
"
13
14
ParameterErrDecoratorAlg::ParameterErrDecoratorAlg
(
const
std::string& name, ISvcLocator* pSvcLocator) :
15
AthReentrantAlgorithm
(name, pSvcLocator) {
16
}
17
18
ParameterErrDecoratorAlg::~ParameterErrDecoratorAlg
() {
19
// nop
20
}
21
22
StatusCode
23
ParameterErrDecoratorAlg::initialize
() {
24
ATH_CHECK
(
m_trkParticleKey
.initialize() );
25
26
std::vector<std::string> decorationNames(
kNDecorators
);
27
decorationNames[
kDecorD0err
]=
"d0err"
;
28
decorationNames[
kDecorZ0err
]=
"z0err"
;
29
decorationNames[
kDecorPhierr
]=
"phierr"
;
30
decorationNames[
kDecorThetaerr
]=
"thetaerr"
;
31
decorationNames[
kDecorQoperr
]=
"qoperr"
;
32
std::string message{
"The following decorations should be added by ParameterErrDecoratorAlg:\n"
};
33
for
(
const
auto
& thisName: decorationNames){
34
message += thisName+
"\n"
;
35
}
36
ATH_MSG_INFO
(message);
37
38
IDPVM::createDecoratorKeysAndAccessor
(*
this
,
m_trkParticleKey
,
m_prefix
.value(),decorationNames,
m_decor
);
39
assert(
m_decor
.size() ==
kNDecorators
);
40
41
return
StatusCode::SUCCESS;
42
}
43
44
StatusCode
45
ParameterErrDecoratorAlg::finalize
() {
46
return
StatusCode::SUCCESS;
47
}
48
49
StatusCode
50
ParameterErrDecoratorAlg::execute
(
const
EventContext &ctx)
const
{
51
SG::ReadHandle<xAOD::TrackParticleContainer>
ptracks(
m_trkParticleKey
, ctx);
52
if
((not ptracks.
isValid
())) {
53
ATH_MSG_ERROR
(
"The track particle container '"
<<
m_trkParticleKey
.key()<<
"' could not be read."
);
54
return
StatusCode::FAILURE;
55
}
56
std::vector< IDPVM::OptionalDecoration<xAOD::TrackParticleContainer,float> >
57
floatDecoration(
IDPVM::createDecoratorsIfNeeded
(*ptracks,
m_decor
, ctx,
msgLvl
(MSG::DEBUG)) );
58
if
(not floatDecoration.empty()){
59
for
(
const
xAOD::TrackParticle
*pTrkParticle : *ptracks) {
60
if
(not
decorateTrack
(*pTrkParticle, floatDecoration) ) {
61
ATH_MSG_ERROR
(
"Decoration failed in ParameterErrDecoratorAlg::execute."
);
62
return
StatusCode::FAILURE;
63
}
64
}
65
}
66
return
StatusCode::SUCCESS;
67
}
68
69
bool
70
ParameterErrDecoratorAlg::decorateTrack
(
const
xAOD::TrackParticle
& particle,
71
std::vector<
IDPVM::OptionalDecoration<xAOD::TrackParticleContainer, float>
> &floatDecoration)
const
{
72
ATH_MSG_VERBOSE
(
"Decorate track with errors "
);
73
bool
success(
true
);
74
const
AmgSymMatrix
(5) errorMat = particle.definingParametersCovMatrix();
75
double
mtheta = particle.theta();
76
double
mqp = particle.qOverP();
77
Trk::JacobianThetaPToCotThetaPt
TheJac(mtheta, mqp);
78
AmgSymMatrix
(5) covVert;
79
covVert = errorMat.similarity(TheJac);
80
81
// 'safeDecorator' used to prevent a crash in case of adding something which pre-exists.
82
// behaviour chosen is to reject quietly
83
float
d0err =
Amg::error
(covVert,
Trk::d0
);
84
float
z0err =
Amg::error
(covVert,
Trk::z0
);
85
float
phierr =
Amg::error
(covVert,
Trk::phi
);
86
float
thetaerr =
Amg::error
(covVert,
Trk::theta
);
87
float
qoperr =
Amg::error
(covVert,
Trk::qOverP
)*1000.;
88
89
IDPVM::decorateOrRejectQuietly
(particle,floatDecoration[
kDecorD0err
],d0err);
90
IDPVM::decorateOrRejectQuietly
(particle,floatDecoration[
kDecorZ0err
],z0err);
91
IDPVM::decorateOrRejectQuietly
(particle,floatDecoration[
kDecorPhierr
],phierr);
92
IDPVM::decorateOrRejectQuietly
(particle,floatDecoration[
kDecorThetaerr
],thetaerr);
93
IDPVM::decorateOrRejectQuietly
(particle,floatDecoration[
kDecorQoperr
],qoperr);
94
95
return
success;
96
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
EventPrimitivesHelpers.h
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition
EventPrimitives.h:50
GeoPrimitivesHelpers.h
JacobianThetaPToCotThetaPt.h
ParameterErrDecoratorAlg.h
header file for class of same name
AthCommonAlgorithm< Gaudi::Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition
AthCommonMsg.h:30
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
ParameterErrDecoratorAlg::decorateTrack
virtual bool decorateTrack(const xAOD::TrackParticle &particle, std::vector< IDPVM::OptionalDecoration< xAOD::TrackParticleContainer, float > > &floatDecoration) const
Definition
ParameterErrDecoratorAlg.cxx:70
ParameterErrDecoratorAlg::m_prefix
Gaudi::Property< std::string > m_prefix
Definition
ParameterErrDecoratorAlg.h:38
ParameterErrDecoratorAlg::m_decor
std::vector< std::pair< SG::WriteDecorHandleKey< xAOD::TrackParticleContainer >, SG::AuxElement::ConstAccessor< float > > > m_decor
Definition
ParameterErrDecoratorAlg.h:53
ParameterErrDecoratorAlg::execute
virtual StatusCode execute(const EventContext &ctx) const
Definition
ParameterErrDecoratorAlg.cxx:50
ParameterErrDecoratorAlg::ParameterErrDecoratorAlg
ParameterErrDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
ParameterErrDecoratorAlg.cxx:14
ParameterErrDecoratorAlg::kDecorThetaerr
@ kDecorThetaerr
Definition
ParameterErrDecoratorAlg.h:48
ParameterErrDecoratorAlg::kDecorZ0err
@ kDecorZ0err
Definition
ParameterErrDecoratorAlg.h:46
ParameterErrDecoratorAlg::kDecorQoperr
@ kDecorQoperr
Definition
ParameterErrDecoratorAlg.h:49
ParameterErrDecoratorAlg::kNDecorators
@ kNDecorators
Definition
ParameterErrDecoratorAlg.h:50
ParameterErrDecoratorAlg::kDecorD0err
@ kDecorD0err
Definition
ParameterErrDecoratorAlg.h:45
ParameterErrDecoratorAlg::kDecorPhierr
@ kDecorPhierr
Definition
ParameterErrDecoratorAlg.h:47
ParameterErrDecoratorAlg::finalize
virtual StatusCode finalize()
Definition
ParameterErrDecoratorAlg.cxx:45
ParameterErrDecoratorAlg::~ParameterErrDecoratorAlg
virtual ~ParameterErrDecoratorAlg()
Definition
ParameterErrDecoratorAlg.cxx:18
ParameterErrDecoratorAlg::initialize
virtual StatusCode initialize()
Definition
ParameterErrDecoratorAlg.cxx:23
ParameterErrDecoratorAlg::m_trkParticleKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trkParticleKey
Definition
ParameterErrDecoratorAlg.h:42
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Trk::JacobianThetaPToCotThetaPt
This is the 5x5 jacobian for the transformation of track parameters and errors having the new standar...
Definition
JacobianThetaPToCotThetaPt.h:41
Amg::error
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Definition
EventPrimitivesHelpers.h:40
IDPVM::createDecoratorKeysAndAccessor
void createDecoratorKeysAndAccessor(T_Parent &parent, const SG::ReadHandleKey< T_Cont > &container_key, const std::string &prefix, const std::vector< std::string > &decor_names, std::vector< WriteKeyAccessorPair< T_Cont, T > > &decor_out)
Definition
safeDecorator.h:52
IDPVM::decorateOrRejectQuietly
void decorateOrRejectQuietly(const T_Cont_Elm &particle, OptionalDecoration< T_Cont, T > &decorator, const T &value)
Definition
safeDecorator.h:175
IDPVM::createDecoratorsIfNeeded
std::vector< OptionalDecoration< T_Cont, T > > createDecoratorsIfNeeded(const T_Cont &container, const std::vector< WriteKeyAccessorPair< T_Cont, T > > &keys, const EventContext &ctx, bool verbose=false)
Definition
safeDecorator.h:70
IDPVM::OptionalDecoration
std::pair< SG::WriteDecorHandle< ContainerType, VariableType >, bool > OptionalDecoration
Definition
safeDecorator.h:48
Trk::theta
@ theta
Definition
ParamDefs.h:66
Trk::qOverP
@ qOverP
perigee
Definition
ParamDefs.h:67
Trk::phi
@ phi
Definition
ParamDefs.h:75
Trk::d0
@ d0
Definition
ParamDefs.h:63
Trk::z0
@ z0
Definition
ParamDefs.h:64
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