Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:17:16

0001 #ifndef TRACKRECO_PHACTSTRACKPROJECTION_H
0002 #define TRACKRECO_PHACTSTRACKPROJECTION_H
0003 
0004 #include <fun4all/SubsysReco.h>
0005 #include <trackbase/TrkrDefs.h>
0006 #include <trackbase_historic/SvtxTrack.h>
0007 
0008 #include <trackbase/ActsGeometry.h>
0009 
0010 #include "ActsPropagator.h"
0011 
0012 #include <Acts/Definitions/Algebra.hpp>
0013 #include <Acts/EventData/TrackParameters.hpp>
0014 #include <Acts/Surfaces/CylinderSurface.hpp>
0015 #include <Acts/Utilities/Result.hpp>
0016 
0017 #include <ActsExamples/EventData/Trajectories.hpp>
0018 
0019 #include <map>
0020 
0021 class PHCompositeNode;
0022 class RawClusterContainer;
0023 class TowerInfoContainer;
0024 class RawTowerGeomContainer;
0025 class SvtxTrackMap;
0026 class SvtxTrack;
0027 class SvtxVertexMap;
0028 
0029 #include <map>
0030 #include <memory>
0031 #include <string>
0032 
0033 /**
0034  * This class takes final fitted tracks from the Acts track fitting
0035  * and projects them out to cylinders with radius at the same radius
0036  * as the three calorimeters. Cluster matching is performed with the
0037  * projections and the SvtxTrack object is updated.
0038  */
0039 
0040 class PHActsTrackProjection : public SubsysReco
0041 {
0042  public:
0043   using BoundTrackParam =
0044       const Acts::BoundTrackParameters;
0045   using SurfacePtr = std::shared_ptr<const Acts::Surface>;
0046   using Trajectory = ActsExamples::Trajectories;
0047   using BoundTrackParamResult = ActsPropagator::BTPPairResult;
0048 
0049   PHActsTrackProjection(const std::string &name = "PHActsTrackProjection");
0050 
0051   int Init(PHCompositeNode *topNode) override;
0052   int InitRun(PHCompositeNode *topNode) override;
0053   int process_event(PHCompositeNode *topNode) override;
0054   int End(PHCompositeNode *topNode) override;
0055 
0056   void useConstField(bool field) { m_constField = field; }
0057   void setConstFieldVal(float b) { m_constFieldVal = b; }
0058 
0059   /// Set an arbitrary radius to project to, in cm
0060   void setLayerRadius(SvtxTrack::CAL_LAYER layer, float rad)
0061   { m_caloRadii[layer] = rad; }
0062 
0063  private:
0064   int getNodes(PHCompositeNode *topNode);
0065   int projectTracks(SvtxTrack::CAL_LAYER);
0066 
0067   /// Propagate the fitted track parameters to a surface with Acts
0068   BoundTrackParamResult propagateTrack(
0069       const Acts::BoundTrackParameters &params,
0070       const SurfacePtr &targetSurf);
0071 
0072   /// Make Acts::CylinderSurface objects corresponding to the calos
0073   int makeCaloSurfacePtrs(PHCompositeNode *topNode);
0074 
0075   /// Update the SvtxTrack object with the track-cluster match
0076   void updateSvtxTrack(const ActsPropagator::BoundTrackParamPair &params,
0077                        SvtxTrack *svtxTrack,
0078                        SvtxTrack::CAL_LAYER);
0079 
0080   /// Objects containing the Acts track fit results
0081   ActsGeometry *m_tGeometry = nullptr;
0082   SvtxTrackMap *m_trackMap = nullptr;
0083   SvtxVertexMap *m_vertexMap = nullptr;
0084 
0085   /// Objects to hold calorimeter information.
0086   std::map<SvtxTrack::CAL_LAYER, SurfacePtr> m_caloSurfaces;
0087 
0088   /// An optional map that allows projection to an arbitrary radius
0089   /// Results are written to the SvtxTrack based on the provided CAL_LAYER
0090   std::map<SvtxTrack::CAL_LAYER, float> m_caloRadii;
0091 
0092   /// use constant field
0093   bool m_constField = true;
0094 
0095   /// constant field value
0096   float m_constFieldVal = 1.4;
0097 };
0098 
0099 #endif