/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/MdcPatRec/MdcData/MdcData-00-01-27/MdcData/MdcHitOnTrack.h

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: MdcHitOnTrack.h,v 1.11 2012/08/13 00:05:12 zhangy Exp $
00004 //
00005 // Description:
00006 //   Contains drift chamber hit info, as hit is used on a particular track
00007 //   Inherits from TrkHitOnTrk.  The drift distance is stored as an 
00008 //   absolute value, but returned as |drift|*ambig.  Ambiguity stored as +/- 1; 
00009 //   ambiguity = 0 => pick better value @ first call to updateMeasurement.
00010 //
00011 // Environment:
00012 //      Software developed for the BaBar Detector at the SLAC B-Factory.
00013 //
00014 // Authors: Steve Schaffner
00015 //
00016 // Revision History:
00017 //      20011018  M. Kelsey -- Make "rawTime()" public.
00018 //      20030923  M. Kelsey -- Add function to replace _dHit pointer
00019 //------------------------------------------------------------------------
00020 
00021 #ifndef MDCHITONTRACK_H
00022 #define MDCHITONTRACK_H
00023 
00024 #include "TrkBase/TrkHitOnTrk.h"
00025 #include "TrkBase/TrkEnums.h"
00026 #include "MdcGeom/Constants.h"
00027 #include <math.h>
00028 #include "CLHEP/Matrix/Vector.h"
00029 #include "CLHEP/Geometry/Point3D.h"
00030 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00031 //  backwards compatibility will be enabled ONLY in CLHEP 1.9
00032 typedef HepGeom::Point3D<double> HepPoint3D;
00033 #endif
00034 
00035 using CLHEP::Hep3Vector;
00036 class MdcHit;
00037 class MdcLayer;
00038 class Trajectory;
00039 
00040 class MdcHitOnTrack : public TrkHitOnTrk {
00041 
00042   public:
00043     MdcHitOnTrack(const TrkFundHit& fundHit, const MdcHit& baseHit,
00044         int ambig, double fittime);
00045     virtual ~MdcHitOnTrack();
00046 
00047 
00048     // MdcHitOnTrack specific functions
00049     double entranceAngleHit() const;
00050     double entranceAngle() const;
00051     double entranceAngle(const HepPoint3D pos, const Hep3Vector dir) const;
00052     // the entrance Angle is the difference in phi between the *direction* 
00053     // of the track at the hit, and the phi of the *location* of hit
00054     // Signing convention is such that tracks going to the 'left' 
00055     // are positive and the ones going to the 'right' are negative
00056     // The definition was chosen so that radially outgoing tracks have 
00057     // zero entrance angle (by construction), regardless of 'doca'
00058 
00059     double dipAngle() const;
00060     // dipangle is just pi/2 - theta of the track at the location of the hit
00061 
00062     // In general ambiguities are: -1 -> right, 0 -> don't know, +1 -> left
00063     //   note: maybe this should just be an 'enum' or even a seperate class...
00064     // Note the special case of incoming tracks (i.e. |entranceAngle()|>pi/2) 
00065     // where a track having a wire on the LEFT ( ambig()=+1) has the hit on the
00066     // RIGHT ( wireAmbig()=-1 ) of the wire
00067     int      ambig()  const  { return _ambig; }  // wire wrt track direction
00068     int     wireAmbig()  const;//   { // hit wrt the wire location
00069       //return fabs(entranceAngle())<Constants::pi/2?ambig():-ambig();} 
00070 
00071     double   fitTime()  const  { return _fitTime; }
00072     // note: drift is signed according to ambiguity...
00073     //   if ambiguity unknown, return the average of the 
00074     //   absolute value of both ambiguities, i.e. pick a positive number...
00075     double   drift()  const  { return _ambig!=0 ? _drift[_ambig<0 ? 0:1] 
00076       : (_drift[1]-_drift[0])*0.5; }
00077     double  drift(double dca)  const  { return _drift[dca<0?0:1]; }
00078     double  dcaToWire() const;
00079 
00080     double  rawTime() const;
00081 
00082     //   generic virtual functions (required by TrkHitOnTrk)
00083     virtual const Trajectory* hitTraj() const;
00084     virtual const MdcHitOnTrack* mdcHitOnTrack() const;
00085     virtual bool timeResid(double& t,double& tErr) const;
00086     virtual bool timeAbsolute(double& t,double& tErr) const;
00087 
00088     // specific virtual functions (required by MdcHitOnTrack)
00089     virtual const MdcHit*  mdcHit()  const;
00090     virtual unsigned tdcIndex()        const = 0;
00091     virtual unsigned status()           const = 0;
00092 
00093     // Forwarded to MdcHit
00094     int              wire()        const ;
00095     const MdcLayer*  layer()       const ;
00096     int              layernumber() const ;
00097     unsigned         layerNumber() const;
00098     int              whichView()   const; // 0 for axial, +/- 1 for stereo
00099     double           charge()      const;
00100 
00101     TrkEnums::TrkViewInfo whatView() const;
00102 
00103     // Set used during persistant -> transient and internally
00104     void                     setAmbig(int a) { _ambig = a<0?-1:a>0?1:0; }
00105     void                     setT0(double t0);
00106 
00107   protected:
00108 
00109     MdcHitOnTrack(const TrkFundHit *baseHit, int ambig,
00110         double fittime, int layer, int wire);
00111     MdcHitOnTrack(const MdcHitOnTrack &hitToBeCopied, TrkRep *newRep,
00112         const TrkDifTraj* trkTraj,const MdcHit *hb=0);
00113 
00114     bool              isBeyondEndflange() const 
00115     { return (hitLen() < _startLen || hitLen() > _endLen); }
00116     // return forceIteration: ambiguity flipped && hit is active
00117     bool              updateAmbiguity(double dca); 
00118 
00119     virtual TrkErrCode updateMeasurement(const TrkDifTraj* traj, bool maintainAmbiguity);
00120     //virtual TrkErrCode updateMeasurement(const TrkDifTraj* traj, bool maintainAmbiguity=false);
00121 
00122     // Allow subclasses to query or replace the underlying hit pointer
00123     const MdcHit* baseHit() const { return _dHit; }
00124     void changeBase(MdcHit* newBase);
00125 
00126   private:
00127     //  friend class MdcHOTData;//yzhang del
00128 
00129     void              updateCorrections();
00130     double            driftVelocity() const; // in cm/s
00131     bool              driftCurrent() const { return ambig()*_drift[ambig()<0?0:1]>0; }
00132 
00133 
00134     //Data members
00135     int               _ambig;  // this is the LR ambiguity wrt the TRACK 
00136     // direction;
00137     // carefull: the t->d calibration needs it wrt. 
00138     // the WIRE, and for INCOMING tracks the two are 
00139     // NOT the same.
00140     double            _drift[2];  // corrected version of what's in the FundHit,
00141     // one for each ambiguity: left, right
00142     const Trajectory* _hitTraj;
00143     double            _fitTime;   // store last value used for the fit (for calib)
00144     //   cached information to improve code speed
00145     double            _startLen;  // start hitlen traj
00146     double            _endLen;    // end hitlen traj
00147     const MdcHit *    _dHit;
00148 
00149 
00150     //  hide copy constructor and assignment operator
00151     MdcHitOnTrack(const MdcHitOnTrack&);
00152     MdcHitOnTrack& operator=(const MdcHitOnTrack&);
00153 };
00154 
00155 #endif

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