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