/[PAMELA software]/gpamela/gpcal/gpucal.F
ViewVC logotype

Annotation of /gpamela/gpcal/gpucal.F

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3.5 - (hide annotations) (download)
Thu Jan 23 13:56:00 2014 UTC (10 years, 10 months ago) by mocchiut
Branch: MAIN
CVS Tags: HEAD
Changes since 3.4: +5 -2 lines
Compilation using SL6

1 cafagna 3.1 *
2 mocchiut 3.5 * $Id: gpucal.F,v 3.4 2005/12/14 03:13:53 cafagna Exp $
3 pamela 3.2 *
4     * $Log: gpucal.F,v $
5 mocchiut 3.5 * Revision 3.4 2005/12/14 03:13:53 cafagna
6     * Neutron detector added. Geometry and GPCALOR package
7     *
8 cafagna 3.4 * Revision 3.3 2005/06/21 02:42:04 cafagna
9     * Major modification to the geometry and to the random number chain
10     *
11 cafagna 3.3 * Revision 3.2 2003/12/17 11:32:48 pamela
12     * CALO SIMULATION COMPLETED: geometry and special tracking parameters updated and simulation checked by a comparison with the Trieste's standalone Monte Carlo simulation
13     *
14 pamela 3.2 * Revision 3.1.1.1 2002/07/11 16:02:14 cafagna
15     * First GPAMELA release on CVS
16 cafagna 3.1 *
17     *
18     *CMZ : 2.03/00 31/10/2000 10.57.01 by Francesco Cafagna
19     *CMZ : 2.01/00 05/04/2000 14.35.18 by Marialuigia Ambriola
20     *CMZ : 2.00/00 29/02/2000 10.23.24 by Francesco Cafagna
21     *CMZ : 1.02/00 08/02/2000 21.29.53 by Francesco Cafagna
22     *CMZ : 1.00/02 04/04/96 16.47.16 by Francesco Cafagna
23     *-- Author : Francesco Cafagna 21/02/96
24     SUBROUTINE GPUCAL(IACT,IS,ID,IPA,IT,DELOSS,PATH,
25     + TRAPAR,NUMVOL,IMEC)
26     ************************************************************************
27     * *
28     * To collect and store the hit structure for CAL *
29     * *
30     * Variables definition: *
31     * IN: *
32     * IACT, integer specifing the action to be taken. It is the INWVOL *
33     * variable in GCTRAK common *
34     * IS , set number *
35     * ID , detector number *
36     * IPA , particle number *
37     * IT , track number *
38     * DELOSS, energy loss in the step *
39     * PATH , current track lenght *
40     * TRAPAR, track parameter, is the VECT vector in GCTRAK common *
41     * NUMVOL, integer array of numbers identifying the DETECTOR *
42     * IMEC , integer indicating the LOSS mecanism position inside NMEC *
43     * vector, zero if not present *
44     * *
45     * *
46     * NOTE: The IT variable is overwritten and the GSCHIT is used *
47     * to account for the multi-tracks produced in an e.m. shower *
48     * *
49     * Called by: GUSTEP *
50     * Author: Francesco Cafagna, 21/02/96 16.13.51 *
51     * *
52     ************************************************************************
53     #include "gphit.inc"
54     #include "gcunit.inc"
55 pamela 3.2 *ml: (19/02/03)
56     #include "gckine.inc"
57     #include "gcflag.inc"
58     #include "gpencal.inc"
59     *end ml
60 mocchiut 3.5 *EM:
61 cafagna 3.1 PARAMETER (CALIB=0.0001085200)
62     *END EM.
63     INTEGER IACT,IS,ID,IPA,IT,NUMVOL(20),IMEC,IDHIT
64 cafagna 3.3 REAL DELOSS,PATH,TRAPAR(7),VHIT(NHCAL),XYZM(3),XYZD(3)
65     * REAL DELOSS,PATH,TRAPAR(7),XYZM(3),XYZD(3)
66 cafagna 3.1 REAL DELTA2,SIGMA2,SIGMA,GRNDM0,GPGAUS,PATHINI
67     LOGICAL SAVE
68     *
69 pamela 3.2 *ml (19/02/02):
70     INTEGER IPL,IMOD,IST
71     DATA IEVOLD/-1/
72     *
73     * It's a new event
74     *
75 cafagna 3.4 C # IF(IEVOLD.NE.IEVENT) THEN
76     C # c print*,'IS,ID,NUMVOL=',IS,ID,NUMVOL
77     C # c print*,'GPUCAL:last event=',ievold
78     C # IEVOLD=IEVENT
79     C # CALL VZERO(ENEMAT,44*9*32)
80     C # ENDIF
81    
82     C # Please note that ENEMAT is zeroed just on the very first event here.
83     C # Then is cleared into GUTREV on an event by event basis.
84     IF(IEVOLD.EQ.-1) THEN
85 pamela 3.2 IEVOLD=IEVENT
86     CALL VZERO(ENEMAT,44*9*32)
87     ENDIF
88 cafagna 3.4
89 pamela 3.2 *end ml.
90     *
91 cafagna 3.1 * Track is inside a volume
92     *
93     IF(IACT.EQ.0) THEN
94     IF(IMEC.GT.0) THEN
95     SAVE = .TRUE.
96     *EM:
97 pamela 3.2 cccc VHIT(4) = (DELOSS/CALIB) + VHIT(4)
98     * END EM
99     C ML
100 cafagna 3.3 VHIT(4) = DELOSS + VHIT(4)
101 pamela 3.2 ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))=
102     + ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))+DELOSS
103     *END ML
104 cafagna 3.1 ENDIF
105     ENDIF
106     *
107     * Entering a new volume or is a new track
108     *
109     IF(IACT.EQ.1) THEN
110     SAVE = .FALSE.
111 cafagna 3.3 CALL VZERO(VHIT,NHCAL)
112     DO I=1,3
113     VHIT(I) = TRAPAR(I)
114     ENDDO
115 cafagna 3.1 IF(IMEC.GT.0) THEN
116     SAVE = .TRUE.
117     *EM:
118 pamela 3.2 c VHIT(4) = DELOSS/CALIB
119     *END EM.
120 cafagna 3.3 VHIT(4) = DELOSS
121 pamela 3.2 C ML:
122     ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))=
123     + ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))+DELOSS
124     *END ML
125 cafagna 3.1 ENDIF
126     IDHIT = -1
127     * Store the particle and momentum if is the first track
128     c IF(IT.EQ.1) THEN
129     c VHIT(5) = IPA
130     c VHIT(6) = TRAPAR(7)
131     c ENDIF
132     PATHINI = PATH
133     ENDIF
134     *
135     * Track is exiting current volume
136     *
137     IF(IACT.EQ.2) THEN
138     IF(IMEC.GT.0) THEN
139     SAVE = .TRUE.
140     *EM:
141 pamela 3.2 c VHIT(4) = (DELOSS/CALIB) + VHIT(4)
142     *END EM
143 cafagna 3.3 VHIT(4) = DELOSS + VHIT(4)
144 pamela 3.2 *ML:
145     ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))=
146     + ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))+DELOSS
147 cafagna 3.1 *END EM
148     ENDIF
149     #if defined(GPAMELA_NOGFLUCT)
150     *
151     * change in de/dx with gaussian convolution
152     * see Hall paper: NIM 220 (1984) 356.
153     *
154     * FIRST: Look if the STOP mechanism is present
155     *
156     IF(IMEC.EQ.1) THEN
157     * This particle has NOT been stopped. So gaussian energy spread...
158     * Delta is in GeV^2/cm
159     DELTA2=.5E-8
160     SIGMA2=DELTA2*(PATH - PATHINI)
161     SIGMA=SQRT(SIGMA2)
162     GRNDM0 = GPGAUS(0.)
163     *EM:
164 pamela 3.2 c VHIT(4)=VHIT(4)+GRNDM0*SIGMA/CALIB
165     CML17/04/03 VHIT(4)=VHIT(4)+GRNDM0*SIGMA
166 cafagna 3.1 *END EM
167 pamela 3.2 CML17/04/03 IF(VHIT(4).LT.0.) VHIT(4)=0.
168 cafagna 3.1 ENDIF
169     #endif
170     *
171     * Store the hit
172     *
173     IF(IDHIT.EQ.-1) THEN
174     *ML:
175     * IF(SAVE) CALL GSCHIT (IS,ID,1,NUMVOL,VHIT,4,IDHIT)
176 cafagna 3.3 IF(SAVE) THEN
177     CALL GSCHIT (IS,ID,1,NUMVOL,VHIT,1,IDHIT)
178     c CALL GSAHIT (IS,ID,IT,NUMVOL,VHIT,IDHIT)
179     ENDIF
180 cafagna 3.1 *END ML.
181     IF (IDHIT.EQ.0) THEN
182     WRITE(CHMAIL,10000) IS,ID,IT
183     CALL GMAIL(1,0)
184     ENDIF
185     ELSE
186     WRITE(CHMAIL,10100) IS,ID,IT
187     CALL GMAIL(1,0)
188     ENDIF
189     ENDIF
190     *
191     * Track is exiting the set up
192     *
193     IF(IACT.EQ.3) THEN
194     *
195     * Check if the hit have been previously stored or not
196     *
197     IF(IDHIT.LT.0) THEN
198     IF(IMEC.GT.0) THEN
199     SAVE = .TRUE.
200     *EM:
201 pamela 3.2 c VHIT(4) = (DELOSS/CALIB) + VHIT(4)
202     * END EM.
203 cafagna 3.3 VHIT(4) = DELOSS + VHIT(4)
204 pamela 3.2 *ML:
205     ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))=
206     + ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))+DELOSS
207     *END ML.
208 cafagna 3.1 ENDIF
209     #if defined(GPAMELA_NOGFLUCT)
210     *
211     * change in de/dx with gaussian convolution
212     * see Hall paper: NIM 220 (1984) 356.
213     *
214     * FIRST: Look if the STOP mechanism is present
215     *
216     IF(IMEC.EQ.1) THEN
217     * This particle has NOT been stopped. So gaussian energy spread...
218     * Delta is in GeV^2/cm
219     DELTA2=.5E-8
220     SIGMA2=DELTA2*(PATH - PATHINI)
221     SIGMA=SQRT(SIGMA2)
222     GRNDM0 = GPGAUS(0.)
223     *EM:
224 pamela 3.2 c VHIT(4)=VHIT(4)+GRNDM0*SIGMA/CALIB
225     CML17/04/03 VHIT(4)=VHIT(4)+GRNDM0*SIGMA
226 cafagna 3.1 *END EM.
227 pamela 3.2 CML17/04/03 IF(VHIT(4).LT.0.) VHIT(4)=0.
228 cafagna 3.1 ENDIF
229     #endif
230     *
231     * Store the hit
232     *
233     IF(IDHIT.EQ.-1) THEN
234     *ML
235 cafagna 3.3 C IF (SAVE) CALL GSCHIT (IS,ID,1,NUMVOL,VHIT,4,IDHIT)
236     IF (SAVE) THEN
237     CALL GSCHIT (IS,ID,1,NUMVOL,VHIT,1,IDHIT)
238     ENDIF
239 pamela 3.2 CL IF (SAVE) CALL GSCHIT (IS,ID,1,NUMVOL,VHIT,1,IDHIT)
240 cafagna 3.1 *END ML.
241     IF (IDHIT.EQ.0) THEN
242     WRITE(CHMAIL,10200) IS,ID,IT
243     CALL GMAIL(1,0)
244     ENDIF
245     ELSE
246     WRITE(CHMAIL,10300) IS,ID,IT
247     CALL GMAIL(1,0)
248     ENDIF
249     ENDIF
250     ENDIF
251     10000 FORMAT(' GPUCAL error: HIT have not be stored for SET='
252     + ,I4,', DET=',I4,', TRACK=',I6)
253     10100 FORMAT(' GPUCAL error: HIT have not be initialized for SET='
254     + ,I4,', DET=',I4,', TRACK=',I6)
255     10200 FORMAT(' GPUCAL error: HIT have not be stored for SET='
256     + ,I4,', DET=',I4,', TRACK=',I6)
257     10300 FORMAT(' GPUCAL error: HIT have not be initialized for SET='
258     + ,I4,', DET=',I4,', TRACK=',I6)
259     RETURN
260     END

  ViewVC Help
Powered by ViewVC 1.1.23