/[PAMELA software]/DarthVader/TrackerLevel2/src/F77/readallparam.f
ViewVC logotype

Contents of /DarthVader/TrackerLevel2/src/F77/readallparam.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Fri May 19 13:15:56 2006 UTC (18 years, 6 months ago) by mocchiut
Branch: DarthVader
CVS Tags: v0r01, start
Changes since 1.1: +0 -0 lines
Error occurred while calculating annotation data.
Imported sources

1
2 ************************************************************
3
4 subroutine readvkmask
5
6 include 'commontracker.f'
7 include 'calib.f'
8 include 'common_c2f.f' !<<<< C2F
9
10 c2f_error = 0
11
12 if(C2F_DEBUG.eq.1)print *
13 $ ,c2f_path(1:c2f_pathlen)//'trk-maskvk.dat'
14 open(10,
15 $ FILE=c2f_path(1:c2f_pathlen)//'trk-maskvk.dat' !<<<< C2F
16 $ ,STATUS='OLD'
17 $ ,IOSTAT=iostat
18 $ )
19 if(iostat.ne.0)then
20 if(C2F_DEBUG.eq.1)
21 $ print*,'READVKMASK: *** Error opening file ***'
22 c2f_error = 1
23 return
24 endif
25 do iv=1,nviews
26 read(10,*
27 $ ,IOSTAT=iostat
28 $ )
29 $ (mask_vk(iv,i),i=1,24)
30 if(iostat.ne.0)then
31 if(C2F_DEBUG.eq.1)
32 $ print*,'READVKMASK: *** Error reading file ***'
33 c2f_error = 1
34 goto 1000
35 endif
36 enddo
37 1000 close(10)
38 1001 continue
39 return
40 end
41
42
43 ************************************************************
44
45 subroutine readmipparam
46
47 include 'commontracker.f'
48 include 'calib.f'
49 include 'common_c2f.f' !<<<< C2F
50
51 character*60 fname_param
52 c2f_error = 0
53 201 format('trk-LADDER',i1,'-mip.dat')
54 do ilad=1,nladders_view
55 write(fname_param,201)ilad
56 if(C2F_DEBUG.eq.1)print *
57 $ ,c2f_path(1:c2f_pathlen)!<<<< C2F
58 $ //fname_param(1:LNBLNK(fname_param))
59 open(10,
60 $ FILE=c2f_path(1:c2f_pathlen)!<<<< C2F
61 $ //fname_param(1:LNBLNK(fname_param))
62 $ ,STATUS='OLD'
63 $ ,IOSTAT=iostat
64 $ )
65 if(iostat.ne.0)then
66 if(C2F_DEBUG.eq.1)print*
67 $ ,'READMIPPARAM: *** Error opening file *** '
68 c2f_error = 1
69 return
70 endif
71 do iv=1,nviews
72 read(10,*
73 $ ,IOSTAT=iostat
74 $ )pip,
75 $ mip(int(pip),ilad)
76 if(iostat.ne.0)then
77 c2f_error = 1
78 goto 1000
79 endif
80 enddo
81 1000 close(10)
82 enddo
83
84 return
85 end
86 *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
87 subroutine readchargeparam
88
89
90 include 'commontracker.f'
91 include 'calib.f'
92 include 'common_c2f.f' !<<<< C2F
93 character*60 fname_param
94 c2f_error = 0
95 201 format('charge-l',i1,'.dat')
96 do ilad=1,nladders_view
97 write(fname_param,201)ilad
98 if(C2F_DEBUG.eq.1)print *
99 $ ,c2f_path(1:c2f_pathlen)!<<<< C2F
100 $ //fname_param(1:LNBLNK(fname_param))
101 open(10,
102 $ FILE=c2f_path(1:c2f_pathlen)!<<<< C2F
103 $ //fname_param(1:LNBLNK(fname_param))
104 $ ,STATUS='OLD'
105 $ ,IOSTAT=iostat
106 $ )
107 if(iostat.ne.0)then
108 c2f_error = 1
109 return
110 endif
111 do ip=1,nplanes
112 read(10,*
113 $ ,IOSTAT=iostat
114 $ )pip,
115 $ kch(ip,ilad),cch(ip,ilad),sch(ip,ilad)
116 if(iostat.ne.0)then
117 c2f_error = 1
118 goto 1000
119 endif
120 enddo
121 1000 close(10)
122 enddo
123
124 return
125 end
126 *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
127 subroutine readetaparam
128 * -----------------------------------------
129 * read eta2,3,4 calibration parameters
130 * and fill variables:
131 *
132 * eta2(netabin,nladders_view,nviews)
133 * eta3(2*netabin,nladders_view,nviews)
134 * eta4(2*netabin,nladders_view,nviews)
135 *
136 include 'commontracker.f'
137 include 'calib.f'
138 include 'common_c2f.f' !<<<< C2F
139
140 character*40 fname_binning
141 character*40 fname_param
142
143
144 c2f_error = 0
145
146 ******retrieve ANGULAR BINNING info
147 fname_binning='binning.dat'
148 if(C2F_DEBUG.eq.1)
149 $ print *
150 $ ,c2f_path(1:c2f_pathlen) !<<<< C2F
151 $ //fname_binning(1:LNBLNK(fname_binning))
152 open(10,
153 $ FILE=c2f_path(1:c2f_pathlen) !<<<< C2F
154 $ //fname_binning(1:LNBLNK(fname_binning))
155 $ ,STATUS='OLD'
156 $ ,IOSTAT=iostat
157 $ )
158 if(iostat.ne.0)then
159 if(C2F_DEBUG.eq.1)
160 $ print*,'READETAPARAM: *** Error in opening file *** '
161 c2f_error = 1
162 return
163 endif
164 c print*,'---- ANGULAR BINNING ----'
165 c print*,'Bin - angL - angR'
166 101 format(i2,' ',f6.2,' ',f6.2)
167 xnn=0
168 do ibin=1,nangmax
169 read(10,*
170 $ ,IOSTAT=iostat
171 $ )xnn,angL(ibin),angR(ibin)
172 if(iostat.ne.0)goto 1000
173 c write(*,101)int(xnn),angL(ibin),angR(ibin)
174 enddo
175 1000 nangbin=int(xnn)
176 close(10)
177 if(nangbin.eq.0)c2f_error = 1
178 c print*,'-------------------------'
179 c print*,nangbin
180
181
182
183 do ieta=2,4 !loop on eta 2,3,4
184 ******retrieve correction parameters
185 200 format(' Opening eta',i1,' files...')
186 if(C2F_DEBUG.eq.1)write(*,200)ieta
187
188 201 format('eta',i1,'-bin',i1,'-l',i1,'.dat')
189 202 format('eta',i1,'-bin',i2,'-l',i1,'.dat')
190 do iang=1,nangbin
191 do ilad=1,nladders_view
192 if(iang.lt.10)write(fname_param,201)ieta,iang,ilad
193 if(iang.ge.10)write(fname_param,202)ieta,iang,ilad
194 open(10,
195 c $ FILE=eta_parampath(1:eta_pathlen) !<<<< C2F
196 $ FILE=c2f_path(1:c2f_pathlen) !<<<< C2F
197 $ //fname_param(1:LNBLNK(fname_param))
198 $ ,STATUS='OLD'
199 $ ,IOSTAT=iostat
200 $ )
201 if(iostat.ne.0)then
202 if(C2F_DEBUG.eq.1)
203 $ print*,'READETAPARAM: ** Error opening file ** '
204 $ ,c2f_path(1:c2f_pathlen)
205 $ //fname_param(1:LNBLNK(fname_param))
206 c2f_error = 1
207 return
208 endif
209 netaval=0
210 do ival=1,netavalmax
211 if(ieta.eq.2)read(10,*
212 $ ,IOSTAT=iostat
213 $ )
214 $ eta2(ival,iang),
215 $ (feta2(ival,iv,ilad,iang),iv=1,nviews)
216 if(ieta.eq.3)read(10,*
217 $ ,IOSTAT=iostat
218 $ )
219 $ eta3(ival,iang),
220 $ (feta3(ival,iv,ilad,iang),iv=1,nviews)
221 if(ieta.eq.4)read(10,*
222 $ ,IOSTAT=iostat
223 $ )
224 $ eta4(ival,iang),
225 $ (feta4(ival,iv,ilad,iang),iv=1,nviews)
226 if(iostat.ne.0)then
227 if(netaval.eq.0)then
228 if(C2F_DEBUG.eq.1)print*,'READETAPARAM: '
229 $ //'*** Error reading file *** '
230 $ ,c2f_path(1:c2f_pathlen)
231 $ //fname_param(1:LNBLNK(fname_param))
232 $ ,' (netaval=',netaval,')'
233 c2f_error = 1
234 endif
235 goto 2000
236 endif
237 netaval=netaval+1
238 enddo
239 2000 close(10)
240 * print*,'... done'
241 enddo
242 enddo
243
244 enddo !end loop on eta 2,3,4
245
246
247 return
248 end
249
250 *************************************************************************
251 subroutine readalignparam
252
253 include 'commontracker.f'
254 include 'common_mech.f'
255 include 'common_align.f'
256 include 'common_c2f.f'
257
258 character*50 fname_param
259 integer sensor
260 c character*120 cmd1
261 c character*120 cmd2
262
263 c2f_error = 0
264 call mech_sensor
265 do ip=1,nplanes
266 fitz(ip)=z_mech_sensor(ip,1,1)*0.1 !cm
267 * gets planes mechanical z positions
268 * (in mm) and sets them in micrometers
269 enddo
270
271
272 100 format('parameters_l',i1,'s',i1,'.dat')
273
274 do ilad=1,nladders_view
275 do is=1,2
276
277 write(fname_param,100)ilad,is
278 if(C2F_DEBUG.eq.1)print *
279 $ ,c2f_path(1:c2f_pathlen)
280 $ //fname_param
281
282 open(10,
283 $ FILE=
284 $ c2f_path(1:c2f_pathlen)
285 $ //fname_param(1:LNBLNK(fname_param))
286 $ ,STATUS='OLD',IOSTAT=iostat
287 $ )
288 if(iostat.ne.0)then
289 c2f_error = 1
290 return
291 endif
292
293 do ip=1,nplanes
294 *
295 * NB! NB! NB! NB! NB!
296 * The file labelled for example "l1s1" include the alignment
297 * parameters of the column of sensors:
298 *
299 * PLANE LADDER SENSOR
300 * -------------------
301 * 1 1 2
302 * 2 1 1
303 * 3 1 1
304 * 4 1 1
305 * 5 1 1
306 * 6 1 1
307 *
308 * This is becouse the plane 1 (bottom plane) is up-side-down
309 *
310 sensor=is
311 if(ip.eq.1)sensor=mod(is,2)+1
312 read(10,*)omega(ip,ilad,sensor)
313 read(10,*)beta(ip,ilad,sensor)
314 read(10,*)gamma(ip,ilad,sensor)
315
316 c N.B. I convert angles from microradiants to radiant
317 omega(ip,ilad,sensor)=omega(ip,ilad,sensor)/1.d6
318 beta(ip,ilad,sensor)=beta(ip,ilad,sensor)/1.d6
319 gamma(ip,ilad,sensor)=gamma(ip,ilad,sensor)/1.d6
320
321 read(10,*)dx(ip,ilad,sensor)
322 read(10,*)dy(ip,ilad,sensor)
323 read(10,*)dz(ip,ilad,sensor)
324 enddo
325
326 close(10)
327 enddo
328 enddo
329
330 return
331 end
332
333 c------------------------------------------------------------------------
334
335 c NB: le coordinate in mech_pos.dat sono calcolate a partire da alcuni dati
336 c contenuti in commontracker.f. forse si puo' evitare mech_pos.dat e mettere
337 c tutto in commontracker.f
338
339
340 subroutine mech_sensor
341 c !it reads sensors coordinates (in PAMELA reference
342 c ! frame) from a text file and it uses them to fill
343 c ! x/y/z_mech_sensor variables, taking into account
344 c ! last plane inversion
345
346 include 'commontracker.f'
347 include 'common_tracks.f'
348 include 'common_c2f.f'
349
350 real xvec(nladders_view),yvec(2),zvec(nplanes)
351
352 c2f_error = 0
353
354 if(C2F_DEBUG.eq.1)print *
355 $ ,c2f_path(1:c2f_pathlen)//'mech_pos.dat'
356 open(10
357 $ ,FILE=
358 $ c2f_path(1:c2f_pathlen)//'mech_pos.dat'
359 $ ,IOSTAT=iostat)
360 c !sensors centres coordinates in mm in
361 c ! PAMELA reference frame:
362 c ! the first plane is the one with lowest Z (the one
363 c ! nearest the calorimeter)
364 c ! the first ladder is the one with lowest X (the
365 c ! one on which the first X strip is)
366 c ! the first sensor is the one with lowest Y (the
367 c ! one on which the first Y strip is) for planes
368 c ! 2..6. for plane 1 the first sensor has higher Y
369
370 if(iostat.ne.0)then
371 c2f_error = 1
372 return
373 endif
374
375 read(10,*) xvec
376 read(10,*) yvec
377 read(10,*) zvec
378
379 do i=1,nplanes
380 do j=1,nladders_view
381 do k=1,2
382 x_mech_sensor(i,j,k)=xvec(j)
383 y_mech_sensor(i,j,k)=yvec(k)
384 z_mech_sensor(i,j,k)=zvec(i)
385 if(i.eq.1) then !y coordinates of first plane (11th view) are
386 y_mech_sensor(i,j,k)=-yvec(k) ! exchanged due to last plane inversion
387 endif
388 enddo
389 enddo
390 enddo
391
392 close(10)
393
394 ! *** INIZIO DEBUG ***
395 c$$$ do i=1,6
396 c$$$ do j=1,3
397 c$$$ do k=1,2
398 c$$$c j=1
399 c$$$ print*,x_mech_sensor(i,j,k)
400 c$$$ print*,y_mech_sensor(i,j,k)
401 c$$$ print*,z_mech_sensor(i,j,k)
402 c$$$ enddo
403 c$$$ enddo
404 c$$$ print*,' '
405 c$$$ enddo
406 ! *** FINE DEBUG ***
407
408
409 return
410 end
411 c------------------------------------------------------------------------
412

  ViewVC Help
Powered by ViewVC 1.1.23