ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
TrigVSI::VtxMap< WrkVrt, Cord >::Cell Class Reference

The class of a cell in 3D histogram. More...

#include <VtxMap.h>

Inheritance diagram for TrigVSI::VtxMap< WrkVrt, Cord >::Cell:
Collaboration diagram for TrigVSI::VtxMap< WrkVrt, Cord >::Cell:

Public Member Functions

 Cell (size_t id, KDPoint< double, 3 > p, std::vector< const WrkVrt * > &v)
 Constructor. More...
 
 Cell (size_t id, KDPoint< double, 3 > p, std::vector< const WrkVrt * > &&v)
 
 Cell (size_t id, KDPoint< double, 3 > p, const WrkVrt *vtx_ptr)
 
 Cell (size_t id, KDPoint< double, 3 > p)
 
 Cell ()
 
int getId ()
 
KDPoint< double, 3 > getPosPoint ()
 Return center position as a KDPoint in specified coordinate. More...
 
TVector3 getPosVect () const
 Return center position in TVector3. More...
 
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
 

Private Attributes

int m_id = -1
 
KDPoint< double, 3 > m_pos
 

Detailed Description

template<typename WrkVrt, typename Cord>
class TrigVSI::VtxMap< WrkVrt, Cord >::Cell

The class of a cell in 3D histogram.

Basically a vertex pack with cell id and position.

Definition at line 60 of file VtxMap.h.

Constructor & Destructor Documentation

◆ Cell() [1/5]

template<typename WrkVrt , typename Cord >
TrigVSI::VtxMap< WrkVrt, Cord >::Cell::Cell ( size_t  id,
KDPoint< double, 3 >  p,
std::vector< const WrkVrt * > &  v 
)
inline

Constructor.

Parameters
[in]idIndex of the cell. Usually equivalent to ibin.
[in]pCenter point of the cell.
[in]vList of vertices inside this cell.

ID and point can't be configured after construction.

Definition at line 70 of file VtxMap.h.

70 : VtxPack<WrkVrt>(v), m_id(id), m_pos(p) {};

◆ Cell() [2/5]

template<typename WrkVrt , typename Cord >
TrigVSI::VtxMap< WrkVrt, Cord >::Cell::Cell ( size_t  id,
KDPoint< double, 3 >  p,
std::vector< const WrkVrt * > &&  v 
)
inline

Definition at line 71 of file VtxMap.h.

71 : VtxPack<WrkVrt>(v), m_id(id), m_pos(p) {};

◆ Cell() [3/5]

template<typename WrkVrt , typename Cord >
TrigVSI::VtxMap< WrkVrt, Cord >::Cell::Cell ( size_t  id,
KDPoint< double, 3 >  p,
const WrkVrt *  vtx_ptr 
)
inline

Definition at line 72 of file VtxMap.h.

72 : VtxPack<WrkVrt>( std::vector<const WrkVrt*>{vtx_ptr} ), m_id(id), m_pos(p) {};

◆ Cell() [4/5]

template<typename WrkVrt , typename Cord >
TrigVSI::VtxMap< WrkVrt, Cord >::Cell::Cell ( size_t  id,
KDPoint< double, 3 >  p 
)
inline

Definition at line 73 of file VtxMap.h.

73 : m_id(id), m_pos(p) {};

◆ Cell() [5/5]

template<typename WrkVrt , typename Cord >
TrigVSI::VtxMap< WrkVrt, Cord >::Cell::Cell ( )
inline

Definition at line 74 of file VtxMap.h.

74 {};

Member Function Documentation

◆ checkUpdate()

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

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)
inlineinherited

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  };

◆ getId()

template<typename WrkVrt , typename Cord >
int TrigVSI::VtxMap< WrkVrt, Cord >::Cell::getId ( )
inline

Definition at line 76 of file VtxMap.h.

76 { return m_id; };

◆ getIncompIndices()

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

Return copy of incompatible track pair list.

Definition at line 80 of file IWrkVrt.h.

80 { checkUpdate(); return m_incompIndices; };

◆ getPosPoint()

template<typename WrkVrt , typename Cord >
KDPoint<double, 3> TrigVSI::VtxMap< WrkVrt, Cord >::Cell::getPosPoint ( )
inline

Return center position as a KDPoint in specified coordinate.

Definition at line 79 of file VtxMap.h.

79 { m_pos.setWeight(this->getWeight()); return m_pos; };

◆ getPosVect()

template<typename WrkVrt , typename Cord >
TVector3 TrigVSI::VtxMap< WrkVrt, Cord >::Cell::getPosVect ( ) const
inline

Return center position in TVector3.

Definition at line 82 of file VtxMap.h.

82 { return Cord::X123toXYZ(m_pos); };

◆ getSelectedTrackIndices()

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

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)
inlineinherited

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 ( )
inlineinherited

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 ( )
inlineinherited

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 ( )
inlineinherited

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 ( )
inlineinherited

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 ( )
inlineinherited

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
inherited

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 ( )
inlineinherited

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
protectedinherited

Definition at line 102 of file IWrkVrt.h.

◆ m_id

template<typename WrkVrt , typename Cord >
int TrigVSI::VtxMap< WrkVrt, Cord >::Cell::m_id = -1
private

Definition at line 85 of file VtxMap.h.

◆ m_incompIndices

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

Definition at line 103 of file IWrkVrt.h.

◆ m_isUpToDate

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

Definition at line 99 of file IWrkVrt.h.

◆ m_pos

template<typename WrkVrt , typename Cord >
KDPoint<double, 3> TrigVSI::VtxMap< WrkVrt, Cord >::Cell::m_pos
private

Definition at line 86 of file VtxMap.h.

◆ m_selTrkIndices

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

Definition at line 101 of file IWrkVrt.h.

◆ m_vtxLists

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

Definition at line 100 of file IWrkVrt.h.


The documentation for this class was generated from the following file:
TrigVSI::VtxMap::Cell::m_id
int m_id
Definition: VtxMap.h:85
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
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
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
TrigVSI::VtxPack::getWeight
double getWeight()
Return the weight of the container.
Definition: IWrkVrt.h:93
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::KDPoint::setWeight
void setWeight(double w)
Set the weight to given value.
Definition: KDPoint.h:133
TrigVSI::VtxPack::m_vtxLists
std::vector< const WrkVrt * > m_vtxLists
Definition: IWrkVrt.h:100
python.PyAthena.v
v
Definition: PyAthena.py:157
TrigVSI::VtxMap::Cell::m_pos
KDPoint< double, 3 > m_pos
Definition: VtxMap.h:86
TrigVSI::VtxPack::updateLists
void updateLists()
Update set of tracks and incompatible track pair list.
Definition: IWrkVrt.h:117