Skip to content
Snippets Groups Projects
Commit 81ad676d authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Merge branch 'tracking_dev' into 'master'

Adding user-defined fixed plane to telescope alignment

See merge request corryvreckan/corryvreckan!522
parents e31734c0 b99f2f83
No related branches found
No related tags found
No related merge requests found
......@@ -48,6 +48,7 @@ AlignmentTrackChi2::AlignmentTrackChi2(Configuration& config, std::vector<std::s
m_maxAssocClusters = config_.get<size_t>("max_associated_clusters");
m_maxTrackChi2 = config_.get<double>("max_track_chi2ndof");
fixed_planes_ = config_.getArray<std::string>("fixed_planes", {});
LOG(INFO) << "Aligning telescope";
}
......@@ -217,9 +218,10 @@ void AlignmentTrackChi2::finalize(const std::shared_ptr<ReadonlyClipboard>& clip
int det = 0;
for(auto& detector : get_regular_detectors(false)) {
string detectorID = detector->getName();
// Do not align fixed planes and the reference plane
bool is_fixed = std::find(fixed_planes_.begin(), fixed_planes_.end(), detectorID) != fixed_planes_.end();
// Do not align the reference plane
if(detector->isReference()) {
if(detector->isReference() || is_fixed) {
LOG(DEBUG) << "Skipping detector " << detector->getName();
continue;
}
......@@ -312,8 +314,11 @@ void AlignmentTrackChi2::finalize(const std::shared_ptr<ReadonlyClipboard>& clip
// Now list the new alignment parameters
for(auto& detector : get_regular_detectors(false)) {
// Do not align the reference plane
if(detector->isReference()) {
// Do not align fixed planes and the reference plane
bool is_fixed = std::find(fixed_planes_.begin(), fixed_planes_.end(), detector->getName()) != fixed_planes_.end();
if(detector->isReference() || is_fixed) {
continue;
}
......
......@@ -57,6 +57,7 @@ namespace corryvreckan {
bool m_alignOrientation;
size_t m_maxAssocClusters;
double m_maxTrackChi2;
std::vector<std::string> fixed_planes_;
std::map<std::string, TGraph*> align_correction_shiftX;
std::map<std::string, TGraph*> align_correction_shiftY;
......
......@@ -17,6 +17,8 @@ For each telescope detector except the reference plane, this method moves the de
* `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`.
* `workers`: Specify the number of workers to use in total, should be strictly larger than zero. Defaults to the number of native threads available on the system minus one, if this can be determined, otherwise one thread is used.
* `fixed_planes`: Optional user-defined fixed planes in addition to reference plane. When `fixed_planes = detector_name`, the geometry of the selected detector will not be modified.
### Plots produced
For each detector, the following plots are produced:
......
......@@ -38,6 +38,7 @@ Prealignment::Prealignment(Configuration& config, std::shared_ptr<Detector> dete
range_abs = config_.get<double>("range_abs");
method = config_.get<PrealignMethod>("method");
fit_range_rel = config_.get<int>("fit_range_rel");
fixed_planes_ = config_.getArray<std::string>("fixed_planes", {});
LOG(DEBUG) << "Setting max_correlation_rms to : " << max_correlation_rms;
LOG(DEBUG) << "Setting damping_factor to : " << damping_factor;
......@@ -127,9 +128,11 @@ void Prealignment::finalize(const std::shared_ptr<ReadonlyClipboard>&) {
LOG(ERROR) << "Detector " << m_detector->getName() << ": RMS X = " << Units::display(rmsX, {"mm", "um"})
<< " , RMS Y = " << Units::display(rmsY, {"mm", "um"});
}
bool is_fixed = std::find(fixed_planes_.begin(), fixed_planes_.end(), m_detector->getName()) != fixed_planes_.end();
// Move all but the reference:
if(!m_detector->isReference()) {
// Move all but the reference and user-defined plane:
if(!m_detector->isReference() && !is_fixed) {
LOG(INFO) << "Running detector " << m_detector->getName();
double shift_X = 0.;
double shift_Y = 0.;
......
......@@ -59,6 +59,7 @@ namespace corryvreckan {
double range_abs;
PrealignMethod method;
int fit_range_rel;
std::vector<std::string> fixed_planes_;
};
} // namespace corryvreckan
#endif // PREALIGNMENT_H
......@@ -22,6 +22,7 @@ However, for the prealignment this is a an acceptable estimation which works wit
* `method`: Specifies which method should be used to compute the translational shifts. With the option `mean` the mean of the 1D correlation histogram is used. The option `maximum` uses the maximum value of the histogram. With `method` set to `gauss_fit` a Gaussian is fitted and the mean of the fit is used for the translational shift. Default is to `mean`.
* `fit_range_rel`: Parameter to set the fit range of the Gaussian fit if `method` is set to `gauss_fit`. The absolute fit range is given by `fit_range_rel` times the spatial resolution of the corresponding detector around the maximum of the 1D correlation histogram. The default of the relative fit range is `fit_range_rel` = 500.
* `range_abs`: Parameter to allow setting up the range in which residuals get plotted (mm, +- around 0). Default is `10mm`. This needs to be increased for large sensors, where the alignment might be out by well more than 10mm and thus residual plots might be empty in the range +- 10.
* `fixed_planes`: Optional user-defined fixed planes in addition to reference plane. When `fixed_planes = detector_name`, the geometry of the selected detector will not be modified.
### Plots Created
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment