Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SvtxTrackEval.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SvtxTrackEval.h
1 #ifndef G4EVAL_SVTXTRACKEVAL_H
2 #define G4EVAL_SVTXTRACKEVAL_H
3 
4 #include "SvtxClusterEval.h"
5 
6 #include <trackbase/TrkrDefs.h>
7 
8 #include <map>
9 #include <set>
10 #include <string> // for string
11 #include <utility>
12 
13 class PHCompositeNode;
14 
15 class PHG4Hit;
16 class PHG4Particle;
17 
18 class SvtxHitEval;
19 class SvtxTrack;
20 class SvtxTrackMap;
21 class SvtxTruthEval;
25 
27 {
28  public:
30  virtual ~SvtxTrackEval();
31 
32  void next_event(PHCompositeNode* topNode);
33  void do_caching(bool do_cache)
34  {
35  _do_cache = do_cache;
36  _clustereval.do_caching(do_cache);
37  }
38  void set_strict(bool strict)
39  {
40  _strict = strict;
41  _clustereval.set_strict(strict);
42  }
44  {
46  _clustereval.set_verbosity(verbosity);
47  }
48 
49  // access the clustereval (and its cached values)
53 
54  // backtrace through to PHG4Hits
55  std::set<PHG4Hit*> all_truth_hits(SvtxTrack* track);
56 
57  // backtrace through to PHG4Particles
58  std::set<PHG4Particle*> all_truth_particles(SvtxTrack* track);
60 
61  // forwardtrace through to SvtxTracks
62  std::set<SvtxTrack*> all_tracks_from(PHG4Particle* truthparticle);
63  SvtxTrack* best_track_from(PHG4Particle* truthparticle);
64  std::set<SvtxTrack*> all_tracks_from(PHG4Hit* truthhit);
65  std::set<SvtxTrack*> all_tracks_from(TrkrDefs::cluskey cluster_key);
68 
69  // overlap calculations
70  void calc_cluster_contribution(SvtxTrack* svtxtrack, PHG4Particle* truthparticle);
71  unsigned int get_nclusters_contribution(SvtxTrack* svtxtrack, PHG4Particle* truthparticle);
72  std::pair<unsigned int, unsigned int> get_layer_range_contribution(SvtxTrack* track, PHG4Particle* particle, unsigned int start_layer, unsigned int end_layer);
73  unsigned int get_nclusters_contribution_by_layer(SvtxTrack* svtxtrack, PHG4Particle* truthparticle);
74  unsigned int get_nwrongclusters_contribution(SvtxTrack* svtxtrack, PHG4Particle* truthparticle);
75  unsigned int get_errors() { return _errors + _clustereval.get_errors(); }
76 
78 
79  private:
80  void get_node_pointers(PHCompositeNode* topNode);
81  bool has_node_pointers();
82 
83  std::vector<TrkrDefs::cluskey> get_track_ckeys(SvtxTrack* track);
84 
86  SvtxTrackMap* _trackmap = nullptr;
90 
91  bool _strict = false;
92  int _verbosity = 0;
93  unsigned int _errors = 0;
94 
95  bool _do_cache = true;
97  std::map<SvtxTrack*, std::set<PHG4Hit*> > _cache_all_truth_hits;
98  std::map<SvtxTrack*, std::set<PHG4Particle*> > _cache_all_truth_particles;
99  std::map<SvtxTrack*, PHG4Particle*> _cache_max_truth_particle_by_nclusters;
100  std::map<PHG4Particle*, std::set<SvtxTrack*> > _cache_all_tracks_from_particle;
101  std::map<PHG4Particle*, SvtxTrack*> _cache_best_track_from_particle;
102  std::map<PHG4Hit*, std::set<SvtxTrack*> > _cache_all_tracks_from_g4hit;
103  std::map<TrkrDefs::cluskey, std::set<SvtxTrack*> > _cache_all_tracks_from_cluster;
104  std::map<TrkrDefs::cluskey, SvtxTrack*> _cache_best_track_from_cluster;
105  std::map<std::pair<SvtxTrack*, PHG4Particle*>, unsigned int> _cache_get_nclusters_contribution;
106  std::map<std::pair<SvtxTrack*, PHG4Particle*>, unsigned int> _cache_get_nclusters_contribution_by_layer;
107  std::map<std::pair<SvtxTrack*, PHG4Particle*>, unsigned int> _cache_get_nwrongclusters_contribution;
108  std::string m_TrackNodeName = "SvtxTrackMap";
109 };
110 
111 #endif // G4EVAL_SVTXTRACKEVAL_H