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