ROOT logo
//*-- AUTHOR : Ilse Koenig
//*-- Modified : 11/11/2003 by Ilse Koenig
//*-- Modified : 28/06/99 by Ilse Koenig

//_HADES_CLASS_DESCRIPTION 
///////////////////////////////////////////////////////////////////////////////
//
// HGeomEltu
//
// class for the GEANT shape ELTU
// 
// The size of a ELTU is defined by 3 'points'.
//   point 0:   origin of starting ellipse of the eltu;
//   point 1:   semi-axis of the ellipse along x,
//              semi-axis of the ellipse along y;
//              (z-component not used)
//   point 2:   origin of ending ellipse of the eltu;
// Warning: The x- and y-values of point 0 and 2 have to be the same!!!!
//          A rotation has to be desribed via the rotation matrix.
//
// The intrinsic coordinate system of a ELTU, which sits in the CAVE and is
// not rotated, is identical with the laboratory system.
//
///////////////////////////////////////////////////////////////////////////////

#include "hgeomeltu.h"
#include "hgeomvolume.h"
#include "hgeomvector.h"

ClassImp(HGeomEltu)

HGeomEltu::HGeomEltu() {
  // constructor
  fName="ELTU";
  nPoints=3;
  nParam=3;
  param=new TArrayD(nParam);
}


HGeomEltu::~HGeomEltu() {
  // default destructor
  if (param) {
    delete param;
    param=0;
  }
  if (center) {
    delete center;
    center=0;
  }
  if (position) {
    delete position;
    position=0;
  }
}


Int_t HGeomEltu::readPoints(fstream* pFile,HGeomVolume* volu) {
  // reads the 3 'points' decribed above from ascii file
  // if the array of points is not existing in the volume it is created and
  // the values are stored inside
  // returns the number of points
  if (!pFile) return 0;
  if (volu->getNumPoints()!=nPoints) volu->createPoints(nPoints);
  Double_t x,y,z;
  const Int_t maxbuf=155;
  Text_t buf[maxbuf];
  for(Int_t i=0;i<nPoints;i++) {
    pFile->getline(buf,maxbuf);
    if (i!=1) {
      sscanf(buf,"%lf%lf%lf",&x,&y,&z);
      volu->setPoint(i,x,y,z);
    } else {
      sscanf(buf,"%lf%lf",&x,&y);
      volu->setPoint(i,x,y,0.0);
    }
  }
  return nPoints;
}


Bool_t HGeomEltu::writePoints(fstream* pFile,HGeomVolume* volu) {
  // writes the 3 'points' decribed above to ascii file
  if (!pFile) return kFALSE;  
  Text_t buf[155];
  for(Int_t i=0;i<nPoints;i++) {
    HGeomVector& v=*(volu->getPoint(i));
    if (i!=1) sprintf(buf,"%9.3f%10.3f%10.3f\n",v(0),v(1),v(2));
    else sprintf(buf,"%9.3f%10.3f\n",v(0),v(1));
    pFile->write(buf,strlen(buf));
  }
  return kTRUE;
}


void HGeomEltu::printPoints(HGeomVolume* volu) {
  // prints volume points to screen
  for(Int_t i=0;i<nPoints;i++) {
    HGeomVector& v=*(volu->getPoint(i));
    if (i!=1) printf("%9.3f%10.3f%10.3f\n",v(0),v(1),v(2));
    else printf("%9.3f%10.3f\n",v(0),v(1));
  }
}


TArrayD* HGeomEltu::calcVoluParam(HGeomVolume* volu) {
  // calculates the parameters needed to create the shape ELTU
  Double_t fac=10.;
  HGeomVector& v1=*(volu->getPoint(1));
  param->AddAt(v1(0)/fac,0);
  param->AddAt(v1(1)/fac,1);
  HGeomVector v=*(volu->getPoint(2)) - *(volu->getPoint(0));
  param->AddAt(TMath::Abs(v(2))/fac/2.,2);
  return param;
} 


void HGeomEltu::calcVoluPosition(HGeomVolume* volu,
          const HGeomTransform& dTC,const HGeomTransform& mTR) {
  // calculates the position of the center of the volume in the intrinsic
  // coordinate system and stores it in the data element 'center'
  // calls the function posInMother(...) to calculate the position of the
  // volume in its mother 
  Double_t t[3]={0.,0.,0.};
  HGeomVector v=*(volu->getPoint(2)) + *(volu->getPoint(0));
  t[2]=v(2)/2.;  
  center->clear();
  center->setTransVector(t);
  posInMother(dTC,mTR);
}
 hgeomeltu.cc:1
 hgeomeltu.cc:2
 hgeomeltu.cc:3
 hgeomeltu.cc:4
 hgeomeltu.cc:5
 hgeomeltu.cc:6
 hgeomeltu.cc:7
 hgeomeltu.cc:8
 hgeomeltu.cc:9
 hgeomeltu.cc:10
 hgeomeltu.cc:11
 hgeomeltu.cc:12
 hgeomeltu.cc:13
 hgeomeltu.cc:14
 hgeomeltu.cc:15
 hgeomeltu.cc:16
 hgeomeltu.cc:17
 hgeomeltu.cc:18
 hgeomeltu.cc:19
 hgeomeltu.cc:20
 hgeomeltu.cc:21
 hgeomeltu.cc:22
 hgeomeltu.cc:23
 hgeomeltu.cc:24
 hgeomeltu.cc:25
 hgeomeltu.cc:26
 hgeomeltu.cc:27
 hgeomeltu.cc:28
 hgeomeltu.cc:29
 hgeomeltu.cc:30
 hgeomeltu.cc:31
 hgeomeltu.cc:32
 hgeomeltu.cc:33
 hgeomeltu.cc:34
 hgeomeltu.cc:35
 hgeomeltu.cc:36
 hgeomeltu.cc:37
 hgeomeltu.cc:38
 hgeomeltu.cc:39
 hgeomeltu.cc:40
 hgeomeltu.cc:41
 hgeomeltu.cc:42
 hgeomeltu.cc:43
 hgeomeltu.cc:44
 hgeomeltu.cc:45
 hgeomeltu.cc:46
 hgeomeltu.cc:47
 hgeomeltu.cc:48
 hgeomeltu.cc:49
 hgeomeltu.cc:50
 hgeomeltu.cc:51
 hgeomeltu.cc:52
 hgeomeltu.cc:53
 hgeomeltu.cc:54
 hgeomeltu.cc:55
 hgeomeltu.cc:56
 hgeomeltu.cc:57
 hgeomeltu.cc:58
 hgeomeltu.cc:59
 hgeomeltu.cc:60
 hgeomeltu.cc:61
 hgeomeltu.cc:62
 hgeomeltu.cc:63
 hgeomeltu.cc:64
 hgeomeltu.cc:65
 hgeomeltu.cc:66
 hgeomeltu.cc:67
 hgeomeltu.cc:68
 hgeomeltu.cc:69
 hgeomeltu.cc:70
 hgeomeltu.cc:71
 hgeomeltu.cc:72
 hgeomeltu.cc:73
 hgeomeltu.cc:74
 hgeomeltu.cc:75
 hgeomeltu.cc:76
 hgeomeltu.cc:77
 hgeomeltu.cc:78
 hgeomeltu.cc:79
 hgeomeltu.cc:80
 hgeomeltu.cc:81
 hgeomeltu.cc:82
 hgeomeltu.cc:83
 hgeomeltu.cc:84
 hgeomeltu.cc:85
 hgeomeltu.cc:86
 hgeomeltu.cc:87
 hgeomeltu.cc:88
 hgeomeltu.cc:89
 hgeomeltu.cc:90
 hgeomeltu.cc:91
 hgeomeltu.cc:92
 hgeomeltu.cc:93
 hgeomeltu.cc:94
 hgeomeltu.cc:95
 hgeomeltu.cc:96
 hgeomeltu.cc:97
 hgeomeltu.cc:98
 hgeomeltu.cc:99
 hgeomeltu.cc:100
 hgeomeltu.cc:101
 hgeomeltu.cc:102
 hgeomeltu.cc:103
 hgeomeltu.cc:104
 hgeomeltu.cc:105
 hgeomeltu.cc:106
 hgeomeltu.cc:107
 hgeomeltu.cc:108
 hgeomeltu.cc:109
 hgeomeltu.cc:110
 hgeomeltu.cc:111
 hgeomeltu.cc:112
 hgeomeltu.cc:113
 hgeomeltu.cc:114
 hgeomeltu.cc:115
 hgeomeltu.cc:116
 hgeomeltu.cc:117
 hgeomeltu.cc:118
 hgeomeltu.cc:119
 hgeomeltu.cc:120
 hgeomeltu.cc:121
 hgeomeltu.cc:122
 hgeomeltu.cc:123
 hgeomeltu.cc:124
 hgeomeltu.cc:125
 hgeomeltu.cc:126
 hgeomeltu.cc:127
 hgeomeltu.cc:128
 hgeomeltu.cc:129
 hgeomeltu.cc:130