LCOV - code coverage report
Current view: top level - TEvtGen/EvtGen/EvtGenBase - EvtVector3R.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 35 0.0 %
Date: 2016-06-14 17:26:59 Functions: 0 13 0.0 %

          Line data    Source code
       1             : //--------------------------------------------------------------------------
       2             : //
       3             : // Environment:
       4             : //      This software is part of the EvtGen package developed jointly
       5             : //      for the BaBar and CLEO collaborations.  If you use all or part
       6             : //      of it, please give an appropriate acknowledgement.
       7             : //
       8             : // Copyright Information: See EvtGen/COPYRIGHT
       9             : //      Copyright (C) 1998      Caltech, UCSB
      10             : //
      11             : // Module: EvtVector3R.cc
      12             : //
      13             : // Description: Real implementation of 3-vectors
      14             : //
      15             : // Modification history:
      16             : //
      17             : //    RYD       September 5, 1997       Module created
      18             : //
      19             : //------------------------------------------------------------------------
      20             : // 
      21             : #include "EvtGenBase/EvtPatches.hh"
      22             : #include <iostream>
      23             : #include <math.h>
      24             : #include "EvtGenBase/EvtVector3R.hh"
      25             : using std::ostream;
      26             : 
      27             : 
      28             : 
      29           0 : EvtVector3R::~EvtVector3R(){}
      30             : 
      31           0 : EvtVector3R::EvtVector3R(){
      32             :   
      33           0 :   v[0]=v[1]=v[2]=0.0;
      34           0 : }
      35             : 
      36             : 
      37           0 : EvtVector3R::EvtVector3R(double x,double y, double z){
      38             :   
      39           0 :   v[0]=x; v[1]=y; v[2]=z;
      40           0 : }
      41             : 
      42             : EvtVector3R rotateEuler(const EvtVector3R& v,
      43             :                         double alpha,double beta,double gamma){
      44             : 
      45           0 :   EvtVector3R tmp(v);
      46           0 :   tmp.applyRotateEuler(alpha,beta,gamma);
      47             :   return tmp;
      48             : 
      49           0 : }
      50             : 
      51             : 
      52             : void EvtVector3R::applyRotateEuler(double phi,double theta,double ksi){
      53             : 
      54             :   double temp[3];
      55             :   double sp,st,sk,cp,ct,ck;
      56             : 
      57           0 :   sp=sin(phi);
      58           0 :   st=sin(theta);
      59           0 :   sk=sin(ksi);
      60           0 :   cp=cos(phi);
      61           0 :   ct=cos(theta);
      62           0 :   ck=cos(ksi);
      63             : 
      64           0 :   temp[0]=( ck*ct*cp-sk*sp)*v[0]+( -sk*ct*cp-ck*sp)*v[1]+st*cp*v[2];
      65           0 :   temp[1]=( ck*ct*sp+sk*cp)*v[0]+(-sk*ct*sp+ck*cp)*v[1]+st*sp*v[2];
      66           0 :   temp[2]=-ck*st*v[0]+sk*st*v[1]+ct*v[2];
      67             : 
      68             : 
      69           0 :   v[0]=temp[0];
      70           0 :   v[1]=temp[1];
      71           0 :   v[2]=temp[2];
      72           0 : }
      73             : 
      74             : ostream& operator<<(ostream& s,const EvtVector3R& v){
      75             :  
      76           0 :   s<<"("<<v.v[0]<<","<<v.v[1]<<","<<v.v[2]<<")";
      77             : 
      78           0 :   return s;
      79             : 
      80             : }
      81             : 
      82             : 
      83             : EvtVector3R cross( const EvtVector3R& p1,const EvtVector3R& p2 ){
      84             : 
      85             :   //Calcs the cross product.  Added by djl on July 27, 1995.
      86             :   //Modified for real vectros by ryd Aug 28-96
      87             : 
      88           0 :   return EvtVector3R(p1.v[1]*p2.v[2] - p1.v[2]*p2.v[1],
      89           0 :                      p1.v[2]*p2.v[0] - p1.v[0]*p2.v[2],
      90           0 :                      p1.v[0]*p2.v[1] - p1.v[1]*p2.v[0]);
      91             : 
      92             : }
      93             : 
      94             : double EvtVector3R::d3mag() const
      95             : 
      96             : // returns the 3 momentum mag.
      97             : {
      98             :   double temp;
      99             : 
     100           0 :   temp = v[0]*v[0]+v[1]*v[1]+v[2]*v[2];
     101           0 :   temp = sqrt( temp );
     102             : 
     103           0 :   return temp;
     104             : } // r3mag
     105             : 
     106             : double EvtVector3R::dot ( const EvtVector3R& p2 ){
     107             : 
     108             :   double temp;
     109             : 
     110           0 :   temp = v[0]*p2.v[0];
     111           0 :   temp += v[0]*p2.v[0];
     112           0 :   temp += v[0]*p2.v[0];
     113             :  
     114           0 :   return temp;
     115             : } //dot
     116             : 
     117             : 
     118             : 
     119             : 
     120             : 

Generated by: LCOV version 1.11