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

Annotation of /gpamela/gpcal/gpucal.F

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3.4 - (hide annotations) (download)
Wed Dec 14 03:13:53 2005 UTC (18 years, 11 months ago) by cafagna
Branch: MAIN
CVS Tags: v4r4, v4r5, v4r6, v4r7, v4r8, v4r9, v4r14, v4r12, v4r13, v4r10, v4r11
Changes since 3.3: +15 -4 lines
Neutron detector added. Geometry and GPCALOR package

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

  ViewVC Help
Powered by ViewVC 1.1.23