+ if( idtmed[itmed]<=0 ) {
+ Error("ReadEuclid","TMED undefined medium number %d for %s\n",itmed,natmed);
+ exit(1);
+ }
+ gMC->Gckmat(idtmed[itmed],natmed);
+ //*
+ } else if (!strcmp(key,"ROTM")) {
+ sscanf(&card[4],"%d %f %f %f %f %f %f",&irot,&teta1,&phi1,&teta2,&phi2,&teta3,&phi3);
+ if( irot<=0 || irot>=kMaxRot ) {
+ Error("ReadEuclid","ROTM rotation matrix number %d illegal\n",irot);
+ exit(1);
+ }
+ AliMatrix(idrot[irot],teta1,phi1,teta2,phi2,teta3,phi3);
+ //*
+ } else if (!strcmp(key,"VOLU")) {
+ sscanf(&card[5],"'%[^']' '%[^']' %d %d", name, shape, &numed, &npar);
+ if (npar>0) {
+ for(i=0;i<npar;i++) fscanf(lun,"%f",&par[i]);
+ fscanf(lun,"%*c");
+ }
+ gMC->Gsvolu( name, shape, idtmed[numed], par, npar);
+ //* save the defined volumes
+ strcpy(volst[++nvol],name);
+ istop[nvol]=1;
+ //*
+ } else if (!strcmp(key,"DIVN")) {
+ sscanf(&card[5],"'%[^']' '%[^']' %d %d", name, mother, &ndiv, &iaxe);
+ gMC->Gsdvn ( name, mother, ndiv, iaxe );
+ //*
+ } else if (!strcmp(key,"DVN2")) {
+ sscanf(&card[5],"'%[^']' '%[^']' %d %d %f %d",name, mother, &ndiv, &iaxe, &orig, &numed);
+ gMC->Gsdvn2( name, mother, ndiv, iaxe, orig,idtmed[numed]);
+ //*
+ } else if (!strcmp(key,"DIVT")) {
+ sscanf(&card[5],"'%[^']' '%[^']' %f %d %d %d", name, mother, &step, &iaxe, &numed, &ndvmx);
+ gMC->Gsdvt ( name, mother, step, iaxe, idtmed[numed], ndvmx);
+ //*
+ } else if (!strcmp(key,"DVT2")) {
+ sscanf(&card[5],"'%[^']' '%[^']' %f %d %f %d %d", name, mother, &step, &iaxe, &orig, &numed, &ndvmx);
+ gMC->Gsdvt2 ( name, mother, step, iaxe, orig, idtmed[numed], ndvmx );
+ //*
+ } else if (!strcmp(key,"POSI")) {
+ sscanf(&card[5],"'%[^']' %d '%[^']' %f %f %f %d '%[^']'", name, &nr, mother, &xo, &yo, &zo, &irot, konly);
+ if( irot<0 || irot>=kMaxRot ) {
+ Error("ReadEuclid","POSI %s#%d rotation matrix number %d illegal\n",name,nr,irot);
+ exit(1);
+ }
+ if( idrot[irot] == -99) {
+ Error("ReadEuclid","POSI %s#%d undefined matrix number %d\n",name,nr,irot);
+ exit(1);
+ }
+ //*** volume name cannot be the top volume
+ for(i=1;i<=nvol;i++) {
+ if (!strcmp(volst[i],name)) istop[i]=0;
+ }
+ //*
+ gMC->Gspos ( name, nr, mother, xo, yo, zo, idrot[irot], konly );
+ //*
+ } else if (!strcmp(key,"POSP")) {
+ sscanf(&card[5],"'%[^']' %d '%[^']' %f %f %f %d '%[^']' %d", name, &nr, mother, &xo, &yo, &zo, &irot, konly, &npar);
+ if( irot<0 || irot>=kMaxRot ) {
+ Error("ReadEuclid","POSP %s#%d rotation matrix number %d illegal\n",name,nr,irot);
+ exit(1);
+ }
+ if( idrot[irot] == -99) {
+ Error("ReadEuclid","POSP %s#%d undefined matrix number %d\n",name,nr,irot);
+ exit(1);
+ }
+ if (npar > 0) {
+ for(i=0;i<npar;i++) fscanf(lun,"%f",&par[i]);
+ fscanf(lun,"%*c");
+ }
+ //*** volume name cannot be the top volume
+ for(i=1;i<=nvol;i++) {
+ if (!strcmp(volst[i],name)) istop[i]=0;
+ }
+ //*
+ gMC->Gsposp ( name, nr, mother, xo,yo,zo, idrot[irot], konly, par, npar);
+ }
+ //*
+ if (strcmp(key,"END")) goto L10;
+ //* find top volume in the geometry
+ flag=0;
+ for(i=1;i<=nvol;i++) {
+ if (istop[i] && flag) {
+ Warning("ReadEuclid"," %s is another possible top volume\n",volst[i]);
+ }
+ if (istop[i] && !flag) {
+ strcpy(topvol,volst[i]);
+ if(fDebug) printf("%s::ReadEuclid: volume %s taken as a top volume\n",ClassName(),topvol);
+ flag=1;
+ }
+ }
+ if (!flag) {
+ Warning("ReadEuclid","top volume not found\n");