**Maintainer**: Simon Spannagel (<simon.spannagel@cern.ch>)
**Status**: Outdated
#### Description
This algorithm reads in data for the ATLASpix device from an input file.
The algorithm opens and reads one data file in the specified input directory with the ending `.dat`. For each hit it, stores the detectorID, row, column, and ToT.
Outdated as data format and decoding for this device has since changed.
#### Parameters
*`inputDirectory`: Path to the directory containing the `.dat` file. This path should lead to the directory above the ALTASpix directory, as this string is added to the input directory in the algorithm.
**Maintainer**: Daniel Hynds (<daniel.hynds@cern.ch>)
**Status**: Functional
#### Description
This algorithm performs translational and rotational telescope plane alignment.
The alignment is performed with respect to the reference plane set in the configuration file. To not include the DUT in this translational and rotational alignment, it will need to be masked in the configuration file.
This algorithm uses the tracks produced by the `BasicTracking` algorithm to align the telescope planes. There are two methods available for alignment:
##### 1) Minimising the track chi^2
For each telescope detector except the reference plane, this method moves the detector, refits all of the tracks, and minimises the chi^2 of these new tracks. The parameter `detectorToAlign` is not used in this method as it automatically iterates through all telescope planes except the DUT.
##### 2) Minimising the track (unbiased) residuals
For the detector specified by the `detectorToAlign` parameter, this method moves the detector, refits all the tracks, and minimises the unbiased residuals calculated from the track intercepts with the plane.
#### Parameters
*`number_of_tracks`: Number of tracks used in the alignment method chosen. Default value is `20000`.
*`iterations`: Number of times the chosen alignment method is to be iterated. Default value is `3`.
*`alignmentMethod`: Determines the alignment method used. To use the track chi^2 minimisation `alignmentMethod = 0`; to use the track residual minimisation `alignmentMethod = 1`.
*`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.
#### Plots produced
For each detector the following plots are produced:
* Translational shift along X-axis vs. iteration number
* Translational shift along Y-axis vs. iteration number
* Translational shift along Z-axis vs. iteration number
* Rotational shift around X-axis vs. iteration number
* Rotational shift around Y-axis vs. iteration number
* Rotational shift around Z-axis vs. iteration number
#### Usage
```toml
[Alignment]
alignmentMethod=0
masked="W0005_H03"#excluding the DUT from the alignment
**Maintainer**: Simon Spannagel (<simon.spannagel@cern.ch>)
**Status**: Functional
#### Description
This algorithm performs a basic tracking method.
Clusters from the first plane in Z (named the seed plane) are related to clusters on the other detector planes using straight line tracks. The DUT plane can be excluded from the track finding and DUT clusters potentially associated with the track stored.
#### Parameters
*`timingCut`: Maximum time difference allowed between clusters for association. In units of seconds. Default value is `0.0000002` (200ns).
*`spatialCut`: Maximum spatial distance in the XY plane allowed between clusters for association. In units of millimetres. Default value is `0.2` (200um).
*`minHitsOnTrack`: Minium number of associated clusters needed to create a track, equivalent to the minimum number of planes required for each track. Default value is `6`.
*`excludeDUT`: Boolean to chose if the DUT plane is included in the track finding. In either case, the DUT clusters possibly associated with the track are saved. Default value is `true`.
*`DUT`: Name of the DUT plane.
#### Plots produced
* Track chi^2 histogram
* Track chi^2 /degrees of freedom histogram
* Clusters per track histogram
* Tracks per event histogram
* Track angle with respect to X-axis histogram
* Track angle with respect to Y-axis histogram
For each detector the following plots are produced:
* Residual in X
* Residual in Y
* Residual in X for clusters with a width in X of 1
* Residual in Y for clusters with a width in X of 1
* Residual in X for clusters with a width in X of 2
* Residual in Y for clusters with a width in X of 2
* Residual in X for clusters with a width in X of 3
* Residual in Y for clusters with a width in X of 3
**Maintainer**: Daniel Hynds (<daniel.hynds@cern.ch>)
**Status**: Functional
#### Description
This algorithm reads in data for a CLICpix device from an input file.
The algorithm opens and reads one data file in the specified input directory with the ending `.dat`. For each hit it stores the detectorID, row, column, and ToT. The shutter rise and fall time information are used to set the current time and event length.
#### Parameters
*`inputDirectory`: Path to the directory containing the `.dat` file. This path should lead to the directory above the CLICpix directory, as this string is added onto the input directory in the algorithm.
**Maintainer**: Daniel Hynds (<daniel.hynds@cern.ch>)
**Status**: Functional
#### Description
This algorithm reads in data for a CLICpix2 device from an input file.
The algorithm opens and reads one data file in the specified input directory. For each hit it stores the detectorID, row, column, and ToT. The shutter rise and fall time information are used to set the current time and event length.
#### Parameters
*`inputDirectory`: Path to the directory containing the `.csv` file. This path should lead to the directory above the CLICpix directory, as this string is added onto the input directory in the algorithm.
**Maintainer**: Daniel Hynds (<daniel.hynds@cern.ch>)
**Status**: Functional
#### Description
This algorithm associates CLICpix2 DUT clusters to tracks using a spatial cut (device type not checked). A significant number of analysis plots are produced.
#### Parameters
*`associationCut`: Maximum distance between a track and cluster for them to be associated. Units of mm. Default value is `0.05` (50um).
*`proximityCut`: Maximum distance apart two tracks are for them to be 'close' to each other. If at the CLICpix plane there are two tracks close to each other, the DUT cluster is not associated with either track. Units of mm. Default value is `0.0005` (0.5um).
*`timepix3Telescope`: Boolean to set whether the Timepix3 telescope is being used. Default value is `false`.
*`DUT`: Name of the DUT plane.
#### Plots produced
For the DUT the following plots are produced:
* 2D hitmap
* Column hits histogram
* Row hits histogram
* Cluster size histogram
* CLuster ToT histogram
* Clusters per event histogram
* Clusters vs event number
* Cluster width histogram (rows, Y-axis)
* Cluster width histogram (columns, X-axis)
* Global track difference
* Global track difference in Y
* Global residuals in X
* Global residuals in Y
* Absolute residuals
* Global residuals in X vs X
* Global residuals in X vs Y
* Global residuals in Y vs X
* Global residuals in Y vs Y
* Global residuals in X vs column width
* Global residuals in X vs row width
* Global residuals in Y vs column width
* Global residuals in Y vs row width
*
* Track intercept in rows
* Track intercept in columns
* Absolute residual map histogram
* X residual vs Y residual
* Associated clusters per event histogram
* Associated clusters vs event number
* Associated clusters vs trigger number
* Associated cluster row
* Associated cluster column
* Frame efficiency histogram
* Frame tracks
* Associated frame tracks
* Associated cluster size
* Associated cluster width (row)
* Associated cluster width (column)
* Associated 1-pixel cluster ToT
* Associated 2-pixel cluster ToT
* Associated 3-pixel cluster ToT
* Associated 4-pixel cluster ToT
* Pixel response in X
* Pixel response in X in global coordinates
* Pixel response in X for odd columns
* Pixel response in X for even columns
* Pixel response in Y
* Pixel response in Y in global coordinates
* Pixel response in Y for odd columns
* Pixel response in Y for even columns
* 2D eta distribution in X
* 2D eta distribution in Y
* Local residual for rows for 2-pixel clusters
* Local residual for columns for 2-pixel clusters
* Cluster ToT for rows for 2-pixel clusters
* Cluster ToT for columns for 2-pixel clusters
* Pixel ToT for rows for 2-pixel clusters
* Pixel ToT for columns for 2-pixel clusters
* Cluster ToT ratio for rows for 2-pixel clusters
* Cluster ToT ratio for rows for 2-pixel clusters
* Local residuals for rows for 2-pixel clusters
* 2D track intercepts
* 2D associatedd track intercepts
* 2D cluster positions in global coordinates
* 2D associated cluster positions in global coordinates
**Maintainer**: Daniel Hynds (<daniel.hynds@cern.ch>)
**Status**: Functional
#### Description
This algorithm reads in raw data files with extension `-1.dat`, and outputs the pixel data in hexidecimal in an output file called `outputHexDump.dat`.
#### Parameters
*`DeviceToDumpData`: The name of the device data is to be read from.
*`inputDirectory`: Path to the directory above the data directory named `DeviceToDumpData`.
**Maintainer**: Daniel Hynds (<daniel.hynds@cern.ch>)
**Status**: Under development
#### Description
This algorithm takes data from Timepix3 devices from the clipboard and plots the pixel hit positions to create the eta correction. Eta correction has still to be implemented in this algorithm (under development).
#### Parameters
No parameters are used from the configuration file.
#### Plots produced
* Histogram of event numbers
For each detector the following plots are produced:
**Maintainer**: Simon Spannagel (<simon.spannagel@cern.ch>)
**Status**: Functional
#### Description
This algorithm reads in an input file containing trees with data previously written out by the `FileWriter`. The read in objects are stored on the clipboard. It reads in `pixel`, `cluster`, `track`, and/or `MCparticle` objects.
#### Parameters
*`onlyDUT`: Boolean to decide if data is read in from only the DUT. Default value is `false`.
*`readPixels`: Boolean to choose if pixel objects are to be read in. Default value is `true`.
*`readClusters`: Boolean to choose if cluster objects are to be read in. Default value is `false`.
*`readTracks`: Boolean to choose if track objects are to be read in. Default value is `false`.
*`readMCParticles`: Boolean to choose if Monte-Carlo particle objects are to be read in. Default value is `false`.
*`fileName`: Name of the file from which data will be read. Default value is `ouyputTuples.root`.
*`timeWindow`: Data with time lower than this value will be read in. Default value is `1`.
**Maintainer**: Simon Spannagel (<simon.spannagel@cern.ch>)
**Status**: Functional
#### Description
This algorithm writes an output file and fills it with trees containing the requested data objects. `Pixel`, `cluster`, and/or `track` objects can be written into the trees.
#### Parameters
*`DUT`: Name of the DUT plane.
*`onlyDUT`: Boolean to decide if only the DUT data is to be written into the outputfile, or if all planes are to be. Default value is `true`.
*`writePixels`: Boolean to choose if pixel objects are to be written out. Default value is `true`.
*`writeClusters`: Boolean to choose if cluster objects are to be written out. Default value is `false`.
*`writeTracks`: Boolean to choose if track objects are to be written out. Default value is `true`.
*`fileName`: Name of the output file. Default value is `outputTuples.root`.
**Maintainer**: Daniel Hynds (<daniel.hynds@cern.ch>)
**Status**: Functional
#### Description
This algorithm takes data from a Timepix3 device from the clipboard and plots the pixel hit positions. This is to be a template to easy create other algorithms for Corryvreckan.
#### Parameters
No parameters are used from the configuration file.
#### Plots produced
* Histogram of event numbers
For each detector the following plots are produced:
**Maintainer**: Daniel Hynds (<daniel.hynds@cern.ch>)
**Status**: Functional - some minor fixes needed
#### Description
This algorithm opens a GUI to monitor the progress of Corryvreckan reconstruction. Each canvas contains real time plots of the reconstruction, updated every 500 events. Plots are used from the `BasicTracking` and `TestAlgorithm` algorithms.
Users should be able to exit `OnlineMonitor` and leave the reconstruction still running, but currently this causes a crash.
#### Parameters
*`reference`: Name of the reference plane.
#### Plots produced
Overview canvas:
* Cluster ToT of reference plane
* 2D hitmap of reference plane
* Residual in X of reference plane
Tracking canvas:
* Track chi^2
* Track angle in X
For each detector the following plots are produced:
* Hitmap canvas: 2D hitmap
* Residuals canvas: residual in X histogram
* Event times canvas: event times histogram
* Correlations X canvas: correlation in X plot
* Correlations Y canvas: correlation in Y plot
* Charge distributions canvas: cluster ToT - broken at the moment
**Maintainer**: Morag Williams (<morag.williams@cern.ch>)
**Status**: Functional
#### Description
This algorithm performs translational telescope plane alignment.
This initial alignment along the X and Y axes is designed to be performed before the `Alignment` algorithm, which carries out translational and rotational alignment of the planes. To not include the DUT in this transaltional alignment, it will need to be masked in the configuration file.
The required translational shifts in X and Y are calculated for each detector as the mean of the 1D correlation histogram along the axis.
#### Parameters
*`reference`: Name of the detector used as the alignment reference plane. All other telescope planes are aligned with respect to the reference plane.
*`damping_factor`: A factor to change the percentage of the calcuated shift applied to each detector. Default value is `1`.
*`max_correlation_rms`: The maximum rms of the 1D correlation histograms allowed for the shifts to be applied. This factor should be tuned for each run, and is combat the effect of flat distributions. Default value is `6`.
### Plots Created
For each detector the following plots are produced:
* 1D correlation plot for X
* 1D correlation plot for Y
* 2D correlation plot for X in local coordinates (comparing to reference plane)
* 2D correlation plot for Y in local coordinates
* 2D correlation plot for X in global coordinates
* 2D correlation plot for Y in global coordinates
#### Usage
```toml
[Prealignment]
log_level=INFO
reference="W0013_D04"
masked="W0005_H03"#excluding the DUT from the prelaignment