File indexing completed on 2025-01-18 09:11:59
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ActsExamples/Io/Root/RootTrackSummaryWriter.hpp"
0010
0011 #include "Acts/Definitions/TrackParametrization.hpp"
0012 #include "Acts/EventData/GenericBoundTrackParameters.hpp"
0013 #include "Acts/EventData/MultiTrajectoryHelpers.hpp"
0014 #include "Acts/EventData/VectorMultiTrajectory.hpp"
0015 #include "Acts/Surfaces/Surface.hpp"
0016 #include "Acts/TrackFitting/GsfOptions.hpp"
0017 #include "Acts/Utilities/Intersection.hpp"
0018 #include "Acts/Utilities/MultiIndex.hpp"
0019 #include "Acts/Utilities/Result.hpp"
0020 #include "Acts/Utilities/detail/periodic.hpp"
0021 #include "ActsExamples/EventData/IndexSourceLink.hpp"
0022 #include "ActsExamples/EventData/TruthMatching.hpp"
0023 #include "ActsExamples/Framework/AlgorithmContext.hpp"
0024 #include "ActsExamples/Framework/WriterT.hpp"
0025 #include "ActsExamples/Validation/TrackClassification.hpp"
0026 #include "ActsFatras/EventData/Barcode.hpp"
0027 #include "ActsFatras/EventData/Particle.hpp"
0028
0029 #include <array>
0030 #include <cmath>
0031 #include <cstddef>
0032 #include <cstdint>
0033 #include <ios>
0034 #include <limits>
0035 #include <memory>
0036 #include <numbers>
0037 #include <optional>
0038 #include <ostream>
0039 #include <stdexcept>
0040
0041 #include <TFile.h>
0042 #include <TTree.h>
0043
0044 using Acts::VectorHelpers::eta;
0045 using Acts::VectorHelpers::perp;
0046 using Acts::VectorHelpers::phi;
0047 using Acts::VectorHelpers::theta;
0048
0049 namespace ActsExamples {
0050
0051 RootTrackSummaryWriter::RootTrackSummaryWriter(
0052 const RootTrackSummaryWriter::Config& config, Acts::Logging::Level level)
0053 : WriterT(config.inputTracks, "RootTrackSummaryWriter", level),
0054 m_cfg(config) {
0055
0056 if (m_cfg.filePath.empty()) {
0057 throw std::invalid_argument("Missing output filename");
0058 }
0059 if (m_cfg.treeName.empty()) {
0060 throw std::invalid_argument("Missing tree name");
0061 }
0062
0063 m_inputParticles.maybeInitialize(m_cfg.inputParticles);
0064 m_inputTrackParticleMatching.maybeInitialize(
0065 m_cfg.inputTrackParticleMatching);
0066
0067
0068 auto path = m_cfg.filePath;
0069 m_outputFile = TFile::Open(path.c_str(), m_cfg.fileMode.c_str());
0070 if (m_outputFile == nullptr) {
0071 throw std::ios_base::failure("Could not open '" + path + "'");
0072 }
0073 m_outputFile->cd();
0074 m_outputTree = new TTree(m_cfg.treeName.c_str(), m_cfg.treeName.c_str());
0075 if (m_outputTree == nullptr) {
0076 throw std::bad_alloc();
0077 }
0078
0079
0080 m_outputTree->Branch("event_nr", &m_eventNr);
0081 m_outputTree->Branch("track_nr", &m_trackNr);
0082
0083 m_outputTree->Branch("nStates", &m_nStates);
0084 m_outputTree->Branch("nMeasurements", &m_nMeasurements);
0085 m_outputTree->Branch("nOutliers", &m_nOutliers);
0086 m_outputTree->Branch("nHoles", &m_nHoles);
0087 m_outputTree->Branch("nSharedHits", &m_nSharedHits);
0088 m_outputTree->Branch("chi2Sum", &m_chi2Sum);
0089 m_outputTree->Branch("NDF", &m_NDF);
0090 m_outputTree->Branch("measurementChi2", &m_measurementChi2);
0091 m_outputTree->Branch("outlierChi2", &m_outlierChi2);
0092 m_outputTree->Branch("measurementVolume", &m_measurementVolume);
0093 m_outputTree->Branch("measurementLayer", &m_measurementLayer);
0094 m_outputTree->Branch("outlierVolume", &m_outlierVolume);
0095 m_outputTree->Branch("outlierLayer", &m_outlierLayer);
0096
0097 m_outputTree->Branch("nMajorityHits", &m_nMajorityHits);
0098 m_outputTree->Branch("majorityParticleId", &m_majorityParticleId);
0099 m_outputTree->Branch("trackClassification", &m_trackClassification);
0100 m_outputTree->Branch("t_charge", &m_t_charge);
0101 m_outputTree->Branch("t_time", &m_t_time);
0102 m_outputTree->Branch("t_vx", &m_t_vx);
0103 m_outputTree->Branch("t_vy", &m_t_vy);
0104 m_outputTree->Branch("t_vz", &m_t_vz);
0105 m_outputTree->Branch("t_px", &m_t_px);
0106 m_outputTree->Branch("t_py", &m_t_py);
0107 m_outputTree->Branch("t_pz", &m_t_pz);
0108 m_outputTree->Branch("t_theta", &m_t_theta);
0109 m_outputTree->Branch("t_phi", &m_t_phi);
0110 m_outputTree->Branch("t_eta", &m_t_eta);
0111 m_outputTree->Branch("t_p", &m_t_p);
0112 m_outputTree->Branch("t_pT", &m_t_pT);
0113 m_outputTree->Branch("t_d0", &m_t_d0);
0114 m_outputTree->Branch("t_z0", &m_t_z0);
0115
0116 m_outputTree->Branch("hasFittedParams", &m_hasFittedParams);
0117 m_outputTree->Branch("eLOC0_fit", &m_eLOC0_fit);
0118 m_outputTree->Branch("eLOC1_fit", &m_eLOC1_fit);
0119 m_outputTree->Branch("ePHI_fit", &m_ePHI_fit);
0120 m_outputTree->Branch("eTHETA_fit", &m_eTHETA_fit);
0121 m_outputTree->Branch("eQOP_fit", &m_eQOP_fit);
0122 m_outputTree->Branch("eT_fit", &m_eT_fit);
0123 m_outputTree->Branch("err_eLOC0_fit", &m_err_eLOC0_fit);
0124 m_outputTree->Branch("err_eLOC1_fit", &m_err_eLOC1_fit);
0125 m_outputTree->Branch("err_ePHI_fit", &m_err_ePHI_fit);
0126 m_outputTree->Branch("err_eTHETA_fit", &m_err_eTHETA_fit);
0127 m_outputTree->Branch("err_eQOP_fit", &m_err_eQOP_fit);
0128 m_outputTree->Branch("err_eT_fit", &m_err_eT_fit);
0129 m_outputTree->Branch("res_eLOC0_fit", &m_res_eLOC0_fit);
0130 m_outputTree->Branch("res_eLOC1_fit", &m_res_eLOC1_fit);
0131 m_outputTree->Branch("res_ePHI_fit", &m_res_ePHI_fit);
0132 m_outputTree->Branch("res_eTHETA_fit", &m_res_eTHETA_fit);
0133 m_outputTree->Branch("res_eQOP_fit", &m_res_eQOP_fit);
0134 m_outputTree->Branch("res_eT_fit", &m_res_eT_fit);
0135 m_outputTree->Branch("pull_eLOC0_fit", &m_pull_eLOC0_fit);
0136 m_outputTree->Branch("pull_eLOC1_fit", &m_pull_eLOC1_fit);
0137 m_outputTree->Branch("pull_ePHI_fit", &m_pull_ePHI_fit);
0138 m_outputTree->Branch("pull_eTHETA_fit", &m_pull_eTHETA_fit);
0139 m_outputTree->Branch("pull_eQOP_fit", &m_pull_eQOP_fit);
0140 m_outputTree->Branch("pull_eT_fit", &m_pull_eT_fit);
0141
0142 if (m_cfg.writeGsfSpecific) {
0143 m_outputTree->Branch("max_material_fwd", &m_gsf_max_material_fwd);
0144 m_outputTree->Branch("sum_material_fwd", &m_gsf_sum_material_fwd);
0145 }
0146
0147 if (m_cfg.writeCovMat) {
0148
0149
0150 m_outputTree->Branch("cov_eLOC0_eLOC0", &m_cov_eLOC0_eLOC0);
0151 m_outputTree->Branch("cov_eLOC0_eLOC1", &m_cov_eLOC0_eLOC1);
0152 m_outputTree->Branch("cov_eLOC0_ePHI", &m_cov_eLOC0_ePHI);
0153 m_outputTree->Branch("cov_eLOC0_eTHETA", &m_cov_eLOC0_eTHETA);
0154 m_outputTree->Branch("cov_eLOC0_eQOP", &m_cov_eLOC0_eQOP);
0155 m_outputTree->Branch("cov_eLOC0_eT", &m_cov_eLOC0_eT);
0156
0157 m_outputTree->Branch("cov_eLOC1_eLOC0", &m_cov_eLOC1_eLOC0);
0158 m_outputTree->Branch("cov_eLOC1_eLOC1", &m_cov_eLOC1_eLOC1);
0159 m_outputTree->Branch("cov_eLOC1_ePHI", &m_cov_eLOC1_ePHI);
0160 m_outputTree->Branch("cov_eLOC1_eTHETA", &m_cov_eLOC1_eTHETA);
0161 m_outputTree->Branch("cov_eLOC1_eQOP", &m_cov_eLOC1_eQOP);
0162 m_outputTree->Branch("cov_eLOC1_eT", &m_cov_eLOC1_eT);
0163
0164 m_outputTree->Branch("cov_ePHI_eLOC0", &m_cov_ePHI_eLOC0);
0165 m_outputTree->Branch("cov_ePHI_eLOC1", &m_cov_ePHI_eLOC1);
0166 m_outputTree->Branch("cov_ePHI_ePHI", &m_cov_ePHI_ePHI);
0167 m_outputTree->Branch("cov_ePHI_eTHETA", &m_cov_ePHI_eTHETA);
0168 m_outputTree->Branch("cov_ePHI_eQOP", &m_cov_ePHI_eQOP);
0169 m_outputTree->Branch("cov_ePHI_eT", &m_cov_ePHI_eT);
0170
0171 m_outputTree->Branch("cov_eTHETA_eLOC0", &m_cov_eTHETA_eLOC0);
0172 m_outputTree->Branch("cov_eTHETA_eLOC1", &m_cov_eTHETA_eLOC1);
0173 m_outputTree->Branch("cov_eTHETA_ePHI", &m_cov_eTHETA_ePHI);
0174 m_outputTree->Branch("cov_eTHETA_eTHETA", &m_cov_eTHETA_eTHETA);
0175 m_outputTree->Branch("cov_eTHETA_eQOP", &m_cov_eTHETA_eQOP);
0176 m_outputTree->Branch("cov_eTHETA_eT", &m_cov_eTHETA_eT);
0177
0178 m_outputTree->Branch("cov_eQOP_eLOC0", &m_cov_eQOP_eLOC0);
0179 m_outputTree->Branch("cov_eQOP_eLOC1", &m_cov_eQOP_eLOC1);
0180 m_outputTree->Branch("cov_eQOP_ePHI", &m_cov_eQOP_ePHI);
0181 m_outputTree->Branch("cov_eQOP_eTHETA", &m_cov_eQOP_eTHETA);
0182 m_outputTree->Branch("cov_eQOP_eQOP", &m_cov_eQOP_eQOP);
0183 m_outputTree->Branch("cov_eQOP_eT", &m_cov_eQOP_eT);
0184
0185 m_outputTree->Branch("cov_eT_eLOC0", &m_cov_eT_eLOC0);
0186 m_outputTree->Branch("cov_eT_eLOC1", &m_cov_eT_eLOC1);
0187 m_outputTree->Branch("cov_eT_ePHI", &m_cov_eT_ePHI);
0188 m_outputTree->Branch("cov_eT_eTHETA", &m_cov_eT_eTHETA);
0189 m_outputTree->Branch("cov_eT_eQOP", &m_cov_eT_eQOP);
0190 m_outputTree->Branch("cov_eT_eT", &m_cov_eT_eT);
0191 }
0192
0193 if (m_cfg.writeGx2fSpecific) {
0194 m_outputTree->Branch("nUpdatesGx2f", &m_nUpdatesGx2f);
0195 }
0196 }
0197
0198 RootTrackSummaryWriter::~RootTrackSummaryWriter() {
0199 m_outputFile->Close();
0200 }
0201
0202 ProcessCode RootTrackSummaryWriter::finalize() {
0203 m_outputFile->cd();
0204 m_outputTree->Write();
0205 m_outputFile->Close();
0206
0207 if (m_cfg.writeCovMat) {
0208 ACTS_INFO("Wrote full covariance matrix to tree");
0209 }
0210 ACTS_INFO("Wrote parameters of tracks to tree '" << m_cfg.treeName << "' in '"
0211 << m_cfg.filePath << "'");
0212
0213 return ProcessCode::SUCCESS;
0214 }
0215
0216 ProcessCode RootTrackSummaryWriter::writeT(const AlgorithmContext& ctx,
0217 const ConstTrackContainer& tracks) {
0218
0219 const static SimParticleContainer emptyParticles;
0220 const static TrackParticleMatching emptyTrackParticleMatching;
0221
0222 const auto& particles =
0223 m_inputParticles.isInitialized() ? m_inputParticles(ctx) : emptyParticles;
0224 const auto& trackParticleMatching =
0225 m_inputTrackParticleMatching.isInitialized()
0226 ? m_inputTrackParticleMatching(ctx)
0227 : emptyTrackParticleMatching;
0228
0229
0230 std::vector<ParticleHitCount> particleHitCounts;
0231
0232
0233 std::lock_guard<std::mutex> lock(m_writeMutex);
0234
0235
0236 m_eventNr = ctx.eventNumber;
0237
0238 for (const auto& track : tracks) {
0239 m_trackNr.push_back(track.index());
0240
0241
0242 m_nStates.push_back(track.nTrackStates());
0243 m_nMeasurements.push_back(track.nMeasurements());
0244 m_nOutliers.push_back(track.nOutliers());
0245 m_nHoles.push_back(track.nHoles());
0246 m_nSharedHits.push_back(track.nSharedHits());
0247 m_chi2Sum.push_back(track.chi2());
0248 m_NDF.push_back(track.nDoF());
0249
0250 {
0251 std::vector<double> measurementChi2;
0252 std::vector<std::uint32_t> measurementVolume;
0253 std::vector<std::uint32_t> measurementLayer;
0254 std::vector<double> outlierChi2;
0255 std::vector<std::uint32_t> outlierVolume;
0256 std::vector<std::uint32_t> outlierLayer;
0257 for (const auto& state : track.trackStatesReversed()) {
0258 const auto& geoID = state.referenceSurface().geometryId();
0259 const auto& volume = geoID.volume();
0260 const auto& layer = geoID.layer();
0261 if (state.typeFlags().test(Acts::TrackStateFlag::OutlierFlag)) {
0262 outlierChi2.push_back(state.chi2());
0263 outlierVolume.push_back(volume);
0264 outlierLayer.push_back(layer);
0265 } else if (state.typeFlags().test(
0266 Acts::TrackStateFlag::MeasurementFlag)) {
0267 measurementChi2.push_back(state.chi2());
0268 measurementVolume.push_back(volume);
0269 measurementLayer.push_back(layer);
0270 }
0271 }
0272 m_measurementChi2.push_back(std::move(measurementChi2));
0273 m_measurementVolume.push_back(std::move(measurementVolume));
0274 m_measurementLayer.push_back(std::move(measurementLayer));
0275 m_outlierChi2.push_back(std::move(outlierChi2));
0276 m_outlierVolume.push_back(std::move(outlierVolume));
0277 m_outlierLayer.push_back(std::move(outlierLayer));
0278 }
0279
0280
0281 ActsFatras::Barcode majorityParticleId(
0282 std::numeric_limits<std::size_t>::max());
0283 TrackMatchClassification trackClassification =
0284 TrackMatchClassification::Unknown;
0285 unsigned int nMajorityHits = std::numeric_limits<unsigned int>::max();
0286 int t_charge = std::numeric_limits<int>::max();
0287 float t_time = NaNfloat;
0288 float t_vx = NaNfloat;
0289 float t_vy = NaNfloat;
0290 float t_vz = NaNfloat;
0291 float t_px = NaNfloat;
0292 float t_py = NaNfloat;
0293 float t_pz = NaNfloat;
0294 float t_theta = NaNfloat;
0295 float t_phi = NaNfloat;
0296 float t_eta = NaNfloat;
0297 float t_p = NaNfloat;
0298 float t_pT = NaNfloat;
0299 float t_d0 = NaNfloat;
0300 float t_z0 = NaNfloat;
0301 float t_qop = NaNfloat;
0302
0303
0304 const Acts::Surface* pSurface =
0305 track.hasReferenceSurface() ? &track.referenceSurface() : nullptr;
0306
0307
0308 auto match = trackParticleMatching.find(track.index());
0309 bool foundMajorityParticle = false;
0310
0311 if (match != trackParticleMatching.end() &&
0312 match->second.particle.has_value()) {
0313
0314 majorityParticleId = match->second.particle.value();
0315 trackClassification = match->second.classification;
0316 nMajorityHits = match->second.contributingParticles.front().hitCount;
0317
0318
0319 auto ip = particles.find(majorityParticleId);
0320 if (ip != particles.end()) {
0321 foundMajorityParticle = true;
0322
0323 const auto& particle = *ip;
0324 ACTS_VERBOSE("Find the truth particle with barcode "
0325 << majorityParticleId << "="
0326 << majorityParticleId.value());
0327
0328 t_p = particle.absoluteMomentum();
0329 t_charge = static_cast<int>(particle.charge());
0330 t_time = particle.time();
0331 t_vx = particle.position().x();
0332 t_vy = particle.position().y();
0333 t_vz = particle.position().z();
0334 t_px = t_p * particle.direction().x();
0335 t_py = t_p * particle.direction().y();
0336 t_pz = t_p * particle.direction().z();
0337 t_theta = theta(particle.direction());
0338 t_phi = phi(particle.direction());
0339 t_eta = eta(particle.direction());
0340 t_pT = t_p * perp(particle.direction());
0341 t_qop = particle.qOverP();
0342
0343 if (pSurface != nullptr) {
0344 auto intersection =
0345 pSurface
0346 ->intersect(ctx.geoContext, particle.position(),
0347 particle.direction(),
0348 Acts::BoundaryTolerance::Infinite())
0349 .closest();
0350 auto position = intersection.position();
0351
0352
0353 auto lpResult = pSurface->globalToLocal(ctx.geoContext, position,
0354 particle.direction());
0355 if (lpResult.ok()) {
0356 t_d0 = lpResult.value()[Acts::BoundIndices::eBoundLoc0];
0357 t_z0 = lpResult.value()[Acts::BoundIndices::eBoundLoc1];
0358 } else {
0359 ACTS_ERROR("Global to local transformation did not succeed.");
0360 }
0361 }
0362 } else {
0363 ACTS_DEBUG("Truth particle with barcode "
0364 << majorityParticleId << "=" << majorityParticleId.value()
0365 << " not found in the input collection!");
0366 }
0367 }
0368 if (!foundMajorityParticle) {
0369 ACTS_DEBUG("Truth particle for track " << track.tipIndex()
0370 << " not found!");
0371 }
0372
0373
0374
0375 m_majorityParticleId.push_back(majorityParticleId.value());
0376 m_trackClassification.push_back(static_cast<int>(trackClassification));
0377 m_nMajorityHits.push_back(nMajorityHits);
0378 m_t_charge.push_back(t_charge);
0379 m_t_time.push_back(t_time);
0380 m_t_vx.push_back(t_vx);
0381 m_t_vy.push_back(t_vy);
0382 m_t_vz.push_back(t_vz);
0383 m_t_px.push_back(t_px);
0384 m_t_py.push_back(t_py);
0385 m_t_pz.push_back(t_pz);
0386 m_t_theta.push_back(t_theta);
0387 m_t_phi.push_back(t_phi);
0388 m_t_eta.push_back(t_eta);
0389 m_t_p.push_back(t_p);
0390 m_t_pT.push_back(t_pT);
0391 m_t_d0.push_back(t_d0);
0392 m_t_z0.push_back(t_z0);
0393
0394
0395 std::array<float, Acts::eBoundSize> param = {NaNfloat, NaNfloat, NaNfloat,
0396 NaNfloat, NaNfloat, NaNfloat};
0397 std::array<float, Acts::eBoundSize> error = {NaNfloat, NaNfloat, NaNfloat,
0398 NaNfloat, NaNfloat, NaNfloat};
0399
0400
0401 auto getCov = [&](auto i, auto j) { return track.covariance()(i, j); };
0402
0403 bool hasFittedParams = track.hasReferenceSurface();
0404 if (hasFittedParams) {
0405 const auto& parameter = track.parameters();
0406 for (unsigned int i = 0; i < Acts::eBoundSize; ++i) {
0407 param[i] = parameter[i];
0408 }
0409
0410 const auto& covariance = track.covariance();
0411 for (unsigned int i = 0; i < Acts::eBoundSize; ++i) {
0412 error[i] = std::sqrt(covariance(i, i));
0413 }
0414 }
0415
0416 std::array<float, Acts::eBoundSize> res = {NaNfloat, NaNfloat, NaNfloat,
0417 NaNfloat, NaNfloat, NaNfloat};
0418 std::array<float, Acts::eBoundSize> pull = {NaNfloat, NaNfloat, NaNfloat,
0419 NaNfloat, NaNfloat, NaNfloat};
0420 if (foundMajorityParticle && hasFittedParams) {
0421 res = {param[Acts::eBoundLoc0] - t_d0,
0422 param[Acts::eBoundLoc1] - t_z0,
0423 Acts::detail::difference_periodic(
0424 param[Acts::eBoundPhi], t_phi,
0425 static_cast<float>(2 * std::numbers::pi)),
0426 param[Acts::eBoundTheta] - t_theta,
0427 param[Acts::eBoundQOverP] - t_qop,
0428 param[Acts::eBoundTime] - t_time};
0429
0430 for (unsigned int i = 0; i < Acts::eBoundSize; ++i) {
0431 pull[i] = res[i] / error[i];
0432 }
0433 }
0434
0435
0436
0437 m_eLOC0_fit.push_back(param[Acts::eBoundLoc0]);
0438 m_eLOC1_fit.push_back(param[Acts::eBoundLoc1]);
0439 m_ePHI_fit.push_back(param[Acts::eBoundPhi]);
0440 m_eTHETA_fit.push_back(param[Acts::eBoundTheta]);
0441 m_eQOP_fit.push_back(param[Acts::eBoundQOverP]);
0442 m_eT_fit.push_back(param[Acts::eBoundTime]);
0443
0444 m_res_eLOC0_fit.push_back(res[Acts::eBoundLoc0]);
0445 m_res_eLOC1_fit.push_back(res[Acts::eBoundLoc1]);
0446 m_res_ePHI_fit.push_back(res[Acts::eBoundPhi]);
0447 m_res_eTHETA_fit.push_back(res[Acts::eBoundTheta]);
0448 m_res_eQOP_fit.push_back(res[Acts::eBoundQOverP]);
0449 m_res_eT_fit.push_back(res[Acts::eBoundTime]);
0450
0451 m_err_eLOC0_fit.push_back(error[Acts::eBoundLoc0]);
0452 m_err_eLOC1_fit.push_back(error[Acts::eBoundLoc1]);
0453 m_err_ePHI_fit.push_back(error[Acts::eBoundPhi]);
0454 m_err_eTHETA_fit.push_back(error[Acts::eBoundTheta]);
0455 m_err_eQOP_fit.push_back(error[Acts::eBoundQOverP]);
0456 m_err_eT_fit.push_back(error[Acts::eBoundTime]);
0457
0458 m_pull_eLOC0_fit.push_back(pull[Acts::eBoundLoc0]);
0459 m_pull_eLOC1_fit.push_back(pull[Acts::eBoundLoc1]);
0460 m_pull_ePHI_fit.push_back(pull[Acts::eBoundPhi]);
0461 m_pull_eTHETA_fit.push_back(pull[Acts::eBoundTheta]);
0462 m_pull_eQOP_fit.push_back(pull[Acts::eBoundQOverP]);
0463 m_pull_eT_fit.push_back(pull[Acts::eBoundTime]);
0464
0465 m_hasFittedParams.push_back(hasFittedParams);
0466
0467 if (m_cfg.writeGsfSpecific) {
0468 using namespace Acts::GsfConstants;
0469 if (tracks.hasColumn(Acts::hashString(kFwdMaxMaterialXOverX0))) {
0470 m_gsf_max_material_fwd.push_back(
0471 track.template component<double>(kFwdMaxMaterialXOverX0));
0472 } else {
0473 m_gsf_max_material_fwd.push_back(NaNfloat);
0474 }
0475
0476 if (tracks.hasColumn(Acts::hashString(kFwdSumMaterialXOverX0))) {
0477 m_gsf_sum_material_fwd.push_back(
0478 track.template component<double>(kFwdSumMaterialXOverX0));
0479 } else {
0480 m_gsf_sum_material_fwd.push_back(NaNfloat);
0481 }
0482 }
0483
0484 if (m_cfg.writeCovMat) {
0485
0486
0487 m_cov_eLOC0_eLOC0.push_back(getCov(0, 0));
0488 m_cov_eLOC0_eLOC1.push_back(getCov(0, 1));
0489 m_cov_eLOC0_ePHI.push_back(getCov(0, 2));
0490 m_cov_eLOC0_eTHETA.push_back(getCov(0, 3));
0491 m_cov_eLOC0_eQOP.push_back(getCov(0, 4));
0492 m_cov_eLOC0_eT.push_back(getCov(0, 5));
0493
0494 m_cov_eLOC1_eLOC0.push_back(getCov(1, 0));
0495 m_cov_eLOC1_eLOC1.push_back(getCov(1, 1));
0496 m_cov_eLOC1_ePHI.push_back(getCov(1, 2));
0497 m_cov_eLOC1_eTHETA.push_back(getCov(1, 3));
0498 m_cov_eLOC1_eQOP.push_back(getCov(1, 4));
0499 m_cov_eLOC1_eT.push_back(getCov(1, 5));
0500
0501 m_cov_ePHI_eLOC0.push_back(getCov(2, 0));
0502 m_cov_ePHI_eLOC1.push_back(getCov(2, 1));
0503 m_cov_ePHI_ePHI.push_back(getCov(2, 2));
0504 m_cov_ePHI_eTHETA.push_back(getCov(2, 3));
0505 m_cov_ePHI_eQOP.push_back(getCov(2, 4));
0506 m_cov_ePHI_eT.push_back(getCov(2, 5));
0507
0508 m_cov_eTHETA_eLOC0.push_back(getCov(3, 0));
0509 m_cov_eTHETA_eLOC1.push_back(getCov(3, 1));
0510 m_cov_eTHETA_ePHI.push_back(getCov(3, 2));
0511 m_cov_eTHETA_eTHETA.push_back(getCov(3, 3));
0512 m_cov_eTHETA_eQOP.push_back(getCov(3, 4));
0513 m_cov_eTHETA_eT.push_back(getCov(3, 5));
0514
0515 m_cov_eQOP_eLOC0.push_back(getCov(4, 0));
0516 m_cov_eQOP_eLOC1.push_back(getCov(4, 1));
0517 m_cov_eQOP_ePHI.push_back(getCov(4, 2));
0518 m_cov_eQOP_eTHETA.push_back(getCov(4, 3));
0519 m_cov_eQOP_eQOP.push_back(getCov(4, 4));
0520 m_cov_eQOP_eT.push_back(getCov(4, 5));
0521
0522 m_cov_eT_eLOC0.push_back(getCov(5, 0));
0523 m_cov_eT_eLOC1.push_back(getCov(5, 1));
0524 m_cov_eT_ePHI.push_back(getCov(5, 2));
0525 m_cov_eT_eTHETA.push_back(getCov(5, 3));
0526 m_cov_eT_eQOP.push_back(getCov(5, 4));
0527 m_cov_eT_eT.push_back(getCov(5, 5));
0528 }
0529
0530 if (m_cfg.writeGx2fSpecific) {
0531 if (tracks.hasColumn(Acts::hashString("Gx2fnUpdateColumn"))) {
0532 int nUpdate = static_cast<int>(
0533 track.template component<std::uint32_t,
0534 Acts::hashString("Gx2fnUpdateColumn")>());
0535 m_nUpdatesGx2f.push_back(nUpdate);
0536 } else {
0537 m_nUpdatesGx2f.push_back(-1);
0538 }
0539 }
0540 }
0541
0542
0543 m_outputTree->Fill();
0544
0545 m_trackNr.clear();
0546 m_nStates.clear();
0547 m_nMeasurements.clear();
0548 m_nOutliers.clear();
0549 m_nHoles.clear();
0550 m_nSharedHits.clear();
0551 m_chi2Sum.clear();
0552 m_NDF.clear();
0553 m_measurementChi2.clear();
0554 m_outlierChi2.clear();
0555 m_measurementVolume.clear();
0556 m_measurementLayer.clear();
0557 m_outlierVolume.clear();
0558 m_outlierLayer.clear();
0559
0560 m_nMajorityHits.clear();
0561 m_majorityParticleId.clear();
0562 m_trackClassification.clear();
0563 m_t_charge.clear();
0564 m_t_time.clear();
0565 m_t_vx.clear();
0566 m_t_vy.clear();
0567 m_t_vz.clear();
0568 m_t_px.clear();
0569 m_t_py.clear();
0570 m_t_pz.clear();
0571 m_t_theta.clear();
0572 m_t_phi.clear();
0573 m_t_p.clear();
0574 m_t_pT.clear();
0575 m_t_eta.clear();
0576 m_t_d0.clear();
0577 m_t_z0.clear();
0578
0579 m_hasFittedParams.clear();
0580 m_eLOC0_fit.clear();
0581 m_eLOC1_fit.clear();
0582 m_ePHI_fit.clear();
0583 m_eTHETA_fit.clear();
0584 m_eQOP_fit.clear();
0585 m_eT_fit.clear();
0586 m_err_eLOC0_fit.clear();
0587 m_err_eLOC1_fit.clear();
0588 m_err_ePHI_fit.clear();
0589 m_err_eTHETA_fit.clear();
0590 m_err_eQOP_fit.clear();
0591 m_err_eT_fit.clear();
0592 m_res_eLOC0_fit.clear();
0593 m_res_eLOC1_fit.clear();
0594 m_res_ePHI_fit.clear();
0595 m_res_eTHETA_fit.clear();
0596 m_res_eQOP_fit.clear();
0597 m_res_eT_fit.clear();
0598 m_pull_eLOC0_fit.clear();
0599 m_pull_eLOC1_fit.clear();
0600 m_pull_ePHI_fit.clear();
0601 m_pull_eTHETA_fit.clear();
0602 m_pull_eQOP_fit.clear();
0603 m_pull_eT_fit.clear();
0604
0605 m_gsf_max_material_fwd.clear();
0606 m_gsf_sum_material_fwd.clear();
0607
0608 if (m_cfg.writeCovMat) {
0609 m_cov_eLOC0_eLOC0.clear();
0610 m_cov_eLOC0_eLOC1.clear();
0611 m_cov_eLOC0_ePHI.clear();
0612 m_cov_eLOC0_eTHETA.clear();
0613 m_cov_eLOC0_eQOP.clear();
0614 m_cov_eLOC0_eT.clear();
0615
0616 m_cov_eLOC1_eLOC0.clear();
0617 m_cov_eLOC1_eLOC1.clear();
0618 m_cov_eLOC1_ePHI.clear();
0619 m_cov_eLOC1_eTHETA.clear();
0620 m_cov_eLOC1_eQOP.clear();
0621 m_cov_eLOC1_eT.clear();
0622
0623 m_cov_ePHI_eLOC0.clear();
0624 m_cov_ePHI_eLOC1.clear();
0625 m_cov_ePHI_ePHI.clear();
0626 m_cov_ePHI_eTHETA.clear();
0627 m_cov_ePHI_eQOP.clear();
0628 m_cov_ePHI_eT.clear();
0629
0630 m_cov_eTHETA_eLOC0.clear();
0631 m_cov_eTHETA_eLOC1.clear();
0632 m_cov_eTHETA_ePHI.clear();
0633 m_cov_eTHETA_eTHETA.clear();
0634 m_cov_eTHETA_eQOP.clear();
0635 m_cov_eTHETA_eT.clear();
0636
0637 m_cov_eQOP_eLOC0.clear();
0638 m_cov_eQOP_eLOC1.clear();
0639 m_cov_eQOP_ePHI.clear();
0640 m_cov_eQOP_eTHETA.clear();
0641 m_cov_eQOP_eQOP.clear();
0642 m_cov_eQOP_eT.clear();
0643
0644 m_cov_eT_eLOC0.clear();
0645 m_cov_eT_eLOC1.clear();
0646 m_cov_eT_ePHI.clear();
0647 m_cov_eT_eTHETA.clear();
0648 m_cov_eT_eQOP.clear();
0649 m_cov_eT_eT.clear();
0650 }
0651
0652 m_nUpdatesGx2f.clear();
0653
0654 return ProcessCode::SUCCESS;
0655 }
0656
0657 }