#include "hgeoshapes.h" void HGeoShapes::selectShape(HGeoParam & ele) { int i, no; HString allShapes[11]={"BOX ","PGON","TRAP","TRD1","PCON", "SPHE","TUBE","TUBS","CONE","CONS", "ELTU"}; no=-1; for(i=0;i<11;i++) {if(ele.shape==allShapes[i]) no=i;} switch(no) { case 0: {currentShape=&box; break;} case 1: {currentShape=&pgon; break;} case 2: {currentShape=&trap; break;} case 3: {currentShape=&trd1; break;} case 4: {currentShape=&pcon; break;} case 5: {currentShape=&sphe; break;} case 6: {currentShape=&tube; break;} case 7: {currentShape=&tubs; break;} case 8: {currentShape=&cone; break;} case 9: {currentShape=&cons; break;} case 10: {currentShape=&eltu; break;} default: { cerr << "shape " << ele.shape << " not yet implemented" << endl; currentShape=0; } } } int HGeoShapes::readPointsDb(HGeoInfo & geoInfo, HGeoParam & ele) { selectShape(ele); if (currentShape) return (currentShape->readPointsDb(geoInfo,ele)); return HFAILURE; } int HGeoShapes::readPoints(HGeoInfo & geoInfo, HGeoParam & ele) { selectShape(ele); if (currentShape) return (currentShape->readPoints(geoInfo,ele)); return HFAILURE; } int HGeoShapes::calcShape(HGeoParam & ele) { selectShape(ele); if (currentShape) { currentShape->calcShape(ele,shapePar); return HSUCCESS; } return HFAILURE; } int HGeoShapes::posShape(HGeoParam & ele,HGeoParam & mo, HGeoShapePar & shapePar) { selectShape(ele); if (currentShape) { currentShape->posShape(ele,mo,shapePar); return HSUCCESS; } return HFAILURE; } int HGeoShapes::writePoints(ofstream & fout, HGeoParam & ele) { selectShape(ele); if (currentShape) { currentShape->writePoints(fout,ele); return HSUCCESS; } return HFAILURE; } void HGeoShapes::showShapePar() { cout << "Geant Parameter:" << endl; cout << "noPar: " << shapePar.noPar << endl; cout << shapePar.volPar; cout << "nRot: " << shapePar.nRot << endl; cout << "pos: " << shapePar.pos << endl; cout << "//--------------------------------------------------------" << endl; }