Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef G4EVAL_BASETRUTHEVAL_H
0002 #define G4EVAL_BASETRUTHEVAL_H
0003 
0004 #include <set>
0005 
0006 class PHCompositeNode;
0007 class PHG4Hit;
0008 class PHG4Particle;
0009 class PHG4Shower;
0010 class PHG4TruthInfoContainer;
0011 class PHG4VtxPoint;
0012 
0013 class BaseTruthEval
0014 {
0015  public:
0016   explicit BaseTruthEval(PHCompositeNode* topNode);
0017   virtual ~BaseTruthEval();
0018 
0019   /// reinitialize the eval for a new event
0020   void next_event(PHCompositeNode* topNode);
0021 
0022   /// strict mode will assert when an error is detected
0023   /// non-strict mode will notice and report at the End()
0024   void set_strict(bool strict) { m_Strict = strict; }
0025 
0026   /// get a count of the errors discovered thus far
0027   unsigned int get_errors() { return m_Errors; }
0028 
0029   /// adjust the messaging from the evalutaion module
0030   void set_verbosity(int verbosity) { m_Verbosity = verbosity; }
0031 
0032   // ---reduced sim node or better---------------------------------------------
0033 
0034   bool has_reduced_node_pointers();
0035 
0036   /// what was the embed flag set for this particle?
0037   int get_embed(PHG4Particle* particle);
0038 
0039   /// what was the vertex creation point of the particle?
0040   PHG4VtxPoint* get_vertex(PHG4Particle* particle);
0041 
0042   /// is this a primary shower?
0043   bool is_primary(PHG4Shower* shower);
0044 
0045   /// is this a primary particle?
0046   bool is_primary(PHG4Particle* particle);
0047 
0048   /// what was the primary shower for this possibly secondary shower?
0049   PHG4Shower* get_primary_shower(PHG4Shower* shower);
0050 
0051   /// what was the primary shower that is associated with this particle?
0052   PHG4Shower* get_primary_shower(PHG4Particle* particle);
0053 
0054   /// what was the primary particle that is associated with this particle?
0055   PHG4Particle* get_primary_particle(PHG4Particle* particle);
0056 
0057   /// what was the primary particle that is associated with this shower?
0058   PHG4Particle* get_primary_particle(PHG4Shower* shower);
0059 
0060   /// which secondary showers are inside this shower?
0061   std::set<PHG4Shower*> all_secondary_showers(PHG4Shower* shower);
0062 
0063   /// do these two shower pointers resolve to the same shower?
0064   bool are_same_shower(PHG4Shower* s1, PHG4Shower* s2);
0065 
0066   /// do these two particle pointers resolve to the same particle?
0067   bool are_same_particle(PHG4Particle* p1, PHG4Particle* p2);
0068 
0069   /// do these two vertex pointers resolve to the same vertex?
0070   bool are_same_vertex(PHG4VtxPoint* vtx1, PHG4VtxPoint* vtx2);
0071 
0072   // ---full sim node required--------------------------------------------------
0073 
0074   bool has_full_node_pointers() { return has_reduced_node_pointers(); }
0075 
0076   /// which particle left this truth hit?
0077   PHG4Particle* get_particle(PHG4Hit* g4hit);
0078 
0079   /// which primary shower contains this truth hit?
0080   PHG4Shower* get_primary_shower(PHG4Hit* g4hit);
0081 
0082   /// which primary particle resulted in this truth hit?
0083   PHG4Particle* get_primary_particle(PHG4Hit* g4hit);
0084 
0085   /// which is the particle associated with this track ID?
0086   PHG4Particle* get_particle(const int trackid);
0087 
0088   /// is this truth hit inside this shower?
0089   bool is_g4hit_from_primary_shower(PHG4Hit* g4hit, PHG4Shower* shower);
0090 
0091   /// was this truth hit left by this particle?
0092   bool is_g4hit_from_particle(PHG4Hit* g4hit, PHG4Particle* particle);
0093 
0094  private:
0095   void get_node_pointers(PHCompositeNode* topNode);
0096 
0097   PHG4TruthInfoContainer* m_TruthInfo = nullptr;
0098 
0099   bool m_Strict = false;
0100   int m_Verbosity = 0;
0101   unsigned int m_Errors = 0;
0102 };
0103 
0104 #endif  // G4EVAL_BASETRUTHEVAL_H