/usr/include/HepMC/SimpleVector.h 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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | //////////////////////////////////////////////////////////////////////////
// SimpleVector.h
//////////////////////////////////////////////////////////////////////////
#ifndef HEPMC_SIMPLEVECTOR_H
#define HEPMC_SIMPLEVECTOR_H
//////////////////////////////////////////////////////////////////////////
// garren@fnal.gov, July 2006
//
// This header provides a place to hold the doubles which are part of one of
// three types of physics vectors:
// momentum 4 vector
// position or displacement 4 vector
// position or displacement 3 vector
//
// For compatibility with existing code,
// the basic expected geometrical access methods are povided
// Also, both FourVector and ThreeVector have a templated constructor that will
// take another vector (HepLorentzVector, GenVector, ...)
// --> this vector must have the following methods: x(), y(), z()
// --> FourVector also requires the t() method
//
//////////////////////////////////////////////////////////////////////////
#include "HepMC/enable_if.h"
#include "HepMC/is_arithmetic.h"
namespace HepMC {
//! FourVector is a simple representation of a physics 4 vector
///
/// \class FourVector
/// For compatibility with existing code,
/// the basic expected geometrical access methods are povided.
/// Also, there is a templated constructor that will
/// take another vector (HepLorentzVector, GenVector, ...)
/// which must have the following methods: x(), y(), z(), t().
///
class FourVector {
public:
/// constructor requiring at least x, y, and z
FourVector( double xin, double yin, double zin, double tin=0)
: m_x(xin), m_y(yin), m_z(zin), m_t(tin) {}
/// constructor requiring only t
FourVector(double tin)
: m_x(0), m_y(0), m_z(0), m_t(tin) {}
FourVector()
: m_x(0), m_y(0), m_z(0), m_t(0) {}
/// templated constructor
/// this is used ONLY if T is not arithmetic
template <class T >
FourVector( const T& v,
typename detail::disable_if< detail::is_arithmetic<T>::value, void >::type * = 0 )
: m_x(v.x()), m_y(v.y()), m_z(v.z()), m_t(v.t()) {}
/// copy constructor
FourVector(const FourVector & v)
: m_x(v.x()), m_y(v.y()), m_z(v.z()), m_t(v.t()) {}
void swap( FourVector & other ); //!< swap
double px() const { return m_x; } //!< return px
double py() const { return m_y; } //!< return py
double pz() const { return m_z; } //!< return pz
double e() const { return m_t; } //!< return E
double x() const { return m_x; } //!< return x
double y() const { return m_y; } //!< return y
double z() const { return m_z; } //!< return z
double t() const { return m_t; } //!< return t
double m2() const; //!< Invariant mass squared.
double m() const; //!< Invariant mass. If m2() is negative then -sqrt(-m2()) is returned.
double perp2() const; //!< Transverse component of the spatial vector squared.
double perp() const; //!< Transverse component of the spatial vector (R in cylindrical system).
// Get spatial vector components in spherical coordinate system.
double theta() const; //!< The polar angle.
double phi() const; //!< The azimuth angle.
double rho() const; //!< spatial vector component magnitude
FourVector & operator = (const FourVector &); //!< make a copy
bool operator == (const FourVector &) const; //!< equality
bool operator != (const FourVector &) const; //!< inequality
double pseudoRapidity() const; //!< Returns the pseudo-rapidity, i.e. -ln(tan(theta/2))
double eta() const; //!< Pseudorapidity (of the space part)
/// set x, y, z, and t
void set (double x, double y, double z, double t);
void setX(double xin) { m_x=xin; } //!< set x
void setY(double yin) { m_y=yin; } //!< set y
void setZ(double zin) { m_z=zin; } //!< set z
void setT(double tin) { m_t=tin; } //!< set t
void setPx(double xin) { m_x=xin; } //!< set px
void setPy(double yin) { m_y=yin; } //!< set py
void setPz(double zin) { m_z=zin; } //!< set pz
void setE(double tin) { m_t=tin; } //!< set E
private:
double m_x;
double m_y;
double m_z;
double m_t;
};
//! ThreeVector is a simple representation of a position or displacement 3 vector
///
/// \class ThreeVector
/// For compatibility with existing code,
/// the basic expected geometrical access methods are povided.
/// Also, there is a templated constructor that will
/// take another vector (HepLorentzVector, GenVector, ...)
/// which must have the following methods: x(), y(), z().
///
class ThreeVector {
public:
/// construct using x, y, and z (only x is required)
ThreeVector( double xin, double yin =0, double zin =0 )
: m_x(xin), m_y(yin), m_z(zin) {}
ThreeVector( )
: m_x(0), m_y(0), m_z(0) {}
/// templated constructor
/// this is used ONLY if T is not arithmetic
template <class T >
ThreeVector( const T& v,
typename detail::disable_if< detail::is_arithmetic<T>::value, void >::type * = 0 )
: m_x(v.x()), m_y(v.y()), m_z(v.z()) {}
/// copy constructor
ThreeVector(const ThreeVector & v)
: m_x(v.x()), m_y(v.y()), m_z(v.z()) {}
void swap( ThreeVector & other ); //!< swap
double x() const { return m_x; } //!< return x
double y() const { return m_y; } //!< return y
double z() const { return m_z; } //!< return z
void setX(double xin) { m_x=xin; } //!< set x
void setY(double yin) { m_y=yin; } //!< set y
void setZ(double zin) { m_z=zin; } //!< set z
void set( double x, double y, double z); //!< set x, y, and z
double phi() const; //!< The azimuth angle.
double theta() const; //!< The polar angle.
double r() const; //!< The magnitude
void setPhi(double); //!< Set phi keeping magnitude and theta constant (BaBar).
void setTheta(double); //!< Set theta keeping magnitude and phi constant (BaBar).
double perp2() const; //!< The transverse component squared (rho^2 in cylindrical coordinate system).
double perp() const; //!< The transverse component (rho in cylindrical coordinate system).
ThreeVector & operator = (const ThreeVector &); //!< make a copy
bool operator == (const ThreeVector &) const; //!< equality
bool operator != (const ThreeVector &) const; //!< inequality
private:
double m_x;
double m_y;
double m_z;
};
} // HepMC
#include "HepMC/SimpleVector.icc"
#endif // HEPMC_SIMPLEVECTOR_H
|