/[PAMELA software]/gpamela/gptrd/gputrd.F
ViewVC logotype

Contents of /gpamela/gptrd/gputrd.F

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3.1 - (show annotations) (download)
Thu Jul 11 16:02:01 2002 UTC (22 years, 4 months ago) by cafagna
Branch: MAIN
Branch point for: v3r0
Initial revision

1 *
2 * $Id$
3 *
4 * $Log$
5 *
6 *CMZ : 3.00/00 07/02/2002 12.41.53 by Unknown
7 *CMZ : 2.01/00 05/04/2000 14.35.18 by Marialuigia Ambriola
8 *CMZ : 2.00/00 29/02/2000 10.23.24 by Francesco Cafagna
9 *CMZ : 1.02/00 09/02/2000 17.22.16 by Francesco Cafagna
10 *CMZ : 1.00/02 04/04/96 16.47.16 by Francesco Cafagna
11 *-- Author : Francesco Cafagna 21/02/96
12 SUBROUTINE GPUTRD(IACT,IS,ID,IPA,IT,DELOSS,PATH,
13 + TRAPAR,NUMVOL,IMEC)
14 ************************************************************************
15 * *
16 * To collect and store the hit structure for TRD *
17 * *
18 * Variables definition: *
19 * IN: *
20 * IACT, integer specifing the action to be taken. It is the INWVOL *
21 * variable in GCTRAK common *
22 * IS , set number *
23 * ID , detector number *
24 * IPA , particle number *
25 * IT , track number *
26 * DELOSS, energy loss in the step *
27 * PATH , current track lenght *
28 * TRAPAR, track parameter, is the VECT vector in GCTRAK common *
29 * NUMVOL, integr array of numbers identifying the DETECTOR *
30 * IMEC , integer indicating the LOSS mecanism position inside NMEC *
31 * vector, zero if not present *
32 * *
33 * *
34 * Called by: GUSTEP *
35 * Author: Francesco Cafagna, 21/02/96 16.13.51 *
36 * *
37 ************************************************************************
38 #include "gphit.inc"
39 #include "gcunit.inc"
40 #include "gptotr.inc"
41 #if defined(GPAMELA_GARFIELD)
42 #include "gctrak.inc"
43 #include "gckine.inc"
44 #endif
45 *
46 INTEGER IACT,IS,ID,IPA,IT,NUMVOL(20),IMEC,IDHIT
47 REAL DELOSS,PATH,TRAPAR(7),VHIT(NHTRD)
48 LOGICAL SAVE
49 #if defined(GPAMELA_GARFIELD)
50 *
51 * Some variables need to call the GARFIELD interface
52 *
53 CHARACTER*20 CHJUNK
54 REAL GARXYZ(6),GARPAR(3),ECLTOT,RJUNK,RBJUNK(10)
55 INTEGER IFAIL,NCLUS,IJUNK,IWBUFF
56 #endif
57 *
58 * if the detector is IDTRSO the hit is not stored
59 *
60 * Track is inside a volume
61 *
62 IF(IACT.EQ.0) THEN
63 IF(IMEC.GT.0) THEN
64 SAVE = .TRUE.
65 VHIT(7) = DELOSS + VHIT(7)
66 ENDIF
67 ENDIF
68 *
69 * Entering a new volume or is a new track
70 *
71 IF(IACT.EQ.1) THEN
72 SAVE = .FALSE.
73 CALL VZERO(VHIT,NHTRD)
74 DO I=1,3
75 VHIT(I) = TRAPAR(I)
76 ENDDO
77 IF(IMEC.GT.0) THEN
78 SAVE = .TRUE.
79 VHIT(7) = DELOSS
80 ENDIF
81 VHIT(8) = PATH
82 VHIT(9) = IPA
83 VHIT(10)= TRAPAR(7)
84 IDHIT = -1
85 ENDIF
86 *
87 * Track is exiting current volume
88 *
89 IF(IACT.EQ.2) THEN
90 DO I=1,3
91 VHIT(I+3) = TRAPAR(I)
92 #if defined(GPAMELA_INTER)
93 * interactive case, we need the average position
94 VHIT(I) = (VHIT(I) + VHIT(I+3) )/2.
95 #endif
96 ENDDO
97 #if defined(GPAMELA_GARFIELD)
98 * Convert coordinates from the MARS to the local reference system
99 IF(IMEC.GT.0) THEN
100 CALL GMTOD(VHIT,GARXYZ,1)
101 CALL GMTOD(TRAPAR,GARXYZ(4),1)
102 C PRINT*,'GARXYZ,PATH=',(GARXYZ(I),I=1,6),PATH
103 * CALL GPTOGAR(GARXYZ,GARXYZ)
104 * CALL GPTOGAR(GARXYZ(4),GARXYZ(4))
105 *
106 * Get the particle infos
107 *
108 CALL GFPART(IPA,CHJUNK,IJUNK,GARPAR(1),GARPAR(2),
109 + RJUNK,RBJUNK,IWBUFF)
110 *
111 * Convert mass from GeV to Mev, calculate kinetic energy and convert it in MeV
112 *
113 GARPAR(3) =
114 + (SQRT(TRAPAR(7)**2+GARPAR(1)**2)-GARPAR(1))*1000.
115 GARPAR(1) = GARPAR(1)*1000.
116 *
117 * Let's calculate the clusters
118 *
119 CALL GPGACL(IPA,GARPAR,GARXYZ,ECLTOT,NCLUS)
120 *
121 * fill the hit structure (energy in GeV)
122 *
123 VHIT(13)=ECLTOT/1000.
124 C VHIT(14)=FLOAT(NCLUS)
125 VHIT(14)=INT(NCLUS)
126 C* ML: update the kinetic energy and then the momentum:
127 GEKINT=GEKIN-VHIT(13)
128 GEKIN=GEKINT
129 GETOT=GEKIN +AMASS
130 VECT(7)= SQRT((GETOT+AMASS)*GEKIN)
131 C Routine to find bin number in kinetic energy table stored in ELOW(NEKBIN)
132 CALL GEKBIN
133 C* END ML.
134 ENDIF
135 #endif
136 IF(IMEC.GT.0) THEN
137 SAVE = .TRUE.
138 VHIT(7) = DELOSS + VHIT(7)
139 ENDIF
140 VHIT(8) = PATH - VHIT(8)
141 *
142 * Store the hit
143 *
144 IF(IDHIT.EQ.-1) THEN
145 IF(TROK) THEN
146 VHIT(11)=ENPHTR*1.E-6
147 VHIT(12)=NPHTR
148 ELSE
149 WRITE(CHMAIL,10000)
150 CALL GMAIL(1,0)
151 ENDIF
152 IF(SAVE) CALL GSAHIT (IS,ID,IT,NUMVOL,VHIT,IDHIT)
153 IF (IDHIT.EQ.0) THEN
154 WRITE(CHMAIL,10100) IS,ID,IT
155 CALL GMAIL(1,0)
156 ENDIF
157 ELSE
158 WRITE(CHMAIL,10200) IS,ID,IT
159 CALL GMAIL(1,0)
160 ENDIF
161 ENDIF
162 *
163 * Track is exiting the set up
164 *
165 IF(IACT.EQ.3) THEN
166 *
167 * Check if the hit have been previously stored or not
168 *
169 IF(IDHIT.LT.0) THEN
170 DO I=1,3
171 VHIT(I+3) = TRAPAR(I)
172 #if defined(GPAMELA_INTER)
173 * interactive case, we need the average position
174 VHIT(I) = (VHIT(I) + VHIT(I+3) )/2.
175 #endif
176 ENDDO
177 IF(IMEC.GT.0) THEN
178 SAVE = .TRUE.
179 VHIT(7) = DELOSS + VHIT(7)
180 ENDIF
181 VHIT(8) = PATH - VHIT(8)
182 #if defined(GPAMELA_GARFIELD)
183 IF(IMEC.GT.0) THEN
184 * Convert coordinates from the MARS to the local reference system
185 CALL GMTOD(VHIT,GARXYZ,1)
186 CALL GMTOD(TRAPAR,GARXYZ(4),1)
187 * PRINT*,'GARXYZ,PATH=',(GARXYZ(I),I=1,6),PATH
188 * CALL GPTOGAR(GARXYZ,GARXYZ)
189 * CALL GPTOGAR(GARXYZ(4),GARXYZ(4))
190 *
191 * Get the particle infos
192 *
193 CALL GFPART(IPA,CHJUNK,IJUNK,GARPAR(1),GARPAR(2),
194 + RJUNK,RBJUNK,IWBUFF)
195 *
196 * Convert mass from GeV to Mev, calculate kinetic energy and convert it in MeV
197 *
198 GARPAR(3) =
199 + (SQRT(TRAPAR(7)**2+GARPAR(1)**2)-GARPAR(1))*1000.
200 GARPAR(1) = GARPAR(1)*1000.
201 *
202 * Let's calculate the clusters
203 *
204 CALL GPGACL(IPA,GARPAR,GARXYZ,ECLTOT,NCLUS)
205 *
206 * fill the hit structure (energy in GeV)
207 *
208 VHIT(13)=ECLTOT/1000.
209 C VHIT(14)=FLOAT(NCLUS)
210 VHIT(14)=INT(NCLUS)
211 C ML: update the kinetic energy and then th momentum:
212 GEKINT=GEKIN-VHIT(11)
213 GEKIN=GEKINT
214 GETOT=GEKIN +AMASS
215 VECT(7)= SQRT((GETOT+AMASS)*GEKIN)
216 C Routine to find bin number in kinetic energy table stored in ELOW(NEKBIN)
217 CALL GEKBIN
218 C END ML.
219 ENDIF
220 #endif
221 *
222 * Store the hit
223 *
224 IF(IDHIT.EQ.-1) THEN
225 IF(TROK) THEN
226 VHIT(11)=ENPHTR*1.E-6
227 VHIT(12)=NPHTR
228 ELSE
229 WRITE(CHMAIL,10300)
230 CALL GMAIL(1,0)
231 ENDIF
232 ENDIF
233 IF(SAVE) CALL GSAHIT (IS,ID,IT,NUMVOL,VHIT,IDHIT)
234 IF (IDHIT.EQ.0) THEN
235 WRITE(CHMAIL,10400) IS,ID,IT
236 CALL GMAIL(1,0)
237 ENDIF
238 ELSE
239 WRITE(CHMAIL,10500) IS,ID,IT
240 CALL GMAIL(1,0)
241 ENDIF
242 ENDIF
243
244 10000 FORMAT(' GPUTRD error: TR process and his tuning will be ignored')
245 10100 FORMAT(' GPUTRD error: HIT have not be stored for SET='
246 + ,I4,', DET=',I4,', TRACK=',I6)
247 10200 FORMAT(' GPUTRD error: HIT have not be initialized for SET='
248 + ,I4,', DET=',I4,', TRACK=',I6)
249 10300 FORMAT(' GPUTRD error: TR process and his tuning will be ignored')
250 10400 FORMAT(' GPUTRD error: HIT have not be stored for SET='
251 + ,I4,', DET=',I4,', TRACK=',I6)
252 10500 FORMAT(' GPUTRD error: HIT have not be initialized for SET='
253 + ,I4,', DET=',I4,', TRACK=',I6)
254 RETURN
255 END

  ViewVC Help
Powered by ViewVC 1.1.23