EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
FairGeoCone.cxx
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file FairGeoCone.cxx
1
//*-- AUTHOR : Ilse Koenig
2
//*-- Modified : 11/11/2003 by Ilse Koenig
3
//*-- Modified : 28/06/99 by Ilse Koenig
4
6
//
7
// FairGeoCone
8
//
9
// class for the GEANT shape CONE
10
//
11
// The size of a CONE is defined by 4 'points'.
12
// point 0: origin of starting circle of the cone;
13
// point 1: inner radius of starting circle,
14
// outer radius of starting circle;
15
// (z-component not used)
16
// point 2: origin of ending circle of the cone;
17
// point 3: inner radius of ending circle,
18
// outer radius of ending circle;
19
// (z-component not used)
20
// Warning: The x- and y-values of point 0 and 2 have to be the same!!!!
21
// A rotation has to be desribed via the rotation matrix.
22
//
23
// The intrinsic coordinate system of a CONE, which sits in the CAVE and is
24
// not rotated, is identical with the laboratory system.
25
//
27
28
#include "
FairGeoCone.h
"
29
30
#include "
FairGeoVolume.h
"
31
#include "
FairGeoVector.h
"
32
33
#include "TArrayD.h"
34
35
ClassImp
(
FairGeoCone
)
36
37
FairGeoCone
::
FairGeoCone
()
38
:
FairGeoBasicShape
()
39
{
40
// constructor
41
fName=
"CONE"
;
42
nPoints=4;
43
nParam=5;
44
param=
new
TArrayD(nParam);
45
}
46
47
48
FairGeoCone::~FairGeoCone
()
49
{
50
// default destructor
51
if
(
param
) {
52
delete
param
;
53
param
=0;
54
}
55
if
(
center
) {
56
delete
center
;
57
center
=0;
58
}
59
if
(
position
) {
60
delete
position
;
61
position
=0;
62
}
63
}
64
65
66
Int_t
FairGeoCone::readPoints
(std::fstream* pFile,
FairGeoVolume
* volu)
67
{
68
// reads the 4 'points' decribed above from ascii file
69
// if the array of points is not existing in the volume it is created and
70
// the values are stored inside
71
// returns the number of points
72
if
(!pFile) {
return
0; }
73
if
(volu->
getNumPoints
()!=
nPoints
) { volu->
createPoints
(
nPoints
); }
74
Double_t
x
,
y
,
z
;
75
const
Int_t maxbuf=155;
76
Text_t buf[maxbuf];
77
for
(Int_t i=0; i<
nPoints
; i++) {
78
pFile->getline(buf,maxbuf);
79
sscanf(buf,
"%lf%lf%lf"
,&x,&y,&z);
80
volu->
setPoint
(i,x,y,z);
81
i++;
82
pFile->getline(buf,maxbuf);
83
sscanf(buf,
"%lf%lf"
,&x,&y);
84
volu->
setPoint
(i,x,y,0.0);
85
}
86
return
nPoints
;
87
}
88
89
90
Bool_t
FairGeoCone::writePoints
(std::fstream* pFile,
FairGeoVolume
* volu)
91
{
92
// writes the 4 'points' decribed above to ascii file
93
if
(!pFile) {
return
kFALSE; }
94
Text_t buf[155];
95
for
(Int_t i=0; i<
nPoints
; i++) {
96
FairGeoVector
&
v
=*(volu->
getPoint
(i));
97
if
(i==0 || i==2) { sprintf(buf,
"%9.3f%10.3f%10.3f\n"
,
v
(0),
v
(1),
v
(2)); }
98
else
{ sprintf(buf,
"%9.3f%10.3f\n"
,
v
(0),
v
(1)); }
99
pFile->write(buf,strlen(buf));
100
}
101
return
kTRUE;
102
}
103
104
105
void
FairGeoCone::printPoints
(
FairGeoVolume
* volu)
106
{
107
// prints volume points to screen
108
for
(Int_t i=0; i<
nPoints
; i++) {
109
FairGeoVector
&
v
=*(volu->
getPoint
(i));
110
if
(i==0 || i==2) {
printf
(
"%9.3f%10.3f%10.3f\n"
,
v
(0),
v
(1),
v
(2)); }
111
else
{
printf
(
"%9.3f%10.3f\n"
,
v
(0),
v
(1)); }
112
}
113
}
114
115
116
TArrayD*
FairGeoCone::calcVoluParam
(
FairGeoVolume
* volu)
117
{
118
// calculates the parameters needed to create the shape CONE
119
Double_t fac=10.;
120
FairGeoVector
v
=*(volu->
getPoint
(2)) - *(volu->
getPoint
(0));
121
param
->AddAt(TMath::Abs(
v
(2))/fac/2.,0);
122
FairGeoVector
&
v1
=*(volu->
getPoint
(1));
123
param
->AddAt(
v1
(0)/fac,1);
124
param
->AddAt(
v1
(1)/fac,2);
125
FairGeoVector
&
v3
=*(volu->
getPoint
(3));
126
param
->AddAt(
v3
(0)/fac,3);
127
param
->AddAt(
v3
(1)/fac,4);
128
return
param
;
129
}
130
131
132
void
FairGeoCone::calcVoluPosition
(
FairGeoVolume
* volu,
133
const
FairGeoTransform
& dTC,
const
FairGeoTransform
& mTR)
134
{
135
// calculates the position of the center of the volume in the intrinsic
136
// coordinate system and stores it in the data element 'center'
137
// calls the function posInMother(...) to calculate the position of the
138
// volume in its mother
139
Double_t
t
[3]= {0.,0.,0.};
140
FairGeoVector
v
=*(volu->
getPoint
(2)) + *(volu->
getPoint
(0));
141
t[2]=
v
(2)/2.;
142
center
->
clear
();
143
center
->
setTransVector
(t);
144
posInMother
(dTC,mTR);
145
}
146
EicRoot
blob
master
geobase
FairGeoCone.cxx
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:36
using
1.8.2 with
EIC GitHub integration