#include "geantdef.h" #include "hgeantinput.h" #include "hgeoframes.h" #include "hnamedlistfc.h" #include "geafuncdec.h" typedef HVector IVec; int HGeoFrames::readDet(HGeoInfo & geoInfo, HGeoMedia & geoMedia) { #ifdef WITHORACLE int detIndexDb=geoInfo.geoDb->getDetIndex(detNameDb); if (detIndexDb>0) { HString daughters[50]; int lN; IVec iMothers; HGeoParam ele; int nd=geoInfo.geoDb->getModuleNames(detIndexDb,daughters); if (nd<0) return HFAILURE; // error in read routine // read all mothers for(int i=0;igetGeomParam(volName,ele); if (ele.objIndex>0) { if (readParam(geoInfo,volName,ele,geoMedia)==HSUCCESS) { append(volName,ele); // showAll(volName,ele); lN=volName.length(); if (lN==4 || (lN==5 && volName[4]=='1')) iMothers.append(ele.objIndex); } } } // read daughters int nm=iMothers.length(); for (int i=0;i0) return HSUCCESS; #endif return HFAILURE; } int HGeoFrames::readDet(HGeoInfo & geoInfo) { readModule(geoInfo); if (length()>0) return HSUCCESS; return HFAILURE; } int HGeoFrames::createDet(HGeoInfo & geoInfo, HGeoMedia & geoMedia){ int matNo, copyNo, copyId, ivolu, lName; HGeoParam ele; HGeoParam mo; HNamedList copyList; HString volName, copyName; int lEleName=eleName.length(); int inout; reset(); do { volName=name(); if (lEleName>0 && volName(0,lEleName)==eleName) { lName=volName.length(); ele=element(); inout=1; if (ele.mother.find("SEC")>=0 || ele.mother.find("CAVE")>=0) { mo.shape="PGON"; mo.geaPos=0.0F; mo.geaRot=0.0F; mo.geaRot[0]=1.0F; mo.geaRot[4]=1.0F; mo.geaRot[8]=1.0F; } else mo=peek(ele.mother); if (ele.mother.find("SEC")>=0){ int secno=int(ele.mother(3,1)); if (geoInfo.getnsSet(secno)==0) inout=0; } matNo=geoMedia.createMedium(ele.material,geoInfo); HGeoShapePar & shapePar=pShapes->shapePar; if (matNo) { copyName=volName(0,4); copyNo=1; copyId=1; if (lName>4) { if (copyList.find(copyName)) copyNo=++copyList.element(0); else copyList.append(copyName,copyNo); HString s=volName(4,lName-4); copyId=int(s); } char* cN=copyName; char* eS=ele.shape; if (copyNo==1 && inout==1) { if (pShapes->calcShape(ele)==HSUCCESS) { #ifdef WITHGEANT GSVOLU(cN,eS,matNo,&(shapePar.volPar[0]),shapePar.noPar,ivolu); #endif } else return HFAILURE; } if (pShapes->posShape(ele,mo,shapePar)==HSUCCESS) { HString tmp=ele.mother(0,4); char* moN=tmp; #ifdef WITHGEANT if (inout==1) { char cTmp[]="ONLY"; GSPOS(cN,copyId,moN,shapePar.pos[0],shapePar.pos[1], shapePar.pos[2],shapePar.nRot,cTmp); } else copyNo--; #endif replace(volName,ele); } else return HFAILURE; #ifdef ILSESHOW cout << volName << " matNo: " << matNo << '\n'; pShapes->showShapePar(); #endif } else { cerr << "material for " << volName << " not defined" << endl; return HFAILURE; } } } while(next(1)); return HSUCCESS; }