Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #include "PHTrackFitting.h"
0002 
0003 #include <trackbase_historic/SvtxTrackMap.h>
0004 #include <globalvertex/SvtxVertexMap.h>
0005 
0006 #include <trackbase/TrkrClusterContainer.h>
0007 #include <trackbase/TrkrHitSet.h>
0008 #include <trackbase/TrkrHitSetContainer.h>
0009 #include <trackbase/TrkrDefs.h>
0010 
0011 #include <fun4all/Fun4AllReturnCodes.h>
0012 #include <fun4all/SubsysReco.h>                // for SubsysReco
0013 
0014 #include <phool/getClass.h>
0015 #include <phool/phool.h>                       // for PHWHERE
0016 
0017 #include <iostream>                            // for operator<<, basic_ostream
0018 
0019 using namespace std;
0020 
0021 PHTrackFitting::PHTrackFitting(const std::string& name)
0022   : SubsysReco(name)
0023   , _cluster_map(nullptr)
0024   , _hitsets(nullptr)
0025   , _vertex_map(nullptr)
0026   , _track_map(nullptr)
0027   , _track_map_name("SvtxTrackMap")
0028 {
0029 }
0030 
0031 int PHTrackFitting::Init(PHCompositeNode* /*topNode*/)
0032 {
0033   return Fun4AllReturnCodes::EVENT_OK;
0034 }
0035 
0036 int PHTrackFitting::InitRun(PHCompositeNode* topNode)
0037 {
0038   return Setup(topNode);
0039 }
0040 
0041 int PHTrackFitting::process_event(PHCompositeNode* /*topNode*/)
0042 {
0043   return Process();
0044 }
0045 
0046 int PHTrackFitting::Setup(PHCompositeNode* topNode)
0047 {
0048   int ret = GetNodes(topNode);
0049   if (ret != Fun4AllReturnCodes::EVENT_OK) return ret;
0050 
0051   return Fun4AllReturnCodes::EVENT_OK;
0052 }
0053 
0054 int PHTrackFitting::GetNodes(PHCompositeNode* topNode)
0055 {
0056   //---------------------------------
0057   // Get Objects off of the Node Tree
0058   //---------------------------------
0059 
0060   //_cluster_map = findNode::getClass<SvtxClusterMap>(topNode, "SvtxClusterMap");
0061   _cluster_map = findNode::getClass<TrkrClusterContainer>(topNode, "TRKR_CLUSTER");
0062   if (!_cluster_map)
0063   {
0064     cout << PHWHERE << " ERROR: Can't find node TRKR_CLUSTER" << endl;
0065     return Fun4AllReturnCodes::ABORTEVENT;
0066   }
0067   _hitsets = findNode::getClass<TrkrHitSetContainer>(topNode, "TRKR_HITSET");
0068   if(!_hitsets)
0069     {
0070       std::cout << PHWHERE << "No hitset container on node tree. Bailing."
0071         << std::endl;
0072       return Fun4AllReturnCodes::ABORTEVENT;
0073     }
0074 
0075   _vertex_map = findNode::getClass<SvtxVertexMap>(topNode, "SvtxVertexMap");
0076   if (!_vertex_map)
0077   {
0078     cout << PHWHERE << " ERROR: Can't find SvtxVertexMap." << endl;
0079     return Fun4AllReturnCodes::ABORTEVENT;
0080   }
0081 
0082   _track_map = findNode::getClass<SvtxTrackMap>(topNode, _track_map_name);
0083   if (!_track_map)
0084   {
0085     cout << PHWHERE << " ERROR: Can't find SvtxTrackMap." << endl;
0086     return Fun4AllReturnCodes::ABORTEVENT;
0087   }
0088 
0089   return Fun4AllReturnCodes::EVENT_OK;
0090 }