ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TrigVSI::VtxPack< WrkVrt > Class Template Reference

Base class of local vertex container in VtxMap. More...

#include <IWrkVrt.h>

Inheritance diagram for TrigVSI::VtxPack< WrkVrt >:
Collaboration diagram for TrigVSI::VtxPack< WrkVrt >:

Public Member Functions

 VtxPack (std::vector< const WrkVrt * > &v)
 Constructor. More...
 
 VtxPack (std::vector< const WrkVrt * > &&v)
 
 VtxPack ()
 
void emplace_back (const WrkVrt *vtx_ptr)
 Emplace vertex pointer to vertex list. More...
 
void updateLists ()
 Update set of tracks and incompatible track pair list. More...
 

Protected Member Functions

void checkUpdate ()
 Check if lists are up to date. If not, update them. More...
 

Protected Attributes

bool m_isUpToDate = false
 
std::vector< const WrkVrt * > m_vtxLists
 
std::unordered_set< size_t > m_selTrkIndices
 
std::unordered_set< std::pair< size_t, size_t >, PairHash< size_t, size_t > > m_compIndices
 
std::vector< std::pair< size_t, size_t > > m_incompIndices
 

Detailed Description

template<typename WrkVrt>
class TrigVSI::VtxPack< WrkVrt >

Base class of local vertex container in VtxMap.

Keep pointers to vertices inside. Automatically generates combined set of all associated tracks and list of incompatible track pairs. typename WrkVrt should be classes derived from IWrkVtx.

Definition at line 56 of file IWrkVrt.h.

Constructor & Destructor Documentation

◆ VtxPack() [1/3]

template<typename WrkVrt >
TrigVSI::VtxPack< WrkVrt >::VtxPack ( std::vector< const WrkVrt * > &  v)
inline

Constructor.

Parameters
[in]vList of pointers to vertex.

Definition at line 62 of file IWrkVrt.h.

62 : m_vtxLists(v) {};

◆ VtxPack() [2/3]

template<typename WrkVrt >
TrigVSI::VtxPack< WrkVrt >::VtxPack ( std::vector< const WrkVrt * > &&  v)
inline

Definition at line 63 of file IWrkVrt.h.

63 : m_vtxLists(std::move(v)) {};

◆ VtxPack() [3/3]

template<typename WrkVrt >
TrigVSI::VtxPack< WrkVrt >::VtxPack ( )
inline

Definition at line 64 of file IWrkVrt.h.

64 {};

Member Function Documentation

◆ checkUpdate()

template<typename WrkVrt >
void TrigVSI::VtxPack< WrkVrt >::checkUpdate ( )
inlineprotected

Check if lists are up to date. If not, update them.

Definition at line 106 of file IWrkVrt.h.

106 { if( !m_isUpToDate ) updateLists(); return; };

◆ emplace_back()

template<typename WrkVrt >
void TrigVSI::VtxPack< WrkVrt >::emplace_back ( const WrkVrt *  vtx_ptr)
inline

Emplace vertex pointer to vertex list.

Definition at line 67 of file IWrkVrt.h.

68  {
69  m_isUpToDate = false;
70  m_vtxLists.emplace_back(vtx_ptr);
71  };

◆ getIncompIndices()

template<typename WrkVrt >
std::vector<std::pair<size_t, size_t> > TrigVSI::VtxPack< WrkVrt >::getIncompIndices ( )
inline

Return copy of incompatible track pair list.

Definition at line 80 of file IWrkVrt.h.

80 { checkUpdate(); return m_incompIndices; };

◆ getSelectedTrackIndices()

template<typename WrkVrt >
std::unordered_set<size_t> TrigVSI::VtxPack< WrkVrt >::getSelectedTrackIndices ( )
inline

Definition at line 76 of file IWrkVrt.h.

76 { checkUpdate(); return m_selTrkIndices; };

◆ getVtx()

template<typename WrkVrt >
const WrkVrt* TrigVSI::VtxPack< WrkVrt >::getVtx ( size_t  ivtx)
inline

Return a copy of i-th vertex.

Definition at line 89 of file IWrkVrt.h.

89 { checkUpdate(); return m_vtxLists[ivtx]; };

◆ getVtxList()

template<typename WrkVrt >
std::vector<const WrkVrt*> TrigVSI::VtxPack< WrkVrt >::getVtxList ( )
inline

Return a copy of vertex list.

Definition at line 85 of file IWrkVrt.h.

85 { checkUpdate(); return m_vtxLists; };

◆ getWeight()

template<typename WrkVrt >
double TrigVSI::VtxPack< WrkVrt >::getWeight ( )
inline

Return the weight of the container.

Definition at line 93 of file IWrkVrt.h.

93 { checkUpdate(); return static_cast<double>(m_vtxLists.size()); };

◆ incompIndices()

template<typename WrkVrt >
const std::vector<std::pair<size_t, size_t> >& TrigVSI::VtxPack< WrkVrt >::incompIndices ( )
inline

Return reference to incompatible track pair list.

Definition at line 82 of file IWrkVrt.h.

82 { checkUpdate(); return m_incompIndices; };

◆ nVtx()

template<typename WrkVrt >
size_t TrigVSI::VtxPack< WrkVrt >::nVtx ( )
inline

Return the number of vertices.

Definition at line 91 of file IWrkVrt.h.

91 { checkUpdate(); return m_vtxLists.size(); };

◆ selectedTrackIndices()

template<typename WrkVrt >
const std::unordered_set<size_t>& TrigVSI::VtxPack< WrkVrt >::selectedTrackIndices ( )
inline

Return reference to selected track indices list.

Definition at line 78 of file IWrkVrt.h.

78 { checkUpdate(); return m_selTrkIndices; };

◆ updateLists()

template<typename WrkVrt >
void TrigVSI::VtxPack< WrkVrt >::updateLists

Update set of tracks and incompatible track pair list.

Everytime accessors are called, this function will be called automatically if lists are not up to date. Also can be called explicitly.

Definition at line 117 of file IWrkVrt.h.

118 {
119  // Update Selected Track list
120  m_selTrkIndices.clear();
121  m_compIndices.clear();
122  for (const WrkVrt* vrt : m_vtxLists) {
123  m_selTrkIndices.emplace( vrt->selectedTrackIndices().at(0) );
124  m_selTrkIndices.emplace( vrt->selectedTrackIndices().at(1) );
125  std::pair<size_t, size_t> p_tmp_ = std::minmax( vrt->selectedTrackIndices().at(0),vrt->selectedTrackIndices().at(1) );
126  m_compIndices.emplace( std::move(p_tmp_) );
127  }
128 
129  // Update incompatible track pair lists
130  m_incompIndices.clear();
131  for ( auto i_itr = m_selTrkIndices.begin(); i_itr != m_selTrkIndices.end(); ++i_itr ) {
132  for ( auto j_itr = std::next(i_itr); j_itr != m_selTrkIndices.end(); ++j_itr ) {
133  std::pair<size_t, size_t> p_tmp_ = std::minmax(*i_itr,*j_itr);
134  auto tmp_itr = std::find(m_compIndices.begin(), m_compIndices.end(), p_tmp_ );
135  if ( tmp_itr != m_compIndices.end() ) continue; // When the pair found in compatible pair list, skip and continue loop
136  m_incompIndices.emplace_back( std::make_pair(*i_itr, *j_itr) );
137  }
138  }
139  //
140  m_isUpToDate = true; // Set up to date flag true
141 }

◆ vtxList()

template<typename WrkVrt >
const std::vector<const WrkVrt*>& TrigVSI::VtxPack< WrkVrt >::vtxList ( )
inline

Return a reference to vertex list.

Definition at line 87 of file IWrkVrt.h.

87 { checkUpdate(); return m_vtxLists; };

Member Data Documentation

◆ m_compIndices

template<typename WrkVrt >
std::unordered_set<std::pair<size_t, size_t>, PairHash<size_t,size_t> > TrigVSI::VtxPack< WrkVrt >::m_compIndices
protected

Definition at line 102 of file IWrkVrt.h.

◆ m_incompIndices

template<typename WrkVrt >
std::vector<std::pair<size_t, size_t> > TrigVSI::VtxPack< WrkVrt >::m_incompIndices
protected

Definition at line 103 of file IWrkVrt.h.

◆ m_isUpToDate

template<typename WrkVrt >
bool TrigVSI::VtxPack< WrkVrt >::m_isUpToDate = false
protected

Definition at line 99 of file IWrkVrt.h.

◆ m_selTrkIndices

template<typename WrkVrt >
std::unordered_set<size_t> TrigVSI::VtxPack< WrkVrt >::m_selTrkIndices
protected

Definition at line 101 of file IWrkVrt.h.

◆ m_vtxLists

template<typename WrkVrt >
std::vector<const WrkVrt*> TrigVSI::VtxPack< WrkVrt >::m_vtxLists
protected

Definition at line 100 of file IWrkVrt.h.


The documentation for this class was generated from the following file:
TrigVSI::VtxPack::m_selTrkIndices
std::unordered_set< size_t > m_selTrkIndices
Definition: IWrkVrt.h:101
TrigVSI::VtxPack::m_isUpToDate
bool m_isUpToDate
Definition: IWrkVrt.h:99
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
TrigVSI::VtxPack::m_incompIndices
std::vector< std::pair< size_t, size_t > > m_incompIndices
Definition: IWrkVrt.h:103
TrigVSI::VtxPack::m_compIndices
std::unordered_set< std::pair< size_t, size_t >, PairHash< size_t, size_t > > m_compIndices
Definition: IWrkVrt.h:102
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
TrigVSI::VtxPack::checkUpdate
void checkUpdate()
Check if lists are up to date. If not, update them.
Definition: IWrkVrt.h:106
TrigVSI::VtxPack::m_vtxLists
std::vector< const WrkVrt * > m_vtxLists
Definition: IWrkVrt.h:100
python.PyAthena.v
v
Definition: PyAthena.py:157
TrigVSI::VtxPack::updateLists
void updateLists()
Update set of tracks and incompatible track pair list.
Definition: IWrkVrt.h:117