Line data Source code
1 : //--------------------------------------------------------------------------
2 : // Units.cc
3 : // Author: A. Buckley, D. Grellscheid
4 : //
5 : // units used by a GenEvent
6 : // The default units are set here at compile time.
7 : //--------------------------------------------------------------------------
8 :
9 : #include "HepMC/Units.h"
10 :
11 : namespace HepMC {
12 :
13 : namespace Units {
14 :
15 : // helper functions
16 : std::string name(MomentumUnit m) {
17 0 : switch (m) {
18 0 : case MEV : return "MEV";
19 0 : case GEV : return "GEV";
20 0 : default : return "badValue";
21 : }
22 0 : }
23 :
24 : std::string name(LengthUnit l) {
25 0 : switch (l) {
26 0 : case MM : return "MM";
27 0 : case CM : return "CM";
28 0 : default : return "badValue";
29 : }
30 0 : }
31 :
32 : double conversion_factor(MomentumUnit from, MomentumUnit to)
33 : {
34 0 : if ( from == to )
35 0 : return 1.0;
36 0 : else if ( from == MEV && to == GEV )
37 0 : return 0.001;
38 : else
39 0 : return 1000.0;
40 0 : }
41 :
42 : double conversion_factor(LengthUnit from, LengthUnit to)
43 : {
44 0 : if ( from == to )
45 0 : return 1.0;
46 0 : else if ( from == MM && to == CM )
47 0 : return 0.1;
48 : else
49 0 : return 10.0;
50 0 : }
51 :
52 : // if this function fails to compile, rerun configure using --with-length_units
53 : LengthUnit default_length_unit() {
54 : //return @HEPMC_DEFAULT_LEN_UNIT@ ;
55 0 : return MM ;
56 : }
57 :
58 : // if this function fails to compile, rerun configure using --with-momentum_units
59 : MomentumUnit default_momentum_unit() {
60 : //return @HEPMC_DEFAULT_MOM_UNIT@ ;
61 0 : return MEV ;
62 : }
63 :
64 : } // Units
65 :
66 : } // HepMC
|