ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SvtxClusterEval.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SvtxClusterEval.h
1 #ifndef G4EVAL_SVTXCLUSTEREVAL_H
2 #define G4EVAL_SVTXCLUSTEREVAL_H
3 
4 #include "SvtxHitEval.h"
5 
6 #include <trackbase/TrkrDefs.h>
9 
10 #include <map>
11 #include <memory> // for shared_ptr, less
12 #include <set>
13 #include <utility>
14 
15 
16 class PHCompositeNode;
17 
18 class PHG4Hit;
19 class PHG4HitContainer;
20 class PHG4Particle;
22 
23 class TrkrCluster;
27 class TrkrHitTruthAssoc;
29 
30 typedef std::multimap<float, TrkrDefs::cluskey> innerMap;
31 
33 {
34  public:
36  virtual ~SvtxClusterEval();
37 
38  void next_event(PHCompositeNode* topNode);
39  void do_caching(bool do_cache)
40  {
41  _do_cache = do_cache;
42  _hiteval.do_caching(do_cache);
43  }
44  void set_strict(bool strict)
45  {
46  _strict = strict;
47  _hiteval.set_strict(strict);
48  }
49  void set_verbosity(int verbosity)
50  {
51  _verbosity = verbosity;
52  _hiteval.set_verbosity(verbosity);
53  }
54 
55  // access the clustereval (and its cached values)
58 
59  // backtrace through to PHG4Hits
60  std::set<PHG4Hit*> all_truth_hits(TrkrDefs::cluskey cluster);
62 
63  std::set<std::shared_ptr<TrkrCluster> > all_truth_clusters(TrkrDefs::cluskey cluster_key);
64  std::shared_ptr<TrkrCluster> max_truth_cluster_by_energy(TrkrDefs::cluskey cluster_key);
65 
67  std::pair<int, int> gtrackid_and_layer_by_nhit(TrkrDefs::cluskey cluster);
68 
69  // backtrace through to PHG4Particles
70  std::set<PHG4Particle*> all_truth_particles(TrkrDefs::cluskey);
73 
74  // forwardtrace through to SvtxClusters
75  std::set<TrkrDefs::cluskey> all_clusters_from(PHG4Particle* truthparticle);
76  std::set<TrkrDefs::cluskey> all_clusters_from(PHG4Hit* truthhit);
80  // overlap calculations
81  float get_energy_contribution(TrkrDefs::cluskey cluster_key, PHG4Particle* truthparticle);
82  float get_energy_contribution(TrkrDefs::cluskey cluster_key, PHG4Hit* truthhit);
83 
84  TrkrCluster* reco_cluster_from_truth_cluster(std::shared_ptr<TrkrCluster> gclus);
85 
86  unsigned int get_errors() { return _errors + _hiteval.get_errors(); }
87 
88  private:
89  void get_node_pointers(PHCompositeNode* topNode);
91  // void fill_g4hit_layer_map();
92  bool has_node_pointers();
93 
96  float fast_approx_atan2(float y, float x);
97  float fast_approx_atan2(float y2x);
98 
111 
112  bool _strict;
114  unsigned int _errors;
115 
116  bool _do_cache;
117  std::map<TrkrDefs::cluskey, std::set<PHG4Hit*> > _cache_all_truth_hits;
118  std::map<TrkrDefs::cluskey, std::set<std::shared_ptr<TrkrCluster> > > _cache_all_truth_clusters;
119  std::map<TrkrDefs::cluskey, PHG4Hit*> _cache_max_truth_hit_by_energy;
120  std::map<TrkrDefs::cluskey, std::shared_ptr<TrkrCluster> > _cache_max_truth_cluster_by_energy;
121  std::map<TrkrDefs::cluskey, std::set<PHG4Particle*> > _cache_all_truth_particles;
122  std::map<TrkrDefs::cluskey, PHG4Particle*> _cache_max_truth_particle_by_energy;
123  std::map<TrkrDefs::cluskey, PHG4Particle*> _cache_max_truth_particle_by_cluster_energy;
124  std::map<PHG4Particle*, std::set<TrkrDefs::cluskey> > _cache_all_clusters_from_particle;
125  std::map<PHG4Hit*, std::set<TrkrDefs::cluskey> > _cache_all_clusters_from_g4hit;
126  std::map<PHG4Hit*, TrkrDefs::cluskey> _cache_best_cluster_from_g4hit;
128  std::map<std::pair<TrkrDefs::cluskey, PHG4Particle*>, float> _cache_get_energy_contribution_g4particle;
129  std::map<std::pair<TrkrDefs::cluskey, PHG4Hit*>, float> _cache_get_energy_contribution_g4hit;
130  std::map<std::shared_ptr<TrkrCluster>, TrkrCluster* > _cache_reco_cluster_from_truth_cluster;
131 
132  // measured for low occupancy events, all in cm
133  const float sig_tpc_rphi_inner = 220e-04;
134  const float sig_tpc_rphi_mid = 155e-04;
135  const float sig_tpc_rphi_outer = 165e-04;
136  const float sig_tpc_z = 750e-04;
137  const float sig_intt_rphi = 17e-04;
138  const float range_intt_z = 0.9;
139  const float sig_mvtx_rphi = 4.0e-04;
140  const float sig_mvtx_z = 4.7e-04;
141  const float sig_mms_rphi_55 = 100e-04;
142  const float sig_mms_z_56 = 200e-04;
143 
144 
146  static constexpr float _clusters_searching_window = 0.1f;
147  std::multimap<unsigned int, innerMap> _clusters_per_layer;
148 // std::multimap<unsigned int, PHG4Hit*> _g4hits_per_layer;
149 };
150 
151 #endif // G4EVAL_SVTXCLUSTEREVAL_H