/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/MdcPatRec/TrkBase/TrkBase-00-01-12/TrkBase/TrkDifPieceTraj.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: TrkDifPieceTraj.h,v 1.1.1.1 2005/04/21 06:01:42 zhangy Exp $
00004 //
00005 //  Description:
00006 //  Differential form of the Piecewise compound trajectory class.  Note that this
00007 //  is now a FULLY IMPLEMENTED CLASS, which completely and generally satisfies
00008 //  the Kalman track interface.  Note also that it's now possible to have a
00009 //  heterogenous collection of TrkSimpTrajs (IE you can append difLines on to
00010 //  difHelixes).
00011 //
00012 // Copyright Information:
00013 //      Copyright (C) 1996      Lawrence Berkeley Laboratory
00014 //
00015 //  Authors: Dave Brown, 3/17/97
00016 //-----------------------------------------------------------------------------
00017 #ifndef TRKDIFPIECETRAJ_HH
00018 #define TRKDIFPIECETRAJ_HH
00019 #include "TrkBase/TrkSimpTraj.h"
00020 #include "TrkBase/TrkKalDeriv.h"
00021 #include "TrkBase/TrkDirection.h"
00022 #include <vector>
00023 #include <deque>
00024 
00025 #include <iosfwd>
00026 class TrkErrCode;
00027 
00028 class TrkDifPieceTraj :  public TrkDifTraj , public TrkKalDeriv {
00029 public:
00030 
00031 //***
00032 //  Constructors
00033 //***
00034   TrkDifPieceTraj(const TrkSimpTraj&,const double lowlim ,const double hilim );
00035 // same as above, except it _TAKES OWNERSHIP_ of the traj
00036   TrkDifPieceTraj(TrkSimpTraj*,const double lowlim ,const double hilim );
00037   TrkDifPieceTraj(const TrkDifPieceTraj& ); // copy constructor
00038 // construct from a vector of simptrajs (which will be cloned).  The first segment will define
00039 // the global flightlength origin, and subsequent global lengths will be computed using POCA.
00040   TrkDifPieceTraj(const std::vector<TrkSimpTraj*>& trajs);
00041   virtual ~TrkDifPieceTraj();
00042   TrkDifPieceTraj& operator =(const TrkDifPieceTraj&);
00043 // validation test
00044   bool operator == (const TrkDifPieceTraj& other) const;
00045 // inversion function, which keeps the same 'trajectory' but reverses the flightlength.
00046 // this is done in-place, and returns itself
00047   TrkDifPieceTraj& invert();
00048   TrkDifPieceTraj* clone() const  {return new TrkDifPieceTraj(*this); }
00049 
00050 //***
00051 //  Differential functions: all are implemented here as call downs
00052 //***
00053   void getDFInfo(double fltLen, DifPoint& pos, DifVector& direction,
00054                  DifVector& delDirect) const;
00055   void getDFInfo2(double fltlen, DifPoint& pos, DifVector& direction) const;
00056 
00057 //***
00058 // Normal trajectory functions: these are all fully implemented as call downs
00059 //***
00060   HepPoint3D position( double ) const;
00061   Hep3Vector direction( double ) const;
00062   double curvature( double f = 0. ) const;
00063   Hep3Vector delDirect( double ) const;
00064   void  getInfo(double fltLen, HepPoint3D& , Hep3Vector& direction) const;
00065   void  getInfo(double fltLen, HepPoint3D& , Hep3Vector& direction,
00066                 Hep3Vector& delDirect) const;
00067   double distTo1stError(double s, double tol, int pathDir) const;
00068   double distTo2ndError(double s, double tol, int pathDir) const;
00069 
00070 //***
00071 //  DifPieceTraj specific functions
00072 //***
00073   const TrkSimpTraj* localTrajectory(double,double&) const; // const version
00074 // test validity of the local range given a global flightlength.
00075   bool locallyValid(double glen,double tol=0.0) const;
00076 //  Overwrite the range functions, to allow local ranges to be
00077 //  updated as well
00078 
00079   void setFlightRange(double newrange[2]);
00080 
00081 //***
00082 //  print functions
00083 //***
00084 
00085   void print(std::ostream& os) const;
00086   void printAll(std::ostream& os) const;
00087 
00088 //  append/prepend new trajectory pieces.  These will adjust the local range of the
00089 //  appended trajectory to match as best as possible (smallest gap) with the existing
00090 //  trajectory, at the specified global flight length.  The return value is the magnitude
00091 //  of the gap at the append point.  Note that this function will remove existing trajectories
00092 //  from the piecetraj if those are found to overlap with the specified global range.
00093 //
00094   const TrkErrCode& append(double gfltlen,const TrkSimpTraj&,double& gap);
00095   const TrkErrCode& prepend(double gfltlen,const TrkSimpTraj&,double& gap);
00096 // ownership-taking versions of the above
00097   const TrkErrCode& append(double gfltlen,TrkSimpTraj*,double& gap);
00098   const TrkErrCode& prepend(double gfltlen,TrkSimpTraj*,double& gap);
00099 // append entire piecetrajs together.  This will adjust the range of the first piece as
00100 // with the single piece append/prepend, but will leave the rest of the piecetraj as-is.
00101   const TrkErrCode& append(double,const TrkDifPieceTraj&,double& gap);
00102   const TrkErrCode& prepend(double,const TrkDifPieceTraj&,double& gap);
00103 //  Insert the traj 'as-is', without trying to adjust the
00104 //  local trajectories flight length to maximize continuity.  The traj will be inserted
00105 //  at the global range closest to its match with the nearest trajectory neighbors.
00106 //  The input trajectory should be disjoint from the existing pieces, otherwise existing
00107 //  pieces may get deleted.  The input trajectory must have a valid flight range.  'Empty
00108 //  spaces' in the global flightrange will be filed by clones of existing trajectories.
00109 //  Index and localTraj functions will operate on the resultant piecetraj to find the
00110 //  closest piece to the specified flightlength, although the returned local flight length
00111 //  may be outside the localtrajs range.
00112 //  This function _TAKES OWNERSHIP_ of the input traj.
00113 //
00114   const TrkErrCode& append(TrkSimpTraj* traj,double& gap);
00115   const TrkErrCode& prepend(TrkSimpTraj* traj,double& gap);
00116 //***
00117 //  Real versions of the base class derrivative functions
00118 //***
00119   HepMatrix derivDeflect(double fltlen,deflectDirection) const;
00120   HepMatrix derivDisplace(double fltlen,deflectDirection idir) const;
00121 
00122   HepMatrix derivPFract(double fltlen) const;
00123 protected:
00124   int resize(double len,trkDirection); // extend/shorten the trajectory.
00125 // find the trajectory index given the global flight distance:
00126   int trajIndex(const double& global,double& local) const;
00127 // global to local translation:
00128   double localDist(int index,double globdist) const {
00129     return _localtraj[index]->lowRange() + globdist - _globalrange[index];
00130   }
00131 // local to global translation
00132   double globalDist(int index,double locdist) const {
00133     return _globalrange[index] + locdist -  _localtraj[index]->lowRange();
00134   }
00135 // Data Members
00136   std::deque<TrkSimpTraj*> _localtraj; // Ordered vector of simptrajs
00137   std::deque<double> _globalrange; // local/global flight range conversion
00138   mutable int _lastIndex;  // Cache of last index used to access traj -- speeds up
00139                    // searching (iff the same piece is queried repeatedly)
00140 };
00141 #endif

Generated on Tue Nov 29 23:13:41 2016 for BOSS_7.0.2 by  doxygen 1.4.7