Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:19:25

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef G4MAIN_PHG4TRUTHTRACKINGACTION_H
0004 #define G4MAIN_PHG4TRUTHTRACKINGACTION_H
0005 
0006 #include "PHG4TrackingAction.h"
0007 
0008 #include <Geant4/G4ThreeVector.hh>
0009 
0010 #include <map>
0011 #include <vector>
0012 
0013 class G4Track;
0014 class PHCompositeNode;
0015 class PHG4TruthInfoContainer;
0016 class PHG4TruthEventAction;
0017 class PHG4Particle;
0018 class PHG4VtxPoint;
0019 
0020 class PHG4TruthTrackingAction : public PHG4TrackingAction
0021 {
0022  public:
0023   //! constructor
0024   PHG4TruthTrackingAction(PHG4TruthEventAction*);
0025 
0026   //! destructor
0027   ~PHG4TruthTrackingAction() override {}
0028 
0029   //! tracking action
0030   void PreUserTrackingAction(const G4Track*) override;
0031 
0032   void PostUserTrackingAction(const G4Track*) override;
0033 
0034   //! Set pointers to the i/o nodes
0035   void SetInterfacePointers(PHCompositeNode*) override;
0036 
0037   int ResetEvent(PHCompositeNode*) override;
0038 
0039  private:
0040   std::map<G4ThreeVector, int> m_VertexMap;
0041 
0042   //! pointer to the "owning" event action
0043   PHG4TruthEventAction* m_EventAction;
0044 
0045   //! pointer to truth information container
0046   PHG4TruthInfoContainer* m_TruthInfoList;
0047 
0048   PHG4Particle* AddParticle(PHG4TruthInfoContainer&, G4Track&);
0049   PHG4VtxPoint* AddVertex(PHG4TruthInfoContainer&, const G4Track&);
0050 
0051   //check if track is long-lived
0052   bool isLongLived ( int pid ) const;
0053 
0054   //check if track is sPHENIX primary
0055   bool issPHENIXPrimary(PHG4TruthInfoContainer& truth, PHG4Particle* particle) const;
0056 
0057   /// Machinery to keep track of upstream particles while adding Geant4 tracks
0058   /// to the truth info container
0059   ///@{
0060   void UpdateG4ParticleStack(const G4Track*);
0061 
0062   struct G4ParticleInfo
0063   {
0064     int g4track_id, particle_id, vertex_id;
0065   };
0066   std::vector<G4ParticleInfo> m_G4ParticleStack;
0067   G4ParticleInfo m_CurrG4Particle;
0068   ///@}
0069 };
0070 
0071 #endif