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