/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/MdcPatRec/MdcRecoUtil/MdcRecoUtil-00-01-08/src/DifRotation.cxx

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: DifRotation.cxx,v 1.2 2009/12/23 02:59:56 zhangy Exp $
00004 //
00005 // Description:
00006 //      Class Implementation for |DifRotation| 
00007 //      Rotates things
00008 // Environment:
00009 //      Software developed for the BaBar Detector at the SLAC B-Factory.
00010 //
00011 // Author List:
00012 //      A. Snyder
00013 //
00014 // Copyright Information:
00015 //      Copyright (C) 1996      SLAC
00016 // 
00017 // History:
00018 //      Migration for BESIII MDC
00019 //
00020 //------------------------------------------------------------------------
00021 
00022 
00023 #include "MdcRecoUtil/DifRotation.h"
00024 
00025 DifRotation::DifRotation()
00026   :_xnew(1.0,0.0,0.0),_ynew(0.0,1.0,0.0),_znew(0.0,0.0,1.0)
00027 {
00028 }
00029 
00030 DifRotation::DifRotation
00031 (const DifNumber& alpha,const DifNumber& beta,const DifNumber& gamma)
00032 {
00033   
00034   //active transformation  - move the vector (reverse sines)
00035   DifNumber calpha=cos(alpha); DifNumber salpha=-sin(alpha);
00036   DifNumber cbeta=cos(beta); DifNumber sbeta=-sin(beta);
00037   DifNumber cgamma=cos(gamma); DifNumber sgamma=-sin(gamma);
00038 
00039  _xnew.x=cbeta*calpha*cgamma-salpha*sgamma;
00040  _xnew.y=cbeta*salpha*cgamma+calpha*sgamma;
00041  _xnew.z=-sbeta*cgamma;
00042 
00043  _ynew.x=-cbeta*calpha*sgamma-salpha*cgamma;
00044  _ynew.y=-cbeta*salpha*sgamma+calpha*cgamma;
00045  _ynew.z=sbeta*sgamma;
00046 
00047  _znew.x=sbeta*calpha;
00048  _znew.y=sbeta*salpha;
00049  _znew.z=cbeta;
00050 }
00051 
00052 DifRotation::DifRotation
00053 (const DifVector& xp,const DifVector& yp,const DifVector &zp)
00054   :_xnew(xp),_ynew(yp),_znew(zp)
00055 {}                              
00056 
00057 DifRotation::DifRotation
00058 (const DifVector& xp,const DifVector& yp) 
00059   :_xnew(xp),_ynew(yp),_znew()
00060 {
00061   _znew=cross(_xnew,_ynew);
00062 }
00063 
00064 int DifRotation::fail()const {
00065   return 0;
00066 }
00067 
00068 void DifRotation::rotate(DifVector &v)const {
00069   DifNumber xcomp=xnew()*v;
00070   DifNumber ycomp=ynew()*v;
00071   DifNumber zcomp=znew()*v;
00072   v.x=xcomp; v.y=ycomp; v.z=zcomp;
00073 }

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