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

//_HADES_CLASS_DESCRIPTION 
///////////////////////////////////////////////////////////////////////////////
//
// HGeomSphe
//
// class for the GEANT shape SPHE
// 
// The size of a SPHE is defined by 3 'points' (The z-components are not used)
//   point 0:   inner radius of the shell
//              outer radius of the shell;
//   point 1:   starting polar angle of the shell,
//              ending polar angle of the shell;
//   point 2:   starting azimuthal angle of the shell,
//              ending azimuthal angle of the shell; )
//
// The intrinsic coordinate system of a SPHE, which sits in the CAVE and is
// not rotated, is identical with the laboratory system.
//
///////////////////////////////////////////////////////////////////////////////

#include "hgeomsphe.h"
#include "hgeomvolume.h"
#include "hgeomvector.h"

ClassImp(HGeomSphe)

HGeomSphe::HGeomSphe() {
  // constructor
  fName="SPHE";
  nPoints=3;
  nParam=6;
  param=new TArrayD(nParam);
}


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


Int_t HGeomSphe::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;
  const Int_t maxbuf=155;
  Text_t buf[maxbuf];
  for(Int_t i=0;i<nPoints;i++) {
    pFile->getline(buf,maxbuf);
    sscanf(buf,"%lf%lf",&x,&y);
    volu->setPoint(i,x,y,0.0);
  }
  return nPoints;
}


Bool_t HGeomSphe::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));
    sprintf(buf,"%9.3f%10.3f\n",v(0),v(1));
    pFile->write(buf,strlen(buf));
  }
  return kTRUE;
}


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


TArrayD* HGeomSphe::calcVoluParam(HGeomVolume* volu) {
  // calculates the parameters needed to create the shape SPHE 
  Double_t fac=10.;
  HGeomVector& v0=*(volu->getPoint(0));
  HGeomVector& v1=*(volu->getPoint(1));
  HGeomVector& v2=*(volu->getPoint(2));
  param->AddAt(v0(0)/fac,0);
  param->AddAt(v0(1)/fac,1);
  param->AddAt(v1(0),2);
  param->AddAt(v1(1),3);
  param->AddAt(v2(0),4);
  param->AddAt(v2(1),5);
  return param;
} 


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