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