#include "hvector.h" #include "hgeopcon.h" typedef HVector FVec; int HGeoPcon::readPoints(HGeoInfo & geoInfo, HString & volName, HGeoParam & ele) { #ifdef WITHORACLE ele.vol=FVec(0.0F,3); char* vName=volName; // not yet implemeted !!!!!!!! cerr << "code for reading a PCON from database is not yet implemeted" << endl; return HFAILURE; #endif return HSUCCESS; } int HGeoPcon::readPoints(HGeoInfo & geoInfo, HGeoParam & ele) { int n; geoInfo.fin >> n; ele.vol=FVec(0.0F,3); ele.vol[0][0]=float(n); if (n>ele.vol.length()-2) { cerr << "number of planes in pgon too large" << endl; return HFAILURE; } geoInfo.fin >> ele.vol[1][0] >> ele.vol[1][1]; for(int i=2;i<=n;i++) {geoInfo.fin >> ele.vol[i];} return HSUCCESS; } void HGeoPcon::calcShape(HGeoParam & ele, HGeoShapePar & p) { p.noPar=3+3*(int(ele.vol[0][0])); p.volPar=FVec(0.0F,3); p.volPar[0]=ele.vol[1][0]; p.volPar[1]=ele.vol[1][1]; p.volPar[2]=ele.vol[0][0]; int n=int(p.volPar[2])+1; for(int i=2;i<=n;i++) { p.volPar.append(ele.vol[i]/10.F); } return; } int HGeoPcon::posShape(HGeoParam & ele, HGeoParam & mo, HGeoShapePar & p) { if (mo.shape=="PGON" || mo.shape=="PCON") { posInPgon(ele,mo,p); return HSUCCESS; } cerr << ele.shape << " in " << mo.shape << " is not yet implemeted" << endl; return HFAILURE; } void HGeoPcon::posInPgon(HGeoParam & ele, HGeoParam & mo, HGeoShapePar & p) { float phi, theta, fac=10.F; if (ele.rot[0]>0.9999F && ele.rot[8]>0.9999F) p.nRot=0; else { if (ele.rot[0]>0.9999F) phi=0.0F; else { phi=acos(ele.rot[0])*p.raddeg; if (ele.rot[1]>0.0F) phi=360.F - phi; cout << "************************************* phi: " << phi << endl; } if (ele.rot[8]>0.9999F) theta=0.0F; else theta=90.F - acos(ele.rot[8])*p.raddeg; #ifdef WITHGEANT GSROTM(++p.geantRotNo,90.,phi,(90.+theta),(phi+90.),theta,(90.+phi)); #else ++p.geantRotNo; #endif p.nRot=p.geantRotNo; } ele.geaPos=0.0F; p.pos=(ele.trans - mo.geaPos) /fac; return; }