File indexing completed on 2025-07-13 07:53:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #ifndef EVALUATOR_DD4HEPUNITS_H
0028 #define EVALUATOR_DD4HEPUNITS_H
0029
0030
0031 namespace dd4hep {
0032
0033
0034
0035
0036
0037 #ifdef DD4HEP_USE_GEANT4_UNITS
0038 static constexpr double millimeter = 1.0;
0039 #else
0040 static constexpr double millimeter = 0.1;
0041 #endif
0042 static constexpr double millimeter2 = millimeter * millimeter;
0043 static constexpr double millimeter3 = millimeter * millimeter * millimeter;
0044
0045 static constexpr double centimeter = 10. * millimeter;
0046 static constexpr double centimeter2 = centimeter * centimeter;
0047 static constexpr double centimeter3 = centimeter * centimeter * centimeter;
0048
0049 static constexpr double meter = 1000. * millimeter;
0050 static constexpr double meter2 = meter * meter;
0051 static constexpr double meter3 = meter * meter * meter;
0052
0053 static constexpr double kilometer = 1000. * meter;
0054 static constexpr double kilometer2 = kilometer * kilometer;
0055 static constexpr double kilometer3 = kilometer * kilometer * kilometer;
0056
0057 static constexpr double parsec = 3.0856775807e+16 * meter;
0058
0059 static constexpr double micrometer = 1.e-6 * meter;
0060 static constexpr double nanometer = 1.e-9 * meter;
0061 static constexpr double angstrom = 1.e-10 * meter;
0062 static constexpr double fermi = 1.e-15 * meter;
0063
0064 static constexpr double barn = 1.e-28 * meter2;
0065 static constexpr double millibarn = 1.e-3 * barn;
0066 static constexpr double microbarn = 1.e-6 * barn;
0067 static constexpr double nanobarn = 1.e-9 * barn;
0068 static constexpr double picobarn = 1.e-12 * barn;
0069
0070
0071 static constexpr double nm = nanometer;
0072 static constexpr double um = micrometer;
0073
0074 static constexpr double mm = millimeter;
0075 static constexpr double mm2 = millimeter2;
0076 static constexpr double mm3 = millimeter3;
0077
0078 static constexpr double cm = centimeter;
0079 static constexpr double cm2 = centimeter2;
0080 static constexpr double cm3 = centimeter3;
0081
0082 static constexpr double m = meter;
0083 static constexpr double m2 = meter2;
0084 static constexpr double m3 = meter3;
0085
0086 static constexpr double km = kilometer;
0087 static constexpr double km2 = kilometer2;
0088 static constexpr double km3 = kilometer3;
0089
0090 static constexpr double pc = parsec;
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101 static constexpr double radian = 1. ;
0102 static constexpr double milliradian = 1.e-3 * radian;
0103 static constexpr double degree = (3.14159265358979323846/180.0)*radian;
0104
0105 static constexpr double steradian = 1.;
0106
0107
0108 static constexpr double rad = radian;
0109 static constexpr double mrad = milliradian;
0110 static constexpr double sr = steradian;
0111 static constexpr double deg = degree;
0112
0113
0114
0115
0116 #ifdef DD4HEP_USE_GEANT4_UNITS
0117 static constexpr double nanosecond = 1.0;
0118 #else
0119 static constexpr double nanosecond = 1.e-9;
0120 #endif
0121 static constexpr double second = 1.e+9 * nanosecond;
0122 static constexpr double millisecond = 1.e-3 * second;
0123 static constexpr double microsecond = 1.e-6 * second;
0124 static constexpr double picosecond = 1.e-12 * second;
0125
0126 static constexpr double hertz = 1. / second;
0127 static constexpr double kilohertz = 1.e+3 * hertz;
0128 static constexpr double megahertz = 1.e+6 * hertz;
0129
0130
0131 static constexpr double ns = nanosecond;
0132 static constexpr double s = second;
0133 static constexpr double ms = millisecond;
0134
0135
0136
0137
0138 static constexpr double eplus = 1.;
0139 static constexpr double e_SI = 1.602176487e-19;
0140 static constexpr double coulomb = eplus / e_SI;
0141
0142
0143
0144
0145 #ifdef DD4HEP_USE_GEANT4_UNITS
0146 static constexpr double megaelectronvolt = 1.0;
0147 #else
0148 static constexpr double megaelectronvolt = 1.e-3;
0149 #endif
0150 static constexpr double electronvolt = 1.e-6 * megaelectronvolt;
0151 static constexpr double kiloelectronvolt = 1.e-3 * megaelectronvolt;
0152 static constexpr double gigaelectronvolt = 1.e+3 * megaelectronvolt;
0153 static constexpr double teraelectronvolt = 1.e+6 * megaelectronvolt;
0154 static constexpr double petaelectronvolt = 1.e+9 * megaelectronvolt;
0155
0156 static constexpr double joule = electronvolt / e_SI;
0157 static constexpr double kilojoule = 1.e3*joule;
0158
0159
0160 static constexpr double eV = electronvolt;
0161 static constexpr double keV = kiloelectronvolt;
0162 static constexpr double MeV = megaelectronvolt;
0163 static constexpr double GeV = gigaelectronvolt;
0164 static constexpr double TeV = teraelectronvolt;
0165 static constexpr double PeV = petaelectronvolt;
0166
0167
0168
0169
0170 static constexpr double kilogram = joule * second * second / (meter * meter);
0171 static constexpr double gram = 1.e-3 * kilogram;
0172 static constexpr double milligram = 1.e-3 * gram;
0173
0174
0175 static constexpr double kg = kilogram;
0176 static constexpr double g = gram;
0177 static constexpr double mg = milligram;
0178
0179
0180
0181
0182 static constexpr double watt = joule / second;
0183 static constexpr double kilowatt = 1.e3*watt;
0184 static constexpr double megawatt = 1.e6*watt;
0185
0186
0187
0188
0189 static constexpr double newton = joule / meter;
0190
0191
0192
0193
0194 #define pascal hep_pascal
0195 static constexpr double hep_pascal = newton / m2;
0196 static constexpr double bar = 100000 * pascal;
0197 static constexpr double atmosphere = 101325 * pascal;
0198
0199
0200
0201
0202 static constexpr double ampere = coulomb / second;
0203 static constexpr double milliampere = 1.e-3 * ampere;
0204 static constexpr double microampere = 1.e-6 * ampere;
0205 static constexpr double nanoampere = 1.e-9 * ampere;
0206
0207
0208
0209
0210 static constexpr double megavolt = megaelectronvolt / eplus;
0211 static constexpr double kilovolt = 1.e-3 * megavolt;
0212 static constexpr double volt = 1.e-6 * megavolt;
0213
0214
0215
0216
0217 static constexpr double ohm = volt / ampere;
0218
0219
0220
0221
0222 static constexpr double farad = coulomb / volt;
0223 static constexpr double millifarad = 1.e-3 * farad;
0224 static constexpr double microfarad = 1.e-6 * farad;
0225 static constexpr double nanofarad = 1.e-9 * farad;
0226 static constexpr double picofarad = 1.e-12 * farad;
0227
0228
0229
0230
0231 static constexpr double weber = volt * second;
0232
0233
0234
0235
0236 static constexpr double tesla = volt * second / meter2;
0237
0238 static constexpr double gauss = 1.e-4 * tesla;
0239 static constexpr double kilogauss = 1.e-1 * tesla;
0240
0241
0242
0243
0244 static constexpr double henry = weber / ampere;
0245
0246
0247
0248
0249 static constexpr double kelvin = 1.;
0250
0251
0252
0253
0254 static constexpr double mole = 1.;
0255
0256
0257
0258
0259 static constexpr double becquerel = 1. / second;
0260 static constexpr double curie = 3.7e+10 * becquerel;
0261
0262
0263
0264
0265 static constexpr double gray = joule / kilogram;
0266 static constexpr double kilogray = 1.e+3 * gray;
0267 static constexpr double milligray = 1.e-3 * gray;
0268 static constexpr double microgray = 1.e-6 * gray;
0269
0270
0271
0272
0273 static constexpr double candela = 1.;
0274
0275
0276
0277
0278 static constexpr double lumen = candela * steradian;
0279
0280
0281
0282
0283 static constexpr double lux = lumen / meter2;
0284
0285
0286
0287
0288 static constexpr double perCent = 0.01;
0289 static constexpr double perThousand = 0.001;
0290 static constexpr double perMillion = 0.000001;
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329 static constexpr double pi = 3.14159265358979323846;
0330 static constexpr double twopi = 2 * pi;
0331 static constexpr double halfpi = pi / 2;
0332 static constexpr double pi2 = pi * pi;
0333
0334
0335
0336
0337 static constexpr double Avogadro = 6.02214179e+23 / mole;
0338
0339
0340
0341
0342
0343 static constexpr double c_light = 2.99792458e+8 * m / s;
0344 static constexpr double c_squared = c_light * c_light;
0345
0346
0347
0348
0349
0350
0351 static constexpr double h_Planck = 6.62606896e-34 * joule * s;
0352 static constexpr double hbar_Planck = h_Planck / twopi;
0353 static constexpr double hbarc = hbar_Planck * c_light;
0354 static constexpr double hbarc_squared = hbarc * hbarc;
0355
0356
0357
0358
0359 static constexpr double electron_charge = -eplus;
0360 static constexpr double e_squared = eplus * eplus;
0361
0362
0363
0364
0365
0366
0367 static constexpr double electron_mass_c2 = 0.510998910 * MeV;
0368 static constexpr double proton_mass_c2 = 938.272013 * MeV;
0369 static constexpr double neutron_mass_c2 = 939.56536 * MeV;
0370 static constexpr double amu_c2 = 931.494028 * MeV;
0371 static constexpr double amu = amu_c2 / c_squared;
0372
0373
0374
0375
0376
0377 static constexpr double mu0 = 4 * pi * 1.e-7 * henry / m;
0378 static constexpr double epsilon0 = 1. / (c_squared * mu0);
0379
0380
0381
0382
0383 static constexpr double elm_coupling = e_squared / (4 * pi * epsilon0);
0384 static constexpr double fine_structure_const = elm_coupling / hbarc;
0385 static constexpr double classic_electr_radius = elm_coupling / electron_mass_c2;
0386 static constexpr double electron_Compton_length = hbarc / electron_mass_c2;
0387 static constexpr double Bohr_radius = electron_Compton_length / fine_structure_const;
0388
0389 static constexpr double alpha_rcl2 = fine_structure_const * classic_electr_radius * classic_electr_radius;
0390
0391 static constexpr double twopi_mc2_rcl2 = twopi * electron_mass_c2 * classic_electr_radius * classic_electr_radius;
0392
0393
0394
0395 static constexpr double k_Boltzmann = 8.617343e-11 * MeV / kelvin;
0396
0397
0398
0399
0400 static constexpr double Temperature_STP = 273.15 * kelvin;
0401 static constexpr double Pressure_STP = 1. * bar;
0402
0403
0404 static constexpr double Temperature_NTP = 293.15 * kelvin;
0405 static constexpr double Pressure_NTP = 1. * atmosphere;
0406
0407 static constexpr double kGasThreshold = 10. * mg / cm3;
0408
0409
0410
0411 static constexpr double universe_mean_density = 1.e-25 * g / cm3;
0412
0413 }
0414 #endif