KalFitTrack Class Reference

Description of a track class (<- Helix.cc). More...

#include <KalFitTrack.h>

Inheritance diagram for KalFitTrack:

KalmanFit::Helix List of all members.

Public Member Functions

 KalFitTrack (const HepPoint3D &pivot, const CLHEP::HepVector &a, const CLHEP::HepSymMatrix &Ea, unsigned int m, double chiSq, unsigned int nhits)
 constructor
 ~KalFitTrack (void)
 destructor
double intersect_cylinder (double r) const
 Intersection with different geometry.
double intersect_yz_plane (const HepTransform3D &plane, double x) const
double intersect_zx_plane (const HepTransform3D &plane, double y) const
double intersect_xy_plane (double z) const
void msgasmdc (double path, int index)
 Calculate multiple scattering angle.
void ms (double path, const KalFitMaterial &m, int index)
void eloss (double path, const KalFitMaterial &m, int index)
 Calculate total energy lost in material.
double smoother_Mdc (KalFitHelixSeg &seg, CLHEP::Hep3Vector &meas, int &flg, int csmflag)
 Kalman smoother for Mdc.
double smoother_Mdc_csmalign (KalFitHelixSeg &seg, CLHEP::Hep3Vector &meas, int &flg, int csmflag)
double smoother_Mdc (KalFitHitMdc &HitMdc, CLHEP::Hep3Vector &meas, KalFitHelixSeg &seg, double &dchi2, int csmflag)
double update_hits (KalFitHitMdc &HitMdc, int inext, CLHEP::Hep3Vector &meas, int way, double &dchi2, double &dtrack, double &dtracknew, double &dtdc, int csmflag)
 Include the Mdc wire hits.
double update_hits (KalFitHelixSeg &HelixSeg, int inext, CLHEP::Hep3Vector &meas, int way, double &dchi2, int csmflag)
double update_hits_csmalign (KalFitHelixSeg &HelixSeg, int inext, CLHEP::Hep3Vector &meas, int way, double &dchi2, int csmflag)
double chi2_next (Helix &H, KalFitHitMdc &HitMdc, int csmflag)
double chi2_next (Helix &H, KalFitHitMdc &HitMdc)
void update_last (void)
 Record the current parameters as ..._last information :.
void update_forMdc (void)
void point_last (const HepPoint3D &point)
 set and give out the last point of the track
const HepPoint3Dpoint_last (void)
const HepPoint3Dpivot_last (void) const
 returns helix parameters
const CLHEP::HepVector & a_last (void) const
const CLHEP::HepSymMatrix & Ea_last (void) const
const HepPoint3Dpivot_forMdc (void) const
const CLHEP::HepVector & a_forMdc (void) const
const CLHEP::HepSymMatrix & Ea_forMdc (void) const
void path_add (double path)
 Update the path length estimation.
void addPathSM (double path)
double getPathSM (void)
void addTofSM (double time)
double getTofSM (void)
void fiTerm (double fi)
double getFiTerm (void)
void tof (double path)
 Update the tof estimation.
double filter (double v_m, const CLHEP::HepVector &m_H, double v_d, double m_V)
double cor_tanldep (double *p, double er)
 Correct the error according the current tanl value :.
void update_bit (int i)
int insist (void) const
 Extractor :.
int type (void) const
int trasan_id (void) const
double r0 (void) const
double mass (void) const
double chiSq (void) const
double chiSq_back (void) const
int ndf_back (void) const
double pathip (void) const
double path_rd (void) const
double path_ab (void) const
double * pathl (void)
CLHEP::Hep3Vector * mom (void)
double tof (void) const
double tof_kaon (void) const
double tof_proton (void) const
double p_kaon (void) const
double p_proton (void) const
double dchi2_max (void) const
double r_max (void) const
unsigned int nchits (void) const
unsigned int nster (void) const
unsigned int ncath (void) const
int pat1 (void) const
int pat2 (void) const
int nhit_r (void) const
int nhit_z (void) const
void type (int t)
 Reinitialize (modificator).
void trasan_id (int t)
void insist (int t)
void pathip (double pl)
void p_kaon (double pl)
void p_proton (double pl)
void chiSq (double c)
void chiSq_back (double c)
void ndf_back (int n)
void nchits (int n)
void nster (int n)
void add_nhit_r (void)
void add_nhit_z (void)
double PathL (int layer)
 Function to calculate the path length in the layer.
void appendHitsMdc (KalFitHitMdc h)
 Functions for Mdc hits list.
void HitsMdc (vector< KalFitHitMdc > &lh)
vector< KalFitHitMdc > & HitsMdc (void)
KalFitHitMdcHitMdc (int i)
void appendHelixSegs (KalFitHelixSeg s)
void HelixSegs (vector< KalFitHelixSeg > &vs)
vector< KalFitHelixSeg > & HelixSegs (void)
KalFitHelixSegHelixSeg (int i)
void order_wirhit (int index)
void order_hits (void)
void number_wirhit (void)
const HepPoint3Dpivot_numf (const HepPoint3D &newPivot)
 Sets pivot position in a given mag field.
const HepPoint3Dpivot_numf (const HepPoint3D &newPivot, double &pathl)
double radius_numf (void) const
 Estimation of the radius in a given mag field.
double getSigma (int layerId, double driftDist) const
double getSigma (KalFitHitMdc &hitmdc, double tanlam, int lr, double dist) const
double getDriftDist (KalFitHitMdc &hitmdc, double drifttime, int lr) const
double getDriftTime (KalFitHitMdc &hitmdc, double toftime) const
double getT0 (void) const
HepSymMatrix getInitMatrix (void) const
double getDigi () const
void chgmass (int i)
int nLayerUsed ()
void resetLayerUsed ()
void useLayer (int iLay)
const HepPoint3Dcenter (void) const
 returns position of helix center(z = 0.);
const HepPoint3Dpivot (void) const
 returns pivot position.
const HepPoint3Dpivot (const HepPoint3D &newPivot)
 sets pivot position.
double radius (void) const
 returns radious of helix.
HepPoint3D x (double dPhi=0.) const
 returns position after rotating angle dPhi in phi direction.
double * x (double dPhi, double p[3]) const
HepPoint3D x (double dPhi, HepSymMatrix &Ex) const
 returns position and convariance matrix(Ex) after rotation.
Hep3Vector direction (double dPhi=0.) const
 returns direction vector after rotating angle dPhi in phi direction.
Hep3Vector momentum (double dPhi=0.) const
 returns momentum vector after rotating angle dPhi in phi direction.
Hep3Vector momentum (double dPhi, HepSymMatrix &Em) const
 returns momentum vector after rotating angle dPhi in phi direction.
HepLorentzVector momentum (double dPhi, double mass) const
 returns 4momentum vector after rotating angle dPhi in phi direction.
HepLorentzVector momentum (double dPhi, double mass, HepSymMatrix &Em) const
 returns 4momentum vector after rotating angle dPhi in phi direction.
HepLorentzVector momentum (double dPhi, double mass, HepPoint3D &x, HepSymMatrix &Emx) const
 returns 4momentum vector after rotating angle dPhi in phi direction.
double dr (void) const
 returns an element of parameters.
double phi0 (void) const
double kappa (void) const
double dz (void) const
double tanl (void) const
double curv (void) const
double sinPhi0 (void) const
double cosPhi0 (void) const
const HepVector & a (void) const
 returns helix parameters.
const HepVector & a (const HepVector &newA)
 sets helix parameters.
const HepSymMatrix & Ea (void) const
 returns error matrix.
const HepSymMatrix & Ea (const HepSymMatrix &newdA)
 sets helix paramters and error matrix.
double approach (KalFitHitMdc &hit, bool doSagCorrection) const
double approach (HepPoint3D pfwd, HepPoint3D pbwd, bool doSagCorrection) const
void set (const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
 sets helix pivot position, parameters, and error matrix.
void ignoreErrorMatrix (void)
 unsets error matrix. Error calculations will be ignored after this function call until an error matrix be set again. 0 matrix will be return as a return value for error matrix when you call functions which returns an error matrix.
double bFieldZ (double)
 sets/returns z componet of the magnetic field.
double bFieldZ (void) const
double alpha (void) const
HepMatrix delApDelA (const HepVector &ap) const
HepMatrix delXDelA (double phi) const
HepMatrix delMDelA (double phi) const
HepMatrix del4MDelA (double phi, double mass) const
HepMatrix del4MXDelA (double phi, double mass) const

Static Public Member Functions

static void setT0 (double t0)
static void setInitMatrix (HepSymMatrix m)
static void setMdcCalibFunSvc (const MdcCalibFunSvc *calibsvc)
static void setMagneticFieldSvc (IMagneticFieldSvc *)
static void setIMdcGeomSvc (IMdcGeomSvc *igeomsvc)
static void setMdcDigiCol (MdcDigiCol *digicol)
static int nmass (void)
static double mass (int i)
static void LR (int x)
static int lead (void)
 Magnetic field map.
static void lead (int i)
static int back (void)
static void back (int i)
static int resol (void)
static void resol (int i)
static int numf (void)
static void numf (int i)

Static Public Attributes

static double mdcGasRadlen_ = 0.
static int tprop_ = 1
 for signal propagation correction
static int debug_ = 0
 for debug
static double chi2_hitf_ = 1000
 Cut chi2 for each hit.
static double chi2_hits_ = 1000
static int numf_ = 0
 Flag for treatment of non-uniform mag field.
static int inner_steps_ = 3
static int outer_steps_ = 3
static double dchi2cutf_anal [43] = {0.}
static double dchi2cuts_anal [43] = {0.}
static double dchi2cutf_calib [43] = {0.}
static double dchi2cuts_calib [43] = {0.}
static int numfcor_ = 1
 NUMF treatment improved.
static double Bznom_ = 10
static int steplev_ = 0
static int Tof_correc_ = 1
 Flag for TOF correction.
static int strag_ = 1
 Flag to take account of energy loss straggling :.
static double factor_strag_ = 0.4
 factor of energy loss straggling for electron
static int nmdc_hit2_ = 500
 Cut chi2 for each hit.
static double chi2mdc_hit2_
static int tofall_ = 1
static int resolflag_ = 0
 wire resoltion flag
static int LR_ = 1
 Use L/R decision from MdcRecHit information :.
static int drifttime_choice_ = 0
 the drifttime choice
static const double ConstantAlpha = 333.564095
 Constant alpha for uniform field.

Private Types

 NMASS = 5
enum  { NMASS = 5 }

Private Attributes

int type_
double mass_
int trasan_id_
int l_mass_
int insist_
double chiSq_
unsigned int nchits_
unsigned int nster_
unsigned int ncath_
unsigned int ndf_back_
double chiSq_back_
double pathip_
double path_rd_
double path_ab_
double tof_
double dchi2_max_
double r_max_
double tof_kaon_
double tof_proton_
double p_kaon_
double p_proton_
double r0_
double PathL_ [43]
double pathSM_
double fiTerm_
double tof2_
CLHEP::Hep3Vector mom_ [43]
int pat1_
int pat2_
int layer_prec_
int nhit_r_
int nhit_z_
HepPoint3D pivot_last_
CLHEP::HepVector a_last_
CLHEP::HepSymMatrix Ea_last_
HepPoint3D point_last_
HepPoint3D pivot_forMdc_
CLHEP::HepVector a_forMdc_
CLHEP::HepSymMatrix Ea_forMdc_
vector< KalFitHitMdcHitsMdc_
vector< KalFitHelixSegHelixSegs_
int myLayerUsed [43]

Static Private Attributes

static const double MASS [NMASS]
static int lead_ = 2
 Flags.
static int back_ = 1
static const MdcCalibFunSvcCalibFunSvc_ = 0
static const IMagneticFieldSvcMFSvc_ = 0
static IMdcGeomSvciGeomSvc_ = 0
static double EventT0_ = 0.
static HepSymMatrix initMatrix_
static MdcDigiColmdcDigiCol_ = 0

Detailed Description

Description of a track class (<- Helix.cc).

Definition at line 34 of file KalFitTrack.h.


Member Enumeration Documentation

anonymous enum [private]

Enumerator:
NMASS 

Definition at line 73 of file KalFitTrack.h.

00073 { NMASS = 5 };


Constructor & Destructor Documentation

KalFitTrack::KalFitTrack ( const HepPoint3D pivot,
const CLHEP::HepVector &  a,
const CLHEP::HepSymMatrix &  Ea,
unsigned int  m,
double  chiSq,
unsigned int  nhits 
)

constructor

KalFitTrack::~KalFitTrack ( void   ) 

destructor

Definition at line 103 of file KalFitTrack.cxx.

00104 {
00105         // delete all objects
00106 
00107 }


Member Function Documentation

const HepVector & Helix::a ( const HepVector &  newA  )  [inline, inherited]

sets helix parameters.

Definition at line 266 of file Helix.h.

References Helix::m_a, and Helix::updateCache().

00266                             {
00267     m_a = i;
00268     updateCache();
00269     return m_a;
00270 }

const HepVector & Helix::a ( void   )  const [inline, inherited]

returns helix parameters.

Definition at line 254 of file Helix.h.

References Helix::m_a.

Referenced by KalmanFit::Helix::approach(), KalFitAlg::complete_track(), eloss(), KalFitAlg::fillTds(), KalFitAlg::fillTds_back(), KalFitAlg::fillTds_ip(), KalFitAlg::fillTds_lead(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), pivot_numf(), radius_numf(), KalFitAlg::smoother_anal(), KalFitAlg::smoother_calib(), KalFitAlg::start_seed(), update_forMdc(), and update_last().

00254                    {
00255     return m_a;
00256 }

const CLHEP::HepVector& KalFitTrack::a_forMdc ( void   )  const [inline]

Definition at line 151 of file KalFitTrack.h.

References a_forMdc_.

00151 { return a_forMdc_;    }

const CLHEP::HepVector& KalFitTrack::a_last ( void   )  const [inline]

Definition at line 147 of file KalFitTrack.h.

References a_last_.

00147 { return a_last_;      }

void KalFitTrack::add_nhit_r ( void   )  [inline]

Definition at line 220 of file KalFitTrack.h.

References nhit_r_.

00220 { nhit_r_++;}

void KalFitTrack::add_nhit_z ( void   )  [inline]

Definition at line 221 of file KalFitTrack.h.

References nhit_z_.

00221 { nhit_z_++;}

void KalFitTrack::addPathSM ( double  path  ) 

Definition at line 1296 of file KalFitTrack.cxx.

References pathSM_.

Referenced by KalFitAlg::smoother_anal().

01296                                       {
01297         pathSM_ += path;
01298 }

void KalFitTrack::addTofSM ( double  time  ) 

Definition at line 1301 of file KalFitTrack.cxx.

References tof2_.

Referenced by KalFitAlg::smoother_anal().

01301                                      {
01302         tof2_ += time;
01303 } 

double Helix::alpha ( void   )  const [inline, inherited]

Definition at line 292 of file Helix.h.

References Helix::m_alpha.

00292                        {
00293 
00294   return m_alpha;
00295 }

void KalFitTrack::appendHelixSegs ( KalFitHelixSeg  s  ) 

void KalFitTrack::appendHitsMdc ( KalFitHitMdc  h  ) 

Functions for Mdc hits list.

Definition at line 1837 of file KalFitTrack.cxx.

References HitsMdc_.

Referenced by KalFitAlg::kalman_fitting_anal(), KalFitAlg::kalman_fitting_calib(), KalFitAlg::kalman_fitting_csmalign(), and KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew().

01837 { HitsMdc_.push_back(h);}

double Helix::approach ( HepPoint3D  pfwd,
HepPoint3D  pbwd,
bool  doSagCorrection 
) const [inherited]

Definition at line 208 of file KalFitDoca.cxx.

References KalmanFit::Helix::a(), KalmanFit::Helix::center(), KalmanFit::Helix::ConstantAlpha, cos(), KalmanFit::Helix::Ea(), first, KalmanFit::Helix::kappa(), KalmanFit::Helix::phi0(), KalmanFit::Helix::pivot(), sin(), KalmanFit::Helix::tanl(), v, and KalmanFit::Helix::x().

00209 {
00210 // ...Cal. dPhi to rotate...
00211 // const TMDCWire & w = * link.wire();
00212     HepPoint3D positionOnWire, positionOnTrack;
00213     HepPoint3D pv = pivot();
00214     HepVector Va = a();
00215     HepSymMatrix Ma = Ea(); 
00216 
00217     Helix _helix(pv, Va ,Ma);
00218     Hep3Vector Wire;
00219     Wire[0] = (pfwd - pbwd).x();
00220     Wire[1] = (pfwd - pbwd).y();
00221     Wire[2] = (pfwd - pbwd).z(); 
00222 // xyPosition(), returns middle position of a wire. z componet is 0.
00223 // w.xyPosition(wp);
00224     double wp[3]; 
00225     wp[0] = 0.5*(pfwd + pbwd).x();   
00226     wp[1] = 0.5*(pfwd + pbwd).y();
00227     wp[2] = 0.;
00228     double wb[3]; 
00229 // w.backwardPosition(wb);
00230     wb[0] = pbwd.x();
00231     wb[1] = pbwd.y();
00232     wb[2] = pbwd.z();
00233     double v[3];
00234     v[0] = Wire.unit().x();
00235     v[1] = Wire.unit().y();
00236     v[2] = Wire.unit().z();
00237 // std::cout<<"Wire.unit() is "<<Wire.unit()<<std::endl; 
00238 
00239 // ...Sag correction...
00240     /* if (doSagCorrection) {
00241         HepVector3D dir = w.direction();
00242         HepPoint3D xw(wp[0], wp[1], wp[2]);
00243         HepPoint3D wireBackwardPosition(wb[0], wb[1], wb[2]);
00244         w.wirePosition(link.positionOnTrack().z(),
00245                        xw,
00246                        wireBackwardPosition,
00247                        dir);
00248         v[0] = dir.x();
00249         v[1] = dir.y();
00250         v[2] = dir.z();
00251         wp[0] = xw.x();
00252         wp[1] = xw.y();
00253         wp[2] = xw.z();
00254         wb[0] = wireBackwardPosition.x();
00255         wb[1] = wireBackwardPosition.y();
00256         wb[2] = wireBackwardPosition.z();
00257      }
00258     */
00259     // ...Cal. dPhi to rotate...
00260     const HepPoint3D & xc = _helix.center();
00261     double xt[3];
00262      _helix.x(0., xt);
00263     double x0 = - xc.x();
00264     double y0 = - xc.y();
00265     double x1 = wp[0] + x0;
00266     double y1 = wp[1] + y0;
00267     x0 += xt[0];
00268     y0 += xt[1];
00269     //std::cout<<" x0 is: "<<x0<<" y0 is: "<<y0<<std::endl;
00270     //std::cout<<" x1 is: "<<x1<<" y1 is: "<<y1<<std::endl;
00271     //std::cout<<" xt[0] is: "<<xt[0]<<" xt[1] is: "<<xt[1]<<std::endl;
00272 
00273     double dPhi = atan2(x0 * y1 - y0 * x1, x0 * x1 + y0 * y1);
00274     //std::cout<<" x0 * y1 - y0 * x1 is: "<<(x0 * y1 - y0 * x1)<<std::endl;
00275     //std::cout<<" x0 * x1 + y0 * y1 is: "<<(x0 * x1 + y0 * y1)<<std::endl;
00276     //std::cout<<" before loop dPhi is "<<dPhi<<std::endl;
00277     //...Setup...
00278     double kappa = _helix.kappa();
00279     double phi0 = _helix.phi0();
00280 
00281     //...Axial case...
00282   /*  if (!w.stereo()) {
00283         positionOnTrack = _helix.x(dPhi);
00284         HepPoint3D x(wp[0], wp[1], wp[2]);
00285         x.setZ(positionOnTrack.z());
00286          positionOnWire = x;
00287      //link.dPhi(dPhi);
00288      std::cout<<" in axial wire : positionOnTrack is "<<positionOnTrack
00289               <<" positionOnWire is "<<positionOnWire<<std::endl;
00290          return (positionOnTrack - positionOnWire).mag();
00291     }
00292    */
00293     double firstdfdphi = 0.;
00294     static bool first = true;
00295     if (first) {
00296 //      extern BelleTupleManager * BASF_Histogram;
00297 //      BelleTupleManager * m = BASF_Histogram;
00298 //      h_nTrial = m->histogram("TTrack::approach nTrial", 100, 0., 100.);
00299     }
00300 //#endif
00301 
00302     //...Stereo case...
00303     double rho = Helix::ConstantAlpha / kappa;
00304     double tanLambda = _helix.tanl();
00305     static HepPoint3D x;
00306     double t_x[3];
00307     double t_dXdPhi[3];
00308     const double convergence = 1.0e-5;
00309     double l;
00310     unsigned nTrial = 0;
00311     while (nTrial < 100) {
00312 
00313 // x = link.positionOnTrack(_helix->x(dPhi));
00314         positionOnTrack = _helix.x(dPhi);
00315         x = _helix.x(dPhi);
00316         t_x[0] = x[0];
00317         t_x[1] = x[1];
00318         t_x[2] = x[2];
00319 
00320         l = v[0] * t_x[0] + v[1] * t_x[1] + v[2] * t_x[2]
00321             - v[0] * wb[0] - v[1] * wb[1] - v[2] * wb[2];
00322 
00323         double rcosPhi = rho * cos(phi0 + dPhi);
00324         double rsinPhi = rho * sin(phi0 + dPhi);
00325         t_dXdPhi[0] =   rsinPhi;
00326         t_dXdPhi[1] = - rcosPhi;
00327         t_dXdPhi[2] = - rho * tanLambda;
00328 
00329         //...f = d(Distance) / d phi...
00330         double t_d2Xd2Phi[2];
00331         t_d2Xd2Phi[0] = rcosPhi;
00332         t_d2Xd2Phi[1] = rsinPhi;
00333 
00334         //...iw new...
00335         double n[3];
00336         n[0] = t_x[0] - wb[0];
00337         n[1] = t_x[1] - wb[1];
00338         n[2] = t_x[2] - wb[2];
00339         
00340         double a[3];
00341         a[0] = n[0] - l * v[0];
00342         a[1] = n[1] - l * v[1];
00343         a[2] = n[2] - l * v[2];
00344         double dfdphi = a[0] * t_dXdPhi[0]
00345             + a[1] * t_dXdPhi[1]
00346             + a[2] * t_dXdPhi[2];
00347 
00348         if (nTrial == 0) {
00349 //          break;
00350             firstdfdphi = dfdphi;
00351         }
00352 
00353         //...Check bad case...
00354         if (nTrial > 3) {
00355 //          std::cout<<" BAD CASE!!, calculate approach ntrial = "<<nTrial<< endl;
00356         }
00357         //...Is it converged?...
00358         if (fabs(dfdphi) < convergence)
00359             break;
00360 
00361         double dv = v[0] * t_dXdPhi[0]
00362             + v[1] * t_dXdPhi[1]
00363             + v[2] * t_dXdPhi[2];
00364         double t0 = t_dXdPhi[0] * t_dXdPhi[0]
00365             + t_dXdPhi[1] * t_dXdPhi[1]
00366             + t_dXdPhi[2] * t_dXdPhi[2];
00367         double d2fd2phi = t0 - dv * dv
00368             + a[0] * t_d2Xd2Phi[0]
00369             + a[1] * t_d2Xd2Phi[1];
00370         //  + a[2] * t_d2Xd2Phi[2];
00371 
00372         dPhi -= dfdphi / d2fd2phi;
00373         ++nTrial;
00374     }
00375     //std::cout<<" dPhi is: "<<dPhi<<std::endl;
00376     //...Cal. positions...
00377     positionOnWire[0] = wb[0] + l * v[0];
00378     positionOnWire[1] = wb[1] + l * v[1];
00379     positionOnWire[2] = wb[2] + l * v[2];
00380 
00381     //std::cout<<"wb[0] is: "<<wb[0]<<" l is: "<<l<<" v[0] is: "<<v[0]<<std::endl;
00382     //std::cout<<"wb[1] is: "<<wb[1]<<" v[1] is: "<<v[1]<<std::endl;
00383     //std::cout<<"wb[2] is: "<<wb[2]<<" v[2] is: "<<v[2]<<std::endl;
00384 
00385     //std::cout<<" positionOnTrack is "<<positionOnTrack
00386     //         <<" positionOnWire is "<<positionOnWire<<std::endl;
00387 
00388     return (positionOnTrack - positionOnWire).mag();
00389     // link.dPhi(dPhi);
00390     // return nTrial;
00391 }

double Helix::approach ( KalFitHitMdc hit,
bool  doSagCorrection 
) const [inherited]

Definition at line 16 of file KalFitDoca.cxx.

References KalmanFit::Helix::a(), KalmanFit::Helix::center(), KalmanFit::Helix::ConstantAlpha, cos(), KalmanFit::Helix::Ea(), first, KalmanFit::Helix::kappa(), KalmanFit::Helix::phi0(), KalmanFit::Helix::pivot(), sin(), KalmanFit::Helix::tanl(), v, w, KalFitHitMdc::wire(), and KalmanFit::Helix::x().

00016                                                              {
00017     //...Cal. dPhi to rotate...
00018     //const TMDCWire & w = * link.wire();
00019     HepPoint3D positionOnWire, positionOnTrack;
00020     HepPoint3D pv = pivot();
00021     //std::cout<<"the track pivot in approach is "<<pv<<std::endl;
00022     HepVector Va = a();
00023     //std::cout<<"the track parameters is "<<Va<<std::endl;
00024     HepSymMatrix Ma = Ea(); 
00025     //std::cout<<"the error matrix is "<<Ma<<std::endl;
00026 
00027     Helix _helix(pv, Va ,Ma);
00028     //_helix.pivot(IP);
00029     const KalFitWire& w = hit.wire();
00030     Hep3Vector Wire = w.fwd() - w.bck(); 
00031     //xyPosition(), returns middle position of a wire. z componet is 0.
00032     //w.xyPosition(wp);
00033     double wp[3]; 
00034     wp[0] = 0.5*(w.fwd() + w.bck()).x();   
00035     wp[1] = 0.5*(w.fwd() + w.bck()).y();
00036     wp[2] = 0.;
00037     double wb[3]; 
00038     //w.backwardPosition(wb);
00039     wb[0] = w.bck().x();
00040     wb[1] = w.bck().y();
00041     wb[2] = w.bck().z();
00042     double v[3];
00043     v[0] = Wire.unit().x();
00044     v[1] = Wire.unit().y();
00045     v[2] = Wire.unit().z();
00046     //std::cout<<"Wire.unit() is "<<Wire.unit()<<std::endl; 
00047     
00048     //...Sag correction...
00049     /* if (doSagCorrection) {
00050         HepVector3D dir = w.direction();
00051         HepPoint3D xw(wp[0], wp[1], wp[2]);
00052         HepPoint3D wireBackwardPosition(wb[0], wb[1], wb[2]);
00053         w.wirePosition(link.positionOnTrack().z(),
00054                        xw,
00055                        wireBackwardPosition,
00056                        dir);
00057         v[0] = dir.x();
00058         v[1] = dir.y();
00059         v[2] = dir.z();
00060         wp[0] = xw.x();
00061         wp[1] = xw.y();
00062         wp[2] = xw.z();
00063         wb[0] = wireBackwardPosition.x();
00064         wb[1] = wireBackwardPosition.y();
00065         wb[2] = wireBackwardPosition.z();
00066      }
00067     */
00068     //...Cal. dPhi to rotate...
00069     const HepPoint3D & xc = _helix.center();
00070 
00071     //std::cout<<" helix center: "<<xc<<std::endl;
00072     
00073     double xt[3]; _helix.x(0., xt);
00074     double x0 = - xc.x();
00075     double y0 = - xc.y();
00076     double x1 = wp[0] + x0;
00077     double y1 = wp[1] + y0;
00078     x0 += xt[0];
00079     y0 += xt[1];
00080     double dPhi = atan2(x0 * y1 - y0 * x1, x0 * x1 + y0 * y1);
00081     
00082     //std::cout<<"dPhi is "<<dPhi<<std::endl;
00083 
00084     //...Setup...
00085     double kappa = _helix.kappa();
00086     double phi0 = _helix.phi0();
00087 
00088     //...Axial case...
00089   /*  if (!w.stereo()) {
00090         positionOnTrack = _helix.x(dPhi);
00091         HepPoint3D x(wp[0], wp[1], wp[2]);
00092         x.setZ(positionOnTrack.z());
00093          positionOnWire = x;
00094      //link.dPhi(dPhi);
00095      std::cout<<" in axial wire : positionOnTrack is "<<positionOnTrack
00096               <<" positionOnWire is "<<positionOnWire<<std::endl;
00097          return (positionOnTrack - positionOnWire).mag();
00098     }
00099    */
00100     double firstdfdphi = 0.;
00101     static bool first = true;
00102     if (first) {
00103 //      extern BelleTupleManager * BASF_Histogram;
00104 //      BelleTupleManager * m = BASF_Histogram;
00105 //      h_nTrial = m->histogram("TTrack::approach nTrial", 100, 0., 100.);
00106     }
00107 //#endif
00108 
00109     //...Stereo case...
00110     double rho = Helix::ConstantAlpha / kappa;
00111     double tanLambda = _helix.tanl();
00112     static HepPoint3D x;
00113     double t_x[3];
00114     double t_dXdPhi[3];
00115     const double convergence = 1.0e-5;
00116     double l;
00117     unsigned nTrial = 0;
00118     while (nTrial < 100) {
00119 
00120 //      x = link.positionOnTrack(_helix->x(dPhi));
00121         positionOnTrack = _helix.x(dPhi);
00122         x = _helix.x(dPhi);
00123         t_x[0] = x[0];
00124         t_x[1] = x[1];
00125         t_x[2] = x[2];
00126 
00127         l = v[0] * t_x[0] + v[1] * t_x[1] + v[2] * t_x[2]
00128             - v[0] * wb[0] - v[1] * wb[1] - v[2] * wb[2];
00129 
00130         double rcosPhi = rho * cos(phi0 + dPhi);
00131         double rsinPhi = rho * sin(phi0 + dPhi);
00132         t_dXdPhi[0] =   rsinPhi;
00133         t_dXdPhi[1] = - rcosPhi;
00134         t_dXdPhi[2] = - rho * tanLambda;
00135 
00136         //...f = d(Distance) / d phi...
00137         double t_d2Xd2Phi[2];
00138         t_d2Xd2Phi[0] = rcosPhi;
00139         t_d2Xd2Phi[1] = rsinPhi;
00140 
00141         //...iw new...
00142         double n[3];
00143         n[0] = t_x[0] - wb[0];
00144         n[1] = t_x[1] - wb[1];
00145         n[2] = t_x[2] - wb[2];
00146         
00147         double a[3];
00148         a[0] = n[0] - l * v[0];
00149         a[1] = n[1] - l * v[1];
00150         a[2] = n[2] - l * v[2];
00151         double dfdphi = a[0] * t_dXdPhi[0]
00152             + a[1] * t_dXdPhi[1]
00153             + a[2] * t_dXdPhi[2];
00154 
00155 //#ifdef TRKRECO_DEBUG
00156         if (nTrial == 0) {
00157 //          break;
00158             firstdfdphi = dfdphi;
00159         }
00160 
00161         //...Check bad case...
00162         if (nTrial > 3) {
00163             std::cout<<" bad case, calculate approach ntrial = "<<nTrial<< std::endl;
00164         }
00165 //#endif
00166 
00167         //...Is it converged?...
00168         if (fabs(dfdphi) < convergence)
00169             break;
00170 
00171         double dv = v[0] * t_dXdPhi[0]
00172             + v[1] * t_dXdPhi[1]
00173             + v[2] * t_dXdPhi[2];
00174         double t0 = t_dXdPhi[0] * t_dXdPhi[0]
00175             + t_dXdPhi[1] * t_dXdPhi[1]
00176             + t_dXdPhi[2] * t_dXdPhi[2];
00177         double d2fd2phi = t0 - dv * dv
00178             + a[0] * t_d2Xd2Phi[0]
00179             + a[1] * t_d2Xd2Phi[1];
00180 //          + a[2] * t_d2Xd2Phi[2];
00181 
00182         dPhi -= dfdphi / d2fd2phi;
00183 
00184 //      cout << "nTrial=" << nTrial << endl;
00185 //      cout << "iw f,df,dphi=" << dfdphi << "," << d2fd2phi << "," << dPhi << endl;
00186 
00187         ++nTrial;
00188     }
00189     //...Cal. positions...
00190     positionOnWire[0] = wb[0] + l * v[0];
00191     positionOnWire[1] = wb[1] + l * v[1];
00192     positionOnWire[2] = wb[2] + l * v[2];
00193    
00194     //std::cout<<" positionOnTrack is "<<positionOnTrack
00195     //         <<" positionOnWire is "<<positionOnWire<<std::endl;
00196     return (positionOnTrack - positionOnWire).mag();
00197 
00198     //link.dPhi(dPhi);
00199 
00200     // #ifdef TRKRECO_DEBUG
00201     // h_nTrial->accumulate((float) nTrial + .5);
00202     // #endif
00203     // return nTrial;
00204 }

void KalFitTrack::back ( int  i  )  [static]

Definition at line 1829 of file KalFitTrack.cxx.

References back_.

01829 { back_ = i;}

int KalFitTrack::back ( void   )  [static]

Definition at line 1830 of file KalFitTrack.cxx.

References back_.

Referenced by KalFitAlg::initialize().

01830 { return back_;}

double Helix::bFieldZ ( void   )  const [inline, inherited]

Definition at line 300 of file Helix.h.

References Helix::m_bField.

00300                          {
00301     return m_bField;
00302 }

double Helix::bFieldZ ( double   )  [inline, inherited]

sets/returns z componet of the magnetic field.

Definition at line 280 of file Helix.h.

References Helix::m_alpha, Helix::m_bField, and Helix::updateCache().

Referenced by KalFitAlg::kalman_fitting_anal(), KalFitAlg::kalman_fitting_calib(), KalFitAlg::kalman_fitting_csmalign(), and KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew().

00280                        {
00281     m_bField = a;
00282     m_alpha = 10000. / 2.99792458 / m_bField;
00283 
00284     //std::cout<<"m_alpha: "<<m_alpha<<std::endl;
00285     updateCache();
00286     return m_bField;
00287 }

const HepPoint3D & Helix::center ( void   )  const [inline, inherited]

returns position of helix center(z = 0.);

Definition at line 194 of file Helix.h.

References Helix::m_center.

Referenced by KalmanFit::Helix::approach(), eloss(), KalFitAlg::fillTds_back(), intersect_cylinder(), intersect_yz_plane(), and intersect_zx_plane().

00194                         {
00195     return m_center;
00196 }

void KalFitTrack::chgmass ( int  i  ) 

Definition at line 1822 of file KalFitTrack.cxx.

References l_mass_, MASS, and mass_.

01822                               {
01823         mass_=MASS[i];
01824         l_mass_=i;
01825 }

double KalFitTrack::chi2_next ( Helix H,
KalFitHitMdc HitMdc 
)

Definition at line 2805 of file KalFitTrack.cxx.

References KalFitWire::bck(), cos(), DBL_MAX, KalFitHitMdc::dist(), KalFitHitMdc::erdist(), KalFitWire::fwd(), KalFitWire::geoID(), getDriftDist(), getDriftTime(), RecMdcHit::getEntra(), getSigma(), H, HitMdc(), KalmanFit::Helix::ignoreErrorMatrix(), KalmanFit::Helix::kappa(), KalFitWire::layer(), KalFitLayer_Mdc::layerId(), KalFitHitMdc::LR(), LR_, M_PI, M_PI2, M_PI4, mass_, KalmanFit::Helix::momentum(), KalmanFit::Helix::phi0(), KalmanFit::Helix::pivot(), KalmanFit::Helix::radius(), KalFitHitMdc::rechitptr(), resolflag_, T, KalmanFit::Helix::tanl(), Tof_correc_, KalFitHitMdc::wire(), and KalmanFit::Helix::x().

02805                                                              {
02806 
02807         double lr = HitMdc.LR();
02808         const KalFitWire& Wire = HitMdc.wire();
02809         int wire_ID = Wire.geoID();
02810         int layerid = HitMdc.wire().layer().layerId();
02811         double entrangle = HitMdc.rechitptr()->getEntra();      
02812 
02813         HepPoint3D fwd(Wire.fwd());
02814         HepPoint3D bck(Wire.bck());
02815         Hep3Vector wire = (Hep3Vector)fwd -(Hep3Vector)bck;
02816         Helix work = H;
02817         work.ignoreErrorMatrix();
02818         work.pivot((fwd + bck) * .5);
02819         HepPoint3D x0kal = (work.x(0).z() - bck.z())/ wire.z() * wire + bck;
02820         H.pivot(x0kal);
02821 
02822         Hep3Vector meas = H.momentum(0).cross(wire).unit();
02823 
02824         if (wire_ID<0 || wire_ID>6796){  //bes
02825                 std::cout << "KalFitTrack : wire_ID problem : " << wire_ID 
02826                         << std::endl;
02827                 return DBL_MAX;
02828         } 
02829 
02830         double x[3] ={pivot().x(), pivot().y(), pivot().z()};
02831         double pmom[3] ={momentum().x(), momentum().y(), momentum().z()};
02832         double tofest(0);
02833         double phi = fmod(phi0() + M_PI4, M_PI2);
02834         double csf0 = cos(phi);
02835         double snf0 = (1. - csf0) * (1. + csf0);
02836         snf0 = sqrt((snf0 > 0.) ? snf0 : 0.);
02837         if(phi > M_PI) snf0 = - snf0;
02838 
02839         if (Tof_correc_) {
02840                 Hep3Vector ip(0, 0, 0);
02841                 Helix work = *(Helix*)this;
02842                 work.ignoreErrorMatrix();
02843                 work.pivot(ip);
02844                 double phi_ip = work.phi0();
02845                 if (fabs(phi - phi_ip) > M_PI) {
02846                         if (phi > phi_ip) phi -= 2 * M_PI;
02847                         else phi_ip -= 2 * M_PI;
02848                 }
02849                 double t = tanl();
02850                 double l = fabs(radius() * (phi - phi_ip) * sqrt(1 + t * t));
02851                 double pmag( sqrt( 1.0 + t*t ) / kappa());
02852                 double mass_over_p( mass_ / pmag );
02853                 double beta( 1.0 / sqrt( 1.0 + mass_over_p * mass_over_p ) );
02854                 tofest = l / ( 29.9792458 * beta );
02855                 //  if(csmflag==1 && HitMdc.wire().y()>0.)  tofest= -1. * tofest;
02856         }
02857 
02858         const HepSymMatrix& ea = H.Ea();
02859         const HepVector& v_a = H.a();
02860         double dchi2R(DBL_MAX), dchi2L(DBL_MAX);
02861 
02862         HepVector v_H(5, 0);
02863         v_H[0] =  -csf0 * meas.x() - snf0 * meas.y();
02864         v_H[3] =  -meas.z();
02865         HepMatrix v_HT = v_H.T();
02866 
02867         double estim = (v_HT * v_a)[0];
02868         HepVector ea_v_H = ea * v_H;
02869         HepMatrix ea_v_HT = (ea_v_H).T();
02870         HepVector v_H_T_ea_v_H = v_HT * ea_v_H;
02871 
02872         HepSymMatrix eaNewL(5), eaNewR(5);
02873         HepVector aNewL(5), aNewR(5);
02874 
02875         //double time = HitMdc.tdc();
02876         //if (Tof_correc_)
02877         // time = time - tofest;
02878         double drifttime = getDriftTime(HitMdc , tofest);
02879         double ddl = getDriftDist(HitMdc, drifttime , 0 );
02880         double ddr = getDriftDist(HitMdc, drifttime , 1 );
02881         double erddl = getSigma( HitMdc, H.a()[4], 0, ddl);
02882         double erddr = getSigma( HitMdc, H.a()[4], 1, ddr);
02883 
02884         double dmeas2[2] = { 0.1*ddl, 0.1*ddr };
02885         double er_dmeas2[2] = {0. , 0.};
02886         if(resolflag_ == 1) { 
02887                 er_dmeas2[0] = 0.1*erddl; 
02888                 er_dmeas2[1] = 0.1*erddr;
02889         } 
02890         else if(resolflag_ == 0) {
02891                 //  int layid = HitMdc.wire().layer().layerId();
02892                 //  double sigma = getSigma(layid, dd);
02893                 //  er_dmeas2[0] = er_dmeas2[1] = sigma;
02894         }
02895 
02896         if ((LR_==0 && lr != 1.0) || 
02897                         (LR_==1 && lr == -1.0)) {
02898 
02899                 double er_dmeasL, dmeasL;
02900                 if(Tof_correc_) {
02901                         dmeasL = (-1.0)*fabs(dmeas2[0]);
02902                         er_dmeasL = er_dmeas2[0];
02903                 } else {
02904                         dmeasL = (-1.0)*fabs(HitMdc.dist()[0]);
02905                         er_dmeasL = HitMdc.erdist()[0];
02906                 }
02907 
02908                 double AL = 1 / ((v_H_T_ea_v_H)[0] + er_dmeasL*er_dmeasL);
02909                 eaNewL.assign(ea - ea_v_H * AL * ea_v_HT);
02910                 double RkL = 1 - (v_H_T_ea_v_H)[0] * AL;
02911                 if(0. == RkL) RkL = 1.e-4;
02912 
02913                 HepVector diffL = ea_v_H * AL * (dmeasL - estim);
02914                 aNewL = v_a + diffL;
02915                 double sigL = dmeasL -(v_HT * aNewL)[0];
02916                 dchi2L = (sigL * sigL) /  (RkL * er_dmeasL*er_dmeasL);
02917         }
02918 
02919         if ((LR_==0 && lr != -1.0) ||
02920                         (LR_==1 && lr == 1.0)) {
02921 
02922                 double er_dmeasR, dmeasR;
02923                 if(Tof_correc_) {
02924                         dmeasR = dmeas2[1];
02925                         er_dmeasR = er_dmeas2[1];
02926                 } else {
02927                         dmeasR = fabs(HitMdc.dist()[1]);
02928                         er_dmeasR = HitMdc.erdist()[1];
02929                 }
02930 
02931                 double AR = 1 / ((v_H_T_ea_v_H)[0] + er_dmeasR*er_dmeasR);
02932                 eaNewR.assign(ea - ea_v_H * AR * ea_v_HT);
02933                 double RkR = 1 - (v_H_T_ea_v_H)[0] * AR;
02934                 if(0. == RkR) RkR = 1.e-4;
02935 
02936                 HepVector diffR = ea_v_H * AR * (dmeasR - estim);
02937                 aNewR = v_a + diffR;
02938                 double sigR = dmeasR -(v_HT * aNewR)[0];
02939                 dchi2R = (sigR*sigR) /  (RkR * er_dmeasR*er_dmeasR);
02940         } 
02941 
02942         if (dchi2R < dchi2L){
02943                 H.a(aNewR); H.Ea(eaNewR);
02944         } else {
02945                 H.a(aNewL); H.Ea(eaNewL);
02946         }
02947         return ((dchi2R < dchi2L) ? dchi2R : dchi2L);
02948 }

double KalFitTrack::chi2_next ( Helix H,
KalFitHitMdc HitMdc,
int  csmflag 
)

Definition at line 2950 of file KalFitTrack.cxx.

References KalFitWire::bck(), cos(), DBL_MAX, KalFitHitMdc::dist(), KalFitHitMdc::erdist(), KalFitWire::fwd(), KalFitWire::geoID(), getDriftDist(), getDriftTime(), RecMdcHit::getEntra(), getSigma(), H, HitMdc(), KalmanFit::Helix::ignoreErrorMatrix(), KalmanFit::Helix::kappa(), KalFitWire::layer(), KalFitLayer_Mdc::layerId(), KalFitHitMdc::LR(), LR_, M_PI, M_PI2, M_PI4, mass_, KalmanFit::Helix::momentum(), KalmanFit::Helix::phi0(), KalmanFit::Helix::pivot(), KalmanFit::Helix::radius(), KalFitHitMdc::rechitptr(), resolflag_, T, KalmanFit::Helix::tanl(), Tof_correc_, KalFitHitMdc::wire(), KalmanFit::Helix::x(), and KalFitWire::y().

02950                                                                          {
02951 
02952         double lr = HitMdc.LR();
02953         const KalFitWire& Wire = HitMdc.wire();
02954         int wire_ID = Wire.geoID();
02955         int layerid = HitMdc.wire().layer().layerId();
02956         double entrangle = HitMdc.rechitptr()->getEntra();      
02957 
02958         HepPoint3D fwd(Wire.fwd());
02959         HepPoint3D bck(Wire.bck());
02960         Hep3Vector wire = (Hep3Vector)fwd -(Hep3Vector)bck;
02961         Helix work = H;
02962         work.ignoreErrorMatrix();
02963         work.pivot((fwd + bck) * .5);
02964         HepPoint3D x0kal = (work.x(0).z() - bck.z())/ wire.z() * wire + bck;
02965         H.pivot(x0kal);
02966 
02967         Hep3Vector meas = H.momentum(0).cross(wire).unit();
02968 
02969         if (wire_ID<0 || wire_ID>6796){  //bes
02970                 std::cout << "KalFitTrack : wire_ID problem : " << wire_ID 
02971                         << std::endl;
02972                 return DBL_MAX;
02973         } 
02974 
02975         double x[3] ={pivot().x(), pivot().y(), pivot().z()};
02976         double pmom[3] ={momentum().x(), momentum().y(), momentum().z()};
02977         double tofest(0);
02978         double phi = fmod(phi0() + M_PI4, M_PI2);
02979         double csf0 = cos(phi);
02980         double snf0 = (1. - csf0) * (1. + csf0);
02981         snf0 = sqrt((snf0 > 0.) ? snf0 : 0.);
02982         if(phi > M_PI) snf0 = - snf0;
02983 
02984         if (Tof_correc_) {
02985                 Hep3Vector ip(0, 0, 0);
02986                 Helix work = *(Helix*)this;
02987                 work.ignoreErrorMatrix();
02988                 work.pivot(ip);
02989                 double phi_ip = work.phi0();
02990                 if (fabs(phi - phi_ip) > M_PI) {
02991                         if (phi > phi_ip) phi -= 2 * M_PI;
02992                         else phi_ip -= 2 * M_PI;
02993                 }
02994                 double t = tanl();
02995                 double l = fabs(radius() * (phi - phi_ip) * sqrt(1 + t * t));
02996                 double pmag( sqrt( 1.0 + t*t ) / kappa());
02997                 double mass_over_p( mass_ / pmag );
02998                 double beta( 1.0 / sqrt( 1.0 + mass_over_p * mass_over_p ) );
02999                 tofest = l / ( 29.9792458 * beta );
03000                 if(csmflag==1 && HitMdc.wire().y()>0.)  tofest= -1. * tofest;
03001         }
03002 
03003         const HepSymMatrix& ea = H.Ea();
03004         const HepVector& v_a = H.a();
03005         double dchi2R(DBL_MAX), dchi2L(DBL_MAX);
03006 
03007         HepVector v_H(5, 0);
03008         v_H[0] =  -csf0 * meas.x() - snf0 * meas.y();
03009         v_H[3] =  -meas.z();
03010         HepMatrix v_HT = v_H.T();
03011 
03012         double estim = (v_HT * v_a)[0];
03013         HepVector ea_v_H = ea * v_H;
03014         HepMatrix ea_v_HT = (ea_v_H).T();
03015         HepVector v_H_T_ea_v_H = v_HT * ea_v_H;
03016 
03017         HepSymMatrix eaNewL(5), eaNewR(5);
03018         HepVector aNewL(5), aNewR(5);
03019 
03020         //double time = HitMdc.tdc();
03021         //if (Tof_correc_)
03022         // time = time - tofest;
03023         double drifttime = getDriftTime(HitMdc , tofest);
03024         double ddl = getDriftDist(HitMdc, drifttime , 0 );
03025         double ddr = getDriftDist(HitMdc, drifttime , 1 );
03026         double erddl = getSigma( HitMdc, H.a()[4], 0, ddl);
03027         double erddr = getSigma( HitMdc, H.a()[4], 1, ddr);
03028 
03029         double dmeas2[2] = { 0.1*ddl, 0.1*ddr };
03030         double er_dmeas2[2] = {0. , 0.};
03031         if(resolflag_ == 1) { 
03032                 er_dmeas2[0] = 0.1*erddl; 
03033                 er_dmeas2[1] = 0.1*erddr;
03034         } 
03035         else if(resolflag_ == 0) {
03036                 //  int layid = HitMdc.wire().layer().layerId();
03037                 //  double sigma = getSigma(layid, dd);
03038                 //  er_dmeas2[0] = er_dmeas2[1] = sigma;
03039         }
03040 
03041         if ((LR_==0 && lr != 1.0) || 
03042                         (LR_==1 && lr == -1.0)) {
03043 
03044                 double er_dmeasL, dmeasL;
03045                 if(Tof_correc_) {
03046                         dmeasL = (-1.0)*fabs(dmeas2[0]);
03047                         er_dmeasL = er_dmeas2[0];
03048                 } else {
03049                         dmeasL = (-1.0)*fabs(HitMdc.dist()[0]);
03050                         er_dmeasL = HitMdc.erdist()[0];
03051                 }
03052 
03053                 double AL = 1 / ((v_H_T_ea_v_H)[0] + er_dmeasL*er_dmeasL);
03054                 eaNewL.assign(ea - ea_v_H * AL * ea_v_HT);
03055                 double RkL = 1 - (v_H_T_ea_v_H)[0] * AL;
03056                 if(0. == RkL) RkL = 1.e-4;
03057 
03058                 HepVector diffL = ea_v_H * AL * (dmeasL - estim);
03059                 aNewL = v_a + diffL;
03060                 double sigL = dmeasL -(v_HT * aNewL)[0];
03061                 dchi2L = (sigL * sigL) /  (RkL * er_dmeasL*er_dmeasL);
03062         }
03063 
03064         if ((LR_==0 && lr != -1.0) ||
03065                         (LR_==1 && lr == 1.0)) {
03066 
03067                 double er_dmeasR, dmeasR;
03068                 if(Tof_correc_) {
03069                         dmeasR = dmeas2[1];
03070                         er_dmeasR = er_dmeas2[1];
03071                 } else {
03072                         dmeasR = fabs(HitMdc.dist()[1]);
03073                         er_dmeasR = HitMdc.erdist()[1];
03074                 }
03075 
03076                 double AR = 1 / ((v_H_T_ea_v_H)[0] + er_dmeasR*er_dmeasR);
03077                 eaNewR.assign(ea - ea_v_H * AR * ea_v_HT);
03078                 double RkR = 1 - (v_H_T_ea_v_H)[0] * AR;
03079                 if(0. == RkR) RkR = 1.e-4;
03080 
03081                 HepVector diffR = ea_v_H * AR * (dmeasR - estim);
03082                 aNewR = v_a + diffR;
03083                 double sigR = dmeasR -(v_HT * aNewR)[0];
03084                 dchi2R = (sigR*sigR) /  (RkR * er_dmeasR*er_dmeasR);
03085         } 
03086 
03087         if (dchi2R < dchi2L){
03088                 H.a(aNewR); H.Ea(eaNewR);
03089         } else {
03090                 H.a(aNewL); H.Ea(eaNewL);
03091         }
03092         return ((dchi2R < dchi2L) ? dchi2R : dchi2L);
03093 }

void KalFitTrack::chiSq ( double  c  )  [inline]

Definition at line 214 of file KalFitTrack.h.

References chiSq_.

00214 { chiSq_ = c; }

double KalFitTrack::chiSq ( void   )  const [inline]

Definition at line 183 of file KalFitTrack.h.

References chiSq_.

Referenced by KalFitAlg::fillTds(), KalFitAlg::fillTds_ip(), KalFitAlg::fillTds_lead(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), and KalFitAlg::start_seed().

00183 { return chiSq_; }

void KalFitTrack::chiSq_back ( double  c  )  [inline]

Definition at line 215 of file KalFitTrack.h.

References chiSq_back_.

00215 { chiSq_back_ = c; }

double KalFitTrack::chiSq_back ( void   )  const [inline]

Definition at line 184 of file KalFitTrack.h.

References chiSq_back_.

Referenced by KalFitAlg::fillTds_back(), and KalFitAlg::start_seed().

00184 { return chiSq_back_; }

double KalFitTrack::cor_tanldep ( double *  p,
double  er 
)

Correct the error according the current tanl value :.

double Helix::cosPhi0 ( void   )  const [inline, inherited]

Definition at line 312 of file Helix.h.

References Helix::m_cp.

00312                          {
00313     return m_cp;
00314 }

double Helix::curv ( void   )  const [inline, inherited]

Definition at line 248 of file Helix.h.

References Helix::m_r.

00248                       {
00249     return m_r;
00250 }

double KalFitTrack::dchi2_max ( void   )  const [inline]

Definition at line 196 of file KalFitTrack.h.

References dchi2_max_.

00196 { return dchi2_max_; }

HepMatrix Helix::del4MDelA ( double  phi,
double  mass 
) const [inherited]

Definition at line 605 of file Helix.cxx.

References cos(), DBL_MAX, Helix::m_ac, Helix::phi0(), and sin().

00605                                               {
00606     //
00607     //   Calculate Jacobian (@4m/@a)
00608     //   Vector a  is helix parameters and phi is internal parameter.
00609     //   Vector 4m is 4 momentum.
00610     //
00611 
00612     HepMatrix d4MDA(4,5,0);
00613 
00614     double phi0 = m_ac[1];
00615     double cpa  = m_ac[2];
00616     double tnl  = m_ac[4];
00617 
00618     double cosf0phi = cos(phi0+phi);
00619     double sinf0phi = sin(phi0+phi);
00620 
00621     double rho;
00622     if(cpa != 0.)rho = 1./cpa;
00623     else rho = (DBL_MAX);
00624 
00625     double charge = 1.;
00626     if(cpa < 0.)charge = -1.;
00627 
00628     double E = sqrt(rho*rho*(1.+tnl*tnl)+mass*mass);
00629 
00630     d4MDA[0][1] = -fabs(rho)*cosf0phi;
00631     d4MDA[0][2] = charge*rho*rho*sinf0phi;
00632  
00633     d4MDA[1][1] = -fabs(rho)*sinf0phi;
00634     d4MDA[1][2] = -charge*rho*rho*cosf0phi;
00635 
00636     d4MDA[2][2] = -charge*rho*rho*tnl;
00637     d4MDA[2][4] = fabs(rho);
00638 
00639     if (cpa != 0.0 && E != 0.0) {
00640       d4MDA[3][2] = (-1.-tnl*tnl)/(cpa*cpa*cpa*E);
00641       d4MDA[3][4] = tnl/(cpa*cpa*E);
00642     } else {
00643       d4MDA[3][2] = (DBL_MAX);
00644       d4MDA[3][4] = (DBL_MAX);
00645     }
00646     return d4MDA;
00647 }

HepMatrix Helix::del4MXDelA ( double  phi,
double  mass 
) const [inherited]

Definition at line 651 of file Helix.cxx.

References cos(), DBL_MAX, Helix::dr(), Helix::dz(), Helix::m_ac, Helix::m_cp, Helix::m_r, Helix::m_sp, Helix::phi0(), and sin().

00651                                                {
00652     //
00653     //   Calculate Jacobian (@4mx/@a)
00654     //   Vector a  is helix parameters and phi is internal parameter.
00655     //   Vector 4xm is 4 momentum and position.
00656     //
00657 
00658     HepMatrix d4MXDA(7,5,0);
00659 
00660     const double & dr      = m_ac[0];
00661     const double & phi0    = m_ac[1];
00662     const double & cpa     = m_ac[2];
00663     const double & dz      = m_ac[3];
00664     const double & tnl     = m_ac[4];
00665 
00666     double cosf0phi = cos(phi0+phi);
00667     double sinf0phi = sin(phi0+phi);
00668 
00669     double rho;
00670     if(cpa != 0.)rho = 1./cpa;
00671     else rho = (DBL_MAX);
00672 
00673     double charge = 1.;
00674     if(cpa < 0.)charge = -1.;
00675 
00676     double E = sqrt(rho * rho * (1. + tnl * tnl) + mass * mass);
00677 
00678     d4MXDA[0][1] = - fabs(rho) * cosf0phi;
00679     d4MXDA[0][2] = charge * rho * rho * sinf0phi;
00680  
00681     d4MXDA[1][1] = - fabs(rho) * sinf0phi;
00682     d4MXDA[1][2] = - charge * rho * rho * cosf0phi;
00683 
00684     d4MXDA[2][2] = - charge * rho * rho * tnl;
00685     d4MXDA[2][4] = fabs(rho);
00686 
00687     if (cpa != 0.0 && E != 0.0) {
00688       d4MXDA[3][2] = (- 1. - tnl * tnl) / (cpa * cpa * cpa * E);
00689       d4MXDA[3][4] = tnl / (cpa * cpa * E);
00690     } else {
00691       d4MXDA[3][2] = (DBL_MAX);
00692       d4MXDA[3][4] = (DBL_MAX);
00693     }
00694     
00695     d4MXDA[4][0] = m_cp;
00696     d4MXDA[4][1] = - dr * m_sp + m_r * (- m_sp + sinf0phi);
00697     if (cpa != 0.0) {
00698       d4MXDA[4][2] = - (m_r / cpa) * (m_cp - cosf0phi);
00699     } else {
00700       d4MXDA[4][2] = (DBL_MAX);
00701     }
00702      
00703     d4MXDA[5][0] = m_sp;
00704     d4MXDA[5][1] = dr * m_cp + m_r * (m_cp - cosf0phi);
00705     if (cpa != 0.0) {
00706       d4MXDA[5][2] = - (m_r / cpa) * (m_sp - sinf0phi);
00707 
00708       d4MXDA[6][2] = (m_r / cpa) * tnl * phi;
00709     } else {
00710       d4MXDA[5][2] = (DBL_MAX);
00711 
00712       d4MXDA[6][2] = (DBL_MAX);
00713     }
00714 
00715     d4MXDA[6][3] = 1.;
00716     d4MXDA[6][4] = - m_r * phi;
00717 
00718     return d4MXDA;
00719 }

HepMatrix Helix::delApDelA ( const HepVector &  ap  )  const [inherited]

Definition at line 446 of file Helix.cxx.

References cos(), DBL_MAX, Helix::dr(), Helix::dz(), Helix::m_ac, M_PI, M_PI2, M_PI8, Helix::m_r, Helix::phi0(), and sin().

Referenced by pivot_numf().

00446                                            {
00447     //
00448     //   Calculate Jacobian (@ap/@a)
00449     //   Vector ap is new helix parameters and a is old helix parameters. 
00450     //
00451 
00452     HepMatrix dApDA(5,5,0);
00453 
00454     const double & dr    = m_ac[0];
00455     const double & phi0  = m_ac[1];
00456     const double & cpa   = m_ac[2];
00457     const double & dz    = m_ac[3];
00458     const double & tnl   = m_ac[4];
00459 
00460     double drp   = ap[0];
00461     double phi0p = ap[1];
00462     double cpap  = ap[2];
00463     double dzp   = ap[3];
00464     double tnlp  = ap[4];
00465 
00466     double rdr   = m_r + dr;
00467     double rdrpr;
00468     if ((m_r + drp) != 0.0) {
00469       rdrpr = 1. / (m_r + drp);
00470     } else {
00471       rdrpr = (DBL_MAX);
00472     }
00473     // double csfd  = cos(phi0)*cos(phi0p) + sin(phi0)*sin(phi0p); 
00474     // double snfd  = cos(phi0)*sin(phi0p) - sin(phi0)*cos(phi0p); 
00475     double csfd  = cos(phi0p - phi0);
00476     double snfd  = sin(phi0p - phi0);
00477     double phid  = fmod(phi0p - phi0 + M_PI8, M_PI2);
00478     if (phid > M_PI) phid = phid - M_PI2;
00479 
00480     dApDA[0][0]  =  csfd;
00481     dApDA[0][1]  =  rdr*snfd;
00482     if(cpa!=0.0) {
00483       dApDA[0][2]  =  (m_r/cpa)*( 1.0 - csfd );
00484     } else {
00485       dApDA[0][2]  = (DBL_MAX);
00486     }
00487 
00488     dApDA[1][0]  = - rdrpr*snfd;
00489     dApDA[1][1]  = rdr*rdrpr*csfd;
00490     if(cpa!=0.0) {
00491       dApDA[1][2]  = (m_r/cpa)*rdrpr*snfd;
00492     } else {
00493       dApDA[1][2]  = (DBL_MAX);
00494     }
00495     
00496     dApDA[2][2]  = 1.0;
00497 
00498     dApDA[3][0]  = m_r*rdrpr*tnl*snfd;
00499     dApDA[3][1]  = m_r*tnl*(1.0 - rdr*rdrpr*csfd);
00500     if(cpa!=0.0) {
00501       dApDA[3][2]  = (m_r/cpa)*tnl*(phid - m_r*rdrpr*snfd);
00502     } else {
00503       dApDA[3][2]  = (DBL_MAX);
00504     }
00505     dApDA[3][3]  = 1.0;
00506     dApDA[3][4]  = - m_r*phid;
00507 
00508     dApDA[4][4] = 1.0;
00509  
00510     return dApDA;
00511 }

HepMatrix Helix::delMDelA ( double  phi  )  const [inherited]

Definition at line 568 of file Helix.cxx.

References cos(), DBL_MAX, Helix::m_ac, Helix::phi0(), and sin().

00568                                 {
00569     //
00570     //   Calculate Jacobian (@m/@a)
00571     //   Vector a is helix parameters and phi is internal parameter.
00572     //   Vector m is momentum.
00573     //
00574 
00575     HepMatrix dMDA(3,5,0);
00576 
00577     const double & phi0 = m_ac[1];
00578     const double & cpa  = m_ac[2];
00579     const double & tnl  = m_ac[4];
00580 
00581     double cosf0phi = cos(phi0+phi);
00582     double sinf0phi = sin(phi0+phi);
00583 
00584     double rho;
00585     if(cpa != 0.)rho = 1./cpa;
00586     else rho = (DBL_MAX);
00587 
00588     double charge = 1.;
00589     if(cpa < 0.)charge = -1.;
00590 
00591     dMDA[0][1] = -fabs(rho)*cosf0phi;
00592     dMDA[0][2] = charge*rho*rho*sinf0phi;
00593  
00594     dMDA[1][1] = -fabs(rho)*sinf0phi;
00595     dMDA[1][2] = -charge*rho*rho*cosf0phi;
00596 
00597     dMDA[2][2] = -charge*rho*rho*tnl;
00598     dMDA[2][4] = fabs(rho);
00599 
00600     return dMDA;
00601 }

HepMatrix Helix::delXDelA ( double  phi  )  const [inherited]

Definition at line 514 of file Helix.cxx.

References cos(), DBL_MAX, Helix::dr(), Helix::dz(), Helix::m_ac, Helix::m_cp, Helix::m_r, Helix::m_sp, Helix::phi0(), and sin().

00514                                 {
00515     //
00516     //   Calculate Jacobian (@x/@a)
00517     //   Vector a is helix parameters and phi is internal parameter
00518     //   which specifys the point to be calculated for Ex(phi).
00519     //
00520 
00521     HepMatrix dXDA(3,5,0);
00522 
00523     const double & dr      = m_ac[0];
00524     const double & phi0    = m_ac[1];
00525     const double & cpa     = m_ac[2];
00526     const double & dz      = m_ac[3];
00527     const double & tnl     = m_ac[4];
00528 
00529     double cosf0phi = cos(phi0 + phi);
00530     double sinf0phi = sin(phi0 + phi);
00531 
00532     dXDA[0][0]     = m_cp;
00533     dXDA[0][1]     = - dr * m_sp + m_r * (- m_sp + sinf0phi); 
00534     if(cpa!=0.0) {
00535       dXDA[0][2]     = - (m_r / cpa) * (m_cp - cosf0phi);
00536     } else {
00537       dXDA[0][2] = (DBL_MAX);
00538     }
00539     // dXDA[0][3]     = 0.0;
00540     // dXDA[0][4]     = 0.0;
00541  
00542     dXDA[1][0]     = m_sp;
00543     dXDA[1][1]     = dr * m_cp + m_r * (m_cp - cosf0phi);
00544     if(cpa!=0.0) {
00545       dXDA[1][2]     = - (m_r / cpa) * (m_sp - sinf0phi);
00546     } else {
00547       dXDA[1][2] = (DBL_MAX);
00548     }
00549     // dXDA[1][3]     = 0.0;
00550     // dXDA[1][4]     = 0.0;
00551 
00552     // dXDA[2][0]     = 0.0;
00553     // dXDA[2][1]     = 0.0;
00554     if(cpa!=0.0) {
00555       dXDA[2][2]     = (m_r / cpa) * tnl * phi;
00556     } else {
00557       dXDA[2][2] = (DBL_MAX);
00558     }
00559     dXDA[2][3]     = 1.0;
00560     dXDA[2][4]     = - m_r * phi;
00561 
00562     return dXDA;
00563 }

Hep3Vector Helix::direction ( double  dPhi = 0.  )  const [inline, inherited]

returns direction vector after rotating angle dPhi in phi direction.

Definition at line 212 of file Helix.h.

References Helix::momentum().

00212                                  {
00213     return momentum(phi).unit();
00214 }

double Helix::dr ( void   )  const [inline, inherited]

returns an element of parameters.

Definition at line 218 of file Helix.h.

References Helix::m_ac.

Referenced by pivot_numf(), and radius_numf().

00218                     {
00219     return m_ac[0];
00220 }

double Helix::dz ( void   )  const [inline, inherited]

Definition at line 236 of file Helix.h.

References Helix::m_ac.

Referenced by intersect_xy_plane(), pivot_numf(), and radius_numf().

00236                     {
00237     return m_ac[3];
00238 }

const HepSymMatrix & Helix::Ea ( const HepSymMatrix &  newdA  )  [inline, inherited]

sets helix paramters and error matrix.

Definition at line 274 of file Helix.h.

References Helix::m_Ea.

00274                                 {
00275     return m_Ea = i;
00276 }

const HepSymMatrix & Helix::Ea ( void   )  const [inline, inherited]

returns error matrix.

Definition at line 260 of file Helix.h.

References Helix::m_Ea.

Referenced by KalmanFit::Helix::approach(), eloss(), KalFitAlg::fillTds(), KalFitAlg::fillTds_back(), KalFitAlg::fillTds_ip(), KalFitAlg::fillTds_lead(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), KalFitAlg::kalman_fitting_calib(), KalFitAlg::kalman_fitting_csmalign(), KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew(), ms(), msgasmdc(), pivot_numf(), KalFitAlg::smoother_anal(), KalFitAlg::smoother_calib(), KalFitAlg::start_seed(), update_forMdc(), and update_last().

00260                     {
00261     return m_Ea;
00262 }

const CLHEP::HepSymMatrix& KalFitTrack::Ea_forMdc ( void   )  const [inline]

Definition at line 152 of file KalFitTrack.h.

References Ea_forMdc_.

00152 { return Ea_forMdc_;   }

const CLHEP::HepSymMatrix& KalFitTrack::Ea_last ( void   )  const [inline]

Definition at line 148 of file KalFitTrack.h.

References Ea_last_.

00148 { return Ea_last_;     }

void KalFitTrack::eloss ( double  path,
const KalFitMaterial m,
int  index 
)

Calculate total energy lost in material.

Definition at line 276 of file KalFitTrack.cxx.

References EvtCyclic3::A, KalmanFit::Helix::a(), EvtCyclic3::B, KalmanFit::Helix::center(), KalFitMaterial::dE(), KalFitMaterial::del_E(), KalmanFit::Helix::Ea(), factor_strag_, l_mass_, MASS, mass_, p_kaon_, p_proton_, r0_, KalmanFit::Helix::radius(), strag_, and tofall_.

Referenced by KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), KalFitAlg::smoother_anal(), KalFitAlg::smoother_calib(), KalFitElement::updateTrack(), KalFitElement::updateTrack_alreadyfound(), and KalFitElement::updateTrack_rphi().

00278 {
00279 #ifdef YDEBUG
00280         cout<<"eloss():ea before: "<<Ea()<<endl;
00281 #endif
00282         HepVector v_a = a();
00283         double v_a_2_2 = v_a[2] * v_a[2];
00284         double v_a_4_2 = v_a[4] * v_a[4];
00285         double pmag = 1 / fabs(v_a[2]) * sqrt(1 + v_a_4_2);
00286         double psq = pmag * pmag;
00287         double E = sqrt(mass_ * mass_ + psq);
00288         double dE = material.dE(mass_, path, pmag);
00289         //std::cout<<" eloss(): dE: "<<dE<<std::endl;//wangll
00290 
00291         if (index > 0) 
00292                 psq += dE * (dE + 2 * sqrt(mass_ * mass_ + psq));
00293         else {
00294                 double dE_max = E - mass_;
00295                 if( dE<dE_max ) psq += dE * (dE - 2 * sqrt(mass_ * mass_ + psq));
00296                 else psq=-1.0;
00297         }
00298 
00299         if (tofall_ && index < 0){
00300                 // Kaon case :
00301                 if (p_kaon_ > 0){
00302                         double psq_kaon = p_kaon_ * p_kaon_;
00303                         double dE_kaon = material.dE(MASS[3], path, p_kaon_);
00304                         psq_kaon += dE_kaon * (dE_kaon - 
00305                                         2 * sqrt(MASS[3] * MASS[3] + psq_kaon));
00306                         if (psq_kaon < 0) psq_kaon = 0;
00307                         p_kaon_ = sqrt(psq_kaon);
00308                 }
00309                 // Proton case :
00310                 if (p_proton_ > 0){
00311                         double psq_proton = p_proton_ * p_proton_;
00312                         double dE_proton = material.dE(MASS[4], path, p_proton_);
00313                         psq_proton += dE_proton * (dE_proton - 
00314                                         2 * sqrt(MASS[4] * MASS[4] + psq_proton));
00315                         if (psq_proton < 0) psq_proton = 0;
00316                         p_proton_ = sqrt(psq_proton);
00317                 }
00318         }
00319 
00320         double dpt;
00321         //cout<<"eloss(): psq = "<<psq<<endl;//wangll
00322         if(psq < 0) dpt = 9999;
00323         else dpt = v_a[2] * pmag / sqrt(psq);
00324         //cout<<"eloss():k:   "<<v_a[2]<<"  k'  "<<dpt<<endl;//wangll
00325 #ifdef YDEBUG
00326         cout<<"eloss():k:   "<<v_a[2]<<"  k'  "<<dpt<<endl;
00327 #endif
00328         // attempt to take account of energy loss for error matrix 
00329 
00330         HepSymMatrix ea = Ea();
00331         double r_E_prim = (E + dE)/E;
00332 
00333         // 1/ Straggling in the energy loss :
00334         if (strag_){
00335                 double del_E(0);
00336                 if(l_mass_==0) {
00337                         del_E = dE*factor_strag_;
00338                 }   else  {
00339                         del_E  = material.del_E(mass_, path, pmag);
00340                 }
00341 
00342                 ea[2][2] += (v_a[2] * v_a[2]) * E * E * del_E * del_E / (psq*psq);
00343         }
00344 
00345         // Effect of the change of curvature (just variables change):
00346         double dpt2 = dpt*dpt;
00347         double A = dpt*dpt2/(v_a_2_2*v_a[2])*r_E_prim;
00348         double B = v_a[4]/(1+v_a_4_2)*
00349                 dpt*(1-dpt2/v_a_2_2*r_E_prim);
00350 
00351         double ea_2_0 = A*ea[2][0] + B*ea[4][0];
00352         double ea_2_1 = A*ea[2][1] + B*ea[4][1];
00353         double ea_2_2 = A*A*ea[2][2] + 2*A*B*ea[2][4] + B*B*ea[4][4]; 
00354         double ea_2_3 = A*ea[2][3] + B*ea[4][3]; 
00355         double ea_2_4 = A*ea[2][4] + B*ea[4][4];
00356 
00357         v_a[2] = dpt;
00358         a(v_a);
00359 
00360         ea[2][0] = ea_2_0;
00361         //std::cout<<"ea[2][0] is "<<ea[2][0]<<" ea(3,1) is "<<ea(3,1)<<std::endl;
00362         ea[2][1] = ea_2_1;
00363         //std::cout<<"ea[2][2] is "<<ea[2][2]<<" ea(3,3) is "<<ea(3,3)<<std::endl;
00364         ea[2][2] = ea_2_2;
00365         ea[2][3] = ea_2_3;
00366         ea[2][4] = ea_2_4;
00367 
00368         Ea(ea);
00369         //cout<<"eloss():dE:   "<<dE<<endl;
00370         //cout<<"eloss():A:   "<<A<<"   B:    "<<B<<endl;
00371         //cout<<"eloss():ea after: "<<Ea()<<endl;
00372         r0_ = fabs(center().perp() - fabs(radius()));
00373 }

double KalFitTrack::filter ( double  v_m,
const CLHEP::HepVector &  m_H,
double  v_d,
double  m_V 
)

void KalFitTrack::fiTerm ( double  fi  ) 

Definition at line 1306 of file KalFitTrack.cxx.

References fiTerm_.

Referenced by KalFitAlg::smoother_anal().

01306                                  {
01307         fiTerm_ = fi;
01308 }

double KalFitTrack::getDigi (  )  const

double KalFitTrack::getDriftDist ( KalFitHitMdc hitmdc,
double  drifttime,
int  lr 
) const

Definition at line 194 of file KalFitTrack2.cxx.

References CalibFunSvc_, debug_, MdcCalibFunSvc::driftTimeToDist(), RecMdcHit::getEntra(), RecMdcHit::getMdcId(), KalFitWire::layer(), KalFitLayer_Mdc::layerId(), KalFitHitMdc::rechitptr(), MdcID::wire(), and KalFitHitMdc::wire().

Referenced by chi2_next().

00195 {
00196         int layerid = hitmdc.wire().layer().layerId();
00197         int  cellid = MdcID::wire(hitmdc.rechitptr()->getMdcId());
00198         if(debug_ == 4 ){
00199                 std::cout<<"the cellid is .."<<cellid<<std::endl;
00200         } 
00201         double entrangle = hitmdc.rechitptr()->getEntra();
00202 
00203         //std::cout<<" entrangle: "<<entrangle<<std::endl;
00204 
00205         return CalibFunSvc_->driftTimeToDist(drifttime, layerid, cellid,  lr, entrangle);
00206 }

double KalFitTrack::getDriftTime ( KalFitHitMdc hitmdc,
double  toftime 
) const

Definition at line 74 of file KalFitTrack2.cxx.

References KalFitWire::bck(), CalibFunSvc_, debug_, drifttime_choice_, KalFitWire::fwd(), KalFitWire::geoID(), RecMdcHit::getDriftT(), getT0(), MdcCalibFunSvc::getT0(), RecMdcHit::getTdc(), MdcCalibFunSvc::getTimeWalk(), iter(), KalFitWire::layer(), KalFitLayer_Mdc::layerId(), RawDataUtil::MdcCharge(), mdcDigiCol_, RawDataUtil::MdcTime(), KalFitHitMdc::rechitptr(), KalFitHitMdc::tdc(), tprop_, KalFitHitMdc::wire(), and KalmanFit::Helix::x().

Referenced by chi2_next().

00075 {
00076         const double vinner = 220.0e8; // cm/s
00077         const double vouter = 240.0e8; // cm/s
00078 
00079         int layerid = hitmdc.wire().layer().layerId();
00080         double zhit = (hitmdc.rechitptr())->getZhit();
00081         const KalFitWire* wire = &(hitmdc.wire());
00082         HepPoint3D fPoint = wire->fwd();
00083         HepPoint3D bPoint = wire->bck();
00084 
00085         // unit is centimeter
00086         double wireLen = (fPoint-bPoint).x()*(fPoint-bPoint).x()+(fPoint-bPoint).y()*(fPoint-bPoint).y()+(fPoint-bPoint).z()*(fPoint-bPoint).z();
00087         wireLen = sqrt(wireLen);
00088         double wireZLen = fabs(fPoint.z() - bPoint.z());
00089         double tp = 0.;
00090         double vp = 0.;
00091         // west readout  
00092         if(0==layerid%2){
00093                 // inner chamber
00094                 if(layerid<8){
00095                         vp = vinner;
00096                 }
00097                 else {
00098                         vp = vouter;
00099                 } 
00100                 tp = wireLen*fabs(zhit - bPoint.z())/wireZLen/vp; 
00101         }
00102 
00103         // east readout  
00104         if(1==layerid%2){
00105                 // inner chamber
00106                 if(layerid<8){
00107                         vp = vinner;
00108                 }
00109                 else {
00110                         vp = vouter;
00111                 }
00112                 tp = wireLen*fabs(zhit - fPoint.z())/wireZLen/vp;
00113         }
00114 
00115         // s to ns
00116         tp = 1.0e9*tp;
00117 
00118         if(0==tprop_) tp = 0.;
00119 
00120         //std::cout<<"propogation time: "<<tp<<std::endl;
00121 
00122         int wireid = hitmdc.wire().geoID();
00123         double drifttime1(0.);
00124         double drifttime2(0.);
00125         double drifttime3(0.);
00126 
00127         MdcDigiCol::iterator iter = mdcDigiCol_->begin();       
00128         for(; iter != mdcDigiCol_->end(); iter++ ) {
00129                 if((*iter)->identify() == (hitmdc.rechitptr())->getMdcId()) break;
00130         }
00131         //double t0 = get_T0();
00132         // see the code of wulh in /Mdc/MdcCalibFunSvc/MdcCalibFunSvc/MdcCalibFunSvc.h,
00133         // double getT0(int wireid) const { return m_t0[wireid]; }
00134 
00135         //double getTimeWalk(int layid, double Q) const ;
00136         double Q = RawDataUtil::MdcCharge((*iter)->getChargeChannel()); 
00137         double timewalk = CalibFunSvc_->getTimeWalk(layerid, Q);
00138 
00139         if(debug_ == 4) { 
00140                 std::cout<<"CalibFunSvc_->getTimeWalk, timewalk ="<<timewalk<<std::endl;
00141         } 
00142 
00143         double timeoffset = CalibFunSvc_->getT0(wireid);
00144         if(debug_ == 4) {
00145                 std::cout<<"CalibFunSvc_->getT0, timeoffset ="<<timeoffset<<std::endl;
00146         } 
00147 
00148         double eventt0 = getT0(); 
00149 
00150         if(debug_ == 4) {
00151                 std::cout<<"the Event T0 we get in the function getDriftTime(...) is "<<eventt0<<std::endl;
00152         }
00153 
00154         // this tdc value come from MdcRecHit assigned by zhangyao
00155         double tdctime1 = hitmdc.tdc();
00156         double tdctime2(0.);
00157         double tdctime3(0.);
00158 
00159         if(debug_ == 4) {
00160                 std::cout<<"tdctime1 be here is .."<<tdctime1<<std::endl; 
00161         }
00162 
00163         // this tdc value come from MdcDigiCol time channel
00164         // attention, if we use the iter like this: for(MdcDigiCol::iterator iter = mdcDigiCol_->begin(); iter != mdcDigiCol_->end(); iter++) it cannot pass the gmake , throw an error !
00165         if(debug_ == 4) {
00166                 //  std::cout<<"the size of the mdcDigiCol_ is "<<mdcDigiCol_.size()<<std::endl;
00167         }
00168         // MdcDigiCol::iterator iter = mdcDigiCol_->begin();       
00169         // for(; iter != mdcDigiCol_->end(); iter++ ) {
00170         //       if((*iter)->identify() == (hitmdc.rechitptr())->getMdcId()) break;
00171         //  }
00172         if(debug_ == 4) { 
00173                 std::cout<<"the time channel be here is .."<<(*iter)->getTimeChannel()<<std::endl;
00174         }
00175         tdctime2 = RawDataUtil::MdcTime((*iter)->getTimeChannel());
00176         tdctime3 = hitmdc.rechitptr()->getTdc();
00177         drifttime1 = tdctime1 - eventt0 - toftime - timewalk -timeoffset - tp;
00178         drifttime2 = tdctime2 - eventt0 - toftime - timewalk -timeoffset - tp;
00179         drifttime3 = tdctime3 - eventt0 - toftime - timewalk -timeoffset - tp;
00180         if(debug_ == 4 ) {
00181                 std::cout<<"we now compare the three kind of tdc , the tdc get from timeChannel() is "<<tdctime2<<" the tdc get from KalFitHitMdc is "<<tdctime1<<" the tdc from MdcRecHit is "<<tdctime3<<" the drifttime1 is ..."<<drifttime1<<" the drifttime 2 is ..."<<drifttime2<<" the drifttime3 is ..."<<drifttime3<<std::endl;
00182         }
00183         //return drifttime3;
00184         //return drifttime1;
00185         if(drifttime_choice_ == 0)
00186                 return drifttime2;
00187         if(drifttime_choice_ == 1)
00188                 // use the driftT caluculated by track-finding
00189                 return hitmdc.rechitptr()->getDriftT(); 
00190 }

double KalFitTrack::getFiTerm ( void   )  [inline]

Definition at line 164 of file KalFitTrack.h.

References fiTerm_.

Referenced by KalFitAlg::fillTds_back().

00164 { return fiTerm_;}

HepSymMatrix KalFitTrack::getInitMatrix ( void   )  const

Definition at line 42 of file KalFitTrack2.cxx.

References initMatrix_.

Referenced by KalFitAlg::smoother_calib().

00043 {
00044         return initMatrix_ ;
00045 }

double KalFitTrack::getPathSM ( void   )  [inline]

Definition at line 158 of file KalFitTrack.h.

References pathSM_.

Referenced by KalFitAlg::fillTds_back().

00158 { return pathSM_;}

double KalFitTrack::getSigma ( KalFitHitMdc hitmdc,
double  tanlam,
int  lr,
double  dist 
) const

Definition at line 209 of file KalFitTrack2.cxx.

References CalibFunSvc_, RecMdcHit::getAdc(), RecMdcHit::getEntra(), MdcCalibFunSvc::getSigma(), RecMdcHit::getZhit(), KalFitWire::layer(), KalFitLayer_Mdc::layerId(), KalFitHitMdc::rechitptr(), subSeperate::temp, and KalFitHitMdc::wire().

00210 { 
00211         int layerid = hitmdc.wire().layer().layerId();
00212         double entrangle = hitmdc.rechitptr()->getEntra();
00213         //  double tanlam = hitmdc.rechitptr()->getTanl();
00214         double z = hitmdc.rechitptr()->getZhit();
00215         double Q = hitmdc.rechitptr()->getAdc();
00216         //std::cout<<" the driftdist  before getsigma is "<<dist<<" the layer is"<<layerid<<std::endl;
00217         //cout<<"layerid, lr, dist, entrangle, tanlam, z , Q = "<<layerid<<", "<<lr<<", "<<dist<<", "<<entrangle<<", "<<tanlam<<", "<<z<<", "<<Q<<endl;//wangll
00218         double temp = CalibFunSvc_->getSigma(layerid, lr, dist, entrangle, tanlam, z , Q );
00219         //std::cout<<" the sigma is "<<temp<<std::endl;
00220         return temp;
00221 }

double KalFitTrack::getSigma ( int  layerId,
double  driftDist 
) const

Definition at line 3096 of file KalFitTrack.cxx.

Referenced by chi2_next().

03096                                                                  {
03097         double sigma1,sigma2,f;
03098         driftDist *= 10;//mm
03099         if(layerId<8){
03100                 if(driftDist<0.5){
03101                         sigma1=0.112784;      sigma2=0.229274;      f=0.666;
03102                 }else if(driftDist<1.){
03103                         sigma1=0.103123;      sigma2=0.269797;      f=0.934;
03104                 }else if(driftDist<1.5){
03105                         sigma1=0.08276;        sigma2=0.17493;      f=0.89;
03106                 }else if(driftDist<2.){
03107                         sigma1=0.070109;      sigma2=0.149859;      f=0.89;
03108                 }else if(driftDist<2.5){
03109                         sigma1=0.064453;      sigma2=0.130149;      f=0.886;
03110                 }else if(driftDist<3.){
03111                         sigma1=0.062383;      sigma2=0.138806;      f=0.942;
03112                 }else if(driftDist<3.5){
03113                         sigma1=0.061873;      sigma2=0.145696;      f=0.946;
03114                 }else if(driftDist<4.){
03115                         sigma1=0.061236;      sigma2=0.119584;      f=0.891;
03116                 }else if(driftDist<4.5){
03117                         sigma1=0.066292;      sigma2=0.148426;      f=0.917;
03118                 }else if(driftDist<5.){
03119                         sigma1=0.078074;      sigma2=0.188148;      f=0.911;
03120                 }else if(driftDist<5.5){
03121                         sigma1=0.088657;      sigma2=0.27548;      f=0.838;
03122                 }else{
03123                         sigma1=0.093089;      sigma2=0.115556;      f=0.367;
03124                 }
03125         }else{
03126                 if(driftDist<0.5){
03127                         sigma1=0.112433;      sigma2=0.327548;      f=0.645;
03128                 }else if(driftDist<1.){
03129                         sigma1=0.096703;      sigma2=0.305206;      f=0.897;
03130                 }else if(driftDist<1.5){
03131                         sigma1=0.082518;      sigma2=0.248913;      f= 0.934;
03132                 }else if(driftDist<2.){
03133                         sigma1=0.072501;      sigma2=0.153868;      f= 0.899;
03134                 }else if(driftDist<2.5){
03135                         sigma1= 0.065535;     sigma2=0.14246;       f=0.914;
03136                 }else if(driftDist<3.){
03137                         sigma1=0.060497;      sigma2=0.126489;      f=0.918;
03138                 }else if(driftDist<3.5){
03139                         sigma1=0.057643;      sigma2= 0.112927;     f=0.892;
03140                 }else if(driftDist<4.){
03141                         sigma1=0.055266;      sigma2=0.094833;      f=0.887;
03142                 }else if(driftDist<4.5){
03143                         sigma1=0.056263;      sigma2=0.124419;      f= 0.932;
03144                 }else if(driftDist<5.){
03145                         sigma1=0.056599;      sigma2=0.124248;      f=0.923;
03146                 }else if(driftDist<5.5){
03147                         sigma1= 0.061377;     sigma2=0.146147;      f=0.964;
03148                 }else if(driftDist<6.){
03149                         sigma1=0.063978;      sigma2=0.150591;      f=0.942;
03150                 }else if(driftDist<6.5){
03151                         sigma1=0.072951;      sigma2=0.15685;       f=0.913;
03152                 }else if(driftDist<7.){
03153                         sigma1=0.085438;      sigma2=0.255109;      f=0.931;
03154                 }else if(driftDist<7.5){
03155                         sigma1=0.101635;      sigma2=0.315529;      f=0.878;
03156                 }else{
03157                         sigma1=0.149529;      sigma2=0.374697;      f=0.89;
03158                 }
03159         }
03160         double sigmax = sqrt(f*sigma1*sigma1+(1 - f)*sigma2*sigma2)*0.1;
03161         return sigmax;//cm
03162 }

double KalFitTrack::getT0 ( void   )  const

Definition at line 57 of file KalFitTrack2.cxx.

References debug_, and EventT0_.

Referenced by getDriftTime().

00058 {
00059         //------------------get  event  start time-----------
00060 
00061         if(debug_ == 4) {
00062                 std::cout<<"in function KalFitTrack::getT0 ( ), EventT0_ = "<<EventT0_<<std::endl;   
00063         }                                                                             
00064         return EventT0_ ;
00065 }

double KalFitTrack::getTofSM ( void   )  [inline]

Definition at line 161 of file KalFitTrack.h.

References tof2_.

Referenced by KalFitAlg::fillTds_back().

00161 { return tof2_;}

KalFitHelixSeg& KalFitTrack::HelixSeg ( int  i  )  [inline]

Definition at line 235 of file KalFitTrack.h.

References HelixSegs_.

Referenced by KalFitAlg::smoother_calib().

00235 { return HelixSegs_[i];}

vector<KalFitHelixSeg>& KalFitTrack::HelixSegs ( void   )  [inline]

Definition at line 234 of file KalFitTrack.h.

References HelixSegs_.

00234 { return HelixSegs_;}

void KalFitTrack::HelixSegs ( vector< KalFitHelixSeg > &  vs  ) 

Referenced by KalFitAlg::complete_track(), KalFitAlg::fillTds_back(), KalFitAlg::filter_fwd_calib(), KalFitAlg::smoother_anal(), and KalFitAlg::smoother_calib().

KalFitHitMdc& KalFitTrack::HitMdc ( int  i  )  [inline]

Definition at line 230 of file KalFitTrack.h.

References HitsMdc_.

Referenced by chi2_next(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), KalFitAlg::smoother_anal(), and KalFitAlg::start_seed().

00230 { return HitsMdc_[i];}

vector<KalFitHitMdc>& KalFitTrack::HitsMdc ( void   )  [inline]

Definition at line 229 of file KalFitTrack.h.

References HitsMdc_.

Referenced by order_hits().

00229 { return HitsMdc_;}

void KalFitTrack::HitsMdc ( vector< KalFitHitMdc > &  lh  ) 

Definition at line 1836 of file KalFitTrack.cxx.

References HitsMdc_.

Referenced by KalFitAlg::complete_track(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), KalFitAlg::kalman_fitting_anal(), KalFitAlg::kalman_fitting_calib(), KalFitAlg::kalman_fitting_csmalign(), KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew(), KalFitAlg::smoother_anal(), and KalFitAlg::start_seed().

01836 { HitsMdc_ = lh;}

void Helix::ignoreErrorMatrix ( void   )  [inherited]

unsets error matrix. Error calculations will be ignored after this function call until an error matrix be set again. 0 matrix will be return as a return value for error matrix when you call functions which returns an error matrix.

Definition at line 722 of file Helix.cxx.

References Helix::m_Ea, and Helix::m_matrixValid.

Referenced by chi2_next(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), order_wirhit(), pivot_numf(), KalFitAlg::smoother_anal(), and KalFitAlg::smoother_calib().

00722                              {
00723     m_matrixValid = false;
00724     m_Ea *= 0.;
00725 }

void KalFitTrack::insist ( int  t  )  [inline]

Definition at line 209 of file KalFitTrack.h.

References insist_.

00209 { insist_ = t;}

int KalFitTrack::insist ( void   )  const [inline]

Extractor :.

Definition at line 178 of file KalFitTrack.h.

References insist_.

00178 { return insist_; }

double KalFitTrack::intersect_cylinder ( double  r  )  const

Intersection with different geometry.

Definition at line 123 of file KalFitTrack.cxx.

References KalmanFit::Helix::center(), M_PI, KalmanFit::Helix::phi0(), and KalmanFit::Helix::radius().

Referenced by KalFitCylinder::intersect(), intersect_yz_plane(), and intersect_zx_plane().

00124 {
00125         double m_rad = radius();
00126         double l = center().perp();
00127 
00128         double cosPhi = (m_rad * m_rad + l * l  - r * r) / (2 * m_rad * l);
00129 
00130         if(cosPhi < -1 || cosPhi > 1) return 0;
00131 
00132         double dPhi = center().phi() - acos(cosPhi) - phi0();
00133 
00134         if(dPhi < -M_PI) dPhi += 2 * M_PI;
00135 
00136         return dPhi;
00137 }

double KalFitTrack::intersect_xy_plane ( double  z  )  const

Definition at line 175 of file KalFitTrack.cxx.

References KalmanFit::Helix::dz(), KalmanFit::Helix::pivot(), KalmanFit::Helix::radius(), and KalmanFit::Helix::tanl().

Referenced by KalFitCylinder::intersect().

00176 {
00177         if (tanl() != 0 && radius() != 0)
00178                 return (pivot().z() + dz() - z) / (radius() * tanl());
00179         else return 0;
00180 }

double KalFitTrack::intersect_yz_plane ( const HepTransform3D plane,
double  x 
) const

Definition at line 157 of file KalFitTrack.cxx.

References KalmanFit::Helix::center(), intersect_cylinder(), and KalmanFit::Helix::radius().

00159 {
00160         HepPoint3D xc = plane * center();
00161         double r = radius();
00162         double d = r * r - (x - xc.x()) * (x - xc.x());
00163         if(d < 0) return 0;
00164 
00165         double yy = xc.y();
00166         if(yy > 0) yy -= sqrt(d);
00167         else yy += sqrt(d);
00168 
00169         double l = (plane.inverse() *
00170                         HepPoint3D(x, yy, 0)).perp();
00171 
00172         return intersect_cylinder(l);
00173 }

double KalFitTrack::intersect_zx_plane ( const HepTransform3D plane,
double  y 
) const

Definition at line 139 of file KalFitTrack.cxx.

References KalmanFit::Helix::center(), intersect_cylinder(), and KalmanFit::Helix::radius().

00141 {
00142         HepPoint3D xc = plane * center();
00143         double r = radius();
00144         double d = r * r - (y - xc.y()) * (y - xc.y());
00145         if(d < 0) return 0;
00146 
00147         double xx = xc.x();
00148         if(xx > 0) xx -= sqrt(d);
00149         else xx += sqrt(d);
00150 
00151         double l = (plane.inverse() *
00152                         HepPoint3D(xx, y, 0)).perp();
00153 
00154         return intersect_cylinder(l);
00155 }

double Helix::kappa ( void   )  const [inline, inherited]

Definition at line 230 of file Helix.h.

References Helix::m_ac.

Referenced by KalmanFit::Helix::approach(), chi2_next(), KalFitAlg::fillTds_back(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), ms(), msgasmdc(), order_hits(), pivot_numf(), KalFitAlg::smoother_anal(), KalFitAlg::smoother_calib(), and tof().

00230                        {
00231     return m_ac[2];
00232 }

void KalFitTrack::lead ( int  i  )  [static]

Definition at line 1827 of file KalFitTrack.cxx.

References lead_.

01827 { lead_ = i;}

int KalFitTrack::lead ( void   )  [static]

Magnetic field map.

Definition at line 1828 of file KalFitTrack.cxx.

References lead_.

Referenced by KalFitAlg::initialize().

01828 { return lead_;}

void KalFitTrack::LR ( int  x  )  [static]

Definition at line 1835 of file KalFitTrack.cxx.

References LR_.

Referenced by KalFitAlg::initialize().

01835 { LR_ = x;}

double KalFitTrack::mass ( int  i  )  [static]

Definition at line 1821 of file KalFitTrack.cxx.

References MASS.

01821 {  return MASS[i];}

double KalFitTrack::mass ( void   )  const [inline]

Definition at line 182 of file KalFitTrack.h.

References mass_.

Referenced by KalFitAlg::fillTds(), KalFitAlg::fillTds_back(), KalFitAlg::fillTds_lead(), and KalFitAlg::smoother_anal().

00182 { return mass_; }

CLHEP::Hep3Vector* KalFitTrack::mom ( void   )  [inline]

Definition at line 190 of file KalFitTrack.h.

References mom_.

00190 { return mom_; }

HepLorentzVector Helix::momentum ( double  dPhi,
double  mass,
HepPoint3D x,
HepSymMatrix &  Emx 
) const [inherited]

returns 4momentum vector after rotating angle dPhi in phi direction.

Definition at line 277 of file Helix.cxx.

References cos(), Helix::del4MXDelA(), Helix::m_ac, Helix::m_cp, Helix::m_Ea, Helix::m_matrixValid, Helix::m_pivot, Helix::m_pt, Helix::m_r, Helix::m_sp, Helix::pt(), and sin().

00280                                           {
00281   // 
00282   // Calculate momentum.
00283   //
00284   // Pt = | 1/kappa | (GeV/c)
00285   //
00286   // Px = -Pt * sin(phi0 + phi) 
00287   // Py =  Pt * cos(phi0 + phi)
00288   // Pz =  Pt * tan(lambda)
00289   //
00290   // E  = sqrt( 1/kappa/kappa * (1+tan(lambda)*tan(lambda)) + mass*mass )
00291   
00292   double pt = fabs(m_pt);
00293   double px = - pt * sin(m_ac[1] + phi);
00294   double py =   pt * cos(m_ac[1] + phi);
00295   double pz =   pt * m_ac[4];
00296   double E  = sqrt(pt * pt * (1. + m_ac[4] * m_ac[4]) + mass * mass);
00297 
00298   x.setX(m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] + phi)));
00299   x.setY(m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] + phi)));
00300   x.setZ(m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi);
00301 
00302   if (m_matrixValid) Emx = m_Ea.similarity(del4MXDelA(phi,mass));
00303   else               Emx = m_Ea;
00304   
00305   return HepLorentzVector(px, py, pz, E);
00306 }

HepLorentzVector Helix::momentum ( double  dPhi,
double  mass,
HepSymMatrix &  Em 
) const [inherited]

returns 4momentum vector after rotating angle dPhi in phi direction.

Definition at line 252 of file Helix.cxx.

References cos(), Helix::del4MDelA(), Helix::m_ac, Helix::m_Ea, Helix::m_matrixValid, Helix::m_pt, Helix::pt(), and sin().

00252                                                                 {
00253     // 
00254     // Calculate momentum.
00255     //
00256     // Pt = | 1/kappa | (GeV/c)
00257     //
00258     // Px = -Pt * sin(phi0 + phi) 
00259     // Py =  Pt * cos(phi0 + phi)
00260     // Pz =  Pt * tan(lambda)
00261     //
00262     // E  = sqrt( 1/kappa/kappa * (1+tan(lambda)*tan(lambda)) + mass*mass )
00263 
00264     double pt = fabs(m_pt);
00265     double px = - pt * sin(m_ac[1] + phi);
00266     double py =   pt * cos(m_ac[1] + phi);
00267     double pz =   pt * m_ac[4];
00268     double E  =   sqrt(pt*pt*(1.+m_ac[4]*m_ac[4])+mass*mass);
00269 
00270     if (m_matrixValid) Em = m_Ea.similarity(del4MDelA(phi,mass));
00271     else               Em = m_Ea;
00272 
00273     return HepLorentzVector(px, py, pz, E);
00274 }

HepLorentzVector Helix::momentum ( double  dPhi,
double  mass 
) const [inherited]

returns 4momentum vector after rotating angle dPhi in phi direction.

Definition at line 229 of file Helix.cxx.

References cos(), Helix::m_ac, Helix::m_pt, Helix::pt(), and sin().

00229                                              {
00230     // 
00231     // Calculate momentum.
00232     //
00233     // Pt = | 1/kappa | (GeV/c)
00234     //
00235     // Px = -Pt * sin(phi0 + phi) 
00236     // Py =  Pt * cos(phi0 + phi)
00237     // Pz =  Pt * tan(lambda)
00238     //
00239     // E  = sqrt( 1/kappa/kappa * (1+tan(lambda)*tan(lambda)) + mass*mass )
00240 
00241     double pt = fabs(m_pt);
00242     double px = - pt * sin(m_ac[1] + phi);
00243     double py =   pt * cos(m_ac[1] + phi);
00244     double pz =   pt * m_ac[4];
00245     double E  =   sqrt(pt*pt*(1.+m_ac[4]*m_ac[4])+mass*mass);
00246 
00247     return HepLorentzVector(px, py, pz, E);
00248 }

Hep3Vector Helix::momentum ( double  dPhi,
HepSymMatrix &  Em 
) const [inherited]

returns momentum vector after rotating angle dPhi in phi direction.

Definition at line 206 of file Helix.cxx.

References cos(), Helix::delMDelA(), Helix::m_ac, Helix::m_Ea, Helix::m_matrixValid, Helix::m_pt, Helix::pt(), and sin().

00206                                                    {
00207     // 
00208     // Calculate momentum.
00209     //
00210     // Pt = | 1/kappa | (GeV/c)
00211     //
00212     // Px = -Pt * sin(phi0 + phi) 
00213     // Py =  Pt * cos(phi0 + phi)
00214     // Pz =  Pt * tan(lambda)
00215     //
00216 
00217     double pt = fabs(m_pt);
00218     double px = - pt * sin(m_ac[1] + phi);
00219     double py =   pt * cos(m_ac[1] + phi);
00220     double pz =   pt * m_ac[4];
00221 
00222     if (m_matrixValid) Em = m_Ea.similarity(delMDelA(phi));
00223     else               Em = m_Ea;
00224 
00225     return Hep3Vector(px, py, pz);
00226 }

Hep3Vector Helix::momentum ( double  dPhi = 0.  )  const [inherited]

returns momentum vector after rotating angle dPhi in phi direction.

Definition at line 186 of file Helix.cxx.

References cos(), Helix::m_ac, Helix::m_pt, Helix::pt(), and sin().

Referenced by chi2_next(), KalFitAlg::complete_track(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), KalFitAlg::smoother_anal(), and KalFitAlg::smoother_calib().

00186                                 {
00187     // 
00188     // Calculate momentum.
00189     //
00190     // Pt = | 1/kappa | (GeV/c)
00191     //
00192     // Px = -Pt * sin(phi0 + phi) 
00193     // Py =  Pt * cos(phi0 + phi)
00194     // Pz =  Pt * tan(lambda)
00195     //
00196 
00197     double pt = fabs(m_pt);
00198     double px = - pt * sin(m_ac[1] + phi);
00199     double py =   pt * cos(m_ac[1] + phi);
00200     double pz =   pt * m_ac[4];
00201 
00202     return Hep3Vector(px, py, pz);
00203 }

void KalFitTrack::ms ( double  path,
const KalFitMaterial m,
int  index 
)

Definition at line 182 of file KalFitTrack.cxx.

References KalmanFit::Helix::Ea(), KalmanFit::Helix::kappa(), mass_, KalFitMaterial::mcs_angle(), path_rd_, t(), KalmanFit::Helix::tanl(), and KalFitMaterial::X0().

Referenced by KalFitElement::updateTrack(), KalFitElement::updateTrack_alreadyfound(), and KalFitElement::updateTrack_rphi().

00184 {
00185         HepSymMatrix ea = Ea();
00186         //cout<<"ms():path  "<<path<<endl;
00187         //cout<<"ms():ea before: "<<ea<<endl;
00188         double k = kappa();
00189         double t = tanl();
00190         double t2 = t * t;
00191         double pt2 = 1 + t2;
00192         double k2 = k * k;
00193 
00194         double pmag = 1 / fabs(k) * sqrt(pt2);
00195         double dth = material.mcs_angle(mass_, path, pmag);
00196         double dth2 = dth * dth;
00197         double pt2dth2 = pt2 * dth2;
00198 
00199         ea[1][1] += pt2dth2;
00200         ea[2][2] += k2 * t2 * dth2;
00201         ea[2][4] += k * t * pt2dth2;
00202         ea[4][4] += pt2 * pt2dth2;
00203 
00204         ea[3][3] += dth2 * path * path /3 / (1 + t2);
00205         ea[3][4] += dth2 * path/2 * sqrt(1 + t2);
00206         ea[3][2] += dth2 * t / sqrt(1 + t2) * k * path/2;
00207         ea[0][0] += dth2 * path * path/3;
00208         ea[0][1] += dth2 * sqrt(1 + t2) * path/2;
00209 
00210         Ea(ea);
00211         //cout<<"ms():ms angle in this: "<<dth<<endl;  
00212         //cout<<"ms():ea after: "<<Ea()<<endl;
00213         if (index < 0) {
00214                 double x0 = material.X0();
00215                 if (x0) path_rd_ += path/x0;
00216         }
00217 }

void KalFitTrack::msgasmdc ( double  path,
int  index 
)

Calculate multiple scattering angle.

Definition at line 219 of file KalFitTrack.cxx.

References KalmanFit::Helix::Ea(), KalmanFit::Helix::kappa(), mass_, mdcGasRadlen_, path_rd_, pathip_, t(), KalmanFit::Helix::tanl(), and tof().

Referenced by KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), KalFitAlg::smoother_anal(), and KalFitAlg::smoother_calib().

00220 {
00221         double k = kappa();
00222         double t = tanl();
00223         double t2 = t * t;
00224         double k2 = k * k;
00225 
00226         double pmag = ( 1 / fabs(k) ) * sqrt(1 + t2);
00227         double psq = pmag*pmag;
00228         /*
00229            double Zprims = 3/2*0.076 + 0.580/9.79*4.99*(4.99+1) +
00230            0.041/183.85*74*(74+1) + 0.302/26.98 * 13 * (13+1);
00231            double chicc = 0.00039612 * sqrt(Zprims * 0.001168);
00232            double dth = 2.557 * chicc * sqrt(path * (mass_*mass_ + psq)) / psq;
00233          */
00234 
00235         //std::cout<<" mdcGasRadlen: "<<mdcGasRadlen_<<std::endl;
00236         double pathx = path/mdcGasRadlen_;
00237         double dth =  0.0136* sqrt(pathx * (mass_*mass_ + psq))/psq 
00238                 *(1 + 0.038 * log(pathx));;
00239         HepSymMatrix ea = Ea();
00240 #ifdef YDEBUG
00241         cout<<"msgasmdc():path  "<<path<<"  pathx "<<pathx<<endl;
00242         cout<<"msgasmdc():dth  "<<dth<<endl;
00243         cout<<"msgasmdc():ea before: "<<ea<<endl;
00244 #endif
00245         double dth2 = dth * dth;
00246 
00247         ea[1][1] += (1 + t2) * dth2;
00248         ea[2][2] += k2 * t2 * dth2;
00249         ea[2][4] += k * t * (1 + t2) * dth2;
00250         ea[4][4] += (1 + t2) * (1 + t2) * dth2;
00251 
00252         // additionnal terms (terms proportional to l and l^2)
00253 
00254         ea[3][3] += dth2 * path * path /3 / (1 + t2);
00255         ea[3][4] += dth2 * path/2 * sqrt(1 + t2);
00256         ea[3][2] += dth2 * t / sqrt(1 + t2) * k * path/2;
00257         ea[0][0] += dth2 * path * path/3;
00258         ea[0][1] += dth2 * sqrt(1 + t2) * path/2;
00259 
00260         Ea(ea);
00261 #ifdef YDEBUG
00262         cout<<"msgasmdc():ea after: "<<Ea()<<endl;
00263 #endif
00264         if (index < 0) {
00265                 pathip_ += path;
00266                 // RMK : put by hand, take care !!
00267                 double x0 = mdcGasRadlen_; // for the Mdc gas
00268                 path_rd_ += path/x0;
00269                 tof(path);
00270 #ifdef YDEBUG
00271                 cout<<"ms...pathip..."<<pathip_<<endl;
00272 #endif
00273         }
00274 }

unsigned int KalFitTrack::ncath ( void   )  const [inline]

Definition at line 200 of file KalFitTrack.h.

References ncath_.

00200 { return ncath_; }

void KalFitTrack::nchits ( int  n  )  [inline]

Definition at line 217 of file KalFitTrack.h.

References nchits_.

00217 { nchits_ = n; }

unsigned int KalFitTrack::nchits ( void   )  const [inline]

Definition at line 198 of file KalFitTrack.h.

References nchits_.

Referenced by KalFitAlg::fillTds(), KalFitAlg::fillTds_ip(), KalFitAlg::fillTds_lead(), and KalFitAlg::start_seed().

00198 { return nchits_; }

void KalFitTrack::ndf_back ( int  n  )  [inline]

Definition at line 216 of file KalFitTrack.h.

References ndf_back_.

00216 { ndf_back_ = n; }

int KalFitTrack::ndf_back ( void   )  const [inline]

Definition at line 185 of file KalFitTrack.h.

References ndf_back_.

Referenced by KalFitAlg::fillTds_back(), and KalFitAlg::start_seed().

00185 { return ndf_back_; }

int KalFitTrack::nhit_r ( void   )  const [inline]

Definition at line 203 of file KalFitTrack.h.

References nhit_r_.

00203 { return nhit_r_;  }

int KalFitTrack::nhit_z ( void   )  const [inline]

Definition at line 204 of file KalFitTrack.h.

References nhit_z_.

00204 { return nhit_z_;  }

int KalFitTrack::nLayerUsed (  )  [inline]

Definition at line 336 of file KalFitTrack.h.

References genRecEmupikp::i, and myLayerUsed.

Referenced by KalFitAlg::fillTds_ip().

00337         {
00338                 int n=0;
00339                 for(int i=0; i<43; i++) n+=myLayerUsed[i];
00340                 return n;
00341         }

int KalFitTrack::nmass ( void   )  [static]

Definition at line 1820 of file KalFitTrack.cxx.

References NMASS.

Referenced by KalFitAlg::complete_track().

01820 {  return NMASS;}

void KalFitTrack::nster ( int  n  )  [inline]

Definition at line 218 of file KalFitTrack.h.

References nster_.

00218 { nster_ = n; }

unsigned int KalFitTrack::nster ( void   )  const [inline]

Definition at line 199 of file KalFitTrack.h.

References nster_.

Referenced by KalFitAlg::fillTds(), KalFitAlg::fillTds_ip(), KalFitAlg::fillTds_lead(), and KalFitAlg::start_seed().

00199 { return nster_; }

void KalFitTrack::number_wirhit ( void   ) 

Definition at line 452 of file KalFitTrack.cxx.

References HitsMdc_, and genRecEmupikp::i.

00453 {
00454         unsigned int nhit = HitsMdc_.size();
00455         int Num[50] = {0};
00456         for( unsigned i=0 ; i < nhit; i++ )
00457                 Num[HitsMdc_[i].wire().layer().layerId()]++;
00458         for( unsigned i=0 ; i < nhit; i++ )
00459                 if (Num[HitsMdc_[i].wire().layer().layerId()]>2)
00460                         HitsMdc_[i].chi2(-2);
00461 }

void KalFitTrack::numf ( int  i  )  [static]

Definition at line 1833 of file KalFitTrack.cxx.

References numf_.

01833 { numf_ = i;}

int KalFitTrack::numf ( void   )  [static]

Definition at line 1834 of file KalFitTrack.cxx.

References numf_.

Referenced by KalFitAlg::initialize().

01834 { return numf_;}

void KalFitTrack::order_hits ( void   ) 

Definition at line 437 of file KalFitTrack.cxx.

References HitsMdc(), HitsMdc_, KalmanFit::Helix::kappa(), and swap.

00437                                 {
00438         for(int it=0; it<HitsMdc().size()-1; it++){
00439                 if(HitsMdc_[it].wire().layer().layerId() == HitsMdc_[it+1].wire().layer().layerId())    
00440                 {
00441                         if((kappa()<0)&&(HitsMdc_[it].wire().localId() > HitsMdc_[it+1].wire().localId())){
00442                                 std::swap(HitsMdc_[it], HitsMdc_[it+1]);
00443                         }
00444                         if((kappa()>0)&&(HitsMdc_[it].wire().localId() < HitsMdc_[it+1].wire().localId())){
00445                                 std::swap(HitsMdc_[it], HitsMdc_[it+1]);
00446                         }
00447                 }
00448         }
00449 }

void KalFitTrack::order_wirhit ( int  index  ) 

Modifier Order the wire hits for mdc track

Definition at line 375 of file KalFitTrack.cxx.

References HitsMdc_, genRecEmupikp::i, KalmanFit::Helix::ignoreErrorMatrix(), ganga-rec::j, KalmanFit::Helix::pivot(), swap, and KalmanFit::Helix::x().

Referenced by KalFitAlg::kalman_fitting_anal(), KalFitAlg::kalman_fitting_calib(), KalFitAlg::kalman_fitting_csmalign(), and KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew().

00376 {
00377         unsigned int nhit = HitsMdc_.size();
00378         Helix tracktest = *(Helix*)this;
00379         int ind = 0;
00380         double* Rad = new double[nhit];
00381         double* Ypos = new double[nhit];
00382         for( unsigned i=0 ; i < nhit; i++ ){
00383 
00384                 HepPoint3D fwd(HitsMdc_[i].wire().fwd());
00385                 HepPoint3D bck(HitsMdc_[i].wire().bck());
00386                 Hep3Vector wire = (CLHEP::Hep3Vector)fwd -(CLHEP::Hep3Vector)bck;
00387 
00388                 // Modification for stereo wires :
00389                 Helix work = tracktest;
00390                 work.ignoreErrorMatrix();
00391                 work.pivot((fwd + bck) * .5);
00392                 HepPoint3D x0 = (work.x(0).z() - bck.z())
00393                         / wire.z() * wire + bck;
00394 
00395                 tracktest.pivot(x0);
00396                 Rad[ind] = tracktest.x(0).perp();
00397                 Ypos[ind] = x0.y();
00398                 ind++;
00399                 //cout<<"Ypos: "<<Ypos[ind-1]<<endl;
00400         }
00401 
00402         // Reorder...
00403         if (index < 0)
00404                 for(int j, k = nhit - 1; k >= 0; k = j){
00405                         j = -1;
00406                         for(int i = 1; i <= k; i++)
00407                                 if(Rad[i - 1] > Rad[i]){
00408                                         j = i - 1;
00409                                         std::swap(Rad[i], Rad[j]);
00410                                         std::swap(HitsMdc_[i], HitsMdc_[j]);
00411                                 }
00412                 }
00413         if (index > 0)
00414                 for(int j, k = nhit - 1; k >= 0; k = j){
00415                         j = -1;
00416                         for(int i = 1; i <= k; i++)
00417                                 if(Rad[i - 1] < Rad[i]){
00418                                         j = i - 1;
00419                                         std::swap(Rad[i], Rad[j]);
00420                                         std::swap(HitsMdc_[i], HitsMdc_[j]);
00421                                 }
00422                 }
00423         if (index == 0)
00424                 for(int j, k = nhit - 1; k >= 0; k = j){
00425                         j = -1;
00426                         for(int i = 1; i <= k; i++)
00427                                 if(Ypos[i - 1] > Ypos[i]){
00428                                         j = i - 1;
00429                                         std::swap(Ypos[i], Ypos[j]);
00430                                         std::swap(HitsMdc_[i], HitsMdc_[j]);
00431                                 }
00432                 }
00433         delete [] Rad;
00434         delete [] Ypos;
00435 }

void KalFitTrack::p_kaon ( double  pl  )  [inline]

Definition at line 212 of file KalFitTrack.h.

References p_kaon_.

00212 { p_kaon_ = pl;}

double KalFitTrack::p_kaon ( void   )  const [inline]

Definition at line 194 of file KalFitTrack.h.

References p_kaon_.

Referenced by KalFitAlg::complete_track().

00194 { return p_kaon_; }

void KalFitTrack::p_proton ( double  pl  )  [inline]

Definition at line 213 of file KalFitTrack.h.

References p_proton_.

00213 { p_proton_ = pl;}

double KalFitTrack::p_proton ( void   )  const [inline]

Definition at line 195 of file KalFitTrack.h.

References p_proton_.

Referenced by KalFitAlg::complete_track().

00195 { return p_proton_; }

int KalFitTrack::pat1 ( void   )  const [inline]

Definition at line 201 of file KalFitTrack.h.

References pat1_.

00201 { return pat1_;  }

int KalFitTrack::pat2 ( void   )  const [inline]

Definition at line 202 of file KalFitTrack.h.

References pat2_.

00202 { return pat2_;  }

double KalFitTrack::path_ab ( void   )  const [inline]

Definition at line 188 of file KalFitTrack.h.

References path_ab_.

00188 { return path_ab_; }

void KalFitTrack::path_add ( double  path  ) 

Update the path length estimation.

Definition at line 1289 of file KalFitTrack.cxx.

References pathip_, and tof().

01290 {
01291         pathip_ += path;
01292         tof(path);
01293 }

double KalFitTrack::path_rd ( void   )  const [inline]

Definition at line 187 of file KalFitTrack.h.

References path_rd_.

00187 { return path_rd_; }

void KalFitTrack::pathip ( double  pl  )  [inline]

Definition at line 211 of file KalFitTrack.h.

References pathip_.

00211 { pathip_ = pl;}

double KalFitTrack::pathip ( void   )  const [inline]

Definition at line 186 of file KalFitTrack.h.

References pathip_.

Referenced by KalFitAlg::fillTds_back().

00186 { return pathip_; }

double KalFitTrack::PathL ( int  layer  ) 

Function to calculate the path length in the layer.

double* KalFitTrack::pathl ( void   )  [inline]

Definition at line 189 of file KalFitTrack.h.

References PathL_.

Referenced by KalFitAlg::fillTds_back().

00189 { return PathL_; }

double Helix::phi0 ( void   )  const [inline, inherited]

Definition at line 224 of file Helix.h.

References Helix::m_ac.

Referenced by KalmanFit::Helix::approach(), chi2_next(), KalFitAlg::fillTds_back(), intersect_cylinder(), pivot_numf(), radius_numf(), and KalFitAlg::smoother_anal().

00224                       {
00225     return m_ac[1];
00226 }

const HepPoint3D & Helix::pivot ( const HepPoint3D newPivot  )  [inherited]

sets pivot position.

Definition at line 310 of file Helix.cxx.

References cos(), Helix::delApDelA(), Helix::dr(), Helix::dz(), Helix::kappa(), Helix::m_a, Helix::m_ac, Helix::m_Ea, Helix::m_matrixValid, M_PI, M_PI2, M_PI4, M_PI8, Helix::m_pivot, Helix::m_r, Helix::phi0(), Helix::tanl(), and Helix::updateCache().

00310                                         {
00311 
00312     //std::cout<<" in Helix::pivot:"<<std::endl;
00313     //std::cout<<" m_alpha: "<<m_alpha<<std::endl;
00314     
00315     const double & dr    = m_ac[0];
00316     const double & phi0  = m_ac[1];
00317     const double & kappa = m_ac[2];
00318     const double & dz    = m_ac[3];
00319     const double & tanl  = m_ac[4];
00320 
00321     double rdr = dr + m_r;
00322     double phi = fmod(phi0 + M_PI4, M_PI2);
00323     double csf0 = cos(phi);
00324     double snf0 = (1. - csf0) * (1. + csf0);
00325     snf0 = sqrt((snf0 > 0.) ? snf0 : 0.);
00326     if(phi > M_PI) snf0 = - snf0;
00327 
00328     double xc = m_pivot.x() + rdr * csf0;
00329     double yc = m_pivot.y() + rdr * snf0;
00330     double csf, snf;
00331     if(m_r != 0.0) {
00332       csf = (xc - newPivot.x()) / m_r;
00333       snf = (yc - newPivot.y()) / m_r;
00334       double anrm = sqrt(csf * csf + snf * snf);
00335       if(anrm != 0.0) {
00336         csf /= anrm;
00337         snf /= anrm;
00338         phi = atan2(snf, csf);
00339       } else {
00340         csf = 1.0;
00341         snf = 0.0;
00342         phi = 0.0;
00343       }
00344     } else {
00345       csf = 1.0;
00346       snf = 0.0;
00347       phi = 0.0;
00348     }
00349     double phid = fmod(phi - phi0 + M_PI8, M_PI2);
00350     if(phid > M_PI) phid = phid - M_PI2;
00351     double drp = (m_pivot.x() + dr * csf0 + m_r * (csf0 - csf) - newPivot.x())
00352         * csf
00353         + (m_pivot.y() + dr * snf0 + m_r * (snf0 - snf) - newPivot.y()) * snf;
00354     double dzp = m_pivot.z() + dz - m_r * tanl * phid - newPivot.z();
00355 
00356     HepVector ap(5);
00357     ap[0] = drp;
00358     ap[1] = fmod(phi + M_PI4, M_PI2);
00359     ap[2] = kappa;
00360     ap[3] = dzp;
00361     ap[4] = tanl;
00362 
00363     //    if (m_matrixValid) m_Ea.assign(delApDelA(ap) * m_Ea * delApDelA(ap).T());
00364     if (m_matrixValid) m_Ea = m_Ea.similarity(delApDelA(ap));
00365 
00366     m_a = ap;
00367     m_pivot = newPivot;
00368 
00369     //...Are these needed?...iw...
00370     updateCache();
00371     return m_pivot;
00372 }

const HepPoint3D & Helix::pivot ( void   )  const [inline, inherited]

returns pivot position.

Definition at line 200 of file Helix.h.

References Helix::m_pivot.

Referenced by KalmanFit::Helix::approach(), chi2_next(), KalFitAlg::complete_track(), KalFitAlg::fillTds(), KalFitAlg::fillTds_back(), KalFitAlg::fillTds_ip(), KalFitAlg::fillTds_lead(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), intersect_xy_plane(), KalFitAlg::kalman_fitting_anal(), KalFitAlg::kalman_fitting_calib(), KalFitAlg::kalman_fitting_csmalign(), KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew(), order_wirhit(), pivot_numf(), radius_numf(), KalFitAlg::smoother_anal(), KalFitAlg::smoother_calib(), KalFitAlg::start_seed(), update_forMdc(), and update_last().

00200                        {
00201     return m_pivot;
00202 }

const HepPoint3D& KalFitTrack::pivot_forMdc ( void   )  const [inline]

Definition at line 150 of file KalFitTrack.h.

References pivot_forMdc_.

00150 { return pivot_forMdc_;}

const HepPoint3D& KalFitTrack::pivot_last ( void   )  const [inline]

returns helix parameters

Definition at line 146 of file KalFitTrack.h.

References pivot_last_.

00146 { return pivot_last_;  }

const HepPoint3D & KalFitTrack::pivot_numf ( const HepPoint3D newPivot,
double &  pathl 
)

Definition at line 1478 of file KalFitTrack.cxx.

References KalmanFit::Helix::a(), Bznom_, cos(), KalmanFit::Helix::delApDelA(), check_raw_filter::dist, KalmanFit::Helix::dr(), KalmanFit::Helix::dz(), KalmanFit::Helix::Ea(), IMagneticFieldSvc::fieldVector(), genRecEmupikp::i, KalmanFit::Helix::ignoreErrorMatrix(), KalmanFit::Helix::kappa(), M_PI, M_PI2, M_PI4, M_PI8, MFSvc_, numf_, outer_steps_, KalmanFit::Helix::phi0(), KalmanFit::Helix::pivot(), KalmanFit::Helix::radius(), sign(), KalmanFit::Helix::tanl(), and KalmanFit::Helix::x().

01478                                                                    {
01479 
01480         Helix tracktest = *(Helix*)this;
01481         tracktest.ignoreErrorMatrix();
01482         double tl  = a()[4];
01483         double th = 90.0 - 180.0*M_1_PI*atan( tl );
01484         /*
01485            int nstep(1);
01486            if (steplev_ == 1)
01487            nstep = 3;
01488            else if (steplev_ == 2 && (th > 140 || th <45))
01489            if ((pivot()-newPivot).mag()<3.)
01490            nstep = 3;
01491            else
01492            nstep = 6;
01493          */
01494         Hep3Vector delta_x((newPivot-pivot()).x()/double(outer_steps_),
01495                         (newPivot-pivot()).y()/double(outer_steps_),
01496                         (newPivot-pivot()).z()/double(outer_steps_));
01497         int i = 1;
01498 
01499         while (i <= outer_steps_) {
01500                 HepPoint3D nextPivot(pivot()+delta_x);
01501                 double xnp(nextPivot.x()), ynp(nextPivot.y()), znp(nextPivot.z());  
01502 
01503                 HepSymMatrix Ea_now = Ea();
01504                 HepPoint3D piv(pivot());
01505                 double xp(piv.x()), yp(piv.y()), zp(piv.z());  
01506 
01507                 double dr    = a()[0];
01508                 double phi0  = a()[1];
01509                 double kappa = a()[2];
01510                 double dz    = a()[3];
01511                 double tanl  = a()[4];
01512 
01513                 double m_rad(0);
01514                 m_rad = radius();
01515 
01516                 double rdr = dr + m_rad;
01517                 double phi = fmod(phi0 + M_PI4, M_PI2);
01518                 double csf0 = cos(phi);
01519                 double snf0 = (1. - csf0) * (1. + csf0);
01520                 snf0 = sqrt((snf0 > 0.) ? snf0 : 0.);
01521                 if(phi > M_PI) snf0 = - snf0;
01522 
01523                 double xc = xp + rdr * csf0;
01524                 double yc = yp + rdr * snf0;
01525                 double csf = (xc - xnp) / m_rad;
01526                 double snf = (yc - ynp) / m_rad;
01527                 double anrm = sqrt(csf * csf + snf * snf);
01528                 csf /= anrm;
01529                 snf /= anrm;
01530                 phi = atan2(snf, csf);
01531                 double phid = fmod(phi - phi0 + M_PI8, M_PI2);
01532                 if(phid > M_PI) phid = phid - M_PI2;
01533                 double drp = (xp + dr * csf0 + m_rad * (csf0 - csf) - xnp)
01534                         * csf
01535                         + (yp + dr * snf0 + m_rad * (snf0 - snf) - ynp) * snf;
01536                 double dzp = zp + dz - m_rad * tanl * phid - znp;
01537 
01538                 HepVector ap(5);
01539                 ap[0] = drp;
01540                 ap[1] = fmod(phi + M_PI4, M_PI2);
01541                 ap[2] = kappa;
01542                 ap[3] = dzp;
01543                 ap[4] = tanl;
01544 
01545                 //std::cout<<" numf_: "<<numf_<<std::endl;
01546 
01547                 // Modification due to non uniform magnetic field :
01548                 if (numf_ > 10) {
01549 
01550                         Hep3Vector x1(xp + dr*csf0, yp + dr*snf0, zp + dz);
01551 
01552                         double csf0p = cos(ap[1]);
01553                         double snf0p = (1. - csf0p) * (1. + csf0p);
01554                         snf0p = sqrt((snf0p > 0.) ? snf0p : 0.);
01555                         if(ap[1] > M_PI) snf0p = - snf0p;
01556 
01557                         Hep3Vector x2(xnp + drp*csf0p,
01558                                         ynp + drp*snf0p,
01559                                         znp + dzp);
01560 
01561                         Hep3Vector dist((x1 - x2).x()/100.0,
01562                                         (x1 - x2).y()/100.0,
01563                                         (x1 - x2).z()/100.0);
01564 
01565                         HepPoint3D middlebis((x1.x() + x2.x())/2,
01566                                         (x1.y() + x2.y())/2,
01567                                         (x1.z() + x2.z())/2);
01568 
01569                         HepVector3D field;
01570                         MFSvc_->fieldVector(10.*middlebis,field);
01571                         field = 1000.*field;
01572 
01573                         //std::cout<<"B field: "<<field<<std::endl;
01574                         Hep3Vector dB(field.x(),
01575                                         field.y(),
01576                                         (field.z()-0.1*Bznom_));
01577 
01578 
01579                         //std::cout<<" dB: "<<dB<<std::endl;
01580 
01581 
01582                         if (field.z()) {
01583                                 double akappa(fabs(kappa));
01584                                 double sign = kappa/akappa;
01585                                 HepVector dp(3);
01586                                 dp = 0.299792458 * sign * dB.cross(dist);
01587 
01588                                 //std::cout<<"dp: "<<dp<<std::endl;
01589 
01590                                 HepVector dhp(3);
01591                                 dhp[0] = -akappa*(dp[0]*csf0p+dp[1]*snf0p);
01592                                 dhp[1] = kappa*akappa*(dp[0]*snf0p-dp[1]*csf0p);
01593                                 dhp[2] = dp[2]*akappa+dhp[1]*tanl/kappa;
01594 
01595 
01596                                 //std::cout<<"dhp: "<<dhp<<std::endl;
01597 
01598 
01599                                 ap[1] += dhp[0];
01600                                 ap[2] += dhp[1];
01601                                 ap[4] += dhp[2];
01602                         }
01603                 }
01604                 HepMatrix m_del = delApDelA(ap);
01605                 Ea_now.assign(m_del * Ea_now * m_del.T());
01606                 pivot(nextPivot);
01607                 a(ap);
01608                 Ea(Ea_now);
01609                 i++;
01610 
01611                 //std::cout<<" a: "<<a()<<std::endl;
01612         }
01613 
01614         // Estimation of the path length :
01615         double tanl_0(tracktest.a()[4]);
01616         double phi0_0(tracktest.a()[1]);
01617         double radius_0(tracktest.radius());
01618         tracktest.pivot(newPivot);
01619 
01620         double phi0_1 = tracktest.a()[1];
01621         if (fabs(phi0_1 - phi0_0) > M_PI) {
01622                 if (phi0_1 > phi0_0) phi0_1 -= 2 * M_PI;
01623                 else phi0_0 -= 2 * M_PI;
01624         }  
01625         if(phi0_1 == phi0_0) phi0_1 = phi0_0 + 1.e-10;
01626         pathl = fabs(radius_0 * (phi0_1 - phi0_0)
01627                         * sqrt(1 + tanl_0 * tanl_0));
01628         return newPivot;
01629 }

const HepPoint3D & KalFitTrack::pivot_numf ( const HepPoint3D newPivot  ) 

Sets pivot position in a given mag field.

Definition at line 1374 of file KalFitTrack.cxx.

References KalmanFit::Helix::a(), Bznom_, cos(), KalmanFit::Helix::delApDelA(), check_raw_filter::dist, KalmanFit::Helix::dr(), KalmanFit::Helix::dz(), KalmanFit::Helix::Ea(), IMagneticFieldSvc::fieldVector(), genRecEmupikp::i, inner_steps_, KalmanFit::Helix::kappa(), M_PI, M_PI2, M_PI4, M_PI8, MFSvc_, numf_, numfcor_, KalmanFit::Helix::phi0(), KalmanFit::Helix::pivot(), KalmanFit::Helix::radius(), radius_numf(), sign(), KalmanFit::Helix::tanl(), and KalmanFit::Helix::x().

Referenced by KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), KalFitAlg::smoother_anal(), KalFitAlg::smoother_calib(), KalFitElement::updateTrack(), KalFitElement::updateTrack_alreadyfound(), and KalFitElement::updateTrack_rphi().

01374                                                    {
01375 
01376         int nstep(1);
01377         HepPoint3D  delta_x((newPivot-pivot()).x()/double(inner_steps_),
01378                         (newPivot-pivot()).y()/double(inner_steps_),
01379                         (newPivot-pivot()).z()/double(inner_steps_));
01380         int i = 1;
01381 
01382         while (i <= inner_steps_) {
01383                 HepPoint3D nextPivot(pivot()+delta_x);
01384                 double xnp(nextPivot.x()), ynp(nextPivot.y()), znp(nextPivot.z());  
01385                 HepSymMatrix Ea_now = Ea();
01386                 HepPoint3D piv(pivot());
01387                 double xp(piv.x()), yp(piv.y()), zp(piv.z());  
01388                 double dr    = a()[0];
01389                 double phi0  = a()[1];
01390                 double kappa = a()[2];
01391                 double dz    = a()[3];
01392                 double tanl  = a()[4];
01393                 double m_rad(0);
01394                 if (numfcor_ == 1)
01395                         m_rad = radius_numf();
01396                 else
01397                         m_rad = radius();
01398                 double rdr = dr + m_rad;
01399                 double phi = fmod(phi0 + M_PI4, M_PI2);
01400                 double csf0 = cos(phi);
01401                 double snf0 = (1. - csf0) * (1. + csf0);
01402                 snf0 = sqrt((snf0 > 0.) ? snf0 : 0.);
01403                 if(phi > M_PI) snf0 = - snf0;
01404 
01405                 double xc = xp + rdr * csf0;
01406                 double yc = yp + rdr * snf0;
01407                 double csf = (xc - xnp) / m_rad;
01408                 double snf = (yc - ynp) / m_rad;
01409                 double anrm = sqrt(csf * csf + snf * snf);
01410                 csf /= anrm;
01411                 snf /= anrm;
01412                 phi = atan2(snf, csf);
01413                 double phid = fmod(phi - phi0 + M_PI8, M_PI2);
01414                 if(phid > M_PI) phid = phid - M_PI2;
01415                 double drp = (xp + dr * csf0 + m_rad * (csf0 - csf) - xnp)
01416                         * csf
01417                         + (yp + dr * snf0 + m_rad * (snf0 - snf) - ynp) * snf;
01418                 double dzp = zp + dz - m_rad * tanl * phid - znp;
01419 
01420                 HepVector ap(5);
01421                 ap[0] = drp;
01422                 ap[1] = fmod(phi + M_PI4, M_PI2);
01423                 ap[2] = kappa;
01424                 ap[3] = dzp;
01425                 ap[4] = tanl;
01426 
01427                 // Modification due to non uniform magnetic field :
01428                 if (numf_ > 10) {
01429 
01430                         Hep3Vector x1(xp + dr*csf0, yp + dr*snf0, zp + dz);
01431                         double csf0p = cos(ap[1]);
01432                         double snf0p = (1. - csf0p) * (1. + csf0p);
01433                         snf0p = sqrt((snf0p > 0.) ? snf0p : 0.);
01434                         if(ap[1] > M_PI) snf0p = - snf0p;
01435 
01436                         Hep3Vector x2(xnp + drp*csf0p,
01437                                         ynp + drp*snf0p,
01438                                         znp + dzp);
01439                         Hep3Vector dist((x1 - x2).x()/100.0,
01440                                         (x1 - x2).y()/100.0,
01441                                         (x1 - x2).z()/100.0);
01442                         HepPoint3D middlebis((x1.x() + x2.x())/2,
01443                                         (x1.y() + x2.y())/2,
01444                                         (x1.z() + x2.z())/2);
01445                         HepVector3D field;
01446                         MFSvc_->fieldVector(10.*middlebis,field); 
01447                         field = 1000.*field;
01448                         Hep3Vector dB(field.x(),
01449                                         field.y(),
01450                                         (field.z()-0.1*Bznom_));
01451                         if (field.z()) {
01452                                 double akappa(fabs(kappa));
01453                                 double sign = kappa/akappa;
01454                                 HepVector dp(3);
01455                                 dp = 0.299792458 * sign * dB.cross(dist);
01456                                 HepVector dhp(3);
01457                                 dhp[0] = -akappa*(dp[0]*csf0p+dp[1]*snf0p);
01458                                 dhp[1] = kappa*akappa*(dp[0]*snf0p-dp[1]*csf0p);
01459                                 dhp[2] = dp[2]*akappa+dhp[1]*tanl/kappa;
01460                                 if (numfcor_ == 0){
01461                                         ap[1] += dhp[0];
01462                                 }
01463                                 ap[2] += dhp[1];
01464                                 ap[4] += dhp[2];
01465                         }
01466                 }
01467                 HepMatrix m_del = delApDelA(ap);
01468                 Ea_now.assign(m_del * Ea_now * m_del.T());
01469                 pivot(nextPivot);
01470                 a(ap);
01471                 Ea(Ea_now);
01472                 i++;
01473         }
01474         return newPivot;
01475 }

const HepPoint3D& KalFitTrack::point_last ( void   )  [inline]

Definition at line 142 of file KalFitTrack.h.

References point_last_.

00142 { return point_last_;} 

void KalFitTrack::point_last ( const HepPoint3D point  )  [inline]

set and give out the last point of the track

Definition at line 141 of file KalFitTrack.h.

References point_last_.

Referenced by KalFitAlg::fillTds_back(), and KalFitAlg::smoother_anal().

00141 { point_last_ = point;} 

double KalFitTrack::r0 ( void   )  const [inline]

Definition at line 181 of file KalFitTrack.h.

References r0_.

00181 { return r0_; }

double KalFitTrack::r_max ( void   )  const [inline]

Definition at line 197 of file KalFitTrack.h.

References r_max_.

00197 { return r_max_; }

double Helix::radius ( void   )  const [inline, inherited]

returns radious of helix.

Definition at line 206 of file Helix.h.

References Helix::m_r.

Referenced by chi2_next(), eloss(), KalFitAlg::fillTds_back(), KalFitCylinder::intersect(), intersect_cylinder(), intersect_xy_plane(), intersect_yz_plane(), intersect_zx_plane(), pivot_numf(), and KalFitAlg::smoother_anal().

00206                         {
00207     return m_r;
00208 }

double KalFitTrack::radius_numf ( void   )  const

Estimation of the radius in a given mag field.

Definition at line 1336 of file KalFitTrack.cxx.

References KalmanFit::Helix::a(), Bznom_, cos(), KalmanFit::Helix::dr(), KalmanFit::Helix::dz(), IMagneticFieldSvc::fieldVector(), M_PI, M_PI2, M_PI4, MFSvc_, numf_, KalmanFit::Helix::phi0(), KalmanFit::Helix::pivot(), and KalmanFit::Helix::x().

Referenced by KalFitAlg::fillTds_back(), and pivot_numf().

01336                                           {
01337 
01338         double Bz(Bznom_);
01339         //std::cout<<"Bz: "<<Bz<<std::endl;
01340         if (numf_ > 10){
01341                 double dr    = a()[0];
01342                 double phi0  = a()[1];
01343                 double dz    = a()[3];
01344                 double phi = fmod(phi0 + M_PI4, M_PI2);
01345                 double csf0 = cos(phi);
01346                 double snf0 = (1. - csf0) * (1. + csf0);
01347                 snf0 = sqrt((snf0 > 0.) ? snf0 : 0.);
01348                 if(phi > M_PI) snf0 = - snf0;
01349                 //XYZPoint
01350                 HepPoint3D x0((pivot().x() + dr*csf0),
01351                                 (pivot().y() + dr*snf0),
01352                                 (pivot().z() + dz));
01353 
01354                 //XYZVector b;
01355                 HepVector3D b;
01356 
01357                 //std::cout<<"b: "<<b<<std::endl;
01358 
01359                 MFSvc_->fieldVector(10.*x0, b);
01360 
01361                 //std::cout<<"b: "<<b<<std::endl;
01362 
01363 
01364                 b = 10000.*b;
01365                 Bz = b.z();
01366         }
01367         if (Bz == 0)
01368                 Bz = Bznom_;
01369         double ALPHA_loc = 10000./2.99792458/Bz;
01370         return ALPHA_loc / a()[2];
01371 }

void KalFitTrack::resetLayerUsed (  )  [inline]

Definition at line 343 of file KalFitTrack.h.

References genRecEmupikp::i, and myLayerUsed.

00343                               {
00344                 for(int i=0; i<43; i++) myLayerUsed[i]=0;
00345         }

void KalFitTrack::resol ( int  i  )  [static]

Definition at line 1831 of file KalFitTrack.cxx.

References resolflag_.

01831 { resolflag_ = i;}

int KalFitTrack::resol ( void   )  [static]

Definition at line 1832 of file KalFitTrack.cxx.

References resolflag_.

Referenced by KalFitAlg::initialize().

01832 { return resolflag_;}

void Helix::set ( const HepPoint3D pivot,
const HepVector &  a,
const HepSymMatrix &  Ea 
) [inherited]

sets helix pivot position, parameters, and error matrix.

Definition at line 375 of file Helix.cxx.

References Helix::m_a, Helix::m_Ea, Helix::m_matrixValid, Helix::m_pivot, and Helix::updateCache().

00377                                     {
00378     m_pivot = pivot;
00379     m_a = a;
00380     m_Ea = Ea;
00381     m_matrixValid = true;
00382     updateCache();
00383 }

void KalFitTrack::setIMdcGeomSvc ( IMdcGeomSvc igeomsvc  )  [static]

Definition at line 239 of file KalFitTrack2.cxx.

References iGeomSvc_.

Referenced by KalFitAlg::setGeomSvc_init().

00240 {
00241         iGeomSvc_ = igeomsvc;
00242 }

void KalFitTrack::setInitMatrix ( HepSymMatrix  m  )  [static]

Definition at line 37 of file KalFitTrack2.cxx.

References initMatrix_.

Referenced by KalFitAlg::kalman_fitting_calib(), KalFitAlg::kalman_fitting_csmalign(), and KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew().

00038 { 
00039         initMatrix_ = m;
00040 }

void KalFitTrack::setMagneticFieldSvc ( IMagneticFieldSvc  )  [static]

Definition at line 228 of file KalFitTrack2.cxx.

References MFSvc_.

Referenced by KalFitAlg::initialize().

00229 {
00230         /*ISvcLocator* svcLocator = Gaudi::svcLocator();
00231           StatusCode sc = svcLocator->service("MagneticFieldSvc",MFSvc_);
00232           if (sc.isFailure()){
00233           std::cout << "Could not load MagneticFieldSvc!" << std::endl;
00234           }*/
00235         MFSvc_ = mf;
00236         if(MFSvc_==0) cout<<"KalFitTrack2:: Could not load MagneticFieldSvc!"<<endl;
00237 } 

void KalFitTrack::setMdcCalibFunSvc ( const MdcCalibFunSvc calibsvc  )  [static]

Definition at line 223 of file KalFitTrack2.cxx.

References CalibFunSvc_.

Referenced by KalFitAlg::setCalibSvc_init().

00224 {
00225         CalibFunSvc_ = calibsvc;
00226 }

void KalFitTrack::setMdcDigiCol ( MdcDigiCol digicol  )  [static]

Definition at line 244 of file KalFitTrack2.cxx.

References mdcDigiCol_.

Referenced by KalFitAlg::execute().

00245 {
00246         mdcDigiCol_ = digicol;
00247 }

void KalFitTrack::setT0 ( double  t0  )  [static]

Definition at line 47 of file KalFitTrack2.cxx.

References debug_, and EventT0_.

Referenced by KalFitAlg::execute().

00048 {
00049         //------------------set  event  start time-----------
00050 
00051         EventT0_ = eventstart;
00052         if(debug_ == 4) {
00053                 std::cout<<"in function KalFitTrack::setT0(...), EventT0_ = "<<EventT0_<<std::endl;
00054         }
00055 }

double Helix::sinPhi0 ( void   )  const [inline, inherited]

Definition at line 306 of file Helix.h.

References Helix::m_sp.

00306                          {
00307     return m_sp;
00308 }

double KalFitTrack::smoother_Mdc ( KalFitHitMdc HitMdc,
CLHEP::Hep3Vector &  meas,
KalFitHelixSeg seg,
double &  dchi2,
int  csmflag 
)

double KalFitTrack::smoother_Mdc ( KalFitHelixSeg seg,
CLHEP::Hep3Vector &  meas,
int &  flg,
int  csmflag 
)

Kalman smoother for Mdc.

Referenced by KalFitAlg::smoother_anal(), and KalFitAlg::smoother_calib().

double KalFitTrack::smoother_Mdc_csmalign ( KalFitHelixSeg seg,
CLHEP::Hep3Vector &  meas,
int &  flg,
int  csmflag 
)

Referenced by KalFitAlg::smoother_calib().

double Helix::tanl ( void   )  const [inline, inherited]

Definition at line 242 of file Helix.h.

References Helix::m_ac.

Referenced by KalmanFit::Helix::approach(), chi2_next(), KalFitAlg::fillTds_back(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), KalFitCylinder::intersect(), intersect_xy_plane(), ms(), msgasmdc(), pivot_numf(), KalFitAlg::smoother_anal(), KalFitAlg::smoother_calib(), and tof().

00242                       {
00243     return m_ac[4];
00244 }

double KalFitTrack::tof ( void   )  const [inline]

Definition at line 191 of file KalFitTrack.h.

References tof_.

Referenced by msgasmdc(), and path_add().

00191 { return tof_; }

void KalFitTrack::tof ( double  path  ) 

Update the tof estimation.

Definition at line 1311 of file KalFitTrack.cxx.

References KalmanFit::Helix::kappa(), MASS, mass_, p_kaon_, p_proton_, KalmanFit::Helix::tanl(), tof_, tof_kaon_, tof_proton_, and tofall_.

Referenced by KalFitAlg::fillTds_back().

01312 {
01313         double light_speed( 29.9792458 );     // light speed in cm/nsec
01314         double t = tanl();
01315         double pmag( sqrt( 1.0 + t*t ) / kappa());
01316         if (pmag !=0) {
01317                 double mass_over_p( mass_ / pmag );
01318                 double beta( 1.0 / sqrt( 1.0 + mass_over_p * mass_over_p ) );
01319                 tof_ += path / ( light_speed * beta );
01320         }
01321 
01322         if (tofall_) {
01323                 if (p_kaon_ > 0){
01324                         double massk_over_p( MASS[3] / p_kaon_ );
01325                         double beta_kaon( 1.0 / sqrt( 1.0 + massk_over_p * massk_over_p ) );
01326                         tof_kaon_ += path / (light_speed * beta_kaon);
01327                 }
01328                 if (p_proton_ > 0){
01329                         double massp_over_p( MASS[4] / p_proton_ );
01330                         double beta_proton( 1.0 / sqrt( 1.0 + massp_over_p * massp_over_p ) );
01331                         tof_proton_ += path / (light_speed * beta_proton);
01332                 }
01333         }
01334 }

double KalFitTrack::tof_kaon ( void   )  const [inline]

Definition at line 192 of file KalFitTrack.h.

References tof_kaon_.

Referenced by KalFitAlg::fillTds_back().

00192 { return tof_kaon_; }

double KalFitTrack::tof_proton ( void   )  const [inline]

Definition at line 193 of file KalFitTrack.h.

References tof_proton_.

Referenced by KalFitAlg::fillTds_back().

00193 { return tof_proton_; }

void KalFitTrack::trasan_id ( int  t  )  [inline]

Definition at line 208 of file KalFitTrack.h.

References trasan_id_.

00208 { trasan_id_ = t;}

int KalFitTrack::trasan_id ( void   )  const [inline]

Definition at line 180 of file KalFitTrack.h.

References trasan_id_.

00180 { return trasan_id_; }

void KalFitTrack::type ( int  t  )  [inline]

Reinitialize (modificator).

Definition at line 207 of file KalFitTrack.h.

References type_.

00207 { type_ = t;}

int KalFitTrack::type ( void   )  const [inline]

Definition at line 179 of file KalFitTrack.h.

References type_.

Referenced by KalFitAlg::kalman_fitting_anal(), KalFitAlg::kalman_fitting_calib(), KalFitAlg::kalman_fitting_csmalign(), and KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew().

00179 { return type_; }

void KalFitTrack::update_bit ( int  i  ) 

Definition at line 1807 of file KalFitTrack.cxx.

References ganga-rec::j, pat1_, and pat2_.

01807                                  {
01808         int j(0);
01809         if (i < 31){
01810                 j = (int) pow(2.,i);
01811                 if (!(pat1_ & j))
01812                         pat1_ = pat1_ | j;
01813         } else if (i < 50) {
01814                 j = (int) pow(2.,(i-31));
01815                 if (!(pat2_ & j))
01816                         pat2_ = pat2_ | j;
01817         }
01818 }

void KalFitTrack::update_forMdc ( void   ) 

Definition at line 116 of file KalFitTrack.cxx.

References KalmanFit::Helix::a(), a_forMdc_, KalmanFit::Helix::Ea(), Ea_forMdc_, KalmanFit::Helix::pivot(), and pivot_forMdc_.

00117 {
00118         pivot_forMdc_ = pivot();
00119         a_forMdc_ = a();
00120         Ea_forMdc_ = Ea();
00121 }

double KalFitTrack::update_hits ( KalFitHelixSeg HelixSeg,
int  inext,
CLHEP::Hep3Vector &  meas,
int  way,
double &  dchi2,
int  csmflag 
)

double KalFitTrack::update_hits ( KalFitHitMdc HitMdc,
int  inext,
CLHEP::Hep3Vector &  meas,
int  way,
double &  dchi2,
double &  dtrack,
double &  dtracknew,
double &  dtdc,
int  csmflag 
)

Include the Mdc wire hits.

Referenced by KalFitAlg::filter_fwd_anal(), and KalFitAlg::filter_fwd_calib().

double KalFitTrack::update_hits_csmalign ( KalFitHelixSeg HelixSeg,
int  inext,
CLHEP::Hep3Vector &  meas,
int  way,
double &  dchi2,
int  csmflag 
)

Referenced by KalFitAlg::filter_fwd_calib().

void KalFitTrack::update_last ( void   ) 

Record the current parameters as ..._last information :.

Definition at line 109 of file KalFitTrack.cxx.

References KalmanFit::Helix::a(), a_last_, KalmanFit::Helix::Ea(), Ea_last_, KalmanFit::Helix::pivot(), and pivot_last_.

00110 {
00111         pivot_last_ = pivot();
00112         a_last_ = a();
00113         Ea_last_ = Ea();
00114 }

void KalFitTrack::useLayer ( int  iLay  )  [inline]

Definition at line 347 of file KalFitTrack.h.

References myLayerUsed.

00347                                 {
00348                 if(iLay>=0 && iLay<=43) myLayerUsed[iLay]=1;
00349         }

HepPoint3D Helix::x ( double  dPhi,
HepSymMatrix &  Ex 
) const [inherited]

returns position and convariance matrix(Ex) after rotation.

Definition at line 165 of file Helix.cxx.

References cos(), Helix::delXDelA(), Helix::m_ac, Helix::m_cp, Helix::m_Ea, Helix::m_matrixValid, Helix::m_pivot, Helix::m_r, Helix::m_sp, sin(), and Helix::x().

00165                                             {
00166     double x = m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] +phi));
00167     double y = m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] +phi));
00168     double z = m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi;
00169 
00170     //
00171     //   Calculate position error matrix.
00172     //   Ex(phi) = (@x/@a)(Ea)(@x/@a)^T, phi is deflection angle to specify the
00173     //   point to be calcualted.
00174     //
00175     // HepMatrix dXDA(3, 5, 0);
00176     // dXDA = delXDelA(phi);
00177     // Ex.assign(dXDA * m_Ea * dXDA.T());
00178 
00179     if (m_matrixValid) Ex = m_Ea.similarity(delXDelA(phi));
00180     else               Ex = m_Ea;
00181 
00182     return HepPoint3D(x, y, z);
00183 }

double * Helix::x ( double  dPhi,
double  p[3] 
) const [inherited]

Definition at line 148 of file Helix.cxx.

References cos(), Helix::m_ac, Helix::m_cp, Helix::m_pivot, Helix::m_r, Helix::m_sp, and sin().

00148                                       {
00149     //
00150     // Calculate position (x,y,z) along helix.
00151     //   
00152     // x = x0 + dr * cos(phi0) + (alpha / kappa) * (cos(phi0) - cos(phi0+phi))
00153     // y = y0 + dr * sin(phi0) + (alpha / kappa) * (sin(phi0) - sin(phi0+phi))
00154     // z = z0 + dz             - (alpha / kappa) * tan(lambda) * phi
00155     //
00156 
00157     p[0] = m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] + phi));
00158     p[1] = m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] + phi));
00159     p[2] = m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi;
00160 
00161     return p;
00162 }

HepPoint3D Helix::x ( double  dPhi = 0.  )  const [inherited]

returns position after rotating angle dPhi in phi direction.

Definition at line 131 of file Helix.cxx.

References cos(), Helix::m_ac, Helix::m_cp, Helix::m_pivot, Helix::m_r, Helix::m_sp, sin(), and Helix::x().

Referenced by KalmanFit::Helix::approach(), chi2_next(), KalFitAlg::complete_track(), KalFitAlg::fillTds_back(), KalFitAlg::filter_fwd_anal(), KalFitAlg::filter_fwd_calib(), getDriftTime(), KalFitCylinder::intersect(), KalFitAlg::kalman_fitting_anal(), KalFitAlg::kalman_fitting_calib(), KalFitAlg::kalman_fitting_csmalign(), KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew(), order_wirhit(), pivot_numf(), radius_numf(), KalFitAlg::smoother_anal(), and KalFitAlg::smoother_calib().

00131                          {
00132     //
00133     // Calculate position (x,y,z) along helix.
00134     //   
00135     // x = x0 + dr * cos(phi0) + (alpha / kappa) * (cos(phi0) - cos(phi0+phi))
00136     // y = y0 + dr * sin(phi0) + (alpha / kappa) * (sin(phi0) - sin(phi0+phi))
00137     // z = z0 + dz             - (alpha / kappa) * tan(lambda) * phi
00138     //
00139 
00140     double x = m_pivot.x() + m_ac[0] * m_cp + m_r * (m_cp - cos(m_ac[1] +phi));
00141     double y = m_pivot.y() + m_ac[0] * m_sp + m_r * (m_sp - sin(m_ac[1] +phi));
00142     double z = m_pivot.z() + m_ac[3] - m_r * m_ac[4] * phi;
00143 
00144     return HepPoint3D(x, y, z);
00145 }


Member Data Documentation

CLHEP::HepVector KalFitTrack::a_forMdc_ [private]

Definition at line 67 of file KalFitTrack.h.

Referenced by a_forMdc(), and update_forMdc().

CLHEP::HepVector KalFitTrack::a_last_ [private]

Definition at line 60 of file KalFitTrack.h.

Referenced by a_last(), and update_last().

int KalFitTrack::back_ = 1 [static, private]

Definition at line 77 of file KalFitTrack.h.

Referenced by back().

double KalFitTrack::Bznom_ = 10 [static]

Definition at line 299 of file KalFitTrack.h.

Referenced by KalFitAlg::beginRun(), KalFitAlg::execute(), KalFitAlg::initialize(), KalFitAlg::kalman_fitting_anal(), KalFitAlg::kalman_fitting_calib(), KalFitAlg::kalman_fitting_csmalign(), KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew(), pivot_numf(), and radius_numf().

const MdcCalibFunSvc * KalFitTrack::CalibFunSvc_ = 0 [static, private]

Definition at line 79 of file KalFitTrack.h.

Referenced by getDriftDist(), getDriftTime(), getSigma(), and setMdcCalibFunSvc().

double KalFitTrack::chi2_hitf_ = 1000 [static]

Cut chi2 for each hit.

Definition at line 282 of file KalFitTrack.h.

Referenced by KalFitAlg::initialize().

double KalFitTrack::chi2_hits_ = 1000 [static]

Definition at line 282 of file KalFitTrack.h.

Referenced by KalFitAlg::initialize().

double KalFitTrack::chi2mdc_hit2_ [static]

Definition at line 313 of file KalFitTrack.h.

double KalFitTrack::chiSq_ [private]

Definition at line 41 of file KalFitTrack.h.

Referenced by chiSq().

double KalFitTrack::chiSq_back_ [private]

Definition at line 43 of file KalFitTrack.h.

Referenced by chiSq_back().

const double Helix::ConstantAlpha = 333.564095 [static, inherited]

Constant alpha for uniform field.

Definition at line 162 of file Helix.h.

Referenced by KalmanFit::Helix::approach().

double KalFitTrack::dchi2_max_ [private]

Definition at line 43 of file KalFitTrack.h.

Referenced by dchi2_max().

double KalFitTrack::dchi2cutf_anal = {0.} [static]

Definition at line 288 of file KalFitTrack.h.

Referenced by KalFitAlg::setDchisqCut().

double KalFitTrack::dchi2cutf_calib = {0.} [static]

Definition at line 292 of file KalFitTrack.h.

Referenced by KalFitAlg::setDchisqCut().

double KalFitTrack::dchi2cuts_anal = {0.} [static]

Definition at line 290 of file KalFitTrack.h.

Referenced by KalFitAlg::setDchisqCut().

double KalFitTrack::dchi2cuts_calib = {0.} [static]

Definition at line 294 of file KalFitTrack.h.

Referenced by KalFitAlg::setDchisqCut().

int KalFitTrack::debug_ = 0 [static]

for debug

Definition at line 280 of file KalFitTrack.h.

Referenced by getDriftDist(), getDriftTime(), getT0(), KalFitAlg::initialize(), and setT0().

int KalFitTrack::drifttime_choice_ = 0 [static]

the drifttime choice

Definition at line 321 of file KalFitTrack.h.

Referenced by getDriftTime(), and KalFitAlg::initialize().

CLHEP::HepSymMatrix KalFitTrack::Ea_forMdc_ [private]

Definition at line 68 of file KalFitTrack.h.

Referenced by Ea_forMdc(), and update_forMdc().

CLHEP::HepSymMatrix KalFitTrack::Ea_last_ [private]

Definition at line 61 of file KalFitTrack.h.

Referenced by Ea_last(), and update_last().

double KalFitTrack::EventT0_ = 0. [static, private]

Definition at line 82 of file KalFitTrack.h.

Referenced by getT0(), and setT0().

double KalFitTrack::factor_strag_ = 0.4 [static]

factor of energy loss straggling for electron

Definition at line 310 of file KalFitTrack.h.

Referenced by eloss(), and KalFitAlg::initialize().

double KalFitTrack::fiTerm_ [private]

Definition at line 50 of file KalFitTrack.h.

Referenced by fiTerm(), and getFiTerm().

vector<KalFitHelixSeg> KalFitTrack::HelixSegs_ [private]

Definition at line 71 of file KalFitTrack.h.

Referenced by HelixSeg(), and HelixSegs().

vector<KalFitHitMdc> KalFitTrack::HitsMdc_ [private]

Definition at line 69 of file KalFitTrack.h.

Referenced by appendHitsMdc(), HitMdc(), HitsMdc(), number_wirhit(), order_hits(), and order_wirhit().

IMdcGeomSvc * KalFitTrack::iGeomSvc_ = 0 [static, private]

Definition at line 81 of file KalFitTrack.h.

Referenced by setIMdcGeomSvc().

HepSymMatrix KalFitTrack::initMatrix_ [static, private]

Definition at line 83 of file KalFitTrack.h.

Referenced by getInitMatrix(), and setInitMatrix().

int KalFitTrack::inner_steps_ = 3 [static]

Definition at line 285 of file KalFitTrack.h.

Referenced by KalFitAlg::initialize(), and pivot_numf().

int KalFitTrack::insist_ [private]

Definition at line 40 of file KalFitTrack.h.

Referenced by insist().

int KalFitTrack::l_mass_ [private]

Definition at line 39 of file KalFitTrack.h.

Referenced by chgmass(), and eloss().

int KalFitTrack::layer_prec_ [private]

Definition at line 55 of file KalFitTrack.h.

int KalFitTrack::lead_ = 2 [static, private]

Flags.

Definition at line 77 of file KalFitTrack.h.

Referenced by lead().

int KalFitTrack::LR_ = 1 [static]

Use L/R decision from MdcRecHit information :.

Definition at line 319 of file KalFitTrack.h.

Referenced by chi2_next(), KalFitAlg::initialize(), KalFitAlg::kalman_fitting_anal(), KalFitAlg::kalman_fitting_calib(), KalFitAlg::kalman_fitting_csmalign(), KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew(), and LR().

const double KalFitTrack::MASS [static, private]

Initial value:

 { 0.000510999,
        0.105658,
        0.139568,
        0.493677,
        0.938272 }

Definition at line 74 of file KalFitTrack.h.

Referenced by chgmass(), eloss(), mass(), and tof().

double KalFitTrack::mass_ [private]

Definition at line 37 of file KalFitTrack.h.

Referenced by chgmass(), chi2_next(), eloss(), mass(), ms(), msgasmdc(), and tof().

MdcDigiCol * KalFitTrack::mdcDigiCol_ = 0 [static, private]

Definition at line 84 of file KalFitTrack.h.

Referenced by getDriftTime(), and setMdcDigiCol().

double KalFitTrack::mdcGasRadlen_ = 0. [static]

Definition at line 274 of file KalFitTrack.h.

Referenced by msgasmdc(), and KalFitAlg::setBesFromGdml().

const IMagneticFieldSvc * KalFitTrack::MFSvc_ = 0 [static, private]

Definition at line 80 of file KalFitTrack.h.

Referenced by pivot_numf(), radius_numf(), and setMagneticFieldSvc().

CLHEP::Hep3Vector KalFitTrack::mom_[43] [private]

Definition at line 53 of file KalFitTrack.h.

Referenced by mom().

int KalFitTrack::myLayerUsed[43] [private]

Definition at line 353 of file KalFitTrack.h.

Referenced by nLayerUsed(), resetLayerUsed(), and useLayer().

unsigned int KalFitTrack::ncath_ [private]

Definition at line 42 of file KalFitTrack.h.

Referenced by ncath().

unsigned int KalFitTrack::nchits_ [private]

Definition at line 42 of file KalFitTrack.h.

Referenced by nchits().

unsigned int KalFitTrack::ndf_back_ [private]

Definition at line 42 of file KalFitTrack.h.

Referenced by ndf_back().

int KalFitTrack::nhit_r_ [private]

Definition at line 56 of file KalFitTrack.h.

Referenced by add_nhit_r(), and nhit_r().

int KalFitTrack::nhit_z_ [private]

Definition at line 56 of file KalFitTrack.h.

Referenced by add_nhit_z(), and nhit_z().

int KalFitTrack::nmdc_hit2_ = 500 [static]

Cut chi2 for each hit.

Definition at line 312 of file KalFitTrack.h.

Referenced by KalFitAlg::initialize().

unsigned int KalFitTrack::nster_ [private]

Definition at line 42 of file KalFitTrack.h.

Referenced by nster().

int KalFitTrack::numf_ = 0 [static]

Flag for treatment of non-uniform mag field.

Definition at line 284 of file KalFitTrack.h.

Referenced by KalFitAlg::initialize(), numf(), pivot_numf(), and radius_numf().

int KalFitTrack::numfcor_ = 1 [static]

NUMF treatment improved.

Definition at line 297 of file KalFitTrack.h.

Referenced by KalFitAlg::beginRun(), KalFitAlg::execute(), KalFitAlg::initialize(), and pivot_numf().

int KalFitTrack::outer_steps_ = 3 [static]

Definition at line 286 of file KalFitTrack.h.

Referenced by KalFitAlg::initialize(), and pivot_numf().

double KalFitTrack::p_kaon_ [private]

Definition at line 46 of file KalFitTrack.h.

Referenced by eloss(), p_kaon(), and tof().

double KalFitTrack::p_proton_ [private]

Definition at line 46 of file KalFitTrack.h.

Referenced by eloss(), p_proton(), and tof().

int KalFitTrack::pat1_ [private]

Definition at line 54 of file KalFitTrack.h.

Referenced by pat1(), and update_bit().

int KalFitTrack::pat2_ [private]

Definition at line 54 of file KalFitTrack.h.

Referenced by pat2(), and update_bit().

double KalFitTrack::path_ab_ [private]

Definition at line 43 of file KalFitTrack.h.

Referenced by path_ab().

double KalFitTrack::path_rd_ [private]

Definition at line 43 of file KalFitTrack.h.

Referenced by ms(), msgasmdc(), and path_rd().

double KalFitTrack::pathip_ [private]

Definition at line 43 of file KalFitTrack.h.

Referenced by msgasmdc(), path_add(), and pathip().

double KalFitTrack::PathL_[43] [private]

Definition at line 48 of file KalFitTrack.h.

Referenced by pathl().

double KalFitTrack::pathSM_ [private]

Definition at line 49 of file KalFitTrack.h.

Referenced by addPathSM(), and getPathSM().

HepPoint3D KalFitTrack::pivot_forMdc_ [private]

Definition at line 66 of file KalFitTrack.h.

Referenced by pivot_forMdc(), and update_forMdc().

HepPoint3D KalFitTrack::pivot_last_ [private]

Definition at line 59 of file KalFitTrack.h.

Referenced by pivot_last(), and update_last().

HepPoint3D KalFitTrack::point_last_ [private]

Definition at line 62 of file KalFitTrack.h.

Referenced by point_last().

double KalFitTrack::r0_ [private]

Definition at line 47 of file KalFitTrack.h.

Referenced by eloss(), and r0().

double KalFitTrack::r_max_ [private]

Definition at line 43 of file KalFitTrack.h.

Referenced by r_max().

int KalFitTrack::resolflag_ = 0 [static]

wire resoltion flag

Definition at line 316 of file KalFitTrack.h.

Referenced by chi2_next(), and resol().

int KalFitTrack::steplev_ = 0 [static]

Level of precision (= 1 : 5steps for all tracks; = 2: 5 steps for very non uniform part)

Definition at line 302 of file KalFitTrack.h.

Referenced by KalFitAlg::initialize().

int KalFitTrack::strag_ = 1 [static]

Flag to take account of energy loss straggling :.

Definition at line 308 of file KalFitTrack.h.

Referenced by eloss(), and KalFitAlg::initialize().

double KalFitTrack::tof2_ [private]

Definition at line 51 of file KalFitTrack.h.

Referenced by addTofSM(), and getTofSM().

double KalFitTrack::tof_ [private]

Definition at line 43 of file KalFitTrack.h.

Referenced by tof().

int KalFitTrack::Tof_correc_ = 1 [static]

Flag for TOF correction.

Definition at line 305 of file KalFitTrack.h.

Referenced by chi2_next(), and KalFitAlg::initialize().

double KalFitTrack::tof_kaon_ [private]

Definition at line 45 of file KalFitTrack.h.

Referenced by tof(), and tof_kaon().

double KalFitTrack::tof_proton_ [private]

Definition at line 45 of file KalFitTrack.h.

Referenced by tof(), and tof_proton().

int KalFitTrack::tofall_ = 1 [static]

Definition at line 314 of file KalFitTrack.h.

Referenced by KalFitAlg::complete_track(), eloss(), KalFitAlg::fillTds_back(), KalFitAlg::initialize(), and tof().

int KalFitTrack::tprop_ = 1 [static]

for signal propagation correction

Definition at line 277 of file KalFitTrack.h.

Referenced by getDriftTime(), and KalFitAlg::initialize().

int KalFitTrack::trasan_id_ [private]

Definition at line 38 of file KalFitTrack.h.

Referenced by trasan_id().

int KalFitTrack::type_ [private]

Definition at line 36 of file KalFitTrack.h.

Referenced by type().


Generated on Tue Nov 29 23:19:55 2016 for BOSS_7.0.2 by  doxygen 1.4.7