Skip to content

Commit

Permalink
feat: writeFloat for seeding performance in SeedingPerformanceWriter.…
Browse files Browse the repository at this point in the history
…cpp (acts-project#2654)

Store (floats) total efficiency, fake rate, duplicate rate and purity in output root file as it is done with ckf performance writer.
This is useful for using the seeding parameters in optuna automatic tuning.
  • Loading branch information
LuisFelipeCoelho authored and asalzburger committed May 21, 2024
1 parent b641f35 commit 0c36ca9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ ActsExamples::ProcessCode ActsExamples::CKFPerformanceWriter::finalize() {
"Duplicate rate with particles (nDuplicateParticles/nTrueParticles) = "
<< duplicationRate_particle);

auto write_float = [&](float f, const char* name) {
auto writeFloat = [&](float f, const char* name) {
TVectorF v(1);
v[0] = f;
m_outputFile->WriteObject(&v, name);
Expand All @@ -135,12 +135,12 @@ ActsExamples::ProcessCode ActsExamples::CKFPerformanceWriter::finalize() {
m_fakeRatePlotTool.write(m_fakeRatePlotCache);
m_duplicationPlotTool.write(m_duplicationPlotCache);
m_trackSummaryPlotTool.write(m_trackSummaryPlotCache);
write_float(eff_tracks, "eff_tracks");
write_float(fakeRate_tracks, "fakerate_tracks");
write_float(duplicationRate_tracks, "duplicaterate_tracks");
write_float(eff_particle, "eff_particles");
write_float(fakeRate_particle, "fakerate_particles");
write_float(duplicationRate_particle, "duplicaterate_particles");
writeFloat(eff_tracks, "eff_tracks");
writeFloat(fakeRate_tracks, "fakerate_tracks");
writeFloat(duplicationRate_tracks, "duplicaterate_tracks");
writeFloat(eff_particle, "eff_particles");
writeFloat(fakeRate_particle, "fakerate_particles");
writeFloat(duplicationRate_particle, "duplicaterate_particles");

if (m_matchingTree != nullptr) {
m_matchingTree->Write();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <vector>

#include <TFile.h>
#include <TVectorT.h>

using Acts::VectorHelpers::eta;
using Acts::VectorHelpers::phi;
Expand Down Expand Up @@ -99,10 +100,20 @@ ActsExamples::ProcessCode ActsExamples::SeedingPerformanceWriter::finalize() {
"/ nMatchedParticles) = "
<< aveNDuplicatedSeeds);

auto writeFloat = [&](float f, const char* name) {
TVectorF v(1);
v[0] = f;
m_outputFile->WriteObject(&v, name);
};

if (m_outputFile != nullptr) {
m_outputFile->cd();
m_effPlotTool.write(m_effPlotCache);
m_duplicationPlotTool.write(m_duplicationPlotCache);
writeFloat(eff, "eff_seeds");
writeFloat(fakeRate, "fakerate_seeds");
writeFloat(duplicationRate, "duplicaterate_seeds");
writeFloat(totalSeedPurity, "purity_seeds");
ACTS_INFO("Wrote performance plots to '" << m_outputFile->GetPath() << "'");
}
return ProcessCode::SUCCESS;
Expand Down

0 comments on commit 0c36ca9

Please sign in to comment.