Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 
0002 #include "SvtxTrackStateRemoval.h"
0003 
0004 #include <fun4all/Fun4AllReturnCodes.h>
0005 #include <phool/PHCompositeNode.h>
0006 #include <phool/PHDataNode.h>
0007 #include <phool/PHNode.h>
0008 #include <phool/PHNodeIterator.h>
0009 #include <phool/PHObject.h>
0010 #include <phool/PHTimer.h>
0011 #include <phool/getClass.h>
0012 #include <phool/phool.h>
0013 
0014 #include <g4detectors/PHG4CylinderGeom.h>
0015 #include <g4detectors/PHG4CylinderGeomContainer.h>
0016 
0017 #include <trackbase_historic/SvtxTrack.h>
0018 #include <trackbase_historic/SvtxTrackMap.h>
0019 #include <trackbase_historic/SvtxTrackState.h>
0020 
0021 //____________________________________________________________________________..
0022 SvtxTrackStateRemoval::SvtxTrackStateRemoval(const std::string& name)
0023   : SubsysReco(name)
0024 {
0025 }
0026 
0027 //____________________________________________________________________________..
0028 SvtxTrackStateRemoval::~SvtxTrackStateRemoval()
0029 {
0030 }
0031 
0032 //____________________________________________________________________________..
0033 int SvtxTrackStateRemoval::Init(PHCompositeNode*)
0034 {
0035   return Fun4AllReturnCodes::EVENT_OK;
0036 }
0037 
0038 //____________________________________________________________________________..
0039 int SvtxTrackStateRemoval::InitRun(PHCompositeNode*)
0040 {
0041   return Fun4AllReturnCodes::EVENT_OK;
0042 }
0043 
0044 //____________________________________________________________________________..
0045 int SvtxTrackStateRemoval::process_event(PHCompositeNode* topNode)
0046 {
0047   auto trackmap = findNode::getClass<SvtxTrackMap>(topNode, "SvtxTrackMap");
0048   if (!trackmap)
0049   {
0050     std::cout << PHWHERE << "No track map on node tree, can't continue."
0051               << std::endl;
0052     return Fun4AllReturnCodes::ABORTEVENT;
0053   }
0054 
0055   auto tpotgeom = findNode::getClass<PHG4CylinderGeomContainer>(topNode, "CYLINDERGEOM_MICROMEGAS_FULL");
0056   if (!tpotgeom)
0057   {
0058     std::cout << PHWHERE << "No micromegas geometry, can't continue."
0059               << std::endl;
0060     return Fun4AllReturnCodes::ABORTEVENT;
0061   }
0062 
0063   /// get the last tracking layer
0064   auto layergeom = tpotgeom->GetLayerGeom(56);
0065 
0066   const float lastradius = layergeom->get_radius();
0067   const float lastthickness = layergeom->get_thickness();
0068   const float lasttrackingradius = lastradius + lastthickness / 2.;
0069 
0070   for (auto& [key, track] : *trackmap)
0071   {
0072     for (auto iter = track->begin_states(); iter != track->end_states(); ++iter)
0073     {
0074       /// Don't erase the PCA state information
0075       if (iter == track->begin_states())
0076       {
0077         continue;
0078       }
0079 
0080       float pathlength = iter->second->get_pathlength();
0081       if (pathlength < lasttrackingradius)
0082       {
0083         track->erase_state(pathlength);
0084       }
0085     }
0086 
0087     if (Verbosity() > 1)
0088     {
0089       track->identify();
0090     }
0091   }
0092 
0093   return Fun4AllReturnCodes::EVENT_OK;
0094 }
0095 
0096 //____________________________________________________________________________..
0097 int SvtxTrackStateRemoval::End(PHCompositeNode*)
0098 {
0099   return Fun4AllReturnCodes::EVENT_OK;
0100 }