ATLAS Offline Software
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 
14  ATH_MSG_DEBUG( "in initialize()" );
15 
18 
19  return StatusCode::SUCCESS;
20 }
21 
22 StatusCode InDet::InDetBeamSpotReader::execute(const EventContext& ctx) const {
23  ATH_MSG_DEBUG( "in execute()");
24 
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 }
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle< VxContainer >
InDet::InDetBeamSpotReader::InDetBeamSpotReader
InDetBeamSpotReader(const std::string &name, ISvcLocator *pSvcLocator)
Definition: InDetBeamSpotReader.cxx:8
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
InDet::InDetBeamSpotReader::initialize
StatusCode initialize() override
Definition: InDetBeamSpotReader.cxx:13
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
InDet::InDetBeamSpotReader::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition: InDetBeamSpotReader.h:32
z
#define z
InDetBeamSpotReader.h
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
VxCandidate.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
InDet::InDetBeamSpotReader::execute
StatusCode execute(const EventContext &ctx) const override
Definition: InDetBeamSpotReader.cxx:22
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
InDet::InDetBeamSpotReader::m_vxContainer
SG::ReadHandleKey< VxContainer > m_vxContainer
Definition: InDetBeamSpotReader.h:36
Trk::VxCandidate
Definition: VxCandidate.h:27