![]() |
Project
|
#include <TrackResiduals.h>
Classes | |
| struct | LocalResid |
| struct | VoxRes |
| Structure which gets filled with the results for each voxel. More... | |
| struct | VoxStats |
| Structure which holds the statistics for each voxel. More... | |
Public Types | |
| enum | { VoxZ , VoxF , VoxX , VoxV , VoxDim = 3 , VoxHDim = 4 } |
| Enumeration for different voxel dimensions. More... | |
| enum | { ResX , ResY , ResZ , ResD , ResDim } |
| Enumeration for the result indices. More... | |
| enum | { DistDone = 1 << 0 , DispDone = 1 << 1 , SmoothDone = 1 << 2 , Masked = 1 << 7 } |
| Enumeration for voxel status flags, using the same bits as in AliRoot version. More... | |
| enum class | KernelType { Epanechnikov , Gaussian } |
Public Member Functions | |
| TrackResiduals ()=default | |
| Default constructor. | |
| TrackResiduals (const TrackResiduals &)=delete | |
| Copying and assigning is forbidden. | |
| TrackResiduals & | operator= (const TrackResiduals &)=delete |
| void | init (bool doBinning=true) |
| void | initBinning () |
| Initializes the binning in X, Y/X and Z. | |
| void | initResultsContainer (int iSec) |
| void | initVoxelStats () |
| Initialize the statistics for the local residuals container. | |
| void | reset () |
| Resets all (also intermediate) results. | |
| void | setPrintMemoryUsage () |
| Sets a flag to print the memory usage at certain points in the program for performance studies. | |
| void | setKernelType (KernelType kernel=KernelType::Epanechnikov, float bwX=2.1f, float bwP=2.1f, float bwZ=1.7f, float scX=1.f, float scP=1.f, float scZ=1.f) |
| void | setSmoothPol2 (int dim, bool flag) |
| void | setVdriftCorr (float corr) |
| void | setT0Corr (float corr) |
| std::vector< LocalResid > & | getLocalResVec () |
| std::vector< VoxStats > ** | getVoxStatPtr () |
| const std::array< std::vector< VoxRes >, SECTORSPERSIDE *SIDES > & | getVoxelResults () const |
| void | processSectorResiduals (Int_t iSec) |
| void | processVoxelResiduals (std::vector< float > &dy, std::vector< float > &dz, std::vector< float > &tg, VoxRes &resVox) |
| void | processVoxelDispersions (std::vector< float > &tg, std::vector< float > &dy, VoxRes &resVox) |
| int | validateVoxels (int iSec) |
| void | smooth (int iSec) |
| float | fitPoly1Robust (std::vector< float > &x, std::vector< float > &y, std::array< float, 2 > &res, std::array< float, 3 > &err, float cutLTM) const |
| float | getMAD2Sigma (std::vector< float > data) const |
| void | medFit (int nPoints, int offset, const std::vector< float > &x, const std::vector< float > &y, float &a, float &b, std::array< float, 3 > &err) const |
| float | roFunc (int nPoints, int offset, const std::vector< float > &x, const std::vector< float > &y, float b, float &aa) const |
| float | selectKthMin (const int k, std::vector< float > &data) const |
| bool | getSmoothEstimate (int iSec, float x, float p, float z, std::array< float, ResDim > &res, int whichDim=0) |
| double | getKernelWeight (std::array< double, 3 > u2vec) const |
| void | setNXBins (int nBins) |
| int | getNXBins () const |
| void | setNY2XBins (int nBins) |
| int | getNY2XBins () const |
| void | setNZ2XBins (int nBins) |
| int | getNZ2XBins () const |
| int | getNVoxelsPerSector () const |
| Get the total number of voxels per TPC sector (mNXBins * mNY2XBins * mNZ2XBins) | |
| void | setY2XBinning (const std::vector< float > &binning) |
| void | setZ2XBinning (const std::vector< float > &binning) |
| size_t | getGlbVoxBin (int ix, int ip, int iz) const |
| size_t | getGlbVoxBin (const std::array< unsigned char, VoxDim > &bvox) const |
| void | getVoxelCoordinates (int isec, int ix, int ip, int iz, float &x, float &p, float &z) const |
| float | getX (int ix) const |
| float | getMaxY2X (int ix) const |
| float | getY2X (int ix, int ip) const |
| float | getZ2X (int iz) const |
| bool | getXBinIgnored (int iSec, int bin) const |
| void | findVoxel (float x, float y2x, float z2x, int &ix, int &ip, int &iz) const |
| bool | findVoxelBin (int secID, float x, float y, float z, std::array< unsigned char, VoxDim > &bvox) const |
| Calculates the bin indices for given x, y, z in sector coordinates. | |
| int | getXBin (float x) const |
| int | getXBinExact (float x) const |
| int | getRowID (float x) const |
| int | getY2XBinExact (float y2x, int ix) const |
| int | getY2XBin (float y2x, int ix) const |
| int | getZ2XBinExact (float z2x) const |
| int | getZ2XBin (float z2x) const |
| float | getDXI (int ix) const |
| float | getDY2XI (int ix, int iy=0) const |
| float | getDZ2X (int iz=0) const |
| float | getDZ2XI (int iz=0) const |
| void | printMem () const |
| Prints the current memory usage. | |
| void | dumpResults (int iSec) |
| void | createOutputFile (const char *filename="debugVoxRes.root") |
| Creates a file for the debug output. | |
| void | closeOutputFile () |
| Closes the file with the debug output. | |
| TFile * | getOutputFilePtr () |
| Allow to access the output file from outside. | |
| void | setStats (const std::vector< TrackResiduals::VoxStats > &statsIn, int iSec) |
| Set the voxel statistics directly from outside. | |
| void | fillStats (int iSec) |
| Fill statistics from TTree. | |
| void | clear () |
| clear member to be able to process new sector or new input files | |
| TTree * | getOutputTree () |
| output tree | |
| void | setAdhocScalingFactorX (const std::array< float, 2 > &scaling) |
| Ad-hoc radial scaling factor A/C-Side. | |
| void | doAdhocCorrectionZ2X (bool corr) |
| Ad-hoc correction of Z/X. | |
Static Public Member Functions | |
| static void | fitCircle (int nCl, std::array< float, param::NPadRows > &x, std::array< float, param::NPadRows > &y, float &xc, float &yc, float &r, std::array< float, param::NPadRows > &residHelixY) |
| static void | fitCircle (TrackInterpolation::TrackValidationData ¶ms) |
| static bool | fitPoly1 (int nCl, std::array< float, param::NPadRows > &x, std::array< float, param::NPadRows > &y, std::array< float, 2 > &res) |
| static bool | fitPoly1 (TrackInterpolation::TrackValidationData ¶ms) |
This class is steering the space point calibration of the TPC from track residuals. Residual maps are created using track interpolation from ITS/TRD/TOF tracks and comparing them to the cluster positions in the TPC. It has been ported from the AliTPCDcalibRes clas from AliRoot.
Definition at line 45 of file TrackResiduals.h.
| anonymous enum |
Enumeration for different voxel dimensions.
| Enumerator | |
|---|---|
| VoxZ | Z/X index. |
| VoxF | Y/X index. |
| VoxX | X index. |
| VoxV | voxel dispersions |
| VoxDim | dimensionality of the voxels |
| VoxHDim | |
Definition at line 56 of file TrackResiduals.h.
| anonymous enum |
Enumeration for the result indices.
| Enumerator | |
|---|---|
| ResX | X index. |
| ResY | Y index. |
| ResZ | Z index. |
| ResD | index for dispersions |
| ResDim | |
Definition at line 64 of file TrackResiduals.h.
| anonymous enum |
Enumeration for voxel status flags, using the same bits as in AliRoot version.
| Enumerator | |
|---|---|
| DistDone | voxel residuals have been processed |
| DispDone | voxel dispersions have been processed |
| SmoothDone | voxel has been smoothed |
| Masked | |
Definition at line 71 of file TrackResiduals.h.
|
strong |
| Enumerator | |
|---|---|
| Epanechnikov | |
| Gaussian | |
Definition at line 76 of file TrackResiduals.h.
|
default |
Default constructor.
|
delete |
Copying and assigning is forbidden.
| void TrackResiduals::clear | ( | ) |
clear member to be able to process new sector or new input files
Definition at line 1643 of file TrackResiduals.cxx.
| void TrackResiduals::closeOutputFile | ( | ) |
Closes the file with the debug output.
Definition at line 1606 of file TrackResiduals.cxx.
|
inline |
Ad-hoc correction of Z/X.
Definition at line 456 of file TrackResiduals.h.
| void TrackResiduals::dumpResults | ( | int | iSec | ) |
Dumps the full results for a given sector to the debug tree (only if an output file has been created before).
| iSec | Sector to dump |
Definition at line 1615 of file TrackResiduals.cxx.
| void TrackResiduals::fillStats | ( | int | iSec | ) |
Fill statistics from TTree.
Definition at line 347 of file TrackResiduals.cxx.
|
inline |
Calculates the bin indices of the closest voxel.
| x | Coordinate in X |
| y2x | Coordinate in Y/X |
| z2x | Coordinate in Z |
| ix | Resulting bin index in X |
| ip | Resulting bin index in Y/X |
| iz | Resulting bin index in Z/X |
Definition at line 626 of file TrackResiduals.h.
| bool TrackResiduals::findVoxelBin | ( | int | secID, |
| float | x, | ||
| float | y, | ||
| float | z, | ||
| std::array< unsigned char, VoxDim > & | bvox | ||
| ) | const |
Calculates the bin indices for given x, y, z in sector coordinates.
Definition at line 269 of file TrackResiduals.cxx.
|
static |
Fits a circle to a given set of points in x and y. Kasa algorithm is used.
| nCl | number of used points |
| x | array with values for x |
| y | array with values for y |
| xc | fit result for circle center position in x is stored here |
| yc | fit result for circle center position in y is stored here |
| r | fit result for circle radius is stored here |
| residHelixY | residuals in y from fitted circle to given points is stored here |
|
static |
Definition at line 1414 of file TrackResiduals.cxx.
|
static |
Fits a straight line to a given set of points, w/o taking into account measurement errors or different weights for the points Straight line is given by y = a * x + b
| res[0] | contains the slope (a) |
| res[1] | contains the offset (b) |
Definition at line 1539 of file TrackResiduals.cxx.
|
static |
Definition at line 1512 of file TrackResiduals.cxx.
| float TrackResiduals::fitPoly1Robust | ( | std::vector< float > & | x, |
| std::vector< float > & | y, | ||
| std::array< float, 2 > & | res, | ||
| std::array< float, 3 > & | err, | ||
| float | cutLTM | ||
| ) | const |
Performs a robust linear fit y(x) = a + b * x for given x and y. The input data is trimmed to reject outliers.
| x | First vector with input data |
| y | Second vector with input data |
| res | Array storing the fit results a and b |
| err | Array storing the uncertainties |
| cutLTM | Fraction of the input data to keep |
fitting + statistics helper functions
Definition at line 1138 of file TrackResiduals.cxx.
|
inline |
Returns the inverse of the distance between two bins in X
| ix | Bin index in X |
Definition at line 547 of file TrackResiduals.h.
|
inline |
Returns the inverse of the distance between two bins in Y/X
| ix | Bin index in X |
| iy | Bin index in Y/X (needed for non-uniform binning) |
Definition at line 599 of file TrackResiduals.h.
|
inline |
Returns the bin size in Z/X
| iz | Bin index in Z/X |
Definition at line 608 of file TrackResiduals.h.
|
inline |
Returns the inverse of the distance between two bins in Z/X
| iz | Bin index in Z/X (needed for non-uniform binning) |
Definition at line 617 of file TrackResiduals.h.
|
inline |
Calculates the global bin number
| bvox | Array with the voxels bin indices in X, Y/X and Z/X |
Definition at line 524 of file TrackResiduals.h.
|
inline |
Calculates the global bin number
| ix | Bin index in X |
| ip | Bin index in Y/X |
| iz | Bin index in Z/X |
Definition at line 530 of file TrackResiduals.h.
| double TrackResiduals::getKernelWeight | ( | std::array< double, 3 > | u2vec | ) | const |
Calculates the weight of the given point used for the kernel smoothing. Takes into account the defined kernel in mKernelType.
| u2vec | Weighted distance in X, Y/X and Z |
Definition at line 1112 of file TrackResiduals.cxx.
|
inline |
Definition at line 154 of file TrackResiduals.h.
| float TrackResiduals::getMAD2Sigma | ( | std::vector< float > | data | ) | const |
Calculates the median of the absolute deviations to the median of the data. The input vector is copied such that the original vector is not modified.
| data | Input data vector |
Definition at line 1370 of file TrackResiduals.cxx.
|
inline |
Calculates the max y/x-coordinate for given x bin taking the dead zone into account.
| ix | Bin index in x |
Definition at line 575 of file TrackResiduals.h.
|
inline |
Get the total number of voxels per TPC sector (mNXBins * mNY2XBins * mNZ2XBins)
Definition at line 288 of file TrackResiduals.h.
|
inline |
Definition at line 275 of file TrackResiduals.h.
|
inline |
Definition at line 280 of file TrackResiduals.h.
|
inline |
Definition at line 285 of file TrackResiduals.h.
|
inline |
Allow to access the output file from outside.
Definition at line 438 of file TrackResiduals.h.
|
inline |
output tree
Definition at line 450 of file TrackResiduals.h.
| int TrackResiduals::getRowID | ( | float | x | ) | const |
Get pad-row number for given x
| x | Coordinate in X |
Definition at line 239 of file TrackResiduals.cxx.
| bool TrackResiduals::getSmoothEstimate | ( | int | iSec, |
| float | x, | ||
| float | p, | ||
| float | z, | ||
| std::array< float, ResDim > & | res, | ||
| int | whichDim = 0 |
||
| ) |
Calculates a smooth estimate for the distortions in specified dimensions around the COG for a given voxel.
| iSec | Sector in which the voxel is located |
| x | COG position in X |
| p | COG position in Y/X |
| z | COG position in Z |
| res | Array to store the results |
| whichDim | Integer value with bits set for the dimensions which need to be smoothed |
Definition at line 749 of file TrackResiduals.cxx.
|
inline |
Calculates the coordinates of the center for a given voxel. These are not global TPC coordinates, but the coordinates for the given global binning system.
| isec | The sector in which we are |
| ix | Bin index in X |
| ip | Bin index in Y/X |
| iz | Bin index in Z/X |
| x | Coordinate in X |
| p | Coordinate in Y/X |
| z | Coordinate in Z/X |
Definition at line 536 of file TrackResiduals.h.
|
inline |
Definition at line 157 of file TrackResiduals.h.
|
inline |
Definition at line 155 of file TrackResiduals.h.
|
inline |
Calculates the x-coordinate for given x bin.
| ix | Bin index in x |
Definition at line 569 of file TrackResiduals.h.
|
inline |
Transforms X coordinate to bin index
| x | Coordinate in X |
Definition at line 644 of file TrackResiduals.h.
|
inline |
Transforms X coordinate to bin index
| x | Coordinate in X |
Definition at line 634 of file TrackResiduals.h.
|
inline |
Tests whether a bin in X is set to be ignored.
| iSec | Sector number |
| bin | Bin index in X |
Definition at line 346 of file TrackResiduals.h.
|
inline |
Calculates the y/x-coordinate.
| ix | Bin index in X |
| ip | Bin index in Y/X |
Definition at line 581 of file TrackResiduals.h.
|
inline |
Transforms Y/X coordinate to bin index at given X In case y2x is out of range the first or last bin is returned resp.
| y2x | Coordinate in Y/X |
| ix | Bin index in X |
Definition at line 672 of file TrackResiduals.h.
|
inline |
Transforms Y/X coordinate to bin index at given X In case y2x is out of range -1 or mNY2XBins is returned resp.
| y2x | Coordinate in Y/X |
| ix | Bin index in X |
Definition at line 651 of file TrackResiduals.h.
|
inline |
Calculates the z-coordinate for given z bin
| i | Bin index in Z/X |
Definition at line 590 of file TrackResiduals.h.
|
inline |
Transforms Z/X coordinate to bin index In case z2x is out of range the first or last bin is returned resp.
| z2x | Coordinate in Z/X |
Definition at line 702 of file TrackResiduals.h.
|
inline |
Transforms Z/X coordinate to bin index In case z2x is out of range XX or XXX is returned resp.
| z2x | Coordinate in Z/X |
Definition at line 679 of file TrackResiduals.h.
| void TrackResiduals::init | ( | bool | doBinning = true | ) |
Steers the initialization (binning, default settings for smoothing, container for the results).
| initBinning | Binning does not need to be initialized in case only outlier filtering is performed |
initialization + binning
Definition at line 51 of file TrackResiduals.cxx.
| void TrackResiduals::initBinning | ( | ) |
Initializes the binning in X, Y/X and Z.
Definition at line 147 of file TrackResiduals.cxx.
| void TrackResiduals::initResultsContainer | ( | int | iSec | ) |
Initializes the results structure for given sector. For each voxel the bin indices are set and the COG is set to the center of the voxel.
| iSec | TPC sector number |
Definition at line 206 of file TrackResiduals.cxx.
| void o2::tpc::TrackResiduals::initVoxelStats | ( | ) |
Initialize the statistics for the local residuals container.
| void TrackResiduals::medFit | ( | int | nPoints, |
| int | offset, | ||
| const std::vector< float > & | x, | ||
| const std::vector< float > & | y, | ||
| float & | a, | ||
| float & | b, | ||
| std::array< float, 3 > & | err | ||
| ) | const |
Fits a straight line to given x and y minimizing the absolute deviations y(x|a, b) = a + b * x. Not all data points need to be considered, but only a fraction of the input is used to perform the fit.
| nPoints | Number of points to consider |
| offset | Starting index for the input vectors |
| x | First vector with input data |
| y | Second vector with input data |
| a | Stores the result for a |
| b | Stores the result for b |
| err | Stores the uncertainties |
Definition at line 1191 of file TrackResiduals.cxx.
|
delete |
| void TrackResiduals::printMem | ( | ) | const |
Prints the current memory usage.
Definition at line 1626 of file TrackResiduals.cxx.
| void TrackResiduals::processSectorResiduals | ( | Int_t | iSec | ) |
Processes residuals for given sector.
| iSec | Sector to process |
Definition at line 367 of file TrackResiduals.cxx.
| void TrackResiduals::processVoxelDispersions | ( | std::vector< float > & | tg, |
| std::vector< float > & | dy, | ||
| VoxRes & | resVox | ||
| ) |
Estimates dispersion for given voxel
| tg | Vector with tan(phi) of the tracks |
| dy | Vector with residuals in y |
| resVox | Voxel results structure |
Definition at line 547 of file TrackResiduals.cxx.
| void TrackResiduals::processVoxelResiduals | ( | std::vector< float > & | dy, |
| std::vector< float > & | dz, | ||
| std::vector< float > & | tg, | ||
| VoxRes & | resVox | ||
| ) |
Performs the robust linear fit for one voxel to estimate the distortions in X, Y and Z and their errors.
| dy | Vector with residuals in y |
| dz | Vector with residuals in z |
| tg | Vector with tan(phi) of the tracks |
| resVox | Voxel results structure |
Definition at line 483 of file TrackResiduals.cxx.
| void TrackResiduals::reset | ( | ) |
Resets all (also intermediate) results.
Definition at line 229 of file TrackResiduals.cxx.
| float TrackResiduals::roFunc | ( | int | nPoints, |
| int | offset, | ||
| const std::vector< float > & | x, | ||
| const std::vector< float > & | y, | ||
| float | b, | ||
| float & | aa | ||
| ) | const |
Helper function for medFit. Calculates sum(x_i * sgn(y_i - a - b * x_i)) for a given b
| nPoints | Number of points to consider |
| offset | Starting index for the input vectors |
| x | First vector with input data |
| y | Second vector with input data |
| b | Given b |
| aa | Parameter a for linear fit (will be set by roFunc) |
Definition at line 1259 of file TrackResiduals.cxx.
| float TrackResiduals::selectKthMin | ( | const int | k, |
| std::vector< float > & | data | ||
| ) | const |
Returns the k-th smallest value in the vector. The input vector is rearranged such that the k-th smallest value is at the k-th position.
| k | Which value to get |
| data | Vector with input data |
Definition at line 1308 of file TrackResiduals.cxx.
|
inline |
Ad-hoc radial scaling factor A/C-Side.
Definition at line 453 of file TrackResiduals.h.
| void TrackResiduals::setKernelType | ( | KernelType | kernel = KernelType::Epanechnikov, |
| float | bwX = 2.1f, |
||
| float | bwP = 2.1f, |
||
| float | bwZ = 1.7f, |
||
| float | scX = 1.f, |
||
| float | scP = 1.f, |
||
| float | scZ = 1.f |
||
| ) |
Sets the kernel type used for smoothing.
| kernel | Kernel type (Epanechnikov / Gaussian) |
| bwX | Bin width in X |
| bwP | Bin width in Y/X |
| bwZ | Bin width in Z |
| scX | Scale factor to increase smoothing bandwidth at sector edges in X |
| scP | Scale factor to increase smoothing bandwidth at sector edges in Y/X |
| scZ | Scale factor to increase smoothing bandwidth at sector edges in Z |
Definition at line 296 of file TrackResiduals.cxx.
|
inline |
Sets the number of bins used in x direction
| nBins | number of bins |
Definition at line 274 of file TrackResiduals.h.
|
inline |
Sets the number of bins used in y/x direction
| nBins | number of bins |
Definition at line 279 of file TrackResiduals.h.
|
inline |
Sets the number of bins used in z/x direction
| nBins | number of bins |
Definition at line 284 of file TrackResiduals.h.
|
inline |
Sets a flag to print the memory usage at certain points in the program for performance studies.
Definition at line 133 of file TrackResiduals.h.
|
inline |
Setting the flag to true for a given dimension will enable smoothing with a 2nd order polynomial. Otherwise a first order polynomial will be used (default along z/x, since the bins are large)
Definition at line 146 of file TrackResiduals.h.
| void TrackResiduals::setStats | ( | const std::vector< TrackResiduals::VoxStats > & | statsIn, |
| int | iSec | ||
| ) |
Set the voxel statistics directly from outside.
processing functions
Definition at line 335 of file TrackResiduals.cxx.
|
inline |
Definition at line 150 of file TrackResiduals.h.
|
inline |
Definition at line 148 of file TrackResiduals.h.
| void TrackResiduals::setY2XBinning | ( | const std::vector< float > & | binning | ) |
Sets a custom (non-uniform) binning in y/x
| binning | Vector with custom binning from -1 to 1 |
Definition at line 69 of file TrackResiduals.cxx.
| void TrackResiduals::setZ2XBinning | ( | const std::vector< float > & | binning | ) |
Sets a custom (non-uniform) binning in z/x
| binning | Vector with custom binning from 0 to 1 |
Definition at line 107 of file TrackResiduals.cxx.
| void TrackResiduals::smooth | ( | int | iSec | ) |
Smooths the residuals for given sector
| iSec | Sector to process |
Definition at line 691 of file TrackResiduals.cxx.
| int TrackResiduals::validateVoxels | ( | int | iSec | ) |
Applies voxel validation cuts. Bad X bins are stored in mXBinsIgnore bitset
| iSec | Sector to process |
Definition at line 563 of file TrackResiduals.cxx.