Project
Loading...
Searching...
No Matches
FairGeoTrd1.cxx
Go to the documentation of this file.
1/********************************************************************************
2 * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3 * *
4 * This software is distributed under the terms of the *
5 * GNU Lesser General Public Licence (LGPL) version 3, *
6 * copied verbatim in the file "LICENSE" *
7 ********************************************************************************/
8//*-- AUTHOR : Ilse Koenig
9//*-- Modified : 11/11/2003 by Ilse Koenig
10//*-- Modified : 16/05/99 by Ilse Koenig
11
13//
14// FairGeoTrd1
15//
16// class for the GEANT shape TRD1
17//
18// The technical coordinate system of a TRD1, which sits in
19// CAVE and is not rotated, is the laboratory system.
20// The y-axis points from the smaller side to the larger one.
21// That's the same definitition as for a TRAP and different from
22// the Geant or ROOT definition for a TRD1.
23// Therefore a transformation is needed:
24// x-technical = - (x-Geant)
25// y-technical = z-Geant
26// z-technical = y-Geant
27// This is stored in the data element intrinsicRot which is
28// created in the function calcVoluPosition(...)
29//
31#include "FairGeoTrd1.h"
32
33#include "FairGeoTransform.h" // for FairGeoTransform
34#include "FairGeoVector.h" // for FairGeoVector
35#include "FairGeoVolume.h" // for FairGeoVolume
36
37#include <TArrayD.h> // for TArrayD
38#include <TMathBase.h> // for Abs
39#include <TString.h> // for TString
40
42
45 , intrinsicRot(FairGeoRotation())
46{
47 // constructor
48 fName = "TRD1";
49 nPoints = 8;
50 nParam = 4;
51 param = new TArrayD(nParam);
52 intrinsicRot.setZero();
53 intrinsicRot.setElement(-1., 0);
54 intrinsicRot.setElement(1., 5);
55 intrinsicRot.setElement(1., 7);
56}
57
59{
60 // destructor
61 delete param;
62 param = 0;
63 delete center;
64 center = 0;
65 delete position;
66 position = 0;
67}
68
70{
71 // calculates the parameters needed to create the shape
72 Double_t fac = 20.;
73 FairGeoVector& v0 = *(volu->getPoint(0));
74 FairGeoVector& v1 = *(volu->getPoint(1));
75 FairGeoVector& v2 = *(volu->getPoint(2));
76 FairGeoVector& v3 = *(volu->getPoint(3));
77 FairGeoVector& v4 = *(volu->getPoint(4));
78 param->AddAt(TMath::Abs((v0(0) - v3(0)) / fac), 0);
79 param->AddAt((v1(0) - v2(0)) / fac, 1);
80 param->AddAt((v4(2) - v0(2)) / fac, 2);
81 param->AddAt((v1(1) - v0(1)) / fac, 3);
82 return param;
83}
84
86{
87 // calls the function posInMother(...) to calculate the position of the
88 // volume in its mother
89 Double_t t[3] = {0., 0., 0.};
90 for (Int_t i = 0; i < 4; i++) {
91 t[0] += (*(volu->getPoint(i)))(0);
92 }
93 t[0] /= 4.;
94 FairGeoVector& v0 = *(volu->getPoint(0));
95 FairGeoVector& v1 = *(volu->getPoint(1));
96 FairGeoVector& v4 = *(volu->getPoint(4));
97 t[1] = (v1(1) + v0(1)) / 2.;
98 t[2] = (v4(2) + v0(2)) / 2.;
100 center->setRotMatrix(intrinsicRot);
101 posInMother(dTC, mTR);
102}
ClassImp(FairGeoTrd1)
int32_t i
FairGeoTransform * center
void posInMother(const FairGeoTransform &, const FairGeoTransform &)
FairGeoTransform * position
void setElement(const Double_t, const Int_t)
void setTransVector(const FairGeoVector &t)
void setRotMatrix(const FairGeoRotation &r)
void calcVoluPosition(FairGeoVolume *, const FairGeoTransform &, const FairGeoTransform &)
TArrayD * calcVoluParam(FairGeoVolume *)
FairGeoVector * getPoint(const Int_t n)
GLfloat v0
Definition glcorearb.h:811
GLfloat GLfloat v1
Definition glcorearb.h:812
GLfloat GLfloat GLfloat GLfloat v3
Definition glcorearb.h:814
GLenum GLfloat param
Definition glcorearb.h:271
GLfloat GLfloat GLfloat v2
Definition glcorearb.h:813