Skip to content
Snippets Groups Projects
Commit 0a388c21 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

InDetBeamSpotReader: Make printout more concise

Print one line per event with all beamspot information instead of the
column-wise format. Also take EventID from EventContext instead of
EventInfo.
parent c65d116f
No related branches found
No related tags found
No related merge requests found
......@@ -14,8 +14,6 @@ StatusCode InDet::InDetBeamSpotReader::initialize() {
ATH_MSG_DEBUG( "in initialize()" );
ATH_CHECK( m_beamSpotKey.initialize() );
ATH_CHECK( m_eventInfo.initialize() );
ATH_CHECK( m_vxContainer.initialize(!m_vxContainer.empty()) );
return StatusCode::SUCCESS;
......@@ -24,46 +22,39 @@ StatusCode InDet::InDetBeamSpotReader::initialize() {
StatusCode InDet::InDetBeamSpotReader::execute(const EventContext& ctx) const {
ATH_MSG_DEBUG( "in execute()");
//get the set of
SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx };
SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfo, ctx);
ATH_MSG_INFO( "In event " << (*eventInfo) );
ATH_MSG_INFO("BeamSpot Position: \n "
<< beamSpotHandle->beamPos() );
ATH_MSG_INFO("BeamSpot Sigma\n\t"
<< beamSpotHandle->beamSigma(0) << "\n\t"
<< beamSpotHandle->beamSigma(1) << "\n\t"
<< beamSpotHandle->beamSigma(2) << "\n\t");
ATH_MSG_INFO("BeamSpot Tilt\n\t"
<< beamSpotHandle->beamTilt(0) << "\n\t"
<< beamSpotHandle->beamTilt(1) << "\n\t");
ATH_MSG_INFO( "In event " << ctx.eventID() );
ATH_MSG_INFO("BeamSpot Position: "
<< beamSpotHandle->beamPos()[0] << " "
<< beamSpotHandle->beamPos()[1] << " "
<< beamSpotHandle->beamPos()[2]
<<", Sigma: "
<< beamSpotHandle->beamSigma(0) << " "
<< beamSpotHandle->beamSigma(1) << " "
<< beamSpotHandle->beamSigma(2)
<< ", Tilt: "
<< beamSpotHandle->beamTilt(0) << " "
<< beamSpotHandle->beamTilt(1)
<< ", Status: "
<< beamSpotHandle->beamStatus());
//get list of PVs
if (!m_vxContainer.empty()) {
ATH_MSG_INFO("Beamspot position at PV z-position");
SG::ReadHandle<VxContainer> importedVxContainer(m_vxContainer, ctx);
VxContainer::const_iterator vtxItr;
for(vtxItr=importedVxContainer->begin();
vtxItr!=importedVxContainer->end(); ++vtxItr) {
if (static_cast<int>((*vtxItr)->vxTrackAtVertex()->size())==0) continue;
if (msgLvl(MSG::INFO)) ATH_MSG_INFO("PV position: "
<< (*vtxItr)->recVertex().position() );
double z = (*vtxItr)->recVertex().position().z();
if (msgLvl(MSG::INFO)) ATH_MSG_INFO("\n\t"
<< beamSpotHandle->beamPos()(0)
+ (z - beamSpotHandle->beamPos()(2))
*beamSpotHandle->beamTilt(0) << "\n\t"
<< beamSpotHandle->beamPos()(1)
+ (z - beamSpotHandle->beamPos()(2))
*beamSpotHandle->beamTilt(1) );
for (const auto& vtx : *importedVxContainer) {
if (static_cast<int>(vtx->vxTrackAtVertex()->size())==0) continue;
ATH_MSG_INFO("PV position: " << vtx->recVertex().position() );
double z = vtx->recVertex().position().z();
ATH_MSG_INFO("\n\t"
<< beamSpotHandle->beamPos()(0)
+ (z - beamSpotHandle->beamPos()(2))
*beamSpotHandle->beamTilt(0) << "\n\t"
<< beamSpotHandle->beamPos()(1)
+ (z - beamSpotHandle->beamPos()(2))
*beamSpotHandle->beamTilt(1) );
}
}
return StatusCode::SUCCESS;
}
StatusCode InDet::InDetBeamSpotReader::finalize() {
ATH_MSG_DEBUG( "in finalize()" );
return StatusCode::SUCCESS;
}
......@@ -13,7 +13,6 @@
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "StoreGate/ReadHandleKey.h"
#include "VxVertex/VxContainer.h"
#include "xAODEventInfo/EventInfo.h"
#include "BeamSpotConditionsData/BeamSpotData.h"
namespace InDet {
......@@ -28,14 +27,11 @@ namespace InDet {
InDetBeamSpotReader (const std::string& name, ISvcLocator* pSvcLocator);
StatusCode initialize() override;
StatusCode execute(const EventContext& ctx) const override;
StatusCode finalize() override;
private:
SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey {
this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo
{this, "EvtInfo", "EventInfo", "EventInfo name"};
SG::ReadHandleKey<VxContainer> m_vxContainer
{this, "VxContainer", "VxPrimaryCandidate", "Vertex container name"};
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment