Commit a1296ffa authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Alignment: also allow alignRotation/Orientation for the track alignment

parent 034a3712
Pipeline #368550 passed with stages
in 5 minutes and 40 seconds
......@@ -19,7 +19,13 @@ Alignment::Alignment(Configuration config, std::vector<Detector*> detectors)
m_pruneTracks = m_config.get<bool>("prune_tracks", false);
m_alignPosition = m_config.get<bool>("alignPosition", true);
if(m_alignPosition) {
LOG(INFO) << "Aligning positions";
}
m_alignOrientation = m_config.get<bool>("alignOrientation", true);
if(m_alignOrientation) {
LOG(INFO) << "Aligning orientations";
}
m_maxAssocClusters = m_config.get<int>("max_associated_clusters", 1);
m_maxTrackChi2 = m_config.get<double>("max_track_chi2ndof", 10.);
......@@ -31,7 +37,12 @@ Alignment::Alignment(Configuration config, std::vector<Detector*> detectors)
} else {
detectorToAlign = m_config.get<std::string>("DUT");
}
LOG(INFO) << "Aligning detector \"" << detectorToAlign << "\"";
if(alignmentMethod == 1) {
LOG(INFO) << "Aligning detector \"" << detectorToAlign << "\"";
} else {
LOG(INFO) << "Aligning telescope";
}
}
void Alignment::initialise() {
......@@ -399,19 +410,36 @@ void Alignment::finalise() {
detNum = det;
// Add the parameters to the fitter (z displacement not allowed to move!)
residualFitter->SetParameter(
det * 6 + 0, (detectorID + "_displacementX").c_str(), detector->displacement().X(), 0.01, -50, 50);
residualFitter->SetParameter(
det * 6 + 1, (detectorID + "_displacementY").c_str(), detector->displacement().Y(), 0.01, -50, 50);
if(m_alignPosition) {
residualFitter->SetParameter(
det * 6 + 0, (detectorID + "_displacementX").c_str(), detector->displacement().X(), 0.01, -50, 50);
residualFitter->SetParameter(
det * 6 + 1, (detectorID + "_displacementY").c_str(), detector->displacement().Y(), 0.01, -50, 50);
} else {
residualFitter->SetParameter(
det * 6 + 0, (detectorID + "_displacementX").c_str(), detector->displacement().X(), 0, -50, 50);
residualFitter->SetParameter(
det * 6 + 1, (detectorID + "_displacementY").c_str(), detector->displacement().Y(), 0, -50, 50);
}
residualFitter->SetParameter(
det * 6 + 2, (detectorID + "_displacementZ").c_str(), detector->displacement().Z(), 0, -10, 500);
residualFitter->SetParameter(
det * 6 + 3, (detectorID + "_rotationX").c_str(), detector->rotation().X(), 0.001, -6.30, 6.30);
residualFitter->SetParameter(
det * 6 + 4, (detectorID + "_rotationY").c_str(), detector->rotation().Y(), 0.001, -6.30, 6.30);
residualFitter->SetParameter(
det * 6 + 5, (detectorID + "_rotationZ").c_str(), detector->rotation().Z(), 0.001, -6.30, 6.30);
if(m_alignOrientation) {
residualFitter->SetParameter(
det * 6 + 3, (detectorID + "_rotationX").c_str(), detector->rotation().X(), 0.001, -6.30, 6.30);
residualFitter->SetParameter(
det * 6 + 4, (detectorID + "_rotationY").c_str(), detector->rotation().Y(), 0.001, -6.30, 6.30);
residualFitter->SetParameter(
det * 6 + 5, (detectorID + "_rotationZ").c_str(), detector->rotation().Z(), 0.001, -6.30, 6.30);
} else {
residualFitter->SetParameter(
det * 6 + 3, (detectorID + "_rotationX").c_str(), detector->rotation().X(), 0, -6.30, 6.30);
residualFitter->SetParameter(
det * 6 + 4, (detectorID + "_rotationY").c_str(), detector->rotation().Y(), 0, -6.30, 6.30);
residualFitter->SetParameter(
det * 6 + 5, (detectorID + "_rotationZ").c_str(), detector->rotation().Z(), 0, -6.30, 6.30);
}
auto old_position = detector->displacement();
auto old_orientation = detector->rotation();
......
......@@ -22,8 +22,8 @@ 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.
* `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`.
* `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. The default value is `true`.
* `alignOrientation`: Boolean to select whether to align the three rotations of the detector under consideration or not. 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