CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
gbl::GblTrajectory Class Reference

GBL trajectory. More...

#include <GblTrajectory.h>

Public Member Functions

unsigned int fit (double &Chi2, int &Ndf, double &lostWeight, std::string optionList="")
 Perform fit of trajectory. More...
 
 GblTrajectory (const std::vector< GblPoint > &aPointList, bool flagCurv=true, bool flagU1dir=true, bool flagU2dir=true)
 Create new (simple) trajectory from list of points. More...
 
 GblTrajectory (const std::vector< GblPoint > &aPointList, unsigned int aLabel, const TMatrixDSym &aSeed, bool flagCurv=true, bool flagU1dir=true, bool flagU2dir=true)
 Create new (simple) trajectory from list of points with external seed. More...
 
 GblTrajectory (const std::vector< std::pair< std::vector< GblPoint >, TMatrixD > > &aPointaAndTransList)
 Create new composed trajectory from list of points and transformations. More...
 
 GblTrajectory (const std::vector< std::pair< std::vector< GblPoint >, TMatrixD > > &aPointaAndTransList, const TMatrixD &extDerivatives, const TVectorD &extMeasurements, const TVectorD &extPrecisions)
 Create new composed trajectory from list of points and transformations with (independent) external measurements. More...
 
void getLabels (std::vector< unsigned int > &aLabelList)
 Get (list of) labels of points on (simple) trajectory. More...
 
void getLabels (std::vector< std::vector< unsigned int > > &aLabelList)
 Get (list of lists of) labels of points on (composed) trajectory. More...
 
unsigned int getMeasResults (unsigned int aLabel, unsigned int &numRes, TVectorD &aResiduals, TVectorD &aMeasErrors, TVectorD &aResErrors, TVectorD &aDownWeights)
 Get residuals at point from measurement. More...
 
unsigned int getNumPoints () const
 Retrieve number of point from trajectory. More...
 
unsigned int getResults (int aSignedLabel, TVectorD &localPar, TMatrixDSym &localCov) const
 Get fit results at point. More...
 
unsigned int getScatResults (unsigned int aLabel, unsigned int &numRes, TVectorD &aResiduals, TVectorD &aMeasErrors, TVectorD &aResErrors, TVectorD &aDownWeights)
 Get (kink) residuals at point from scatterer. More...
 
bool isValid () const
 Retrieve validity of trajectory. More...
 
void milleOut (MilleBinary &aMille)
 Write valid trajectory to Millepede-II binary file. More...
 
void printData ()
 Print GblData blocks for trajectory. More...
 
void printPoints (unsigned int level=0)
 Print GblPoints on trajectory. More...
 
void printTrajectory (unsigned int level=0)
 Print GblTrajectory. More...
 
virtual ~GblTrajectory ()
 

Private Member Functions

void buildLinearEquationSystem ()
 Build linear equation system from data (blocks). More...
 
void calcJacobians ()
 Calculate Jacobians to previous/next scatterer from point to point ones. More...
 
void construct ()
 Construct trajectory from list of points. More...
 
void defineOffsets ()
 Define offsets from list of points. More...
 
double downWeight (unsigned int aMethod)
 Down-weight all points. More...
 
void getFitToKinkJacobian (std::vector< unsigned int > &anIndex, SMatrix27 &aJacobian, const GblPoint &aPoint) const
 Get jacobian for transformation from (trajectory) fit to kink parameters at point. More...
 
void getFitToLocalJacobian (std::vector< unsigned int > &anIndex, SMatrix55 &aJacobian, const GblPoint &aPoint, unsigned int measDim, unsigned int nJacobian=1) const
 Get (part of) jacobian for transformation from (trajectory) fit to track parameters at point. More...
 
std::pair< std::vector
< unsigned int >, TMatrixD > 
getJacobian (int aSignedLabel) const
 Get jacobian for transformation from fit to track parameters at point. More...
 
void getResAndErr (unsigned int aData, double &aResidual, double &aMeadsError, double &aResError, double &aDownWeight)
 Get residual and errors from data block. More...
 
void predict ()
 Calculate predictions for all points. More...
 
void prepare ()
 Prepare fit for simple or composed trajectory. More...
 

Private Attributes

bool constructOK
 Trajectory has been successfully constructed (ready for fit/output) More...
 
TMatrixD externalDerivatives
 
TVectorD externalMeasurements
 
unsigned int externalPoint
 Label of external point (or 0) More...
 
TVectorD externalPrecisions
 
TMatrixDSym externalSeed
 Precision (inverse covariance matrix) of external seed. More...
 
bool fitOK
 Trajectory has been successfully fitted (results are valid) More...
 
std::vector< TMatrixD > innerTransformations
 Transformations at innermost points of. More...
 
std::vector< unsigned int > measDataIndex
 mapping points to data blocks from measurements More...
 
unsigned int numAllPoints
 Number of all points on trajectory. More...
 
unsigned int numCurvature
 Number of curvature parameters (0 or 1) or external parameters. More...
 
unsigned int numInnerTrans
 Number of inner transformations to external parameters. More...
 
unsigned int numLocals
 Total number of (additional) local parameters. More...
 
unsigned int numMeasurements
 Total number of measurements. More...
 
unsigned int numOffsets
 Number of (points with) offsets on trajectory. More...
 
unsigned int numParameters
 Number of fit parameters. More...
 
std::vector< unsigned int > numPoints
 Number of points on (sub)trajectory. More...
 
unsigned int numTrajectories
 Number of trajectories (in composed trajectory) More...
 
std::vector< unsigned int > scatDataIndex
 mapping points to data blocks from scatterers More...
 
std::vector< GblDatatheData
 List of data blocks. More...
 
std::vector< unsigned int > theDimension
 List of active dimensions (0=u1, 1=u2) in fit. More...
 
BorderedBandMatrix theMatrix
 (Bordered band) matrix of linear equation system More...
 
std::vector< std::vector
< GblPoint > > 
thePoints
 (list of) List of points on trajectory More...
 
VVector theVector
 Vector of linear equation system. More...
 

Detailed Description

GBL trajectory.

List of GblPoints ordered by arc length. Can be fitted and optionally written to MP-II binary file.

Definition at line 26 of file GblTrajectory.h.

Constructor & Destructor Documentation

gbl::GblTrajectory::GblTrajectory ( const std::vector< GblPoint > &  aPointList,
bool  flagCurv = true,
bool  flagU1dir = true,
bool  flagU2dir = true 
)

Create new (simple) trajectory from list of points.

Curved trajectory in space (default) or without curvature (q/p) or in one plane (u-direction) only.

Parameters
[in]aPointListList of points
[in]flagCurvUse q/p
[in]flagU1dirUse in u1 direction
[in]flagU2dirUse in u2 direction

Definition at line 117 of file GblTrajectory.cc.

References construct(), numAllPoints, numPoints, theDimension, and thePoints.

118  :
119  numAllPoints(aPointList.size()), numPoints(), numOffsets(0), numInnerTrans(
120  0), numCurvature(flagCurv ? 1 : 0), numParameters(0), numLocals(
122 
123  if (flagU1dir)
124  theDimension.push_back(0);
125  if (flagU2dir)
126  theDimension.push_back(1);
127  // simple (single) trajectory
128  thePoints.push_back(aPointList);
129  numPoints.push_back(numAllPoints);
130  construct(); // construct trajectory
131 }
std::vector< unsigned int > scatDataIndex
mapping points to data blocks from scatterers
Definition: GblTrajectory.h:76
void construct()
Construct trajectory from list of points.
TVectorD externalPrecisions
Definition: GblTrajectory.h:82
unsigned int numParameters
Number of fit parameters.
Definition: GblTrajectory.h:66
std::vector< unsigned int > measDataIndex
mapping points to data blocks from measurements
Definition: GblTrajectory.h:75
std::vector< unsigned int > theDimension
List of active dimensions (0=u1, 1=u2) in fit.
Definition: GblTrajectory.h:72
TMatrixDSym externalSeed
Precision (inverse covariance matrix) of external seed.
Definition: GblTrajectory.h:77
unsigned int numOffsets
Number of (points with) offsets on trajectory.
Definition: GblTrajectory.h:63
unsigned int externalPoint
Label of external point (or 0)
Definition: GblTrajectory.h:69
unsigned int numInnerTrans
Number of inner transformations to external parameters.
Definition: GblTrajectory.h:64
unsigned int numMeasurements
Total number of measurements.
Definition: GblTrajectory.h:68
std::vector< unsigned int > numPoints
Number of points on (sub)trajectory.
Definition: GblTrajectory.h:61
std::vector< TMatrixD > innerTransformations
Transformations at innermost points of.
Definition: GblTrajectory.h:78
std::vector< GblData > theData
List of data blocks.
Definition: GblTrajectory.h:74
TMatrixD externalDerivatives
Definition: GblTrajectory.h:80
std::vector< std::vector< GblPoint > > thePoints
(list of) List of points on trajectory
Definition: GblTrajectory.h:73
unsigned int numLocals
Total number of (additional) local parameters.
Definition: GblTrajectory.h:67
unsigned int numAllPoints
Number of all points on trajectory.
Definition: GblTrajectory.h:60
TVectorD externalMeasurements
Definition: GblTrajectory.h:81
unsigned int numCurvature
Number of curvature parameters (0 or 1) or external parameters.
Definition: GblTrajectory.h:65
gbl::GblTrajectory::GblTrajectory ( const std::vector< GblPoint > &  aPointList,
unsigned int  aLabel,
const TMatrixDSym &  aSeed,
bool  flagCurv = true,
bool  flagU1dir = true,
bool  flagU2dir = true 
)

Create new (simple) trajectory from list of points with external seed.

Curved trajectory in space (default) or without curvature (q/p) or in one plane (u-direction) only.

Parameters
[in]aPointListList of points
[in]aLabel(Signed) label of point for external seed (<0: in front, >0: after point, slope changes at scatterer!)
[in]aSeedPrecision matrix of external seed
[in]flagCurvUse q/p
[in]flagU1dirUse in u1 direction
[in]flagU2dirUse in u2 direction

Definition at line 145 of file GblTrajectory.cc.

References construct(), numAllPoints, numPoints, theDimension, and thePoints.

147  :
148  numAllPoints(aPointList.size()), numPoints(), numOffsets(0), numInnerTrans(
149  0), numCurvature(flagCurv ? 1 : 0), numParameters(0), numLocals(
152 
153  if (flagU1dir)
154  theDimension.push_back(0);
155  if (flagU2dir)
156  theDimension.push_back(1);
157  // simple (single) trajectory
158  thePoints.push_back(aPointList);
159  numPoints.push_back(numAllPoints);
160  construct(); // construct trajectory
161 }
std::vector< unsigned int > scatDataIndex
mapping points to data blocks from scatterers
Definition: GblTrajectory.h:76
void construct()
Construct trajectory from list of points.
TVectorD externalPrecisions
Definition: GblTrajectory.h:82
unsigned int numParameters
Number of fit parameters.
Definition: GblTrajectory.h:66
std::vector< unsigned int > measDataIndex
mapping points to data blocks from measurements
Definition: GblTrajectory.h:75
std::vector< unsigned int > theDimension
List of active dimensions (0=u1, 1=u2) in fit.
Definition: GblTrajectory.h:72
TMatrixDSym externalSeed
Precision (inverse covariance matrix) of external seed.
Definition: GblTrajectory.h:77
unsigned int numOffsets
Number of (points with) offsets on trajectory.
Definition: GblTrajectory.h:63
unsigned int externalPoint
Label of external point (or 0)
Definition: GblTrajectory.h:69
unsigned int numInnerTrans
Number of inner transformations to external parameters.
Definition: GblTrajectory.h:64
unsigned int numMeasurements
Total number of measurements.
Definition: GblTrajectory.h:68
std::vector< unsigned int > numPoints
Number of points on (sub)trajectory.
Definition: GblTrajectory.h:61
std::vector< TMatrixD > innerTransformations
Transformations at innermost points of.
Definition: GblTrajectory.h:78
std::vector< GblData > theData
List of data blocks.
Definition: GblTrajectory.h:74
TMatrixD externalDerivatives
Definition: GblTrajectory.h:80
std::vector< std::vector< GblPoint > > thePoints
(list of) List of points on trajectory
Definition: GblTrajectory.h:73
unsigned int numLocals
Total number of (additional) local parameters.
Definition: GblTrajectory.h:67
unsigned int numAllPoints
Number of all points on trajectory.
Definition: GblTrajectory.h:60
TVectorD externalMeasurements
Definition: GblTrajectory.h:81
unsigned int numCurvature
Number of curvature parameters (0 or 1) or external parameters.
Definition: GblTrajectory.h:65
gbl::GblTrajectory::GblTrajectory ( const std::vector< std::pair< std::vector< GblPoint >, TMatrixD > > &  aPointsAndTransList)

Create new composed trajectory from list of points and transformations.

Composed of curved trajectory in space.

Parameters
[in]aPointsAndTransListList containing pairs with list of points and transformation (at inner (first) point)

Definition at line 168 of file GblTrajectory.cc.

References construct(), plotBeamSpotDB::first, innerTransformations, numAllPoints, numCurvature, numPoints, edm::second(), theDimension, and thePoints.

169  :
171  aPointsAndTransList.size()), numParameters(0), numLocals(0), numMeasurements(
173 
174  for (unsigned int iTraj = 0; iTraj < aPointsAndTransList.size(); ++iTraj) {
175  thePoints.push_back(aPointsAndTransList[iTraj].first);
176  numPoints.push_back(thePoints.back().size());
177  numAllPoints += numPoints.back();
178  innerTransformations.push_back(aPointsAndTransList[iTraj].second);
179  }
180  theDimension.push_back(0);
181  theDimension.push_back(1);
182  numCurvature = innerTransformations[0].GetNcols();
183  construct(); // construct (composed) trajectory
184 }
std::vector< unsigned int > scatDataIndex
mapping points to data blocks from scatterers
Definition: GblTrajectory.h:76
void construct()
Construct trajectory from list of points.
TVectorD externalPrecisions
Definition: GblTrajectory.h:82
unsigned int numParameters
Number of fit parameters.
Definition: GblTrajectory.h:66
std::vector< unsigned int > measDataIndex
mapping points to data blocks from measurements
Definition: GblTrajectory.h:75
std::vector< unsigned int > theDimension
List of active dimensions (0=u1, 1=u2) in fit.
Definition: GblTrajectory.h:72
TMatrixDSym externalSeed
Precision (inverse covariance matrix) of external seed.
Definition: GblTrajectory.h:77
unsigned int numOffsets
Number of (points with) offsets on trajectory.
Definition: GblTrajectory.h:63
U second(std::pair< T, U > const &p)
unsigned int externalPoint
Label of external point (or 0)
Definition: GblTrajectory.h:69
unsigned int numInnerTrans
Number of inner transformations to external parameters.
Definition: GblTrajectory.h:64
unsigned int numMeasurements
Total number of measurements.
Definition: GblTrajectory.h:68
std::vector< unsigned int > numPoints
Number of points on (sub)trajectory.
Definition: GblTrajectory.h:61
std::vector< TMatrixD > innerTransformations
Transformations at innermost points of.
Definition: GblTrajectory.h:78
std::vector< GblData > theData
List of data blocks.
Definition: GblTrajectory.h:74
TMatrixD externalDerivatives
Definition: GblTrajectory.h:80
std::vector< std::vector< GblPoint > > thePoints
(list of) List of points on trajectory
Definition: GblTrajectory.h:73
unsigned int numLocals
Total number of (additional) local parameters.
Definition: GblTrajectory.h:67
unsigned int numAllPoints
Number of all points on trajectory.
Definition: GblTrajectory.h:60
TVectorD externalMeasurements
Definition: GblTrajectory.h:81
unsigned int numCurvature
Number of curvature parameters (0 or 1) or external parameters.
Definition: GblTrajectory.h:65
gbl::GblTrajectory::GblTrajectory ( const std::vector< std::pair< std::vector< GblPoint >, TMatrixD > > &  aPointsAndTransList,
const TMatrixD &  extDerivatives,
const TVectorD &  extMeasurements,
const TVectorD &  extPrecisions 
)

Create new composed trajectory from list of points and transformations with (independent) external measurements.

Composed of curved trajectory in space.

Parameters
[in]aPointsAndTransListList containing pairs with list of points and transformation (at inner (first) point)
[in]extDerivativesDerivatives of external measurements vs external parameters
[in]extMeasurementsExternal measurements (residuals)
[in]extPrecisionsPrecision of external measurements

Definition at line 194 of file GblTrajectory.cc.

References construct(), plotBeamSpotDB::first, innerTransformations, numAllPoints, numCurvature, numPoints, edm::second(), theDimension, and thePoints.

197  :
199  aPointsAndTransList.size()), numParameters(0), numLocals(0), numMeasurements(
201  extDerivatives), externalMeasurements(extMeasurements), externalPrecisions(
202  extPrecisions) {
203 
204  for (unsigned int iTraj = 0; iTraj < aPointsAndTransList.size(); ++iTraj) {
205  thePoints.push_back(aPointsAndTransList[iTraj].first);
206  numPoints.push_back(thePoints.back().size());
207  numAllPoints += numPoints.back();
208  innerTransformations.push_back(aPointsAndTransList[iTraj].second);
209  }
210  theDimension.push_back(0);
211  theDimension.push_back(1);
212  numCurvature = innerTransformations[0].GetNcols();
213  construct(); // construct (composed) trajectory
214 }
std::vector< unsigned int > scatDataIndex
mapping points to data blocks from scatterers
Definition: GblTrajectory.h:76
void construct()
Construct trajectory from list of points.
TVectorD externalPrecisions
Definition: GblTrajectory.h:82
unsigned int numParameters
Number of fit parameters.
Definition: GblTrajectory.h:66
std::vector< unsigned int > measDataIndex
mapping points to data blocks from measurements
Definition: GblTrajectory.h:75
std::vector< unsigned int > theDimension
List of active dimensions (0=u1, 1=u2) in fit.
Definition: GblTrajectory.h:72
TMatrixDSym externalSeed
Precision (inverse covariance matrix) of external seed.
Definition: GblTrajectory.h:77
unsigned int numOffsets
Number of (points with) offsets on trajectory.
Definition: GblTrajectory.h:63
U second(std::pair< T, U > const &p)
unsigned int externalPoint
Label of external point (or 0)
Definition: GblTrajectory.h:69
unsigned int numInnerTrans
Number of inner transformations to external parameters.
Definition: GblTrajectory.h:64
unsigned int numMeasurements
Total number of measurements.
Definition: GblTrajectory.h:68
std::vector< unsigned int > numPoints
Number of points on (sub)trajectory.
Definition: GblTrajectory.h:61
std::vector< TMatrixD > innerTransformations
Transformations at innermost points of.
Definition: GblTrajectory.h:78
std::vector< GblData > theData
List of data blocks.
Definition: GblTrajectory.h:74
TMatrixD externalDerivatives
Definition: GblTrajectory.h:80
std::vector< std::vector< GblPoint > > thePoints
(list of) List of points on trajectory
Definition: GblTrajectory.h:73
unsigned int numLocals
Total number of (additional) local parameters.
Definition: GblTrajectory.h:67
unsigned int numAllPoints
Number of all points on trajectory.
Definition: GblTrajectory.h:60
TVectorD externalMeasurements
Definition: GblTrajectory.h:81
unsigned int numCurvature
Number of curvature parameters (0 or 1) or external parameters.
Definition: GblTrajectory.h:65
gbl::GblTrajectory::~GblTrajectory ( )
virtual

Definition at line 216 of file GblTrajectory.cc.

216  {
217 }

Member Function Documentation

void gbl::GblTrajectory::buildLinearEquationSystem ( )
private

Build linear equation system from data (blocks).

Definition at line 692 of file GblTrajectory.cc.

References gbl::BorderedBandMatrix::addBlockMatrix(), j, numCurvature, numLocals, numParameters, gbl::VVector::resize(), gbl::BorderedBandMatrix::resize(), theData, theMatrix, and theVector.

Referenced by fit().

692  {
693  unsigned int nBorder = numCurvature + numLocals;
695  theMatrix.resize(numParameters, nBorder);
696  double aValue, aWeight;
697  std::vector<unsigned int>* indLocal;
698  std::vector<double>* derLocal;
699  std::vector<GblData>::iterator itData;
700  for (itData = theData.begin(); itData < theData.end(); ++itData) {
701  itData->getLocalData(aValue, aWeight, indLocal, derLocal);
702  for (unsigned int j = 0; j < indLocal->size(); ++j) {
703  theVector((*indLocal)[j] - 1) += (*derLocal)[j] * aWeight * aValue;
704  }
705  theMatrix.addBlockMatrix(aWeight, indLocal, derLocal);
706  }
707 }
void addBlockMatrix(double aWeight, const std::vector< unsigned int > *anIndex, const std::vector< double > *aVector)
Add symmetric block matrix.
unsigned int numParameters
Number of fit parameters.
Definition: GblTrajectory.h:66
void resize(const unsigned int nRows)
Resize vector.
Definition: VMatrix.cc:240
int j
Definition: DBlmapReader.cc:9
std::vector< GblData > theData
List of data blocks.
Definition: GblTrajectory.h:74
void resize(unsigned int nSize, unsigned int nBorder=1, unsigned int nBand=5)
Resize bordered band matrix.
BorderedBandMatrix theMatrix
(Bordered band) matrix of linear equation system
Definition: GblTrajectory.h:84
VVector theVector
Vector of linear equation system.
Definition: GblTrajectory.h:83
unsigned int numLocals
Total number of (additional) local parameters.
Definition: GblTrajectory.h:67
unsigned int numCurvature
Number of curvature parameters (0 or 1) or external parameters.
Definition: GblTrajectory.h:65
void gbl::GblTrajectory::calcJacobians ( )
private

Calculate Jacobians to previous/next scatterer from point to point ones.

Definition at line 297 of file GblTrajectory.cc.

References gbl::GblPoint::addNextJacobian(), begin, end, gbl::GblPoint::getP2pJacobian(), numTrajectories, and thePoints.

Referenced by construct().

297  {
298 
299  SMatrix55 scatJacobian;
300  // loop over trajectories
301  for (unsigned int iTraj = 0; iTraj < numTrajectories; ++iTraj) {
302  // forward propagation (all)
303  GblPoint* previousPoint = &thePoints[iTraj].front();
304  unsigned int numStep = 0;
305  std::vector<GblPoint>::iterator itPoint;
306  for (itPoint = thePoints[iTraj].begin() + 1;
307  itPoint < thePoints[iTraj].end(); ++itPoint) {
308  if (numStep == 0) {
309  scatJacobian = itPoint->getP2pJacobian();
310  } else {
311  scatJacobian = itPoint->getP2pJacobian() * scatJacobian;
312  }
313  numStep++;
314  itPoint->addPrevJacobian(scatJacobian); // iPoint -> previous scatterer
315  if (itPoint->getOffset() >= 0) {
316  previousPoint->addNextJacobian(scatJacobian); // lastPoint -> next scatterer
317  numStep = 0;
318  previousPoint = &(*itPoint);
319  }
320  }
321  // backward propagation (without scatterers)
322  for (itPoint = thePoints[iTraj].end() - 1;
323  itPoint > thePoints[iTraj].begin(); --itPoint) {
324  if (itPoint->getOffset() >= 0) {
325  scatJacobian = itPoint->getP2pJacobian();
326  continue; // skip offsets
327  }
328  itPoint->addNextJacobian(scatJacobian); // iPoint -> next scatterer
329  scatJacobian = scatJacobian * itPoint->getP2pJacobian();
330  }
331  }
332 }
ROOT::Math::SMatrix< double, 5, 5 > SMatrix55
Definition: GblData.h:23
#define end
Definition: vmac.h:37
std::vector< std::vector< GblPoint > > thePoints
(list of) List of points on trajectory
Definition: GblTrajectory.h:73
unsigned int numTrajectories
Number of trajectories (in composed trajectory)
Definition: GblTrajectory.h:62
#define begin
Definition: vmac.h:30
void gbl::GblTrajectory::construct ( )
private

Construct trajectory from list of points.

Trajectory is prepared for fit or output to binary file, may consists of sub-trajectories.

Definition at line 233 of file GblTrajectory.cc.

References begin, calcJacobians(), constructOK, gather_cfg::cout, defineOffsets(), alignCSCRings::e, fitOK, bookConverter::max, numAllPoints, numCurvature, numInnerTrans, numLocals, numMeasurements, numOffsets, numParameters, numTrajectories, prepare(), theDimension, and thePoints.

Referenced by GblTrajectory().

233  {
234 
235  constructOK = false;
236  fitOK = false;
237  unsigned int aLabel = 0;
238  if (numAllPoints < 2) {
239  std::cout << " GblTrajectory construction failed: too few GblPoints "
240  << std::endl;
241  return;
242  }
243  // loop over trajectories
244  numTrajectories = thePoints.size();
245  //std::cout << " numTrajectories: " << numTrajectories << ", " << innerTransformations.size() << std::endl;
246  for (unsigned int iTraj = 0; iTraj < numTrajectories; ++iTraj) {
247  std::vector<GblPoint>::iterator itPoint;
248  for (itPoint = thePoints[iTraj].begin();
249  itPoint < thePoints[iTraj].end(); ++itPoint) {
250  numLocals = std::max(numLocals, itPoint->getNumLocals());
251  numMeasurements += itPoint->hasMeasurement();
252  itPoint->setLabel(++aLabel);
253  }
254  }
255  defineOffsets();
256  calcJacobians();
257  try {
258  prepare();
259  } catch (std::overflow_error &e) {
260  std::cout << " GblTrajectory construction failed: " << e.what()
261  << std::endl;
262  return;
263  }
264  constructOK = true;
265  // number of fit parameters
268 }
unsigned int numParameters
Number of fit parameters.
Definition: GblTrajectory.h:66
bool constructOK
Trajectory has been successfully constructed (ready for fit/output)
Definition: GblTrajectory.h:70
bool fitOK
Trajectory has been successfully fitted (results are valid)
Definition: GblTrajectory.h:71
std::vector< unsigned int > theDimension
List of active dimensions (0=u1, 1=u2) in fit.
Definition: GblTrajectory.h:72
unsigned int numOffsets
Number of (points with) offsets on trajectory.
Definition: GblTrajectory.h:63
unsigned int numInnerTrans
Number of inner transformations to external parameters.
Definition: GblTrajectory.h:64
void calcJacobians()
Calculate Jacobians to previous/next scatterer from point to point ones.
unsigned int numMeasurements
Total number of measurements.
Definition: GblTrajectory.h:68
void defineOffsets()
Define offsets from list of points.
void prepare()
Prepare fit for simple or composed trajectory.
std::vector< std::vector< GblPoint > > thePoints
(list of) List of points on trajectory
Definition: GblTrajectory.h:73
unsigned int numTrajectories
Number of trajectories (in composed trajectory)
Definition: GblTrajectory.h:62
#define begin
Definition: vmac.h:30
unsigned int numLocals
Total number of (additional) local parameters.
Definition: GblTrajectory.h:67
tuple cout
Definition: gather_cfg.py:121
unsigned int numAllPoints
Number of all points on trajectory.
Definition: GblTrajectory.h:60
unsigned int numCurvature
Number of curvature parameters (0 or 1) or external parameters.
Definition: GblTrajectory.h:65
void gbl::GblTrajectory::defineOffsets ( )
private

Define offsets from list of points.

Define offsets at points with scatterers and first and last point. All other points need interpolation from adjacent points with offsets.

Definition at line 275 of file GblTrajectory.cc.

References begin, numOffsets, numTrajectories, and thePoints.

Referenced by construct().

275  {
276 
277  // loop over trajectories
278  for (unsigned int iTraj = 0; iTraj < numTrajectories; ++iTraj) {
279  // first point is offset
280  thePoints[iTraj].front().setOffset(numOffsets++);
281  // intermediate scatterers are offsets
282  std::vector<GblPoint>::iterator itPoint;
283  for (itPoint = thePoints[iTraj].begin() + 1;
284  itPoint < thePoints[iTraj].end() - 1; ++itPoint) {
285  if (itPoint->hasScatterer()) {
286  itPoint->setOffset(numOffsets++);
287  } else {
288  itPoint->setOffset(-numOffsets);
289  }
290  }
291  // last point is offset
292  thePoints[iTraj].back().setOffset(numOffsets++);
293  }
294 }
unsigned int numOffsets
Number of (points with) offsets on trajectory.
Definition: GblTrajectory.h:63
std::vector< std::vector< GblPoint > > thePoints
(list of) List of points on trajectory
Definition: GblTrajectory.h:73
unsigned int numTrajectories
Number of trajectories (in composed trajectory)
Definition: GblTrajectory.h:62
#define begin
Definition: vmac.h:30
double gbl::GblTrajectory::downWeight ( unsigned int  aMethod)
private

Down-weight all points.

Parameters
[in]aMethodM-estimator (1: Tukey, 2:Huber, 3:Cauchy)

Definition at line 937 of file GblTrajectory.cc.

References theData.

Referenced by fit().

937  {
938  double aLoss = 0.;
939  std::vector<GblData>::iterator itData;
940  for (itData = theData.begin(); itData < theData.end(); ++itData) {
941  aLoss += (1. - itData->setDownWeighting(aMethod));
942  }
943  return aLoss;
944 }
std::vector< GblData > theData
List of data blocks.
Definition: GblTrajectory.h:74
unsigned int gbl::GblTrajectory::fit ( double &  Chi2,
int &  Ndf,
double &  lostWeight,
std::string  optionList = "" 
)

Perform fit of trajectory.

Optionally iterate for outlier down-weighting.

Parameters
[out]Chi2Chi2 sum (corrected for down-weighting)
[out]NdfNumber of degrees of freedom
[out]lostWeightSum of weights lost due to down-weighting
[in]optionListIterations for down-weighting (One character per iteration: t,h,c (or T,H,C) for Tukey, Huber or Cauchy function)
Returns
Error code (non zero value indicates failure of fit)

Definition at line 956 of file GblTrajectory.cc.

References buildLinearEquationSystem(), constructOK, gather_cfg::cout, downWeight(), alignCSCRings::e, fitOK, i, numParameters, predict(), gbl::BorderedBandMatrix::solveAndInvertBorderedBand(), AlCaHLTBitMon_QueryRunRegistry::string, theData, theMatrix, and theVector.

957  {
958  const double normChi2[4] = { 1.0, 0.8737, 0.9326, 0.8228 };
959  const std::string methodList = "TtHhCc";
960 
961  Chi2 = 0.;
962  Ndf = -1;
963  lostWeight = 0.;
964  if (not constructOK)
965  return 10;
966 
967  unsigned int aMethod = 0;
968 
970  lostWeight = 0.;
971  unsigned int ierr = 0;
972  try {
973 
975  predict();
976 
977  for (unsigned int i = 0; i < optionList.size(); ++i) // down weighting iterations
978  {
979  size_t aPosition = methodList.find(optionList[i]);
980  if (aPosition != std::string::npos) {
981  aMethod = aPosition / 2 + 1;
982  lostWeight = downWeight(aMethod);
985  predict();
986  }
987  }
988  Ndf = theData.size() - numParameters;
989  Chi2 = 0.;
990  for (unsigned int i = 0; i < theData.size(); ++i) {
991  Chi2 += theData[i].getChi2();
992  }
993  Chi2 /= normChi2[aMethod];
994  fitOK = true;
995 
996  } catch (int e) {
997  std::cout << " GblTrajectory::fit exception " << e << std::endl;
998  ierr = e;
999  }
1000  return ierr;
1001 }
int i
Definition: DBlmapReader.cc:9
void buildLinearEquationSystem()
Build linear equation system from data (blocks).
unsigned int numParameters
Number of fit parameters.
Definition: GblTrajectory.h:66
bool constructOK
Trajectory has been successfully constructed (ready for fit/output)
Definition: GblTrajectory.h:70
bool fitOK
Trajectory has been successfully fitted (results are valid)
Definition: GblTrajectory.h:71
void predict()
Calculate predictions for all points.
double downWeight(unsigned int aMethod)
Down-weight all points.
std::vector< GblData > theData
List of data blocks.
Definition: GblTrajectory.h:74
BorderedBandMatrix theMatrix
(Bordered band) matrix of linear equation system
Definition: GblTrajectory.h:84
VVector theVector
Vector of linear equation system.
Definition: GblTrajectory.h:83
tuple cout
Definition: gather_cfg.py:121
void solveAndInvertBorderedBand(const VVector &aRightHandSide, VVector &aSolution)
Solve linear equation system, partially calculate inverse.
Definition: Chi2.h:17
void gbl::GblTrajectory::getFitToKinkJacobian ( std::vector< unsigned int > &  anIndex,
SMatrix27 aJacobian,
const GblPoint aPoint 
) const
private

Get jacobian for transformation from (trajectory) fit to kink parameters at point.

Jacobian broken lines (q/p,..,u_i-1,u_i,u_i+1..) to kink (du') parameters.

Parameters
[out]anIndexList of fit parameters with non zero derivatives
[out]aJacobianCorresponding transformation matrix
[in]aPointPoint to use

Definition at line 514 of file GblTrajectory.cc.

References gbl::GblPoint::getDerivatives(), gbl::GblPoint::getOffset(), i, numCurvature, numLocals, and theDimension.

Referenced by prepare().

515  {
516 
517  unsigned int nDim = theDimension.size();
518  unsigned int nCurv = numCurvature;
519  unsigned int nLocals = numLocals;
520 
521  int nOffset = aPoint.getOffset();
522 
523  SMatrix22 prevW, prevWJ, nextW, nextWJ;
524  SVector2 prevWd, nextWd;
525  aPoint.getDerivatives(0, prevW, prevWJ, prevWd); // W-, W- * J-, W- * d-
526  aPoint.getDerivatives(1, nextW, nextWJ, nextWd); // W-, W- * J-, W- * d-
527  const SMatrix22 sumWJ(prevWJ + nextWJ); // W- * J- + W+ * J+
528  const SVector2 sumWd(prevWd + nextWd); // W+ * d+ + W- * d-
529 
530  unsigned int iOff = (nOffset - 1) * nDim + nCurv + nLocals + 1; // first offset ('i' in u_i)
531 
532  // local offset
533  if (nCurv > 0) {
534  aJacobian.Place_in_col(-sumWd, 0, 0); // from curvature
535  anIndex[0] = nLocals + 1;
536  }
537  aJacobian.Place_at(prevW, 0, 1); // from 1st Offset
538  aJacobian.Place_at(-sumWJ, 0, 3); // from 2nd Offset
539  aJacobian.Place_at(nextW, 0, 5); // from 1st Offset
540  for (unsigned int i = 0; i < nDim; ++i) {
541  anIndex[1 + theDimension[i]] = iOff + i;
542  anIndex[3 + theDimension[i]] = iOff + nDim + i;
543  anIndex[5 + theDimension[i]] = iOff + nDim * 2 + i;
544  }
545 }
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned int > theDimension
List of active dimensions (0=u1, 1=u2) in fit.
Definition: GblTrajectory.h:72
ROOT::Math::SVector< double, 2 > SVector2
Definition: GblPoint.h:29
ROOT::Math::SMatrix< double, 2 > SMatrix22
Definition: GblPoint.h:22
unsigned int numLocals
Total number of (additional) local parameters.
Definition: GblTrajectory.h:67
unsigned int numCurvature
Number of curvature parameters (0 or 1) or external parameters.
Definition: GblTrajectory.h:65
void gbl::GblTrajectory::getFitToLocalJacobian ( std::vector< unsigned int > &  anIndex,
SMatrix55 aJacobian,
const GblPoint aPoint,
unsigned int  measDim,
unsigned int  nJacobian = 1 
) const
private

Get (part of) jacobian for transformation from (trajectory) fit to track parameters at point.

Jacobian broken lines (q/p,..,u_i,u_i+1..) to local (q/p,u',u) parameters.

Parameters
[out]anIndexList of fit parameters with non zero derivatives
[out]aJacobianCorresponding transformation matrix
[in]aPointPoint to use
[in]measDimDimension of 'measurement' (<=2: calculate only offset part, >2: complete matrix)
[in]nJacobianDirection (0: to previous offset, 1: to next offset)

Definition at line 419 of file GblTrajectory.cc.

References gbl::GblPoint::getDerivatives(), gbl::GblPoint::getOffset(), i, numCurvature, numLocals, jetcorrextractor::sign(), and theDimension.

Referenced by getJacobian(), and prepare().

421  {
422 
423  unsigned int nDim = theDimension.size();
424  unsigned int nCurv = numCurvature;
425  unsigned int nLocals = numLocals;
426 
427  int nOffset = aPoint.getOffset();
428 
429  if (nOffset < 0) // need interpolation
430  {
431  SMatrix22 prevW, prevWJ, nextW, nextWJ, matN;
432  SVector2 prevWd, nextWd;
433  int ierr;
434  aPoint.getDerivatives(0, prevW, prevWJ, prevWd); // W-, W- * J-, W- * d-
435  aPoint.getDerivatives(1, nextW, nextWJ, nextWd); // W-, W- * J-, W- * d-
436  const SMatrix22 sumWJ(prevWJ + nextWJ);
437  matN = sumWJ.Inverse(ierr); // N = (W- * J- + W+ * J+)^-1
438  // derivatives for u_int
439  const SMatrix22 prevNW(matN * prevW); // N * W-
440  const SMatrix22 nextNW(matN * nextW); // N * W+
441  const SVector2 prevNd(matN * prevWd); // N * W- * d-
442  const SVector2 nextNd(matN * nextWd); // N * W+ * d+
443 
444  unsigned int iOff = nDim * (-nOffset - 1) + nLocals + nCurv + 1; // first offset ('i' in u_i)
445 
446  // local offset
447  if (nCurv > 0) {
448  aJacobian.Place_in_col(-prevNd - nextNd, 3, 0); // from curvature
449  anIndex[0] = nLocals + 1;
450  }
451  aJacobian.Place_at(prevNW, 3, 1); // from 1st Offset
452  aJacobian.Place_at(nextNW, 3, 3); // from 2nd Offset
453  for (unsigned int i = 0; i < nDim; ++i) {
454  anIndex[1 + theDimension[i]] = iOff + i;
455  anIndex[3 + theDimension[i]] = iOff + nDim + i;
456  }
457 
458  // local slope and curvature
459  if (measDim > 2) {
460  // derivatives for u'_int
461  const SMatrix22 prevWPN(nextWJ * prevNW); // W+ * J+ * N * W-
462  const SMatrix22 nextWPN(prevWJ * nextNW); // W- * J- * N * W+
463  const SVector2 prevWNd(nextWJ * prevNd); // W+ * J+ * N * W- * d-
464  const SVector2 nextWNd(prevWJ * nextNd); // W- * J- * N * W+ * d+
465  if (nCurv > 0) {
466  aJacobian(0, 0) = 1.0;
467  aJacobian.Place_in_col(prevWNd - nextWNd, 1, 0); // from curvature
468  }
469  aJacobian.Place_at(-prevWPN, 1, 1); // from 1st Offset
470  aJacobian.Place_at(nextWPN, 1, 3); // from 2nd Offset
471  }
472  } else { // at point
473  // anIndex must be sorted
474  // forward : iOff2 = iOff1 + nDim, index1 = 1, index2 = 3
475  // backward: iOff2 = iOff1 - nDim, index1 = 3, index2 = 1
476  unsigned int iOff1 = nDim * nOffset + nCurv + nLocals + 1; // first offset ('i' in u_i)
477  unsigned int index1 = 3 - 2 * nJacobian; // index of first offset
478  unsigned int iOff2 = iOff1 + nDim * (nJacobian * 2 - 1); // second offset ('i' in u_i)
479  unsigned int index2 = 1 + 2 * nJacobian; // index of second offset
480  // local offset
481  aJacobian(3, index1) = 1.0; // from 1st Offset
482  aJacobian(4, index1 + 1) = 1.0;
483  for (unsigned int i = 0; i < nDim; ++i) {
484  anIndex[index1 + theDimension[i]] = iOff1 + i;
485  }
486 
487  // local slope and curvature
488  if (measDim > 2) {
489  SMatrix22 matW, matWJ;
490  SVector2 vecWd;
491  aPoint.getDerivatives(nJacobian, matW, matWJ, vecWd); // W, W * J, W * d
492  double sign = (nJacobian > 0) ? 1. : -1.;
493  if (nCurv > 0) {
494  aJacobian(0, 0) = 1.0;
495  aJacobian.Place_in_col(-sign * vecWd, 1, 0); // from curvature
496  anIndex[0] = nLocals + 1;
497  }
498  aJacobian.Place_at(-sign * matWJ, 1, index1); // from 1st Offset
499  aJacobian.Place_at(sign * matW, 1, index2); // from 2nd Offset
500  for (unsigned int i = 0; i < nDim; ++i) {
501  anIndex[index2 + theDimension[i]] = iOff2 + i;
502  }
503  }
504  }
505 }
int i
Definition: DBlmapReader.cc:9
double sign(double x)
std::vector< unsigned int > theDimension
List of active dimensions (0=u1, 1=u2) in fit.
Definition: GblTrajectory.h:72
ROOT::Math::SVector< double, 2 > SVector2
Definition: GblPoint.h:29
ROOT::Math::SMatrix< double, 2 > SMatrix22
Definition: GblPoint.h:22
unsigned int numLocals
Total number of (additional) local parameters.
Definition: GblTrajectory.h:67
unsigned int numCurvature
Number of curvature parameters (0 or 1) or external parameters.
Definition: GblTrajectory.h:65
std::pair< std::vector< unsigned int >, TMatrixD > gbl::GblTrajectory::getJacobian ( int  aSignedLabel) const
private

Get jacobian for transformation from fit to track parameters at point.

Jacobian broken lines (q/p,..,u_i,u_i+1..) to track (q/p,u',u) parameters including additional local parameters.

Parameters
[in]aSignedLabel(Signed) label of point for external seed (<0: in front, >0: after point, slope changes at scatterer!)
Returns
List of fit parameters with non zero derivatives and corresponding transformation matrix

Definition at line 343 of file GblTrajectory.cc.

References funct::abs(), getFitToLocalJacobian(), i, j, numCurvature, numLocals, numPoints, numTrajectories, theDimension, and thePoints.

Referenced by getResults(), and prepare().

344  {
345 
346  unsigned int nDim = theDimension.size();
347  unsigned int nCurv = numCurvature;
348  unsigned int nLocals = numLocals;
349  unsigned int nBorder = nCurv + nLocals;
350  unsigned int nParBRL = nBorder + 2 * nDim;
351  unsigned int nParLoc = nLocals + 5;
352  std::vector<unsigned int> anIndex;
353  anIndex.reserve(nParBRL);
354  TMatrixD aJacobian(nParLoc, nParBRL);
355  aJacobian.Zero();
356 
357  unsigned int aLabel = abs(aSignedLabel);
358  unsigned int firstLabel = 1;
359  unsigned int lastLabel = 0;
360  unsigned int aTrajectory = 0;
361  // loop over trajectories
362  for (unsigned int iTraj = 0; iTraj < numTrajectories; ++iTraj) {
363  aTrajectory = iTraj;
364  lastLabel += numPoints[iTraj];
365  if (aLabel <= lastLabel)
366  break;
367  if (iTraj < numTrajectories - 1)
368  firstLabel += numPoints[iTraj];
369  }
370  int nJacobian; // 0: prev, 1: next
371  // check consistency of (index, direction)
372  if (aSignedLabel > 0) {
373  nJacobian = 1;
374  if (aLabel >= lastLabel) {
375  aLabel = lastLabel;
376  nJacobian = 0;
377  }
378  } else {
379  nJacobian = 0;
380  if (aLabel <= firstLabel) {
381  aLabel = firstLabel;
382  nJacobian = 1;
383  }
384  }
385  const GblPoint aPoint = thePoints[aTrajectory][aLabel - firstLabel];
386  std::vector<unsigned int> labDer(5);
387  SMatrix55 matDer;
388  getFitToLocalJacobian(labDer, matDer, aPoint, 5, nJacobian);
389 
390  // from local parameters
391  for (unsigned int i = 0; i < nLocals; ++i) {
392  aJacobian(i + 5, i) = 1.0;
393  anIndex.push_back(i + 1);
394  }
395  // from trajectory parameters
396  unsigned int iCol = nLocals;
397  for (unsigned int i = 0; i < 5; ++i) {
398  if (labDer[i] > 0) {
399  anIndex.push_back(labDer[i]);
400  for (unsigned int j = 0; j < 5; ++j) {
401  aJacobian(j, iCol) = matDer(j, i);
402  }
403  ++iCol;
404  }
405  }
406  return std::make_pair(anIndex, aJacobian);
407 }
int i
Definition: DBlmapReader.cc:9
void getFitToLocalJacobian(std::vector< unsigned int > &anIndex, SMatrix55 &aJacobian, const GblPoint &aPoint, unsigned int measDim, unsigned int nJacobian=1) const
Get (part of) jacobian for transformation from (trajectory) fit to track parameters at point...
std::vector< unsigned int > theDimension
List of active dimensions (0=u1, 1=u2) in fit.
Definition: GblTrajectory.h:72
ROOT::Math::SMatrix< double, 5, 5 > SMatrix55
Definition: GblData.h:23
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
std::vector< unsigned int > numPoints
Number of points on (sub)trajectory.
Definition: GblTrajectory.h:61
std::vector< std::vector< GblPoint > > thePoints
(list of) List of points on trajectory
Definition: GblTrajectory.h:73
unsigned int numTrajectories
Number of trajectories (in composed trajectory)
Definition: GblTrajectory.h:62
unsigned int numLocals
Total number of (additional) local parameters.
Definition: GblTrajectory.h:67
unsigned int numCurvature
Number of curvature parameters (0 or 1) or external parameters.
Definition: GblTrajectory.h:65
void gbl::GblTrajectory::getLabels ( std::vector< unsigned int > &  aLabelList)

Get (list of) labels of points on (simple) trajectory.

Parameters
[out]aLabelListList of labels (aLabelList[i] = i+1)

Definition at line 636 of file GblTrajectory.cc.

References i, and thePoints.

636  {
637  unsigned int aLabel = 0;
638  unsigned int nPoint = thePoints[0].size();
639  aLabelList.resize(nPoint);
640  for (unsigned i = 0; i < nPoint; ++i) {
641  aLabelList[i] = ++aLabel;
642  }
643 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::vector< GblPoint > > thePoints
(list of) List of points on trajectory
Definition: GblTrajectory.h:73
void gbl::GblTrajectory::getLabels ( std::vector< std::vector< unsigned int > > &  aLabelList)

Get (list of lists of) labels of points on (composed) trajectory.

Parameters
[out]aLabelListList of of lists of labels

Definition at line 649 of file GblTrajectory.cc.

References i, numTrajectories, and thePoints.

650  {
651  unsigned int aLabel = 0;
652  aLabelList.resize(numTrajectories);
653  for (unsigned int iTraj = 0; iTraj < numTrajectories; ++iTraj) {
654  unsigned int nPoint = thePoints[iTraj].size();
655  aLabelList[iTraj].resize(nPoint);
656  for (unsigned i = 0; i < nPoint; ++i) {
657  aLabelList[iTraj][i] = ++aLabel;
658  }
659  }
660 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::vector< GblPoint > > thePoints
(list of) List of points on trajectory
Definition: GblTrajectory.h:73
unsigned int numTrajectories
Number of trajectories (in composed trajectory)
Definition: GblTrajectory.h:62
unsigned int gbl::GblTrajectory::getMeasResults ( unsigned int  aLabel,
unsigned int &  numData,
TVectorD &  aResiduals,
TVectorD &  aMeasErrors,
TVectorD &  aResErrors,
TVectorD &  aDownWeights 
)

Get residuals at point from measurement.

Get (diagonalized) residual, error of measurement and residual and down-weighting factor for measurement at point

Parameters
[in]aLabelLabel of point on trajectory
[out]numDataNumber of data blocks from measurement at point
[out]aResidualsMeasurements-Predictions
[out]aMeasErrorsErrors of Measurements
[out]aResErrorsErrors of Residuals (including correlations from track fit)
[out]aDownWeightsDown-Weighting factors
Returns
error code (non-zero if trajectory not fitted successfully)

Definition at line 587 of file GblTrajectory.cc.

References fitOK, getResAndErr(), i, and measDataIndex.

589  {
590  numData = 0;
591  if (not fitOK)
592  return 1;
593 
594  unsigned int firstData = measDataIndex[aLabel - 1]; // first data block with measurement
595  numData = measDataIndex[aLabel] - firstData; // number of data blocks
596  for (unsigned int i = 0; i < numData; ++i) {
597  getResAndErr(firstData + i, aResiduals[i], aMeasErrors[i],
598  aResErrors[i], aDownWeights[i]);
599  }
600  return 0;
601 }
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned int > measDataIndex
mapping points to data blocks from measurements
Definition: GblTrajectory.h:75
bool fitOK
Trajectory has been successfully fitted (results are valid)
Definition: GblTrajectory.h:71
void getResAndErr(unsigned int aData, double &aResidual, double &aMeadsError, double &aResError, double &aDownWeight)
Get residual and errors from data block.
unsigned int gbl::GblTrajectory::getNumPoints ( ) const

Retrieve number of point from trajectory.

Definition at line 225 of file GblTrajectory.cc.

References numAllPoints.

225  {
226  return numAllPoints;
227 }
unsigned int numAllPoints
Number of all points on trajectory.
Definition: GblTrajectory.h:60
void gbl::GblTrajectory::getResAndErr ( unsigned int  aData,
double &  aResidual,
double &  aMeasError,
double &  aResError,
double &  aDownWeight 
)
private

Get residual and errors from data block.

Get residual, error of measurement and residual and down-weighting factor for (single) data block

Parameters
[in]aDataLabel of data block
[out]aResidualMeasurement-Prediction
[out]aMeasErrorError of Measurement
[out]aResErrorError of Residual (including correlations from track fit)
[out]aDownWeightDown-Weighting factor

Definition at line 672 of file GblTrajectory.cc.

References gbl::BorderedBandMatrix::getBlockMatrix(), j, mathSSE::sqrt(), theData, and theMatrix.

Referenced by getMeasResults(), and getScatResults().

673  {
674 
675  double aMeasVar;
676  std::vector<unsigned int>* indLocal;
677  std::vector<double>* derLocal;
678  theData[aData].getResidual(aResidual, aMeasVar, aDownWeight, indLocal,
679  derLocal);
680  unsigned int nParBrl = (*indLocal).size();
681  TVectorD aVec(nParBrl); // compressed vector of derivatives
682  for (unsigned int j = 0; j < nParBrl; ++j) {
683  aVec[j] = (*derLocal)[j];
684  }
685  TMatrixDSym aMat = theMatrix.getBlockMatrix(*indLocal); // compressed (covariance) matrix
686  double aFitVar = aMat.Similarity(aVec); // variance from track fit
687  aMeasError = sqrt(aMeasVar); // error of measurement
688  aResError = (aFitVar < aMeasVar ? sqrt(aMeasVar - aFitVar) : 0.); // error of residual
689 }
T sqrt(T t)
Definition: SSEVec.h:48
int j
Definition: DBlmapReader.cc:9
std::vector< GblData > theData
List of data blocks.
Definition: GblTrajectory.h:74
BorderedBandMatrix theMatrix
(Bordered band) matrix of linear equation system
Definition: GblTrajectory.h:84
TMatrixDSym getBlockMatrix(const std::vector< unsigned int > anIndex) const
Retrieve symmetric block matrix.
unsigned int gbl::GblTrajectory::getResults ( int  aSignedLabel,
TVectorD &  localPar,
TMatrixDSym &  localCov 
) const

Get fit results at point.

Get corrections and covariance matrix for local track and additional parameters in forward or backward direction.

Parameters
[in]aSignedLabel(Signed) label of point on trajectory (<0: in front, >0: after point, slope changes at scatterer!)
[out]localParCorrections for local parameters
[out]localCovCovariance for local parameters
Returns
error code (non-zero if trajectory not fitted successfully)

Definition at line 557 of file GblTrajectory.cc.

References fitOK, gbl::BorderedBandMatrix::getBlockMatrix(), getJacobian(), i, theMatrix, and theVector.

558  {
559  if (not fitOK)
560  return 1;
561  std::pair<std::vector<unsigned int>, TMatrixD> indexAndJacobian =
562  getJacobian(aSignedLabel);
563  unsigned int nParBrl = indexAndJacobian.first.size();
564  TVectorD aVec(nParBrl); // compressed vector
565  for (unsigned int i = 0; i < nParBrl; ++i) {
566  aVec[i] = theVector(indexAndJacobian.first[i] - 1);
567  }
568  TMatrixDSym aMat = theMatrix.getBlockMatrix(indexAndJacobian.first); // compressed matrix
569  localPar = indexAndJacobian.second * aVec;
570  localCov = aMat.Similarity(indexAndJacobian.second);
571  return 0;
572 }
int i
Definition: DBlmapReader.cc:9
std::pair< std::vector< unsigned int >, TMatrixD > getJacobian(int aSignedLabel) const
Get jacobian for transformation from fit to track parameters at point.
bool fitOK
Trajectory has been successfully fitted (results are valid)
Definition: GblTrajectory.h:71
BorderedBandMatrix theMatrix
(Bordered band) matrix of linear equation system
Definition: GblTrajectory.h:84
VVector theVector
Vector of linear equation system.
Definition: GblTrajectory.h:83
TMatrixDSym getBlockMatrix(const std::vector< unsigned int > anIndex) const
Retrieve symmetric block matrix.
unsigned int gbl::GblTrajectory::getScatResults ( unsigned int  aLabel,
unsigned int &  numData,
TVectorD &  aResiduals,
TVectorD &  aMeasErrors,
TVectorD &  aResErrors,
TVectorD &  aDownWeights 
)

Get (kink) residuals at point from scatterer.

Get (diagonalized) residual, error of measurement and residual and down-weighting factor for scatterering kinks at point

Parameters
[in]aLabelLabel of point on trajectory
[out]numDataNumber of data blocks from scatterer at point
[out]aResiduals(kink)Measurements-(kink)Predictions
[out]aMeasErrorsErrors of (kink)Measurements
[out]aResErrorsErrors of Residuals (including correlations from track fit)
[out]aDownWeightsDown-Weighting factors
Returns
error code (non-zero if trajectory not fitted successfully)

Definition at line 616 of file GblTrajectory.cc.

References fitOK, getResAndErr(), i, and scatDataIndex.

618  {
619  numData = 0;
620  if (not fitOK)
621  return 1;
622 
623  unsigned int firstData = scatDataIndex[aLabel - 1]; // first data block with scatterer
624  numData = scatDataIndex[aLabel] - firstData; // number of data blocks
625  for (unsigned int i = 0; i < numData; ++i) {
626  getResAndErr(firstData + i, aResiduals[i], aMeasErrors[i],
627  aResErrors[i], aDownWeights[i]);
628  }
629  return 0;
630 }
std::vector< unsigned int > scatDataIndex
mapping points to data blocks from scatterers
Definition: GblTrajectory.h:76
int i
Definition: DBlmapReader.cc:9
bool fitOK
Trajectory has been successfully fitted (results are valid)
Definition: GblTrajectory.h:71
void getResAndErr(unsigned int aData, double &aResidual, double &aMeadsError, double &aResError, double &aDownWeight)
Get residual and errors from data block.
bool gbl::GblTrajectory::isValid ( void  ) const

Retrieve validity of trajectory.

Definition at line 220 of file GblTrajectory.cc.

References constructOK.

Referenced by core.AutoHandle.AutoHandle::ReallyLoad().

220  {
221  return constructOK;
222 }
bool constructOK
Trajectory has been successfully constructed (ready for fit/output)
Definition: GblTrajectory.h:70
void gbl::GblTrajectory::milleOut ( MilleBinary aMille)

Write valid trajectory to Millepede-II binary file.

Definition at line 1004 of file GblTrajectory.cc.

References gbl::MilleBinary::addData(), constructOK, theData, and gbl::MilleBinary::writeRecord().

Referenced by MillePedeAlignmentAlgorithm::addReferenceTrajectory().

1004  {
1005  double aValue;
1006  double aErr;
1007  std::vector<unsigned int>* indLocal;
1008  std::vector<double>* derLocal;
1009  std::vector<int>* labGlobal;
1010  std::vector<double>* derGlobal;
1011 
1012  if (not constructOK)
1013  return;
1014 
1015 // data: measurements, kinks and external seed
1016  std::vector<GblData>::iterator itData;
1017  for (itData = theData.begin(); itData != theData.end(); ++itData) {
1018  itData->getAllData(aValue, aErr, indLocal, derLocal, labGlobal,
1019  derGlobal);
1020  aMille.addData(aValue, aErr, *indLocal, *derLocal, *labGlobal,
1021  *derGlobal);
1022  }
1023  aMille.writeRecord();
1024 }
bool constructOK
Trajectory has been successfully constructed (ready for fit/output)
Definition: GblTrajectory.h:70
std::vector< GblData > theData
List of data blocks.
Definition: GblTrajectory.h:74
void gbl::GblTrajectory::predict ( )
private

Calculate predictions for all points.

Definition at line 926 of file GblTrajectory.cc.

References theData, and theVector.

Referenced by fit().

926  {
927  std::vector<GblData>::iterator itData;
928  for (itData = theData.begin(); itData < theData.end(); ++itData) {
929  itData->setPrediction(theVector);
930  }
931 }
std::vector< GblData > theData
List of data blocks.
Definition: GblTrajectory.h:74
VVector theVector
Vector of linear equation system.
Definition: GblTrajectory.h:83
void gbl::GblTrajectory::prepare ( )
private

Prepare fit for simple or composed trajectory.

Generate data (blocks) from measurements, kinks, external seed and measurements.

Definition at line 713 of file GblTrajectory.cc.

References gbl::GblData::addDerivatives(), begin, externalDerivatives, externalMeasurements, externalPoint, externalPrecisions, externalSeed, getFitToKinkJacobian(), getFitToLocalJacobian(), getJacobian(), i, cmsHarvester::index, innerTransformations, j, relval_steps::k, measDataIndex, numAllPoints, numCurvature, numInnerTrans, numLocals, numMeasurements, numOffsets, numTrajectories, scatDataIndex, theData, theDimension, and thePoints.

Referenced by construct().

713  {
714  unsigned int nDim = theDimension.size();
715  // upper limit
716  unsigned int maxData = numMeasurements + nDim * (numOffsets - 2)
717  + externalSeed.GetNrows();
718  theData.reserve(maxData);
719  measDataIndex.resize(numAllPoints + 3); // include external seed and measurements
720  scatDataIndex.resize(numAllPoints + 1);
721  unsigned int nData = 0;
722  std::vector<TMatrixD> innerTransDer;
723  std::vector<std::vector<unsigned int> > innerTransLab;
724  // composed trajectory ?
725  if (numInnerTrans > 0) {
726  //std::cout << "composed trajectory" << std::endl;
727  for (unsigned int iTraj = 0; iTraj < numTrajectories; ++iTraj) {
728  // innermost point
729  GblPoint* innerPoint = &thePoints[iTraj].front();
730  // transformation fit to local track parameters
731  std::vector<unsigned int> firstLabels(5);
732  SMatrix55 matFitToLocal, matLocalToFit;
733  getFitToLocalJacobian(firstLabels, matFitToLocal, *innerPoint, 5);
734  // transformation local track to fit parameters
735  int ierr;
736  matLocalToFit = matFitToLocal.Inverse(ierr);
737  TMatrixD localToFit(5, 5);
738  for (unsigned int i = 0; i < 5; ++i) {
739  for (unsigned int j = 0; j < 5; ++j) {
740  localToFit(i, j) = matLocalToFit(i, j);
741  }
742  }
743  // transformation external to fit parameters at inner (first) point
744  innerTransDer.push_back(localToFit * innerTransformations[iTraj]);
745  innerTransLab.push_back(firstLabels);
746  }
747  }
748  // measurements
749  SMatrix55 matP;
750  // loop over trajectories
751  std::vector<GblPoint>::iterator itPoint;
752  for (unsigned int iTraj = 0; iTraj < numTrajectories; ++iTraj) {
753  for (itPoint = thePoints[iTraj].begin();
754  itPoint < thePoints[iTraj].end(); ++itPoint) {
755  SVector5 aMeas, aPrec;
756  unsigned int nLabel = itPoint->getLabel();
757  unsigned int measDim = itPoint->hasMeasurement();
758  if (measDim) {
759  const TMatrixD localDer = itPoint->getLocalDerivatives();
760  const std::vector<int> globalLab = itPoint->getGlobalLabels();
761  const TMatrixD globalDer = itPoint->getGlobalDerivatives();
762  TMatrixD transDer;
763  itPoint->getMeasurement(matP, aMeas, aPrec);
764  unsigned int iOff = 5 - measDim; // first active component
765  std::vector<unsigned int> labDer(5);
766  SMatrix55 matDer, matPDer;
767  unsigned int nJacobian =
768  (itPoint < thePoints[iTraj].end() - 1) ? 1 : 0; // last point needs backward propagation
769  getFitToLocalJacobian(labDer, matDer, *itPoint, measDim,
770  nJacobian);
771  if (measDim > 2) {
772  matPDer = matP * matDer;
773  } else { // 'shortcut' for position measurements
774  matPDer.Place_at(
775  matP.Sub<SMatrix22>(3, 3)
776  * matDer.Sub<SMatrix25>(3, 0), 3, 0);
777  }
778 
779  if (numInnerTrans > 0) {
780  // transform for external parameters
781  TMatrixD proDer(measDim, 5);
782  // match parameters
783  unsigned int ifirst = 0;
784  unsigned int ilabel = 0;
785  while (ilabel < 5) {
786  if (labDer[ilabel] > 0) {
787  while (innerTransLab[iTraj][ifirst]
788  != labDer[ilabel] and ifirst < 5) {
789  ++ifirst;
790  }
791  if (ifirst >= 5) {
792  labDer[ilabel] -= 2 * nDim * (iTraj + 1); // adjust label
793  } else {
794  // match
795  labDer[ilabel] = 0; // mark as related to external parameters
796  for (unsigned int k = iOff; k < 5; ++k) {
797  proDer(k - iOff, ifirst) = matPDer(k,
798  ilabel);
799  }
800  }
801  }
802  ++ilabel;
803  }
804  transDer.ResizeTo(measDim, numCurvature);
805  transDer = proDer * innerTransDer[iTraj];
806  }
807  for (unsigned int i = iOff; i < 5; ++i) {
808  if (aPrec(i) > 0.) {
809  GblData aData(nLabel, aMeas(i), aPrec(i));
810  aData.addDerivatives(i, labDer, matPDer, iOff, localDer,
811  globalLab, globalDer, numLocals, transDer);
812  theData.push_back(aData);
813  nData++;
814  }
815  }
816 
817  }
818  measDataIndex[nLabel] = nData;
819  }
820  }
821 
822  // pseudo measurements from kinks
823  SMatrix22 matT;
824  scatDataIndex[0] = nData;
825  scatDataIndex[1] = nData;
826  // loop over trajectories
827  for (unsigned int iTraj = 0; iTraj < numTrajectories; ++iTraj) {
828  for (itPoint = thePoints[iTraj].begin() + 1;
829  itPoint < thePoints[iTraj].end() - 1; ++itPoint) {
830  SVector2 aMeas, aPrec;
831  unsigned int nLabel = itPoint->getLabel();
832  if (itPoint->hasScatterer()) {
833  itPoint->getScatterer(matT, aMeas, aPrec);
834  TMatrixD transDer;
835  std::vector<unsigned int> labDer(7);
836  SMatrix27 matDer, matTDer;
837  getFitToKinkJacobian(labDer, matDer, *itPoint);
838  matTDer = matT * matDer;
839  if (numInnerTrans > 0) {
840  // transform for external parameters
841  TMatrixD proDer(nDim, 5);
842  // match parameters
843  unsigned int ifirst = 0;
844  unsigned int ilabel = 0;
845  while (ilabel < 7) {
846  if (labDer[ilabel] > 0) {
847  while (innerTransLab[iTraj][ifirst]
848  != labDer[ilabel] and ifirst < 5) {
849  ++ifirst;
850  }
851  if (ifirst >= 5) {
852  labDer[ilabel] -= 2 * nDim * (iTraj + 1); // adjust label
853  } else {
854  // match
855  labDer[ilabel] = 0; // mark as related to external parameters
856  for (unsigned int k = 0; k < nDim; ++k) {
857  proDer(k, ifirst) = matTDer(k, ilabel);
858  }
859  }
860  }
861  ++ilabel;
862  }
863  transDer.ResizeTo(nDim, numCurvature);
864  transDer = proDer * innerTransDer[iTraj];
865  }
866  for (unsigned int i = 0; i < nDim; ++i) {
867  unsigned int iDim = theDimension[i];
868  if (aPrec(iDim) > 0.) {
869  GblData aData(nLabel, aMeas(iDim), aPrec(iDim));
870  aData.addDerivatives(iDim, labDer, matTDer, numLocals,
871  transDer);
872  theData.push_back(aData);
873  nData++;
874  }
875  }
876  }
877  scatDataIndex[nLabel] = nData;
878  }
879  scatDataIndex[thePoints[iTraj].back().getLabel()] = nData;
880  }
881 
882  // external seed
883  if (externalPoint > 0) {
884  std::pair<std::vector<unsigned int>, TMatrixD> indexAndJacobian =
886  std::vector<unsigned int> externalSeedIndex = indexAndJacobian.first;
887  std::vector<double> externalSeedDerivatives(externalSeedIndex.size());
888  const TMatrixDSymEigen externalSeedEigen(externalSeed);
889  const TVectorD valEigen = externalSeedEigen.GetEigenValues();
890  TMatrixD vecEigen = externalSeedEigen.GetEigenVectors();
891  vecEigen = vecEigen.T() * indexAndJacobian.second;
892  for (int i = 0; i < externalSeed.GetNrows(); ++i) {
893  if (valEigen(i) > 0.) {
894  for (int j = 0; j < externalSeed.GetNcols(); ++j) {
895  externalSeedDerivatives[j] = vecEigen(i, j);
896  }
897  GblData aData(externalPoint, 0., valEigen(i));
898  aData.addDerivatives(externalSeedIndex, externalSeedDerivatives);
899  theData.push_back(aData);
900  nData++;
901  }
902  }
903  }
904  measDataIndex[numAllPoints + 1] = nData;
905  // external measurements
906  unsigned int nExt = externalMeasurements.GetNrows();
907  if (nExt > 0) {
908  std::vector<unsigned int> index(numCurvature);
909  std::vector<double> derivatives(numCurvature);
910  for (unsigned int iExt = 0; iExt < nExt; ++iExt) {
911  for (unsigned int iCol = 0; iCol < numCurvature; ++iCol) {
912  index[iCol] = iCol + 1;
913  derivatives[iCol] = externalDerivatives(iExt, iCol);
914  }
915  GblData aData(1U, externalMeasurements(iExt),
916  externalPrecisions(iExt));
917  aData.addDerivatives(index, derivatives);
918  theData.push_back(aData);
919  nData++;
920  }
921  }
922  measDataIndex[numAllPoints + 2] = nData;
923 }
std::vector< unsigned int > scatDataIndex
mapping points to data blocks from scatterers
Definition: GblTrajectory.h:76
int i
Definition: DBlmapReader.cc:9
std::pair< std::vector< unsigned int >, TMatrixD > getJacobian(int aSignedLabel) const
Get jacobian for transformation from fit to track parameters at point.
TVectorD externalPrecisions
Definition: GblTrajectory.h:82
std::vector< unsigned int > measDataIndex
mapping points to data blocks from measurements
Definition: GblTrajectory.h:75
void getFitToLocalJacobian(std::vector< unsigned int > &anIndex, SMatrix55 &aJacobian, const GblPoint &aPoint, unsigned int measDim, unsigned int nJacobian=1) const
Get (part of) jacobian for transformation from (trajectory) fit to track parameters at point...
ROOT::Math::SMatrix< double, 2, 7 > SMatrix27
Definition: GblData.h:22
std::vector< unsigned int > theDimension
List of active dimensions (0=u1, 1=u2) in fit.
Definition: GblTrajectory.h:72
TMatrixDSym externalSeed
Precision (inverse covariance matrix) of external seed.
Definition: GblTrajectory.h:77
ROOT::Math::SVector< double, 2 > SVector2
Definition: GblPoint.h:29
void getFitToKinkJacobian(std::vector< unsigned int > &anIndex, SMatrix27 &aJacobian, const GblPoint &aPoint) const
Get jacobian for transformation from (trajectory) fit to kink parameters at point.
ROOT::Math::SMatrix< double, 5, 5 > SMatrix55
Definition: GblData.h:23
unsigned int numOffsets
Number of (points with) offsets on trajectory.
Definition: GblTrajectory.h:63
unsigned int externalPoint
Label of external point (or 0)
Definition: GblTrajectory.h:69
unsigned int numInnerTrans
Number of inner transformations to external parameters.
Definition: GblTrajectory.h:64
ROOT::Math::SVector< double, 5 > SVector5
Definition: GblPoint.h:30
unsigned int numMeasurements
Total number of measurements.
Definition: GblTrajectory.h:68
ROOT::Math::SMatrix< double, 2 > SMatrix22
Definition: GblPoint.h:22
int j
Definition: DBlmapReader.cc:9
std::vector< TMatrixD > innerTransformations
Transformations at innermost points of.
Definition: GblTrajectory.h:78
std::vector< GblData > theData
List of data blocks.
Definition: GblTrajectory.h:74
TMatrixD externalDerivatives
Definition: GblTrajectory.h:80
std::vector< std::vector< GblPoint > > thePoints
(list of) List of points on trajectory
Definition: GblTrajectory.h:73
unsigned int numTrajectories
Number of trajectories (in composed trajectory)
Definition: GblTrajectory.h:62
#define begin
Definition: vmac.h:30
unsigned int numLocals
Total number of (additional) local parameters.
Definition: GblTrajectory.h:67
ROOT::Math::SMatrix< double, 2, 5 > SMatrix25
Definition: GblData.h:21
unsigned int numAllPoints
Number of all points on trajectory.
Definition: GblTrajectory.h:60
TVectorD externalMeasurements
Definition: GblTrajectory.h:81
unsigned int numCurvature
Number of curvature parameters (0 or 1) or external parameters.
Definition: GblTrajectory.h:65
void gbl::GblTrajectory::printData ( )

Print GblData blocks for trajectory.

Definition at line 1108 of file GblTrajectory.cc.

References gather_cfg::cout, and theData.

1108  {
1109  std::cout << "GblData blocks " << std::endl;
1110  std::vector<GblData>::iterator itData;
1111  for (itData = theData.begin(); itData < theData.end(); ++itData) {
1112  itData->printData();
1113  }
1114 }
std::vector< GblData > theData
List of data blocks.
Definition: GblTrajectory.h:74
tuple cout
Definition: gather_cfg.py:121
void gbl::GblTrajectory::printPoints ( unsigned int  level = 0)

Print GblPoints on trajectory.

Parameters
[in]levelprint level (0: minimum, >0: more)

Definition at line 1096 of file GblTrajectory.cc.

References begin, gather_cfg::cout, numTrajectories, and thePoints.

1096  {
1097  std::cout << "GblPoints " << std::endl;
1098  for (unsigned int iTraj = 0; iTraj < numTrajectories; ++iTraj) {
1099  std::vector<GblPoint>::iterator itPoint;
1100  for (itPoint = thePoints[iTraj].begin();
1101  itPoint < thePoints[iTraj].end(); ++itPoint) {
1102  itPoint->printPoint(level);
1103  }
1104  }
1105 }
std::vector< std::vector< GblPoint > > thePoints
(list of) List of points on trajectory
Definition: GblTrajectory.h:73
unsigned int numTrajectories
Number of trajectories (in composed trajectory)
Definition: GblTrajectory.h:62
#define begin
Definition: vmac.h:30
tuple cout
Definition: gather_cfg.py:121
tuple level
Definition: testEve_cfg.py:34
void gbl::GblTrajectory::printTrajectory ( unsigned int  level = 0)

Print GblTrajectory.

Parameters
[in]levelprint level (0: minimum, >0: more)

Definition at line 1030 of file GblTrajectory.cc.

References constructOK, gather_cfg::cout, externalDerivatives, externalMeasurements, externalPoint, externalPrecisions, externalSeed, fitOK, i, innerTransformations, numAllPoints, numInnerTrans, numMeasurements, numOffsets, numParameters, gbl::VVector::print(), gbl::BorderedBandMatrix::printMatrix(), theDimension, theMatrix, and theVector.

1030  {
1031  if (numInnerTrans) {
1032  std::cout << "Composed GblTrajectory, " << numInnerTrans
1033  << " subtrajectories" << std::endl;
1034  } else {
1035  std::cout << "Simple GblTrajectory" << std::endl;
1036  }
1037  if (theDimension.size() < 2) {
1038  std::cout << " 2D-trajectory" << std::endl;
1039  }
1040  std::cout << " Number of GblPoints : " << numAllPoints
1041  << std::endl;
1042  std::cout << " Number of points with offsets: " << numOffsets << std::endl;
1043  std::cout << " Number of fit parameters : " << numParameters
1044  << std::endl;
1045  std::cout << " Number of measurements : " << numMeasurements
1046  << std::endl;
1047  if (externalMeasurements.GetNrows()) {
1048  std::cout << " Number of ext. measurements : "
1049  << externalMeasurements.GetNrows() << std::endl;
1050  }
1051  if (externalPoint) {
1052  std::cout << " Label of point with ext. seed: " << externalPoint
1053  << std::endl;
1054  }
1055  if (constructOK) {
1056  std::cout << " Constructed OK " << std::endl;
1057  }
1058  if (fitOK) {
1059  std::cout << " Fitted OK " << std::endl;
1060  }
1061  if (level > 0) {
1062  if (numInnerTrans) {
1063  std::cout << " Inner transformations" << std::endl;
1064  for (unsigned int i = 0; i < numInnerTrans; ++i) {
1065  innerTransformations[i].Print();
1066  }
1067  }
1068  if (externalMeasurements.GetNrows()) {
1069  std::cout << " External measurements" << std::endl;
1070  std::cout << " Measurements:" << std::endl;
1071  externalMeasurements.Print();
1072  std::cout << " Precisions:" << std::endl;
1073  externalPrecisions.Print();
1074  std::cout << " Derivatives:" << std::endl;
1075  externalDerivatives.Print();
1076  }
1077  if (externalPoint) {
1078  std::cout << " External seed:" << std::endl;
1079  externalSeed.Print();
1080  }
1081  if (fitOK) {
1082  std::cout << " Fit results" << std::endl;
1083  std::cout << " Parameters:" << std::endl;
1084  theVector.print();
1085  std::cout << " Covariance matrix (bordered band part):"
1086  << std::endl;
1088  }
1089  }
1090 }
void printMatrix() const
Print bordered band matrix.
int i
Definition: DBlmapReader.cc:9
TVectorD externalPrecisions
Definition: GblTrajectory.h:82
unsigned int numParameters
Number of fit parameters.
Definition: GblTrajectory.h:66
bool constructOK
Trajectory has been successfully constructed (ready for fit/output)
Definition: GblTrajectory.h:70
bool fitOK
Trajectory has been successfully fitted (results are valid)
Definition: GblTrajectory.h:71
std::vector< unsigned int > theDimension
List of active dimensions (0=u1, 1=u2) in fit.
Definition: GblTrajectory.h:72
TMatrixDSym externalSeed
Precision (inverse covariance matrix) of external seed.
Definition: GblTrajectory.h:77
void print() const
Print vector.
Definition: VMatrix.cc:276
unsigned int numOffsets
Number of (points with) offsets on trajectory.
Definition: GblTrajectory.h:63
unsigned int externalPoint
Label of external point (or 0)
Definition: GblTrajectory.h:69
unsigned int numInnerTrans
Number of inner transformations to external parameters.
Definition: GblTrajectory.h:64
unsigned int numMeasurements
Total number of measurements.
Definition: GblTrajectory.h:68
std::vector< TMatrixD > innerTransformations
Transformations at innermost points of.
Definition: GblTrajectory.h:78
TMatrixD externalDerivatives
Definition: GblTrajectory.h:80
BorderedBandMatrix theMatrix
(Bordered band) matrix of linear equation system
Definition: GblTrajectory.h:84
VVector theVector
Vector of linear equation system.
Definition: GblTrajectory.h:83
tuple cout
Definition: gather_cfg.py:121
tuple level
Definition: testEve_cfg.py:34
unsigned int numAllPoints
Number of all points on trajectory.
Definition: GblTrajectory.h:60
TVectorD externalMeasurements
Definition: GblTrajectory.h:81

Member Data Documentation

bool gbl::GblTrajectory::constructOK
private

Trajectory has been successfully constructed (ready for fit/output)

Definition at line 70 of file GblTrajectory.h.

Referenced by construct(), fit(), isValid(), milleOut(), and printTrajectory().

TMatrixD gbl::GblTrajectory::externalDerivatives
private

Definition at line 80 of file GblTrajectory.h.

Referenced by prepare(), and printTrajectory().

TVectorD gbl::GblTrajectory::externalMeasurements
private

Definition at line 81 of file GblTrajectory.h.

Referenced by prepare(), and printTrajectory().

unsigned int gbl::GblTrajectory::externalPoint
private

Label of external point (or 0)

Definition at line 69 of file GblTrajectory.h.

Referenced by prepare(), and printTrajectory().

TVectorD gbl::GblTrajectory::externalPrecisions
private

Definition at line 82 of file GblTrajectory.h.

Referenced by prepare(), and printTrajectory().

TMatrixDSym gbl::GblTrajectory::externalSeed
private

Precision (inverse covariance matrix) of external seed.

Definition at line 77 of file GblTrajectory.h.

Referenced by prepare(), and printTrajectory().

bool gbl::GblTrajectory::fitOK
private

Trajectory has been successfully fitted (results are valid)

Definition at line 71 of file GblTrajectory.h.

Referenced by construct(), fit(), getMeasResults(), getResults(), getScatResults(), and printTrajectory().

std::vector<TMatrixD> gbl::GblTrajectory::innerTransformations
private

Transformations at innermost points of.

Definition at line 78 of file GblTrajectory.h.

Referenced by GblTrajectory(), prepare(), and printTrajectory().

std::vector<unsigned int> gbl::GblTrajectory::measDataIndex
private

mapping points to data blocks from measurements

Definition at line 75 of file GblTrajectory.h.

Referenced by getMeasResults(), and prepare().

unsigned int gbl::GblTrajectory::numAllPoints
private

Number of all points on trajectory.

Definition at line 60 of file GblTrajectory.h.

Referenced by construct(), GblTrajectory(), getNumPoints(), prepare(), and printTrajectory().

unsigned int gbl::GblTrajectory::numCurvature
private

Number of curvature parameters (0 or 1) or external parameters.

Definition at line 65 of file GblTrajectory.h.

Referenced by buildLinearEquationSystem(), construct(), GblTrajectory(), getFitToKinkJacobian(), getFitToLocalJacobian(), getJacobian(), and prepare().

unsigned int gbl::GblTrajectory::numInnerTrans
private

Number of inner transformations to external parameters.

Definition at line 64 of file GblTrajectory.h.

Referenced by construct(), prepare(), and printTrajectory().

unsigned int gbl::GblTrajectory::numLocals
private

Total number of (additional) local parameters.

Definition at line 67 of file GblTrajectory.h.

Referenced by buildLinearEquationSystem(), construct(), getFitToKinkJacobian(), getFitToLocalJacobian(), getJacobian(), and prepare().

unsigned int gbl::GblTrajectory::numMeasurements
private

Total number of measurements.

Definition at line 68 of file GblTrajectory.h.

Referenced by construct(), prepare(), and printTrajectory().

unsigned int gbl::GblTrajectory::numOffsets
private

Number of (points with) offsets on trajectory.

Definition at line 63 of file GblTrajectory.h.

Referenced by construct(), defineOffsets(), prepare(), and printTrajectory().

unsigned int gbl::GblTrajectory::numParameters
private

Number of fit parameters.

Definition at line 66 of file GblTrajectory.h.

Referenced by buildLinearEquationSystem(), construct(), fit(), and printTrajectory().

std::vector<unsigned int> gbl::GblTrajectory::numPoints
private

Number of points on (sub)trajectory.

Definition at line 61 of file GblTrajectory.h.

Referenced by GblTrajectory(), and getJacobian().

unsigned int gbl::GblTrajectory::numTrajectories
private

Number of trajectories (in composed trajectory)

Definition at line 62 of file GblTrajectory.h.

Referenced by calcJacobians(), construct(), defineOffsets(), getJacobian(), getLabels(), prepare(), and printPoints().

std::vector<unsigned int> gbl::GblTrajectory::scatDataIndex
private

mapping points to data blocks from scatterers

Definition at line 76 of file GblTrajectory.h.

Referenced by getScatResults(), and prepare().

std::vector<GblData> gbl::GblTrajectory::theData
private

List of data blocks.

Definition at line 74 of file GblTrajectory.h.

Referenced by buildLinearEquationSystem(), downWeight(), fit(), getResAndErr(), milleOut(), predict(), prepare(), and printData().

std::vector<unsigned int> gbl::GblTrajectory::theDimension
private

List of active dimensions (0=u1, 1=u2) in fit.

Definition at line 72 of file GblTrajectory.h.

Referenced by construct(), GblTrajectory(), getFitToKinkJacobian(), getFitToLocalJacobian(), getJacobian(), prepare(), and printTrajectory().

BorderedBandMatrix gbl::GblTrajectory::theMatrix
private

(Bordered band) matrix of linear equation system

Definition at line 84 of file GblTrajectory.h.

Referenced by buildLinearEquationSystem(), fit(), getResAndErr(), getResults(), and printTrajectory().

std::vector<std::vector<GblPoint> > gbl::GblTrajectory::thePoints
private

(list of) List of points on trajectory

Definition at line 73 of file GblTrajectory.h.

Referenced by calcJacobians(), construct(), defineOffsets(), GblTrajectory(), getJacobian(), getLabels(), prepare(), and printPoints().

VVector gbl::GblTrajectory::theVector
private

Vector of linear equation system.

Definition at line 83 of file GblTrajectory.h.

Referenced by buildLinearEquationSystem(), fit(), getResults(), predict(), and printTrajectory().