26 : _clustereval(topNode)
37 std::cout <<
"SvtxTrackEval::~SvtxTrackEval() - Error Count: " <<
_errors << std::endl;
64 return std::set<PHG4Hit*>();
74 return std::set<PHG4Hit*>();
79 std::map<SvtxTrack*, std::set<PHG4Hit*> >::iterator iter =
87 std::set<PHG4Hit*> truth_hits;
91 for (
const auto& cluster_key : cluster_keys)
105 for (
auto new_hit : new_hits)
107 truth_hits.insert(new_hit);
123 return std::set<PHG4Particle*>();
133 return std::set<PHG4Particle*>();
139 std::set<PHG4Particle*> returnset;
141 for (
const auto& [weight, truthTrackSet] : map)
143 for (
const int& g4partid : truthTrackSet)
153 std::map<SvtxTrack*, std::set<PHG4Particle*> >::iterator iter =
160 std::set<PHG4Particle*> truth_particles;
173 for (
const auto& cluster_key : cluster_keys)
187 for (
auto new_particle : new_particles)
189 truth_particles.insert(new_particle);
199 return truth_particles;
226 auto itr = map.end();
228 std::set<int> bestPartSet = itr->second;
229 int bestpart = *bestPartSet.begin();
235 std::map<SvtxTrack*, PHG4Particle*>::iterator iter =
255 unsigned int max_nclusters = 0;
257 for (
auto candidate : particles)
260 if (nclusters > max_nclusters)
262 max_nclusters = nclusters;
263 max_particle = candidate;
280 return std::set<SvtxTrack*>();
287 else if (!truthparticle)
290 return std::set<SvtxTrack*>();
295 std::set<SvtxTrack*> returnset;
299 for (
const auto& [weight, recoTrackSet] : map)
301 for (
const unsigned int& trackid : recoTrackSet)
311 std::map<PHG4Particle*, std::set<SvtxTrack*> >::iterator iter =
319 std::set<SvtxTrack*>
tracks;
326 for (
const auto& cluster_key : cluster_keys)
341 for (
auto candidate : particles)
343 if (
get_truth_eval()->are_same_particle(candidate, truthparticle))
345 tracks.insert(track);
364 return std::set<SvtxTrack*>();
374 return std::set<SvtxTrack*>();
379 std::map<PHG4Hit*, std::set<SvtxTrack*> >::iterator iter =
387 std::set<SvtxTrack*>
tracks;
395 for (
const auto& cluster_key : cluster_keys)
409 for (
auto candidate : hits)
412 if (candidate->get_trkid() == truthhit->
get_trkid())
414 tracks.insert(track);
440 else if (!truthparticle)
454 auto itr = map.end();
456 std::set<unsigned int> bestPartSet = itr->second;
457 int bestpart = *bestPartSet.begin();
463 std::map<PHG4Particle*, SvtxTrack*>::iterator iter =
472 unsigned int best_count = 0;
474 for (
auto track : tracks)
477 if (count > best_count)
507 for (
const auto& candidate_key : cluster_keys)
521 std::map<TrkrDefs::cluskey, std::set<SvtxTrack*> >::iterator cliter =
525 cliter->second.insert(track);
529 std::set<SvtxTrack*>
tracks;
530 tracks.insert(track);
545 return std::set<SvtxTrack*>();
558 std::set<SvtxTrack*>
tracks;
566 std::map<TrkrDefs::cluskey, std::set<SvtxTrack*> >::iterator iter =
585 for (
const auto& candidate : cluster_keys)
597 if (cluster_key == candidate)
599 tracks.insert(track);
632 std::map<TrkrDefs::cluskey, SvtxTrack*>::iterator iter =
641 float best_quality = FLT_MAX;
645 for (
auto candidate : tracks)
647 if (candidate->get_quality() < best_quality)
649 best_quality = candidate->get_quality();
650 best_track = candidate;
675 else if (!track || !particle)
683 std::map<std::pair<SvtxTrack*, PHG4Particle*>,
unsigned int>::iterator iter =
705 else if (!track || !particle)
713 std::map<std::pair<SvtxTrack*, PHG4Particle*>,
unsigned int>::iterator iter =
737 else if (!track || !particle)
743 std::map<std::pair<SvtxTrack*, PHG4Particle*>,
unsigned int>::iterator iter =
745 std::map<std::pair<SvtxTrack*, PHG4Particle*>,
unsigned int>::iterator witer =
754 unsigned int nclusters = 0;
755 unsigned int nwrong = 0;
758 for (
const auto& cluster_key : cluster_keys)
772 for (
auto candidate : particles)
805 else if (!track || !particle)
813 std::map<std::pair<SvtxTrack*, PHG4Particle*>,
unsigned int>::iterator iter =
821 unsigned int nclusters_by_layer = 0;
822 int layer_occupied[100];
823 for (
int&
i : layer_occupied)
830 for (
const auto& cluster_key : cluster_keys)
847 for (
auto candidate : particles)
851 layer_occupied[cluster_layer]++;
855 for (
int i : layer_occupied)
859 nclusters_by_layer++;
867 return nclusters_by_layer;
875 return std::make_pair(0,0);
883 else if (!track || !particle)
886 return std::make_pair(0,0);
889 unsigned int nmatches = 0;
890 unsigned int nwrong = 0;
891 unsigned int nlayers = end_layer - start_layer;
902 for (
const auto& cluster_key : cluster_keys)
905 if (cluster_layer >= end_layer)
909 if (cluster_layer < start_layer)
927 for (
auto candidate : particles)
932 layers[cluster_layer - start_layer] = 1;
938 layers_wrong[cluster_layer - start_layer] = 1;
947 if(layers_wrong[
i] == 1)
954 return std::make_pair(nmatches,nwrong);
962 _truthRecoMap = findNode::getClass<PHG4ParticleSvtxMap>(topNode,
"PHG4ParticleSvtxMap");
964 _recoTruthMap = findNode::getClass<SvtxPHG4ParticleMap>(topNode,
"SvtxPHG4ParticleMap");
966 _truthinfo = findNode::getClass<PHG4TruthInfoContainer>(topNode,
"G4TruthInfo");
987 std::vector<TrkrDefs::cluskey> cluster_keys;
996 cluster_keys.push_back(*iter);
1005 cluster_keys.push_back(*iter);
1009 return cluster_keys;