/usr/include/HepMC/SimpleVector.icc is in libhepmc-dev 2.06.09-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | //////////////////////////////////////////////////////////////////////////
// SimpleVector.icc
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// garren@fnal.gov, July 2006
//
//
//////////////////////////////////////////////////////////////////////////
#include <cmath>
#include <algorithm> // for swap
namespace HepMC {
//////////////////////////////////////////////////////////////////////////
// FourVector inline methods
//////////////////////////////////////////////////////////////////////////
inline void FourVector::swap( FourVector & other ) {
std::swap( m_x, other.m_x );
std::swap( m_y, other.m_y );
std::swap( m_z, other.m_z );
std::swap( m_t, other.m_t );
}
inline FourVector & FourVector::operator=(const FourVector & v) {
m_x = v.x();
m_y = v.y();
m_z = v.z();
m_t = v.t();
return *this;
}
inline void FourVector::set(double xin, double yin, double zin, double tin) {
m_x = xin;
m_y = yin;
m_z = zin;
m_t = tin;
}
inline double FourVector::m2() const {
return m_t*m_t - (m_x*m_x + m_y*m_y + m_z*m_z);
}
inline double FourVector::m() const {
double mm = m2();
return mm < 0.0 ? -std::sqrt(-mm) : std::sqrt(mm);
}
inline double FourVector::perp2() const { return m_x*m_x + m_y*m_y; }
inline double FourVector::perp() const { return std::sqrt(perp2()); }
inline double FourVector::theta() const {
return m_x == 0.0 && m_y == 0.0 && m_z == 0.0 ? 0.0 : std::atan2(perp(),m_z);
}
inline double FourVector::phi() const {
return m_x == 0.0 && m_y == 0.0 ? 0.0 : std::atan2(m_y,m_x);
}
inline double FourVector::rho() const {
return std::sqrt( m_x*m_x + m_y*m_y + m_z*m_z );
}
inline bool FourVector::operator == (const FourVector & v) const {
return (v.x()==x() && v.y()==y() && v.z()==z() && v.t()==t()) ? true : false;
}
inline bool FourVector::operator != (const FourVector & v) const {
return (v.x()!=x() || v.y()!=y() || v.z()!=z() || v.t()!=t()) ? true : false;
}
inline double FourVector::pseudoRapidity() const {
double m1 = std::sqrt( m_x*m_x + m_y*m_y + m_z*m_z );
if ( m1== 0 ) return 0.0;
if ( m1== z() ) return 1.0E72;
if ( m1== -z() ) return -1.0E72;
return 0.5*log( (m1+z())/(m1-z()) );
}
inline double FourVector::eta() const { return pseudoRapidity();}
//////////////////////////////////////////////////////////////////////////
// ThreeVector inline methods
//////////////////////////////////////////////////////////////////////////
inline void ThreeVector::swap( ThreeVector & other ) {
std::swap( m_x, other.m_x );
std::swap( m_y, other.m_y );
std::swap( m_z, other.m_z );
}
inline double ThreeVector::theta() const {
return m_x == 0.0 && m_y == 0.0 && m_z == 0.0 ? 0.0 : std::atan2(perp(),m_z);
}
inline double ThreeVector::phi() const {
return m_x == 0.0 && m_y == 0.0 ? 0.0 : std::atan2(m_y,m_x);
}
inline double ThreeVector::r() const {
return std::sqrt( m_x*m_x + m_y*m_y + m_z*m_z );
}
inline void ThreeVector::set(double xin, double yin, double zin) {
m_x = xin;
m_y = yin;
m_z = zin;
}
inline void ThreeVector::setPhi(double ph) {
double xy = perp();
setX(xy*std::cos(ph));
setY(xy*std::sin(ph));
}
inline void ThreeVector::setTheta(double th) {
double ma = r();
double ph = phi();
setX(ma*std::sin(th)*std::cos(ph));
setY(ma*std::sin(th)*std::sin(ph));
setZ(ma*std::cos(th));
}
inline double ThreeVector::perp2() const { return m_x*m_x + m_y*m_y; }
inline double ThreeVector::perp() const { return std::sqrt(perp2()); }
inline ThreeVector & ThreeVector::operator = (const ThreeVector & p) {
m_x = p.x();
m_y = p.y();
m_z = p.z();
return *this;
}
inline bool ThreeVector::operator == (const ThreeVector& v) const {
return (v.x()==x() && v.y()==y() && v.z()==z()) ? true : false;
}
inline bool ThreeVector::operator != (const ThreeVector& v) const {
return (v.x()!=x() || v.y()!=y() || v.z()!=z()) ? true : false;
}
} // HepMC
|