#include "geantdef.h" #include "hgeocave.h" #include #include "geafuncdec.h" int HGeoCave::readDet(HGeoInfo & geoInfo, HGeoMedia & geoMedia) { #ifdef WITHORACLE HGeoParam ele; ele.objIndex=geoInfo.geoDb->getGeomParam(detName,ele); if (ele.objIndex>0) { if (ele.shape.length()<4) ele.shape += ' '; if (geoMedia.readMediumDb(geoInfo, ele.material)==HFAILURE) return HFAILURE; if (pShapes->readPointsDb(geoInfo,ele)==HFAILURE) return HFAILURE; append(detName,ele); #ifdef ILSESHOW showAll(detName,ele); #endif return HSUCCESS; } else cerr<<"*************** cannot read "<> eleName; if (eleName.empty() || eleName(0)=='/') geoInfo.fin.getline(eleName,120); else { if (eleName!=detName) { cerr << detName << " not found in file" << endl; return HFAILURE; } else { geoInfo.fin >> ele.shape.assign(20) >> ele.material.assign(40); if (ele.shape.length()==3) ele.shape.insert(3," "); readVol(geoInfo,ele); append(detName,ele); return HSUCCESS; } } } return HFAILURE; } int HGeoCave::createDet(HGeoInfo & geoInfo, HGeoMedia & geoMedia){ int matno, ivolu; HGeoParam ele; if(reset()) { HString eleName=name(); ele=element(); matno=geoMedia.createMedium(ele.material,geoInfo); HGeoShapePar & shapePar=pShapes->shapePar; if (matno) { if (pShapes->calcShape(ele)==HSUCCESS) { #ifdef WITHGEANT char* eN=eleName; char* eS=ele.shape; GSVOLU(eN,eS,matno,&(shapePar.volPar[0]),shapePar.noPar,ivolu); #endif #ifdef ILSESHOW pShapes->showShapePar(); #endif return HSUCCESS; } } } cerr << "cannot create Cave" << endl; exit(1); return HFAILURE; } int HGeoCave::writeToFile(HString & modName, HGeoInfo & geoInfo) { ofstream fout; connectOutputFile(modName,geoInfo,fout); reset(); HString volName=name(); HGeoParam ele=element(); fout << volName << '\n'; fout << ele.shape << '\n'; fout << ele.material << '\n'; if (pShapes->writePoints(fout,ele)==HFAILURE) { fout.close(); return HFAILURE; } fout.close(); return HSUCCESS; }