ATLAS Offline Software
Loading...
Searching...
No Matches
TrackSelector.cxx
Go to the documentation of this file.
1
13
16
17#include "TrackSelector.h"
18
21#include "find_bin.h"
22
23IDTPM2::TrackSelector::TrackSelector( const std::string& name )
24 : GenericTrackSelector( name ) { }
25
26
27
30 if ( m_useOfflineTool ) ATH_CHECK( m_offlineTool.retrieve() );
31 return StatusCode::SUCCESS;
32}
33
34
41
42template<typename T, typename U=T>
43bool select_min( const T& x, const std::vector<T>& xbins,
44 const U& y, const std::vector<U>& ycuts ) { return y>=ycuts.at( IDTPM2::bins::find_bin( xbins, x ) ); }
45
46template<typename T, typename U=T>
47bool select_max( const T& x, const std::vector<T>& xbins,
48 const U& y, const std::vector<U>& ycuts ) { return y<=ycuts.at( IDTPM2::bins::find_bin( xbins, x ) ); }
49
50
51
53
54 if ( m_useOfflineTool ) {
56 const xAOD::TrackParticle* track = t.as<xAOD::TrackParticle>();
57
58 if ( !track ) {
60 const xAOD::Electron* electron = t.as<xAOD::Electron>();
61 if ( electron ) track = electron->trackParticle();
62 else return false;
63 }
64
66 if ( ! m_offlineTool->accept( track ) ) return false; // TODO vertex needs to be provided here
67 }
68
72 if ( !GenericTrackSelector::selectTrack(t) ) return false;
73
76 if ( !m_etaBins.empty() ) {
78 // if (!m_minHitsVec.empty() && !nHitsSelVec(*track, m_minHitsVec, m_etaBins)) return false;
79 // if (!m_minPtVec.empty() && !minPtSelVec(*track, m_minPtVec, m_etaBins)) return false;
80 // if (!m_maxD0Vec.empty() && !maxD0SelVec(*track, m_maxD0Vec, m_etaBins)) return false;
81 // if (!m_maxZ0Vec.empty() && !maxZ0SelVec(*track, m_maxZ0Vec, m_etaBins)) return false;
82
83 // if (!m_minHitsVec.empty() && !vector_select( track, m_minHitsVec, m_etaBins)) return false;
84 // if (!m_minPtVec.empty() && !minPtSelVec(*track, m_minPtVec, m_etaBins)) return false;
85 // if (!m_maxD0Vec.empty() && !maxD0SelVec(*track, m_maxD0Vec, m_etaBins)) return false;
86 // if (!m_maxZ0Vec.empty() && !maxZ0SelVec(*track, m_maxZ0Vec, m_etaBins)) return false;
87
95 if ( !m_minHitsVec.empty() && !select_min<float,unsigned>( t.eta(), m_etaBins, t.nSi(), m_minHitsVec.value() )) return false;
96 if ( !m_minPtVec.empty() && !select_min<float>( t.eta(), m_etaBins, t.pt(), m_minPtVec.value() )) return false;
97 if ( !m_maxZ0Vec.empty() && !select_max<float>( t.eta(), m_etaBins, std::fabs(t.z0()), m_maxZ0Vec.value() )) return false;
98 if ( !m_maxD0Vec.empty() && !select_max<float>( t.eta(), m_etaBins, std::fabs(t.d0()), m_maxD0Vec.value() )) return false;
99
100 }
101
102 return true;
103}
104
#define ATH_CHECK
Evaluate an expression and check for errors.
bool select_min(const T &x, const std::vector< T > &xbins, const U &y, const std::vector< U > &ycuts)
do we really need these ?
bool select_max(const T &x, const std::vector< T > &xbins, const U &y, const std::vector< U > &ycuts)
emacs: this is -*- c++ -*-
#define y
#define x
virtual bool selectTrack(const TrackView &t) const override
GenericTrackSelector(const std::string &name)
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
FloatArrayProperty m_etaBins
how these vector cuts are handled needs to be tidied up - put in to some genertic templates
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
TrackSelector(const std::string &name)
the functions in find_bin are not nice and need to be tidied up
ToolHandle< InDet::IInDetTrackSelectionTool > m_offlineTool
virtual bool selectTrack(const TrackView &t) const override
just take the baseclass version ... virtual std::vector<TrackView> selectTracks( const std::vector<Tr...
forward declaration required for function prototype
Definition TrackView.h:43
emacs: this is -*- c++ -*-
size_t find_bin(const std::vector< T > &v, const U &x)
Definition find_bin.h:24
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Electron_v1 Electron
Definition of the current "egamma version".
Definition Electron.h:17