ATLAS Offline Software
Loading...
Searching...
No Matches
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
7
8InDet::InDetBeamSpotReader::InDetBeamSpotReader(const std::string& name, ISvcLocator* pSvcLocator):
9 AthReentrantAlgorithm(name, pSvcLocator)
10{
11}
12
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
22StatusCode 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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
#define z
An algorithm that can be simultaneously executed in multiple threads.
SG::ReadHandleKey< VxContainer > m_vxContainer
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
StatusCode initialize() override
InDetBeamSpotReader(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode execute(const EventContext &ctx) const override