Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:19

0001 #ifndef G4TRACKING_TRUTHCLUSTERIZERBASE
0002 #define G4TRACKING_TRUTHCLUSTERIZERBASE
0003 
0004 // Generated March 2023, David Stewart
0005 //
0006 //  Virtual base class used to cluster TrkrHits into TrkrClusters, but using only the reconstructed hits
0007 //  from phg4 embedded (``truth'') tracks. In each of the following modules, a child-class will be derived
0008 //  with the "cluster_hits()" virtual function implemented
0009 //  - PHG4MvtxHitReco
0010 //  - PHG4InttHitReco
0011 //  - PHG4TpcElectronDrift
0012 //  - (maybe?) tpot?
0013 //
0014 //  It's job is to:
0015 //    (1) build TrkrTruthTracks in the TrkrTruthTrackContainer
0016 //    (2) build TrkrClusters in the truth clusters TrkrClusterContainer
0017 //  It does this by collecting the TrkrHit's associated with each PHG4 truth track, and when they
0018 //  are all collected, it calls the down-stream macros (the same ones which do the Svtx clustering)
0019 //  on this subset of the TrkrHits, and assigning these clusters to the TrkrClusterContainer and
0020 //  the associated TrkrTruthTrackContainer.
0021 
0022 #include <trackbase/TrkrDefs.h>
0023 
0024 #include <map>
0025 
0026 class PHCompositeNode;
0027 class TrkrHitSetContainer;
0028 class TrkrClusterContainer;
0029 class TrkrTruthTrackContainer;
0030 class TrkrTruthTrack;
0031 class PHG4TruthInfoContainer;
0032 class PHG4Hit;
0033 
0034 class TruthClusterizerBase
0035 {
0036  protected:
0037   TrkrHitSetContainer* m_hits;
0038   int m_verbosity{0};
0039   PHCompositeNode* m_topNode{nullptr};
0040   TrkrTruthTrackContainer* m_truthtracks{nullptr};
0041   TrkrClusterContainer* m_clusters{nullptr};  // cluster container passed to individual clusterers
0042   PHG4TruthInfoContainer* m_truthinfo{nullptr};
0043   int m_trkid{-1};
0044   bool m_is_emb{false};
0045   bool m_was_emb{false};
0046   bool m_is_new_track{false};
0047   TrkrTruthTrack* m_current_track{nullptr};
0048 
0049   std::map<TrkrDefs::hitsetkey, unsigned int> m_hitsetkey_cnt{};  // counter for making ckeys form hitsetkeys
0050 
0051   // implemented individually for mvtx, intt and tpc cluster hits
0052   /* static int dummy_cluster_hits() { */
0053   /* return Fun4AllReturnCodes::EVENT_OK; */
0054   /* }; */
0055 
0056  public:
0057   TruthClusterizerBase();
0058   void init_clusterizer_base(PHCompositeNode*& _topNode, int verbosity);
0059   virtual ~TruthClusterizerBase();
0060 
0061   // main use functions
0062   void check_g4hit_status(PHG4Hit*);
0063   void transfer_clusters(TrkrClusterContainer*);
0064   void update_track();
0065   void transfer_clusters();
0066 
0067   void addhitset(TrkrDefs::hitsetkey, TrkrDefs::hitkey, float neffelectrons);
0068 
0069   // convenience
0070   int Verbosity() { return m_verbosity; };
0071   void set_verbosity(int _) { m_verbosity = _; };
0072   void print_clusters(int nclusprint = 20);
0073 };
0074 
0075 #endif