Fork me on GitHub

source: svn/trunk/Utilities/HepMC/src/Units.cc@ 495

Last change on this file since 495 was 349, checked in by severine ovyn, 16 years ago

first test

File size: 1.5 KB
RevLine 
[349]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 "Units.h"
10
11namespace HepMC {
12
13 namespace Units {
14
15 // helper functions
16 std::string name(MomentumUnit m) {
17 switch (m) {
18 case MEV : return "MEV";
19 case GEV : return "GEV";
20 default : return "badValue";
21 }
22 }
23
24 std::string name(LengthUnit l) {
25 switch (l) {
26 case MM : return "MM";
27 case CM : return "CM";
28 default : return "badValue";
29 }
30 }
31
32 double conversion_factor(MomentumUnit from, MomentumUnit to)
33 {
34 if ( from == to )
35 return 1.0;
36 else if ( from == MEV && to == GEV )
37 return 0.001;
38 else
39 return 1000.0;
40 }
41
42 double conversion_factor(LengthUnit from, LengthUnit to)
43 {
44 if ( from == to )
45 return 1.0;
46 else if ( from == MM && to == CM )
47 return 0.1;
48 else
49 return 10.0;
50 }
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 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 return GEV;
62 }
63
64 } // Units
65
66} // HepMC
Note: See TracBrowser for help on using the repository browser.