68 for (std::vector<MeasurementOnPlane*>::const_iterator it = this->
measurementsOnPlane_.begin(); it != this->measurementsOnPlane_.end(); ++it) {
89 retVal.
getCov() *= 1. / weight;
99 double sumOfWeights(0), weight(0);
121 sumOfWeights += weight;
124 retVal.
getCov() += covInv;
147 double normMin(9.99E99);
148 unsigned int iMin(0);
152 Exception e(
"KalmanFitterInfo::getClosestMeasurementOnPlane: Cannot compare measurements with different H-Matrices. Maybe you have to select a different multipleMeasurementHandling.", __LINE__,__FILE__);
158 double norm = sqrt(res.Norm2Sqr());
159 if (norm < normMin) {
193 bool first(
false), last(
false);
198 debugOut <<
"KalmanFitterInfo::getFittedState - Track is pruned and has " << tr->
getNumPoints() <<
" TrackPoints \n";
206 debugOut <<
"KalmanFitterInfo::getFittedState - has flag F \n";
212 debugOut <<
"KalmanFitterInfo::getFittedState - has flag L \n";
222 debugOut <<
"KalmanFitterInfo::getFittedState first " << first <<
", last " << last <<
"\n";
238 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/predictions not available in this FitterInfo.", __LINE__,__FILE__);
243 debugOut <<
"KalmanFitterInfo::getFittedState - biased at last measurement = forwardUpdate_ \n";
251 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/predictions not available in this FitterInfo.", __LINE__,__FILE__);
256 debugOut <<
"KalmanFitterInfo::getFittedState - biased at first measurement = backwardUpdate_ \n";
263 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/predictions not available in this FitterInfo.", __LINE__,__FILE__);
268 debugOut <<
"KalmanFitterInfo::getFittedState - biased = mean(forwardUpdate_, backwardPrediction_) \n";
279 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/predictions not available in this FitterInfo.", __LINE__,__FILE__);
284 debugOut <<
"KalmanFitterInfo::getFittedState - unbiased at last measurement = forwardPrediction_ \n";
292 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/predictions not available in this FitterInfo.", __LINE__,__FILE__);
297 debugOut <<
"KalmanFitterInfo::getFittedState - unbiased at first measurement = backwardPrediction_ \n";
303 Exception e(
"KalmanFitterInfo::getFittedState: Needed updates/predictions not available in this FitterInfo.", __LINE__,__FILE__);
308 debugOut <<
"KalmanFitterInfo::getFittedState - unbiased = mean(forwardPrediction_, backwardPrediction_) \n";
322 if(*(smoothedState.
getPlane()) != *plane) {
323 Exception e(
"KalmanFitterInfo::getResidual: smoothedState and measurement are not defined in the same plane.", __LINE__,__FILE__);
327 Exception e(
"KalmanFitterInfo::getResidual: smoothedState and measurement are not defined wrt the same TrackRep.", __LINE__,__FILE__);
335 TVectorD res(H->
Hv(smoothedState.
getState()));
339 if (onlyMeasurementErrors) {
343 TMatrixDSym cov(smoothedState.
getCov());
345 cov += measurement->
getCov();
356 return Rinv.Similarity(res.
getState());
420 for (std::vector<MeasurementOnPlane*>::const_iterator m = measurementsOnPlane.begin(), mend = measurementsOnPlane.end(); m < mend; ++m) {
434 for (std::vector<MeasurementOnPlane*>::const_iterator m = measurementsOnPlane.begin(), mend = measurementsOnPlane.end(); m < mend; ++m) {
467 Exception e(
"KalmanFitterInfo::setWeights: weights do not have the same size as measurementsOnPlane", __LINE__,__FILE__);
472 errorOut <<
"KalmanFitterInfo::setWeights - WARNING: setting weights even though weights are fixed!" << std::endl;
512 printOut <<
"genfit::KalmanFitterInfo. Belongs to TrackPoint " <<
trackPoint_ <<
"; TrackRep " <<
rep_ <<
"\n";
546 errorOut <<
"KalmanFitterInfo::checkConsistency(): trackPoint_ is nullptr" << std::endl;
558 if (plane.get() ==
nullptr) {
561 errorOut <<
"KalmanFitterInfo::checkConsistency(): plane is nullptr" << std::endl;
566 TVector3 oTest = plane->getO();
575 errorOut <<
"KalmanFitterInfo::checkConsistency(): measurementsOnPlane_ do not all have the same dimensionality" << std::endl;
580 errorOut <<
"KalmanFitterInfo::checkConsistency(): measurementsOnPlane_ have dimension 0" << std::endl;
586 int dim =
rep_->getDim();
589 errorOut <<
"KalmanFitterInfo::checkConsistency(): referenceState_ is not defined with the correct plane " <<
referenceState_->getPlane().get() <<
" vs. " << plane.get() << std::endl;
593 errorOut <<
"KalmanFitterInfo::checkConsistency(): referenceState_ is not defined with the correct TrackRep" << std::endl;
597 errorOut <<
"KalmanFitterInfo::checkConsistency(): referenceState_ does not have the right dimension!" << std::endl;
604 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardPrediction_ is not defined with the correct plane" << std::endl;
608 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardPrediction_ is not defined with the correct TrackRep" << std::endl;
612 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardPrediction_ does not have the right dimension!" << std::endl;
618 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardUpdate_ is not defined with the correct plane" << std::endl;
622 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardUpdate_ is not defined with the correct TrackRep" << std::endl;
626 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardUpdate_ does not have the right dimension!" << std::endl;
633 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardPrediction_ is not defined with the correct plane" << std::endl;
637 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardPrediction_ is not defined with the correct TrackRep" << std::endl;
641 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardPrediction_ does not have the right dimension!" << std::endl;
647 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardUpdate_ is not defined with the correct plane" << std::endl;
651 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardUpdate_ is not defined with the correct TrackRep" << std::endl;
655 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardUpdate_ does not have the right dimension!" << std::endl;
661 if((*it)->getPlane() != plane) {
662 errorOut <<
"KalmanFitterInfo::checkConsistency(): measurement is not defined with the correct plane" << std::endl;
665 if((*it)->getRep() !=
rep_) {
666 errorOut <<
"KalmanFitterInfo::checkConsistency(): measurement is not defined with the correct TrackRep" << std::endl;
669 if ((*it)->getState().GetNrows() == 0) {
670 errorOut <<
"KalmanFitterInfo::checkConsistency(): measurement has dimension 0!" << std::endl;
675 if (flags ==
nullptr or !flags->
hasFlags(
"U")) {
678 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardUpdate_ w/o forwardPrediction_" << std::endl;
684 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardUpdate_ w/o backwardPrediction_" << std::endl;
688 if (flags ==
nullptr or !flags->
hasFlags(
"M")) {
690 errorOut <<
"KalmanFitterInfo::checkConsistency(): forwardUpdate_ w/o measurement" << std::endl;
695 errorOut <<
"KalmanFitterInfo::checkConsistency(): backwardUpdate_ w/o measurement" << std::endl;
707void KalmanFitterInfo::Streamer(TBuffer &R__b)
714 if (R__b.IsReading()) {
715 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
if (R__v) { }
718 baseClass0::Streamer(R__b);
731 if (flag & (1 << 1)) {
737 if (flag & (1 << 2)) {
743 if (flag & (1 << 3)) {
749 if (flag & (1 << 4)) {
756 std::vector<genfit::MeasurementOnPlane*,std::allocator<genfit::MeasurementOnPlane*> > &R__stl =
measurementsOnPlane_;
757 TClass *R__tcl1 = TBuffer::GetClass(
typeid(genfit::MeasurementOnPlane));
759 Error(
"measurementsOnPlane_ streamer",
"Missing the TClass object for genfit::MeasurementOnPlane!");
764 R__stl.reserve(R__n);
765 for (R__i = 0; R__i < R__n; R__i++) {
766 genfit::MeasurementOnPlane* R__t =
new MeasurementOnPlane();
767 R__t->Streamer(R__b);
769 R__stl.push_back(R__t);
772 R__b.CheckByteCount(R__s, R__c, thisClass::IsA());
774 R__c = R__b.WriteVersion(thisClass::IsA(), kTRUE);
776 typedef genfit::AbsFitterInfo baseClass0;
777 baseClass0::Streamer(R__b);
797 std::vector<genfit::MeasurementOnPlane*,std::allocator<genfit::MeasurementOnPlane*> > &R__stl =
measurementsOnPlane_;
798 int R__n=int(R__stl.size());
801 std::vector<genfit::MeasurementOnPlane*,std::allocator<genfit::MeasurementOnPlane*> >::iterator R__k;
802 for (R__k = R__stl.begin(); R__k != R__stl.end(); ++R__k) {
803 (*R__k)->Streamer(R__b);
807 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.
virtual TVectorD Hv(const TVectorD &v) const
H*v.
virtual void HMHt(TMatrixDSym &M) const
similarity: H*M*H^t
virtual AbsHMatrix * clone() const =0
Abstract base class for a track representation.
Exception class for error handling in GENFIT (provides storage for diagnostic information)
void setFatal(bool b=true)
Set fatal flag.
PruneFlags & getPruneFlags()
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 ...
bool hasBackwardUpdate() const override
void setBackwardUpdate(KalmanFittedStateOnPlane *backwardUpdate)
void setRep(const AbsTrackRep *rep) override
std::vector< MeasurementOnPlane * > measurementsOnPlane_
cache
virtual bool checkConsistency(const genfit::PruneFlags *=nullptr) const override
ReferenceStateOnPlane * getReferenceState() const
bool hasForwardPrediction() const override
void setWeights(const std::vector< double > &)
Set weights of measurements.
void addMeasurementOnPlane(MeasurementOnPlane *measurementOnPlane)
void setMeasurementsOnPlane(const std::vector< genfit::MeasurementOnPlane * > &measurementsOnPlane)
const MeasuredStateOnPlane & getFittedState(bool biased=true) const override
Get unbiased or biased (default) smoothed state.
std::unique_ptr< ReferenceStateOnPlane > referenceState_
Reference state. Used by KalmanFitterRefTrack.
void setBackwardPrediction(MeasuredStateOnPlane *backwardPrediction)
bool hasBackwardPrediction() const override
void setForwardUpdate(KalmanFittedStateOnPlane *forwardUpdate)
MeasurementOnPlane getAvgWeightedMeasurementOnPlane(bool ignoreWeights=false) const
void addMeasurementsOnPlane(const std::vector< genfit::MeasurementOnPlane * > &measurementsOnPlane)
void setReferenceState(ReferenceStateOnPlane *referenceState)
std::vector< double > getWeights() const
Get weights of measurements.
void deleteBackwardInfo() override
void deleteMeasurementInfo() override
unsigned int getNumMeasurements() const
MeasurementOnPlane getResidual(unsigned int iMeasurement=0, bool biased=false, bool onlyMeasurementErrors=true) const override
Get unbiased (default) or biased residual from ith measurement.
MeasuredStateOnPlane * getForwardPrediction() const
virtual KalmanFitterInfo * clone() const override
Deep copy ctor for polymorphic class.
KalmanFittedStateOnPlane * getBackwardUpdate() const
std::unique_ptr< MeasuredStateOnPlane > fittedStateBiased_
cache
MeasurementOnPlane * getClosestMeasurementOnPlane(const StateOnPlane *) const
Get measurements which is closest to state.
MeasuredStateOnPlane * getBackwardPrediction() const
std::unique_ptr< MeasuredStateOnPlane > forwardPrediction_
virtual void Print(const Option_t *="") const override
virtual ~KalmanFitterInfo()
bool hasReferenceState() const override
std::unique_ptr< MeasuredStateOnPlane > fittedStateUnbiased_
std::unique_ptr< KalmanFittedStateOnPlane > backwardUpdate_
bool hasForwardUpdate() const override
void deleteReferenceInfo() override
MeasurementOnPlane * getMeasurementOnPlane(int i=0) const
double getSmoothedChi2(unsigned int iMeasurement=0) const
void setForwardPrediction(MeasuredStateOnPlane *forwardPrediction)
KalmanFittedStateOnPlane * getForwardUpdate() const
void deleteForwardInfo() override
std::unique_ptr< KalmanFittedStateOnPlane > forwardUpdate_
std::unique_ptr< MeasuredStateOnPlane > backwardPrediction_
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
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
FitStatus * getFitStatus(const AbsTrackRep *rep=nullptr) const
Get FitStatus for a AbsTrackRep. Per default, return FitStatus for cardinalRep.
unsigned int getNumPoints() const
TrackPoint * getPointWithFitterInfo(int id, const AbsTrackRep *rep=nullptr) const
Object containing AbsMeasurement and AbsFitterInfo objects.
Defines for I/O streams used for error and debug printing.
MeasuredStateOnPlane calcAverageState(const MeasuredStateOnPlane &forwardState, const MeasuredStateOnPlane &backwardState)
Calculate weighted average between two MeasuredStateOnPlanes.
std::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.
Info which information has been pruned from the Track.
bool hasFlags(Option_t *option="CFLWRMIU") const
check if all the given flags are set
bool isPruned() const
check if any of the flags is set
void Print(const Option_t *="") const