Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-07-16 08:14:51

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef TRACKRECO_PHTRUTHTRACKFITTER_H
0004 #define TRACKRECO_PHTRUTHTRACKFITTER_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 
0008 #include <g4main/PHG4HitDefs.h>
0009 #include <trackbase/TrkrDefs.h>
0010 
0011 #include <limits>
0012 #include <string>
0013 #include <vector>
0014 
0015 class ActsGeometry;
0016 class PHCompositeNode;
0017 class PHG4Hit;
0018 class PHG4HitContainer;
0019 class PHG4Particle;
0020 class PHG4TruthInfoContainer;
0021 class PHG4VtxPoint;
0022 class SvtxTrack;
0023 class SvtxTrackMap;
0024 class TrackSeed;
0025 class TrackSeedContainer;
0026 class TrkrCluster;
0027 class TrkrClusterContainer;
0028 class TrkrClusterHitAssoc;
0029 class TrkrHitTruthAssoc;
0030 
0031 class PHTruthTrackFitter : public SubsysReco
0032 {
0033  public:
0034   PHTruthTrackFitter(const std::string& name = "PHTruthTrackFitter");
0035   ~PHTruthTrackFitter() override = default;
0036 
0037   int InitRun(PHCompositeNode* topNode) override;
0038   int process_event(PHCompositeNode* topNode) override;
0039   int End(PHCompositeNode* topNode) override;
0040 
0041   void setTrackMapName(const std::string& name) { m_trackMapName = name; }
0042   void setSvtxSeedMapName(const std::string& name) { m_svtxSeedMapName = name; }
0043   void setTrkrClusterContainerName(const std::string& name) { m_clusterMapName = name; }
0044   void setDefaultCrossing(short int crossing) { m_defaultCrossing = crossing; }
0045   void setPositionError(float value) { m_positionError = value; }
0046   void setZError(float value) { m_zError = value; }
0047   void setExtrapolateToClusterRadius(bool value) { m_extrapolateToClusterRadius = value; }
0048 
0049  private:
0050   int createNodes(PHCompositeNode* topNode);
0051   int getNodes(PHCompositeNode* topNode);
0052 
0053   TrackSeed* getSeed(TrackSeedContainer* container, unsigned int index) const;
0054   unsigned int getTruthTrackId(const TrackSeed* svtxSeed, const TrackSeed* tpcSeed, const TrackSeed* siliconSeed) const;
0055 
0056   std::vector<const PHG4Hit*> getTruthHits(TrkrDefs::cluskey cluskey) const;
0057   const PHG4Hit* getG4Hit(unsigned int trkrid, PHG4HitDefs::keytype g4hitkey) const;
0058 
0059   bool addStateFromCluster(SvtxTrack* track, TrkrDefs::cluskey cluskey, unsigned int truthTrackId,
0060                            const PHG4Particle* particle, const PHG4VtxPoint* vertex,
0061                            unsigned int stateIndex) const;
0062   float getClusterRadius(TrkrDefs::cluskey cluskey, TrkrCluster* cluster) const;
0063   float getPathLength(const PHG4VtxPoint* vertex, float x, float y, float z, unsigned int stateIndex) const;
0064   int getCharge(const PHG4Particle* particle, const TrackSeed* tpcSeed, const TrackSeed* siliconSeed) const;
0065   short int getCrossing(const TrackSeed* tpcSeed, const TrackSeed* siliconSeed) const;
0066 
0067   std::string m_trackMapName = "SvtxTrackMap";
0068   std::string m_svtxSeedMapName = "SvtxTrackSeedContainer";
0069   std::string m_clusterMapName = "TRKR_CLUSTER";
0070 
0071   TrackSeedContainer* m_seedMap = nullptr;
0072   TrackSeedContainer* m_tpcSeeds = nullptr;
0073   TrackSeedContainer* m_siliconSeeds = nullptr;
0074   SvtxTrackMap* m_trackMap = nullptr;
0075   TrkrClusterContainer* m_clusterMap = nullptr;
0076   TrkrClusterHitAssoc* m_clusterHitMap = nullptr;
0077   TrkrHitTruthAssoc* m_hitTruthAssoc = nullptr;
0078   ActsGeometry* m_tGeometry = nullptr;
0079   PHG4TruthInfoContainer* m_g4TruthInfo = nullptr;
0080 
0081   PHG4HitContainer* m_g4HitsTpc = nullptr;
0082   PHG4HitContainer* m_g4HitsIntt = nullptr;
0083   PHG4HitContainer* m_g4HitsMvtx = nullptr;
0084   PHG4HitContainer* m_g4HitsMicromegas = nullptr;
0085 
0086   short int m_defaultCrossing = 0;
0087   float m_positionError = 0.005;
0088   float m_zError = 0.01;
0089   bool m_extrapolateToClusterRadius = true;
0090 
0091   static constexpr unsigned int m_invalidTruthTrackId = std::numeric_limits<unsigned int>::max();
0092 };
0093 
0094 #endif