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