Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:21:49

0001 #ifndef G4EVAL_SVTXTRUTHEVAL_H
0002 #define G4EVAL_SVTXTRUTHEVAL_H
0003 
0004 #include "BaseTruthEval.h"
0005 
0006 #include <trackbase/TrkrDefs.h>
0007 
0008 class PHCompositeNode;
0009 
0010 class PHG4Hit;
0011 class PHG4HitContainer;
0012 class PHG4Particle;
0013 class PHG4TruthInfoContainer;
0014 class PHG4CylinderGeomContainer;
0015 class PHG4TpcGeomContainer;
0016 class PHG4VtxPoint;
0017 class TrkrCluster;
0018 class ActsGeometry;
0019 class PHParametersContainer;
0020 
0021 #include <map>
0022 #include <memory>
0023 #include <set>
0024 #include <vector>
0025 
0026 class SvtxTruthEval
0027 {
0028  public:
0029   SvtxTruthEval(PHCompositeNode* topNode);
0030   virtual ~SvtxTruthEval();
0031 
0032   void next_event(PHCompositeNode* topNode);
0033   void do_caching(bool do_cache) { _do_cache = do_cache; }
0034   void set_strict(bool strict)
0035   {
0036     _strict = strict;
0037     _basetrutheval.set_strict(strict);
0038   }
0039   void set_verbosity(int verbosity)
0040   {
0041     _verbosity = verbosity;
0042     _basetrutheval.set_verbosity(verbosity);
0043   }
0044 
0045   std::set<PHG4Hit*> all_truth_hits();
0046   std::set<PHG4Hit*> all_truth_hits(PHG4Particle* particle);
0047   PHG4Particle* get_particle(PHG4Hit* g4hit);
0048   int get_embed(PHG4Particle* particle);
0049   PHG4VtxPoint* get_vertex(PHG4Particle* particle);
0050   bool is_primary(PHG4Particle* particle);
0051   PHG4Particle* get_primary_particle(PHG4Hit* g4hit);
0052   PHG4Particle* get_primary_particle(PHG4Particle* particle);
0053   PHG4Particle* get_particle(const int trackid);
0054 
0055   std::map<TrkrDefs::cluskey, std::shared_ptr<TrkrCluster>> all_truth_clusters(PHG4Particle* particle);
0056 
0057   bool is_g4hit_from_particle(PHG4Hit* g4hit, PHG4Particle* particle);
0058   bool are_same_particle(PHG4Particle* p1, PHG4Particle* p2);
0059   bool are_same_vertex(PHG4VtxPoint* vtx1, PHG4VtxPoint* vtx2);
0060 
0061   PHG4Hit* get_innermost_truth_hit(PHG4Particle* particle);
0062   PHG4Hit* get_outermost_truth_hit(PHG4Particle* particle);
0063 
0064   unsigned int get_errors() { return _errors + _basetrutheval.get_errors(); }
0065 
0066   std::set<PHG4Hit*> get_truth_hits_from_truth_cluster(TrkrDefs::cluskey ckey);
0067   void FillTruthHitsFromParticleCache();
0068 
0069  private:
0070   void get_node_pointers(PHCompositeNode* topNode);
0071   bool has_node_pointers();
0072 
0073   void LayerClusterG4Hits(const std::set<PHG4Hit*>& truth_hits, std::vector<PHG4Hit*>& contributing_hits, std::vector<double>& contributing_hits_energy, std::vector<std::vector<double>>& contributing_hits_entry, std::vector<std::vector<double>>& contributing_hits_exit, float layer, float& x, float& y, float& z, float& t, float& e);
0074 
0075   float line_circle_intersection(float x[], float y[], float z[], float radius);
0076 
0077   void G4ClusterSize(TrkrDefs::cluskey ckey, unsigned int layer, const std::vector<std::vector<double>> &contributing_hits_entry, const std::vector<std::vector<double>> &contributing_hits_exit, float& g4phisize, float& g4zsize);
0078 
0079   unsigned int getAdcValue(double gedep);
0080 
0081   BaseTruthEval _basetrutheval;
0082 
0083   PHG4TruthInfoContainer* _truthinfo = nullptr;
0084   PHG4HitContainer* _g4hits_svtx = nullptr;
0085   PHG4HitContainer* _g4hits_mms = nullptr;
0086   PHG4HitContainer* _g4hits_tracker = nullptr;
0087   PHG4HitContainer* _g4hits_maps = nullptr;
0088 
0089   PHG4TpcGeomContainer* _tpc_geom_container{};
0090   PHG4CylinderGeomContainer* _intt_geom_container{};
0091   PHG4CylinderGeomContainer* _mvtx_geom_container{};
0092   PHG4CylinderGeomContainer* _mms_geom_container{};
0093   ActsGeometry* _tgeometry = nullptr;
0094 
0095   bool _strict = false;
0096   int _verbosity = 0;
0097   unsigned int _errors = 0;
0098   unsigned long iclus = 0;
0099 
0100   const unsigned int _nlayers_maps = 3;
0101   const unsigned int _nlayers_intt = 4;
0102   const unsigned int _nlayers_tpc = 48;
0103   const unsigned int _nlayers_mms = 2;
0104 
0105   std::multimap<TrkrDefs::cluskey, PHG4Hit*> _truth_cluster_truth_hit_map;
0106 
0107   bool _do_cache = true;
0108   std::set<PHG4Hit*> _cache_all_truth_hits;
0109   std::map<PHG4Particle*, std::set<PHG4Hit*>> _cache_all_truth_hits_g4particle;
0110   std::map<PHG4Particle*, std::map<TrkrDefs::cluskey, std::shared_ptr<TrkrCluster>>> _cache_all_truth_clusters_g4particle;
0111   std::map<PHG4Particle*, PHG4Hit*> _cache_get_innermost_truth_hit;
0112   std::map<PHG4Particle*, PHG4Hit*> _cache_get_outermost_truth_hit;
0113   std::map<PHG4Hit*, PHG4Particle*> _cache_get_primary_particle_g4hit;
0114 };
0115 
0116 #endif  // G4EVAL_SVTXTRUTHEVAL_H