Skip to content
Snippets Groups Projects
Commit 002646ed authored by Ginger Cheng's avatar Ginger Cheng
Browse files

clean code, add description in README for extra user-define fixed plane

parent b367ed7e
No related branches found
No related tags found
No related merge requests found
......@@ -44,7 +44,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_plane_ = config_.getArray<std::string>("fixed_plane", {});
fixed_planes_ = config_.getArray<std::string>("fixed_planes", {});
LOG(INFO) << "Aligning telescope";
}
......@@ -181,15 +181,11 @@ void AlignmentTrackChi2::finalize(const std::shared_ptr<ReadonlyClipboard>& clip
int det = 0;
for(auto& detector : get_regular_detectors(false)) {
string detectorID = detector->getName();
bool is_fixed = false;
// Do not align the reference plane
for(const auto& fixed_plane : fixed_plane_) {
if(detectorID == fixed_plane) {
is_fixed = true;
}
}
// 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) {
LOG(DEBUG) << "Skipping detector " << detector->getName();
continue;
......@@ -283,16 +279,10 @@ void AlignmentTrackChi2::finalize(const std::shared_ptr<ReadonlyClipboard>& clip
// Now list the new alignment parameters
for(auto& detector : get_regular_detectors(false)) {
string detectorID = detector->getName();
bool is_fixed = false;
// Do not align the reference plane
for(const auto& fixed_plane : fixed_plane_) {
if(detectorID == fixed_plane) {
LOG(INFO) << "Skipping user fixed detector " << detectorID;
is_fixed = true;
}
}
// 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;
}
......
......@@ -16,6 +16,7 @@ For each telescope detector except the reference plane, this method moves the de
* `prune_tracks`: Boolean to set if tracks with a track chi^2 > `max_track_chi2ndof` should be excluded from use in the alignment. 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`.
* `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,7 +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_plane_ = config_.getArray<std::string>("fixed_plane", {});
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;
......@@ -128,14 +128,7 @@ 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"});
}
string detectorID = m_detector->getName();
bool is_fixed = false;
// Do not align the user-defined plane
for(const auto& fixed_plane : fixed_plane_) {
if(detectorID == fixed_plane) {
is_fixed = true;
}
}
bool is_fixed = std::find(fixed_planes_.begin(), fixed_planes_.end(), detector->getName()) != fixed_planes_.end();
// Move all but the reference and user-defined plane:
if(!m_detector->isReference() && !is_fixed) {
......
......@@ -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