Last change
on this file since 815 was 577, checked in by cp3-support, 13 years ago |
upgrade HepMC to version 2.06.05
|
File size:
1.4 KB
|
Line | |
---|
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 |
|
---|
11 | namespace 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 MM ;
|
---|
55 | }
|
---|
56 |
|
---|
57 | // if this function fails to compile, rerun configure using --with-momentum_units
|
---|
58 | MomentumUnit default_momentum_unit() {
|
---|
59 | return GEV ;
|
---|
60 | }
|
---|
61 |
|
---|
62 | } // Units
|
---|
63 |
|
---|
64 | } // HepMC
|
---|
Note:
See
TracBrowser
for help on using the repository browser.