Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:19

0001 
0002 #include "TrackContainerCombiner.h"
0003 
0004 #include <fun4all/Fun4AllReturnCodes.h>
0005 
0006 #include <trackbase_historic/SvtxTrack.h>
0007 #include <trackbase_historic/SvtxTrackMap.h>
0008 #include <trackbase_historic/TrackSeed.h>
0009 #include <trackbase_historic/TrackSeedContainer.h>
0010 
0011 #include <phool/PHCompositeNode.h>
0012 #include <phool/PHIODataNode.h>
0013 #include <phool/PHNode.h>  // for PHNode
0014 #include <phool/PHNodeIterator.h>
0015 #include <phool/PHObject.h>  // for PHObject
0016 #include <phool/getClass.h>
0017 #include <phool/phool.h>
0018 
0019 //____________________________________________________________________________..
0020 TrackContainerCombiner::TrackContainerCombiner(const std::string& name)
0021   : SubsysReco(name)
0022 {
0023 }
0024 
0025 //____________________________________________________________________________..
0026 TrackContainerCombiner::~TrackContainerCombiner() = default;
0027 
0028 //____________________________________________________________________________..
0029 int TrackContainerCombiner::InitRun(PHCompositeNode* topNode)
0030 {
0031   int ret = getNodes(topNode);
0032   return ret;
0033 }
0034 
0035 //____________________________________________________________________________..
0036 int TrackContainerCombiner::process_event(PHCompositeNode* /*unused*/)
0037 {
0038   if (m_seedContainer)
0039   {
0040     if (Verbosity() > 1)
0041     {
0042       std::cout << "Seed container size to start " << m_newSeedContainer->size()
0043                 << std::endl;
0044     }
0045     mergeSeeds();
0046     if (Verbosity() > 1)
0047     {
0048       std::cout << "Seed container size to finish " << m_newSeedContainer->size()
0049                 << std::endl;
0050     }
0051   }
0052 
0053   return Fun4AllReturnCodes::EVENT_OK;
0054 }
0055 
0056 void TrackContainerCombiner::mergeSeeds()
0057 {
0058   for (const auto& seed : *m_oldSeedContainer)
0059   {
0060     if (!seed)
0061     {
0062       continue;
0063     }
0064     m_newSeedContainer->insert(seed);
0065   }
0066 }
0067 //____________________________________________________________________________..
0068 int TrackContainerCombiner::End(PHCompositeNode* /*unused*/)
0069 {
0070   return Fun4AllReturnCodes::EVENT_OK;
0071 }
0072 
0073 int TrackContainerCombiner::getNodes(PHCompositeNode* topNode)
0074 {
0075   m_newSeedContainer = findNode::getClass<TrackSeedContainer>(topNode, m_newContainerName);
0076   if (!m_newSeedContainer)
0077   {
0078     std::cout << PHWHERE << "No new track seed container, bailing" << std::endl;
0079     return Fun4AllReturnCodes::ABORTEVENT;
0080   }
0081   m_oldSeedContainer = findNode::getClass<TrackSeedContainer>(topNode, m_oldContainerName);
0082   if (!m_oldSeedContainer)
0083   {
0084     std::cout << PHWHERE << "No old track seed container, bailing" << std::endl;
0085     return Fun4AllReturnCodes::ABORTEVENT;
0086   }
0087 
0088   return Fun4AllReturnCodes::EVENT_OK;
0089 }