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

Stores the result of vertex clustering performed in VtxMap. More...

#include <VtxMap.h>

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

Public Member Functions

 CellCluster (std::vector< Cell * > &&v)
 Constructor. More...
 
void emplace_back (const WrkVrt *)=delete
 Vertex cannot be added after initialization. More...
 
size_t nCells () const
 
CellgetPoint (size_t ipt) const
 
size_t nPoints () const
 
std::vector< Cell * > & Points ()
 
const std::vector< Cell * > & getPoints () const
 
void updateLists ()
 Update set of tracks and incompatible track pair list. More...
 
Accessors

Return copy of selected track indices list.

std::unordered_set< size_t > getSelectedTrackIndices ()
 
const std::unordered_set< size_t > & selectedTrackIndices ()
 Return reference to selected track indices list. More...
 
std::vector< std::pair< size_t, size_t > > getIncompIndices ()
 Return copy of incompatible track pair list. More...
 
const std::vector< std::pair< size_t, size_t > > & incompIndices ()
 Return reference to incompatible track pair list. More...
 
std::vector< const WrkVrt * > getVtxList ()
 Return a copy of vertex list. More...
 
const std::vector< const WrkVrt * > & vtxList ()
 Return a reference to vertex list. More...
 
const WrkVrt * getVtx (size_t ivtx)
 Return a copy of i-th vertex. More...
 
size_t nVtx ()
 Return the number of vertices. More...
 
double getWeight ()
 Return the weight of the container. More...
 
Position in specific coordinate
double x1 () const
 
double x2 () const
 
double x3 () const
 
KDPoint< double, 3 > PosCoord () const
 
Position in cartesian coordinate
double x () const
 
double y () const
 
double z () const
 
TVector3 PosVect () const
 
Accessors

Return copy of selected track indices list.

std::unordered_set< size_t > getSelectedTrackIndices ()
 
const std::unordered_set< size_t > & selectedTrackIndices ()
 Return reference to selected track indices list. More...
 
std::vector< std::pair< size_t, size_t > > getIncompIndices ()
 Return copy of incompatible track pair list. More...
 
const std::vector< std::pair< size_t, size_t > > & incompIndices ()
 Return reference to incompatible track pair list. More...
 
std::vector< const WrkVrt * > getVtxList ()
 Return a copy of vertex list. More...
 
const std::vector< const WrkVrt * > & vtxList ()
 Return a reference to vertex list. More...
 
const WrkVrt * getVtx (size_t ivtx)
 Return a copy of i-th vertex. More...
 
size_t nVtx ()
 Return the number of vertices. More...
 
double getWeight ()
 Return the weight of the container. More...
 
Accessors

Return copy of selected track indices list.

std::unordered_set< size_t > getSelectedTrackIndices ()
 
const std::unordered_set< size_t > & selectedTrackIndices ()
 Return reference to selected track indices list. More...
 
std::vector< std::pair< size_t, size_t > > getIncompIndices ()
 Return copy of incompatible track pair list. More...
 
const std::vector< std::pair< size_t, size_t > > & incompIndices ()
 Return reference to incompatible track pair list. More...
 
std::vector< const WrkVrt * > getVtxList ()
 Return a copy of vertex list. More...
 
const std::vector< const WrkVrt * > & vtxList ()
 Return a reference to vertex list. More...
 
const WrkVrt * getVtx (size_t ivtx)
 Return a copy of i-th vertex. More...
 
size_t nVtx ()
 Return the number of vertices. More...
 
double getWeight ()
 Return the weight of the container. More...
 

Protected Member Functions

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

Protected Attributes

std::vector< Cell * > m_points
 
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

KDPoint< double, 3 > m_posAvr
 
TVector3 m_posAvrVec
 

Detailed Description

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

Stores the result of vertex clustering performed in VtxMap.

The class of a cell cluster. Provides average position and other vertex pack related objects. Designed for readout usage.

Definition at line 97 of file VtxMap.h.

Constructor & Destructor Documentation

◆ CellCluster()

template<typename WrkVrt , typename Cord >
TrigVSI::VtxMap< WrkVrt, Cord >::CellCluster::CellCluster ( std::vector< Cell * > &&  v)
inline

Constructor.

Parameters
[in]vList of cells in the cluster.

Cells can't be added after construction.

Definition at line 105 of file VtxMap.h.

105  : Cluster<Cell*>(v)
106  {
107  size_t n_vtx = 0;
108  for ( auto& cell_ptr : v ) n_vtx += cell_ptr->nVtx();
109  std::vector<const WrkVrt*> tmp_vtx_cls;
110  tmp_vtx_cls.reserve(n_vtx);
111 
112  double w = 0.;
113  TVector3 tmp_vec(0.,0.,0.);
114  for ( auto& cell_ptr : v ) {
115  std::vector<const WrkVrt*> tmp_vtx_cell = cell_ptr->getVtxList();
116  tmp_vtx_cls.insert( tmp_vtx_cls.end(), tmp_vtx_cell.begin(), tmp_vtx_cell.end() );
117 
118  tmp_vec += cell_ptr->getWeight() * cell_ptr->getPosVect();
119  w += cell_ptr->getWeight();
120  }
121  this->m_vtxLists = std::move(tmp_vtx_cls);
122  this->updateLists();
123 
124  this->m_posAvrVec = (1. / w) * tmp_vec;
125  this->m_posAvr = Cord::XYZtoX123(this->m_posAvrVec);
126  this->m_posAvr.setWeight(w);
127  };

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 , typename Cord >
void TrigVSI::VtxMap< WrkVrt, Cord >::CellCluster::emplace_back ( const WrkVrt *  )
inlinedelete

Vertex cannot be added after initialization.

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

◆ getPoint()

Cell * TrigVSI::Cluster< Cell * >::getPoint ( size_t  ipt) const
inlineinherited

Definition at line 30 of file DBScan.h.

30 { return m_points[ipt]; };

◆ getPoints()

const std::vector<Cell * >& TrigVSI::Cluster< Cell * >::getPoints
inlineinherited

Definition at line 34 of file DBScan.h.

34 { return m_points; };

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

◆ nCells()

template<typename WrkVrt , typename Cord >
size_t TrigVSI::VtxMap< WrkVrt, Cord >::CellCluster::nCells ( ) const
inline

Definition at line 132 of file VtxMap.h.

132 { return this->nPoints(); };

◆ nPoints()

size_t TrigVSI::Cluster< Cell * >::nPoints
inlineinherited

Definition at line 31 of file DBScan.h.

31 { return m_points.size(); };

◆ 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(); };

◆ Points()

std::vector<Cell * >& TrigVSI::Cluster< Cell * >::Points
inlineinherited

Definition at line 33 of file DBScan.h.

33 { return m_points; };

◆ PosCoord()

template<typename WrkVrt , typename Cord >
KDPoint<double,3> TrigVSI::VtxMap< WrkVrt, Cord >::CellCluster::PosCoord ( ) const
inline

Definition at line 139 of file VtxMap.h.

139 { return m_posAvr; };

◆ PosVect()

template<typename WrkVrt , typename Cord >
TVector3 TrigVSI::VtxMap< WrkVrt, Cord >::CellCluster::PosVect ( ) const
inline

Definition at line 147 of file VtxMap.h.

147 { return m_posAvrVec; };

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

◆ x()

template<typename WrkVrt , typename Cord >
double TrigVSI::VtxMap< WrkVrt, Cord >::CellCluster::x ( ) const
inline

Definition at line 144 of file VtxMap.h.

144 { return m_posAvrVec.x(); };

◆ x1()

template<typename WrkVrt , typename Cord >
double TrigVSI::VtxMap< WrkVrt, Cord >::CellCluster::x1 ( ) const
inline

Definition at line 136 of file VtxMap.h.

136 { return m_posAvr.at(0); };

◆ x2()

template<typename WrkVrt , typename Cord >
double TrigVSI::VtxMap< WrkVrt, Cord >::CellCluster::x2 ( ) const
inline

Definition at line 137 of file VtxMap.h.

137 { return m_posAvr.at(1); };

◆ x3()

template<typename WrkVrt , typename Cord >
double TrigVSI::VtxMap< WrkVrt, Cord >::CellCluster::x3 ( ) const
inline

Definition at line 138 of file VtxMap.h.

138 { return m_posAvr.at(2); };

◆ y()

template<typename WrkVrt , typename Cord >
double TrigVSI::VtxMap< WrkVrt, Cord >::CellCluster::y ( ) const
inline

Definition at line 145 of file VtxMap.h.

145 { return m_posAvrVec.y(); };

◆ z()

template<typename WrkVrt , typename Cord >
double TrigVSI::VtxMap< WrkVrt, Cord >::CellCluster::z ( ) const
inline

Definition at line 146 of file VtxMap.h.

146 { return m_posAvrVec.z(); };

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_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_points

std::vector<Cell * > TrigVSI::Cluster< Cell * >::m_points
protectedinherited

Definition at line 37 of file DBScan.h.

◆ m_posAvr

template<typename WrkVrt , typename Cord >
KDPoint<double, 3> TrigVSI::VtxMap< WrkVrt, Cord >::CellCluster::m_posAvr
private

Definition at line 151 of file VtxMap.h.

◆ m_posAvrVec

template<typename WrkVrt , typename Cord >
TVector3 TrigVSI::VtxMap< WrkVrt, Cord >::CellCluster::m_posAvrVec
private

Definition at line 152 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::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::KDPoint::at
T at(size_t i) const
Return i-th element. If given i exceeds the size, return NaN.
Definition: KDPoint.h:128
TrigVSI::Cluster< Cell * >::nPoints
size_t nPoints() const
Definition: DBScan.h:31
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::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:154
TrigVSI::Cluster< Cell * >::m_points
std::vector< Cell * > m_points
Definition: DBScan.h:34
TrigVSI::VtxMap::CellCluster::m_posAvr
KDPoint< double, 3 > m_posAvr
Definition: VtxMap.h:147
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
TrigVSI::VtxPack::updateLists
void updateLists()
Update set of tracks and incompatible track pair list.
Definition: IWrkVrt.h:117
TrigVSI::VtxMap::CellCluster::m_posAvrVec
TVector3 m_posAvrVec
Definition: VtxMap.h:152