Commit 92611c37 authored by Jens Kroeger's avatar Jens Kroeger
Browse files

Merge branch 'parse-align-parameter-in-string' into 'master'

parsing string to for alignment pos and rot in AlignmentDUTResidual

See merge request !367
parents 5c9f5d3f 5270ae96
Pipeline #2003978 passed with stages
in 36 minutes and 16 seconds
......@@ -26,17 +26,27 @@ AlignmentDUTResidual::AlignmentDUTResidual(Configuration& config, std::shared_pt
config_.setDefault<bool>("prune_tracks", false);
config_.setDefault<bool>("align_position", true);
config_.setDefault<bool>("align_orientation", true);
config_.setDefault<std::string>("align_position_axes", "xy");
config_.setDefault<std::string>("align_orientation_axes", "xyz");
config_.setDefault<size_t>("max_associated_clusters", 1);
config_.setDefault<double>("max_track_chi2ndof", 10.);
nIterations = config_.get<size_t>("iterations");
m_pruneTracks = config_.get<bool>("prune_tracks");
m_alignPosition = config_.get<bool>("align_position");
m_alignOrientation = config_.get<bool>("align_orientation");
m_alignPosition_axes = config_.get<std::string>("align_position_axes");
m_alignOrientation_axes = config_.get<std::string>("align_orientation_axes");
std::transform(m_alignPosition_axes.begin(), m_alignPosition_axes.end(), m_alignPosition_axes.begin(), ::tolower);
std::transform(
m_alignOrientation_axes.begin(), m_alignOrientation_axes.end(), m_alignOrientation_axes.begin(), ::tolower);
if(m_alignPosition) {
LOG(INFO) << "Aligning positions";
}
m_alignOrientation = config_.get<bool>("align_orientation");
if(m_alignOrientation) {
LOG(INFO) << "Aligning orientations";
}
......@@ -254,24 +264,33 @@ void AlignmentDUTResidual::finalize(const std::shared_ptr<ReadonlyClipboard>& cl
<< Units::display(m_detector->rotation(), {"deg"});
// Add the parameters to the fitter (z displacement not allowed to move!)
if(m_alignPosition) {
if(m_alignPosition && m_alignPosition_axes.find('x') != std::string::npos) {
residualFitter->SetParameter(0, (name + "_displacementX").c_str(), m_detector->displacement().X(), 0.01, -50, 50);
residualFitter->SetParameter(1, (name + "_displacementY").c_str(), m_detector->displacement().Y(), 0.01, -50, 50);
} else {
residualFitter->SetParameter(0, (name + "_displacementX").c_str(), m_detector->displacement().X(), 0, -50, 50);
}
if(m_alignPosition && m_alignPosition_axes.find('y') != std::string::npos) {
residualFitter->SetParameter(1, (name + "_displacementY").c_str(), m_detector->displacement().Y(), 0.01, -50, 50);
} else {
residualFitter->SetParameter(1, (name + "_displacementY").c_str(), m_detector->displacement().Y(), 0, -50, 50);
}
// Z is never changed:
residualFitter->SetParameter(2, (name + "_displacementZ").c_str(), m_detector->displacement().Z(), 0, -10, 500);
if(m_alignOrientation) {
if(m_alignOrientation && m_alignOrientation_axes.find('x') != std::string::npos) {
residualFitter->SetParameter(3, (name + "_rotationX").c_str(), m_detector->rotation().X(), 0.001, -6.30, 6.30);
residualFitter->SetParameter(4, (name + "_rotationY").c_str(), m_detector->rotation().Y(), 0.001, -6.30, 6.30);
residualFitter->SetParameter(5, (name + "_rotationZ").c_str(), m_detector->rotation().Z(), 0.001, -6.30, 6.30);
} else {
residualFitter->SetParameter(3, (name + "_rotationX").c_str(), m_detector->rotation().X(), 0, -6.30, 6.30);
}
if(m_alignOrientation && m_alignOrientation_axes.find('y') != std::string::npos) {
residualFitter->SetParameter(4, (name + "_rotationY").c_str(), m_detector->rotation().Y(), 0.001, -6.30, 6.30);
} else {
residualFitter->SetParameter(4, (name + "_rotationY").c_str(), m_detector->rotation().Y(), 0, -6.30, 6.30);
}
if(m_alignOrientation && m_alignOrientation_axes.find('z') != std::string::npos) {
residualFitter->SetParameter(5, (name + "_rotationZ").c_str(), m_detector->rotation().Z(), 0.001, -6.30, 6.30);
} else {
residualFitter->SetParameter(5, (name + "_rotationZ").c_str(), m_detector->rotation().Z(), 0, -6.30, 6.30);
}
......
......@@ -62,6 +62,8 @@ namespace corryvreckan {
bool m_pruneTracks;
bool m_alignPosition;
bool m_alignOrientation;
std::string m_alignPosition_axes;
std::string m_alignOrientation_axes;
size_t m_maxAssocClusters;
double m_maxTrackChi2;
......
......@@ -11,8 +11,10 @@ This module uses tracks for alignment. The module moves the detector it is insta
### Parameters
* `iterations`: Number of times the chosen alignment method is to be iterated. Default value is `3`.
* `align_position`: Boolean to select whether to align the X and Y displacements of the detector or not. Note that the Z displacement is never aligned. The default value is `true`.
* `align_orientation`: Boolean to select whether to align the three rotations of the detector under consideration or not. The default value is `true`.
* `align_position`: Boolean to select whether to align the translational displacements of the detector or not. Note that the Z displacement is never aligned. Specify the axes using `align_position_axes`. The default value is `true`.
* `align_orientation`: Boolean to select whether to align the rotations of the detector under consideration or not. Specify the axes using `align_orientation_axes`. The default value is `true`.
* `align_position_axes`: Define for which axes to perform translational alignment. The default value is `xy`, which means both X and Y displacements of the detector will be aligned.
* `align_orientation_axes`: Define for which axes to perform rotational alignment if `align_orientation = true`. The default value is `xyz`, which means that rotations around X, Y and Z axis will be aligned.
* `prune_tracks`: Boolean to set if tracks with a number of associated clusters > `max_associated_clusters` or with a track chi^2 > `max_track_chi2ndof` should be excluded from use in the alignment. The number of discarded tracks is written to the terminal. Default is `false`.
* `max_associated_clusters`: Maximum number of associated clusters per track allowed when `prune_tracks = true` for the track to be used in the alignment. Default value is `1`.
* `max_track_chi2ndof`: Maximum track chi^2 value allowed when `prune_tracks = true` for the track to be used in the alignment. Default value is `10.0`.
......
......@@ -40,8 +40,10 @@ spatial_cut_abs = 350um, 350um
[AlignmentDUTResidual]
log_level = INFO
iterations = 4
align_orientation = true # <-- if alignment keeps failing disable...
align_position = true # <-- ...orientation OR position alignment!
align_orientation = true
align_position = true
align_orientation_axes = "xyz" # <-- if alignment keeps failing disable...
align_position_axes = "xy" # <-- ...orientation OR position alignment!
max_track_chi2ndof = 3
#DATASET timepix3tel_dut_atlaspix_ebeam120
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment