Commit 9236dae6 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Alignment: invert logic of switching on/off rotation and translarion alignment

parent 3bbdccd4
Pipeline #359527 passed with stages
in 2 minutes and 31 seconds
......@@ -18,8 +18,8 @@ Alignment::Alignment(Configuration config, std::vector<Detector*> detectors)
nIterations = m_config.get<int>("iterations", 3);
m_pruneTracks = m_config.get<bool>("prune_tracks", false);
m_translationsOnly = m_config.get<bool>("translationsOnly", false);
m_rotationsOnly = m_config.get<bool>("rotationsOnly", false);
m_alignPosition = m_config.get<bool>("alignPosition", true);
m_alignOrientation = m_config.get<bool>("alignOrientation", true);
m_maxAssocClusters = m_config.get<int>("max_associated_clusters", 1);
m_maxTrackChi2 = m_config.get<double>("max_track_chi2ndof", 10.);
......@@ -309,31 +309,35 @@ void Alignment::finalise() {
<< display_vector(detector->rotation(), {"deg"});
// Add the parameters to the fitter (z displacement not allowed to move!)
if(m_rotationsOnly == true) {
if(m_alignPosition) {
residualFitter->SetParameter(
0, (detectorToAlign + "_displacementX").c_str(), detector->displacementX(), 0, -50, 50);
0, (detectorToAlign + "_displacementX").c_str(), detector->displacementX(), 0.01, -50, 50);
residualFitter->SetParameter(
1, (detectorToAlign + "_displacementY").c_str(), detector->displacementY(), 0, -50, 50);
1, (detectorToAlign + "_displacementY").c_str(), detector->displacementY(), 0.01, -50, 50);
} else {
residualFitter->SetParameter(
0, (detectorToAlign + "_displacementX").c_str(), detector->displacementX(), 0.01, -50, 50);
0, (detectorToAlign + "_displacementX").c_str(), detector->displacementX(), 0, -50, 50);
residualFitter->SetParameter(
1, (detectorToAlign + "_displacementY").c_str(), detector->displacementY(), 0.01, -50, 50);
1, (detectorToAlign + "_displacementY").c_str(), detector->displacementY(), 0, -50, 50);
}
// Z is never changed:
residualFitter->SetParameter(
2, (detectorToAlign + "_displacementZ").c_str(), detector->displacementZ(), 0, -10, 500);
if(m_translationsOnly == true) {
residualFitter->SetParameter(3, (detectorToAlign + "_rotationX").c_str(), detector->rotationX(), 0, -6.30, 6.30);
residualFitter->SetParameter(4, (detectorToAlign + "_rotationY").c_str(), detector->rotationY(), 0, -6.30, 6.30);
residualFitter->SetParameter(5, (detectorToAlign + "_rotationZ").c_str(), detector->rotationZ(), 0, -6.30, 6.30);
} else {
if(m_alignOrientation) {
residualFitter->SetParameter(
3, (detectorToAlign + "_rotationX").c_str(), detector->rotationX(), 0.001, -6.30, 6.30);
residualFitter->SetParameter(
4, (detectorToAlign + "_rotationY").c_str(), detector->rotationY(), 0.001, -6.30, 6.30);
residualFitter->SetParameter(
5, (detectorToAlign + "_rotationZ").c_str(), detector->rotationZ(), 0.001, -6.30, 6.30);
} else {
residualFitter->SetParameter(3, (detectorToAlign + "_rotationX").c_str(), detector->rotationX(), 0, -6.30, 6.30);
residualFitter->SetParameter(4, (detectorToAlign + "_rotationY").c_str(), detector->rotationY(), 0, -6.30, 6.30);
residualFitter->SetParameter(5, (detectorToAlign + "_rotationZ").c_str(), detector->rotationZ(), 0, -6.30, 6.30);
}
for(int iteration = 0; iteration < nIterations; iteration++) {
auto old_position = detector->displacement();
......
......@@ -41,8 +41,8 @@ namespace corryvreckan {
int m_numberOfTracksForAlignment;
int alignmentMethod;
bool m_pruneTracks;
bool m_translationsOnly;
bool m_rotationsOnly;
bool m_alignPosition;
bool m_alignOrientation;
int m_maxAssocClusters;
double m_maxTrackChi2;
......
## Alignment
**Maintainer**: Daniel Hynds (<daniel.hynds@cern.ch>), Simon Spannagel (<simon.spannagel@cern.ch>)
**Maintainer**: Daniel Hynds (<daniel.hynds@cern.ch>), Simon Spannagel (<simon.spannagel@cern.ch>)
**Status**: Functional
**Status**: Functional
#### Description
This module performs translational and rotational telescope plane alignment. The alignment is performed with respect to the reference plane set in the configuration file.
This module uses the tracks produced by the `BasicTracking` module to align the telescope planes. If fewer than half of the tracks have associated clusters, a warning is produced on terminal.
This module uses the tracks produced by the `BasicTracking` module to align the telescope planes. If fewer than half of the tracks have associated clusters, a warning is produced on terminal.
There are two methods available for alignment:
......@@ -23,9 +23,9 @@ For the detector specified by the `detectorToAlign` parameter, this method moves
* `detectorToAlign`: Parameter to set a particular plane to align. This parameter is only used in the residuals method (`alignmentMethod = 1`). The default is the `DUT` plane.
* `DUT`: Name of the DUT plane.
* `reference`: Name of the detector used as the alignment reference plane. All other telescope planes are aligned with respect to the reference plane.
* `translationsOnly`: Boolean to set if only translational alignment is wanted by the user. Note that the Z displacement is never aligned. The default value is `false`.
* `rotationsOnly`: Boolean to set if only rotational alignment is wanted by the user. The default value is `false`.
* `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. This parameter was designed for `alignmentMethod=1`. The number of discarded tracks is outputted on terminal. Default is `False`.
* `alignPosition`: Boolean to select whether to align the X and Y displacements of the detector or not. Note that the Z displacement is never aligned. This parameter is only used in `alignmentMode = 1`. The default value is `true`.
* `alignOrientation`: Boolean to select whether to align the three rotations of the detector under consideration or not. This parameter is only used in `alignmentMode = 1`. The default value is `true`.
* `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. This parameter was designed for `alignmentMethod=1`. The number of discarded tracks is outputted on 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`.
......
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