ATLAS Offline Software
EventInfoBeamSpotDecoratorAlg.cxx
Go to the documentation of this file.
1 //
2 // Copyright (C) 2002-2021 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 
18 namespace xAODMaker {
19 
21 
22  // Initialise all of the keys.
24 
28 
33 
36 
38 
39  // Greet the user.
40  ATH_MSG_INFO( "Creating beamspot decorations on "
41  << m_beamPosXKey.contHandleKey().fullKey() << " from "
42  << m_beamSpotKey.fullKey() );
43  ATH_MSG_DEBUG( "Keys used by the algorithm:" );
44  ATH_MSG_DEBUG( " - " << m_beamSpotKey.fullKey() );
45  ATH_MSG_DEBUG( " - " << m_beamPosXKey.fullKey() );
46  ATH_MSG_DEBUG( " - " << m_beamPosYKey.fullKey() );
47  ATH_MSG_DEBUG( " - " << m_beamPosZKey.fullKey() );
48  ATH_MSG_DEBUG( " - " << m_beamPosSigmaXKey.fullKey() );
49  ATH_MSG_DEBUG( " - " << m_beamPosSigmaYKey.fullKey() );
50  ATH_MSG_DEBUG( " - " << m_beamPosSigmaZKey.fullKey() );
51  ATH_MSG_DEBUG( " - " << m_beamPosSigmaXYKey.fullKey() );
52  ATH_MSG_DEBUG( " - " << m_beamTiltXZKey.fullKey() );
53  ATH_MSG_DEBUG( " - " << m_beamTiltYZKey.fullKey() );
54  ATH_MSG_DEBUG( " - " << m_beamStatusKey.fullKey() );
55 
56  // Return gracefully.
57  return StatusCode::SUCCESS;
58  }
59 
61  EventInfoBeamSpotDecoratorAlg::execute( const EventContext& ctx ) const {
62 
63  // Read in the condition object.
65  beamSpotHandle( m_beamSpotKey, ctx );
66  const InDet::BeamSpotData* beamSpotData = beamSpotHandle.retrieve();
67  ATH_CHECK( beamSpotData != nullptr );
68 
69  // Set all of the decorations on the EventInfo object.
71  beamPosXHandle( m_beamPosXKey, ctx );
72  beamPosXHandle( *beamPosXHandle ) = beamSpotData->beamPos()[ Amg::x ];
74  beamPosYHandle( m_beamPosYKey, ctx );
75  beamPosYHandle( *beamPosYHandle ) = beamSpotData->beamPos()[ Amg::y ];
77  beamPosZHandle( m_beamPosZKey, ctx );
78  beamPosZHandle( *beamPosZHandle ) = beamSpotData->beamPos()[ Amg::z ];
79 
81  beamPosSigmaXHandle( m_beamPosSigmaXKey, ctx );
82  beamPosSigmaXHandle( *beamPosSigmaXHandle ) =
83  beamSpotData->beamSigma( 0 );
85  beamPosSigmaYHandle( m_beamPosSigmaYKey, ctx );
86  beamPosSigmaYHandle( *beamPosSigmaYHandle ) =
87  beamSpotData->beamSigma( 1 );
89  beamPosSigmaZHandle( m_beamPosSigmaZKey, ctx );
90  beamPosSigmaZHandle( *beamPosSigmaZHandle ) =
91  beamSpotData->beamSigma( 2 );
93  beamPosSigmaXYHandle( m_beamPosSigmaXYKey, ctx );
94  beamPosSigmaXYHandle( *beamPosSigmaXYHandle ) =
95  beamSpotData->beamSigmaXY();
96 
98  beamTiltXZHandle( m_beamTiltXZKey, ctx );
99  beamTiltXZHandle( *beamTiltXZHandle ) = beamSpotData->beamTilt( 0 );
101  beamTiltYZHandle( m_beamTiltYZKey, ctx );
102  beamTiltYZHandle( *beamTiltYZHandle ) = beamSpotData->beamTilt( 1 );
103 
105  beamStatusHandle( m_beamStatusKey, ctx );
106  beamStatusHandle( *beamStatusHandle ) = beamSpotData->beamStatus();
107 
108  // Return gracefully.
109  return StatusCode::SUCCESS;
110  }
111 
112 } // namespace xAODMaker
xAODMaker::EventInfoBeamSpotDecoratorAlg::m_beamPosSigmaZKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamPosSigmaZKey
Decorator handle for beamPosSigmaZ.
Definition: EventInfoBeamSpotDecoratorAlg.h:72
xAODMaker::EventInfoBeamSpotDecoratorAlg::m_beamPosZKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamPosZKey
Decorator handle for beamPosZ.
Definition: EventInfoBeamSpotDecoratorAlg.h:59
xAODMaker::EventInfoBeamSpotDecoratorAlg::m_beamPosXKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamPosXKey
Decorator handle for beamPosX.
Definition: EventInfoBeamSpotDecoratorAlg.h:51
xAODMaker::EventInfoBeamSpotDecoratorAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm.
Definition: EventInfoBeamSpotDecoratorAlg.cxx:61
xAODMaker::EventInfoBeamSpotDecoratorAlg::m_beamPosSigmaYKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamPosSigmaYKey
Decorator handle for beamPosSigmaY.
Definition: EventInfoBeamSpotDecoratorAlg.h:68
xAODMaker::EventInfoBeamSpotDecoratorAlg::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Conditions object with the beamspot information.
Definition: EventInfoBeamSpotDecoratorAlg.h:47
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAODMaker::EventInfoBeamSpotDecoratorAlg
Algorithm for filling the beam position variables on xAOD::EventInfo.
Definition: EventInfoBeamSpotDecoratorAlg.h:26
Amg::y
@ y
Definition: GeoPrimitives.h:35
xAODMaker
Definition: StoreGateSvc.h:72
xAODMaker::EventInfoBeamSpotDecoratorAlg::m_beamTiltYZKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamTiltYZKey
Decorator handle for beamTiltYZ.
Definition: EventInfoBeamSpotDecoratorAlg.h:85
ReadCondHandle.h
Amg::z
@ z
Definition: GeoPrimitives.h:36
SG::ReadCondHandle::retrieve
const_pointer_type retrieve()
Definition: ReadCondHandle.h:161
InDet::BeamSpotData::beamSigmaXY
float beamSigmaXY() const noexcept
Definition: BeamSpotData.h:72
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Amg::x
@ x
Definition: GeoPrimitives.h:34
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:99
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAODMaker::EventInfoBeamSpotDecoratorAlg::m_beamPosSigmaXKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamPosSigmaXKey
Decorator handle for beamPosSigmaX.
Definition: EventInfoBeamSpotDecoratorAlg.h:64
DECLARE_COMPONENT
DECLARE_COMPONENT(MuonReadoutGeomCnvAlg)
xAODMaker::EventInfoBeamSpotDecoratorAlg::initialize
virtual StatusCode initialize() override
Function initialising the algorithm.
Definition: EventInfoBeamSpotDecoratorAlg.cxx:20
InDet::BeamSpotData::beamPos
const Amg::Vector3D & beamPos() const noexcept
Definition: BeamSpotData.h:68
xAODMaker::EventInfoBeamSpotDecoratorAlg::m_beamPosYKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamPosYKey
Decorator handle for beamPosY.
Definition: EventInfoBeamSpotDecoratorAlg.h:55
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
EventInfoBeamSpotDecoratorAlg.h
SG::WriteDecorHandleKey::contHandleKey
const ReadHandleKey< T > & contHandleKey() const
Return the handle key for the container.
xAODMaker::EventInfoBeamSpotDecoratorAlg::m_beamPosSigmaXYKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamPosSigmaXYKey
Decorator handle for beamPosSigmaXY.
Definition: EventInfoBeamSpotDecoratorAlg.h:76
InDet::BeamSpotData
Definition: BeamSpotData.h:21
SG::WriteDecorHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
xAODMaker::EventInfoBeamSpotDecoratorAlg::m_beamStatusKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamStatusKey
Decorator handle for beamStatus.
Definition: EventInfoBeamSpotDecoratorAlg.h:90
InDet::BeamSpotData::beamStatus
int beamStatus() const noexcept
Definition: BeamSpotData.h:76
InDet::BeamSpotData::beamTilt
float beamTilt(int i) const noexcept
Returns the beam sigma for the i+3-th error matrix element (the 'tilt')
Definition: BeamSpotData.h:74
InDet::BeamSpotData::beamSigma
float beamSigma(int i) const noexcept
Returns the beam sigma for the i-th error matrix element.
Definition: BeamSpotData.h:70
xAODMaker::EventInfoBeamSpotDecoratorAlg::m_beamTiltXZKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamTiltXZKey
Decorator handle for beamTiltXZ.
Definition: EventInfoBeamSpotDecoratorAlg.h:81