ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrkrClusterHitAssocv3.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrkrClusterHitAssocv3.cc
1 
9 #include "TrkrDefs.h"
10 
11 #include <ostream> // for operator<<, endl, basic_ostream, ostream, basic_o...
12 
13 namespace
14 {
16 }
17 
18 //_________________________________________________________________________
20 { m_map.clear(); }
21 
22 //_________________________________________________________________________
23 void TrkrClusterHitAssocv3::identify(std::ostream &os) const
24 {
25  std::multimap<TrkrDefs::cluskey, TrkrDefs::hitkey>::const_iterator iter;
26  os << "-----TrkrClusterHitAssocv3-----" << std::endl;
27  os << "Number of associations: " << size() << std::endl;
28  for( const auto& map_pair:m_map )
29  {
30  for( const auto& pair:map_pair.second )
31  {
32  os << "clus key " << pair.first << std::dec
33  << " layer " << (unsigned int) TrkrDefs::getLayer(pair.first)
34  << " hit key: " << pair.second << std::endl;
35  }
36  }
37  os << "------------------------------" << std::endl;
38 
39  return;
40 
41 }
42 
43 //_________________________________________________________________________
45 {
46  // get hitset key from cluster
48 
49  // find relevant association map, create one if not found
50  Map& clusterMap = m_map[hitsetkey];
51 
52  // insert association
53  clusterMap.insert(std::make_pair(ckey, hidx));
54 }
55 
56 //_________________________________________________________________________
58 {
59  // find relevant association map, create one if not found, and return adress
60  return &m_map[hitsetkey];
61 }
62 
63 //_________________________________________________________________________
65 {
66  // get hitset key from cluster
68 
69  // find relevant association map, create one if not found
70  const auto iter = m_map.find(hitsetkey);
71  if( iter != m_map.end() )
72  {
73  return std::make_pair( iter->second.lower_bound(ckey), iter->second.upper_bound(ckey) );
74  } else {
75  return std::make_pair( dummy_map.cbegin(), dummy_map.cend() );
76  }
77 }
78 
79 //_________________________________________________________________________
80 unsigned int TrkrClusterHitAssocv3::size(void) const
81 {
82  unsigned int size = 0;
83  for( const auto& map_pair:m_map )
84  { size += map_pair.second.size(); }
85 
86  return size;
87 }