Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef QA_QAG4SimulationTracking_H
0002 #define QA_QAG4SimulationTracking_H
0003 
0004 #include <g4eval/SvtxEvalStack.h>
0005 
0006 #include <trackbase/TrkrDefs.h>  // for cluskey
0007 
0008 #include <fun4all/SubsysReco.h>
0009 
0010 #include <memory>
0011 #include <set>
0012 #include <string>
0013 #include <utility>
0014 
0015 class PHCompositeNode;
0016 class SvtxTrackMap;
0017 class PHG4Hit;
0018 class PHG4HitContainer;
0019 class PHG4TruthInfoContainer;
0020 class TrkrClusterContainer;
0021 class TrkrClusterHitAssoc;
0022 class TrkrHitTruthAssoc;
0023 class SvtxVertexMap;
0024 class GlobalVertexMap;
0025 
0026 /// \class QAG4SimulationTracking
0027 class QAG4SimulationTracking : public SubsysReco
0028 {
0029  public:
0030   QAG4SimulationTracking(const std::string &name = "QAG4SimulationTracking");
0031   virtual ~QAG4SimulationTracking() = default;
0032 
0033   int Init(PHCompositeNode *topNode);
0034   int InitRun(PHCompositeNode *topNode);
0035   int process_event(PHCompositeNode *topNode);
0036 
0037   // common prefix for QA histograms
0038   std::string get_histo_prefix();
0039 
0040   //! If added, only process truth particle associated with the selected list of EmbeddingIDs
0041   //! Call multiple times to add multiple EmbeddingIDs
0042   //! For EmbeddingID<0, all negative embedding IDs are accepted for pile up events.
0043   void addEmbeddingID(int embeddingID);
0044 
0045   //! range of the truth track eta to be analyzed
0046   void setEtaRange(double low, double high)
0047   {
0048     m_etaRange.first = low;
0049     m_etaRange.second = high;
0050   }
0051 
0052   //! only count unique truth<->reco track pair in tracking efficiency
0053   void setUniqueTrackingMatch(bool b)
0054   {
0055     m_uniqueTrackingMatch = b;
0056   }
0057 
0058   void set_embed_id_cut(const int id) { m_embed_id_cut = id; }
0059 
0060  private:
0061   /// load nodes
0062   int load_nodes(PHCompositeNode *);
0063 
0064   void get_dca(SvtxTrack *track, float &dca3dxy, float &dca3dz,
0065                float &dca3dxysigma, float &dca3dzsigma);
0066   // get geant hits associated to a cluster
0067   using G4HitSet = std::set<PHG4Hit *>;
0068   G4HitSet find_g4hits(TrkrDefs::cluskey) const;
0069 
0070   std::unique_ptr<SvtxEvalStack> m_svtxEvalStack;
0071   std::set<int> m_embeddingIDs;
0072 
0073   //! range of the truth track eta to be analyzed
0074   std::pair<double, double> m_etaRange = {-1, 1};
0075 
0076   //! only count unique truth<->reco track pair in tracking efficiency
0077   bool m_uniqueTrackingMatch = true;
0078 
0079   //! cut for selecting on foreground
0080   int m_embed_id_cut = 0;
0081 
0082   PHG4TruthInfoContainer *m_truthContainer = nullptr;
0083   SvtxTrackMap *m_trackMap = nullptr;
0084   GlobalVertexMap *m_vertexMap = nullptr;
0085 
0086   TrkrClusterContainer *m_cluster_map = nullptr;
0087   TrkrClusterHitAssoc *m_cluster_hit_map = nullptr;
0088   TrkrHitTruthAssoc *m_hit_truth_map = nullptr;
0089 
0090   PHG4HitContainer *m_g4hits_tpc = nullptr;
0091   PHG4HitContainer *m_g4hits_intt = nullptr;
0092   PHG4HitContainer *m_g4hits_mvtx = nullptr;
0093   PHG4HitContainer *m_g4hits_micromegas = nullptr;
0094 };
0095 
0096 #endif  // QA_QAG4SimulationTracking_H