1 |
* |
2 |
* $Id$ |
3 |
* |
4 |
* $Log$ |
5 |
* |
6 |
*CMZ : 2.01/00 06/03/2000 13.07.03 by Francesco Cafagna |
7 |
*CMZ : 2.00/00 25/02/2000 17.16.49 by Francesco Cafagna |
8 |
*CMZ : 1.02/00 22/10/99 16.17.58 by Francesco Cafagna |
9 |
*CMZ : 1.01/00 21/05/96 17.33.37 by Francesco Cafagna |
10 |
*CMZ : 1.00/02 04/04/96 16.08.24 by Francesco Cafagna |
11 |
*-- Author : Francesco Cafagna 23/02/96 |
12 |
SUBROUTINE GPDTOF |
13 |
************************************************************************ |
14 |
* * |
15 |
* To perform TOF digitization * |
16 |
* * |
17 |
* Called by: GUDIGI * |
18 |
* Author: Francesco Cafagna, 23/02/96 12.50.38 * |
19 |
* * |
20 |
************************************************************************ |
21 |
#include "gcunit.inc" |
22 |
#include "gpphit.inc" |
23 |
PARAMETER (NH=NHTOF,NHM=NHMTOF,NVOL=3) |
24 |
#include "gprhit.inc" |
25 |
#include "gptof.inc" |
26 |
#include "gpsed.inc" |
27 |
* |
28 |
INTEGER IS,ID,NV,NVM,NNHM,INDEX,NPLANE |
29 |
CHARACTER*4 CSET(7) |
30 |
DATA CSET/'S11 ','S12 ','S21 ','S22 ','S31 ','S32 ','S4 '/ |
31 |
* |
32 |
* Vector zeroed |
33 |
* |
34 |
CALL VZERO(IPLTOF,NHM) |
35 |
CALL VZERO(IPADDLE,NHM) |
36 |
CALL VZERO(IPARTOF,NHM) |
37 |
CALL VZERO(XINTOF,NHM) |
38 |
CALL VZERO(YINTOF,NHM) |
39 |
CALL VZERO(ZINTOF,NHM) |
40 |
CALL VZERO(XOUTTOF,NHM) |
41 |
CALL VZERO(YOUTTOF,NHM) |
42 |
CALL VZERO(ZOUTTOF,NHM) |
43 |
CALL VZERO(ERELTOF,NHM) |
44 |
CALL VZERO(TIMETOF,NHM) |
45 |
CALL VZERO(PATHTOF,NHM) |
46 |
CALL VZERO(P0TOF,NHM) |
47 |
* |
48 |
CALL VZERO(NUMD ,NVOL) |
49 |
* |
50 |
* Start with tof top |
51 |
* |
52 |
NV = NVOL |
53 |
NVM= NVMAX |
54 |
IT = -1 |
55 |
NTHTOF = 0 |
56 |
INDEX = 0 |
57 |
DO II=1,7 |
58 |
IS= II |
59 |
ID= 1 |
60 |
* |
61 |
* Check on the volume level |
62 |
* |
63 |
IF (NV.GT.NVM) THEN |
64 |
WRITE(CHMAIL,10000) CSET,CNSED(IS,ID),NVOL,NVMAX, IDRUN, |
65 |
+ IDEVT |
66 |
CALL GMAIL(1,0) |
67 |
GO TO 10 |
68 |
ENDIF |
69 |
CALL VZERO(VHITS,NH*NHM) |
70 |
CALL VZERO(ITRA ,NHM) |
71 |
CALL VZERO(NUMBV,NVOL*NHM) |
72 |
NHITS = -1 |
73 |
CALL GPRHIT(CSET(II),CNSED(IS,ID),IS,ID,NVOL,NH,NHM,1, |
74 |
+ IT,NUMD,ITRA,NUMBV,VHITS,NHITS) |
75 |
* |
76 |
* If there was a problem in GPRHIT then exit |
77 |
* |
78 |
IF(NHITS.LT.0) THEN |
79 |
WRITE(CHMAIL,10200) CSET(IS),CNSED(IS,ID),NHITS,NHM, |
80 |
+ IDRUN,IDEVT |
81 |
CALL GMAIL(1,0) |
82 |
GO TO 10 |
83 |
ENDIF |
84 |
* |
85 |
* Fill the CWN common |
86 |
* |
87 |
NPLANE = II |
88 |
NTHTOF = NHITS + NTHTOF |
89 |
DO I=1,NHITS |
90 |
INDEX = INDEX + 1 |
91 |
IPLTOF(INDEX) = NPLANE |
92 |
*ML: |
93 |
IPADDLE(INDEX) = NUMBV(NVTOF,I) |
94 |
IF(II.EQ.7) THEN |
95 |
IPADDLE(INDEX) = NUMBV(NVS4,I) |
96 |
ENDIF |
97 |
*END ML. |
98 |
#if defined(GPAMELA_INTER) |
99 |
XAVTOF(INDEX) = VHITS(1,I) |
100 |
YAVTOF(INDEX) = VHITS(2,I) |
101 |
ZAVTOF(INDEX) = VHITS(3,I) |
102 |
XOUTTOF(INDEX) = VHITS(4,I) |
103 |
YOUTTOF(INDEX) = VHITS(5,I) |
104 |
ZOUTTOF(INDEX) = VHITS(6,I) |
105 |
XINTOF(INDEX) = 2*XAVTOF(INDEX) - XOUTTOF(INDEX) |
106 |
YINTOF(INDEX) = 2*YAVTOF(INDEX) - YOUTTOF(INDEX) |
107 |
ZINTOF(INDEX) = 2*ZAVTOF(INDEX) - ZOUTTOF(INDEX) |
108 |
#endif |
109 |
#if !defined(GPAMELA_INTER) |
110 |
XINTOF(INDEX) = VHITS(1,I) |
111 |
YINTOF(INDEX) = VHITS(2,I) |
112 |
ZINTOF(INDEX) = VHITS(3,I) |
113 |
XOUTTOF(INDEX) = VHITS(4,I) |
114 |
YOUTTOF(INDEX) = VHITS(5,I) |
115 |
ZOUTTOF(INDEX) = VHITS(6,I) |
116 |
XAVTOF(INDEX) = (XINTOF(INDEX)+XOUTTOF(INDEX))/2. |
117 |
YAVTOF(INDEX) = (YINTOF(INDEX)+YOUTTOF(INDEX))/2. |
118 |
ZAVTOF(INDEX) = (ZINTOF(INDEX)+ZOUTTOF(INDEX))/2. |
119 |
#endif |
120 |
*ML: |
121 |
* ERELTOF(INDEX) = VHITS(7,I) |
122 |
ERELTOF(INDEX) = VHITS(11,I) |
123 |
TIMETOF(INDEX) = VHITS(8,I) |
124 |
PATHTOF(INDEX) = VHITS(9,I) |
125 |
IPARTOF(INDEX) = VHITS(10,I) |
126 |
* P0TOF (INDEX) = VHITS(11,I) |
127 |
P0TOF(INDEX) = VHITS(7,I) |
128 |
ENDDO |
129 |
ENDDO |
130 |
* |
131 |
10000 FORMAT(' GPDTOF: VOLUME level too big: SET=',A4,', DET=',A4, |
132 |
+ ',NVOL=',I3,', NVMAX=',I3,', RUN=',I5,', EVT=',I8) |
133 |
10100 FORMAT(' GPDTOF: MAX number of hits retrived: SET=',A4, |
134 |
+ ', DET=',A4,',NHREAD=',I5,', NHMAX=',I5, |
135 |
+ ', RUN=',I5,', EVT=',I8) |
136 |
10200 FORMAT(' GPDTOF: Error in GPRHIT: SET=',A4, |
137 |
+ ', DET=',A4,',NHITS=',I5,', NHMAX=',I5, |
138 |
+ ', RUN=',I5,', EVT=',I8) |
139 |
10 RETURN |
140 |
END |