Skip to content

Commit

Permalink
feat: Add full cov and pulls to VertexPerformanceWriter (#2119)
Browse files Browse the repository at this point in the history
since people are looking more closely into vertex performance right now this might be helpful
  • Loading branch information
andiwand committed May 16, 2023
1 parent 9e65ec3 commit c59801e
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 23 deletions.
Binary file modified CI/physmon/reference/performance_amvf_orthogonal_hist.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_amvf_seeded_hist.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_amvf_truth_estimated_hist.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_amvf_truth_smeared_hist.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_ivf_orthogonal_hist.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_ivf_seeded_hist.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_ivf_truth_estimated_hist.root
Binary file not shown.
Binary file modified CI/physmon/reference/performance_ivf_truth_smeared_hist.root
Binary file not shown.
13 changes: 9 additions & 4 deletions CI/physmon/vertexing_config.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
histograms:
"diff.*":
"res.*":
nbins: 100
min: -0.1
max: 0.1

diffz:
resZ:
nbins: 50
min: -0.3
max: 0.3

"covXX|covYY":
"pull.*":
nbins: 50
min: -6
max: 6

"covXX|covYY|covZZ":
nbins: 100
min: -0.0005
max: 0.0005

"covXY|covYX":
"covXY|covXZ|covYX":
nbins: 100
min: -0.0001
max: 0.0001
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ ActsExamples::VertexPerformanceWriter::VertexPerformanceWriter(
throw std::bad_alloc();
} else {
// I/O parameters
m_outputTree->Branch("diffx", &m_diffx);
m_outputTree->Branch("diffy", &m_diffy);
m_outputTree->Branch("diffz", &m_diffz);
m_outputTree->Branch("resX", &m_resX);
m_outputTree->Branch("resY", &m_resY);
m_outputTree->Branch("resZ", &m_resZ);

m_outputTree->Branch("pullX", &m_pullX);
m_outputTree->Branch("pullY", &m_pullY);
m_outputTree->Branch("pullZ", &m_pullZ);

m_outputTree->Branch("recoX", &m_recoX);
m_outputTree->Branch("recoY", &m_recoY);
Expand All @@ -99,8 +103,11 @@ ActsExamples::VertexPerformanceWriter::VertexPerformanceWriter(

m_outputTree->Branch("covXX", &m_covXX);
m_outputTree->Branch("covYY", &m_covYY);
m_outputTree->Branch("covZZ", &m_covZZ);
m_outputTree->Branch("covXY", &m_covXY);
m_outputTree->Branch("covYX", &m_covYX);
m_outputTree->Branch("covXZ", &m_covXZ);
m_outputTree->Branch("covYZ", &m_covYZ);

m_outputTree->Branch("trkVtxMatch", &m_trackVtxMatchFraction);
m_outputTree->Branch("nRecoVtx", &m_nrecoVtx);
m_outputTree->Branch("nTrueVtx", &m_ntrueVtx);
Expand Down Expand Up @@ -359,9 +366,27 @@ ActsExamples::ProcessCode ActsExamples::VertexPerformanceWriter::writeT(
// Vertex found, fill varibles
const auto& truePos = particle.position();

m_diffx.push_back(vtx.position()[0] - truePos[0]);
m_diffy.push_back(vtx.position()[1] - truePos[1]);
m_diffz.push_back(vtx.position()[2] - truePos[2]);
m_resX.push_back(vtx.position()[0] - truePos[0]);
m_resY.push_back(vtx.position()[1] - truePos[1]);
m_resZ.push_back(vtx.position()[2] - truePos[2]);

auto pull = [&](int i) {
double var = vtx.covariance()(i, i);
if (var < 0) {
ACTS_WARNING("var(" << i << ") = " << var << " < 0");
return std::numeric_limits<double>::quiet_NaN();
}
double std = std::sqrt(var);
if (std == 0) {
ACTS_WARNING("std(" << i << ") = 0");
return std::numeric_limits<double>::quiet_NaN();
}
return (vtx.position()[i] - truePos[i]) / std;
};

m_pullX.push_back(pull(0));
m_pullY.push_back(pull(1));
m_pullZ.push_back(pull(2));

m_truthX.push_back(truePos[0]);
m_truthY.push_back(truePos[1]);
Expand All @@ -373,8 +398,11 @@ ActsExamples::ProcessCode ActsExamples::VertexPerformanceWriter::writeT(

m_covXX.push_back(vtx.covariance()(0, 0));
m_covYY.push_back(vtx.covariance()(1, 1));
m_covZZ.push_back(vtx.covariance()(2, 2));
m_covXY.push_back(vtx.covariance()(0, 1));
m_covYX.push_back(vtx.covariance()(1, 0));
m_covXZ.push_back(vtx.covariance()(0, 2));
m_covYZ.push_back(vtx.covariance()(1, 2));

m_trackVtxMatchFraction.push_back(trackVtxMatchFraction);
// Next vertex now
break;
Expand All @@ -394,9 +422,12 @@ ActsExamples::ProcessCode ActsExamples::VertexPerformanceWriter::writeT(
// fill the variables
m_outputTree->Fill();

m_diffx.clear();
m_diffy.clear();
m_diffz.clear();
m_resX.clear();
m_resY.clear();
m_resZ.clear();
m_pullX.clear();
m_pullY.clear();
m_pullZ.clear();
m_truthX.clear();
m_truthY.clear();
m_truthZ.clear();
Expand All @@ -405,8 +436,10 @@ ActsExamples::ProcessCode ActsExamples::VertexPerformanceWriter::writeT(
m_recoZ.clear();
m_covXX.clear();
m_covYY.clear();
m_covZZ.clear();
m_covXY.clear();
m_covYX.clear();
m_covXZ.clear();
m_covYZ.clear();
m_trackVtxMatchFraction.clear();

return ProcessCode::SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,14 @@ class VertexPerformanceWriter final
TFile* m_outputFile{nullptr}; ///< The output file
TTree* m_outputTree{nullptr}; ///< The output tree

std::vector<float>
m_diffx; ///< Difference in x positon between reco and true vtx
std::vector<float>
m_diffy; ///< Difference in y positon between reco and true vtx
std::vector<float>
m_diffz; ///< Difference in z positon between reco and true vtx
/// Difference in x positon between reco and true vtx
std::vector<float> m_resX;
std::vector<float> m_resY;
std::vector<float> m_resZ;

std::vector<float> m_pullX;
std::vector<float> m_pullY;
std::vector<float> m_pullZ;

std::vector<float> m_truthX;
std::vector<float> m_truthY;
Expand All @@ -112,8 +114,11 @@ class VertexPerformanceWriter final

std::vector<float> m_covXX;
std::vector<float> m_covYY;
std::vector<float> m_covZZ;
std::vector<float> m_covXY;
std::vector<float> m_covYX;
std::vector<float> m_covXZ;
std::vector<float> m_covYZ;

std::vector<float> m_trackVtxMatchFraction;

int m_nrecoVtx = -1; ///< Number of reconstructed vertices
Expand Down

0 comments on commit c59801e

Please sign in to comment.