Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:25

0001 /* Copyright 2008-2010, Technische Universitaet Muenchen,
0002    Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch & Tobias Schlüter
0003 
0004    This file is part of GENFIT.
0005 
0006    GENFIT is free software: you can redistribute it and/or modify
0007    it under the terms of the GNU Lesser General Public License as published
0008    by the Free Software Foundation, either version 3 of the License, or
0009    (at your option) any later version.
0010 
0011    GENFIT is distributed in the hope that it will be useful,
0012    but WITHOUT ANY WARRANTY; without even the implied warranty of
0013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014    GNU Lesser General Public License for more details.
0015 
0016    You should have received a copy of the GNU Lesser General Public License
0017    along with GENFIT.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 /** @addtogroup genfit
0020  * @{
0021  */
0022 
0023 #ifndef genfit_ICalibrationParametersDerivatives_h
0024 #define genfit_ICalibrationParametersDerivatives_h
0025 
0026 #include "AbsMeasurement.h"
0027 #include "StateOnPlane.h"
0028 #include "TMatrixD.h"
0029 #include <TMatrixT.h>
0030 
0031 
0032 namespace genfit {
0033 
0034 /** @brief Abstract base class to establish an interface between physical representation
0035  * of the detector for alignment/calibration and (fitted) state on genfit::Track
0036  * 
0037  * An implementing class (RecoHit) should be able to calculate derivatives of 
0038  * track fit residuals (2D for planar, 1D for strip hit) residuals w.r.t.
0039  * global (and optionally additional local) parameters. Global parameters
0040  * need unique integer labels to identify them across all sub-detectors
0041  *
0042  *  @author TadeasBilka
0043  */
0044 class ICalibrationParametersDerivatives {
0045 
0046  public:
0047    virtual ~ICalibrationParametersDerivatives(){}
0048 
0049    /**
0050     * @brief Labels and derivatives of residuals (local measurement coordinates) w.r.t. alignment/calibration parameters
0051     * Matrix "G" of derivatives valid for given prediction of track state:
0052     * 
0053     * G(i, j) = d_residual_i/d_parameter_j
0054     * 
0055     * For 2D measurement (u,v):
0056     * 
0057     * G = ( du/da du/db du/dc ... )
0058     *     ( dv/da dv/db dv/dc ... )
0059     * 
0060     * for calibration parameters a, b, c.
0061     * 
0062     * For 1D measurement:
0063     * 
0064     * G = (   0     0     0   ... )
0065     *     ( dv/da dv/db dv/dc ... )    for V-strip,
0066     * 
0067     * 
0068     * G = ( du/da du/db du/dc ... )
0069     *     (   0     0     0   ... )    for U-strip,
0070     *
0071     * Measurements with more dimesions (slopes, curvature) should provide
0072     * full 4-5Dx(n params) matrix (state as (q/p, u', v', u, v) or (u', v', u, v))
0073     * 
0074     * 
0075     * @param sop Predicted state of the track as linearization point around 
0076     * which derivatives of alignment/calibration parameters shall be computed
0077     * @return pair<vector<int>, TMatrixD> With matrix with #rows = dimension of residual, #columns = number of parameters.
0078     * #columns must match vector<int>.size().
0079     */
0080    virtual std::pair<std::vector<int>, TMatrixD> globalDerivatives(const genfit::StateOnPlane* sop) {return std::make_pair(labels(), derivatives(sop));};
0081 
0082    /**
0083     * @brief Vector of integer labels for calibration/alignment
0084     * parameters available (must match #columns of derivatives(...))
0085     * 
0086     * unique across all sub-detectors in calibration
0087     * 
0088     * @return std::vector< int > Vector of integer labels
0089     */
0090    virtual std::vector<int> labels() {return std::vector<int>();}
0091    
0092    /**
0093     * @brief Derivatives of residuals (local measurement coordinates) w.r.t. alignment/calibration parameters
0094     * Matrix "G" of derivatives valid for given prediction of track state:
0095     * 
0096     * G(i, j) = d_residual_i/d_parameter_j
0097     * 
0098     * For 2D measurement (u,v):
0099     * 
0100     * G = ( du/da du/db du/dc ... )
0101     *     ( dv/da dv/db dv/dc ... )
0102     * 
0103     * for calibration parameters a, b, c.
0104     * 
0105     * For 1D measurement both forms are allowed:
0106     * 
0107     * G = (   0     0     0   ... )
0108     *     ( dv/da dv/db dv/dc ... )    for V-strip,
0109     * 
0110     * 
0111     * G = ( du/da du/db du/dc ... )
0112     *     (   0     0     0   ... )    for U-strip,
0113     * 
0114     * or :
0115     * 
0116     * G = ( d_sensitive/da d_sensitive/db d_sensitive/dc ... )   as matrix with one row.
0117     * 
0118     * A possible algorithm using these derivatives
0119     * should be able to resolve this based on the measurement HMatrix.
0120     * Measurements with more dimesions (slopes, curvature) should provide
0121     * full 4-5Dx(n params) matrix (state as (q/p, u', v', u, v) or (u', v', u, v))
0122     * 
0123     * 
0124     * @param sop Predicted state of the track as linearization point around 
0125     * which derivatives of alignment/calibration parameters shall be computed
0126     * @return TMatrixD Matrix with #rows = dimension of residual, #columns = number of parameters.
0127     * #columns must match labels().size().
0128     */
0129    virtual TMatrixD derivatives(const genfit::StateOnPlane*) {return TMatrixD();}
0130    
0131    /**
0132     * @brief Derivatives for additional local parameters to be fitted
0133     * in global calibration algorithms together with with global parameters
0134     * 
0135     * Local parameters are not neccesarily identified by label because their number
0136     * is proportional to number of measurements included in calibration
0137     * (possibly very huge number!)
0138     * 
0139     * @return TMatrixD Matrix in form d_residual_i/d_parameter_j
0140     */
0141    virtual TMatrixD localDerivatives(const genfit::StateOnPlane*) {return TMatrixD();}
0142    
0143    /**
0144     * @brief Vector of integer labels for local calibration
0145     * parameters available (must match #columns of localDerivatives(...))
0146     * 
0147     * This will be usually ignored (e.g. does not have to match localDerivatives),
0148     * but it is a good practice to return vector of zeros of correct size
0149     * @return std::vector< int > Vector of integer labels
0150     */
0151    virtual std::vector<int> localLabels() {return std::vector<int>();}
0152    
0153 };
0154 
0155 } /* End of namespace genfit */
0156 /** @} */
0157 
0158 #endif // genfit_ICalibrationParametersDerivatives_h