#include "hgeomsphe.h"
#include "hgeomvolume.h"
#include "hgeomvector.h"
ClassImp(HGeomSphe)
HGeomSphe::HGeomSphe() {
fName="SPHE";
nPoints=3;
nParam=6;
param=new TArrayD(nParam);
}
HGeomSphe::~HGeomSphe() {
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) {
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) {
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) {
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) {
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) {
center->clear();
posInMother(dTC,mTR);
}
Last change: Sat May 22 12:56:40 2010
Last generated: 2010-05-22 12:56
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.