GENFIT
Rev:NoNumberAvailable
|
Go to the documentation of this file.
18 unsigned int dim = rep->
getDim();
20 throw new genfit::Exception(
"GblFitterInfo: Representation state is not 5D", __LINE__, __FILE__);
21 TMatrixDSym noise(dim, dim);
31 unsigned int dim = rep->
getDim();
33 throw new genfit::Exception(
"GblFitterInfo: Representation state is not 5D", __LINE__, __FILE__);
34 TMatrixDSym noise(dim, dim);
58 TMatrixDSym zero(repDim);
67 fwdCov_.SetMatrixArray(zero.GetMatrixArray());
68 bwdCov_.SetMatrixArray(zero.GetMatrixArray());
98 double c1 = trackDirection.Dot(measurementPlane->getU());
99 double c2 = trackDirection.Dot(measurementPlane->getV());
101 TMatrixDSym scatCov(2);
102 scatCov(0, 0) = 1. - c2 * c2;
103 scatCov(1, 1) = 1. - c1 * c1;
104 scatCov(0, 1) = c1 * c2;
105 scatCov(1, 0) = c1 * c2;
106 scatCov *= variance * variance / (1. - c1 * c1 - c2 * c2) / (1. - c1 * c1 - c2 * c2) ;
144 TVectorD aResiduals(measurement.
getState());
145 TMatrixDSym aPrecision(measurement.
getCov().Invert());
147 double res = aResiduals(0);
148 double prec = aPrecision(0, 0);
149 aResiduals.ResizeTo(2);
150 aPrecision.ResizeTo(TMatrixDSym(2));
154 aPrecision(0, 0) = prec;
157 double res = aResiduals(0);
158 double prec = aPrecision(0, 0);
159 aResiduals.ResizeTo(2);
160 aPrecision.ResizeTo(TMatrixDSym(2));
164 aPrecision(1, 1) = prec;
174 std::vector<int> labels = globals->
labels();
176 if (derivs.GetNcols() > 0 && !labels.empty() && (
unsigned int)derivs.GetNcols() == labels.size()) {
180 if (locals.GetNcols() > 0) {
223 unsigned int imop = 0;
224 double maxWeight = allMeas.at(0)->getWeight();
225 for (
unsigned int i = 0; i < allMeas.size(); i++)
226 if (allMeas.at(i)->getWeight() > maxWeight)
231 measCov_.ResizeTo(allMeas.at(imop)->getCov());
232 measCov_ = allMeas.at(imop)->getCov();
233 hMatrix_.ResizeTo(allMeas.at(imop)->getHMatrix()->getMatrix());
234 hMatrix_ = allMeas.at(imop)->getHMatrix()->getMatrix();
236 setPlane(allMeas.at(imop)->getPlane());
238 for (
unsigned int imeas = 0; imeas < allMeas.size(); imeas++)
239 delete allMeas[imeas];
251 unsigned int label = 0;
254 for (
unsigned int ip = 0; ip < trk->
getNumPoints(); ip++) {
265 throw genfit::Exception(
"GblFitterInfo: fitter info did not found itself in track to update", __LINE__, __FILE__);
267 throw genfit::Exception(
"GblFitterInfo: Deduced point label not valid", __LINE__, __FILE__);
271 unsigned int numMRes = 2;
272 TVectorD mResiduals(2), mMeasErrors(2), mResErrors(2), mDownWeights(2);
273 if (0 != traj.
getMeasResults(label, numMRes, mResiduals, mMeasErrors, mResErrors, mDownWeights))
277 unsigned int numKRes = 2;
278 TVectorD kResiduals(2), kMeasErrors(2), kResErrors(2), kDownWeights(2);
279 if (0 != traj.
getScatResults(label, numKRes, kResiduals, kMeasErrors, kResErrors, kDownWeights))
289 TVectorD bwdUpdate(5 + nLocals), fwdUpdate(5 + nLocals);
290 TMatrixDSym bwdCov(5 + nLocals), fwdCov(5 + nLocals);
293 if (0 != traj.
getResults(label, fwdUpdate, fwdCov))
297 if (0 != traj.
getResults(-1 * label, bwdUpdate, bwdCov))
301 TVectorD _bwdUpdate(5 + nLocals), _fwdUpdate(5 + nLocals);
302 TMatrixDSym _bwdCov(5 + nLocals), _fwdCov(5 + nLocals);
303 _bwdUpdate = bwdUpdate;
304 _fwdUpdate = fwdUpdate;
307 bwdUpdate.ResizeTo(5);
308 fwdUpdate.ResizeTo(5);
309 bwdCov.ResizeTo(TMatrixDSym(5));
310 fwdCov.ResizeTo(TMatrixDSym(5));
311 for (
int i = 0; i < 5; i++) {
312 bwdUpdate(i) = _bwdUpdate(i);
313 fwdUpdate(i) = _fwdUpdate(i);
314 for (
int j = 0; j < 5; j++) {
315 bwdCov(i, j) = _bwdCov(i, j);
316 fwdCov(i, j) = _fwdCov(i, j);
350 if (!prevFitterInfo) {
355 prevFitterInfo =
this;
416 TMatrixDSym localCovariance(2);
417 localCovariance.Zero();
425 localCovariance.ResizeTo(TMatrixDSym(1));
429 localCovariance.ResizeTo(TMatrixDSym(1));
437 if (onlyMeasurementErrors) {
452 TMatrixDSym localCovariance(2);
453 localCovariance.Zero();
465 kinks(0) = -stateDiff(1);
466 kinks(1) = -stateDiff(2);
512 std::cout <<
"=============================================================================================" << std::endl;
513 std::cout <<
" >>> GblFitterInfo " << std::endl;
514 std::cout <<
" ************* " << std::endl;
518 std::cout << std::endl;
520 std::cout <<
"=============================================================================================" << std::endl;
521 std::cout <<
" | PREDICTIONS | REFERENCE | Corrections from last iteration |" << std::endl;
522 std::cout <<
" | (+)prediction | (-)prediction | state | (+)correction | (-) correction |" << std::endl;
523 std::cout <<
"---------------------------------------------------------------------------------------------" << std::endl;
525 for (
int i = 0; i <5; i++) {
526 std::cout << std::left;
545 std::cout <<
"=============================================================================================" << std::endl;
548 std::cout <<
" | Meas. residual | measurement - prediction | Down-weight | Fit+meas Err. |" << std::endl;
549 std::cout <<
" | | | | -diagonaliz. |" << std::endl;
550 std::cout <<
"---------------------------------------------------------------------------------------------" << std::endl;
553 if (residual.GetNoElements()<2) {
554 residual.ResizeTo(2);
564 << std::setw(12) << residual(0) <<
" | "
571 << std::setw(12) << residual(1) <<
" | "
576 std::cout <<
"---------------------------------------------------------------------------------------------" << std::endl;
579 std::cout <<
" | Kink residual | Residual of slope difference | Down-weight | Fit Kink Err. |" << std::endl;
580 std::cout <<
" | -diagonalized | - ( (+)pred - (-)pred ) | | -diagonaliz. |" << std::endl;
581 std::cout <<
"---------------------------------------------------------------------------------------------" << std::endl;
583 std::cout <<
" u' | "
585 << std::setw(12) <<
getKinks()(0) <<
" | "
590 std::cout <<
" v' | "
592 << std::setw(12) <<
getKinks()(1) <<
" | "
596 std::cout <<
"=============================================================================================" << std::endl;
599 std::cout <<
"H Matrix: ";
hMatrix_.Print();
601 std::cout <<
"Measurement covariance: ";
measCov_.Print();
603 std::cout <<
"Jacobian: ";
jacobian_.Print();
604 std::cout <<
"Backward covariance: ";
bwdCov_.Print();
605 std::cout <<
"Forward covariance : ";
fwdCov_.Print();
607 std::cout <<
"=============================================================================================" << std::endl;
virtual GblFitterInfo * clone() const
Deep copy ctor for polymorphic class.
Collects information needed and produced by a GblFitter/GBL and is specific to one AbsTrackRep of the...
const MaterialProperties & getMaterial() const
boost::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.
virtual double extrapolateToPlane(StateOnPlane &state, const genfit::SharedPlanePtr &plane, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
Extrapolates the state to plane, and returns the extrapolation length and, via reference,...
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
SharedPlanePtr sharedPlane_
No ownership.
void recalculateJacobian(GblFitterInfo *prevFitterInfo)
Re-extrapolates between prevFitterInfo and this point using forward state to update the Jacobian (if ...
void addLocals(const TMatrixD &aDerivatives)
Add local derivatives to a point.
boost::scoped_ptr< MeasuredStateOnPlane > fittedStateFwd_
cache
const TMatrixDSym & getCov() const
void updateFitResults(gbl::GblTrajectory &traj)
Update fitter info from GBL fit results.
MeasurementOnPlane getKink() const
Get kink (residual) with diagonalized covariance (2D) Covariance may be zero if not yet fitted or no ...
StateOnPlane with additional covariance matrix.
const AbsTrackRep * getRep() const
MeasurementOnPlane getResidual(unsigned int=0, bool=false, bool onlyMeasurementErrors=true) const
Get the residual.
bool hasThinScatterer() const
Exception class for error handling in GENFIT (provides storage for diagnostic information)
const TMatrixDSym & getCovSeed() const
Defines for I/O streams used for error and debug printing.
TVectorD kinkDownWeights_
const TrackPoint * getTrackPoint() const
TVectorD getKinks() const
Get kink (residual) (2D) = 0 - ( (+)pred - (-)pred )
TrackPoint * getPoint(int id) const
virtual bool isEqual(const AbsHMatrix &other) const =0
void addGlobals(const std::vector< int > &aLabels, const TMatrixD &aDerivatives)
Add global derivatives to a point.
void addMeasurement(const TMatrixD &aProjection, const TVectorD &aResiduals, const TVectorD &aPrecision, double minPrecision=0.)
Add a measurement to a point.
const AbsTrackRep * rep_
No ownership.
virtual TMatrixD derivatives(const genfit::StateOnPlane *sop)=0
Derivatives of residuals (local measurement coordinates) w.r.t. alignment/calibration parameters Matr...
FitStatus * getFitStatus(const AbsTrackRep *rep=NULL) const
Get FitStatus for a AbsTrackRep. Per default, return FitStatus for cardinalRep.
TVectorD fwdStateCorrection_
TVectorD kinkResidualErrors_
Abstract base class for a track representation.
void setJacobian(TMatrixD jacobian)
Set the Jacobian for further GblPoint construction.
FitStatus for use with GblFitter.
bool isValid() const
Retrieve validity of trajectory.
virtual TMatrixD localDerivatives(const genfit::StateOnPlane *)
Derivatives for additional local parameters to be fitted in global calibration algorithms together wi...
void setMaxLocalFitParams(unsigned maxLocalFitParams)
virtual void Print(const Option_t *="") const
virtual bool checkConsistency(const genfit::PruneFlags *=NULL) const
unsigned int getNumPoints() const
Retrieve number of point from trajectory.
const TMatrixD & getMatrix() const
Get the actual matrix representation.
Object containing AbsMeasurement and AbsFitterInfo objects.
This class collects all information needed and produced by a specific AbsFitter and is specific to on...
TVectorD measDownWeights_
AbsHMatrix implementation for two-dimensional MeasurementOnPlane and RKTrackRep parameterization.
A state with arbitrary dimension defined in a DetPlane.
bool getMaxLocalFitParams()
bool hasRawMeasurements() const
GblFitterInfo()
Constructor for ROOT I/O.
virtual SharedPlanePtr constructPlane(const StateOnPlane &state) const =0
unsigned int getMeasResults(unsigned int aLabel, unsigned int &numRes, TVectorD &aResiduals, TVectorD &aMeasErrors, TVectorD &aResErrors, TVectorD &aDownWeights)
Get residuals at point from measurement.
AbsMeasurement * getRawMeasurement(int i=0) const
void updateMeasurementAndPlane(const StateOnPlane &sop)
SHOULD BE USED ONLY INTERNALY! Update the plane from measurement constructed with state or take plane...
unsigned int getResults(int aSignedLabel, TVectorD &localPar, TMatrixDSym &localCov) const
Get fit results at point.
TVectorD measResidualErrors_
const TMatrixD & getMatrix() const
Get the actual matrix representation.
AbsHMatrix implementation for one-dimensional MeasurementOnPlane and RKTrackRep parameterization.
virtual std::vector< int > labels()=0
Vector of integer labels for calibration/alignment parameters available (must match #columns of deriv...
const TrackPoint * trackPoint_
virtual const AbsHMatrix * constructHMatrix(const AbsTrackRep *) const =0
Measured coordinates on a plane.
TVectorD bwdStateCorrection_
void setPlane(const SharedPlanePtr &plane)
gbl::GblPoint constructGblPoint()
Collect all data and create a GblPoint.
const SharedPlanePtr & getPlane() const
virtual void getForwardJacobianAndNoise(TMatrixD &jacobian, TMatrixDSym &noise, TVectorD &deltaState) const =0
Get the jacobian and noise matrix of the last extrapolation.
TMatrixDSym getCovariance(double variance, TVector3 trackDirection, SharedPlanePtr measurementPlane) const
Get scattering covariance projected into (measurement) plane.
void addScatterer(const TVectorD &aResiduals, const TVectorD &aPrecision)
Add a (thin) scatterer to a point.
const MeasuredStateOnPlane & getFittedState(bool afterKink=true) const
Get the prediction at this point Always biased in GBL (global fit) There are 2 states,...
virtual unsigned int getDim() const =0
Get the dimension of the state vector used by the track representation.
const TVectorD & getState() const
bool hasMeasurements() const
MeasurementOnPlane getMeasurement() const
Get the measurement on plane from stored measurement data (from last construction/update)
ThinScatterer * getMaterialInfo() const
double getDensity() const
AbsHMatrix implementation for one-dimensional MeasurementOnPlane and RKTrackRep parameterization.
Abstract base class to establish an interface between physical representation of the detector for ali...
void setReferenceState(StateOnPlane &referenceState)
Set the prediction and plane (from measurement if any) You should use the user constructor instead.
boost::scoped_ptr< MeasuredStateOnPlane > fittedStateBwd_
void reset(unsigned int measurementDim=2, unsigned int repDim=5)
(Initial) reset of fitter info
AbsFitterInfo * getFitterInfo(const AbsTrackRep *rep=NULL) const
Get fitterInfo for rep. Per default, use cardinal rep.
unsigned int getNumPoints() const
unsigned int getScatResults(unsigned int aLabel, unsigned int &numRes, TVectorD &aResiduals, TVectorD &aMeasErrors, TVectorD &aResErrors, TVectorD &aDownWeights)
Get (kink) residuals at point from scatterer.
virtual std::vector< genfit::MeasurementOnPlane * > constructMeasurementsOnPlane(const StateOnPlane &state) const =0
const SharedPlanePtr & getPlane() const
Info which information has been pruned from the Track.