ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
BeamEffects
src
BeamSpotFixerAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
#include <
StoreGate/ReadCondHandle.h
>
8
#include <
StoreGate/ReadHandle.h
>
9
#include <
StoreGate/WriteHandle.h
>
10
#include <
xAODEventInfo/EventAuxInfo.h
>
11
12
#include "
BeamSpotFixerAlg.h
"
13
14
namespace
Simulation
15
{
16
17
BeamSpotFixerAlg::BeamSpotFixerAlg
(
const
std::string& name, ISvcLocator* pSvcLocator )
18
:
AthReentrantAlgorithm
( name, pSvcLocator )
19
{
20
}
21
23
StatusCode
BeamSpotFixerAlg::initialize
()
24
{
25
ATH_CHECK
(
m_beamSpotKey
.initialize());
26
27
ATH_CHECK
(
m_inputKey
.initialize() );
28
ATH_MSG_VERBOSE
(
"Initialized ReadHandleKey: "
<<
m_inputKey
);
29
ATH_CHECK
(
m_outputKey
.initialize() );
30
ATH_MSG_VERBOSE
(
"Initialized WriteHandleKey: "
<<
m_outputKey
);
31
32
return
StatusCode::SUCCESS;
33
}
34
35
StatusCode
BeamSpotFixerAlg::execute
(
const
EventContext& ctx)
const
36
{
37
SG::ReadCondHandle<InDet::BeamSpotData>
beamSpotHandle {
m_beamSpotKey
, ctx };
38
if
(!beamSpotHandle.
isValid
()) {
39
ATH_MSG_ERROR
(
"Beam spot information not valid"
);
40
return
StatusCode::FAILURE;
41
}
42
43
SG::ReadHandle<xAOD::EventInfo>
inputEventInfo(
m_inputKey
, ctx);
44
if
(!inputEventInfo.
isValid
()) {
45
ATH_MSG_ERROR
(
"Could not get input xAOD::EventInfo "
<< inputEventInfo.
name
() <<
" from store "
<< inputEventInfo.
store
());
46
return
StatusCode::FAILURE;
47
}
48
ATH_MSG_DEBUG
(
"Found input xAOD::EventInfo "
<< inputEventInfo.
name
() <<
" in store "
<< inputEventInfo.
store
());
49
50
SG::WriteHandle<xAOD::EventInfo>
eventInfo(
m_outputKey
, ctx);
51
ATH_CHECK
(eventInfo.
record
(std::make_unique<xAOD::EventInfo>(), std::make_unique<xAOD::EventAuxInfo>()));
52
if
(!eventInfo.
isValid
()) {
53
ATH_MSG_ERROR
(
"Could not record output xAOD::EventInfo "
<< eventInfo.
name
() <<
" to store "
<< eventInfo.
store
());
54
return
StatusCode::FAILURE;
55
}
56
ATH_MSG_DEBUG
(
"Recorded output xAOD::EventInfo "
<< eventInfo.
name
() <<
" in store "
<< eventInfo.
store
());
57
58
// Copy the eventInfo data
59
*eventInfo = *inputEventInfo;
60
61
// Copy the beamspot info
62
eventInfo->setBeamPos( beamSpotHandle->beamPos()[
Amg::x
],
63
beamSpotHandle->beamPos()[
Amg::y
],
64
beamSpotHandle->beamPos()[
Amg::z
] );
65
eventInfo->setBeamPosSigma( beamSpotHandle->beamSigma( 0 ),
66
beamSpotHandle->beamSigma( 1 ),
67
beamSpotHandle->beamSigma( 2 ) );
68
eventInfo->setBeamPosSigmaXY( beamSpotHandle->beamSigmaXY() );
69
eventInfo->setBeamTiltXZ( beamSpotHandle->beamTilt( 0 ) );
70
eventInfo->setBeamTiltYZ( beamSpotHandle->beamTilt( 1 ) );
71
eventInfo->setBeamStatus( beamSpotHandle->beamStatus() );
72
73
return
StatusCode::SUCCESS;
74
}
75
76
}
// namespace Simulation
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_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
BeamSpotFixerAlg.h
EventAuxInfo.h
ReadCondHandle.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::VarHandleBase::store
std::string store() const
Return the name of the store holding the object we are proxying.
Definition
StoreGate/src/VarHandleBase.cxx:382
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition
AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Simulation::BeamSpotFixerAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Athena algorithm's interface method execute().
Definition
BeamSpotFixerAlg.cxx:35
Simulation::BeamSpotFixerAlg::m_inputKey
SG::ReadHandleKey< xAOD::EventInfo > m_inputKey
Definition
BeamSpotFixerAlg.h:44
Simulation::BeamSpotFixerAlg::BeamSpotFixerAlg
BeamSpotFixerAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
BeamSpotFixerAlg.cxx:17
Simulation::BeamSpotFixerAlg::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition
BeamSpotFixerAlg.h:42
Simulation::BeamSpotFixerAlg::m_outputKey
SG::WriteHandleKey< xAOD::EventInfo > m_outputKey
Definition
BeamSpotFixerAlg.h:45
Simulation::BeamSpotFixerAlg::initialize
virtual StatusCode initialize() override final
Athena algorithm's interface method initialize().
Definition
BeamSpotFixerAlg.cxx:23
Amg::y
@ y
Definition
GeoPrimitives.h:35
Amg::x
@ x
Definition
GeoPrimitives.h:34
Amg::z
@ z
Definition
GeoPrimitives.h:36
Simulation
Definition
BeamEffectsAlg.cxx:21
Generated on
for ATLAS Offline Software by
1.17.0