thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
Unitsystem.h
1// -*- C++ -*-
2//
3// Unitsystem.h is a part of ThePEG - Toolkit for HEP Event Generation
4// Copyright (C) 1999-2019 Leif Lonnblad, David Grellscheid
5//
6// ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8//
9#ifndef ThePEG_Units_H
10#define ThePEG_Units_H
11
12#include "ThePEG/Vectors/Lorentz5Vector.fh"
13#include "ThePEG/Vectors/LorentzVector.fh"
14#include "ThePEG/Vectors/ThreeVector.fh"
15#include "ThePEG/Vectors/Transverse.fh"
16
17#include "PhysicalQty.h"
18#include "PhysicalQtyOps.h"
19#include "PhysicalQtyComplex.h"
20
21
22namespace ThePEG {
23
35namespace Units {
36
38template<long int L, long int E, long int Q, long int DL=1, long int DE=1, long int DQ=1>
39using Qty = ThePEG::Qty<std::ratio<L,DL>, std::ratio<E,DE>, std::ratio<Q,DQ>>;
40
43
45typedef Energy Mass;
46
49
51typedef Length Time;
52
54typedef Qty<-1,0,0> InvLength;
55
57typedef double Velocity;
58
61
64
66typedef Qty<-1,1,0> Tension;
67
70
72typedef Qty<-2,0,0> InvArea;
73
76
82typedef Qty<0, 2, 0> Energy2;
83typedef Qty<0, 3, 0> Energy3;
84typedef Qty<0, 4, 0> Energy4;
85typedef Qty<0, 5, 0> Energy5;
86typedef Qty<0, 6, 0> Energy6;
87typedef Qty<0, 7, 0> Energy7;
88typedef Qty<0, 8, 0> Energy8;
89typedef Qty<0, 9, 0> Energy9;
93
95typedef Qty<0,-1,0, 1,2,1> InvSqrtEnergy;
96
97typedef Qty<0, -1, 0> InvEnergy;
98typedef Qty<0, -2, 0> InvEnergy2;
99typedef Qty<0, -3, 0> InvEnergy3;
100typedef Qty<0, -4, 0> InvEnergy4;
101typedef Qty<0, -5, 0> InvEnergy5;
102typedef Qty<0, -6, 0> InvEnergy6;
103typedef Qty<0, -7, 0> InvEnergy7;
104typedef Qty<0, -8, 0> InvEnergy8;
105typedef Qty<0, -9, 0> InvEnergy9;
106typedef Qty<0,-10, 0> InvEnergy10;
107typedef Qty<0,-11, 0> InvEnergy11;
108typedef Qty<0,-12, 0> InvEnergy12;
110
113
115typedef Qty<2,-2,0> DiffXSec;
116
118typedef Qty<2,-4,0> Diff2XSec;
119
121typedef Qty<2,-6,0> Diff3XSec;
122
125
128
131
134
137
140
143
147
150
153
157
160
162
163constexpr Length operator "" _mm( long double x ) {
164 return Length{Length::baseunit(), static_cast<double>(x)};
165}
166constexpr Length operator "" _mm( unsigned long long x ) {
167 return Length{Length::baseunit(), static_cast<double>(x)};
168}
169
170constexpr Length meter = 1.0e+3_mm;
171constexpr Length millimeter = 1_mm;
172constexpr Length mm = 1_mm;
173constexpr Length centimeter = 10_mm;
174constexpr Length micrometer = 1.0e-3_mm;
175constexpr Length nanometer = 1.0e-6_mm;
176constexpr Length picometer = 1.0e-9_mm;
177constexpr Length femtometer = 1.0e-12_mm;
178
179constexpr Energy operator "" _MeV( long double x ) {
180 return Energy{Energy::baseunit(), static_cast<double>(x)};
181}
182constexpr Energy operator "" _MeV( unsigned long long x ) {
183 return Energy{Energy::baseunit(), static_cast<double>(x)};
184}
185
186constexpr Energy operator "" _GeV( long double x ) {
187 return Energy{1000_MeV, static_cast<double>(x)};
188}
189constexpr Energy operator "" _GeV( unsigned long long x ) {
190 return Energy{1000_MeV, static_cast<double>(x)};
191}
192
193constexpr Energy operator "" _TeV( long double x ) {
194 return Energy{1000_GeV, static_cast<double>(x)};
195}
196constexpr Energy operator "" _TeV( unsigned long long x ) {
197 return Energy{1000_GeV, static_cast<double>(x)};
198}
199
200constexpr Energy keV = 1.0e-3_MeV;
201constexpr Energy MeV = 1_MeV;
202constexpr Energy GeV = 1_GeV;
203constexpr Energy TeV = 1_TeV;
204
205
206
207constexpr Energy2 operator "" _MeV2( long double x ) {
208 return Energy2{Energy2::baseunit(), static_cast<double>(x)};
209}
210constexpr Energy2 operator "" _MeV2( unsigned long long x ) {
211 return Energy2{Energy2::baseunit(), static_cast<double>(x)};
212}
213
214constexpr Energy2 operator "" _GeV2( long double x ) {
215 return Energy2{1.0e+6_MeV2, static_cast<double>(x)};
216}
217constexpr Energy2 operator "" _GeV2( unsigned long long x ) {
218 return Energy2{1.0e+6_MeV2, static_cast<double>(x)};
219}
220
221constexpr Energy2 MeV2 = 1_MeV2;
222constexpr Energy2 GeV2 = 1_GeV2;
223
224constexpr InvEnergy InvGeV = 1/GeV;
225
226
227constexpr Area operator "" _pb( long double x ) {
228 return Area{1.0e-34 * Area::baseunit(), static_cast<double>(x)};
229}
230constexpr Area operator "" _pb( unsigned long long x ) {
231 return Area{1.0e-34 * Area::baseunit(), static_cast<double>(x)};
232}
233
234constexpr Area femtobarn = 1.0e-03_pb;
235constexpr Area picobarn = 1_pb;
236constexpr Area nanobarn = 1.0e+03_pb;
237constexpr Area microbarn = 1.0e+06_pb;
238constexpr Area millibarn = 1.0e+09_pb;
239constexpr Area barn = 1.0e+12_pb;
240
241constexpr Charge eplus = Charge::baseunit();
243
245constexpr Qty<1,1,0> hbarc = 197.326968e-15 * MeV * meter;
247constexpr Qty<1,1,0> hbar_Planck = hbarc / 1.0; // c is one
248}
249
254namespace UnitRemoval {
256
257 constexpr Units::Energy E = Units::Energy::baseunit();
258
259 constexpr Units::Energy2 E2 = E*E;
260 constexpr Units::Energy3 E3 = E*E2;
261 constexpr Units::Energy4 E4 = E2*E2;
262
263 constexpr Units::InvEnergy InvE = 1.0/E;
264 constexpr Units::InvEnergy2 InvE2 = 1.0/E2;
265 constexpr Units::InvEnergy3 InvE3 = 1.0/E3;
266 constexpr Units::InvEnergy4 InvE4 = 1.0/E4;
267
271}
272
273}
274
275#endif /* ThePEG_Units_H */
Overloads for operations on complex physical quantities.
Overloads for mathematical operations on physical quantities.
The PhysicalQty class allows compile-time checking of dimensional correctness.
The Lorentz5Vector inherits from the LorentzVector class.
A 4-component Lorentz vector.
Definition: LorentzVector.h:44
static constexpr Type baseunit()
Basic unit of this quantity.
Definition: PhysicalQty.h:113
This template class allows the compiler to check calculations with physical quantities for dimensiona...
Definition: PhysicalQty.h:52
A 3-component vector.
Definition: ThreeVector.h:35
Transverse represents the transverse components of a LorentzVector.
Definition: Transverse.h:30
Qty<-1, 1, 0 > Tension
Tension.
Definition: Unitsystem.h:66
ThreeVector< Length > Distance
A distance in three-dimensional euclidean space.
Definition: Unitsystem.h:130
Qty< 0, 1, 0 > Energy
Energy.
Definition: Unitsystem.h:42
ThreeVector< Length > Point
A point in three-dimensional euclidean space.
Definition: Unitsystem.h:127
Qty< 2,-2, 0 > DiffXSec
CrossSection/Energy2.
Definition: Unitsystem.h:115
Qty<-1, 0, 0 > InvLength
Inverse Length.
Definition: Unitsystem.h:54
ThreeVector< Energy > Momentum3
A momentum in three-dimensional euclidean space.
Definition: Unitsystem.h:136
Qty< 2, 0, 0 > Area
Area will be assumed to be Length .
Definition: Unitsystem.h:69
constexpr Qty< 1, 1, 0 > hbarc
Planck's constant times c (PDG 2006 value 197.326968(17) MeV fm)
Definition: Unitsystem.h:245
Lorentz5Vector< Energy > Lorentz5Momentum
A momentum in four-dimensional space-time with an explicit invariant mass component.
Definition: Unitsystem.h:156
LorentzVector< Length > LorentzDistance
A distance in four-dimensional space-time.
Definition: Unitsystem.h:142
Qty< 1, 0, 0 > Length
Length.
Definition: Unitsystem.h:48
LorentzVector< Length > LorentzPoint
A point in four-dimensional space-time.
Definition: Unitsystem.h:149
LorentzVector< Energy > LorentzMomentum
A momentum in four-dimensional space-time.
Definition: Unitsystem.h:152
Qty< 2,-4, 0 > Diff2XSec
CrossSection/Energy4.
Definition: Unitsystem.h:118
Area CrossSection
Cross section is an area.
Definition: Unitsystem.h:75
Qty< 1, 1, 0 > AngularMomentum
Angular momentum.
Definition: Unitsystem.h:63
Lorentz5Vector< Length > Lorentz5Distance
A distance in four-dimensional space-time with an explicit invariant time component.
Definition: Unitsystem.h:146
ThreeVector< double > Axis
A direction in three-dimensional euclidean space.
Definition: Unitsystem.h:133
Energy Mass
Mass has the same unit as Energy <=> c == 1.
Definition: Unitsystem.h:45
Qty< 0, 0, 1 > Charge
Charge.
Definition: Unitsystem.h:60
ThreeVector< double > Boost
A three-dimensional boost vector.
Definition: Unitsystem.h:139
constexpr Qty< 1, 1, 0 > hbar_Planck
Planck's constant (PDG 2006 value 197.326968(17) MeV fm)
Definition: Unitsystem.h:247
Qty< 2,-6, 0 > Diff3XSec
CrossSection/Energy6.
Definition: Unitsystem.h:121
Transverse< Energy > TransverseMomentum
Transverse components of a momentum.
Definition: Unitsystem.h:159
Length Time
Time has the same unit as Length.
Definition: Unitsystem.h:51
Energy2 Scale
Scale is the same as a squared energy.
Definition: Unitsystem.h:124
Qty< 2, 2, 0 > Energy2XSec
CrossSection*Energy2.
Definition: Unitsystem.h:112
double Velocity
Velocities are dimensionless fractions of c.
Definition: Unitsystem.h:57
Qty<-2, 0, 0 > InvArea
Inverse Area.
Definition: Unitsystem.h:72
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28