Skip to content
Snippets Groups Projects
Commit 479afe64 authored by Adam Edward Barton's avatar Adam Edward Barton
Browse files

migrate InDetBeamSpotFinder away from IBeamCondSvc service

Former-commit-id: 30542ee6
parent fc30daad
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@ atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
Event/EventInfo
Event/xAOD/xAODEventInfo
InnerDetector/InDetConditions/InDetBeamSpotService
InnerDetector/InDetConditions/BeamSpotConditionsData
Tracking/TrkEvent/TrkEventPrimitives
Tracking/TrkEvent/VxVertex
Trigger/TrigAnalysis/TrigAnalysisInterfaces
......
......@@ -7,27 +7,19 @@
#include "VxVertex/VxCandidate.h"
//#include "TrkEventPrimitives/VertexType.h"
#include "InDetBeamSpotService/IBeamCondSvc.h"
#include "GaudiKernel/ToolHandle.h"
#include "EventInfo/EventID.h"
InDet::InDetBeamSpotReader::InDetBeamSpotReader(const std::string& name, ISvcLocator* pSvcLocator):
AthAlgorithm(name, pSvcLocator),
m_toolSvc("ToolSvc",name),
m_beamSpotSvc("BeamCondSvc",name)
AthReentrantAlgorithm(name, pSvcLocator)
{
declareProperty("ToolSvc", m_toolSvc);
declareProperty("BeamCondSvc", m_beamSpotSvc);
}
StatusCode InDet::InDetBeamSpotReader::initialize() {
ATH_MSG_DEBUG( "in initialize()" );
ATH_CHECK( m_toolSvc.retrieve() );
ATH_CHECK( m_beamSpotSvc.retrieve() );
ATH_CHECK( m_beamSpotKey.initialize() );
ATH_CHECK( m_eventInfo.initialize() );
ATH_CHECK( m_vxContainer.initialize() );
......@@ -35,26 +27,27 @@ StatusCode InDet::InDetBeamSpotReader::initialize() {
return StatusCode::SUCCESS;
}
StatusCode InDet::InDetBeamSpotReader::execute(){
StatusCode InDet::InDetBeamSpotReader::execute_r(const EventContext& ctx) const {
ATH_MSG_DEBUG( "in execute()");
//get the set of
SG::ReadHandle<EventInfo> eventInfo(m_eventInfo);
SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx };
SG::ReadHandle<EventInfo> eventInfo(m_eventInfo, ctx);
EventID* eventID = eventInfo->event_ID();
ATH_MSG_INFO( "In event " << (*eventID) );
ATH_MSG_INFO("BeamSpot Position: \n "
<< m_beamSpotSvc->beamPos() );
<< beamSpotHandle->beamPos() );
ATH_MSG_INFO("BeamSpot Sigma\n\t"
<< m_beamSpotSvc->beamSigma(0) << "\n\t"
<< m_beamSpotSvc->beamSigma(1) << "\n\t"
<< m_beamSpotSvc->beamSigma(2) << "\n\t");
<< beamSpotHandle->beamSigma(0) << "\n\t"
<< beamSpotHandle->beamSigma(1) << "\n\t"
<< beamSpotHandle->beamSigma(2) << "\n\t");
ATH_MSG_INFO("BeamSpot Tilt\n\t"
<< m_beamSpotSvc->beamTilt(0) << "\n\t"
<< m_beamSpotSvc->beamTilt(1) << "\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<VxContainer> importedVxContainer(m_vxContainer);
SG::ReadHandle<VxContainer> importedVxContainer(m_vxContainer, ctx);
VxContainer::const_iterator vtxItr;
for(vtxItr=importedVxContainer->begin();
vtxItr!=importedVxContainer->end(); ++vtxItr) {
......@@ -63,12 +56,12 @@ StatusCode InDet::InDetBeamSpotReader::execute(){
<< (*vtxItr)->recVertex().position() );
double z = (*vtxItr)->recVertex().position().z();
if (msgLvl(MSG::INFO)) ATH_MSG_INFO("\n\t"
<< m_beamSpotSvc->beamPos()(0)
+ (z - m_beamSpotSvc->beamPos()(2))
*m_beamSpotSvc->beamTilt(0) << "\n\t"
<< m_beamSpotSvc->beamPos()(1)
+ (z - m_beamSpotSvc->beamPos()(2))
*m_beamSpotSvc->beamTilt(1) );
<< 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;
......
......@@ -10,36 +10,29 @@
//////////////////////////////
#include <string>
#include <vector>
#include <map>
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ServiceHandle.h"
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "StoreGate/ReadHandleKey.h"
#include "VxVertex/VxContainer.h"
#include "EventInfo/EventInfo.h"
class IBeamCondSvc;
#include "BeamSpotConditionsData/BeamSpotData.h"
namespace InDet {
/** An example class of how to read beamspot position.
Currently there must be a valid beamspot entry for the IOV of data that is
being read. Otherwise an error will occur.
*/
class InDetBeamSpotReader : public AthAlgorithm {
class InDetBeamSpotReader : public AthReentrantAlgorithm {
public:
//Standard constructor and methods
InDetBeamSpotReader (const std::string& name, ISvcLocator* pSvcLocator);
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
StatusCode initialize() override;
StatusCode execute_r(const EventContext& ctx) const override;
StatusCode finalize() override;
private:
ServiceHandle<IToolSvc> m_toolSvc;
ServiceHandle<IBeamCondSvc> m_beamSpotSvc;
SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
SG::ReadHandleKey<EventInfo> m_eventInfo
{this, "EvtInfo", "EventInfo", "EventInfo 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