VGM
Version 5.5
Toggle main menu visibility
Loading...
Searching...
No Matches
packages
RootGM
source
solids
Polycone.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
// Class Polycone
14
// ---------------
15
// VGM implementation for Root polycone solid.
16
//
17
// Author: Ivana Hrivnacova; IPN Orsay
18
19
#include "
RootGM/solids/Polycone.h
"
20
#include "
RootGM/common/Units.h
"
21
#include "
RootGM/solids/SolidMap.h
"
22
23
#include "TGeoPcon.h"
24
25
#include <iostream>
26
27
const
int
RootGM::Polycone::fgkMaxNofZPlanes = 50;
28
double
* RootGM::Polycone::fgZBuffer = 0;
29
double
* RootGM::Polycone::fgRinBuffer = 0;
30
double
* RootGM::Polycone::fgRoutBuffer = 0;
31
32
//_____________________________________________________________________________
33
RootGM::Polycone::Polycone
(
const
std::string& name,
double
sphi,
double
dphi,
34
int
nofZPlanes,
double
* z,
double
* rin,
double
* rout)
35
:
VGM
::ISolid(),
VGM
::IPolycone(),
BaseVGM
::
VPolycone
(), fPolycone(0)
36
{
45
46
double
* param =
new
double
[3 + 3 * nofZPlanes];
47
// number of parameters: sphi, dphi, nz + 3*nofZPlanes
48
49
param[0] = sphi /
RootGM::Units::Angle
();
50
param[1] = dphi /
RootGM::Units::Angle
();
51
param[2] = nofZPlanes;
52
53
for
(
int
i = 0; i < nofZPlanes; i++) {
54
int
j = 3 + 3 * i;
55
param[j] = z[i] /
RootGM::Units::Length
();
56
param[j + 1] = rin[i] /
RootGM::Units::Length
();
57
param[j + 2] = rout[i] /
RootGM::Units::Length
();
58
}
59
60
fPolycone =
new
TGeoPcon(param);
61
fPolycone->SetName(name.data());
62
63
RootGM::SolidMap::Instance
()->
AddSolid
(
this
, fPolycone);
64
CreateBuffers();
65
66
delete
[] param;
67
}
68
69
//_____________________________________________________________________________
70
RootGM::Polycone::Polycone
(TGeoPcon* polycone)
71
:
VGM
::ISolid(),
VGM
::IPolycone(),
BaseVGM
::
VPolycone
(), fPolycone(polycone)
72
{
74
75
RootGM::SolidMap::Instance
()->
AddSolid
(
this
, fPolycone);
76
CreateBuffers();
77
}
78
79
//_____________________________________________________________________________
80
RootGM::Polycone::Polycone
()
81
:
VGM
::ISolid(),
VGM
::IPolycone(),
BaseVGM
::
VPolycone
()
82
{
84
}
85
86
//_____________________________________________________________________________
87
RootGM::Polycone::Polycone
(
const
Polycone
& rhs)
88
:
VGM
::ISolid(rhs),
VGM
::IPolycone(rhs),
BaseVGM
::
VPolycone
(rhs)
89
{
91
}
92
93
//_____________________________________________________________________________
94
RootGM::Polycone::~Polycone
()
95
{
96
//
97
}
98
99
//_____________________________________________________________________________
100
void
RootGM::Polycone::CreateBuffers()
101
{
102
if
(!fgZBuffer) fgZBuffer =
new
double
[fgkMaxNofZPlanes];
103
if
(!fgRinBuffer) fgRinBuffer =
new
double
[fgkMaxNofZPlanes];
104
if
(!fgRoutBuffer) fgRoutBuffer =
new
double
[fgkMaxNofZPlanes];
105
}
106
107
//_____________________________________________________________________________
108
std::string
RootGM::Polycone::Name
()
const
{
return
fPolycone->GetName(); }
109
110
//_____________________________________________________________________________
111
double
RootGM::Polycone::StartPhi
()
const
112
{
113
return
fPolycone->GetPhi1() *
RootGM::Units::Angle
();
114
}
115
116
//_____________________________________________________________________________
117
double
RootGM::Polycone::DeltaPhi
()
const
118
{
119
return
fPolycone->GetDphi() *
RootGM::Units::Angle
();
120
}
121
122
//_____________________________________________________________________________
123
int
RootGM::Polycone::NofZPlanes
()
const
{
return
fPolycone->GetNz(); }
124
125
//_____________________________________________________________________________
126
double
*
RootGM::Polycone::ZValues
()
const
127
{
128
int
nofZPlanes =
NofZPlanes
();
129
if
(nofZPlanes > fgkMaxNofZPlanes) {
130
nofZPlanes = fgkMaxNofZPlanes;
131
std::cerr <<
"+++ Warning +++"
<< std::endl;
132
std::cerr <<
" Number of Zplanes > size of buffer."
<< std::endl;
133
std::cerr <<
" only "
<< nofZPlanes <<
" values are returned."
134
<< std::endl;
135
}
136
137
for
(
int
i = 0; i < nofZPlanes; i++)
138
fgZBuffer[i] = fPolycone->GetZ(i) *
RootGM::Units::Length
();
139
140
return
fgZBuffer;
141
}
142
143
//_____________________________________________________________________________
144
double
*
RootGM::Polycone::InnerRadiusValues
()
const
145
{
146
int
nofZPlanes =
NofZPlanes
();
147
if
(nofZPlanes > fgkMaxNofZPlanes) {
148
nofZPlanes = fgkMaxNofZPlanes;
149
std::cerr <<
"+++ Warning +++"
<< std::endl;
150
std::cerr <<
" Number of Zplanes > size of buffer."
<< std::endl;
151
std::cerr <<
" only "
<< nofZPlanes <<
" values are returned."
152
<< std::endl;
153
}
154
155
for
(
int
i = 0; i < nofZPlanes; i++)
156
fgRinBuffer[i] = fPolycone->GetRmin(i) *
RootGM::Units::Length
();
157
158
return
fgRinBuffer;
159
}
160
161
//_____________________________________________________________________________
162
double
*
RootGM::Polycone::OuterRadiusValues
()
const
163
{
164
int
nofZPlanes =
NofZPlanes
();
165
if
(nofZPlanes > fgkMaxNofZPlanes) {
166
nofZPlanes = fgkMaxNofZPlanes;
167
std::cerr <<
"+++ Warning +++"
<< std::endl;
168
std::cerr <<
" Number of Zplanes > size of buffer."
<< std::endl;
169
std::cerr <<
" only "
<< nofZPlanes <<
" values are returned."
170
<< std::endl;
171
}
172
173
for
(
int
i = 0; i < nofZPlanes; i++)
174
fgRoutBuffer[i] = fPolycone->GetRmax(i) *
RootGM::Units::Length
();
175
176
return
fgRoutBuffer;
177
}
Units.h
Polycone.h
SolidMap.h
BaseVGM::VPolycone::VPolycone
VPolycone()
Definition
VPolycone.cxx:30
RootGM::Polycone::StartPhi
virtual double StartPhi() const
Return starting phi angle of the segment in deg.
Definition
Polycone.cxx:111
RootGM::Polycone::~Polycone
virtual ~Polycone()
Definition
Polycone.cxx:94
RootGM::Polycone::NofZPlanes
virtual int NofZPlanes() const
Return number of planes perpendicular to the z axis.
Definition
Polycone.cxx:123
RootGM::Polycone::ZValues
virtual double * ZValues() const
Return the array of z positions of the planes in mm.
Definition
Polycone.cxx:126
RootGM::Polycone::InnerRadiusValues
virtual double * InnerRadiusValues() const
Return the array of inner radius of the planes in mm.
Definition
Polycone.cxx:144
RootGM::Polycone::OuterRadiusValues
virtual double * OuterRadiusValues() const
Return the array of outer radius of the planes in mm.
Definition
Polycone.cxx:162
RootGM::Polycone::Polycone
Polycone(const std::string &name, double sphi, double dphi, int nofZPlanes, double *z, double *rin, double *rout)
Definition
Polycone.cxx:33
RootGM::Polycone::Polycone
Polycone()
Definition
Polycone.cxx:80
RootGM::Polycone::DeltaPhi
virtual double DeltaPhi() const
Return opening phi angle of the segment in deg.
Definition
Polycone.cxx:117
RootGM::Polycone::Name
virtual std::string Name() const
Return the name of this solid.
Definition
Polycone.cxx:108
RootGM::SolidMap::AddSolid
void AddSolid(VGM::ISolid *, TGeoShape *)
Definition
SolidMap.cxx:59
RootGM::SolidMap::Instance
static SolidMap * Instance()
Definition
SolidMap.cxx:28
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
BaseVGM
BaseVGM utilities.
Definition
utilities.h:23
VGM
VGM interfaces.
Definition
VMedium.h:28
Generated on
for VGM by
1.17.0