Geant4  10.00.p01
setStdMath.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id:$
3 // ----------------------------------------------------------------------
4 
5 #include "CLHEP/Evaluator/Evaluator.h"
6 
7 #include <cmath> // for sqrt and pow
8 
9 static double eval_abs (double a) { return (a < 0) ? -a : a; }
10 static double eval_min (double a, double b) { return (a < b) ? a : b; }
11 static double eval_max (double a, double b) { return (a > b) ? a : b; }
12 static double eval_sqrt (double a) { return std::sqrt(a); }
13 static double eval_pow (double a, double b) { return std::pow(a,b); }
14 static double eval_sin (double a) { return std::sin(a); }
15 static double eval_cos (double a) { return std::cos(a); }
16 static double eval_tan (double a) { return std::tan(a); }
17 static double eval_asin (double a) { return std::asin(a); }
18 static double eval_acos (double a) { return std::acos(a); }
19 static double eval_atan (double a) { return std::atan(a); }
20 static double eval_atan2(double a, double b) { return std::atan2(a,b); }
21 static double eval_sinh (double a) { return std::sinh(a); }
22 static double eval_cosh (double a) { return std::cosh(a); }
23 static double eval_tanh (double a) { return std::tanh(a); }
24 static double eval_exp (double a) { return std::exp(a); }
25 static double eval_log (double a) { return std::log(a); }
26 static double eval_log10(double a) { return std::log10(a); }
27 
28 namespace HepTool {
29 
30 void Evaluator::setStdMath() {
31 
32  // S E T S T A N D A R D C O N S T A N T S
33 
34  setVariable("pi", 3.14159265358979323846);
35  setVariable("e", 2.7182818284590452354);
36  setVariable("gamma", 0.577215664901532861);
37  setVariable("radian", 1.0);
38  setVariable("rad", 1.0);
39  setVariable("degree", 3.14159265358979323846/180.);
40  setVariable("deg", 3.14159265358979323846/180.);
41 
42  // S E T S T A N D A R D F U N C T I O N S
43 
44  setFunction("abs", eval_abs);
45  setFunction("min", eval_min);
46  setFunction("max", eval_max);
47  setFunction("sqrt", eval_sqrt);
48  setFunction("pow", eval_pow);
49  setFunction("sin", eval_sin);
50  setFunction("cos", eval_cos);
51  setFunction("tan", eval_tan);
52  setFunction("asin", eval_asin);
53  setFunction("acos", eval_acos);
54  setFunction("atan", eval_atan);
55  setFunction("atan2", eval_atan2);
56  setFunction("sinh", eval_sinh);
57  setFunction("cosh", eval_cosh);
58  setFunction("tanh", eval_tanh);
59  setFunction("exp", eval_exp);
60  setFunction("log", eval_log);
61  setFunction("log10", eval_log10);
62 }
63 
64 } // namespace HepTool
static double eval_min(double a, double b)
Definition: setStdMath.cc:10
static double eval_pow(double a, double b)
Definition: setStdMath.cc:13
static double eval_acos(double a)
Definition: setStdMath.cc:18
static double eval_sin(double a)
Definition: setStdMath.cc:14
G4double a
Definition: TRTMaterials.hh:39
static double eval_asin(double a)
Definition: setStdMath.cc:17
static double eval_exp(double a)
Definition: setStdMath.cc:24
static double eval_abs(double a)
Definition: setStdMath.cc:9
static double eval_max(double a, double b)
Definition: setStdMath.cc:11
static double eval_sqrt(double a)
Definition: setStdMath.cc:12
static double eval_atan(double a)
Definition: setStdMath.cc:19
static double eval_tanh(double a)
Definition: setStdMath.cc:23
static double eval_atan2(double a, double b)
Definition: setStdMath.cc:20
static double eval_sinh(double a)
Definition: setStdMath.cc:21
static double eval_log(double a)
Definition: setStdMath.cc:25
static double eval_cos(double a)
Definition: setStdMath.cc:15
static double eval_cosh(double a)
Definition: setStdMath.cc:22
static double eval_log10(double a)
Definition: setStdMath.cc:26
static double eval_tan(double a)
Definition: setStdMath.cc:16