ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetCalibAlgs
InDetBeamSpotFinder
src
InDetBeamSpotReader.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
#include "
InDetBeamSpotReader.h
"
6
#include "
VxVertex/VxCandidate.h
"
7
8
InDet::InDetBeamSpotReader::InDetBeamSpotReader
(
const
std::string& name, ISvcLocator* pSvcLocator):
9
AthReentrantAlgorithm
(name, pSvcLocator)
10
{
11
}
12
13
StatusCode
InDet::InDetBeamSpotReader::initialize
() {
14
ATH_MSG_DEBUG
(
"in initialize()"
);
15
16
ATH_CHECK
(
m_beamSpotKey
.initialize() );
17
ATH_CHECK
(
m_vxContainer
.initialize(!
m_vxContainer
.empty()) );
18
19
return
StatusCode::SUCCESS;
20
}
21
22
StatusCode
InDet::InDetBeamSpotReader::execute
(
const
EventContext& ctx)
const
{
23
ATH_MSG_DEBUG
(
"in execute()"
);
24
25
SG::ReadCondHandle<InDet::BeamSpotData>
beamSpotHandle {
m_beamSpotKey
, ctx };
26
ATH_MSG_INFO
(
"In event "
<< ctx.eventID() );
27
ATH_MSG_INFO
(
"BeamSpot Position: "
28
<< beamSpotHandle->beamPos()[0] <<
" "
29
<< beamSpotHandle->beamPos()[1] <<
" "
30
<< beamSpotHandle->beamPos()[2]
31
<<
", Sigma: "
32
<< beamSpotHandle->beamSigma(0) <<
" "
33
<< beamSpotHandle->beamSigma(1) <<
" "
34
<< beamSpotHandle->beamSigma(2)
35
<<
", Tilt: "
36
<< beamSpotHandle->beamTilt(0) <<
" "
37
<< beamSpotHandle->beamTilt(1)
38
<<
", Status: "
39
<< beamSpotHandle->beamStatus());
40
41
//get list of PVs
42
if
(!
m_vxContainer
.empty()) {
43
ATH_MSG_INFO
(
"Beamspot position at PV z-position"
);
44
SG::ReadHandle<VxContainer>
importedVxContainer(
m_vxContainer
, ctx);
45
for
(
const
Trk::VxCandidate
* vtx : *importedVxContainer) {
46
if
(
static_cast<
int
>
(vtx->vxTrackAtVertex()->size())==0)
continue
;
47
ATH_MSG_INFO
(
"PV position: "
<< vtx->recVertex().position() );
48
double
z
= vtx->recVertex().position().z();
49
ATH_MSG_INFO
(
"\n\t"
50
<< beamSpotHandle->beamPos()(0)
51
+ (
z
- beamSpotHandle->beamPos()(2))
52
*beamSpotHandle->beamTilt(0) <<
"\n\t"
53
<< beamSpotHandle->beamPos()(1)
54
+ (
z
- beamSpotHandle->beamPos()(2))
55
*beamSpotHandle->beamTilt(1) );
56
}
57
}
58
59
return
StatusCode::SUCCESS;
60
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
InDetBeamSpotReader.h
z
#define z
VxCandidate.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
InDet::InDetBeamSpotReader::m_vxContainer
SG::ReadHandleKey< VxContainer > m_vxContainer
Definition
InDetBeamSpotReader.h:36
InDet::InDetBeamSpotReader::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition
InDetBeamSpotReader.h:32
InDet::InDetBeamSpotReader::initialize
StatusCode initialize() override
Definition
InDetBeamSpotReader.cxx:13
InDet::InDetBeamSpotReader::InDetBeamSpotReader
InDetBeamSpotReader(const std::string &name, ISvcLocator *pSvcLocator)
Definition
InDetBeamSpotReader.cxx:8
InDet::InDetBeamSpotReader::execute
StatusCode execute(const EventContext &ctx) const override
Definition
InDetBeamSpotReader.cxx:22
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
Trk::VxCandidate
Definition
VxCandidate.h:27
Generated on
for ATLAS Offline Software by
1.17.0