7 #include <TMatrixDSym.h>
10 #include <GenFit/KalmanFitterInfo.h>
11 #include <GenFit/MeasuredStateOnPlane.h>
12 #include <GenFit/MeasurementOnPlane.h>
13 #include <GenFit/TrackPoint.h>
14 #include <GenFit/AbsHMatrix.h>
25 TVectorD ep1(3), ep2(3), hitcoord(7);
36 TMatrixDSym hitcov(7);
39 hitcov(6, 6) = resol*resol;
42 setRawHitCoords(hitcoord);
46 setTrackPoint(
nullptr);
50 setLeftRightResolution(0);
54 _enableInFit = _bfHit.
hit.
index < 0 ?
false : en;
67 if(!_enableInFit)
return;
69 genfit::KalmanFitterInfo* fitinfo = getTrackPoint()->getKalmanFitterInfo();
70 const genfit::MeasuredStateOnPlane& state = fitinfo->getFittedState(
false);
71 genfit::MeasurementOnPlane* mstate = fitinfo->getClosestMeasurementOnPlane(&state);
72 const genfit::AbsHMatrix* H = mstate->getHMatrix();
74 _driftSign = mstate->getState()[0] > 0 ? 1 : -1;
75 _proj = H->Hv(state.getState())[0];
80 std::cout <<
" ................................................" << std::endl;
83 <<
", post-fit sign = " << _driftSign <<
", projection = " << _proj <<
", residual = " << _proj - _driftSign*_bfHit.
hit.
driftDistance << std::endl;
85 if(debugLvl < 1)
return;
91 genfit::KalmanFitterInfo* fitinfo = getTrackPoint()->getKalmanFitterInfo();
92 const genfit::MeasuredStateOnPlane& fitstate = fitinfo->getFittedState(
true);
93 fitstate.getPosMom(pos, mom);
96 if(debugLvl > 10) fitstate.get6DCov().Print();
98 if(debugLvl > 1 && fitinfo->hasReferenceState())
100 genfit::StateOnPlane* state =
static_cast<genfit::StateOnPlane*
>(fitinfo->getReferenceState());
102 state->getPosMom(pos, mom);
107 if(debugLvl > 2 && fitinfo->hasForwardPrediction())
109 genfit::MeasuredStateOnPlane* state =
static_cast<genfit::MeasuredStateOnPlane*
>(fitinfo->getForwardPrediction());
111 state->getPosMom(pos, mom);
114 if(debugLvl > 10) state->get6DCov().Print();
117 if(debugLvl > 2 && fitinfo->hasForwardUpdate())
119 genfit::MeasuredStateOnPlane* state =
static_cast<genfit::MeasuredStateOnPlane*
>(fitinfo->getForwardUpdate());
121 state->getPosMom(pos, mom);
124 if(debugLvl > 10) state->get6DCov().Print();
127 if(debugLvl > 3 && fitinfo->hasBackwardPrediction())
129 genfit::MeasuredStateOnPlane* state =
static_cast<genfit::MeasuredStateOnPlane*
>(fitinfo->getBackwardPrediction());
131 state->getPosMom(pos, mom);
134 if(debugLvl > 10) state->get6DCov().Print();
137 if(debugLvl > 3 && fitinfo->hasBackwardUpdate())
139 genfit::MeasuredStateOnPlane* state =
static_cast<genfit::MeasuredStateOnPlane*
>(fitinfo->getBackwardUpdate());
141 state->getPosMom(pos, mom);
144 if(debugLvl > 10) state->get6DCov().Print();
150 std::cout <<
" -- " << name.Data() <<
": ";
151 std::cout <<
"pos (X,Y,Z,W) = " << std::setprecision(6) << pos.X() <<
" " << pos.Y() <<
" " << pos.Z() <<
" " << w;
152 std::cout <<
" - mom(Px,Py,Pz) = " << mom.X() <<
" " << mom.Y() <<
" " << mom.Z();
153 std::cout <<
" - rep(tx,ty,x0,y0) = " << mom.X()/mom.Z() <<
" " << mom.Y()/mom.Z() <<
" " << pos.X()-mom.X()/mom.Z()*pos.Z();
154 std::cout <<
" " << pos.Y()-mom.Y()/mom.Z()*pos.Z();
155 std::cout << std::endl;
void setTrackPtr(GFTrack *trackPtr)
double getCellWidth(int detectorID)
void printHelper(double w, TVector3 &pos, TVector3 &mom, TString name="none")
double getPlaneResolution(int detectorID) const
void print(unsigned int debugLvl=0)
double getInterceptionFast(int detectorID, double tx, double ty, double x0, double y0) const
static GeomSvc * instance()
singlton instance
void getEndPoints(int detectorID, int elementID, TVectorD &ep1, TVectorD &ep2)
double getPlanePosition(int detectorID) const
GFMeasurement(const SignedHit &rawHit, bool en=true)