ECCE @ EIC 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;
22 
24 {
25  public:
27  virtual ~SvtxTrackEval();
28 
29  void next_event(PHCompositeNode* topNode);
30  void do_caching(bool do_cache)
31  {
32  _do_cache = do_cache;
33  _clustereval.do_caching(do_cache);
34  }
35  void set_strict(bool strict)
36  {
37  _strict = strict;
38  _clustereval.set_strict(strict);
39  }
40  void set_verbosity(int verbosity)
41  {
42  _verbosity = verbosity;
43  _clustereval.set_verbosity(verbosity);
44  }
45 
46  // access the clustereval (and its cached values)
50 
51  // backtrace through to PHG4Hits
52  std::set<PHG4Hit*> all_truth_hits(SvtxTrack* track);
53 
54  // backtrace through to PHG4Particles
55  std::set<PHG4Particle*> all_truth_particles(SvtxTrack* track);
57 
58  // forwardtrace through to SvtxTracks
59  std::set<SvtxTrack*> all_tracks_from(PHG4Particle* truthparticle);
60  SvtxTrack* best_track_from(PHG4Particle* truthparticle);
61  std::set<SvtxTrack*> all_tracks_from(PHG4Hit* truthhit);
62  std::set<SvtxTrack*> all_tracks_from(TrkrDefs::cluskey cluster_key);
65 
66  // overlap calculations
67  void calc_cluster_contribution(SvtxTrack* svtxtrack, PHG4Particle* truthparticle);
68  unsigned int get_nclusters_contribution(SvtxTrack* svtxtrack, PHG4Particle* truthparticle);
69  unsigned int get_layer_range_contribution(SvtxTrack* track, PHG4Particle* particle, unsigned int start_layer, unsigned int end_layer);
70  unsigned int get_nclusters_contribution_by_layer(SvtxTrack* svtxtrack, PHG4Particle* truthparticle);
71  unsigned int get_nwrongclusters_contribution(SvtxTrack* svtxtrack, PHG4Particle* truthparticle);
72  unsigned int get_errors() { return _errors + _clustereval.get_errors(); }
73 
74  void set_track_nodename(const std::string& name) { m_TrackNodeName = name; }
75 
76  private:
77  void get_node_pointers(PHCompositeNode* topNode);
78  bool has_node_pointers();
79 
82 
83  bool _strict;
85  unsigned int _errors;
86 
87  bool _do_cache;
89  std::map<SvtxTrack*, std::set<PHG4Hit*> > _cache_all_truth_hits;
90  std::map<SvtxTrack*, std::set<PHG4Particle*> > _cache_all_truth_particles;
91  std::map<SvtxTrack*, PHG4Particle*> _cache_max_truth_particle_by_nclusters;
92  std::map<PHG4Particle*, std::set<SvtxTrack*> > _cache_all_tracks_from_particle;
93  std::map<PHG4Particle*, SvtxTrack*> _cache_best_track_from_particle;
94  std::map<PHG4Hit*, std::set<SvtxTrack*> > _cache_all_tracks_from_g4hit;
95  std::map<TrkrDefs::cluskey, std::set<SvtxTrack*> > _cache_all_tracks_from_cluster;
96  std::map<TrkrDefs::cluskey, SvtxTrack*> _cache_best_track_from_cluster;
97  std::map<std::pair<SvtxTrack*, PHG4Particle*>, unsigned int> _cache_get_nclusters_contribution;
98  std::map<std::pair<SvtxTrack*, PHG4Particle*>, unsigned int> _cache_get_nclusters_contribution_by_layer;
99  std::map<std::pair<SvtxTrack*, PHG4Particle*>, unsigned int> _cache_get_nwrongclusters_contribution;
100  std::string m_TrackNodeName;
101 };
102 
103 #endif // G4EVAL_SVTXTRACKEVAL_H