Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option for align vector for telescope plane placement #747

Merged
merged 2 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

// Project include(s).
#include "traccc/options/details/interface.hpp"
#include "traccc/options/details/value_array.hpp"

namespace traccc::opts {

Expand All @@ -31,6 +32,8 @@ class telescope_detector : public interface {
float smearing = 50.f;
/// Half length of plane [mm]
float half_length = 1000000.f;
/// Vector for plane alingment
opts::value_array<float, 3> align_vector{0.f, 0.f, 1.f};

/// @}

Expand Down
8 changes: 7 additions & 1 deletion examples/options/src/telescope_detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ telescope_detector::telescope_detector()
m_desc.add_options()("half-length-mm",
po::value(&half_length)->default_value(half_length),
"Half length of plane [mm]");
m_desc.add_options()("align-vector",
po::value(&align_vector)
->value_name("X:Y:Z")
->default_value(align_vector),
"Vector for plane placement");
}

void telescope_detector::read(const po::variables_map&) {
Expand All @@ -59,7 +64,8 @@ std::ostream& telescope_detector::print_impl(std::ostream& out) const {
<< " Smearing : " << smearing / detray::unit<float>::um
<< " [um]\n"
<< " Half length : " << half_length / detray::unit<float>::mm
<< " [mm]";
<< " [mm]"
<< " Align axis : " << align_vector << " \n";
return out;
}

Expand Down
6 changes: 5 additions & 1 deletion examples/simulation/simulate_telescope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ int simulate(const traccc::opts::generation& generation_opts,
* Build a telescope geometry
*****************************/

const auto align_vec = telescope_opts.align_vector;
vector3 align_axis{align_vec[0u], align_vec[1u], align_vec[2u]};
align_axis = vector::normalize(align_axis);

// Plane alignment direction (aligned to z-axis)
detray::detail::ray<traccc::default_algebra> traj{
{0, 0, 0}, 0, {0, 0, 1}, -1};
{0, 0, 0}, 0, align_axis, -1};
// Position of planes (in mm unit)
std::vector<scalar> plane_positions;

Expand Down
Loading