Skip to content

Commit

Permalink
refactor: Enhance RootTrackParameterWriter with residuals and pulls (
Browse files Browse the repository at this point in the history
…#3666)

A couple of improvements to the `RootTrackParameterWriter` for validation purposes.

- Write geometry ID
- Write parameter errors
- Write residuals and pulls
- Write truth matched particle ID
  • Loading branch information
andiwand authored Oct 1, 2024
1 parent 3fc1ae7 commit a09e118
Show file tree
Hide file tree
Showing 3 changed files with 262 additions and 109 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the Acts project.
//
// Copyright (C) 2017-2018 CERN for the benefit of the Acts project
// Copyright (C) 2017-2024 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -23,9 +23,6 @@

class TFile;
class TTree;
namespace ActsFatras {
class Barcode;
} // namespace ActsFatras

namespace ActsExamples {
struct AlgorithmContext;
Expand Down Expand Up @@ -95,29 +92,68 @@ class RootTrackParameterWriter final : public TrackParameterWriter {
ReadDataHandle<HitSimHitsMap> m_inputMeasurementSimHitsMap{
this, "InputMeasurementSimHitsMap"};

std::mutex m_writeMutex; ///< Mutex used to protect multi-threaded writes
TFile* m_outputFile{nullptr}; ///< The output file
TTree* m_outputTree{nullptr}; ///< The output tree
int m_eventNr{0}; ///< the event number of

float m_loc0{NaNfloat}; ///< loc0
float m_loc1{NaNfloat}; ///< loc1
float m_phi{NaNfloat}; ///< phi
float m_theta{NaNfloat}; ///< theta
float m_qop{NaNfloat}; ///< q/p
float m_time{NaNfloat}; ///< time
float m_p{NaNfloat}; ///< p
float m_pt{NaNfloat}; ///< pt
float m_eta{NaNfloat}; ///< eta

int m_t_charge{0}; ///< Truth particle charge
float m_t_loc0{NaNfloat}; ///< Truth parameter loc0
float m_t_loc1{NaNfloat}; ///< Truth parameter loc1
float m_t_phi{NaNfloat}; ///< Truth parameter phi
float m_t_theta{NaNfloat}; ///< Truth parameter theta
float m_t_qop{NaNfloat}; ///< Truth parameter qop
float m_t_time{NaNfloat}; ///< Truth parameter time
bool m_truthMatched = false; ///< Whether the seed is matched with truth
/// Mutex used to protect multi-threaded writes
std::mutex m_writeMutex;
TFile* m_outputFile{nullptr};
TTree* m_outputTree{nullptr};

int m_eventNr{0};

int m_volumeId{0};
int m_layerId{0};
int m_surfaceId{0};

// Track parameters
float m_loc0{NaNfloat};
float m_loc1{NaNfloat};
float m_phi{NaNfloat};
float m_theta{NaNfloat};
float m_qop{NaNfloat};
float m_time{NaNfloat};

float m_err_loc0{NaNfloat};
float m_err_loc1{NaNfloat};
float m_err_phi{NaNfloat};
float m_err_theta{NaNfloat};
float m_err_qop{NaNfloat};
float m_err_time{NaNfloat};

int m_charge{0};
float m_p{NaNfloat};
float m_pt{NaNfloat};
float m_eta{NaNfloat};

// Truth parameters
/// Whether the seed is matched with truth
bool m_t_matched{false};
std::uint64_t m_t_particleId{0};
unsigned int m_nMajorityHits{0};

float m_t_loc0{NaNfloat};
float m_t_loc1{NaNfloat};
float m_t_phi{NaNfloat};
float m_t_theta{NaNfloat};
float m_t_qop{NaNfloat};
float m_t_time{NaNfloat};

int m_t_charge{0};
float m_t_p{NaNfloat};
float m_t_pt{NaNfloat};
float m_t_eta{NaNfloat};

float m_res_loc0{NaNfloat};
float m_res_loc1{NaNfloat};
float m_res_phi{NaNfloat};
float m_res_theta{NaNfloat};
float m_res_qop{NaNfloat};
float m_res_time{NaNfloat};

float m_pull_loc0{NaNfloat};
float m_pull_loc1{NaNfloat};
float m_pull_phi{NaNfloat};
float m_pull_theta{NaNfloat};
float m_pull_qop{NaNfloat};
float m_pull_time{NaNfloat};
};

} // namespace ActsExamples
Loading

0 comments on commit a09e118

Please sign in to comment.