Commit b3aab79d authored by Jens Kroeger's avatar Jens Kroeger
Browse files

Merge branch 'master' into fix_eventdefinitionm26

parents d4b2bb15 4792df3a
......@@ -52,6 +52,7 @@ Corryvreckan has been developed and is maintained by
The following authors, in alphabetical order, have contributed to Corryvreckan:
* Matthew Daniel Buckland, University of Liverpool, @mbucklan
* Manuel Colocci, CERN, @mcolocci
* Dominik Dannheim, CERN, @dannheim
* Katharina Dort, University of Giessen/CERN, @kdort
* Alexander Ferk, CERN, @aferk
......
......@@ -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`.
......
......@@ -118,6 +118,18 @@ void AnalysisDUT::initialize() {
new TH1F("residualsX2pix", "Residual for 2-pixel clusters in X;x_{track}-x_{hit} [mm];# entries", 800, -0.1, 0.1);
residualsY2pix =
new TH1F("residualsY2pix", "Residual for 2-pixel clusters in Y;y_{track}-y_{hit} [mm];# entries", 800, -0.1, 0.1);
residualsX3pix =
new TH1F("residualsX3pix", "Residual for 3-pixel clusters in X;x_{track}-x_{hit} [mm];# entries", 800, -0.1, 0.1);
residualsY3pix =
new TH1F("residualsY3pix", "Residual for 3-pixel clusters in Y;y_{track}-y_{hit} [mm];# entries", 800, -0.1, 0.1);
residualsX4pix =
new TH1F("residualsX4pix", "Residual for 4-pixel clusters in X;x_{track}-x_{hit} [mm];# entries", 800, -0.1, 0.1);
residualsY4pix =
new TH1F("residualsY4pix", "Residual for 4-pixel clusters in Y;y_{track}-y_{hit} [mm];# entries", 800, -0.1, 0.1);
residualsXatLeast5pix = new TH1F(
"residualsXatLeast5pix", "Residual for >= 5-pixel clusters in X;x_{track}-x_{hit} [mm];# entries", 800, -0.1, 0.1);
residualsYatLeast5pix = new TH1F(
"residualsYatLeast5pix", "Residual for >= 5-pixel clusters in Y;y_{track}-y_{hit} [mm];# entries", 800, -0.1, 0.1);
clusterChargeAssoc = new TH1F("clusterChargeAssociated",
"Charge distribution of associated clusters;cluster charge [e];# entries",
......@@ -331,9 +343,9 @@ void AnalysisDUT::initialize() {
hAssociatedTracksGlobalPosition =
new TH2F("hAssociatedTracksGlobalPosition",
"Map of associated track positions (global);global intercept x [mm];global intercept y [mm]",
200,
-10,
10,
400,
-20,
20,
200,
-10,
10);
......@@ -499,6 +511,27 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
residualsY2pix->Fill(ydistance);
}
if(assoc_cluster->columnWidth() == 3) {
residualsX3pix->Fill(xdistance);
}
if(assoc_cluster->rowWidth() == 3) {
residualsY3pix->Fill(ydistance);
}
if(assoc_cluster->columnWidth() == 4) {
residualsX4pix->Fill(xdistance);
}
if(assoc_cluster->rowWidth() == 4) {
residualsY4pix->Fill(ydistance);
}
if(assoc_cluster->columnWidth() >= 5) {
residualsXatLeast5pix->Fill(xdistance);
}
if(assoc_cluster->rowWidth() >= 5) {
residualsYatLeast5pix->Fill(ydistance);
}
// Time residuals
residualsTime->Fill(tdistance);
residualsTimeVsTime->Fill(tdistance, track->timestamp());
......
......@@ -49,6 +49,9 @@ namespace corryvreckan {
TH1F *residualsX1pix, *residualsY1pix;
TH1F *residualsX2pix, *residualsY2pix;
TH1F *residualsX3pix, *residualsY3pix;
TH1F *residualsX4pix, *residualsY4pix;
TH1F *residualsXatLeast5pix, *residualsYatLeast5pix;
TH1F* clusterChargeAssoc;
TH1F* clusterSizeAssoc;
......
......@@ -92,7 +92,7 @@ In addition, the calibration file of the detector specified in the geometry conf
* `adjust_event_times`: Matrix that allows the user to shift the event start/end of all different types of EUDAQ events before comparison to any other Corryvreckan data. The first entry of each row specifies the data type, the second is the offset which is added to the event start and the third entry is the offset added to the event end. A usage example is shown below, double brackets are required if only one entry is provided.
* `buffer_depth`: Depth of buffer in which EUDAQ2 `StandardEvents` are timesorted. This algorithm only works for `StandardEvents` with well-defined timestamps. Setting it to `0` disables timesorting. Default is `0`.
* `shift_triggers`: Shift the trigger ID up or down when assigning it to the Corryvreckan event. This allows to correct trigger ID offsets between different devices such as the TLU and MIMOSA26. Note that the same value for `shift_triggers` needs to be passed to the `EventLoaderEUDAQ2` for the TLU.
* `eudaq_loglevel`: Verbosity level of the EUDAQ logger instance of the converter module. Possible options are, in decreasing severity, `USER`, `ERROR`, `WARN`, `INFO`, `EXTRA` and `DEBUG`. The default level is `ERROR`.
* `eudaq_loglevel`: Verbosity level of the EUDAQ logger instance of the converter module. Possible options are, in decreasing severity, `USER`, `ERROR`, `WARN`, `INFO`, `EXTRA` and `DEBUG`. The default level is `ERROR`. Please note that the verbosity can only be changed globally, i.e. when using multiple instances of `EventLoaderEUDAQ2`, the last occurrence will determine the (global) value of this parameter.
### Plots produced
......
......@@ -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