Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /*
0002  * GblData.h
0003  *
0004  *  Created on: Aug 18, 2011
0005  *      Author: kleinwrt
0006  */
0007 
0008 /** \file
0009  *  GblData definition.
0010  *
0011  *  \author Claus Kleinwort, DESY, 2011 (Claus.Kleinwort@desy.de)
0012  *
0013  *  \copyright
0014  *  Copyright (c) 2011 - 2016 Deutsches Elektronen-Synchroton,
0015  *  Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY \n\n
0016  *  This library is free software; you can redistribute it and/or modify
0017  *  it under the terms of the GNU Library General Public License as
0018  *  published by the Free Software Foundation; either version 2 of the
0019  *  License, or (at your option) any later version. \n\n
0020  *  This library is distributed in the hope that it will be useful,
0021  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0022  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0023  *  GNU Library General Public License for more details. \n\n
0024  *  You should have received a copy of the GNU Library General Public
0025  *  License along with this program (see the file COPYING.LIB for more
0026  *  details); if not, write to the Free Software Foundation, Inc.,
0027  *  675 Mass Ave, Cambridge, MA 02139, USA.
0028  */
0029 
0030 #ifndef GBLDATA_H_
0031 #define GBLDATA_H_
0032 
0033 #include<iostream>
0034 #include<vector>
0035 #include<math.h>
0036 #include "VMatrix.h"
0037 #include "TVectorD.h"
0038 #include "TMatrixD.h"
0039 #include "TMatrixDSym.h"
0040 
0041 #include "Math/SMatrix.h"
0042 #include "Math/SVector.h"
0043 typedef ROOT::Math::SMatrix<double, 2, 5> SMatrix25;
0044 typedef ROOT::Math::SMatrix<double, 2, 7> SMatrix27;
0045 typedef ROOT::Math::SMatrix<double, 5, 5> SMatrix55;
0046 
0047 //! Namespace for the general broken lines package
0048 namespace gbl {
0049 
0050 /// Data (block) for independent scalar measurement
0051 /**
0052  * Data (block) containing value, precision and derivatives for measurements and kinks.
0053  * Created from attributes of GblPoints, used to construct linear equation system for track fit.
0054  */
0055 class GblData {
0056 public:
0057         GblData() : theLabel(0), theValue(0.), thePrecision(-1.), theDownWeight(0.), thePrediction(0.) {};
0058     GblData(unsigned int aLabel, double aMeas, double aPrec);
0059     virtual ~GblData();
0060     void addDerivatives(unsigned int iRow,
0061             const std::vector<unsigned int> &labDer, const SMatrix55 &matDer,
0062             unsigned int iOff, const TMatrixD &derLocal,
0063             const std::vector<int> &labGlobal, const TMatrixD &derGlobal,
0064             unsigned int nLocal, const TMatrixD &derTrans);
0065     void addDerivatives(unsigned int iRow,
0066             const std::vector<unsigned int> &labDer, const SMatrix27 &matDer,
0067             unsigned int nLocal, const TMatrixD &derTrans);
0068     void addDerivatives(const std::vector<unsigned int> &index,
0069             const std::vector<double> &derivatives);
0070 
0071     void setPrediction(const VVector &aVector);
0072     double setDownWeighting(unsigned int aMethod);
0073     double getChi2() const;
0074     void printData() const;
0075     void getLocalData(double &aValue, double &aWeight,
0076             std::vector<unsigned int>* &indLocal,
0077             std::vector<double>* &derLocal);
0078     void getAllData(double &aValue, double &aErr,
0079             std::vector<unsigned int>* &indLocal,
0080             std::vector<double>* &derLocal, std::vector<int>* &labGlobal,
0081             std::vector<double>* &derGlobal);
0082     void getResidual(double &aResidual, double &aVariance, double &aDownWeight,
0083             std::vector<unsigned int>* &indLocal,
0084             std::vector<double>* &derLocal);
0085 
0086 private:
0087     unsigned int theLabel; ///< Label (of measurements point)
0088     double theValue; ///< Value (residual)
0089     double thePrecision; ///< Precision (1/sigma**2)
0090     double theDownWeight; ///< Down-weighting factor (0-1)
0091     double thePrediction; ///< Prediction from fit
0092     std::vector<unsigned int> theParameters; ///< List of fit parameters (with non zero derivatives)
0093     std::vector<double> theDerivatives; ///< List of derivatives for fit
0094     std::vector<int> globalLabels; ///< Labels for global derivatives
0095     std::vector<double> globalDerivatives; ///< Global derivatives
0096 
0097         ClassDef(GblData, 1)
0098 };
0099 }
0100 #endif /* GBLDATA_H_ */