program compare *------------------------------------------------------------ * read PISA VTX output file svxPISA.par, and calculate radial * distance for each ladder (by layer, ladder, sensor chip) *------------------------------------------------------------ implicit none character*100 line1, line2 integer zero, ew, bsave, chip, csave, i, & line, iret, n, idummy, barrel, ladder, sensor real x,y,z,r,rsave,phi,pi,cos,theta,tilt, & a1,b1,c1,d1,e1,f1,a2,b2,c2,d2,e2,f2, & x1,y1,z1,x2,y2,z2,r1,r2,angle1,angle2,matrix1,matrix2, & cos1,cos2,tilt1,tilt2 data pi /3.14159265/ write (6,*)'Input files: svxPISA_cvs.par and svxPIA.par' open (unit=15, file='svxPISA_cvs.par') open (unit=16, file='svxPISA.par') line = 0 do while (.true.) line = line+1 read (15,'(a100)',end=100,err=100) line1 read (16,'(a100)',end=100,err=100) line2 if (line.eq.34) then write (6,'(13x,''ladder center tilt'',/,'' & radius angle angle '',/,'' & barrel, ----------- ------------ ----------- '',/,'' & ladder old new old new old new '',/,'' & ------------------------------------------------------'')') *--------1---------2---------3---------4---------5---------6---------7-- endif if (line.ge.34 .and. mod(line+1,5).eq.0) then read (line1,'(4i12)') idummy, barrel, ladder, sensor if (barrel.ne.bsave) then write(6,*) 'Barrel',barrel,':' bsave = barrel endif line = line+1 ! read x,y,z read (15,'(a100)',end=100,err=100) line1 read (16,'(a100)',end=100,err=100) line2 cxx write (6,*) '1:',line1,'2:', line2 read(line1,'(f12.8,f20.12,f16.12)') x1,y1,z1 cxx read(line2,'(3f10.5)' ) x2,y2,z2 read(line2,'(f12.8,f20.12,f16.12)') x2,y2,z2 r1 = sqrt(x1*x1+y1*y1) r2 = sqrt(x2*x2+y2*y2) angle1 = atan2(y1,x1)*180/pi angle2 = atan2(y2,x2)*180/pi line = line+1 ! read rotation matrix read (15,'(a100)',end=100,err=100) line1 read (16,'(a100)',end=100,err=100) line2 read (line1,'(f10.6)') matrix1 read (line2,'(f10.6)') matrix2 if (sensor.eq.1) then cos1 = acos(matrix1)*180/pi cos2 = acos(matrix2)*180/pi tilt1 = cos1-90-angle1 tilt2 = cos2-90-angle2 if (tilt1.lt.-180) tilt1 = -tilt1-180 if (tilt2.lt.-180) tilt2 = -tilt2-180 if (tilt1.gt. 150) tilt1 = 180-tilt1 if (tilt2.gt. 150) tilt2 = 180-tilt2 write (6,'('' '',2i3,2f8.3,2f9.3,2f8.3)') & barrel, ladder, r1,r2, angle1, angle2, tilt1,tilt2 endif ! sensor=1 endif ! start of block enddo 100 close (unit=15) close (unit=16) stop end