VGM
Version 5.5
Toggle main menu visibility
Loading...
Searching...
No Matches
packages
ClhepVGM
source
Units.cxx
Go to the documentation of this file.
1
// $Id$
2
3
// -----------------------------------------------------------------------
4
// The ClhepVGM package of the Virtual Geometry Model
5
// Copyright (C) 2007, Ivana Hrivnacova
6
// All rights reserved.
7
//
8
// For the licensing terms see vgm/LICENSE.
9
// Contact: ivana@ipno.in2p3.fr
10
// -----------------------------------------------------------------------
11
12
//
13
// Class Units
14
// ------------------
15
// Conversion from CLHEP physical units to VGM units..
16
//
17
// Author: Ivana Hrivnacova; IPN Orsay
18
19
#include "
ClhepVGM/Units.h
"
20
21
#include "CLHEP/Units/SystemOfUnits.h"
22
23
#include <cstdlib>
24
#include <iostream>
25
26
using
CLHEP::atmosphere;
27
using
CLHEP::cm;
28
using
CLHEP::cm3;
29
using
CLHEP::deg;
30
using
CLHEP::g;
31
using
CLHEP::kelvin;
32
using
CLHEP::mm;
33
using
CLHEP::mole;
34
35
//
36
// static const data members
37
//
38
39
const
double
ClhepVGM::Units::fgkLength = 1. / mm;
40
const
double
ClhepVGM::Units::fgkAngle = 1. / deg;
41
const
double
ClhepVGM::Units::fgkMassDensity = 1. / (g / cm3);
42
const
double
ClhepVGM::Units::fgkAtomicWeight = 1. / (g / mole);
43
const
double
ClhepVGM::Units::fgkTemperature = 1. / kelvin;
44
const
double
ClhepVGM::Units::fgkPressure = 1. / atmosphere;
45
46
//_____________________________________________________________________________
47
ClhepVGM::Units::Units
()
48
{
50
}
51
52
//_____________________________________________________________________________
53
ClhepVGM::Units::~Units
()
54
{
55
//
56
}
57
58
//
59
// public functions
60
//
61
62
//_____________________________________________________________________________
63
double
ClhepVGM::Units::AxisUnit
(
VGM::Axis
axis)
64
{
65
if
(axis ==
VGM::kXAxis
|| axis ==
VGM::kYAxis
|| axis ==
VGM::kZAxis
||
66
axis ==
VGM::kRho
|| axis ==
VGM::kRadial3D
) {
67
68
return
Length
();
69
}
70
71
if
(axis ==
VGM::kPhi
|| axis ==
VGM::kSphTheta
) {
72
return
Angle
();
73
}
74
75
// axis == kUndefined
76
std::cerr <<
" ClhepVGM::Units::AxisUnit:"
<< std::endl;
77
std::cerr <<
" Undefined axis"
<< std::endl;
78
std::cerr <<
"*** Error: Aborting execution ***"
<< std::endl;
79
exit(1);
80
}
81
82
//_____________________________________________________________________________
83
double
ClhepVGM::Units::Length
() {
return
fgkLength; }
84
85
//_____________________________________________________________________________
86
double
ClhepVGM::Units::Length
(
double
clhepUnit)
87
{
88
return
fgkLength * clhepUnit;
89
}
90
91
//_____________________________________________________________________________
92
double
ClhepVGM::Units::Angle
() {
return
fgkAngle; }
93
94
//_____________________________________________________________________________
95
double
ClhepVGM::Units::Angle
(
double
clhepUnit) {
return
fgkAngle * clhepUnit; }
96
97
//_____________________________________________________________________________
98
double
ClhepVGM::Units::MassDensity
() {
return
fgkMassDensity; }
99
100
//_____________________________________________________________________________
101
double
ClhepVGM::Units::MassDensity
(
double
clhepUnit)
102
{
103
return
fgkMassDensity * clhepUnit;
104
}
105
106
//_____________________________________________________________________________
107
double
ClhepVGM::Units::AtomicWeight
() {
return
fgkAtomicWeight; }
108
109
//_____________________________________________________________________________
110
double
ClhepVGM::Units::AtomicWeight
(
double
clhepUnit)
111
{
112
return
fgkAtomicWeight * clhepUnit;
113
}
114
115
//_____________________________________________________________________________
116
double
ClhepVGM::Units::Temperature
() {
return
fgkTemperature; }
117
118
//_____________________________________________________________________________
119
double
ClhepVGM::Units::Temperature
(
double
clhepUnit)
120
{
121
return
fgkTemperature * clhepUnit;
122
}
123
124
//_____________________________________________________________________________
125
double
ClhepVGM::Units::Pressure
() {
return
fgkPressure; }
126
127
//_____________________________________________________________________________
128
double
ClhepVGM::Units::Pressure
(
double
clhepUnit)
129
{
130
return
fgkPressure * clhepUnit;
131
}
Units.h
ClhepVGM::Units::~Units
virtual ~Units()
Definition
Units.cxx:53
ClhepVGM::Units::Temperature
static double Temperature()
Return CLHEP default temperature unit in VGM unit.
Definition
Units.cxx:116
ClhepVGM::Units::AtomicWeight
static double AtomicWeight()
Return CLHEP default atomic weight unit in VGM units.
Definition
Units.cxx:107
ClhepVGM::Units::MassDensity
static double MassDensity()
Return CLHEP default mass density unit in VGM units.
Definition
Units.cxx:98
ClhepVGM::Units::Pressure
static double Pressure()
Return CLHEP default pressure unit in VGM unit.
Definition
Units.cxx:125
ClhepVGM::Units::Units
Units()
Definition
Units.cxx:47
ClhepVGM::Units::Length
static double Length()
Return CLHEP default length unit in VGM units.
Definition
Units.cxx:83
ClhepVGM::Units::Angle
static double Angle()
Return CLHEP default angle unit in VGM units.
Definition
Units.cxx:92
ClhepVGM::Units::AxisUnit
static double AxisUnit(VGM::Axis axis)
Convert CLHEP default unit for given axis type in VGM units.
Definition
Units.cxx:63
VGM::Axis
Axis
Definition
Axis.h:34
VGM::kRho
@ kRho
Definition
Axis.h:38
VGM::kPhi
@ kPhi
Definition
Axis.h:40
VGM::kYAxis
@ kYAxis
Definition
Axis.h:36
VGM::kRadial3D
@ kRadial3D
Definition
Axis.h:39
VGM::kXAxis
@ kXAxis
Definition
Axis.h:35
VGM::kZAxis
@ kZAxis
Definition
Axis.h:37
VGM::kSphTheta
@ kSphTheta
Definition
Axis.h:41
Generated on
for VGM by
1.17.0