#include "hgeomcone.h"
#include "hgeomvolume.h"
#include "hgeomvector.h"
ClassImp(HGeomCone)
HGeomCone::HGeomCone() {
fName="CONE";
nPoints=4;
nParam=5;
param=new TArrayD(nParam);
}
HGeomCone::~HGeomCone() {
if (param) {
delete param;
param=0;
}
if (center) {
delete center;
center=0;
}
if (position) {
delete position;
position=0;
}
}
Int_t HGeomCone::readPoints(fstream* pFile,HGeomVolume* volu) {
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);
sscanf(buf,"%lf%lf%lf",&x,&y,&z);
volu->setPoint(i,x,y,z);
i++;
pFile->getline(buf,maxbuf);
sscanf(buf,"%lf%lf",&x,&y);
volu->setPoint(i,x,y,0.0);
}
return nPoints;
}
Bool_t HGeomCone::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));
if (i==0 || i==2) 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 HGeomCone::printPoints(HGeomVolume* volu) {
for(Int_t i=0;i<nPoints;i++) {
HGeomVector& v=*(volu->getPoint(i));
if (i==0 || i==2) 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* HGeomCone::calcVoluParam(HGeomVolume* volu) {
Double_t fac=10.;
HGeomVector v=*(volu->getPoint(2)) - *(volu->getPoint(0));
param->AddAt(TMath::Abs(v(2))/fac/2.,0);
HGeomVector& v1=*(volu->getPoint(1));
param->AddAt(v1(0)/fac,1);
param->AddAt(v1(1)/fac,2);
HGeomVector& v3=*(volu->getPoint(3));
param->AddAt(v3(0)/fac,3);
param->AddAt(v3(1)/fac,4);
return param;
}
void HGeomCone::calcVoluPosition(HGeomVolume* volu,
const HGeomTransform& dTC,const HGeomTransform& mTR) {
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);
}
Last change: Sat May 22 12:56:15 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.