File indexing completed on 2025-12-17 09:20:44
0001 #include "PHG4ParticleSvtxMap_v1.h"
0002
0003 PHG4ParticleSvtxMap_v1::PHG4ParticleSvtxMap_v1()
0004 : m_map()
0005 {
0006 }
0007
0008 PHG4ParticleSvtxMap_v1::PHG4ParticleSvtxMap_v1(const PHG4ParticleSvtxMap_v1& map)
0009 : m_map()
0010 {
0011 m_processed = map.processed();
0012 for (const auto& iter : map)
0013 {
0014 WeightedRecoTrackMap trackmap = iter.second;
0015 m_map.insert(std::make_pair(iter.first, trackmap));
0016 }
0017 }
0018
0019 PHG4ParticleSvtxMap_v1& PHG4ParticleSvtxMap_v1::operator=(const PHG4ParticleSvtxMap_v1& map)
0020 {
0021 Reset();
0022
0023 for (const auto& iter : map)
0024 {
0025 m_map.insert(std::make_pair(iter.first, iter.second));
0026 }
0027
0028 return *this;
0029 }
0030
0031 PHG4ParticleSvtxMap_v1::~PHG4ParticleSvtxMap_v1()
0032 {
0033 Reset();
0034 }
0035
0036 void PHG4ParticleSvtxMap_v1::identify(std::ostream& os) const
0037 {
0038 os << "PHG4ParticleSvtxMap_v1 size = " << m_map.size() << std::endl;
0039
0040 for (const auto& [g4id, matchedRecoTracks] : m_map)
0041 {
0042 os << "G4Particle " << g4id << " has matched reco tracks " << std::endl;
0043 for (const auto& [weight, trackset] : matchedRecoTracks)
0044 {
0045 os << " weight " << weight << " has reco tracks " << std::endl;
0046 for (const auto& track : trackset)
0047 {
0048 os << " trackid : " << track << std::endl;
0049 }
0050 }
0051 }
0052 }
0053
0054 PHG4ParticleSvtxMap::WeightedRecoTrackMap PHG4ParticleSvtxMap_v1::insert(const int key, const PHG4ParticleSvtxMap::WeightedRecoTrackMap map)
0055 {
0056 m_map.insert(std::make_pair(key, map));
0057 return map;
0058 }
0059
0060 const PHG4ParticleSvtxMap::WeightedRecoTrackMap& PHG4ParticleSvtxMap_v1::get(const int key) const
0061 {
0062 const auto iter = m_map.find(key);
0063 if (iter == m_map.end())
0064 {
0065 return PHG4ParticleSvtxMap::get(key);
0066 }
0067 else
0068 {
0069 return iter->second;
0070 }
0071 }