VGM
Version 5.3
Loading...
Searching...
No Matches
packages
BaseVGM
source
common
utilities.cxx
Go to the documentation of this file.
1
// $Id$
2
3
// -----------------------------------------------------------------------
4
// The BaseVGM 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
// BaseVGM utilities
13
// --------------
14
// Utility functions
15
//
16
// Author: Ivana Hrivnacova; IPN Orsay
17
18
#include "
VGM/common/Axis.h
"
19
#include "
VGM/common/Transform.h
"
20
21
#include "
BaseVGM/common/utilities.h
"
22
23
#include <iostream>
24
#include <math.h>
25
26
//_____________________________________________________________________________
27
void
BaseVGM::DebugInfo
()
28
{
29
//
30
std::cout <<
"VGM info: "
;
31
}
32
33
//_____________________________________________________________________________
34
double
BaseVGM::Round
(
double
x)
35
{
38
39
double
t;
40
if
(x >= 0.0) {
41
t = ceil(x);
42
if
(t - x > 0.5) t -= 1.0;
43
return
t;
44
}
45
else
{
46
t = ceil(-x);
47
if
(t + x > 0.5) t -= 1.0;
48
return
-t;
49
}
50
}
51
52
//_____________________________________________________________________________
53
std::string
VGM::AxisTypeName
(
VGM::Axis
typeId)
54
{
55
// Returns the axis type name for specified typeId
56
switch
(typeId) {
57
case
kXAxis
:
58
return
"X"
;
59
break
;
60
case
kYAxis
:
61
return
"Y"
;
62
break
;
63
case
kZAxis
:
64
return
"Z"
;
65
break
;
66
case
kRho
:
67
return
"Rho"
;
68
break
;
69
case
kRadial3D
:
70
return
"Radial3D"
;
71
break
;
72
case
kPhi
:
73
return
"Phi"
;
74
break
;
75
case
kSphTheta
:
76
return
"SphTheta"
;
77
break
;
78
case
kUnknownAxis
:
79
return
"Unknown"
;
80
break
;
81
default
:
82
return
"Undefined"
;
83
break
;
84
};
85
}
86
87
//_____________________________________________________________________________
88
std::ostream&
operator<<
(std::ostream& out,
const
VGM::Transform
& transform)
89
{
90
out <<
"( "
<< transform[
VGM::kDx
] <<
", "
<< transform[
VGM::kDy
] <<
", "
91
<< transform[
VGM::kDz
] <<
")mm ( "
<< transform[
VGM::kAngleX
] <<
", "
92
<< transform[
VGM::kAngleY
] <<
", "
<< transform[
VGM::kAngleZ
] <<
")deg "
;
93
94
if
(
BaseVGM::Round
(transform[6]) == 0)
95
out <<
" noReflZ"
;
96
else
97
out <<
" reflZ"
;
98
99
return
out;
100
}
Axis.h
utilities.h
operator<<
std::ostream & operator<<(std::ostream &out, const VGM::Transform &transform)
Definition
utilities.cxx:88
Transform.h
Axis
VGM Axis enumeration.
BaseVGM::DebugInfo
void DebugInfo()
Debug printing.
Definition
utilities.cxx:27
BaseVGM::Round
double Round(double x)
Round number.
Definition
utilities.cxx:34
VGM::Transform
std::vector< double > Transform
Definition
Transform.h:40
VGM::AxisTypeName
std::string AxisTypeName(VGM::Axis typeId)
Definition
utilities.cxx:53
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::kUnknownAxis
@ kUnknownAxis
Definition
Axis.h:42
VGM::kZAxis
@ kZAxis
Definition
Axis.h:37
VGM::kSphTheta
@ kSphTheta
Definition
Axis.h:41
VGM::kAngleZ
@ kAngleZ
Definition
Transform.h:49
VGM::kDx
@ kDx
Definition
Transform.h:44
VGM::kAngleY
@ kAngleY
Definition
Transform.h:48
VGM::kDz
@ kDz
Definition
Transform.h:46
VGM::kAngleX
@ kAngleX
Definition
Transform.h:47
VGM::kDy
@ kDy
Definition
Transform.h:45
Generated on Thu Nov 28 2024 10:40:48 for VGM by
1.12.0