Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:21:43

0001 /*!
0002  * \file DSTTrackInfoReader.cc
0003  * \author Alex Patton <aopatton@mit.edu>
0004  */
0005 
0006 #include "DSTTrackInfoReader.h"
0007 
0008 #include <trackbase_historic/TrackInfoContainer.h>
0009 
0010 #include <fun4all/Fun4AllReturnCodes.h>
0011 
0012 #include <phool/PHCompositeNode.h>
0013 #include <phool/PHNodeIterator.h>
0014 #include <phool/getClass.h>
0015 
0016 
0017 //_____________________________________________________________________
0018 
0019 //_____________________________________________________________________
0020 DSTTrackInfoReader::DSTTrackInfoReader(const std::string& name)
0021   : SubsysReco(name)
0022 {
0023 }
0024 
0025 //_____________________________________________________________________
0026 int DSTTrackInfoReader::InitRun(PHCompositeNode* topNode)
0027 {
0028   // make a clusterContainer node and a trackmap node
0029   // assume writing macro removed them
0030   //  evalNode->addNode(newNode);
0031 
0032   // auto newNode = new PHIODataNode<PHObject>( new DSTContainerv3, "DSTContainer","PHObject");
0033   // evalNode->addNode(newNode);
0034 
0035   // TrackInfo container
0036   m_track_info_container = findNode::getClass<TrackInfoContainer>(topNode, "TrackInfoContainer");
0037 
0038   // m_container = findNode::getClass<DSTContainer>(topNode, "DSTContainer");
0039 
0040   // svtxtrackmap constructer is protected
0041   // auto svtxNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "SVTX"));
0042   // auto newNode = new PHIODataNode<PHObject>( new SvtxTrackMap, "SvtxTrackMap_2","PHObject");
0043   // svtxNode->addNode(newNode);
0044 
0045   return Fun4AllReturnCodes::EVENT_OK;
0046 }
0047 
0048 //_____________________________________________________________________
0049 int DSTTrackInfoReader::process_event(PHCompositeNode* topNode)
0050 {
0051   // Init(topNode);
0052   //  load nodes
0053   auto res = load_nodes(topNode);
0054   // std::cout <<"This is before I fill cluster map" << std::endl;
0055   // m_cluster_map->identify();
0056   if (res != Fun4AllReturnCodes::EVENT_OK)
0057   {
0058     return res;
0059   }
0060   evaluate_track_info();
0061 
0062   m_track_info_container->Reset();
0063 
0064   return Fun4AllReturnCodes::EVENT_OK;
0065 }
0066 
0067 //_____________________________________________________________________
0068 int DSTTrackInfoReader::load_nodes(PHCompositeNode* topNode)
0069 {
0070   // get necessary nodes
0071   // m_track_map = findNode::getClass<SvtxTrackMap>(topNode, "SvtxTrackMap");
0072 
0073   m_track_info_container = findNode::getClass<TrackInfoContainer>(topNode, "TrackInfoContainer");
0074 
0075   return Fun4AllReturnCodes::EVENT_OK;
0076 }
0077 
0078 void DSTTrackInfoReader::evaluate_track_info()
0079 {
0080   if (Verbosity() > 1)
0081   {
0082     for (int iTrk = 0; iTrk < (int) m_track_info_container->size(); iTrk++)
0083     {
0084       std::cout << "size: " << m_track_info_container->size() << std::endl;
0085       std::cout << "hitbitmap: " << (m_track_info_container->get_trackinfo(iTrk))->get_hitbitmap() << std::endl;
0086       std::cout << "crossing: " << (m_track_info_container->get_trackinfo(iTrk))->get_crossing() << std::endl;
0087       std::cout << "chi^2: " << (m_track_info_container->get_trackinfo(iTrk))->get_chisq() << std::endl;
0088       std::cout << "NDF: " << unsigned((m_track_info_container->get_trackinfo(iTrk))->get_ndf()) << std::endl;
0089     }
0090   }
0091 }