1#include "Tracking/Reco/TruthMatchingTool.h"
6TruthMatchingTool::TruthInfo TruthMatchingTool::Evaluate(
7 const std::unordered_map<unsigned int, unsigned int>& trk_trackIDs,
14 for (std::unordered_map<unsigned int, unsigned int>::const_iterator it =
16 it != trk_trackIDs.end(); it++) {
17 double currentTruthProb = (double)it->second / (
double)n_meas;
18 if (currentTruthProb > ti.truthProb) {
19 ti.truthProb = currentTruthProb;
20 ti.trackID = it->first;
24 if (ti.trackID > 0) ti.pdgID = map_[ti.trackID].getPdgID();
30 const std::vector<ldmx::Measurement>& vmeas) {
31 std::unordered_map<unsigned int, unsigned int> trk_trackIDs;
33 for (
auto meas : vmeas) {
34 for (
auto trkId : meas.getTrackIds()) {
35 if (trk_trackIDs.find(trkId) != trk_trackIDs.end())
36 trk_trackIDs[trkId]++;
38 trk_trackIDs[trkId] = 1;
42 return Evaluate(trk_trackIDs, vmeas.size());
57 std::unordered_map<unsigned int, unsigned int> trk_trackIDs;
59 for (
auto measID : trk.getMeasurementsIdxs()) {
60 auto meas = measurements_.at(measID);
62 std::cout <<
"Getting measurement at ID:" << measID << std::endl;
63 std::cout << meas << std::endl;
64 std::cout << meas.getTrackIds().size() << std::endl;
67 for (
auto trkId : meas.getTrackIds()) {
68 if (trk_trackIDs.find(trkId) != trk_trackIDs.end()) {
69 trk_trackIDs[trkId]++;
71 trk_trackIDs[trkId] = 1;
77 std::cout <<
"The trackIDs maps look like:" << std::endl;
78 for (std::unordered_map<unsigned int, unsigned int>::iterator it =
80 it != trk_trackIDs.end(); it++) {
81 std::cout << it->first <<
" " << it->second << std::endl;
86 return Evaluate(trk_trackIDs, 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...