/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/MdcPatRec/MdcGeom/MdcGeom-00-01-17/src/MdcSagTraj.cxx

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: MdcSagTraj.cxx,v 1.3 2009/12/17 00:38:40 zhangy Exp $
00004 //
00005 // Description:
00006 //      Class MdcSagTraj
00007 //      
00008 //      
00009 //
00010 // Environment:
00011 //      Software developed for the BaBar Detector at the SLAC B-Factory.
00012 //
00013 // Author List:
00014 //      R. Stroili              originator
00015 //      
00016 //
00017 // Copyright Information:
00018 //      Copyright (C) 1998      INFN & Padova University
00019 // 
00020 // History:
00021 //      Migration for BESIII MDC
00022 //
00023 //------------------------------------------------------------------------
00024 
00025 //-----------------------
00026 // This Class's Header --
00027 //-----------------------
00028 #include "MdcGeom/MdcSagTraj.h"
00029 
00030 //-------------
00031 // C Headers --
00032 //-------------
00033 extern "C" {
00034 }
00035 
00036 //---------------
00037 // C++ Headers --
00038 //---------------
00039 #include <assert.h>
00040 
00041 //-------------------------------
00042 // Collaborating Class Headers --
00043 //-------------------------------
00044 #include "MdcGeom/Trajectory.h"
00045 
00046 //-----------------------------------------------------------------------
00047 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00048 //-----------------------------------------------------------------------
00049 
00050 //              ----------------------------------------
00051 //              -- Public Function Member Definitions --
00052 //              ----------------------------------------
00053 
00054 //----------------
00055 // Constructors --
00056 //----------------
00057 MdcSagTraj::MdcSagTraj( const double sag, const HepPoint3D& start, 
00058                         const HepPoint3D& stop )
00059   : TrkGeomTraj(0.0,start.distance(stop)), _sag(sag), _start(start), _stop(stop)
00060 {
00061   //_direction = stop - start;
00062   _direction = ((CLHEP::Hep3Vector) stop) - ((CLHEP::Hep3Vector) start);
00063   _length = _direction.mag();
00064   assert( _length != 0 );
00065 
00066   _direction.setMag(1.0);
00067   _a = _sag*4./(_length*_length);
00068   _b = -_a*_length;
00069 
00070 }
00071 
00072 MdcSagTraj::MdcSagTraj( const MdcSagTraj& other )
00073   : TrkGeomTraj(0.0,other._start.distance(other._stop)), 
00074     _sag(other._sag), _a(other._a), _b(other._b), _length(other._length),
00075     _start(other._start), _stop(other._stop), 
00076     _direction(other._direction)
00077 {}
00078 
00079 MdcSagTraj::~MdcSagTraj(){;}
00080 //-------------
00081 // Methods   --
00082 //-------------
00083 MdcSagTraj*
00084 MdcSagTraj::clone() const 
00085 {
00086   return new MdcSagTraj(*this);
00087 }
00088     
00089 //-------------
00090 // Operators --
00091 //-------------
00092 //-----------------------------------------------------------------------------
00093 MdcSagTraj& 
00094 MdcSagTraj::operator = (const MdcSagTraj& other) 
00095 {
00096   if(&other != this){
00097     for(int iend=0;iend<2;iend++)
00098       flightrange[iend] = other.flightrange[iend];
00099     _start = other._start;
00100     _stop = other._stop;
00101     _sag = other._sag;
00102     _a = other._a;
00103     _b = other._b;
00104     _length = other._length;
00105     _direction = other._direction;
00106   }
00107   return *this;
00108 }
00109 
00110 Hep3Vector 
00111 MdcSagTraj::deviation( double flightlen ) const 
00112 {
00113   // only correction in y
00114 //   Hep3Vector deviation(0., (_a*flightlen+_b)*flightlen, 0.);
00115 //   Hep3Vector deviaH(0.,cosh((flightlen-_length/2.)/_a_H)+_b_H,0.);
00116 //   return deviation;
00117   return Hep3Vector(0., (_a*flightlen+_b)*flightlen, 0.);
00118 }
00119 
00120 HepPoint3D
00121 MdcSagTraj::position(double flightlen) const 
00122 {
00123   static HepPoint3D tmppos;
00124   tmppos = _start;
00125 //CHANGE   tmppos += _direction*flightlen;
00126   tmppos += (HepPoint3D) _direction*flightlen;//yzhang TEMP 
00127   tmppos.setY(tmppos.y()+(_a*flightlen+_b)*flightlen);
00128   return tmppos;
00129 }
00130 
00131 Hep3Vector 
00132 MdcSagTraj::direction( double flightlen ) const {
00133   if ( flightlen <= 0. ) return _direction;
00134 //    Hep3Vector dir =  _direction*flightlen + delDirect(flightlen);
00135   static Hep3Vector tmpdir;
00136   tmpdir =  _direction*flightlen;
00137 //   register double newy = tmpdir.y() + 2.*_a*flightlen+_b;
00138 //   tmpdir.setY(newy);
00139   tmpdir.setY(tmpdir.y() + 2.*_a*flightlen+_b);
00140 //   tmpdir += delDirect(flightlen);
00141   tmpdir.setMag(1.0);
00142   return tmpdir;
00143 }
00144   
00145 Hep3Vector 
00146 MdcSagTraj::delDirect( double /*flightlen*/ ) const 
00147 {
00148   return Hep3Vector(0., 2.*_a, 0.);
00149 }
00150 
00151 void  
00152 MdcSagTraj::getInfo(double flightlen, HepPoint3D& pos, Hep3Vector& dir) const 
00153 {
00154 // std::cout<<"Dyz*"<<"MdcSagTraj01 "<<std::endl;//yzhang DEBUG
00155   // Written using +=, etc to avoid temporaries
00156   pos = _start;
00157 //CHANGE   pos += _direction*flightlen;
00158   pos += (HepPoint3D) _direction*flightlen;
00159   
00160   dir = _direction;
00161   if ( flightlen > 0. ) {
00162     pos.setY(pos.y() + deltaY(flightlen));
00163     dir.setY(dir.y() + 2.*_a*flightlen+_b);
00164     dir.setMag(1.0);
00165   }
00166 }
00167 
00168 void  
00169 MdcSagTraj::getInfo( double flightlen, HepPoint3D& pos, Hep3Vector& dir, 
00170                      Hep3Vector& delDir ) const 
00171 {
00172 //       std::cout<<"Dyz*"<<"MdcSagTraj011 "<<std::endl;//yzhang DEBUG
00173          
00174   pos = _start;
00175 //CHANGE   pos += _direction*flightlen ;
00176   pos += (HepPoint3D) _direction*flightlen ;
00177   
00178   pos.setY( pos.y() + (_a*flightlen+_b)*flightlen) ;
00179 
00180   dir = _direction;
00181   dir.setY( dir.y() + 2*_a*flightlen+_b) ;
00182   // Note: `dir' is on purpose not normalized (WDH, Jan 2003)
00183 
00184   delDir.setX(0.);
00185   delDir.setY(2.*_a);
00186   delDir.setZ(0.);
00187 }
00188 
00189 double
00190 MdcSagTraj::curvature( double /*f*/ ) const
00191 {
00192   return _sag;
00193 }
00194 
00195 double 
00196 MdcSagTraj::distTo1stError(double flightlen, double tol, int pathDir) const 
00197 {
00198   double dtmp = pathDir*2.*_a*flightlen+_b;
00199 
00200   return dtmp==0. ? 9999.e4 : fabs(tol/dtmp);
00201 }
00202   
00203 double 
00204 MdcSagTraj::distTo2ndError(double /*s*/, double /*tol*/, int /*pathDir*/) const
00205 { 
00206   return 999.e4 ;
00207   //return _a==0. ? 999.e4 : tol/(2.*_a); 
00208 }
00209 
00210 // Support Visitor pattern (see TrkGeomTraj.h)
00211 void 
00212 MdcSagTraj::accept(TrkGeomTrajVisitor& /*visitor*/) const 
00213 {
00214   std::cout<<"ErrMsg(error)"<<"accept visitor NOT implemented yet"<<std::endl;
00215 }
00216 

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