ATLAS Offline Software
Loading...
Searching...
No Matches
InDetSecVtxTrackCut.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4//Author: Lianyou Shan <lianyou.shan@cern.ch>
5// -*- c++ -*-
6// InDetSecVtxTrackCuts.cxx
7// implementations and definitions of cut objects
8
11
12#include <algorithm>
13
14
15// ---------------- SecVtxTrackCut ----------------
22
24
25// this function is a friend of the tool
27{
28 if (!m_selectionTool) {
29 ATH_MSG_ERROR( "Invalid pointer to InDetSecVtxTrackSelectionTool." );
30 return StatusCode::FAILURE;
31 }
32 // let the cut have a handle on the tool's accessors
33 m_trackAccessors = &(m_selectionTool->m_trackAccessors);
34 return StatusCode::SUCCESS;
35}
36
37// ---------------- D0minCut ----------------
44
46{
49 return StatusCode::SUCCESS;
50}
51
53{
54 if (!m_paramAccessor) {
55 ATH_MSG_WARNING( "Track parameter accessor not valid. Track will not pass this cut." );
56 return false;
57 }
58 ATH_MSG_DEBUG( " trk D0 " << m_paramAccessor->getValue() << " vs D0minCut " << m_minValue ) ;
59 return std::fabs( m_paramAccessor->getValue() ) >= m_minValue;
60}
61
62// ---------------- FuncSummaryValueCut ----------------
63template <size_t N>
65 const std::array<xAOD::SummaryType,N>&& sumTypes) : InDet::SecVtxTrackCut(tool)
66 , m_summaryTypes(sumTypes)
67{
68}
69
70template <size_t N>
72{
73 // first run the base class version to get access to the tool's accessors
75
76 for (size_t i=0; i<N; ++i) {
77 std::string summaryName = "summaryType";
78 summaryName += std::to_string(m_summaryTypes[i]);
79 std::shared_ptr<SummaryAccessor> accessor;
80 ATH_CHECK( getAccessor(summaryName, accessor) );
81 accessor->setSummaryType( m_summaryTypes[i] );
82 m_summaryAccessors[i] = std::move(accessor);
83 }
84
85 return StatusCode::SUCCESS;
86}
87
88template <size_t N>
90{
91 std::array<uint8_t,N> results{}; // member variable to store the results
92
93 for (size_t i=0; i<N; ++i) {
94 if (!m_summaryAccessors[i]) {
95 ATH_MSG_WARNING( "Track summary accessor not valid. Track will not pass this cut." );
96 return false;
97 }
98 results[i] = m_summaryAccessors[i]->getValue();
99 }
100 return m_func(results);
101}
102
103template class InDet::FuncSummaryValueCut<3>;
104template class InDet::FuncSummaryValueCut<4>;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
#define min(a, b)
Definition cfImp.cxx:40
virtual StatusCode initialize()
virtual bool result() const
std::shared_ptr< svParamAccessor< 0 > > m_paramAccessor
D0minCut(InDetSecVtxTrackSelectionTool *, Double_t min=-99.)
std::function< bool(const std::array< uint8_t, N > &)> m_func
FuncSummaryValueCut(InDetSecVtxTrackSelectionTool *, const std::array< xAOD::SummaryType, N > &&)
std::array< xAOD::SummaryType, N > m_summaryTypes
std::array< std::shared_ptr< SummaryAccessor >, N > m_summaryAccessors
Implementation of the track selector tool.
SecVtxTrackCut(InDetSecVtxTrackSelectionTool *)
std::unordered_map< std::string, std::shared_ptr< SecVtxTrackAccessor > > * m_trackAccessors
StatusCode getAccessor(const std::string &name, std::shared_ptr< AccessorType > &accessor)
virtual ~SecVtxTrackCut()=0
InDetSecVtxTrackSelectionTool * m_selectionTool
virtual StatusCode initialize()
AsgMessaging(const std::string &name)
Constructor with a name.
Primary Vertex Finder.