88 retVal.
getCov() *= 1. / weight;
97 double sumOfWeights(0), weight(0);
119 sumOfWeights += weight;
122 retVal.
getCov() += covInv;
145 double normMin(9.99E99);
146 unsigned int iMin(0);
150 Exception e(
"KalmanFitterInfo::getClosestMeasurementOnPlane: Cannot compare measurements with different H-Matrices. Maybe you have to select a different multipleMeasurementHandling.", __LINE__,__FILE__);
156 double norm = sqrt(res.Norm2Sqr());
157 if (norm < normMin) {
183 if (this->
getTrackPoint()->getTrack()->getPointWithMeasurementAndFitterInfo(-1, this->
getRep())
186 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/redictions not available in this FitterInfo.", __LINE__,__FILE__);
191 std::cout <<
"KalmanFitterInfo::getFittedState - biased at last measurement = forwardUpdate_ \n";
195 else if (this->
getTrackPoint()->getTrack()->getPointWithMeasurementAndFitterInfo(0, this->
getRep())
198 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/redictions not available in this FitterInfo.", __LINE__,__FILE__);
203 std::cout <<
"KalmanFitterInfo::getFittedState - biased at first measurement = backwardUpdate_ \n";
210 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/redictions not available in this FitterInfo.", __LINE__,__FILE__);
215 std::cout <<
"KalmanFitterInfo::getFittedState - biased = mean(forwardUpdate_, backwardPrediction_) \n";
224 if (this->
getTrackPoint()->getTrack()->getPointWithMeasurementAndFitterInfo(-1, this->
getRep())
227 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/redictions not available in this FitterInfo.", __LINE__,__FILE__);
232 std::cout <<
"KalmanFitterInfo::getFittedState - unbiased at last measurement = forwardPrediction_ \n";
236 else if (this->
getTrackPoint()->getTrack()->getPointWithMeasurementAndFitterInfo(0, this->
getRep())
239 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/redictions not available in this FitterInfo.", __LINE__,__FILE__);
244 std::cout <<
"KalmanFitterInfo::getFittedState - unbiased at first measurement = backwardPrediction_ \n";
250 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/redictions not available in this FitterInfo.", __LINE__,__FILE__);
255 std::cout <<
"KalmanFitterInfo::getFittedState - unbiased = mean(forwardPrediction_, backwardPrediction_) \n";
271 if(*(smoothedState.
getPlane()) != *plane) {
272 Exception e(
"KalmanFitterInfo::getResidual: smoothedState and measurement are not defined in the same plane.", __LINE__,__FILE__);
276 Exception e(
"KalmanFitterInfo::getResidual: smoothedState and measurement are not defined wrt the same TrackRep.", __LINE__,__FILE__);
284 TVectorD res(H->Hv(smoothedState.
getState()));
288 if (onlyMeasurementErrors) {
292 TMatrixDSym cov(smoothedState.
getCov());
294 cov += measurement->
getCov();
360 for (std::vector<MeasurementOnPlane*>::const_iterator
m = measurementsOnPlane.begin(),
mend = measurementsOnPlane.end();
m <
mend; ++
m) {
374 for (std::vector<MeasurementOnPlane*>::const_iterator
m = measurementsOnPlane.begin(),
mend = measurementsOnPlane.end();
m <
mend; ++
m) {
407 Exception e(
"KalmanFitterInfo::setWeights: weights do not have the same size as measurementsOnPlane", __LINE__,__FILE__);
412 std::cerr <<
"KalmanFitterInfo::setWeights - WARNING: setting weights even though weights are fixed!" << std::endl;
452 std::cout <<
"genfit::KalmanFitterInfo. Belongs to TrackPoint " <<
trackPoint_ <<
"; TrackRep " <<
rep_ <<
"\n";
455 std::cout <<
"Weights are fixed.\n";
486 std::cerr <<
"KalmanFitterInfo::checkConsistency(): trackPoint_ is NULL" << std::endl;
498 if (plane.get() == NULL) {
501 std::cerr <<
"KalmanFitterInfo::checkConsistency(): plane is NULL" << std::endl;
505 TVector3 oTest = plane->getO();
513 std::cerr <<
"KalmanFitterInfo::checkConsistency(): measurementsOnPlane_ do not all have the same dimensionality" << std::endl;
518 std::cerr <<
"KalmanFitterInfo::checkConsistency(): measurementsOnPlane_ have dimension 0" << std::endl;
527 std::cerr <<
"KalmanFitterInfo::checkConsistency(): referenceState_ is not defined with the correct plane " <<
referenceState_->getPlane().get() <<
" vs. " << plane.get() << std::endl;
531 std::cerr <<
"KalmanFitterInfo::checkConsistency(): referenceState_ is not defined with the correct TrackRep" << std::endl;
535 std::cerr <<
"KalmanFitterInfo::checkConsistency(): referenceState_ does not have the right dimension!" << std::endl;
542 std::cerr <<
"KalmanFitterInfo::checkConsistency(): forwardPrediction_ is not defined with the correct plane" << std::endl;
546 std::cerr <<
"KalmanFitterInfo::checkConsistency(): forwardPrediction_ is not defined with the correct TrackRep" << std::endl;
550 std::cerr <<
"KalmanFitterInfo::checkConsistency(): forwardPrediction_ does not have the right dimension!" << std::endl;
556 std::cerr <<
"KalmanFitterInfo::checkConsistency(): forwardUpdate_ is not defined with the correct plane" << std::endl;
560 std::cerr <<
"KalmanFitterInfo::checkConsistency(): forwardUpdate_ is not defined with the correct TrackRep" << std::endl;
564 std::cerr <<
"KalmanFitterInfo::checkConsistency(): forwardUpdate_ does not have the right dimension!" << std::endl;
571 std::cerr <<
"KalmanFitterInfo::checkConsistency(): backwardPrediction_ is not defined with the correct plane" << std::endl;
575 std::cerr <<
"KalmanFitterInfo::checkConsistency(): backwardPrediction_ is not defined with the correct TrackRep" << std::endl;
579 std::cerr <<
"KalmanFitterInfo::checkConsistency(): backwardPrediction_ does not have the right dimension!" << std::endl;
585 std::cerr <<
"KalmanFitterInfo::checkConsistency(): backwardUpdate_ is not defined with the correct plane" << std::endl;
589 std::cerr <<
"KalmanFitterInfo::checkConsistency(): backwardUpdate_ is not defined with the correct TrackRep" << std::endl;
593 std::cerr <<
"KalmanFitterInfo::checkConsistency(): backwardUpdate_ does not have the right dimension!" << std::endl;
599 if((*it)->getPlane() != plane) {
600 std::cerr <<
"KalmanFitterInfo::checkConsistency(): measurement is not defined with the correct plane" << std::endl;
603 if((*it)->getRep() !=
rep_) {
604 std::cerr <<
"KalmanFitterInfo::checkConsistency(): measurement is not defined with the correct TrackRep" << std::endl;
607 if ((*it)->getState().GetNrows() == 0) {
608 std::cerr <<
"KalmanFitterInfo::checkConsistency(): measurement has dimension 0!" << std::endl;
615 std::cerr <<
"KalmanFitterInfo::checkConsistency(): forwardUpdate_ w/o forwardPrediction_" << std::endl;
620 std::cerr <<
"KalmanFitterInfo::checkConsistency(): forwardUpdate_ w/o measurement" << std::endl;
626 std::cerr <<
"KalmanFitterInfo::checkConsistency(): backwardUpdate_ w/o backwardPrediction_" << std::endl;
631 std::cerr <<
"KalmanFitterInfo::checkConsistency(): backwardUpdate_ w/o measurement" << std::endl;
641void KalmanFitterInfo::Streamer(TBuffer &R__b)
648 if (R__b.IsReading()) {
649 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
if (R__v) { }
652 baseClass0::Streamer(R__b);
665 if (flag & (1 << 1)) {
671 if (flag & (1 << 2)) {
677 if (flag & (1 << 3)) {
683 if (flag & (1 << 4)) {
690 std::vector<genfit::MeasurementOnPlane*,std::allocator<genfit::MeasurementOnPlane*> > &R__stl =
measurementsOnPlane_;
693 Error(
"measurementsOnPlane_ streamer",
"Missing the TClass object for genfit::MeasurementOnPlane!");
698 R__stl.reserve(R__n);
699 for (R__i = 0; R__i < R__n; R__i++) {
701 R__t->Streamer(R__b);
703 R__stl.push_back(R__t);
706 R__b.CheckByteCount(R__s, R__c, thisClass::IsA());
708 R__c = R__b.WriteVersion(thisClass::IsA(), kTRUE);
711 baseClass0::Streamer(R__b);
731 std::vector<genfit::MeasurementOnPlane*,std::allocator<genfit::MeasurementOnPlane*> > &R__stl =
measurementsOnPlane_;
732 int R__n=
int(R__stl.size());
735 std::vector<genfit::MeasurementOnPlane*,std::allocator<genfit::MeasurementOnPlane*> >::iterator R__k;
736 for (R__k = R__stl.begin(); R__k != R__stl.end(); ++R__k) {
737 (*R__k)->Streamer(R__b);
741 R__b.SetByteCount(R__c, kTRUE);
This class collects all information needed and produced by a specific AbsFitter and is specific to on...
const AbsTrackRep * getRep() const
const TrackPoint * trackPoint_
const SharedPlanePtr & getPlane() const
const AbsTrackRep * rep_
No ownership.
void setPlane(const SharedPlanePtr &plane)
const TrackPoint * getTrackPoint() const
HMatrix for projecting from AbsTrackRep parameters to measured parameters in a DetPlane.
Abstract base class for a track representation.
virtual unsigned int getDim() const =0
Get the dimension of the state vector used by the track representation.
Exception class for error handling in GENFIT (provides storage for diagnostic information)
void setFatal(bool b=true)
Set fatal flag.
MeasuredStateOnPlane with additional info produced by a Kalman filter or DAF.
Collects information needed and produced by a AbsKalmanFitter implementations and is specific to one ...
void setBackwardUpdate(KalmanFittedStateOnPlane *backwardUpdate)
void setRep(const AbsTrackRep *rep)
MeasurementOnPlane getResidual(unsigned int iMeasurement=0, bool biased=false, bool onlyMeasurementErrors=true) const
Get unbiased (default) or biased residual from ith measurement.
const MeasuredStateOnPlane & getFittedState(bool biased=true) const
Get unbiased or biased (default) smoothed state.
std::vector< MeasurementOnPlane * > measurementsOnPlane_
cache
ReferenceStateOnPlane * getReferenceState() const
virtual bool checkConsistency() const
void setWeights(const std::vector< double > &)
Set weights of measurements.
void addMeasurementOnPlane(MeasurementOnPlane *measurementOnPlane)
void setMeasurementsOnPlane(const std::vector< genfit::MeasurementOnPlane * > &measurementsOnPlane)
void setBackwardPrediction(MeasuredStateOnPlane *backwardPrediction)
bool hasForwardPrediction() const
void setForwardUpdate(KalmanFittedStateOnPlane *forwardUpdate)
void deleteReferenceInfo()
bool hasReferenceState() const
MeasurementOnPlane getAvgWeightedMeasurementOnPlane(bool ignoreWeights=false) const
void addMeasurementsOnPlane(const std::vector< genfit::MeasurementOnPlane * > &measurementsOnPlane)
bool hasBackwardPrediction() const
void deleteBackwardInfo()
void setReferenceState(ReferenceStateOnPlane *referenceState)
std::vector< double > getWeights() const
Get weights of measurements.
boost::scoped_ptr< MeasuredStateOnPlane > fittedStateUnbiased_
unsigned int getNumMeasurements() const
MeasuredStateOnPlane * getForwardPrediction() const
KalmanFittedStateOnPlane * getBackwardUpdate() const
boost::scoped_ptr< ReferenceStateOnPlane > referenceState_
Reference state. Used by KalmanFitterRefTrack.
MeasurementOnPlane * getClosestMeasurementOnPlane(const StateOnPlane *) const
Get measurements which is closest to state.
MeasuredStateOnPlane * getBackwardPrediction() const
boost::scoped_ptr< MeasuredStateOnPlane > fittedStateBiased_
cache
bool hasForwardUpdate() const
boost::scoped_ptr< KalmanFittedStateOnPlane > forwardUpdate_
virtual ~KalmanFitterInfo()
bool hasBackwardUpdate() const
virtual KalmanFitterInfo * clone() const
Deep copy ctor for polymorphic class.
boost::scoped_ptr< KalmanFittedStateOnPlane > backwardUpdate_
boost::scoped_ptr< MeasuredStateOnPlane > backwardPrediction_
MeasurementOnPlane * getMeasurementOnPlane(int i=0) const
void setForwardPrediction(MeasuredStateOnPlane *forwardPrediction)
virtual void Print(const Option_t *="") const
KalmanFittedStateOnPlane * getForwardUpdate() const
boost::scoped_ptr< MeasuredStateOnPlane > forwardPrediction_
void deleteMeasurementInfo()
StateOnPlane with additional covariance matrix.
const TMatrixDSym & getCov() const
Measured coordinates on a plane.
void setWeight(double weight)
const AbsHMatrix * getHMatrix() const
StateOnPlane with linearized transport to that ReferenceStateOnPlane from previous and next Reference...
A state with arbitrary dimension defined in a DetPlane.
void setPlane(const SharedPlanePtr &plane)
const TVectorD & getState() const
const AbsTrackRep * getRep() const
const SharedPlanePtr & getPlane() const
Object containing AbsMeasurement and AbsFitterInfo objects.
boost::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.
MeasuredStateOnPlane calcAverageState(const MeasuredStateOnPlane &forwardState, const MeasuredStateOnPlane &backwardState)
Calculate weighted average between two MeasuredStateOnPlanes.
subroutine mend
End of 'module' printout.