ATLAS Offline Software
Loading...
Searching...
No Matches
EventInfoBeamSpotDecoratorAlg.cxx
Go to the documentation of this file.
1//
2// Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3//
4
5// Local include(s).
7
8// Gaudi/Athena include(s).
11
12// System include(s).
13#include <cstdint>
14
15// Declare the algorithm to Gaudi.
17
18namespace xAODMaker {
19
21
22 // Initialise all of the keys.
23 ATH_CHECK( m_beamSpotKey.initialize() );
24 ATH_CHECK( m_eventInfoKey.initialize() );
25
26 ATH_CHECK( m_beamPosXKey.initialize() );
27 ATH_CHECK( m_beamPosYKey.initialize() );
28 ATH_CHECK( m_beamPosZKey.initialize() );
29
30 ATH_CHECK( m_beamPosSigmaXKey.initialize() );
31 ATH_CHECK( m_beamPosSigmaYKey.initialize() );
32 ATH_CHECK( m_beamPosSigmaZKey.initialize() );
33 ATH_CHECK( m_beamPosSigmaXYKey.initialize() );
34
35 ATH_CHECK( m_beamTiltXZKey.initialize() );
36 ATH_CHECK( m_beamTiltYZKey.initialize() );
37
38 ATH_CHECK( m_beamStatusKey.initialize() );
39
40 // Greet the user.
41 ATH_MSG_INFO( "Creating beamspot decorations on "
42 << m_beamPosXKey.contHandleKey().fullKey() << " from "
43 << m_beamSpotKey.fullKey() );
44 ATH_MSG_DEBUG( "Keys used by the algorithm:" );
45 ATH_MSG_DEBUG( " - " << m_beamSpotKey.fullKey() );
46 ATH_MSG_DEBUG( " - " << m_beamPosXKey.fullKey() );
47 ATH_MSG_DEBUG( " - " << m_beamPosYKey.fullKey() );
48 ATH_MSG_DEBUG( " - " << m_beamPosZKey.fullKey() );
49 ATH_MSG_DEBUG( " - " << m_beamPosSigmaXKey.fullKey() );
50 ATH_MSG_DEBUG( " - " << m_beamPosSigmaYKey.fullKey() );
51 ATH_MSG_DEBUG( " - " << m_beamPosSigmaZKey.fullKey() );
52 ATH_MSG_DEBUG( " - " << m_beamPosSigmaXYKey.fullKey() );
53 ATH_MSG_DEBUG( " - " << m_beamTiltXZKey.fullKey() );
54 ATH_MSG_DEBUG( " - " << m_beamTiltYZKey.fullKey() );
55 ATH_MSG_DEBUG( " - " << m_beamStatusKey.fullKey() );
56
57 // Return gracefully.
58 return StatusCode::SUCCESS;
59 }
60
61 StatusCode
62 EventInfoBeamSpotDecoratorAlg::execute( const EventContext& ctx ) const {
63
64 // Read in the condition object.
66 beamSpotHandle( m_beamSpotKey, ctx );
67 const InDet::BeamSpotData* beamSpotData = beamSpotHandle.retrieve();
68 ATH_CHECK( beamSpotData != nullptr );
69
70 // Set all of the decorations on the EventInfo object.
72 beamPosXHandle( m_beamPosXKey, ctx );
73 beamPosXHandle( *beamPosXHandle ) = beamSpotData->beamPos()[ Amg::x ];
75 beamPosYHandle( m_beamPosYKey, ctx );
76 beamPosYHandle( *beamPosYHandle ) = beamSpotData->beamPos()[ Amg::y ];
78 beamPosZHandle( m_beamPosZKey, ctx );
79 beamPosZHandle( *beamPosZHandle ) = beamSpotData->beamPos()[ Amg::z ];
80
82 beamPosSigmaXHandle( m_beamPosSigmaXKey, ctx );
83 beamPosSigmaXHandle( *beamPosSigmaXHandle ) =
84 beamSpotData->beamSigma( 0 );
86 beamPosSigmaYHandle( m_beamPosSigmaYKey, ctx );
87 beamPosSigmaYHandle( *beamPosSigmaYHandle ) =
88 beamSpotData->beamSigma( 1 );
90 beamPosSigmaZHandle( m_beamPosSigmaZKey, ctx );
91 beamPosSigmaZHandle( *beamPosSigmaZHandle ) =
92 beamSpotData->beamSigma( 2 );
94 beamPosSigmaXYHandle( m_beamPosSigmaXYKey, ctx );
95 beamPosSigmaXYHandle( *beamPosSigmaXYHandle ) =
96 beamSpotData->beamSigmaXY();
97
99 beamTiltXZHandle( m_beamTiltXZKey, ctx );
100 beamTiltXZHandle( *beamTiltXZHandle ) = beamSpotData->beamTilt( 0 );
102 beamTiltYZHandle( m_beamTiltYZKey, ctx );
103 beamTiltYZHandle( *beamTiltYZHandle ) = beamSpotData->beamTilt( 1 );
104
106 beamStatusHandle( m_beamStatusKey, ctx );
107 beamStatusHandle( *beamStatusHandle ) = beamSpotData->beamStatus();
108
109 // Return gracefully.
110 return StatusCode::SUCCESS;
111 }
112
113} // namespace xAODMaker
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
DECLARE_COMPONENT(MuonGMR4::ReadoutGeomCnvAlg)
Handle class for adding a decoration to an object.
float beamTilt(int i) const noexcept
Returns the beam sigma for the i+3-th error matrix element (the 'tilt')
float beamSigma(int i) const noexcept
Returns the beam sigma for the i-th error matrix element.
int beamStatus() const noexcept
const Amg::Vector3D & beamPos() const noexcept
float beamSigmaXY() const noexcept
const_pointer_type retrieve()
Handle class for adding a decoration to an object.
Algorithm for filling the beam position variables on xAOD::EventInfo.
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamPosSigmaXKey
Decorator handle for beamPosSigmaX.
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamPosYKey
Decorator handle for beamPosY.
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamPosSigmaYKey
Decorator handle for beamPosSigmaY.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Read handle for EventInfo object to be decorated.
virtual StatusCode initialize() override
Function initialising the algorithm.
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Conditions object with the beamspot information.
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamStatusKey
Decorator handle for beamStatus.
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamTiltXZKey
Decorator handle for beamTiltXZ.
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm.
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamTiltYZKey
Decorator handle for beamTiltYZ.
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamPosZKey
Decorator handle for beamPosZ.
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamPosSigmaXYKey
Decorator handle for beamPosSigmaXY.
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamPosSigmaZKey
Decorator handle for beamPosSigmaZ.
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamPosXKey
Decorator handle for beamPosX.