From 20c4c729c6bf3c6101e99c0fb2a6844706907af7 Mon Sep 17 00:00:00 2001 From: Frank Winklmeier Date: Mon, 14 Oct 2019 12:32:37 +0200 Subject: [PATCH] InDetBeamSpotReader: Create component and make vertex optional Enable build of InDetBeamSpotReader component and make the reading of the vertex container optional. --- .../src/InDetBeamSpotReader.cxx | 36 ++++++++++--------- .../InDetBeamSpotFinder_entries.cxx | 4 +-- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotReader.cxx b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotReader.cxx index 69ba8b91c1e..a68e6e5e0b0 100644 --- a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotReader.cxx +++ b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotReader.cxx @@ -16,7 +16,7 @@ StatusCode InDet::InDetBeamSpotReader::initialize() { ATH_CHECK( m_beamSpotKey.initialize() ); ATH_CHECK( m_eventInfo.initialize() ); - ATH_CHECK( m_vxContainer.initialize() ); + ATH_CHECK( m_vxContainer.initialize(!m_vxContainer.empty()) ); return StatusCode::SUCCESS; } @@ -37,24 +37,26 @@ StatusCode InDet::InDetBeamSpotReader::execute(const EventContext& ctx) const { ATH_MSG_INFO("BeamSpot Tilt\n\t" << beamSpotHandle->beamTilt(0) << "\n\t" << beamSpotHandle->beamTilt(1) << "\n\t"); - ATH_MSG_INFO("Beamspot position at PV z-position"); //get list of PVs - SG::ReadHandle importedVxContainer(m_vxContainer, ctx); - VxContainer::const_iterator vtxItr; - for(vtxItr=importedVxContainer->begin(); - vtxItr!=importedVxContainer->end(); ++vtxItr) { - if (static_cast((*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) ); + if (!m_vxContainer.empty()) { + ATH_MSG_INFO("Beamspot position at PV z-position"); + SG::ReadHandle importedVxContainer(m_vxContainer, ctx); + VxContainer::const_iterator vtxItr; + for(vtxItr=importedVxContainer->begin(); + vtxItr!=importedVxContainer->end(); ++vtxItr) { + if (static_cast((*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) ); + } } return StatusCode::SUCCESS; diff --git a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/components/InDetBeamSpotFinder_entries.cxx b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/components/InDetBeamSpotFinder_entries.cxx index b10a8d9e538..d65d02995e7 100644 --- a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/components/InDetBeamSpotFinder_entries.cxx +++ b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/components/InDetBeamSpotFinder_entries.cxx @@ -1,11 +1,11 @@ #include "../InDetBeamSpotFinder.h" #include "../InDetBeamSpotRooFit.h" +#include "../InDetBeamSpotReader.h" #include "../InDetBeamSpotVertex.h" #include "../RefitTracksAndVertex.h" - DECLARE_COMPONENT( InDet::InDetBeamSpotFinder ) DECLARE_COMPONENT( InDet::InDetBeamSpotVertex ) DECLARE_COMPONENT( InDet::InDetBeamSpotRooFit ) +DECLARE_COMPONENT( InDet::InDetBeamSpotReader ) DECLARE_COMPONENT( RefitTracksAndVertex ) - -- GitLab