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