forked from acts-project/acts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Replace
ParticleSmearing
with TrackParameterSmearing
in…
… Examples (acts-project#3784) - extract track parameters from particles - replace `ParticleSmearing` with `TrackParameterSmearing` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced `TrackParameterSmearing` and `ParticleTrackParamExtractor` classes for enhanced track parameter processing. - Updated smearing configurations and parameters to improve clarity and usability. - Enhanced Python bindings for various generator classes, allowing for customizable event generation. - **Bug Fixes** - Adjusted logging levels for new algorithms to ensure appropriate verbosity. - **Documentation** - Updated comments and documentation to reflect changes in parameter names and functionalities. - **Chores** - Removed deprecated `ParticleSmearing` algorithm and associated files from the project. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
23 changed files
with
471 additions
and
331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
158 changes: 0 additions & 158 deletions
158
Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleTrackParamExtractor.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// This file is part of the ACTS project. | ||
// | ||
// Copyright (C) 2016 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 | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
#include "ActsExamples/TruthTracking/ParticleTrackParamExtractor.hpp" | ||
|
||
#include "Acts/Surfaces/PerigeeSurface.hpp" | ||
#include "ActsExamples/EventData/SimParticle.hpp" | ||
#include "ActsExamples/Framework/AlgorithmContext.hpp" | ||
|
||
#include <stdexcept> | ||
#include <utility> | ||
|
||
namespace ActsExamples { | ||
|
||
ParticleTrackParamExtractor::ParticleTrackParamExtractor( | ||
const Config& config, Acts::Logging::Level level) | ||
: IAlgorithm("ParticleTrackParamExtractor", level), m_cfg(config) { | ||
if (m_cfg.inputParticles.empty()) { | ||
throw std::invalid_argument("Missing input particles collection"); | ||
} | ||
if (m_cfg.outputTrackParameters.empty()) { | ||
throw std::invalid_argument("Missing output track parameters collection"); | ||
} | ||
|
||
m_inputParticles.initialize(m_cfg.inputParticles); | ||
m_outputTrackParameters.initialize(m_cfg.outputTrackParameters); | ||
} | ||
|
||
ActsExamples::ProcessCode ParticleTrackParamExtractor::execute( | ||
const AlgorithmContext& ctx) const { | ||
const SimParticleContainer& particles = m_inputParticles(ctx); | ||
|
||
std::unordered_map<SimBarcode, std::shared_ptr<Acts::PerigeeSurface>> | ||
perigeeSurfaces; | ||
|
||
for (auto&& [vtxId, vtxParticles] : groupBySecondaryVertex(particles)) { | ||
// a group contains at least one particle by construction. assume that all | ||
// particles within the group originate from the same position and use it | ||
// to as the reference position for the perigee frame. | ||
auto perigee = Acts::Surface::makeShared<Acts::PerigeeSurface>( | ||
vtxParticles.begin()->position()); | ||
perigeeSurfaces[vtxId] = perigee; | ||
} | ||
|
||
// create track parameters from the particles | ||
TrackParametersContainer trackParameters; | ||
|
||
for (const auto& particle : particles) { | ||
const auto vtxId = particle.particleId().vertexId(); | ||
const auto particleHypothesis = particle.hypothesis(); | ||
const auto phi = Acts::VectorHelpers::phi(particle.direction()); | ||
const auto theta = Acts::VectorHelpers::theta(particle.direction()); | ||
const auto qOverP = particle.qOverP(); | ||
const auto time = particle.time(); | ||
|
||
trackParameters.emplace_back( | ||
perigeeSurfaces.at(vtxId), | ||
Acts::BoundVector{0, 0, phi, theta, qOverP, time}, std::nullopt, | ||
particleHypothesis); | ||
} | ||
|
||
m_outputTrackParameters(ctx, std::move(trackParameters)); | ||
|
||
return ProcessCode::SUCCESS; | ||
} | ||
|
||
} // namespace ActsExamples |
48 changes: 48 additions & 0 deletions
48
Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleTrackParamExtractor.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// This file is part of the ACTS project. | ||
// | ||
// Copyright (C) 2016 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 | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include "Acts/Utilities/Logger.hpp" | ||
#include "ActsExamples/EventData/SimParticle.hpp" | ||
#include "ActsExamples/EventData/Track.hpp" | ||
#include "ActsExamples/Framework/DataHandle.hpp" | ||
#include "ActsExamples/Framework/IAlgorithm.hpp" | ||
#include "ActsExamples/Framework/ProcessCode.hpp" | ||
|
||
#include <string> | ||
|
||
namespace ActsExamples { | ||
struct AlgorithmContext; | ||
|
||
/// Extract track parameters from particles. | ||
class ParticleTrackParamExtractor final : public IAlgorithm { | ||
public: | ||
struct Config { | ||
/// The input particles collection. | ||
std::string inputParticles; | ||
/// The output track parameters collection. | ||
std::string outputTrackParameters; | ||
}; | ||
|
||
ParticleTrackParamExtractor(const Config& config, Acts::Logging::Level level); | ||
|
||
ProcessCode execute(const AlgorithmContext& ctx) const final; | ||
|
||
/// Get readonly access to the config parameters | ||
const Config& config() const { return m_cfg; } | ||
|
||
private: | ||
Config m_cfg; | ||
|
||
ReadDataHandle<SimParticleContainer> m_inputParticles{this, "InputParticles"}; | ||
WriteDataHandle<TrackParametersContainer> m_outputTrackParameters{ | ||
this, "OutputTrackParameters"}; | ||
}; | ||
|
||
} // namespace ActsExamples |
Oops, something went wrong.