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
FairGeoBasicShape.cxx
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file FairGeoBasicShape.cxx
1
//*-- AUTHOR : Ilse Koenig
2
//*-- Modified : 11/11/2003 by Ilse Koenig
3
//*-- Modified : 29/06/99 by Ilse Koenig
4
6
//
7
// FairGeoBasicShape
8
//
9
// Base class of the all shapes
10
//
12
13
#include "
FairGeoBasicShape.h
"
14
15
#include "
FairGeoVolume.h
"
16
#include "
FairGeoVector.h
"
17
18
#include "TArrayD.h"
19
20
#include <iostream>
21
22
using
std::cout;
23
24
ClassImp
(
FairGeoBasicShape
)
25
26
FairGeoBasicShape
::
FairGeoBasicShape
()
27
: TNamed(),
28
nPoints(0),
29
nParam(0),
30
param(0),
31
center(new
FairGeoTransform
()),
32
position
(new FairGeoTransform())
33
{
34
// default constructor
35
}
36
37
38
FairGeoBasicShape::~FairGeoBasicShape
()
39
{
40
// destructor
41
if
(
param
) {
42
delete
param
;
43
param
=0;
44
}
45
if
(
center
) {
46
delete
center
;
47
center
=0;
48
}
49
if
(
position
) {
50
delete
position
;
51
position
=0;
52
}
53
}
54
55
56
Int_t
FairGeoBasicShape::readPoints
(std::fstream* pFile,
FairGeoVolume
* volu)
57
{
58
// reads nPoints with 3 components from Ascii file
59
// if the array of points is not existing in the volume it is created and
60
// the values are stored inside
61
// returns the number of points
62
if
(!pFile) {
return
0; }
63
if
(volu->
getNumPoints
()!=
nPoints
) { volu->
createPoints
(
nPoints
); }
64
Double_t
x
,
y
,
z
;
65
const
Int_t maxbuf=155;
66
Text_t buf[maxbuf];
67
for
(Int_t i=0; i<
nPoints
; i++) {
68
pFile->getline(buf,maxbuf);
69
sscanf(buf,
"%lf%lf%lf"
,&x,&y,&z);
70
volu->
setPoint
(i,x,y,z);
71
}
72
return
nPoints
;
73
}
74
75
76
Bool_t
FairGeoBasicShape::writePoints
(std::fstream* pFile,
FairGeoVolume
* volu)
77
{
78
// writes nPoints with 3 components to Ascii file
79
if
(!pFile) {
return
kFALSE; }
80
Text_t buf[155];
81
for
(Int_t i=0; i<volu->
getNumPoints
(); i++) {
82
FairGeoVector
&
v
=*(volu->
getPoint
(i));
83
sprintf(buf,
"%9.3f%10.3f%10.3f\n"
,
v
(0),
v
(1),
v
(2));
84
pFile->write(buf,strlen(buf));
85
}
86
return
kTRUE;
87
}
88
89
90
void
FairGeoBasicShape::printPoints
(
FairGeoVolume
* volu)
91
{
92
// prints nPoints with 3 components to screen
93
for
(Int_t i=0; i<volu->
getNumPoints
(); i++) {
94
FairGeoVector
&
v
=*(volu->
getPoint
(i));
95
printf
(
"%9.3f%10.3f%10.3f\n"
,
v
(0),
v
(1),
v
(2));
96
}
97
}
98
99
100
void
FairGeoBasicShape::calcVoluPosition
(
FairGeoVolume
* volu,
101
const
FairGeoTransform
& mTR)
102
{
103
// calculates the relevant information to position the corresponding volume
104
// in its mother and to position later other components inside this volume.
105
// The transformation mTR describes the position and orientation of the
106
// mother volume (center) relative to the physical coordinate system of
107
// the volume from which it was created.
108
FairGeoTransform
& dTC=volu->
getTransform
();
109
calcVoluPosition
(volu,dTC,mTR);
110
}
111
112
113
void
FairGeoBasicShape::posInMother
(
const
FairGeoTransform
& dTC,
114
const
FairGeoTransform
& mTR)
115
{
116
// calculates the position of the volume inside its mother
117
// dTC is the coordinate system of the ROOT volume relative to its physical
118
// coordinate system
119
// mTR is the coordinate system of the mother volume relative to its
120
// physical coordinate system
121
position
->
setRotMatrix
(
center
->
getRotMatrix
());
122
position
->
setTransVector
(
center
->
getTransVector
());
123
position
->
transFrom
(dTC);
124
position
->
transTo
(mTR);
125
FairGeoVector
t
(
position
->
getTransVector
());
126
position
->
setTransVector
(
t
*=0.1);
127
}
128
129
130
void
FairGeoBasicShape::printParam
()
131
{
132
// prints the parameters of the ROOT shape
133
if
(
param
) {
134
for
(Int_t i=0; i<
nParam
; i++) { cout<<
param
->At(i)<<
" "
; }
135
cout<<
'\n'
;
136
}
137
}
138
139
140
141
EicRoot
blob
master
geobase
FairGeoBasicShape.cxx
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:36
using
1.8.2 with
EIC GitHub integration