EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FairGeoTrd1.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FairGeoTrd1.cxx
1 //*-- AUTHOR : Ilse Koenig
2 //*-- Modified : 11/11/2003 by Ilse Koenig
3 //*-- Modified : 16/05/99 by Ilse Koenig
4 
6 //
7 // FairGeoTrd1
8 //
9 // class for the GEANT shape TRD1
10 //
11 // The technical coordinate system of a TRD1, which sits in
12 // CAVE and is not rotated, is the laboratory system.
13 // The y-axis points from the smaller side to the larger one.
14 // That's the same definitition as for a TRAP and different from
15 // the Geant or ROOT definition for a TRD1.
16 // Therefore a transformation is needed:
17 // x-technical = - (x-Geant)
18 // y-technical = z-Geant
19 // z-technical = y-Geant
20 // This is stored in the data element intrinsicRot which is
21 // created in the function calcVoluPosition(...)
22 //
24 
25 #include "FairGeoTrd1.h"
26 
27 #include "FairGeoVolume.h"
28 #include "FairGeoVector.h"
29 
30 #include "TArrayD.h"
31 
33 
36  intrinsicRot(FairGeoRotation())
37 {
38  // constructor
39  fName="TRD1";
40  nPoints=8;
41  nParam=4;
42  param=new TArrayD(nParam);
43  intrinsicRot.setZero();
44  intrinsicRot.setElement(-1.,0);
45  intrinsicRot.setElement(1.,5);
46  intrinsicRot.setElement(1.,7);
47 }
48 
49 
51 {
52  // destructor
53  if (param) {
54  delete param;
55  param=0;
56  }
57  if (center) {
58  delete center;
59  center=0;
60  }
61  if (position) {
62  delete position;
63  position=0;
64  }
65 }
66 
67 
69 {
70  // calculates the parameters needed to create the shape
71  Double_t fac=20.;
72  FairGeoVector& v0=*(volu->getPoint(0));
73  FairGeoVector& v1=*(volu->getPoint(1));
74  FairGeoVector& v2=*(volu->getPoint(2));
75  FairGeoVector& v3=*(volu->getPoint(3));
76  FairGeoVector& v4=*(volu->getPoint(4));
77  param->AddAt(TMath::Abs((v0(0)-v3(0))/fac),0);
78  param->AddAt((v1(0)-v2(0))/fac,1);
79  param->AddAt((v4(2)-v0(2))/fac,2);
80  param->AddAt((v1(1)-v0(1))/fac,3);
81  return param;
82 }
83 
84 
86  const FairGeoTransform& dTC,const FairGeoTransform& mTR)
87 {
88  // calls the function posInMother(...) to calculate the position of the
89  // volume in its mother
90  Double_t t[3]= {0.,0.,0.};
91  for(Int_t i=0; i<4; i++) { t[0]+=(*(volu->getPoint(i)))(0); }
92  t[0]/=4.;
93  FairGeoVector& v0=*(volu->getPoint(0));
94  FairGeoVector& v1=*(volu->getPoint(1));
95  FairGeoVector& v4=*(volu->getPoint(4));
96  t[1]=(v1(1)+v0(1))/2.;
97  t[2]=(v4(2)+v0(2))/2.;
100  posInMother(dTC,mTR);
101 }
102