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

Contents of /gpamela/gptrd/gpxtr.F

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3.2 - (show annotations) (download)
Tue Apr 6 10:33:45 2004 UTC (20 years, 8 months ago) by pamela
Branch: MAIN
CVS Tags: v4r4, v4r5, v4r6, v4r7, v4r1, v4r2, v4r3, v4r8, v4r9, v4r14, v4r12, v4r13, v4r10, v4r11, HEAD
Changes since 3.1: +12 -4 lines
NON-REPRODUCIBILITY problem of a GPAMELA RUN fixed; bug found and fixed filling in the hit structure of the calorimeter

1 *
2 * $Id: gpxtr.F,v 3.1.1.1 2002/07/11 16:02:01 cafagna Exp $
3 *
4 * $Log: gpxtr.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 : 3.00/00 05/02/2002 12.51.38 by Unknown
10 *-- Author : Marialuigia Ambriola 11/05/2001
11 SUBROUTINE GPXTR
12 **************************************************************************
13 * *
14 * Generates and absorbs transition radiatixon spectrum in TRD *
15 * *
16 * *
17 * *
18 * Called by: GUSTEP *
19 * Author: Marialuigia Ambriola 11/05/2001 *
20 * *
21 **************************************************************************
22 #include "gpgene.inc"
23 #include "gctrak.inc"
24 #include "gctmed.inc"
25 #include "gpmed.inc"
26 #include "gpsed.inc"
27 #include "gcsets.inc"
28 #include "gpaltr.inc"
29 #include "gckine.inc"
30 #include "gcnum.inc"
31 #include "gcflag.inc"
32 #include "gptotr.inc"
33 #include "gcunit.inc"
34 EXTERNAL XTRYIELD
35 EXTERNAL NPOISS
36 EXTERNAL XTRINTER
37 EXTERNAL XTRINTEG
38 REAL CAM,RL,G,NF,WR,CR,SPH,CATT,W,E
39 REAL GRNDM0(1)
40 INTEGER INDEX,INDEXAIR,INDEXC,LAY
41 c centimeter and GeV:
42 DATA RL1/7.0E-4/,RL2/204.E-4/,N/71/,w1/31.59E-9/,w2/.7E-9/
43 DATA IEVOLD/-1/,NTMOLD/-1/
44 PARAMETER (ALPHA=1/137.,PG=3.1415926536,HTC=197.3269E-16)
45 PARAMETER (C=3.E+10)
46 **************
47 *particle inside kapton, radiator or xenon?
48 *if yes, calcolates the length of the track.
49 *NUMED is the number of the tracking medium (common GCTMED)
50 *MTRAD, MKAP and MXE are the numbers of radiator, kapton and xenon
51 *tracking media, like defined by GPAMELA.
52 IF(CHARGE.EQ.0) THEN
53 RETURN
54 ENDIF
55 IF(AMASS.LE.0) THEN
56 WRITE(CHMAIL,10000) AMASS
57 CALL GMAIL(1,0)
58 RETURN
59 ENDIF
60 G=GETOT/AMASS
61 IF(G.LE.100.) THEN
62 RETURN
63 ENDIF
64 IF((NUMED.EQ.MKAP.AND.IDET.EQ.IDTRSO).OR.NUMED.EQ.
65 + MTRAD.OR.NUMED.EQ.MXE) THEN
66 IF(INWVOL.EQ.1.) THEN
67 CAM=SLENG
68 RETURN
69 ELSEIF(INWVOL.EQ.2) THEN
70 C #
71 C # Calculate the layer number
72 C #
73 IF(NUMED.EQ.MXE) THEN
74 IF(NUMBV(NVNAME-1).GE.29.AND.NUMBV(NVNAME-1).LE.32)LAY=2
75 IF(NUMBV(NVNAME-1).GE.25.AND.NUMBV(NVNAME-1).LE.28)LAY=4
76 IF(NUMBV(NVNAME-1).GE.21.AND.NUMBV(NVNAME-1).LE.24)LAY=6
77 IF(NUMBV(NVNAME-1).GE.17.AND.NUMBV(NVNAME-1).LE.20)LAY=8
78 IF(NUMBV(NVNAME-1).GE.13.AND.NUMBV(NVNAME-1).LE.16)LAY=10
79 IF(NUMBV(NVNAME-1).GE.10.AND.NUMBV(NVNAME-1).LE.12)LAY=12
80 IF(NUMBV(NVNAME-1).GE.7.AND.NUMBV(NVNAME-1).LE.9)LAY=14
81 IF(NUMBV(NVNAME-1).GE.4.AND.NUMBV(NVNAME-1).LE.6)LAY=16
82 IF(NUMBV(NVNAME-1).GE.1.AND.NUMBV(NVNAME-1).LE.3)LAY=18
83 IF(NUMBV(NVNAME).GT.16) THEN
84 LAY = LAY - 1
85 ENDIF
86 ENDIF
87 CAM=SLENG-CAM
88 ELSE
89 RETURN
90 ENDIF
91 ELSE
92 RETURN
93 ENDIF
94 ****************
95 INDEX=0
96 INDEXAIR=0
97 INDEXC=0
98 IF(INWVOL.NE.2) RETURN
99 IF(IEVOLD.NE.IEVENT.OR.NTMOLD.NE.NTMULT) THEN
100 CALL VZERO(EY,115)
101 ENDIF
102 IEVOLD=IEVENT
103 NTMOLD=NTMULT
104 SPH=0.
105 NPHTR=0
106 ENPHTR=0.
107 IF(NUMED.EQ.MKAP.AND.IDET.EQ.IDTRSO) INDEX=4
108 IF(NUMED.EQ.MXE) INDEX=3
109 IF(NUMED.EQ.MTRAD) THEN
110 INDEXAIR=1
111 INDEXC=2
112 RL=RL1+RL2
113 ENDIF
114 ****************
115 c radiator:
116 IF(INDEX.EQ.0) THEN
117 NF=CAM/RL
118 DO I=1,115
119 XTREN=XTRYIELD(I,G)
120 WR=0.
121 CR=NF*(ATTTRD(I,INDEXAIR)*RL2+ATTTRD(I,INDEXC)*RL1)
122 IF(CR.GT.0.) WR=EXP(-CR)
123 c considering the whole radiator and the absorption.
124 c when dividing for enatt I consider the number of photons per unit energy,
125 c which are created and transmitted by the radiator.
126 C remember that enatt is in keV unity.
127 IF(CR.GT.0.AND.NF.GT.1) THEN
128 XTREN=2*NF*XTREN*(1.-WR)/(CR*ENATT(I))
129 EY(I)=EY(I)*WR+XTREN
130 SPH=SPH+EY(I)
131 ENDIF
132 ENDDO
133 ENDIF
134 goto 999
135 print*,'index,IEVENT,gamma,spettro'
136 print*,index,IEVENT,g
137 print*,(ey(i),i=1,4)
138 print*,(ey(i),i=5,8)
139 print*,(ey(i),i=9,12)
140 print*,(ey(i),i=13,16)
141 print*,(ey(i),i=17,20)
142 print*,(ey(i),i=21,24)
143 print*,(ey(i),i=25,28)
144 print*,(ey(i),i=29,32)
145 print*,(ey(i),i=33,36)
146 print*,(ey(i),i=37,40)
147 print*,(ey(i),i=41,44)
148 print*,(ey(i),i=45,48)
149 print*,(ey(i),i=49,52)
150 print*,(ey(i),i=53,56)
151 print*,(ey(i),i=57,60)
152 print*,(ey(i),i=61,64)
153 print*,(ey(i),i=65,68)
154 print*,(ey(i),i=69,72)
155 print*,(ey(i),i=73,76)
156 print*,(ey(i),i=77,80)
157 print*,(ey(i),i=81,84)
158 print*,(ey(i),i=85,88)
159 print*,(ey(i),i=89,92)
160 print*,(ey(i),i=93,96)
161 print*,(ey(i),i=97,100)
162 print*,(ey(i),i=101,104)
163 print*,(ey(i),i=105,108)
164 print*,(ey(i),i=109,112)
165 print*,(ey(i),i=113,115)
166 999 continue
167 ******************
168 C now the spectrum is propagated in the other absorbent media in the TRD:
169 c the absorber could be the kapton or the Xe-CO2 or the gas in between (here
170 c not considered):
171 IF(INDEX.NE.0) THEN
172 CALL VZERO(EA,115)
173 CALL VZERO(ER,115)
174 DO I=1,115
175 CATT=ATTTRD(I,INDEX)*CAM
176 W=0
177 W=EXP(-CATT)
178 C PRINT*,'EY(I),I,CATT,ATT',EY(I),I,CATT,ATTTRD(I,INDEX)
179 c absorbed spectrum:
180 EA(I)=EY(I)*(1-W)
181 c transmitted spectrum:
182 EY(I)=EY(I)*W
183 C PRINT*,'W,EA(I),EY(I),I,INDEX',W,EA(I),EY(I),I,INDEX
184 ENDDO
185 ENDIF
186 C finally the sensitive gas:
187 IF(INDEX.EQ.3) THEN
188 goto 998
189 print*,'index,IEVENT,gamma,spettro assorbito'
190 print*,index,IEVENT,g
191 print*,(ea(i),i=1,4)
192 print*,(ea(i),i=5,8)
193 print*,(ea(i),i=9,12)
194 print*,(ea(i),i=13,16)
195 print*,(ea(i),i=17,20)
196 print*,(ea(i),i=21,24)
197 print*,(ea(i),i=25,28)
198 print*,(ea(i),i=29,32)
199 print*,(ea(i),i=33,36)
200 print*,(ea(i),i=37,40)
201 print*,(ea(i),i=41,44)
202 print*,(ea(i),i=45,48)
203 print*,(ea(i),i=49,52)
204 print*,(ea(i),i=53,56)
205 print*,(ea(i),i=57,60)
206 print*,(ea(i),i=61,64)
207 print*,(ea(i),i=65,68)
208 print*,(ea(i),i=69,72)
209 print*,(ea(i),i=73,76)
210 print*,(ea(i),i=77,80)
211 print*,(ea(i),i=81,84)
212 print*,(ea(i),i=85,88)
213 print*,(ea(i),i=89,92)
214 print*,(ea(i),i=93,96)
215 print*,(ea(i),i=97,100)
216 print*,(ea(i),i=101,104)
217 print*,(ea(i),i=105,108)
218 print*,(ea(i),i=109,112)
219 print*,(ea(i),i=113,115)
220 998 continue
221 c considering the escape peak in Xe-CO2;
222 CALL XESCAPE(ENATT,EA,ER,115)
223 SPH=0.
224 goto 997
225 print*,'index,IEVENT,gamma,spettro con escape'
226 print*,index,IEVENT,g
227 print*,(er(i),i=1,4)
228 print*,(er(i),i=5,8)
229 print*,(er(i),i=9,12)
230 print*,(er(i),i=13,16)
231 print*,(er(i),i=17,20)
232 print*,(er(i),i=21,24)
233 print*,(er(i),i=25,28)
234 print*,(er(i),i=29,32)
235 print*,(er(i),i=33,36)
236 print*,(er(i),i=37,40)
237 print*,(er(i),i=41,44)
238 print*,(er(i),i=45,48)
239 print*,(er(i),i=49,52)
240 print*,(er(i),i=53,56)
241 print*,(er(i),i=57,60)
242 print*,(er(i),i=61,64)
243 print*,(er(i),i=65,68)
244 print*,(er(i),i=69,72)
245 print*,(er(i),i=73,76)
246 print*,(er(i),i=77,80)
247 print*,(er(i),i=81,84)
248 print*,(er(i),i=85,88)
249 print*,(er(i),i=89,92)
250 print*,(er(i),i=93,96)
251 print*,(er(i),i=97,100)
252 print*,(er(i),i=101,104)
253 print*,(er(i),i=105,108)
254 print*,(er(i),i=109,112)
255 print*,(er(i),i=113,115)
256 997 continue
257 c yes escape peak:
258 ccc SPH=XTRINTEG(ENATT,ER,EINT,115)
259 SPH=XTRINTEG(ENATT,ER,EINT,75)
260 c if you don't consider the escape-peak, don't comment the next row:
261 C SPH=XTRINTEG(ENATT,EA,EINT,115)
262 C 28/9/2001: FINE TUNING OF TR:
263 c for PS ALFA=0.65 (momentum.lt.40. GeV/c)
264 c per SPS ALFA=0.69 (momentum.ge.40. GeV/c):
265 IF(ALFATR.NE.-9999.) THEN
266 SPH=ALFATR*SPH
267 ELSE
268 TROK=.FALSE.
269 WRITE(CHMAIL,10100) ALFATR
270 CALL GMAIL(1,0)
271 RETURN
272 ENDIF
273 c end 28/9/2001.
274 NPHTR=NPOISS(SPH)
275 c print*,'lay=',lay,'sph,nph=',sph,nph
276 c PRINT*,'Xe-CO2: XTRINTEG,NPOISS:',SPH,NPHTR
277 IF(NPHTR.GT.0) THEN
278 DO I=1,NPHTR
279 ccc 10 E=XTRINTER(RNDM(1)*SPH,EINT,ENATT,115)
280 c ml 26/03/04
281 c 10 E=XTRINTER(RNDM(1)*SPH,EINT,ENATT,75)
282 10 CALL GRNDM(GRNDM0,1)
283 E=XTRINTER(GRNDM0(1)*SPH,EINT,ENATT,75)
284 C ml 26/03/04
285 C 28/9/2001: TENTATIVO DI FINE TUNING DELLA TR:
286 ******** NEI DATI REALI NON VEDO FOTONI CON ENERGIA MAGGIORE DI 60 keV:
287 c fine modifica 28/9/2001
288 IF(E.GT.45.) THEN
289 PRINT*,'Extracted energy'
290 PRINT*,E
291 GOTO 10
292 ENDIF
293 ENPHTR=ENPHTR+E
294 ENDDO
295 c PRINT*,'Energy (keV) and photons absorbed, for event:'
296 c + ,IEVENT,ENPHTR,NPHTR ,'layer=',lay
297 C NTRHIT=NPHTR
298 C ENEHIT=ENPHTR*1.E-6
299 C* ML: SOTTRAE LA ENERGIA PERSA NEL TRD.
300 GEKINT=GEKIN-ENPHTR*1.E-6
301 GEKIN=GEKINT
302 GETOT=GEKIN +AMASS
303 VECT(7)= SQRT((GETOT+AMASS)*GEKIN)
304 C Routine to find bin number in kinetic energy table stored in ELOW(NEKBIN)
305 CALL GEKBIN
306 C* END ML.
307 ELSE
308 c PRINT*,'no photons converted in the straw'
309 ENDIF
310 IF (LAY.GT.0.AND.LAY.LE.18) THEN
311 ENTRTOT = ENTRTOT + ENPHTR
312 ENLAY(LAY) = ENLAY(LAY) + ENPHTR
313 NPHTOTR = NPHTOTR + NPHTR
314 NPHLAY(LAY)= NPHLAY(LAY) + NPHTR
315 ILI=NUMBV(NVNAME-1)
316 IHI=NUMBV(NVNAME)
317 ENTRSTRAW(ILI,IHI) = ENTRSTRAW(ILI,IHI)+ ENPHTR
318 NTRSTRAW(ILI,IHI) = NTRSTRAW(ILI,IHI)+ NPHTR
319 c PRINT*,'NPHTOTR,LAY,ENPHTR,ENTRTOT',NPHTOTR,LAY,ENPHTR,ENTRTOT
320 C PRINT*,'NTRSTRAW',NTRSTRAW(ILI,IHI),ILI,IHI
321 C PRINT*,'ENTRSTRAW,ENPHTR',ENTRSTRAW(ILI,IHI),ENPHTR
322 ELSE
323 WRITE(CHMAIL,10200)LAY
324 CALL GMAIL(1,0)
325 C PRINT*,' ERROR IN LAYER CALCULATION',LAY
326 ENDIF
327 ENDIF
328 10000 FORMAT('GPXTR error: negative mass =',F10.3)
329 10100 FORMAT('GPXTR error: ALFATR not set, TR process ',
330 + 'and his tuning will be ignored, ALFATR =',F10.3)
331 10200 FORMAT('GPXTR error in layer calculation =',F10.3)
332 RETURN
333 END

  ViewVC Help
Powered by ViewVC 1.1.23