Belle II Software  release-05-01-25
MplTrackRep Class Reference

Monopole track representation. More...

#include <MplTrackRep.h>

Inheritance diagram for MplTrackRep:
Collaboration diagram for MplTrackRep:

Public Member Functions

 MplTrackRep (int pdgCode, float magCharge, char propDir=0)
 
double RKPropagate (M1x7 &state7, M7x7 *jacobian, M1x3 &SA, double S, bool varField=true, bool calcOnlyLastRowOfJ=false) const override
 The actual Runge Kutta propagation. More...
 
double getCharge (const StateOnPlane &state) const override
 Get the (fitted) charge of a state. More...
 
virtual AbsTrackRepclone () const override
 Clone the trackRep.
 
virtual double extrapolateToPlane (StateOnPlane &state, const SharedPlanePtr &plane, bool stopAtBoundary=false, bool calcJacobianNoise=false) const override
 Extrapolates the state to plane, and returns the extrapolation length and, via reference, the extrapolated state. More...
 
virtual double extrapolateToLine (StateOnPlane &state, const TVector3 &linePoint, const TVector3 &lineDirection, bool stopAtBoundary=false, bool calcJacobianNoise=false) const override
 Extrapolates the state to the POCA to a line, and returns the extrapolation length and, via reference, the extrapolated state. More...
 
virtual double extrapolateToLine (StateOnPlane &state, const TVector3 &linePoint, const TVector3 &lineDirection, bool stopAtBoundary=false, bool calcJacobianNoise=false) const=0
 Extrapolates the state to the POCA to a line, and returns the extrapolation length and, via reference, the extrapolated state. More...
 
virtual double extrapolateToLine (StateOnPlane &state, const TVector3 &point1, const TVector3 &point2, TVector3 &poca, TVector3 &dirInPoca, TVector3 &poca_onwire, bool stopAtBoundary=false, bool calcJacobianNoise=false) const
 Resembles the interface of GFAbsTrackRep in old versions of genfit. More...
 
virtual double extrapolateToLine (StateOnPlane &state, const TVector3 &point1, const TVector3 &point2, TVector3 &poca, TVector3 &dirInPoca, TVector3 &poca_onwire, bool stopAtBoundary=false, bool calcJacobianNoise=false) const
 Resembles the interface of GFAbsTrackRep in old versions of genfit. More...
 
virtual double extrapolateToPoint (StateOnPlane &state, const TVector3 &point, bool stopAtBoundary=false, bool calcJacobianNoise=false) const override
 Extrapolates the state to the POCA to a point, and returns the extrapolation length and, via reference, the extrapolated state. More...
 
virtual double extrapolateToPoint (StateOnPlane &state, const TVector3 &point, const TMatrixDSym &G, bool stopAtBoundary=false, bool calcJacobianNoise=false) const override
 Extrapolates the state to the POCA to a point in the metric of G, and returns the extrapolation length and, via reference, the extrapolated state. More...
 
virtual double extrapolateToCylinder (StateOnPlane &state, double radius, const TVector3 &linePoint=TVector3(0., 0., 0.), const TVector3 &lineDirection=TVector3(0., 0., 1.), bool stopAtBoundary=false, bool calcJacobianNoise=false) const override
 Extrapolates the state to the cylinder surface, and returns the extrapolation length and, via reference, the extrapolated state. More...
 
virtual double extrapolateToCone (StateOnPlane &state, double radius, const TVector3 &linePoint=TVector3(0., 0., 0.), const TVector3 &lineDirection=TVector3(0., 0., 1.), bool stopAtBoundary=false, bool calcJacobianNoise=false) const override
 Extrapolates the state to the cone surface, and returns the extrapolation length and, via reference, the extrapolated state. More...
 
virtual double extrapolateToSphere (StateOnPlane &state, double radius, const TVector3 &point=TVector3(0., 0., 0.), bool stopAtBoundary=false, bool calcJacobianNoise=false) const override
 Extrapolates the state to the sphere surface, and returns the extrapolation length and, via reference, the extrapolated state. More...
 
virtual double extrapolateBy (StateOnPlane &state, double step, bool stopAtBoundary=false, bool calcJacobianNoise=false) const override
 Extrapolates the state by step (cm) and returns the extrapolation length and, via reference, the extrapolated state. More...
 
unsigned int getDim () const override
 Get the dimension of the state vector used by the track representation.
 
virtual TVector3 getPos (const StateOnPlane &state) const override
 Get the cartesian position of a state.
 
virtual TVector3 getMom (const StateOnPlane &state) const override
 Get the cartesian momentum vector of a state.
 
virtual void getPosMom (const StateOnPlane &state, TVector3 &pos, TVector3 &mom) const override
 Get cartesian position and momentum vector of a state.
 
virtual double getMomMag (const StateOnPlane &state) const override
 get the magnitude of the momentum in GeV.
 
virtual double getMomVar (const MeasuredStateOnPlane &state) const override
 get the variance of the absolute value of the momentum .
 
virtual TMatrixDSym get6DCov (const MeasuredStateOnPlane &state) const override
 Get the 6D covariance.
 
virtual void getPosMomCov (const MeasuredStateOnPlane &state, TVector3 &pos, TVector3 &mom, TMatrixDSym &cov) const override
 Translates MeasuredStateOnPlane into 3D position, momentum and 6x6 covariance.
 
virtual double getQop (const StateOnPlane &state) const override
 Get charge over momentum.
 
double getSpu (const StateOnPlane &state) const
 
double getTime (const StateOnPlane &state) const override
 Get the time corresponding to the StateOnPlane. Extrapolation.
 
virtual void getForwardJacobianAndNoise (TMatrixD &jacobian, TMatrixDSym &noise, TVectorD &deltaState) const override
 Get the jacobian and noise matrix of the last extrapolation.
 
virtual void getBackwardJacobianAndNoise (TMatrixD &jacobian, TMatrixDSym &noise, TVectorD &deltaState) const override
 Get the jacobian and noise matrix of the last extrapolation if it would have been done in opposite direction.
 
std::vector< genfit::MatStepgetSteps () const override
 Get stepsizes and material properties of crossed materials of the last extrapolation.
 
virtual double getRadiationLenght () const override
 Get the accumulated X/X0 (path / radiation length) of the material crossed in the last extrapolation.
 
virtual void setPosMom (StateOnPlane &state, const TVector3 &pos, const TVector3 &mom) const override
 Set position and momentum of state.
 
virtual void setPosMom (StateOnPlane &state, const TVectorD &state6) const override
 Set position and momentum of state.
 
virtual void setPosMomErr (MeasuredStateOnPlane &state, const TVector3 &pos, const TVector3 &mom, const TVector3 &posErr, const TVector3 &momErr) const override
 Set position and momentum and error of state.
 
virtual void setPosMomCov (MeasuredStateOnPlane &state, const TVector3 &pos, const TVector3 &mom, const TMatrixDSym &cov6x6) const override
 Set position, momentum and covariance of state.
 
virtual void setPosMomCov (MeasuredStateOnPlane &state, const TVectorD &state6, const TMatrixDSym &cov6x6) const override
 Set position, momentum and covariance of state.
 
virtual void setChargeSign (StateOnPlane &state, double charge) const override
 Set the sign of the charge according to charge.
 
virtual void setQop (StateOnPlane &state, double qop) const override
 Set charge/momentum.
 
void setSpu (StateOnPlane &state, double spu) const
 
void setTime (StateOnPlane &state, double time) const override
 Set time at which the state was defined.
 
virtual bool isSameType (const AbsTrackRep *other) override
 check if other is of same type (e.g. RKTrackRep).
 
virtual bool isSame (const AbsTrackRep *other) override
 check if other is of same type (e.g. RKTrackRep) and has same pdg code.
 
double extrapolateToMeasurement (StateOnPlane &state, const AbsMeasurement *measurement, bool stopAtBoundary=false, bool calcJacobianNoise=false) const
 extrapolate to an AbsMeasurement
 
TVector3 getDir (const StateOnPlane &state) const
 Get the direction vector of a state.
 
void getPosDir (const StateOnPlane &state, TVector3 &pos, TVector3 &dir) const
 Get cartesian position and direction vector of a state.
 
virtual TVectorD get6DState (const StateOnPlane &state) const
 Get the 6D state vector (x, y, z, p_x, p_y, p_z).
 
virtual void get6DStateCov (const MeasuredStateOnPlane &state, TVectorD &stateVec, TMatrixDSym &cov) const
 Translates MeasuredStateOnPlane into 6D state vector (x, y, z, p_x, p_y, p_z) and 6x6 covariance.
 
int getPDG () const
 Get the pdg code.
 
double getPDGCharge () const
 Get the charge of the particle of the pdg code.
 
double getMass (const StateOnPlane &state) const
 Get tha particle mass in GeV/c^2.
 
char getPropDir () const
 Get propagation direction. (-1, 0, 1) -> (backward, auto, forward).
 
void calcJacobianNumerically (const genfit::StateOnPlane &origState, const genfit::SharedPlanePtr destPlane, TMatrixD &jacobian) const
 Calculate Jacobian of transportation numerically. More...
 
bool switchPDGSign ()
 try to multiply pdg code with -1. (Switch from particle to anti-particle and vice versa).
 
void setPropDir (int dir)
 Set propagation direction. (-1, 0, 1) -> (backward, auto, forward).
 
void switchPropDir ()
 Switch propagation direction. Has no effect if propDir_ is set to 0.
 
virtual void setDebugLvl (unsigned int lvl=1)
 
virtual void Print (const Option_t *="") const
 

Protected Attributes

StateOnPlane lastStartState_
 
StateOnPlane lastEndState_
 state where the last extrapolation has started
 
int pdgCode_
 Particle code.
 
char propDir_
 propagation direction (-1, 0, 1) -> (backward, auto, forward)
 
unsigned int debugLvl_
 

Private Member Functions

void initArrays () const
 
virtual double extrapToPoint (StateOnPlane &state, const TVector3 &point, const TMatrixDSym *G=nullptr, bool stopAtBoundary=false, bool calcJacobianNoise=false) const
 
void getState7 (const StateOnPlane &state, M1x7 &state7) const
 
void getState5 (StateOnPlane &state, const M1x7 &state7) const
 
void calcJ_pM_5x7 (M5x7 &J_pM, const TVector3 &U, const TVector3 &V, const M1x3 &pTilde, double spu) const
 
void transformPM6 (const MeasuredStateOnPlane &state, M6x6 &out6x6) const
 
void calcJ_Mp_7x5 (M7x5 &J_Mp, const TVector3 &U, const TVector3 &V, const TVector3 &W, const M1x3 &A) const
 
void calcForwardJacobianAndNoise (const M1x7 &startState7, const DetPlane &startPlane, const M1x7 &destState7, const DetPlane &destPlane) const
 
void transformM6P (const M6x6 &in6x6, const M1x7 &state7, MeasuredStateOnPlane &state) const
 
bool RKutta (const M1x4 &SU, const DetPlane &plane, double charge, double mass, M1x7 &state7, M7x7 *jacobianT, M1x7 *J_MMT_unprojected_lastRow, double &coveredDistance, double &flightTime, bool &checkJacProj, M7x7 &noiseProjection, StepLimits &limits, bool onlyOneStep=false, bool calcOnlyLastRowOfJ=false) const
 Propagates the particle through the magnetic field. More...
 
double estimateStep (const M1x7 &state7, const M1x4 &SU, const DetPlane &plane, const double &charge, double &relMomLoss, StepLimits &limits) const
 
TVector3 pocaOnLine (const TVector3 &linePoint, const TVector3 &lineDirection, const TVector3 &point) const
 
double Extrap (const DetPlane &startPlane, const DetPlane &destPlane, double charge, double mass, bool &isAtBoundary, M1x7 &state7, double &flightTime, bool fillExtrapSteps, TMatrixDSym *cov=nullptr, bool onlyOneStep=false, bool stopAtBoundary=false, double maxStep=1.E99) const
 Handles propagation and material effects. More...
 
void checkCache (const StateOnPlane &state, const SharedPlanePtr *plane) const
 
double momMag (const M1x7 &state7) const
 

Private Attributes

const double m_magCharge
 
const double m_mass
 
std::vector< RKStepRKSteps_
 state where the last extrapolation has ended
 
int RKStepsFXStart_
 RungeKutta steps made in the last extrapolation.
 
int RKStepsFXStop_
 
std::vector< ExtrapStepExtrapSteps_
 
TMatrixD fJacobian_
 steps made in Extrap during last extrapolation
 
TMatrixDSym fNoise_
 
bool useCache_
 
unsigned int cachePos_
 use cached RKSteps_ for extrapolation
 
StepLimits limits_
 
M7x7 noiseArray_
 
M7x7 noiseProjection_
 noise matrix of the last extrapolation
 
M7x7 J_MMT_
 

Detailed Description

Monopole track representation.

It is a minimal modification of RKTrackRep with a different equations of motion for magnetic charges.

In the current implementation the states on plane are 5-d: u, v, u', v', q/p except that q in this case is magnetic, and the monopole has no electic charge.

Definition at line 33 of file MplTrackRep.h.

Member Function Documentation

◆ calcJacobianNumerically()

void calcJacobianNumerically ( const genfit::StateOnPlane origState,
const genfit::SharedPlanePtr  destPlane,
TMatrixD &  jacobian 
) const
inherited

Calculate Jacobian of transportation numerically.

Slow but accurate. Can be used to validate (semi)analytic calculations.

Definition at line 105 of file AbsTrackRep.cc.

◆ Extrap()

double Extrap ( const DetPlane startPlane,
const DetPlane destPlane,
double  charge,
double  mass,
bool &  isAtBoundary,
M1x7 state7,
double &  flightTime,
bool  fillExtrapSteps,
TMatrixDSym *  cov = nullptr,
bool  onlyOneStep = false,
bool  stopAtBoundary = false,
double  maxStep = 1.E99 
) const
privateinherited

Handles propagation and material effects.

extrapolateToPlane(), extrapolateToPoint() and extrapolateToLine() etc. call this function. Extrap() needs a plane as an argument, hence extrapolateToPoint() and extrapolateToLine() create virtual detector planes. In this function, RKutta() is called and the resulting points and point paths are filtered so that the direction doesn't change and tiny steps are filtered out. After the propagation the material effects are called via the MaterialEffects singleton. Extrap() will loop until the plane is reached, unless the propagation fails or the maximum number of iterations is exceeded.

fNoMaterial &&

Definition at line 2307 of file RKTrackRep.cc.

2319 {
2320 
2321  static const unsigned int maxNumIt(500);
2322  unsigned int numIt(0);
2323 
2324  double coveredDistance(0.);
2325  double dqop(0.);
2326 
2327  const TVector3 W(destPlane.getNormal());
2328  M1x4 SU = {{W.X(), W.Y(), W.Z(), destPlane.distance(0., 0., 0.)}};
2329 
2330  // make SU vector point away from origin
2331  if (W*destPlane.getO() < 0) {
2332  SU[0] *= -1;
2333  SU[1] *= -1;
2334  SU[2] *= -1;
2335  }
2336 
2337 
2338  M1x7 startState7 = state7;
2339 
2340  while(true){
2341 
2342  if (debugLvl_ > 0) {
2343  debugOut << "\n============ RKTrackRep::Extrap loop nr. " << numIt << " ============\n";
2344  debugOut << "Start plane: "; startPlane.Print();
2345  debugOut << "fillExtrapSteps " << fillExtrapSteps << "\n";
2346  }
2347 
2348  if(++numIt > maxNumIt){
2349  Exception exc("RKTrackRep::Extrap ==> maximum number of iterations exceeded",__LINE__,__FILE__);
2350  exc.setFatal();
2351  throw exc;
2352  }
2353 
2354  // initialize jacobianT with unit matrix
2355  for(int i = 0; i < 7*7; ++i) J_MMT_[i] = 0;
2356  for(int i=0; i<7; ++i) J_MMT_[8*i] = 1.;
2357 
2358  M7x7* noise = nullptr;
2359  isAtBoundary = false;
2360 
2361  // propagation
2362  bool checkJacProj = false;
2363  limits_.reset();
2364  limits_.setLimit(stp_sMaxArg, maxStep-fabs(coveredDistance));
2365 
2366  M1x7 J_MMT_unprojected_lastRow = {{0, 0, 0, 0, 0, 0, 1}};
2367 
2368  if( ! RKutta(SU, destPlane, charge, mass, state7, &J_MMT_, &J_MMT_unprojected_lastRow,
2369  coveredDistance, flightTime, checkJacProj, noiseProjection_,
2370  limits_, onlyOneStep, !fillExtrapSteps) ) {
2371  Exception exc("RKTrackRep::Extrap ==> Runge Kutta propagation failed",__LINE__,__FILE__);
2372  exc.setFatal();
2373  throw exc;
2374  }
2375 
2376  bool atPlane(limits_.getLowestLimit().first == stp_plane);
2377  if (limits_.getLowestLimit().first == stp_boundary)
2378  isAtBoundary = true;
2379 
2380 
2381  if (debugLvl_ > 0) {
2382  debugOut<<"RKSteps \n";
2383  for (std::vector<RKStep>::iterator it = RKSteps_.begin(); it != RKSteps_.end(); ++it){
2384  debugOut << "stepSize = " << it->matStep_.stepSize_ << "\t";
2385  it->matStep_.material_.Print();
2386  }
2387  debugOut<<"\n";
2388  }
2389 
2390 
2391 
2392  // call MatFX
2393  if(fillExtrapSteps) {
2394  noise = &noiseArray_;
2395  for(int i = 0; i < 7*7; ++i) noiseArray_[i] = 0; // set noiseArray_ to 0
2396  }
2397 
2398  unsigned int nPoints(RKStepsFXStop_ - RKStepsFXStart_);
2399  if ( nPoints>0){
2400  // momLoss has a sign - negative loss means momentum gain
2401  double momLoss = MaterialEffects::getInstance()->effects(RKSteps_,
2403  RKStepsFXStop_,
2404  fabs(charge/state7[6]), // momentum
2405  pdgCode_,
2406  noise);
2407 
2408  RKStepsFXStart_ = RKStepsFXStop_;
2409 
2410  if (debugLvl_ > 0) {
2411  debugOut << "momLoss: " << momLoss << " GeV; relative: " << momLoss/fabs(charge/state7[6])
2412  << "; coveredDistance = " << coveredDistance << "\n";
2413  if (debugLvl_ > 1 && noise != nullptr) {
2414  debugOut << "7D noise: \n";
2415  RKTools::printDim(noise->begin(), 7, 7);
2416  }
2417  }
2418 
2419  // do momLoss only for defined 1/momentum .ne.0
2420  if(fabs(state7[6])>1.E-10) {
2421 
2422  if (debugLvl_ > 0) {
2423  debugOut << "correct state7 with dx/dqop, dy/dqop ...\n";
2424  }
2425 
2426  dqop = charge/(fabs(charge/state7[6])-momLoss) - state7[6];
2427 
2428  // Correct coveredDistance and flightTime and momLoss if checkJacProj == true
2429  // The idea is to calculate the state correction (based on the mometum loss) twice:
2430  // Once with the unprojected Jacobian (which preserves coveredDistance),
2431  // and once with the projected Jacobian (which is constrained to the plane and does NOT preserve coveredDistance).
2432  // The difference of these two corrections can then be used to calculate a correction factor.
2433  if (checkJacProj && fabs(coveredDistance) > MINSTEP) {
2434  M1x3 state7_correction_unprojected = {{0, 0, 0}};
2435  for (unsigned int i=0; i<3; ++i) {
2436  state7_correction_unprojected[i] = 0.5 * dqop * J_MMT_unprojected_lastRow[i];
2437  //debugOut << "J_MMT_unprojected_lastRow[i] " << J_MMT_unprojected_lastRow[i] << "\n";
2438  //debugOut << "state7_correction_unprojected[i] " << state7_correction_unprojected[i] << "\n";
2439  }
2440 
2441  M1x3 state7_correction_projected = {{0, 0, 0}};
2442  for (unsigned int i=0; i<3; ++i) {
2443  state7_correction_projected[i] = 0.5 * dqop * J_MMT_[6*7 + i];
2444  //debugOut << "J_MMT_[6*7 + i] " << J_MMT_[6*7 + i] << "\n";
2445  //debugOut << "state7_correction_projected[i] " << state7_correction_projected[i] << "\n";
2446  }
2447 
2448  // delta distance
2449  M1x3 delta_state = {{0, 0, 0}};
2450  for (unsigned int i=0; i<3; ++i) {
2451  delta_state[i] = state7_correction_unprojected[i] - state7_correction_projected[i];
2452  }
2453 
2454  double Dist( sqrt(delta_state[0]*delta_state[0]
2455  + delta_state[1]*delta_state[1]
2456  + delta_state[2]*delta_state[2] ) );
2457 
2458  // sign: delta * a
2459  if (delta_state[0]*state7[3] + delta_state[1]*state7[4] + delta_state[2]*state7[5] > 0)
2460  Dist *= -1.;
2461 
2462  double correctionFactor( 1. + Dist / coveredDistance );
2463  flightTime *= correctionFactor;
2464  momLoss *= correctionFactor;
2465  coveredDistance = coveredDistance + Dist;
2466 
2467  if (debugLvl_ > 0) {
2468  debugOut << "correctionFactor-1 = " << correctionFactor-1. << "; Dist = " << Dist << "\n";
2469  debugOut << "corrected momLoss: " << momLoss << " GeV; relative: " << momLoss/fabs(charge/state7[6])
2470  << "; corrected coveredDistance = " << coveredDistance << "\n";
2471  }
2472  }
2473 
2474  // correct state7 with dx/dqop, dy/dqop ... Greatly improves extrapolation accuracy!
2475  double qop( charge/(fabs(charge/state7[6])-momLoss) );
2476  dqop = qop - state7[6];
2477  state7[6] = qop;
2478 
2479  for (unsigned int i=0; i<6; ++i) {
2480  state7[i] += 0.5 * dqop * J_MMT_[6*7 + i];
2481  }
2482  // normalize direction, just to make sure
2483  double norm( 1. / sqrt(state7[3]*state7[3] + state7[4]*state7[4] + state7[5]*state7[5]) );
2484  for (unsigned int i=3; i<6; ++i)
2485  state7[i] *= norm;
2486 
2487  }
2488  } // finished MatFX
2489 
2490 
2491  // fill ExtrapSteps_
2492  if (fillExtrapSteps) {
2493  static const ExtrapStep defaultExtrapStep;
2494  ExtrapSteps_.push_back(defaultExtrapStep);
2495  std::vector<ExtrapStep>::iterator lastStep = ExtrapSteps_.end() - 1;
2496 
2497  // Store Jacobian of this step for final calculation.
2498  lastStep->jac7_ = J_MMT_;
2499 
2500  if( checkJacProj == true ){
2501  //project the noise onto the destPlane
2502  RKTools::Np_N_NpT(noiseProjection_, noiseArray_);
2503 
2504  if (debugLvl_ > 1) {
2505  debugOut << "7D noise projected onto plane: \n";
2506  RKTools::printDim(noiseArray_.begin(), 7, 7);
2507  }
2508  }
2509 
2510  // Store this step's noise for final calculation.
2511  lastStep->noise7_ = noiseArray_;
2512 
2513  if (debugLvl_ > 2) {
2514  debugOut<<"ExtrapSteps \n";
2515  for (std::vector<ExtrapStep>::iterator it = ExtrapSteps_.begin(); it != ExtrapSteps_.end(); ++it){
2516  debugOut << "7D Jacobian: "; RKTools::printDim((it->jac7_.begin()), 5,5);
2517  debugOut << "7D noise: "; RKTools::printDim((it->noise7_.begin()), 5,5);
2518  }
2519  debugOut<<"\n";
2520  }
2521  }
2522 
2523 
2524 
2525  // check if at boundary
2526  if (stopAtBoundary and isAtBoundary) {
2527  if (debugLvl_ > 0) {
2528  debugOut << "stopAtBoundary -> break; \n ";
2529  }
2530  break;
2531  }
2532 
2533  if (onlyOneStep) {
2534  if (debugLvl_ > 0) {
2535  debugOut << "onlyOneStep -> break; \n ";
2536  }
2537  break;
2538  }
2539 
2540  //break if we arrived at destPlane
2541  if(atPlane) {
2542  if (debugLvl_ > 0) {
2543  debugOut << "arrived at destPlane with a distance of " << destPlane.distance(state7[0], state7[1], state7[2]) << " cm left. ";
2544  if (destPlane.isInActive(state7[0], state7[1], state7[2], state7[3], state7[4], state7[5]))
2545  debugOut << "In active area of destPlane. \n";
2546  else
2547  debugOut << "NOT in active area of plane. \n";
2548 
2549  debugOut << " position: "; TVector3(state7[0], state7[1], state7[2]).Print();
2550  debugOut << " direction: "; TVector3(state7[3], state7[4], state7[5]).Print();
2551  }
2552  break;
2553  }
2554 
2555  }
2556 
2557  if (fillExtrapSteps) {
2558  // propagate cov and add noise
2559  calcForwardJacobianAndNoise(startState7, startPlane, state7, destPlane);
2560 
2561  if (cov != nullptr) {
2562  cov->Similarity(fJacobian_);
2563  *cov += fNoise_;
2564  }
2565 
2566  if (debugLvl_ > 0) {
2567  if (cov != nullptr) {
2568  debugOut << "final covariance matrix after Extrap: "; cov->Print();
2569  }
2570  }
2571  }
2572 
2573  return coveredDistance;
2574 }

◆ extrapolateBy()

double extrapolateBy ( StateOnPlane state,
double  step,
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
overridevirtualinherited

Extrapolates the state by step (cm) and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implements AbsTrackRep.

Definition at line 721 of file RKTrackRep.cc.

◆ extrapolateToCone()

double extrapolateToCone ( StateOnPlane state,
double  radius,
const TVector3 &  linePoint = TVector3(0., 0., 0.),
const TVector3 &  lineDirection = TVector3(0., 0., 1.),
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
overridevirtualinherited

Extrapolates the state to the cone surface, and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implements AbsTrackRep.

Definition at line 476 of file RKTrackRep.cc.

◆ extrapolateToCylinder()

double extrapolateToCylinder ( StateOnPlane state,
double  radius,
const TVector3 &  linePoint = TVector3(0., 0., 0.),
const TVector3 &  lineDirection = TVector3(0., 0., 1.),
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
overridevirtualinherited

Extrapolates the state to the cylinder surface, and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implements AbsTrackRep.

Definition at line 351 of file RKTrackRep.cc.

◆ extrapolateToLine() [1/4]

double extrapolateToLine ( StateOnPlane state,
const TVector3 &  linePoint,
const TVector3 &  lineDirection,
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
overridevirtualinherited

Extrapolates the state to the POCA to a line, and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implements AbsTrackRep.

Definition at line 135 of file RKTrackRep.cc.

◆ extrapolateToLine() [2/4]

virtual double extrapolateToLine
inherited

Extrapolates the state to the POCA to a line, and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

◆ extrapolateToLine() [3/4]

virtual double extrapolateToLine
inlineinherited

Resembles the interface of GFAbsTrackRep in old versions of genfit.

This interface to extrapolateToLine is intended to resemble the interface of GFAbsTrackRep in old versions of genfit and is implemented by default via the preceding function.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Definition at line 120 of file AbsTrackRep.h.

◆ extrapolateToLine() [4/4]

virtual double extrapolateToLine ( StateOnPlane state,
const TVector3 &  point1,
const TVector3 &  point2,
TVector3 &  poca,
TVector3 &  dirInPoca,
TVector3 &  poca_onwire,
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
inlinevirtualinherited

Resembles the interface of GFAbsTrackRep in old versions of genfit.

This interface to extrapolateToLine is intended to resemble the interface of GFAbsTrackRep in old versions of genfit and is implemented by default via the preceding function.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Definition at line 120 of file AbsTrackRep.h.

◆ extrapolateToPlane()

double extrapolateToPlane ( StateOnPlane state,
const SharedPlanePtr plane,
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
overridevirtualinherited

Extrapolates the state to plane, and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implements AbsTrackRep.

Definition at line 80 of file RKTrackRep.cc.

◆ extrapolateToPoint() [1/2]

virtual double extrapolateToPoint ( StateOnPlane state,
const TVector3 &  point,
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
inlineoverridevirtualinherited

Extrapolates the state to the POCA to a point, and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implements AbsTrackRep.

Definition at line 100 of file RKTrackRep.h.

103  {
104  return extrapToPoint(state, point, nullptr, stopAtBoundary, calcJacobianNoise);
105  }

◆ extrapolateToPoint() [2/2]

virtual double extrapolateToPoint ( StateOnPlane state,
const TVector3 &  point,
const TMatrixDSym &  G,
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
inlineoverridevirtualinherited

Extrapolates the state to the POCA to a point in the metric of G, and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implements AbsTrackRep.

Definition at line 107 of file RKTrackRep.h.

◆ extrapolateToSphere()

double extrapolateToSphere ( StateOnPlane state,
double  radius,
const TVector3 &  point = TVector3(0., 0., 0.),
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
overridevirtualinherited

Extrapolates the state to the sphere surface, and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implements AbsTrackRep.

Definition at line 610 of file RKTrackRep.cc.

◆ getCharge()

double getCharge ( const StateOnPlane state) const
overridevirtual

Get the (fitted) charge of a state.

This is not always equal the pdg charge (e.g. if the charge sign was flipped during the fit).

Reimplemented from RKTrackRep.

Definition at line 44 of file MplTrackRep.cc.

44  {
45 
46  if (dynamic_cast<const MeasurementOnPlane*>(&state) != nullptr) {
47  Exception exc("RKTrackRep::getCharge - cannot get charge from MeasurementOnPlane",__LINE__,__FILE__);
48  exc.setFatal();
49  throw exc;
50  }
51 
52  double pdgCharge( m_magCharge * (this->getPDGCharge() > 0 ? 1.0 : -1.0));
53 
54  // return pdgCharge with sign of q/p
55  if (state.getState()(0) * pdgCharge < 0)
56  return -pdgCharge;
57  else
58  return pdgCharge;
59 }

◆ RKPropagate()

double RKPropagate ( M1x7 state7,
M7x7 jacobian,
M1x3 SA,
double  S,
bool  varField = true,
bool  calcOnlyLastRowOfJ = false 
) const
overridevirtual

The actual Runge Kutta propagation.

propagate state7 with step S. Fills SA (Start directions derivatives dA/S). This is a single Runge-Kutta step. If jacobian is nullptr, only the state is propagated, otherwise also the 7x7 jacobian is calculated. If varField is false, the magnetic field will only be evaluated at the starting position. The return value is an estimation on how good the extrapolation is, and it is usually fine if it is > 1. It gives a suggestion how you must scale S so that the quality will be sufficient.

Reimplemented from RKTrackRep.

Definition at line 61 of file MplTrackRep.cc.

◆ RKutta()

bool RKutta ( const M1x4 SU,
const DetPlane plane,
double  charge,
double  mass,
M1x7 state7,
M7x7 jacobianT,
M1x7 J_MMT_unprojected_lastRow,
double &  coveredDistance,
double &  flightTime,
bool &  checkJacProj,
M7x7 noiseProjection,
StepLimits limits,
bool  onlyOneStep = false,
bool  calcOnlyLastRowOfJ = false 
) const
privateinherited

Propagates the particle through the magnetic field.

If the propagation is successful and the plane is reached, the function returns true. Propagated state and the jacobian of the extrapolation are written to state7 and jacobianT. The jacobian is only calculated if jacobianT != nullptr. In the main loop of the Runge Kutta algorithm, the estimateStep() is called and may reduce the estimated stepsize so that a maximum momentum loss will not be exceeded, and stop at material boundaries. If this is the case, RKutta() will only propagate the reduced distance and then return. This is to ensure that material effects, which are calculated after the propagation, are taken into account properly.

Definition at line 1799 of file RKTrackRep.cc.


The documentation for this class was generated from the following files:
Belle2::EvtPDLUtil::charge
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition: EvtPDLUtil.cc:46
genfit::Exception
Exception class for error handling in GENFIT (provides storage for diagnostic information)
Definition: Exception.h:48
genfit::StepLimits::setLimit
void setLimit(StepLimitType type, double value)
absolute of value will be taken! If limit is already lower, it will be set to value anyway.
Definition: StepLimits.h:89
genfit::RKTrackRep::RKSteps_
std::vector< RKStep > RKSteps_
state where the last extrapolation has ended
Definition: RKTrackRep.h:294
genfit::StepLimits::getLowestLimit
std::pair< StepLimitType, double > getLowestLimit(double margin=1.E-3) const
Get the lowest limit.
Definition: StepLimits.cc:44
genfit::AbsTrackRep::pdgCode_
int pdgCode_
Particle code.
Definition: AbsTrackRep.h:364
genfit::RKTrackRep::RKutta
bool RKutta(const M1x4 &SU, const DetPlane &plane, double charge, double mass, M1x7 &state7, M7x7 *jacobianT, M1x7 *J_MMT_unprojected_lastRow, double &coveredDistance, double &flightTime, bool &checkJacProj, M7x7 &noiseProjection, StepLimits &limits, bool onlyOneStep=false, bool calcOnlyLastRowOfJ=false) const
Propagates the particle through the magnetic field.
Definition: RKTrackRep.cc:1799
genfit::AbsTrackRep::getPDGCharge
double getPDGCharge() const
Get the charge of the particle of the pdg code.
Definition: AbsTrackRep.cc:93
genfit::RKTrackRep::noiseProjection_
M7x7 noiseProjection_
noise matrix of the last extrapolation
Definition: RKTrackRep.h:309
genfit::RKTrackRep::fJacobian_
TMatrixD fJacobian_
steps made in Extrap during last extrapolation
Definition: RKTrackRep.h:299
genfit::MeasurementOnPlane
Measured coordinates on a plane.
Definition: MeasurementOnPlane.h:46
genfit::RKTrackRep::RKStepsFXStart_
int RKStepsFXStart_
RungeKutta steps made in the last extrapolation.
Definition: RKTrackRep.h:295
genfit::debugOut
std::ostream debugOut
Default stream for debug output.