Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:20:44

0001 #include "SvtxPHG4ParticleMap_v1.h"
0002 
0003 SvtxPHG4ParticleMap_v1::SvtxPHG4ParticleMap_v1()
0004   : m_map()
0005 {
0006 }
0007 
0008 SvtxPHG4ParticleMap_v1::SvtxPHG4ParticleMap_v1(const SvtxPHG4ParticleMap_v1& map)
0009   : m_map()
0010 {
0011   m_processed = map.processed();
0012   for (const auto& iter : map)
0013   {
0014     WeightedTruthTrackMap trackmap = iter.second;
0015     m_map.insert(std::make_pair(iter.first, trackmap));
0016   }
0017 }
0018 
0019 SvtxPHG4ParticleMap_v1& SvtxPHG4ParticleMap_v1::operator=(const SvtxPHG4ParticleMap_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 SvtxPHG4ParticleMap_v1::~SvtxPHG4ParticleMap_v1()
0032 {
0033   Reset();
0034 }
0035 
0036 void SvtxPHG4ParticleMap_v1::identify(std::ostream& os) const
0037 {
0038   os << "SvtxPHG4ParticleMap_v1 size = " << m_map.size() << std::endl;
0039 
0040   for (const auto& [trackID, matchedTruthTracks] : m_map)
0041   {
0042     os << "Reco track " << trackID << " has matched truth tracks " << std::endl;
0043     for (const auto& [weight, partset] : matchedTruthTracks)
0044     {
0045       os << "  weight " << weight << " has truth tracks " << std::endl;
0046       for (const auto& g4part : partset)
0047       {
0048         os << "    g4id : " << g4part << std::endl;
0049       }
0050     }
0051   }
0052 }
0053 
0054 SvtxPHG4ParticleMap::WeightedTruthTrackMap SvtxPHG4ParticleMap_v1::insert(const unsigned int key, const SvtxPHG4ParticleMap::WeightedTruthTrackMap map)
0055 {
0056   m_map.insert(std::make_pair(key, map));
0057   return map;
0058 }
0059 
0060 const SvtxPHG4ParticleMap::WeightedTruthTrackMap& SvtxPHG4ParticleMap_v1::get(const unsigned int key) const
0061 {
0062   const auto iter = m_map.find(key);
0063   if (iter == m_map.end())
0064   {
0065     return SvtxPHG4ParticleMap::get(key);
0066   }
0067   else
0068   {
0069     return iter->second;
0070   }
0071 }