#include "geantdef.h" #include "hgeantinput.h" #include "hgeomdc.h" #include "geafuncdec.h" typedef HFloatVec FVec; // Common Blocks for GEANT position of sensitive volume in the reference // coordinate system of the MDC and for shape of volume #ifdef WITHGEANT struct MDCDISTCONST_DEF { float mdcdx[4][7]; float mdcdy[4][7]; char mdcshape[5]; }; #define MDCDCONST COMMON_BLOCK(MDCDCONST,mdcdconst) COMMON_BLOCK_DEF(MDCDISTCONST_DEF,MDCDCONST); #endif int HGeoMdc::readDet(HGeoInfo & geoInfo, HGeoMedia & geoMedia) { #ifdef WITHORACLE HString sno; for(int i=1;i<=numModules;i++) { sno=i; detName.replace(2,sno); noOfKeepIn[i]=readModule(geoInfo,geoMedia); } if (length()>0) return HSUCCESS; #endif return HFAILURE; } int HGeoMdc::readDet(HGeoInfo & geoInfo) { HString sno; for(int i=1;i<=numModules;i++) { sno=i; detName.replace(2,sno); eleName.replace(1,sno); noOfKeepIn[i]=readModule(geoInfo); geoInfo.fin.seekg(0, ios::beg); geoInfo.fin.clear(); } if (length()>0) return HSUCCESS; return HFAILURE; } int HGeoMdc::createDet(HGeoInfo & geoInfo, HGeoMedia & geoMedia){ HString sno; MDCDCONST.mdcshape[0]='\0'; for(int i=1;i<=numModules;i++) { reset(); sno=i; detName.replace(2,sno); eleName.replace(1,sno); if (noOfKeepIn[i]>0) { if (createModule(geoInfo,geoMedia)==HFAILURE) return HFAILURE; } } return HSUCCESS; } int HGeoMdc::createHits(HString & volName) { extern HGeantInput geantInput; int l1, l2, idtype, iset, idet; HString copyName=volName(0,4); l1=(int)copyName(1,1); l2=(int)copyName(3,1); if(copyName(2,2) == "C4") l2 = 7; // this is the 4th cathode plane idtype=10*l1+l2; if (hitsRead<1) { int i=0; int n=geantInput.getHitNoFiles(); while (i<=n) { hitsFileName=geantInput.getHitFileName(i); if (hitsFileName.find("mdc")>=0) break; i++; } if (i>n) { cerr << "No file for hit definition of Mdc found" << endl; return HFAILURE; } if (readHits(hitsFileName)==HFAILURE) return HFAILURE; } if (restoreTree(volName)==HFAILURE) return HFAILURE; #ifdef WITHGEANT char* cS=chset; char* cN=copyName; GSDET(cS,cN,nv,chnmsv,nbitsv,idtype,1000,1000,iset,idet); GSDETH(cS,cN,nh,chnamh,nbitsh,orig,fact); #endif #ifdef ILSESHOW showHits(volName,idtype); #endif // fill Commonblock #ifdef WITHGEANT FVec refPos(0.F,3); HString shape, s1; calcRefPos(volName,refPos,s1); //cout<