Commit 5b054534 authored by Adam Edward Barton's avatar Adam Edward Barton 💬
Browse files

Use 'proper' deco access to beamspot data

parent 4abc5eac
......@@ -308,7 +308,7 @@ if InDetFlags.doV0Finder():
lamin = 900,
lamax = 1300,
d0_cut = 0.,
UseBeamSpotCond = True,
UseBeamSpotCond = False,
V0Tools = v0_tools,
TrackToVertexTool = TrackingCommon.getInDetTrackToVertexTool(),
Extrapolator = v0_InDetExtrapolator)
......@@ -331,7 +331,7 @@ if InDetFlags.doV0Finder():
#useTRTplusSi = True,
useVertexCollection = True,
#trkSelPV = True,
UseBeamSpotCond = True,
UseBeamSpotCond = False,
V0Tools = v0_tools,
TrackToVertexTool = TrackingCommon.getInDetTrackToVertexTool(),
Extrapolator = v0_InDetExtrapolator)
......
......@@ -20,6 +20,8 @@
#include "xAODTracking/VertexContainer.h"
#include "xAODTracking/TrackParticleContainer.h"
#include "StoreGate/WriteDecorHandleKey.h"
#include "StoreGate/ReadDecorHandleKey.h"
#include "StoreGate/ReadDecorHandleKeyArray.h"
#include "xAODEventInfo/EventInfo.h"
#include "BeamSpotConditionsData/BeamSpotData.h"
......@@ -208,6 +210,7 @@ namespace InDet
SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo_key{this, "EventInfo", "EventInfo", "Input event information"};
SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
SG::ReadDecorHandleKeyArray<xAOD::EventInfo> m_beamSpotDecoKey{this, "BeamSpotDecoKeys" ,{}, "Add the scheduler dependencies on the beamspot information"};
Gaudi::Property<bool> m_useBeamSpotCond { this, "UseBeamSpotCond", false };
// V0 candidate output container name (same calling alg)
Gaudi::Property<std::string> m_v0Key { this, "V0ContainerName", "V0Candidates", "V0 container name (same calling alg)" };
......
......@@ -36,7 +36,7 @@
#include "xAODTracking/VertexContainer.h"
#include "EventKernel/PdtPdg.h"
#include "StoreGate/WriteDecorHandle.h"
#include "StoreGate/ReadDecorHandle.h"
#include <vector>
#include <cmath>
......@@ -231,7 +231,12 @@ StatusCode InDetV0FinderTool::initialize()
ATH_CHECK( m_eventInfo_key.initialize(!m_useBeamSpotCond));
ATH_CHECK( m_beamSpotKey .initialize( m_useBeamSpotCond));
if(!m_useBeamSpotCond){
for (const std::string beam : {"beamPosX", "beamPosY", "beamPosZ"}) {
m_beamSpotDecoKey.emplace_back(m_eventInfo_key.key() + "."+beam);
}
}
ATH_CHECK( m_beamSpotDecoKey.initialize(!m_useBeamSpotCond));
// Get the track selector tool from ToolSvc
ATH_CHECK( m_trkSelector.retrieve() );
......@@ -309,8 +314,10 @@ StatusCode InDetV0FinderTool::performSearch(xAOD::VertexContainer* v0Container,
auto beamSpotHandle = SG::ReadCondHandle(m_beamSpotKey, ctx);
beamspot = beamSpotHandle->beamPos();
}else{
SG::ReadHandle<xAOD::EventInfo> evt { m_eventInfo_key, ctx };
beamspot = Amg::Vector3D(evt->beamPosX(), evt->beamPosY(), evt->beamPosZ());
SG::ReadDecorHandle<xAOD::EventInfo, float> beamPosX(m_beamSpotDecoKey[0], ctx);
SG::ReadDecorHandle<xAOD::EventInfo, float> beamPosY(m_beamSpotDecoKey[1], ctx);
SG::ReadDecorHandle<xAOD::EventInfo, float> beamPosZ(m_beamSpotDecoKey[2], ctx);
beamspot = Amg::Vector3D(beamPosX(0), beamPosY(0), beamPosZ(0));
}
// track preselection
std::vector<const xAOD::TrackParticle*> posTracks; posTracks.clear();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment