VGM
Version 5.5
Toggle main menu visibility
Loading...
Searching...
No Matches
packages
RootGM
source
common
axis.cxx
Go to the documentation of this file.
1
// $Id$
2
3
// -----------------------------------------------------------------------
4
// The RootGM 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
// RootGM utilities
14
// --------------
15
// Utility functions
16
//
17
// Author: Ivana Hrivnacova; IPN Orsay
18
19
#include "
RootGM/common/axis.h
"
20
#include "
RootGM/common/Units.h
"
21
22
#include "TGeoMatrix.h"
23
#include "TGeoPatternFinder.h"
24
25
#include <float.h>
26
#include <iostream>
27
28
//
29
// Root -> VGM
30
//
31
32
//_____________________________________________________________________________
33
VGM::Axis
RootGM::Axis
(
const
TGeoPatternFinder* finder)
34
{
35
// Checks the finder concrete type and returns the division axis.
36
// ---
37
38
const
TGeoPatternX* finderX =
dynamic_cast<
const
TGeoPatternX*
>
(finder);
39
if
(finderX)
return
VGM::kXAxis
;
40
41
const
TGeoPatternY* finderY =
dynamic_cast<
const
TGeoPatternY*
>
(finder);
42
if
(finderY)
return
VGM::kYAxis
;
43
44
const
TGeoPatternZ* finderZ =
dynamic_cast<
const
TGeoPatternZ*
>
(finder);
45
if
(finderZ)
return
VGM::kZAxis
;
46
47
const
TGeoPatternParaX* finderParaX =
48
dynamic_cast<
const
TGeoPatternParaX*
>
(finder);
49
if
(finderParaX)
return
VGM::kXAxis
;
50
51
const
TGeoPatternParaY* finderParaY =
52
dynamic_cast<
const
TGeoPatternParaY*
>
(finder);
53
if
(finderParaY)
return
VGM::kYAxis
;
54
55
const
TGeoPatternParaZ* finderParaZ =
56
dynamic_cast<
const
TGeoPatternParaZ*
>
(finder);
57
if
(finderParaZ)
return
VGM::kZAxis
;
58
59
const
TGeoPatternTrapZ* finderTrapZ =
60
dynamic_cast<
const
TGeoPatternTrapZ*
>
(finder);
61
if
(finderTrapZ)
return
VGM::kZAxis
;
62
63
const
TGeoPatternCylR* finderR =
dynamic_cast<
const
TGeoPatternCylR*
>
(finder);
64
if
(finderR)
return
VGM::kRho
;
65
66
const
TGeoPatternCylPhi* finderPhi =
67
dynamic_cast<
const
TGeoPatternCylPhi*
>
(finder);
68
if
(finderPhi)
return
VGM::kPhi
;
69
70
const
TGeoPatternSphR* finderSphR =
71
dynamic_cast<
const
TGeoPatternSphR*
>
(finder);
72
if
(finderSphR)
return
VGM::kRadial3D
;
73
74
const
TGeoPatternSphPhi* finderSphPhi =
75
dynamic_cast<
const
TGeoPatternSphPhi*
>
(finder);
76
if
(finderSphPhi)
return
VGM::kPhi
;
77
78
const
TGeoPatternSphTheta* finderSphTheta =
79
dynamic_cast<
const
TGeoPatternSphTheta*
>
(finder);
80
if
(finderSphTheta)
return
VGM::kSphTheta
;
81
82
// Not supported shapes:
83
// Honeycomb
84
85
return
VGM::kUnknownAxis
;
86
}
87
88
//
89
// VGM -> Root
90
//
91
92
//_____________________________________________________________________________
93
int
RootGM::Axis
(
VGM::Axis
axis)
94
{
95
// Converts VGM axis enum to Root axis number.
96
// ---
97
98
switch
(axis) {
99
case
VGM::kXAxis
:
100
return
1;
101
case
VGM::kYAxis
:
102
return
2;
103
case
VGM::kZAxis
:
104
return
3;
105
case
VGM::kRho
:
106
return
1;
107
case
VGM::kPhi
:
108
return
2;
109
case
VGM::kSphTheta
:
110
return
3;
111
case
VGM::kRadial3D
:
112
return
1;
113
case
VGM::kUnknownAxis
:
114
return
0;
115
}
116
117
return
0;
118
}
119
120
//_____________________________________________________________________________
121
double
RootGM::AxisUnit
(
VGM::Axis
axis)
122
{
123
switch
(axis) {
124
case
VGM::kXAxis
:
125
return
RootGM::Units::Length
();
126
break
;
127
case
VGM::kYAxis
:
128
return
RootGM::Units::Length
();
129
break
;
130
case
VGM::kZAxis
:
131
return
RootGM::Units::Length
();
132
break
;
133
case
VGM::kRho
:
134
return
RootGM::Units::Length
();
135
break
;
136
case
VGM::kRadial3D
:
137
return
RootGM::Units::Length
();
138
break
;
139
case
VGM::kPhi
:
140
return
RootGM::Units::Angle
();
141
break
;
142
case
VGM::kUnknownAxis
:
143
return
0;
144
break
;
145
default
:
146
return
0;
147
break
;
148
}
149
}
Units.h
axis.h
RootGM::Units::Length
static double Length()
Return Root length unit in VGM units.
Definition
Units.h:84
RootGM::Units::Angle
static double Angle()
Return Root angle unit in VGM units.
Definition
Units.h:85
RootGM::Axis
VGM::Axis Axis(const TGeoPatternFinder *finder)
Definition
axis.cxx:33
RootGM::AxisUnit
double AxisUnit(VGM::Axis axis)
Definition
axis.cxx:121
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::kUnknownAxis
@ kUnknownAxis
Definition
Axis.h:42
VGM::kZAxis
@ kZAxis
Definition
Axis.h:37
VGM::kSphTheta
@ kSphTheta
Definition
Axis.h:41
Generated on
for VGM by
1.17.0