1#include "Tracking/Reco/TruthMatchingTool.h"
3#include "Tracking/Event/Track.h"
8TruthMatchingTool::TruthInfo TruthMatchingTool::evaluate(
9 const std::unordered_map<unsigned int, unsigned int>& trk_trackIDs,
16 for (std::unordered_map<unsigned int, unsigned int>::const_iterator it =
18 it != trk_trackIDs.end(); it++) {
19 double current_truth_prob = (double)it->second / (
double)n_meas;
20 if (current_truth_prob > ti.truth_prob_) {
21 ti.truth_prob_ = current_truth_prob;
22 ti.track_id_ = it->first;
26 if (ti.track_id_ > 0) ti.pdg_id_ = map_[ti.track_id_].getPdgID();
32 const std::vector<ldmx::Measurement>& vmeas) {
33 std::unordered_map<unsigned int, unsigned int> trk_track_i_ds;
35 for (
auto meas : vmeas) {
36 for (
auto trk_id : meas.getTrackIds()) {
37 if (trk_track_i_ds.find(trk_id) != trk_track_i_ds.end())
38 trk_track_i_ds[trk_id]++;
40 trk_track_i_ds[trk_id] = 1;
44 return evaluate(trk_track_i_ds, vmeas.size());
59 std::unordered_map<unsigned int, unsigned int> trk_track_i_ds;
61 for (
auto meas_id : trk.getMeasurementsIdxs()) {
62 auto meas = measurements_.at(meas_id);
64 std::cout <<
"Getting measurement at ID:" << meas_id << std::endl;
65 std::cout << meas << std::endl;
66 std::cout << meas.getTrackIds().size() << std::endl;
69 for (
auto trk_id : meas.getTrackIds()) {
70 if (trk_track_i_ds.find(trk_id) != trk_track_i_ds.end()) {
71 trk_track_i_ds[trk_id]++;
73 trk_track_i_ds[trk_id] = 1;
79 std::cout <<
"The trackIDs maps look like:" << std::endl;
80 for (std::unordered_map<unsigned int, unsigned int>::iterator it =
81 trk_track_i_ds.begin();
82 it != trk_track_i_ds.end(); it++) {
83 std::cout << it->first <<
" " << it->second << std::endl;
88 return evaluate(trk_track_i_ds, trk.getMeasurementsIdxs().size());
Implementation of a track object.
The measurement calibrator can be a function or a class/struct able to retrieve the sim hits containe...