--- DarthVader/CalorimeterLevel2/src/calol2cm.for 2006/06/29 12:56:45 1.3 +++ DarthVader/CalorimeterLevel2/src/calol2cm.for 2007/11/29 16:11:52 1.11 @@ -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,8 +16,8 @@ c INTEGER gtr INTEGER j, m, nn, i - INTEGER IBAR(2,NPLA), NPFIT(2) - INTEGER Iquest(100) + INTEGER IBAR(2,NPLAV), NPFIT(2) + INTEGER Iquest(100), IWPL(2),CHTRACK c COMMON / TAGLIOEN / EINF, ESUP, ENER(2) SAVE / TAGLIOEN / @@ -37,7 +37,7 @@ COMMON / CH / CHECK SAVE / CH / C - COMMON / CALOFIT / VARFIT, NPFIT + COMMON / CALOFIT / VARFIT, NPFIT, IWPL,CHTRACK SAVE / CALOFIT / C COMMON / pawcd / hmemor @@ -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. @@ -86,6 +87,7 @@ QX22 = 0. QMAX = 0. GTR = 0 + CHTRACK = 0 C DISTX = 0. DISTY = 0. @@ -99,44 +101,62 @@ 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 - ENPLANEY = ENPLANEY + ESTRIP(2,I,J) DEXY(2,I,J) = ESTRIP(2,I,J) + ENPLANEY = ENPLANEY + DEXY(2,I,J) NSTRIP = NSTRIP + 1. - QTOT = QTOT + ESTRIP(2,I,J) - IF (I.LT.11) QQ(1) = QQ(1) + ESTRIP(2,I,J) + QTOT = QTOT + DEXY(2,I,J) + IF (I.LT.11) QQ(1) = QQ(1) + DEXY(2,I,J) ENDIF IF ( ESTRIP(1,I,J).GT.EMIN ) THEN - ENPLANEX = ENPLANEX + ESTRIP(1,I,J) +C IF ( ESTRIP(1,I+1,J).GT.EMIN ) THEN +C +c print *,' i ',i,' i + 1 ',I+1 +C DEXY(1,I,J) = ESTRIP(1,I+1,J) DEXY(1,I,J) = ESTRIP(1,I,J) +C + ENPLANEX = ENPLANEX + DEXY(1,I,J) NSTRIP = NSTRIP + 1. - QTOT = QTOT + ESTRIP(1,I,J) - if (i.lt.11) QQ(2) = QQ(2) + ESTRIP(1,I,J) + QTOT = QTOT + DEXY(1,I,J) + if (i.lt.11) QQ(2) = QQ(2) + DEXY(1,I,J) +c IF (I.EQ.21) THEN +c NX22 = NX22 + 1. +c QX22 = QX22 + DEXY(1,I,J) +c ENDIF ENDIF ENDIF IF ( MOD(I,2).EQ.0 ) THEN IF (ESTRIP(2,I,J).GT.EMIN) THEN - ENPLANEY = ENPLANEY + ESTRIP(2,I,J) DEXY(2,I,J) = ESTRIP(2,I,J) + ENPLANEY = ENPLANEY + DEXY(2,I,J) NSTRIP = NSTRIP + 1. - QTOT = QTOT + ESTRIP(2,I,J) - if (i.lt.11) QQ(3) = QQ(3) + ESTRIP(2,I,J) + QTOT = QTOT + DEXY(2,I,J) + if (i.lt.11) QQ(3) = QQ(3) + DEXY(2,I,J) ENDIF IF (ESTRIP(1,I,J).GT.EMIN) THEN - ENPLANEX = ENPLANEX + ESTRIP(1,I,J) +C IF (ESTRIP(1,I-1,J).GT.EMIN) THEN +C +c print *,' i ',i,' i - 1 ',I-1 +C DEXY(1,I,J) = ESTRIP(1,I-1,J) DEXY(1,I,J) = ESTRIP(1,I,J) +C + ENPLANEX = ENPLANEX + DEXY(1,I,J) NSTRIP = NSTRIP + 1. - QTOT = QTOT + ESTRIP(1,I,J) - IF (I.EQ.22) THEN + QTOT = QTOT + DEXY(1,I,J) + IF (I.EQ.NPLA) THEN NX22 = NX22 + 1. - QX22 = QX22 + ESTRIP(1,I,J) + QX22 = QX22 + DEXY(1,I,J) ENDIF - IF (I.LT.11) QQ(4) = QQ(4) + ESTRIP(1,I,J) + IF (I.LT.11) QQ(4) = QQ(4) + DEXY(1,I,J) ENDIF ENDIF C @@ -157,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) @@ -175,22 +197,33 @@ ENDIF C DO I = 1,NPLA +C NN = 1 NN = 0 - IF (M.EQ.2) NN = 1 +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. @@ -198,6 +231,11 @@ ENDIF CALL LASTRISCIA(BAR(M,I),IBAR(M,I)) CIBAR(M,I) = IBAR(M,I) + IF (ibar(m,i).EQ.-1) THEN + CHTRACK = CHTRACK + 1 + ELSE + IWPL(M) = IWPL(M) + 1 + ENDIF ENDDO ENDIF C @@ -208,7 +246,8 @@ C C CALCULATE ELEN AND SELEN C - ELEN = 40.82 * QTOT * 1.06 * 1E-4 +c ELEN = 40.82 * QTOT * 1.06 * 1E-4 + ELEN = 260. * QTOT IF (ELEN.GT.0.) THEN SELEN = ELEN * (0.01183 + 0.121 / SQRT(ELEN)) ELSE