ATLAS Offline Software
InDetSecVtxTrackAccessor.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 //Author: Lianyou Shan <lianyou.shan@cern.ch>
5 // -*- c++ -*-
6 // InDetSecVtxTrackAccessor.cxx
7 // implementations of accessor objects
8 
11 
12 // ---------------- SecVtxTrackAccessor ----------------
14  : asg::AsgMessaging::AsgMessaging(tool)
15 { }
16 
18 
19 // ---------------- SummaryAccessor ----------------
22  , m_summaryValue(0)
23  , m_summaryType(xAOD::numberOfTrackSummaryTypes)
24 {
25 }
26 
28 {
29  m_summaryType = sumType;
30 }
31 
33  const xAOD::Vertex* )
34 {
35  if (!track.summaryValue(m_summaryValue, m_summaryType)) {
36  ATH_MSG_DEBUG( "Failed to get SummaryType " << std::to_string(m_summaryType)
37  << " from xAOD::TrackParticle summary. A value of zero will be used instead." );
38  m_summaryValue = 0;
39  }
40  return StatusCode::SUCCESS;
41 }
42 
43 #ifndef XAOD_ANALYSIS
45  const Trk::TrackParameters*,
46  const Trk::TrackSummary* summary )
47 {
48  if (!summary) {
49  ATH_MSG_ERROR( "Recieved null pointer to track summary." );
50  m_summaryValue = 0;
51  return StatusCode::FAILURE;
52  }
53  // previously casting the xAOD::SummaryType directly to a Trk::SummaryType.
54  // now casting to an int in between to try to remove coverity warning.
55  Int_t summaryTypeInt = static_cast<Int_t>(m_summaryType);
56  Int_t checkSummaryValue = summary->get( static_cast<Trk::SummaryType>(summaryTypeInt) );
57  if (checkSummaryValue < 0) {
58  // Trk::TrackSummary::get() will return -1 if the data cannot be retrieved
59  ATH_MSG_DEBUG( "Recieved " << checkSummaryValue << " for SummaryType " << std::to_string(m_summaryType)
60  << " from Trk::TrackSummary. A value of zero will be used instead." );
61  checkSummaryValue = 0;
62  }
63  m_summaryValue = checkSummaryValue;
64  return StatusCode::SUCCESS;
65 }
66 #endif
67 
InDet::SummaryAccessor::access
StatusCode access(const xAOD::TrackParticle &track, const xAOD::Vertex *vertex=0)
Definition: InDetSecVtxTrackAccessor.cxx:32
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
asg::IAsgTool
Base class for the dual-use tool interface classes.
Definition: IAsgTool.h:41
InDet::SummaryAccessor::m_summaryType
xAOD::SummaryType m_summaryType
Definition: InDetSecVtxTrackAccessor.h:60
asg
Definition: DataHandleTestTool.h:28
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
InDet::SummaryAccessor::m_summaryValue
uint8_t m_summaryValue
Definition: InDetSecVtxTrackAccessor.h:59
InDetSecVtxTrackSelectionTool.h
xAOD::SummaryType
SummaryType
Enumerates the different types of information stored in Summary.
Definition: TrackingPrimitives.h:228
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
InDet::SummaryAccessor::setSummaryType
void setSummaryType(xAOD::SummaryType)
Definition: InDetSecVtxTrackAccessor.cxx:27
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
InDet::SecVtxTrackAccessor::SecVtxTrackAccessor
SecVtxTrackAccessor(const asg::IAsgTool *)
Definition: InDetSecVtxTrackAccessor.cxx:13
Trk::ParametersBase
Definition: ParametersBase.h:55
xAOD::numberOfTrackSummaryTypes
@ numberOfTrackSummaryTypes
Definition: TrackingPrimitives.h:319
InDet::SecVtxTrackAccessor
Definition: InDetSecVtxTrackAccessor.h:33
Trk::TrackSummary
A summary of the information contained by a track.
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:287
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
InDet::SecVtxTrackAccessor::~SecVtxTrackAccessor
virtual ~SecVtxTrackAccessor()=0
Trk::SummaryType
SummaryType
enumerates the different types of information stored in Summary.
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:45
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
InDetSecVtxTrackAccessor.h
InDet::SummaryAccessor::SummaryAccessor
SummaryAccessor(const asg::IAsgTool *)
Definition: InDetSecVtxTrackAccessor.cxx:20
SCT_Monitoring::summary
@ summary
Definition: SCT_MonitoringNumbers.h:65