--- DarthVader/CalorimeterLevel2/src/calol2cm.for 2007/03/30 11:17:16 1.7 +++ DarthVader/CalorimeterLevel2/src/calol2cm.for 2008/12/12 16:18:19 1.12 @@ -5,10 +5,10 @@ C INCLUDE 'INTEST.TXT' C - REAL PIANO(22), VARFIT(2) + REAL PIANO(NPLAV), VARFIT(2) REAL SHIFT - REAL TG(2), BAR(2,NPLA) - REAL DISTX, DISTY, Y(NPLA), YY(NPLA) + REAL TG(2), BAR(2,NPLAV) + REAL DISTX, DISTY, Y(NPLAV), YY(NPLAV) REAL RIG, RMASS REAL CHECK, ENER, CX, CY REAL EINF, ESUP,ENPLANEX,ENPLANEY,TENPLAX,TENPLAY @@ -16,7 +16,7 @@ c INTEGER gtr INTEGER j, m, nn, i - INTEGER IBAR(2,NPLA), NPFIT(2) + INTEGER IBAR(2,NPLAV), NPFIT(2) INTEGER Iquest(100), IWPL(2),CHTRACK c COMMON / TAGLIOEN / EINF, ESUP, ENER(2) @@ -53,8 +53,9 @@ C C Z position of Y planes, Y1 = 0., Y2 = -8.09, Y3 = -18.18, ... C +c print *,'NPLA IS ',NPLA PIANO(1) = 0. - DO I = 2, 22 + DO I = 2, NPLA IF ( MOD(I,2).EQ.0 ) THEN PIANO(I) = PIANO(I-1) - 8.09 ELSE @@ -63,13 +64,13 @@ ENDDO C CALL VZERO(DEXY,2*LENSEV) - CALL VZERO(BAR,2*NPLA) - CALL VZERO(IBAR,2*NPLA) - CALL VZERO(CBAR,2*NPLA) - CALL VZERO(CIBAR,2*NPLA) + CALL VZERO(BAR,2*NPLAV) + CALL VZERO(IBAR,2*NPLAV) + CALL VZERO(CBAR,2*NPLAV) + CALL VZERO(CIBAR,2*NPLAV) CALL VZERO(QQ,4) - CALL VZERO(Y,NPLA) - CALL VZERO(YY,NPLA) + CALL VZERO(Y,NPLAV) + CALL VZERO(YY,NPLAV) VARFIT(1) = 0. VARFIT(2) = 0. NPFIT(1) = 0. @@ -100,10 +101,14 @@ C C CALCULATE QTOT, NSTRIP, QQ, NX22, QX22, QMAX AND PLANEMAX C - DO I = 1,22 + DO I = 1,NPLA ENPLANEY = 0. ENPLANEX = 0. DO J = 1,96 +c if ( ESTRIP(1,I,J).gt.0) +c & print *,' I ',I,' J ',J,' ES1 ',ESTRIP(1,I,J) +c if ( ESTRIP(2,I,J).gt.0) +c & print *,' I ',I,' J ',J,' ES2 ',ESTRIP(2,I,J) IF ( MOD(I,2).NE.0 ) THEN IF ( ESTRIP(2,I,J).GT.EMIN ) THEN DEXY(2,I,J) = ESTRIP(2,I,J) @@ -147,7 +152,7 @@ ENPLANEX = ENPLANEX + DEXY(1,I,J) NSTRIP = NSTRIP + 1. QTOT = QTOT + DEXY(1,I,J) - IF (I.EQ.22) THEN + IF (I.EQ.NPLA) THEN NX22 = NX22 + 1. QX22 = QX22 + DEXY(1,I,J) ENDIF @@ -172,7 +177,9 @@ C FIT THE TRACK INSIDE THE CALORIMETER C if (GOOD2.EQ.1.OR.TRIGTY.GE.2) then +c print *,' CALL CLUSTER ' CALL CLUSTER +c print *,' CALL DIRECTION ' CALL DIRECTION(TG) NPCFIT(1) = NPFIT(1) NPCFIT(2) = NPFIT(2) @@ -190,23 +197,33 @@ ENDIF C DO I = 1,NPLA - NN = 1 -C NN = 0 +C NN = 1 + NN = 0 C IF (M.EQ.2) NN = 1 IF (MOD(I,2).EQ.NN) THEN - SHIFT = +0.5 + IF (REVERSE.EQ.0) THEN + SHIFT = -0.5 + ELSE + SHIFT = +0.5 + ENDIF ELSE - SHIFT = -0.5 + IF (REVERSE.EQ.0) THEN + SHIFT = +0.5 + ELSE + SHIFT = -0.5 + ENDIF ENDIF C IF (M.EQ.1) THEN DISTX = PIANO(I) - 5.81 +c print *,'C X PLANE I= ',I,' Z = ',DISTX+ZALIG Y(I) = DISTX * TG(1) + CX BAR(M,I) = Y(I) CBAR(M,I) = (Y(I) - XALIG)/10. C ELSE DISTY = PIANO(I) +c print *,'C Y PLANE I= ',I,' Z = ',DISTY+ZALIG YY(I) = DISTY * TG(2) + CY BAR(M,I) = YY(I) CBAR(M,I) = (-YALIG + YY(I))/10. @@ -229,7 +246,9 @@ C C CALCULATE ELEN AND SELEN C - ELEN = 40.82 * QTOT * 1.06 * 1E-4 +c ELEN = 40.82 * QTOT * 1.06 * 1E-4 +C ELEN = 260. * QTOT + ELEN = QTOT / 260. IF (ELEN.GT.0.) THEN SELEN = ELEN * (0.01183 + 0.121 / SQRT(ELEN)) ELSE