/[PAMELA software]/chewbacca/PamOffLineSW/forroutines/tracker/common/functions.f
ViewVC logotype

Contents of /chewbacca/PamOffLineSW/forroutines/tracker/common/functions.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Tue Sep 23 07:20:18 2008 UTC (16 years, 2 months ago) by mocchiut
Branch: v0r00, MAIN
CVS Tags: v1r02, v1r00, v1r01, start, v10RED, v9r00, v9r01, HEAD
Changes since 1.1: +0 -0 lines
Imported sources, 23/09/2008

1 *************************************************************************
2 *
3 * functions.f
4 *
5 * - !???
6 *
7 * needs:
8 * - !???
9 *
10 * output variables:
11 * - !???
12 *
13 * to be called inside !???
14 *
15 *************************************************************************
16
17
18 function pitch(view) !da' il pitch delle strip di una vista
19
20 real pitch
21 integer view
22
23 include './commontracker.f'
24
25 if(mod(view,2).eq.0) then !X
26 pitch=pitchX
27 else !Y
28 pitch=pitchY
29 endif
30
31 end
32
33
34
35 c------------------------------------------------------------------------
36
37
38
39 function npl(view) !da' il numero del piano a partire dalla vista!???
40
41 integer npl,view
42
43 npl=INT((view-1)/2)+1
44
45 end
46
47
48
49 c------------------------------------------------------------------------
50
51
52
53 function nld(istrip,view)
54 c da' il numero del ladder a partire dalla
55 C strip del piano
56
57 c chiamo ladder 1 quello dove si trova la prima strip
58 c letta X
59 c quindi la prima strip letta Y si trova sul ladder 3
60
61 integer istrip,view,nld
62
63 include './commontracker.f'
64
65 nld=INT((istrip-1)/nstrips_ladder)+1
66
67 c$$$ if(mod(view,2).eq.1) then !Y
68 c$$$ nld=4-nld
69 c$$$ endif
70
71 end
72
73
74
75 c------------------------------------------------------------------------
76
77
78
79
80 function nvk(istrip) !da' il numero del va1 a partire dalla strip del piano!???
81
82 integer istrip,nvk
83
84 include './commontracker.f'
85
86 nvk=INT((istrip-1)/nstrips_va1)+1
87
88 end
89
90
91
92 c------------------------------------------------------------------------
93
94
95
96 function nst(istrip) !da' la strip del va1 a partire dalla strip del piano!???
97
98 integer istrip,nst
99
100 include './commontracker.f'
101
102 nst=INT(mod((istrip-1),nstrips_va1))+1
103
104 end
105
106
107
108 c------------------------------------------------------------------------
109
110
111
112 c$$$ function coordpl(iev,ic,istrip,view,ladder,sen) !reads strip number of the planes
113 c$$$ ! and gives strip coordinate in micrometers, taking into
114 c$$$ ! account plane geometry.
115 c$$$ ! the origin of the coordinate is on the first
116 c$$$ ! strip of the plane
117 c$$$ integer is,istrip,view,ladder
118 c$$$ integer sensor,sen !for test2002: tells if the cluster belongs to the
119 c$$$ ! Si sensor next to the hybrid or to the far one!???
120 c$$$ real coordpl
121 c$$$
122 c$$$
123 c$$$ include './commontracker.f'
124 c$$$
125 c$$$ c NB mettere il 1024 nel commontracker...!???
126 c$$$
127 c$$$
128 c$$$ is=istrip !per evitare che cambi il valore di istrip...!???
129 c$$$
130 c$$$ coordpl=0.
131 c$$$
132 c$$$ if(mod(view,2).eq.0) then !X view
133 c$$$
134 c$$$ if((is.le.3) !X has 1018 strips...
135 c$$$ $ .or.(is.ge.1022.and.is.le.1027)
136 c$$$ $ .or.(is.ge.2046.and.is.le.2051)
137 c$$$ $ .or.(is.ge.3070)) then
138 c$$$ print*,'functions: WARNING: false X strip: strip ',is !servirebbe
139 c$$$ $ ,' view ',view,' ladder ',ladder ! errflag per poter
140 c$$$ $ ,' iev ',iev,' ic ',ic ! errflag per poter
141 c$$$ endif ! segnalare anche l'evento dal main program...!???
142 c$$$
143 c$$$ if(ladder.eq.1) then
144 c$$$ is=is-3 !4 =< istrip =< 1021
145 c$$$ coordpl=(is-1)*pitch(view)
146 c$$$ elseif(ladder.eq.2) then
147 c$$$ is=is-1024-3 !1028 =< istrip =< 2045
148 c$$$ coordpl=(1018-1)*pitch(view)+731.5+610.+731.5
149 c$$$ $ +(is-1)*pitch(view) !takes into account space between ladders (C
150 c$$$ ! fiber rails + dead Si)
151 c$$$ elseif(ladder.eq.3) then
152 c$$$ is=is-2048-3 !2052 =< istrip =< 3069
153 c$$$ coordpl=(1018-1)*pitch(view)+731.5+610.
154 c$$$ $ +731.5+(1018-1)*pitch(view)+731.5+610.
155 c$$$ $ +731.5+(is-1)*pitch(view)
156 c$$$ endif
157 c$$$
158 c$$$ elseif(mod(view,2).eq.1) then !Y view
159 c$$$
160 c$$$ is=mod(is-1,1024)+1
161 c$$$
162 c$$$ c questo non funziona sempre perche' il fascio puo' entrare su uno e uscire da un altro:/ !???
163 c$$$ c questo non funziona sempre :/ !???
164 c$$$ c questo non funziona sempre :/ !???
165 c$$$ c questo non funziona sempre :/ !???
166 c$$$ c questo non funziona sempre :/ !???
167 c$$$
168 c$$$ c if(view.ne.11) then !in 2002 beam test 11th view was flipped...!???
169 c$$$ sensor=sen
170 c$$$ c else
171 c$$$ c if(sen.eq.0) sensor=1
172 c$$$ c if(sen.eq.1) sensor=0
173 c$$$ c endif !ZZZZZZZZZZZZZZz
174 c$$$
175 c$$$
176 c$$$ if(sensor.eq.0) then !sensor=0 --> Si sensor next to hybrid!???
177 c$$$ coordpl=(is-1)*pitch(view)
178 c$$$ elseif(sensor.eq.1) then !sensor=1 --> Si sensor far from hybrid!???
179 c$$$ coordpl=(1024-1)*pitch(view)+985.0+30.
180 c$$$ $ +985.5+(is-1)*pitch(view)
181 c$$$ endif
182 c$$$
183 c$$$ if(view.eq.11) then !in 2002 beam test 11th view was flipped...!???
184 c$$$ coordpl=(is-1)*pitch(view)
185 c$$$ c coordpl=142400.-coordpl!???
186 c$$$ coordpl=0. !???
187 c$$$ c$$$ if(sensor.eq.0) then !sensor=0 --> Si sensor next to hybrid!???
188 c$$$ c$$$ coordpl=(is-1)*pitch(view)
189 c$$$ c$$$ elseif(sensor.eq.1) then !sensor=1 --> Si sensor far from hybrid!???
190 c$$$ c$$$ coordpl=(1024-1)*pitch(view)+985.0+30.
191 c$$$ c$$$ $ +985.5+(is-1)*pitch(view)
192 c$$$ c$$$ endif
193 c$$$ endif
194 c$$$
195 c$$$ endif
196 c$$$
197 c$$$ end
198 c$$$
199 c$$$
200 c$$$
201 c$$$
202 c$$$ c------------------------------------------------------------------------
203 c$$$
204 c$$$
205 c$$$
206 c$$$
207 c$$$ function coord(coordpl,view) !reads strip coordinate in micrometers respect
208 c$$$ ! to the first strip of the plane and gives it
209 c$$$ ! in PAMELA reference frame (the origin is in the
210 c$$$ ! centre of the magnet)
211 c$$$ integer view
212 c$$$
213 c$$$ real coord,coordpl
214 c$$$
215 c$$$
216 c$$$ coord=0.
217 c$$$
218 c$$$
219 c$$$ if(mod(view,2).eq.0) then !X view
220 c$$$
221 c$$$ traslX=(1018-1)*51. + 731.5 + 610. + (53330./2)
222 c$$$ coord=coordpl-traslX
223 c$$$
224 c$$$ elseif(mod(view,2).eq.1) then !Y view
225 c$$$
226 c$$$ traslY=(1024-1)*66.5 + 985. + 15. +
227 c$$$ $ ((288000./2) -
228 c$$$ $ (15000. + 1470. + 55000. + 30. + 70000. + 15.))
229 c$$$
230 c$$$ c traslY=0.!???
231 c$$$
232 c$$$ c if(view.ne.11) then !in 2002 beam test 11th view was flipped...!???
233 c$$$ coord=coordpl-traslY
234 c$$$ c else
235 c$$$ c coord=traslY-coordpl
236 c$$$ c endif!ZZZZZZZZZZZZZz
237 c$$$
238 c$$$ endif
239 c$$$
240 c$$$ end
241 c$$$
242 c$$$
243 c$$$
244 c$$$ c------------------------------------------------------------------------
245
246
247
248
249 function coordsi(istrip,view)
250 c reads strip number and gives
251 c strip coordinate in micrometers.
252 c the origin of the coordinate is on the centre
253 c of the sensor
254 integer is,istrip,view
255
256 real coordsi
257
258
259 include './commontracker.f'
260
261 c NB mettere il 1024 nel commontracker...!???
262
263
264 is=istrip !per evitare che cambi il valore di istrip...!???
265
266 is=mod(is-1,1024)+1
267
268 coordsi=0.
269
270 if(mod(view,2).eq.0) then !X view
271
272 if((is.le.3).or.(is.ge.1022)) then !X has 1018 strips...
273 print*,'functions: WARNING: false X strip: strip ',is !servirebbe
274 c $ ,' view ',view ! errflag per poter
275 endif ! segnalare anche l'evento dal main program...!???
276
277 is=is-3 !4 =< is =< 1021
278
279 edge=edgeX
280 dim=SiDimX
281
282 elseif(mod(view,2).eq.1) then !Y view
283
284 edge=edgeY
285 dim=SiDimY
286
287 if(view.eq.11) then !INVERSIONE!???
288 is=1025-is
289 endif
290
291 endif
292
293 p=pitch(view)
294
295 coord1=(is-1)*p !rispetto alla prima strip del sensore
296 coord1=coord1+edge !rispetto al bordo del sensore
297
298 coordsi=coord1-dim/2 !rispetto al centro del sensore
299
300
301
302 end
303
304
305
306 c------------------------------------------------------------------------
307
308
309
310
311 function coord(coordsi,view,ladder,sen)
312 c reads strip coordinate in
313 c micrometers respect to center of the
314 c sensor and gives it in PAMELA reference frame
315 c (the origin is in the centre of the magnet)
316
317 include './commontracker.f'
318 include './runinfo.f'
319
320 integer view,ladder,sen
321 integer sx,sy,sz
322
323 real coord,coordsi,trasl
324
325 parameter (offset=4365.) !??? ! um
326 c parameter (offset=0.)!???
327
328
329 coord=0.
330
331 sx=ladder
332 sy=sen
333 sz=npl(view)
334
335 call mech_sensor
336
337
338 if(mod(view,2).eq.0) then !X view
339
340 trasl=x_mech_sensor(sz,sx,sy) !in millimetri
341
342 elseif(mod(view,2).eq.1) then !Y view
343
344 trasl=y_mech_sensor(sz,sx,sy) !in millimetri
345
346 if(view.eq.11) then !INVERSIONE!???
347 coordsi=coordsi+offset
348 endif
349
350 endif
351
352
353 coord=coordsi+trasl*1000
354
355
356 end
357
358
359
360 c------------------------------------------------------------------------
361
362
363
364 subroutine mech_sensor
365
366 include './commontracker.f'
367
368 open(20,FILE='../common/mechanical_positions.dat')
369 do ip=1,6
370 do j=1,3
371 read(20,*)(x_mech_sensor(ip,j,k),k=1,2)
372 read(20,*)(y_mech_sensor(ip,j,k),k=1,2)
373 read(20,*)(z_mech_sensor(ip,j,k),k=1,2)
374 enddo
375 enddo
376 close(20)
377
378
379 return
380 end

  ViewVC Help
Powered by ViewVC 1.1.23