/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/EventDisplay/BesVisLib/BesVisLib-00-04-04/BesVisLib/vector3.h File Reference

Go to the source code of this file.

Classes

struct  vector3
struct  polar

Functions

vector3 InitV (float x, float y, float z)
vector3 InitV1 (float phi, float cosTheta, float magnitude)
float Mag (vector3 v)
float Mag2 (vector3 v)
float Dot (vector3 v1, vector3 v2)
vector3 Cross (vector3 v1, vector3 v2)
vector3 Unit (vector3 v)
vector3 Intersection (float z0, vector3 vec, vector3 pos)
vector3 TimesA (float a, vector3 v)
vector3 AddV (vector3 v1, vector3 v2)
vector3 SubV (vector3 v1, vector3 v2)
vector3 TransformFrom (vector3 v, vector3 ux, vector3 uy, vector3 uz)
vector3 TransformTo (vector3 v, vector3 ux, vector3 uy, vector3 uz)
polar XYZ2Polar (vector3 v)

Variables

const float pi = 3.1415926536
const float rad = 57.29578


Function Documentation

vector3 AddV ( vector3  v1,
vector3  v2 
)

Definition at line 93 of file vector3.h.

References v, vector3::x, vector3::y, and vector3::z.

Referenced by TransformFrom().

00094 {
00095   vector3 v;
00096   v.x = v1.x + v2.x;
00097   v.y = v1.y + v2.y;
00098   v.z = v1.z + v2.z;
00099   return v;
00100 }

vector3 Cross ( vector3  v1,
vector3  v2 
)

Definition at line 49 of file vector3.h.

References v, vector3::x, vector3::y, and vector3::z.

00050 {
00051   vector3 v;
00052   v.x = v1.y*v2.z - v1.z*v2.y;
00053   v.y = v1.z*v2.x - v1.x*v2.z;
00054   v.z = v1.x*v2.y - v1.y*v2.x;
00055   return v;
00056 }

float Dot ( vector3  v1,
vector3  v2 
)

Definition at line 42 of file vector3.h.

References vector3::x, vector3::y, and vector3::z.

00043 {
00044   return v1.x*v2.x+v1.y*v2.y+v1.z*v2.z;
00045 }

vector3 InitV ( float  x,
float  y,
float  z 
)

Definition at line 9 of file vector3.h.

References v.

00010 {
00011   vector3 v;
00012   v.x = x;
00013   v.y = y;
00014   v.z = z;
00015   return v;
00016 }

vector3 InitV1 ( float  phi,
float  cosTheta,
float  magnitude 
)

Definition at line 19 of file vector3.h.

References cos(), sin(), and v.

00020 {
00021   vector3 v;
00022   float sinTheta = sqrt(1.0-cosTheta*cosTheta);
00023   v.z = magnitude*cosTheta;
00024   v.y = magnitude*sinTheta*sin(phi);
00025   v.x = magnitude*sinTheta*cos(phi);
00026   return v;
00027 }

vector3 Intersection ( float  z0,
vector3  vec,
vector3  pos 
)

Definition at line 72 of file vector3.h.

References boss::pos, vec, vector3::x, vector3::y, and vector3::z.

00073 { 
00074   vector3 vz0;
00075   vz0.z = z0;
00076   vz0.x = (vz0.z - pos.z)*vec.x/vec.z + pos.x;
00077   vz0.y = (vz0.z - pos.z)*vec.y/vec.z + pos.y;
00078   return vz0;
00079 }

float Mag ( vector3  v  ) 

Definition at line 30 of file vector3.h.

References v.

Referenced by Unit().

00031 {
00032   return sqrt(v.x*v.x+v.y*v.y+v.z*v.z);
00033 }

float Mag2 ( vector3  v  ) 

Definition at line 36 of file vector3.h.

References v.

00037 {
00038   return v.x*v.x+v.y*v.y+v.z*v.z;
00039 }

vector3 SubV ( vector3  v1,
vector3  v2 
)

Definition at line 103 of file vector3.h.

References v, vector3::x, vector3::y, and vector3::z.

00104 { 
00105   vector3 v;
00106   v.x = v1.x - v2.x;
00107   v.y = v1.y - v2.y;
00108   v.z = v1.z - v2.z;
00109   return v;
00110 }

vector3 TimesA ( float  a,
vector3  v 
)

Definition at line 83 of file vector3.h.

References v, vector3::x, vector3::y, and vector3::z.

Referenced by TransformFrom().

00084 {
00085   vector3 vv;
00086   vv.x = a*v.x;
00087   vv.y = a*v.y;
00088   vv.z = a*v.z;
00089   return vv;
00090 }

vector3 TransformFrom ( vector3  v,
vector3  ux,
vector3  uy,
vector3  uz 
)

Definition at line 113 of file vector3.h.

References AddV(), TimesA(), and v.

00114 {
00115   ux = TimesA(v.x,ux);
00116   uy = TimesA(v.y,uy);
00117   uz = TimesA(v.z,uz);
00118   v = AddV(AddV(ux, uy), uz);
00119   return v;
00120 }

vector3 TransformTo ( vector3  v,
vector3  ux,
vector3  uy,
vector3  uz 
)

Definition at line 124 of file vector3.h.

References Dot, v, vector3::x, vector3::y, and vector3::z.

00125 {
00126   vector3 vv;
00127   vv.x = Dot(v,ux);
00128   vv.y = Dot(v,uy);
00129   vv.z = Dot(v,uz);
00130   return vv;
00131 }

vector3 Unit ( vector3  v  ) 

Definition at line 59 of file vector3.h.

References Mag(), v, vector3::x, vector3::y, and vector3::z.

00060 {
00061   vector3 vv;
00062   float p = Mag(v);
00063   vv.x = v.x/p;
00064   vv.y = v.y/p;
00065   vv.z = v.z/p;
00066   return vv;
00067 }

polar XYZ2Polar ( vector3  v  ) 

Definition at line 142 of file vector3.h.

References pi, s, and v.

00143 {
00144   polar s;
00145   float rxy;
00146 
00147   s.r = sqrt(v.x*v.x+v.y*v.y+v.z*v.z);
00148   if(s.r==0.0){
00149     s.theta = 0.0;
00150   }
00151   else{
00152     s.theta = acos(v.z/s.r);
00153   }
00154 
00155   rxy = sqrt(v.x*v.x+v.y*v.y);
00156   if(rxy==0.0){
00157     s.phi = 0.0;
00158   }
00159   else{
00160     if(v.y>=0.0) s.phi = acos(v.x/rxy);
00161     else{
00162       s.phi = 2.0*pi-acos(v.x/rxy);
00163     }
00164   }
00165 
00166   return s;
00167 }


Variable Documentation

const float pi = 3.1415926536

Definition at line 133 of file vector3.h.

Referenced by DTagTool::angleShowerwithTrack(), Dalitz::Babar_sakurai(), EmcRecCrystal::BarrelCheckout(), EvtConExc::baryon_sampling(), MdcBbEmcEff::bbEmcMdcTrackingEff(), BesMdcWire::BesMdcWire(), G4HepMCInterface::Boost(), PreXtCalib::calib(), MdcUtilitySvc::cellTrackPassed(), BesMdcConstruction::Construct(), BesSCM::Construct(), BesEvent::ConstructMdcTrackFromRec(), BesEvent::ConstructMucTrackFromRec(), TMDCTsf::createTsf(), EvtCalHelAmp::decay(), EvtConExc::difgamXs(), BesTofDigitizerBrV2::DirectPh(), THelixFitter::drift(), BesMdcGeoParameter::Dump(), EmcRecCrystal::EndCapCheckout(), EvtEulerAngles::EulerAngles(), FarmMonitorAlg::execute(), TofRec::execute(), SD0Tag::execute(), EmcRec::execute(), EventPreSelect::execute(), CalibEventSelect::execute(), BhabhaPreSelect::execute(), EvtSelExample::execute(), DQASelHadron::execute(), DQASelDimu::execute(), DQASelBhabha::execute(), DQARhopi::execute(), DQAJpsi2PPbarAlg::execute(), DQADtag::execute(), Rhopi::execute(), PipiJpsi::execute(), AbsCor::execute(), Ppjrhopi::execute(), Gam4pikp::execute(), TSegment::expandSeg(), MdcCalRecTrk::fgNoiseRatio(), MagneticFieldSvc::fieldVector(), TofCheckDigi::FillCol(), TrkReco::FillTuple(), EvtConExc::findMaxXS(), EmcSelBhaEvent::findPhiDiff(), EvtCalHelAmp::firstder(), TRungeFitter::fit(), TPiFormFactor::GS(), HTrackParameter::HTrackParameter(), BesMdcGeoParameter::InitFromFile(), BesMdcGeoParameter::InitFromSvc(), DimuPreSelect::IsDimu(), UserPi0Cut::isGoodPhoton(), TTrackManager::makeTds(), EvtConExc::meson_sampling(), HTrackParameter::minDistanceTwoHelix(), K0kpi::MTotal(), TMDCWire::neighbor(), LocalPhotonSelector::operator()(), ParticleIDBase::pdfCalculate(), BesMdcWire::Phi(), MdcNavigation::poca(), EmcRecShowerPosLogShMax::Position(), EmcRecShowerPosLoglin::Position(), EmcRecShowerPosLog::Position(), EmcRecShowerPosLinShMax::Position(), EmcRecShowerPosLin::Position(), BesMdcSD::ProcessHits(), EvtConExc::Rad1(), EvtConExc::Rad2(), MdcGeomSvc::ReadFilePar(), EvtConExc::Ros_xs(), Dalitz::sakurai(), SingleParticleGun::SingleParticleGun(), EvtConExc::SoftPhoton_xs(), BesTofDigitizerBrV2::TofPmtRspns(), update(), PreXtMdcCalib::updateConst(), Pi0EtaToGGRecAlg::validPhoton(), EvtConExc::VP_sampling(), EventPreSelect::WhetherSector(), CalibEventSelect::WhetherSector(), BhabhaPreSelect::WhetherSector(), EvtXsection::Xsection_c(), XYZ2Polar(), MdcSegInfoSterO::zPosition(), and HoughValidUpdate::zPosition().

const float rad = 57.29578

Definition at line 134 of file vector3.h.

Referenced by HTrackParameter::center(), BesMdcConstruction::Construct(), BesTofConstruction::ConstructEcTof_mrpc(), TrkLineRep::helix(), TrkCircleRep::helix(), PartProduce::lg_container(), TrkCircleTraj::paramFunc(), HelixTraj::paramFunc(), and BesHeader::SetCornerRadius().


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