89 retVal.
getCov() *= 1. / weight;
98 double sumOfWeights(0), weight(0);
120 sumOfWeights += weight;
123 retVal.
getCov() += covInv;
146 double normMin(9.99E99);
147 unsigned int iMin(0);
151 Exception e(
"KalmanFitterInfo::getClosestMeasurementOnPlane: Cannot compare measurements with different H-Matrices. Maybe you have to select a different multipleMeasurementHandling.", __LINE__,__FILE__);
157 double norm = sqrt(res.Norm2Sqr());
158 if (norm < normMin) {
192 bool first(
false), last(
false);
197 debugOut <<
"KalmanFitterInfo::getFittedState - Track is pruned and has " << tr->
getNumPoints() <<
" TrackPoints \n";
205 debugOut <<
"KalmanFitterInfo::getFittedState - has flag F \n";
211 debugOut <<
"KalmanFitterInfo::getFittedState - has flag L \n";
221 debugOut <<
"KalmanFitterInfo::getFittedState first " << first <<
", last " << last <<
"\n";
237 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/predictions not available in this FitterInfo.", __LINE__,__FILE__);
242 debugOut <<
"KalmanFitterInfo::getFittedState - biased at last measurement = forwardUpdate_ \n";
250 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/predictions not available in this FitterInfo.", __LINE__,__FILE__);
255 debugOut <<
"KalmanFitterInfo::getFittedState - biased at first measurement = backwardUpdate_ \n";
262 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/predictions not available in this FitterInfo.", __LINE__,__FILE__);
267 debugOut <<
"KalmanFitterInfo::getFittedState - biased = mean(forwardUpdate_, backwardPrediction_) \n";
278 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/predictions not available in this FitterInfo.", __LINE__,__FILE__);
283 debugOut <<
"KalmanFitterInfo::getFittedState - unbiased at last measurement = forwardPrediction_ \n";
291 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/predictions not available in this FitterInfo.", __LINE__,__FILE__);
296 debugOut <<
"KalmanFitterInfo::getFittedState - unbiased at first measurement = backwardPrediction_ \n";
302 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/predictions not available in this FitterInfo.", __LINE__,__FILE__);
307 debugOut <<
"KalmanFitterInfo::getFittedState - unbiased = mean(forwardPrediction_, backwardPrediction_) \n";
321 if(*(smoothedState.
getPlane()) != *plane) {
322 Exception e(
"KalmanFitterInfo::getResidual: smoothedState and measurement are not defined in the same plane.", __LINE__,__FILE__);
326 Exception e(
"KalmanFitterInfo::getResidual: smoothedState and measurement are not defined wrt the same TrackRep.", __LINE__,__FILE__);
334 TVectorD res(H->
Hv(smoothedState.
getState()));
338 if (onlyMeasurementErrors) {
342 TMatrixDSym cov(smoothedState.
getCov());
344 cov += measurement->
getCov();
355 return Rinv.Similarity(res.
getState());
419 for (std::vector<MeasurementOnPlane*>::const_iterator m = measurementsOnPlane.begin(), mend = measurementsOnPlane.end(); m < mend; ++m) {
433 for (std::vector<MeasurementOnPlane*>::const_iterator m = measurementsOnPlane.begin(), mend = measurementsOnPlane.end(); m < mend; ++m) {
466 Exception e(
"KalmanFitterInfo::setWeights: weights do not have the same size as measurementsOnPlane", __LINE__,__FILE__);
471 errorOut <<
"KalmanFitterInfo::setWeights - WARNING: setting weights even though weights are fixed!" << std::endl;
511 printOut <<
"genfit::KalmanFitterInfo. Belongs to TrackPoint " <<
trackPoint_ <<
"; TrackRep " <<
rep_ <<
"\n";
545 errorOut <<
"KalmanFitterInfo::checkConsistency(): trackPoint_ is NULL" << std::endl;
557 if (plane.get() == NULL) {
560 errorOut <<
"KalmanFitterInfo::checkConsistency(): plane is NULL" << std::endl;
564 TVector3 oTest = plane->getO();
572 errorOut <<
"KalmanFitterInfo::checkConsistency(): measurementsOnPlane_ do not all have the same dimensionality" << std::endl;
577 errorOut <<
"KalmanFitterInfo::checkConsistency(): measurementsOnPlane_ have dimension 0" << std::endl;
586 errorOut <<
"KalmanFitterInfo::checkConsistency(): referenceState_ is not defined with the correct plane " <<
referenceState_->getPlane().get() <<
" vs. " << plane.get() << std::endl;
590 errorOut <<
"KalmanFitterInfo::checkConsistency(): referenceState_ is not defined with the correct TrackRep" << std::endl;
594 errorOut <<
"KalmanFitterInfo::checkConsistency(): referenceState_ does not have the right dimension!" << std::endl;
601 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardPrediction_ is not defined with the correct plane" << std::endl;
605 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardPrediction_ is not defined with the correct TrackRep" << std::endl;
609 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardPrediction_ does not have the right dimension!" << std::endl;
615 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardUpdate_ is not defined with the correct plane" << std::endl;
619 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardUpdate_ is not defined with the correct TrackRep" << std::endl;
623 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardUpdate_ does not have the right dimension!" << std::endl;
630 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardPrediction_ is not defined with the correct plane" << std::endl;
634 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardPrediction_ is not defined with the correct TrackRep" << std::endl;
638 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardPrediction_ does not have the right dimension!" << std::endl;
644 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardUpdate_ is not defined with the correct plane" << std::endl;
648 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardUpdate_ is not defined with the correct TrackRep" << std::endl;
652 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardUpdate_ does not have the right dimension!" << std::endl;
658 if((*it)->getPlane() != plane) {
659 errorOut <<
"KalmanFitterInfo::checkConsistency(): measurement is not defined with the correct plane" << std::endl;
662 if((*it)->getRep() !=
rep_) {
663 errorOut <<
"KalmanFitterInfo::checkConsistency(): measurement is not defined with the correct TrackRep" << std::endl;
666 if ((*it)->getState().GetNrows() == 0) {
667 errorOut <<
"KalmanFitterInfo::checkConsistency(): measurement has dimension 0!" << std::endl;
672 if (flags == NULL or !flags->
hasFlags(
"U")) {
675 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardUpdate_ w/o forwardPrediction_" << std::endl;
681 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardUpdate_ w/o backwardPrediction_" << std::endl;
685 if (flags == NULL or !flags->
hasFlags(
"M")) {
687 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardUpdate_ w/o measurement" << std::endl;
692 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardUpdate_ w/o measurement" << std::endl;
704 void KalmanFitterInfo::Streamer(TBuffer &R__b)
709 typedef ::genfit::KalmanFitterInfo thisClass;
711 if (R__b.IsReading()) {
712 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
if (R__v) { }
715 baseClass0::Streamer(R__b);
728 if (flag & (1 << 1)) {
734 if (flag & (1 << 2)) {
740 if (flag & (1 << 3)) {
746 if (flag & (1 << 4)) {
753 std::vector<genfit::MeasurementOnPlane*,std::allocator<genfit::MeasurementOnPlane*> > &R__stl =
measurementsOnPlane_;
756 Error(
"measurementsOnPlane_ streamer",
"Missing the TClass object for genfit::MeasurementOnPlane!");
761 R__stl.reserve(R__n);
762 for (R__i = 0; R__i < R__n; R__i++) {
764 R__t->Streamer(R__b);
766 R__stl.push_back(R__t);
769 R__b.CheckByteCount(R__s, R__c, thisClass::IsA());
771 R__c = R__b.WriteVersion(thisClass::IsA(), kTRUE);
774 baseClass0::Streamer(R__b);
794 std::vector<genfit::MeasurementOnPlane*,std::allocator<genfit::MeasurementOnPlane*> > &R__stl =
measurementsOnPlane_;
795 int R__n=(&R__stl) ?
int(R__stl.size()) : 0;
798 std::vector<genfit::MeasurementOnPlane*,std::allocator<genfit::MeasurementOnPlane*> >::iterator R__k;
799 for (R__k = R__stl.begin(); R__k != R__stl.end(); ++R__k) {
800 (*R__k)->Streamer(R__b);
804 R__b.SetByteCount(R__c, kTRUE);
void setBackwardUpdate(KalmanFittedStateOnPlane *backwardUpdate)
const AbsHMatrix * getHMatrix() const
virtual ~KalmanFitterInfo()
const AbsTrackRep * getRep() const
void deleteReferenceInfo()
void setWeights(const std::vector< double > &)
Set weights of measurements.
bool hasBackwardPrediction() const
PruneFlags & getPruneFlags()
boost::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.
virtual KalmanFitterInfo * clone() const
Deep copy ctor for polymorphic class.
double getSmoothedChi2(unsigned int iMeasurement=0)
virtual bool checkConsistency(const genfit::PruneFlags *=NULL) const
boost::scoped_ptr< KalmanFittedStateOnPlane > backwardUpdate_
MeasuredStateOnPlane * getForwardPrediction() const
const TVectorD & getState() const
bool hasReferenceState() const
virtual void HMHt(TMatrixDSym &M) const
similarity: H*M*H^t
virtual void Print(const Option_t *="") const
Info which information has been pruned from the Track.
void setMeasurementsOnPlane(const std::vector< genfit::MeasurementOnPlane * > &measurementsOnPlane)
void addMeasurementOnPlane(MeasurementOnPlane *measurementOnPlane)
HMatrix for projecting from AbsTrackRep parameters to measured parameters in a DetPlane.
unsigned int getNumPoints() const
ReferenceStateOnPlane * getReferenceState() const
void deleteMeasurementInfo()
void setPlane(const SharedPlanePtr &plane)
boost::scoped_ptr< KalmanFittedStateOnPlane > forwardUpdate_
KalmanFittedStateOnPlane * getBackwardUpdate() const
void setForwardPrediction(MeasuredStateOnPlane *forwardPrediction)
unsigned int getNumMeasurements() const
void deleteBackwardInfo()
const SharedPlanePtr & getPlane() const
bool hasFlags(Option_t *option="CFLWRMIU") const
check if all the given flags are set
MeasuredStateOnPlane with additional info produced by a Kalman filter or DAF.
StateOnPlane with linearized transport to that ReferenceStateOnPlane from previous and next Reference...
MeasuredStateOnPlane calcAverageState(const MeasuredStateOnPlane &forwardState, const MeasuredStateOnPlane &backwardState)
Calculate weighted average between two MeasuredStateOnPlanes.
StateOnPlane with additional covariance matrix.
TrackPoint * getPointWithFitterInfo(int id, const AbsTrackRep *rep=NULL) const
MeasurementOnPlane * getClosestMeasurementOnPlane(const StateOnPlane *) const
Get measurements which is closest to state.
void addMeasurementsOnPlane(const std::vector< genfit::MeasurementOnPlane * > &measurementsOnPlane)
void setFatal(bool b=true)
Set fatal flag.
void setReferenceState(ReferenceStateOnPlane *referenceState)
Abstract base class for a track representation.
void Print(const Option_t *="") const
Collects information needed and produced by a AbsKalmanFitter implementations and is specific to one ...
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
std::vector< double > getWeights() const
Get weights of measurements.
MeasuredStateOnPlane * getBackwardPrediction() const
MeasurementOnPlane getAvgWeightedMeasurementOnPlane(bool ignoreWeights=false) const
boost::scoped_ptr< MeasuredStateOnPlane > forwardPrediction_
Object containing AbsMeasurement and AbsFitterInfo objects.
virtual AbsHMatrix * clone() const =0
virtual TVectorD Hv(const TVectorD &v) const
H*v.
void setWeight(double weight)
bool hasForwardPrediction() const
KalmanFittedStateOnPlane * getForwardUpdate() const
void setRep(const AbsTrackRep *rep)
boost::scoped_ptr< MeasuredStateOnPlane > fittedStateUnbiased_
std::vector< MeasurementOnPlane * > measurementsOnPlane_
cache
const TrackPoint * trackPoint_
const SharedPlanePtr & getPlane() const
bool isPruned() const
check if any of the flags is set
A state with arbitrary dimension defined in a DetPlane.
bool hasBackwardUpdate() const
boost::scoped_ptr< ReferenceStateOnPlane > referenceState_
Reference state. Used by KalmanFitterRefTrack.
boost::scoped_ptr< MeasuredStateOnPlane > backwardPrediction_
MeasurementOnPlane getResidual(unsigned int iMeasurement=0, bool biased=false, bool onlyMeasurementErrors=true) const
Get unbiased (default) or biased residual from ith measurement.
const AbsTrackRep * getRep() const
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
const TrackPoint * getTrackPoint() const
void setBackwardPrediction(MeasuredStateOnPlane *backwardPrediction)
bool hasForwardUpdate() const
void setPlane(const SharedPlanePtr &plane)
Measured coordinates on a plane.
boost::scoped_ptr< MeasuredStateOnPlane > fittedStateBiased_
cache
const TMatrixDSym & getCov() const
const MeasuredStateOnPlane & getFittedState(bool biased=true) const
Get unbiased or biased (default) smoothed state.
void setForwardUpdate(KalmanFittedStateOnPlane *forwardUpdate)
const AbsTrackRep * rep_
No ownership.
MeasurementOnPlane * getMeasurementOnPlane(int i=0) const
Defines for I/O streams used for error and debug printing.
This class collects all information needed and produced by a specific AbsFitter and is specific to on...
virtual unsigned int getDim() const =0
Get the dimension of the state vector used by the track representation.
FitStatus * getFitStatus(const AbsTrackRep *rep=NULL) const
Get FitStatus for a AbsTrackRep. Per default, return FitStatus for cardinalRep.