/usr/include/ThePEG/Vectors/Transverse.h is in libthepeg-dev 1.8.0-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 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | // -*- C++ -*-
//
// Transverse.h is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2011 Leif Lonnblad
//
// ThePEG is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef ThePEG_Transverse_H
#define ThePEG_Transverse_H
// This is the declaration of the Transverse class.
#include "ThePEG/Config/ThePEG.h"
#include "ThePEG/Vectors/Lorentz5Vector.h"
#include "Transverse.fh"
namespace ThePEG {
/**
* Transverse represents the transverse components of a
* LorentzVector. It inherits from
* <code>std::pair<Value,Value></code> and can be used
* anywhere such a pair is called for. It can also be created directly
* from a <code>ThreeVector</code>, <code>LorentzVector</code> and
* <code>Lorentz5Momentum</code>.
*
* @see Lorentz5Vector
*/
template <typename Value>
class Transverse: public pair<Value,Value> {
public:
/** Template argument typedef. */
typedef typename BinaryOpTraits<Value,Value>::MulT Value2;
/** Template argument typedef. */
typedef pair<Value,Value> BasePair;
public:
/** @name Constructors. */
//@{
/**
* Default constructor.
*/
Transverse() : BasePair(Value(), Value()) {}
/**
* Constructor from underlying representation.
*/
Transverse(const BasePair & p) : BasePair(p) {}
/**
* Constructor from x and y components.
*/
Transverse(Value x, Value y) : BasePair(x, y) {}
/**
* Constructor taking the transverse parts of a ThreeVector.
*/
Transverse(const ThreeVector<Value> & p) : BasePair(p.x(), p.y()) {}
/**
* Constructor taking the transverse parts of a LorentzVector.
*/
Transverse(const LorentzVector<Value> & p) : BasePair(p.x(), p.y()) {}
/**
* Constructor taking the transverse parts of a Lorentz5Vector.
*/
Transverse(const Lorentz5Vector<Value> & p) : BasePair(p.x(), p.y()) {}
//@}
/** @name Assignment operators. */
//@{
/**
* Assignment from underlying representation.
*/
const Transverse & operator=(const BasePair & p) {
BasePair::operator=(p);
return *this;
}
/**
* Assignment taking the transverse parts of a ThreeVector.
*/
const Transverse & operator=(const ThreeVector<Value> & p) {
BasePair::operator=(BasePair(p.x(), p.y()));
return *this;
}
/**
* Assignment taking the transverse parts of a LorentzVector.
*/
const Transverse & operator=(const LorentzVector<Value> & p) {
BasePair::operator=(BasePair(p.x(), p.y()));
return *this;
}
/**
* Assignment taking the transverse parts of a Lorentz5Vector.
*/
const Transverse & operator=(const Lorentz5Vector<Value> & p) {
BasePair::operator=(BasePair(p.x(), p.y()));
return *this;
}
//@}
/** @name Arithmetric operations */
//@{
/**
* Unary minus.
*/
Transverse operator-() const { return Transverse(-x(), -y()); }
/**
* Binary minus.
*/
Transverse operator-(const Transverse & pt) const {
return Transverse(x() - pt.x(), y() - pt.y());
}
/**
* Assign-subtract.
*/
Transverse & operator-=(const Transverse & pt) {
BasePair::first -= pt.x();
BasePair::second -= pt.y();
return *this;
}
/**
* Addition.
*/
Transverse operator+(const Transverse & pt) const {
return Transverse(x() + pt.x(), y() + pt.y());
}
/**
* Assign-add.
*/
Transverse & operator+=(const Transverse & pt) {
BasePair::first += pt.x();
BasePair::second += pt.y();
return *this;
}
/**
* Multiply-assign with a scalar.
*/
inline Transverse & operator*=(double a) {
BasePair::first *= a;
BasePair::second *= a;
return *this;
}
/**
* Divide-assign with a scalar.
*/
inline Transverse & operator/=(double a) {
BasePair::first /= a;
BasePair::second /= a;
return *this;
}
//@}
/** @name Access coordinates. */
//@{
/**
* The x-component.
*/
Value x() const { return BasePair::first; }
/**
* The y-component.
*/
Value y() const { return BasePair::second; }
/**
* The magnitude squared.
*/
Value2 pt2() const { return sqr(x()) + sqr(y()); }
/**
* The magnitude.
*/
Value pt() const { return sqrt(pt2()); }
/**
* The azimuth angle.
*/
double phi() const { return atan2(y(), x()); }
//@}
};
/** Output a Transverse with units to a stream. */
template <typename OStream, typename T, typename UT>
void ounitstream(OStream & os, const Transverse<T> & p, UT & u) {
os << ounit(p.x(), u) << ounit(p.y(), u);
}
/** Input a Transverse with units from a stream. */
template <typename IStream, typename T, typename UT>
void iunitstream(IStream & is, Transverse<T> & p, UT & u) {
T x, y;
is >> iunit(x, u) >> iunit(y, u);
p = Transverse<T>(x, y);
}
/** Multiply a Transverse with a number. */
template <typename Value>
inline Transverse<Value>
operator*(Transverse<Value> a, double b) {
return a *= b;
}
/** Multiply a number with a Transverse. */
template <typename Value>
inline Transverse<Value>
operator*(double b, Transverse<Value> a) {
return a *= b;
}
/** Multiply a (unitful) number with a Transverse. */
template <typename ValueA, typename ValueB>
inline
Transverse<typename BinaryOpTraits<ValueA,ValueB>::MulT>
operator*(ValueB a, const Transverse<ValueA> & v) {
typedef typename BinaryOpTraits<ValueB,ValueA>::MulT ResultT;
return Transverse<ResultT>(a*v.x(), a*v.y());
}
/** Multiply a Transverse with a (unitful) number. */
template <typename ValueA, typename ValueB>
inline
Transverse<typename BinaryOpTraits<ValueA,ValueB>::MulT>
operator*(const Transverse<ValueA> & v, ValueB a) {
typedef typename BinaryOpTraits<ValueB,ValueA>::MulT ResultT;
return Transverse<ResultT>(a*v.x(), a*v.y());
}
/** Divide a Transverse by a number. */
template <typename Value>
inline Transverse<double>
operator/(const Transverse<Value> & v, Value a) {
return Transverse<double>(v.x()/a, v.y()/a);
}
/** Divide a Transverse by a (unitful) number. */
template <typename ValueA, typename ValueB>
inline
Transverse<typename BinaryOpTraits<ValueA,ValueB>::DivT>
operator/(const Transverse<ValueA> & v, ValueB b) {
typedef typename BinaryOpTraits<ValueA,ValueB>::DivT ResultT;
return Transverse<ResultT>(v.x()/b, v.y()/b);
}
}
#endif /* ThePEG_Transverse_H */
|