PhysicalConstants.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file larcoreobj/SimpleTypesAndConstants/PhysicalConstants.h
3 /// \brief Collection of Physical constants used in LArSoft
4 ///
5 ///
6 /// \author brebel@fnal.gov
7 ////////////////////////////////////////////////////////////////////////
8 #ifndef UTIL_PHYSICALCONSTANTS_H
9 #define UTIL_PHYSICALCONSTANTS_H
10 
11 /**
12  * @brief Generic namespace of utility functions generally independent of LArSoft.
13  *
14  * Some physical constants are also included here.
15  * As a reminder, the "standard" units in LArSoft are:
16  * * energy: GeV
17  * * time: ns
18  * * space: cm
19  *
20  */
21 namespace util {
22 
23  /**
24  * @{
25  * @name Recombination factor coefficients (NIM).
26  * @see sim::ISCalculationSeparate::CalculateIonizationAndScintillation()
27  *
28  * Recombination factor coefficients come from Nucl.Instrum.Meth.A523:275-286,2004
29  * * @f$ dE/dx @f$ is given by the voxel energy deposition, but have to convert it to MeV/cm from GeV/voxel width
30  * * electric field: @f$ E @f$ in kV/cm
31  * * @f$ R = A/(1 + (dE/dx)*k/E) @f$
32  * * @f$ A = 0.800 \pm 0.003 @f$
33  * * @f$ k = 0.0486 @f$ needs to be scaled with Electric field
34  */
35  constexpr double kRecombA = 0.800; ///< _A_ constant.
36  constexpr double kRecombk = 0.0486; ///< _k_ constant, in g/(MeV cm&sup2;)*kV/cm.
37  /// @}
38  /**
39  * @{
40  * @name Recombination factor coefficients (modified box, ArguNeuT JINST).
41  * @see sim::ISCalculationSeparate::CalculateIonizationAndScintillation()
42  *
43  * Recombination factor coefficients come from Nucl.Instrum.Meth.A523:275-286,2004
44  * * @f$ dE/dx @f$ is given by the voxel energy deposition, but have to convert it to MeV/cm from GeV/voxel width
45  * * electric field: @f$ E @f$ in kV/cm
46  * * `kModBoxB` needs to be scaled with the electric field.
47  *
48  */
49  constexpr double kModBoxA = 0.930; ///< Modified Box Alpha
50  constexpr double kModBoxB = 0.212; ///< Modified Box Beta in g/(MeV cm&sup2;)*kV/cm
51  // constexpr double kWion = 23.6e-6; ///< ionization potenial in LAr, 23.6 eV = 1e, Wion in MeV/e
52  /// @}
53 
54  // Conversion for energy deposited in GeV to number of ionization electrons produced
55  constexpr double kGeVToElectrons = 4.237e7; ///< 23.6eV per ion pair, 1e9 eV/GeV
56 
57  // More constants
58  /// Speed of light in vacuum in LArSoft units [cm/ns].
59  constexpr double kc = 29.9792458;
60  //static double khbar = 6.58211899e-22; ///< MeVs
61 
62  // Conversion factors
63  constexpr double kMeterToCentimeter = 1.e2; ///< 1 m = 100 cm
64  constexpr double kCentimeterToMeter = 1./kMeterToCentimeter;
65  constexpr double kMeterToKilometer = 1.e-3; ///< 1000 m = 1 km
66  constexpr double kKilometerToMeter = 1./kMeterToKilometer;
67 
68  constexpr double keVToMeV = 1.e-6; ///< 1e6 eV = 1 MeV
69  constexpr double kMeVToeV = 1./keVToMeV;
70 
71  constexpr double kBogusD = -999.; ///< obviously bogus double value
72  constexpr int kBogusI = -999; ///< obviously bogus integer value
73  constexpr float kBogusF = -999.; ///< obviously bogus float value
74 
75  constexpr double quietCompiler = kBogusD*kBogusI*kBogusF*kRecombA*kRecombk*kGeVToElectrons;
76 
77 
78  /// Returns the constant pi (up to 35 decimal digits of precision)
79  template <typename T = double>
80  inline constexpr T pi() { return 3.14159265358979323846264338327950288L; }
81 
82  /// Converts the argument angle from degrees into radians
83  template <typename T>
84  inline constexpr T DegreesToRadians(T angle) { return angle / 180 * pi<T>(); }
85 
86  /// Converts the argument angle from radians into degrees (@f$ \pi \rightarrow 180 @f$)
87  template <typename T>
88  inline constexpr T RadiansToDegrees(T angle) { return angle / pi<T>() * 180; }
89 
90 
91 } // namespace util
92 
93 #endif //UTIL_PHYSICALCONSTANTS_H
Namespace for general, non-LArSoft-specific utilities.
constexpr int kBogusI
obviously bogus integer value
constexpr double keVToMeV
1e6 eV = 1 MeV
constexpr double kGeVToElectrons
23.6eV per ion pair, 1e9 eV/GeV
constexpr double kc
Speed of light in vacuum in LArSoft units [cm/ns].
constexpr double kModBoxB
Modified Box Beta in g/(MeV cm²)*kV/cm.
constexpr T DegreesToRadians(T angle)
Converts the argument angle from degrees into radians.
constexpr double kCentimeterToMeter
constexpr double kMeterToKilometer
1000 m = 1 km
constexpr double kKilometerToMeter
constexpr double kMeVToeV
constexpr double quietCompiler
constexpr float kBogusF
obviously bogus float value
constexpr double kRecombk
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
constexpr T RadiansToDegrees(T angle)
Converts the argument angle from radians into degrees ( )
constexpr double kBogusD
obviously bogus double value
constexpr double kRecombA
A constant.
constexpr double kModBoxA
Modified Box Alpha.
constexpr double kMeterToCentimeter
1 m = 100 cm