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