VGM Version 5.3
Loading...
Searching...
No Matches
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"
20
22
23#include <iostream>
24#include <math.h>
25
26//_____________________________________________________________________________
28{
29 //
30 std::cout << "VGM info: ";
31}
32
33//_____________________________________________________________________________
34double 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//_____________________________________________________________________________
53std::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//_____________________________________________________________________________
88std::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}
std::ostream & operator<<(std::ostream &out, const VGM::Transform &transform)
Definition utilities.cxx:88
VGM Axis enumeration.
void DebugInfo()
Debug printing.
Definition utilities.cxx:27
double Round(double x)
Round number.
Definition utilities.cxx:34
std::vector< double > Transform
Definition Transform.h:40
std::string AxisTypeName(VGM::Axis typeId)
Definition utilities.cxx:53
@ kRho
Definition Axis.h:38
@ kPhi
Definition Axis.h:40
@ kYAxis
Definition Axis.h:36
@ kRadial3D
Definition Axis.h:39
@ kXAxis
Definition Axis.h:35
@ kUnknownAxis
Definition Axis.h:42
@ kZAxis
Definition Axis.h:37
@ kSphTheta
Definition Axis.h:41
@ kAngleZ
Definition Transform.h:49
@ kDx
Definition Transform.h:44
@ kAngleY
Definition Transform.h:48
@ kDz
Definition Transform.h:46
@ kAngleX
Definition Transform.h:47
@ kDy
Definition Transform.h:45