File indexing completed on 2025-08-05 08:18:00
0001 #ifndef G4EVAL_SVTXHITEVAL_H
0002 #define G4EVAL_SVTXHITEVAL_H
0003
0004 #include "SvtxTruthEval.h"
0005
0006 #include <trackbase/TrkrDefs.h>
0007
0008 #include <map>
0009 #include <set>
0010 #include <utility>
0011
0012 class PHCompositeNode;
0013
0014 class PHG4Hit;
0015 class PHG4HitContainer;
0016 class PHG4Particle;
0017 class PHG4TruthInfoContainer;
0018
0019 class TrkrHitSetContainer;
0020 class TrkrClusterContainer;
0021 class TrkrHitTruthAssoc;
0022
0023 class SvtxHitEval
0024 {
0025 public:
0026 SvtxHitEval(PHCompositeNode* topNode);
0027 virtual ~SvtxHitEval();
0028
0029 void next_event(PHCompositeNode* topNode);
0030 void do_caching(bool do_cache)
0031 {
0032 _do_cache = do_cache;
0033 _trutheval.do_caching(do_cache);
0034 }
0035 void set_strict(bool strict)
0036 {
0037 _strict = strict;
0038 _trutheval.set_strict(strict);
0039 }
0040 void set_verbosity(int verbosity)
0041 {
0042 _verbosity = verbosity;
0043 _trutheval.set_verbosity(verbosity);
0044 }
0045
0046
0047 SvtxTruthEval* get_truth_eval() { return &_trutheval; }
0048
0049
0050
0051
0052 std::set<PHG4Hit*> all_truth_hits(TrkrDefs::hitkey hit_key);
0053 PHG4Hit* max_truth_hit_by_energy(TrkrDefs::hitkey hit_key);
0054
0055
0056 std::set<PHG4Hit*> all_truth_hits(TrkrDefs::hitkey hit_key, const TrkrDefs::TrkrId trkrid);
0057 PHG4Hit* max_truth_hit_by_energy(TrkrDefs::hitkey hit_key, const TrkrDefs::TrkrId trkrid);
0058
0059
0060 std::set<PHG4Particle*> all_truth_particles(TrkrDefs::hitkey hit_key);
0061 PHG4Particle* max_truth_particle_by_energy(TrkrDefs::hitkey hit_key);
0062
0063
0064 std::set<PHG4Particle*> all_truth_particles(TrkrDefs::hitkey hit_key, const TrkrDefs::TrkrId trkrid);
0065 PHG4Particle* max_truth_particle_by_energy(TrkrDefs::hitkey hit_key, const TrkrDefs::TrkrId trkrid);
0066
0067
0068 std::set<TrkrDefs::hitkey> all_hits_from(PHG4Particle* truthparticle);
0069 std::set<TrkrDefs::hitkey> all_hits_from(PHG4Hit* truthhit);
0070 TrkrDefs::hitkey best_hit_from(PHG4Hit* truthhit);
0071
0072
0073 float get_energy_contribution(TrkrDefs::hitkey, PHG4Particle* truthparticle);
0074 float get_energy_contribution(TrkrDefs::hitkey, PHG4Hit* truthhit);
0075
0076 unsigned int get_errors() { return _errors + _trutheval.get_errors(); }
0077
0078 private:
0079 void get_node_pointers(PHCompositeNode* topNode);
0080 bool has_node_pointers();
0081
0082 SvtxTruthEval _trutheval;
0083 TrkrHitSetContainer* _hitmap = nullptr;
0084 TrkrClusterContainer* _clustermap{};
0085 TrkrHitTruthAssoc* _hit_truth_map{};
0086
0087 PHG4HitContainer* _g4hits_tpc = nullptr;
0088 PHG4HitContainer* _g4hits_intt = nullptr;
0089 PHG4HitContainer* _g4hits_mvtx = nullptr;
0090 PHG4HitContainer* _g4hits_mms = nullptr;
0091
0092 PHG4TruthInfoContainer* _truthinfo;
0093
0094 bool _strict = false;
0095 int _verbosity = 0;
0096 unsigned int _errors = 0;
0097
0098 bool _do_cache = true;
0099 std::map<TrkrDefs::hitkey, std::set<PHG4Hit*> > _cache_all_truth_hits;
0100 std::map<TrkrDefs::hitkey, PHG4Hit*> _cache_max_truth_hit_by_energy;
0101 std::map<TrkrDefs::hitkey, std::set<PHG4Particle*> > _cache_all_truth_particles;
0102 std::map<TrkrDefs::hitkey, PHG4Particle*> _cache_max_truth_particle_by_energy;
0103 std::map<PHG4Particle*, std::set<TrkrDefs::hitkey> > _cache_all_hits_from_particle;
0104 std::map<PHG4Hit*, std::set<TrkrDefs::hitkey> > _cache_all_hits_from_g4hit;
0105 std::map<PHG4Hit*, TrkrDefs::hitkey> _cache_best_hit_from_g4hit;
0106 std::map<std::pair<TrkrDefs::hitkey, PHG4Particle*>, float> _cache_get_energy_contribution_g4particle;
0107 std::map<std::pair<TrkrDefs::hitkey, PHG4Hit*>, float> _cache_get_energy_contribution_g4hit;
0108 };
0109
0110 #endif