1 |
************************************************************ |
************************************************************ |
2 |
|
* The following subroutines |
3 |
|
* - track_finding >> hough transform |
4 |
|
* - track_fitting >> bob golden fitting |
5 |
|
* all the procedures to create LEVEL2 data, starting from LEVEL1 data. |
6 |
|
* |
7 |
|
* |
8 |
|
* |
9 |
|
* (This subroutine and all the dependent subroutines |
10 |
|
* will be included in the flight software) |
11 |
|
************************************************************ |
12 |
|
subroutine track_finding(iflag) |
13 |
|
|
|
subroutine readmipparam |
|
|
|
|
14 |
include '../common/commontracker.f' |
include '../common/commontracker.f' |
15 |
|
include '../common/common_momanhough.f' |
16 |
|
include '../common/common_mech.f' |
17 |
|
include '../common/common_xyzPAM.f' |
18 |
|
include '../common/common_mini_2.f' |
19 |
include '../common/calib.f' |
include '../common/calib.f' |
20 |
|
include '../common/level1.f' |
21 |
|
include '../common/level2.f' |
22 |
|
|
23 |
character*60 fname_param |
include '../common/momanhough_init.f' |
24 |
201 format('trk-LADDER',i1,'-mip.dat') |
|
25 |
do ilad=1,nladders_view |
logical DEBUG |
26 |
write(fname_param,201)ilad |
common/dbg/DEBUG |
|
print *,'Opening file: ',fname_param |
|
|
open(10, |
|
|
$ FILE='./bin-aux/'//fname_param(1:LNBLNK(fname_param)) |
|
|
$ ,STATUS='UNKNOWN' |
|
|
$ ,IOSTAT=iostat |
|
|
$ ) |
|
|
if(iostat.ne.0)then |
|
|
print*,'READMIPPARAM: *** Error in opening file ***' |
|
|
return |
|
|
endif |
|
|
do iv=1,nviews |
|
|
read(10,* |
|
|
$ ,IOSTAT=iostat |
|
|
$ )pip, |
|
|
$ mip(int(pip),ilad) |
|
|
c print*,ilad,iv,pip,mip(int(pip),ilad) |
|
|
enddo |
|
|
close(10) |
|
|
enddo |
|
27 |
|
|
28 |
return |
*------------------------------------------------------------------------------- |
29 |
end |
* STEP 1 |
30 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
*------------------------------------------------------------------------------- |
31 |
subroutine readchargeparam |
* X-Y cluster association |
32 |
|
* |
33 |
|
* Clusters are associated to form COUPLES |
34 |
|
* Clusters not associated in any couple are called SINGLETS |
35 |
|
* |
36 |
|
* Track identification (Hough transform) and fitting is first done on couples. |
37 |
|
* Hence singlets are possibly added to the track. |
38 |
|
* |
39 |
|
* Variables assigned by the routine "cl_to_couples" are those in the |
40 |
|
* common blocks: |
41 |
|
* - common/clusters/cl_good |
42 |
|
* - common/couples/clx,cly,ncp_plane,ncp_tot,cp_useds1,cp_useds2 |
43 |
|
* - common/singlets/ncls,cls,cl_single |
44 |
|
*------------------------------------------------------------------------------- |
45 |
|
*------------------------------------------------------------------------------- |
46 |
|
|
47 |
|
c iflag=0 |
48 |
|
call cl_to_couples(iflag) |
49 |
|
if(iflag.eq.1)then !bad event |
50 |
|
goto 880 !fill ntp and go to next event |
51 |
|
endif |
52 |
|
|
53 |
|
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
54 |
|
* selezione di tracce pulite per diagnostica |
55 |
|
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
56 |
|
c$$$ if(DEBUG)then |
57 |
|
c$$$ do ip=1,nplanes |
58 |
|
c$$$ if(ncp_plane(ip).ne.1)good2=.false. |
59 |
|
c$$$ enddo |
60 |
|
c$$$c if(good2.eq.0)goto 100!next event |
61 |
|
c$$$c if(good2.eq.0)goto 880!fill ntp and go to next event |
62 |
|
c$$$ endif |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
*----------------------------------------------------- |
67 |
|
*----------------------------------------------------- |
68 |
|
* HOUGH TRASFORM |
69 |
|
*----------------------------------------------------- |
70 |
|
*----------------------------------------------------- |
71 |
|
|
72 |
|
|
73 |
|
*------------------------------------------------------------------------------- |
74 |
|
* STEP 2 |
75 |
|
*------------------------------------------------------------------------------- |
76 |
|
* |
77 |
|
* Association of couples to form |
78 |
|
* - DOUBLETS in YZ view |
79 |
|
* - TRIPLETS in XZ view |
80 |
|
* |
81 |
|
* Variables assigned by the routine "cp_to_doubtrip" are those in the |
82 |
|
* common blocks: |
83 |
|
* - common/hough_param/ |
84 |
|
* $ alfayz1, !Y0 |
85 |
|
* $ alfayz2, !tg theta-yz |
86 |
|
* $ alfaxz1, !X0 |
87 |
|
* $ alfaxz2, !tg theta-xz |
88 |
|
* $ alfaxz3 !1/r |
89 |
|
* - common/doublets/ndblt,cpyz1,cpyz2 |
90 |
|
* - common/triplets/ntrpt,cpxz1,cpxz2,cpxz3 |
91 |
|
*------------------------------------------------------------------------------- |
92 |
|
*------------------------------------------------------------------------------- |
93 |
|
|
94 |
|
c iflag=0 |
95 |
|
call cp_to_doubtrip(iflag) |
96 |
|
if(iflag.eq.1)then !bad event |
97 |
|
goto 880 !fill ntp and go to next event |
98 |
|
endif |
99 |
|
|
100 |
|
|
101 |
|
*------------------------------------------------------------------------------- |
102 |
|
* STEP 3 |
103 |
|
*------------------------------------------------------------------------------- |
104 |
|
* |
105 |
|
* Classification of doublets and triplets to form CLOUDS, |
106 |
|
* according to distance in parameter space. |
107 |
|
* |
108 |
|
* cloud = cluster of points (doublets/triplets) in parameter space |
109 |
|
* |
110 |
|
* |
111 |
|
* |
112 |
|
* Variables assigned by the routine "doub_to_YZcloud" are those in the |
113 |
|
* common blocks: |
114 |
|
* - common/clouds_yz/ |
115 |
|
* $ nclouds_yz |
116 |
|
* $ ,alfayz1_av,alfayz2_av |
117 |
|
* $ ,ptcloud_yz,db_cloud,cpcloud_yz |
118 |
|
* |
119 |
|
* Variables assigned by the routine "trip_to_XZcloud" are those in the |
120 |
|
* common blocks: |
121 |
|
* common/clouds_xz/ |
122 |
|
* $ nclouds_xz xz2_av,alfaxz3_av |
123 |
|
* $ ,ptcloud_xz,tr_cloud,cpcloud_xz |
124 |
|
*------------------------------------------------------------------------------- |
125 |
|
*------------------------------------------------------------------------------- |
126 |
|
|
127 |
|
c iflag=0 |
128 |
|
call doub_to_YZcloud(iflag) |
129 |
|
if(iflag.eq.1)then !bad event |
130 |
|
goto 880 !fill ntp and go to next event |
131 |
|
endif |
132 |
|
c iflag=0 |
133 |
|
call trip_to_XZcloud(iflag) |
134 |
|
if(iflag.eq.1)then !bad event |
135 |
|
goto 880 !fill ntp and go to next event |
136 |
|
endif |
137 |
|
|
138 |
|
880 return |
139 |
|
end |
140 |
|
|
141 |
|
************************************************************ |
142 |
|
|
143 |
|
|
144 |
|
subroutine track_fitting(iflag) |
145 |
|
|
146 |
include '../common/commontracker.f' |
include '../common/commontracker.f' |
147 |
|
include '../common/common_momanhough.f' |
148 |
|
include '../common/common_mech.f' |
149 |
|
include '../common/common_xyzPAM.f' |
150 |
|
include '../common/common_mini_2.f' |
151 |
include '../common/calib.f' |
include '../common/calib.f' |
152 |
|
include '../common/level1.f' |
153 |
|
include '../common/level2.f' |
154 |
|
|
155 |
|
include '../common/momanhough_init.f' |
156 |
|
|
157 |
|
logical DEBUG |
158 |
|
common/dbg/DEBUG |
159 |
|
|
160 |
|
logical FIMAGE ! |
161 |
|
|
162 |
character*60 fname_param |
*------------------------------------------------------------------------------- |
163 |
201 format('charge-l',i1,'.dat') |
* STEP 4 (ITERATED until any other physical track isn't found) |
164 |
do ilad=1,nladders_view |
*------------------------------------------------------------------------------- |
165 |
write(fname_param,201)ilad |
* |
166 |
print *,'Opening file: ',fname_param |
* YZ and XZ clouds are combined in order to obtain the initial guess |
167 |
open(10, |
* of the candidate-track parameters. |
168 |
$ FILE='./bin-aux/'//fname_param(1:LNBLNK(fname_param)) |
* A minimum number of matching couples between YZ and XZ clouds is required. |
169 |
$ ,STATUS='UNKNOWN' |
* |
170 |
$ ,IOSTAT=iostat |
* A TRACK CANDIDATE is defined by |
171 |
$ ) |
* - the couples resulting from the INTERSECTION of the two clouds, and |
172 |
if(iostat.ne.0)then |
* - the associated track parameters (evaluated by performing a zero-order |
173 |
print*,'READCHARGEPARAM: *** Error in opening file ***' |
* track fitting) |
174 |
|
* |
175 |
|
* The NTRACKS candidate-track parameters are stored in common block: |
176 |
|
* |
177 |
|
* - common/track_candidates/NTRACKS,AL_STORE |
178 |
|
* $ ,XV_STORE,YV_STORE,ZV_STORE |
179 |
|
* $ ,XM_STORE,YM_STORE,ZM_STORE |
180 |
|
* $ ,RESX_STORE,RESY_STORE |
181 |
|
* $ ,AXV_STORE,AYV_STORE |
182 |
|
* $ ,XGOOD_STORE,YGOOD_STORE |
183 |
|
* $ ,CP_STORE,RCHI2_STORE |
184 |
|
* |
185 |
|
*------------------------------------------------------------------------------- |
186 |
|
*------------------------------------------------------------------------------- |
187 |
|
ntrk=0 !counter of identified physical tracks |
188 |
|
|
189 |
|
11111 continue !<<<<<<< come here when performing a new search |
190 |
|
|
191 |
|
c iflag=0 |
192 |
|
call clouds_to_ctrack(iflag) |
193 |
|
if(iflag.eq.1)then !no candidate tracks found |
194 |
|
goto 880 !fill ntp and go to next event |
195 |
|
endif |
196 |
|
|
197 |
|
FIMAGE=.false. !processing best track (not track image) |
198 |
|
ibest=0 !best track among candidates |
199 |
|
iimage=0 !track image |
200 |
|
* ------------- select the best track ------------- |
201 |
|
rchi2best=1000000000. |
202 |
|
do i=1,ntracks |
203 |
|
if(RCHI2_STORE(i).lt.rchi2best.and. |
204 |
|
$ RCHI2_STORE(i).gt.0)then |
205 |
|
ibest=i |
206 |
|
rchi2best=RCHI2_STORE(i) |
207 |
|
endif |
208 |
|
enddo |
209 |
|
if(ibest.eq.0)goto 880 !>> no good candidates |
210 |
|
*------------------------------------------------------------------------------- |
211 |
|
* The best track candidate (ibest) is selected and a new fitting is performed. |
212 |
|
* Previous to this, the track is refined by: |
213 |
|
* - possibly adding new COUPLES or SINGLETS from the missing planes |
214 |
|
* - evaluating the coordinates with improved PFAs |
215 |
|
* ( angle-dependent ETA algorithms ) |
216 |
|
*------------------------------------------------------------------------------- |
217 |
|
|
218 |
|
1212 continue !<<<<< come here to fit track-image |
219 |
|
|
220 |
|
if(.not.FIMAGE)then !processing best candidate |
221 |
|
icand=ibest |
222 |
|
else !processing image |
223 |
|
icand=iimage |
224 |
|
iimage=0 |
225 |
|
endif |
226 |
|
if(icand.eq.0)then |
227 |
|
print*,'HAI FATTO UN CASINO!!!!!! icand = ',icand |
228 |
|
$ ,ibest,iimage |
229 |
return |
return |
230 |
endif |
endif |
|
do ip=1,nplanes |
|
|
read(10,* |
|
|
$ ,IOSTAT=iostat |
|
|
$ )pip, |
|
|
$ kch(ip,ilad),cch(ip,ilad),sch(ip,ilad) |
|
|
c print*,ilad,ip,pip,kch(ip,ilad), |
|
|
c $ cch(ip,ilad),sch(ip,ilad) |
|
|
enddo |
|
|
close(10) |
|
|
enddo |
|
231 |
|
|
232 |
return |
* *-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
233 |
end |
call refine_track(icand) |
234 |
*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
* *-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
|
subroutine readetaparam |
|
|
* ----------------------------------------- |
|
|
* read eta2,3,4 calibration parameters |
|
|
* and fill variables: |
|
|
* |
|
|
* eta2(netabin,nladders_view,nviews) |
|
|
* eta3(2*netabin,nladders_view,nviews) |
|
|
* eta4(2*netabin,nladders_view,nviews) |
|
|
* |
|
|
include '../common/commontracker.f' |
|
|
include '../common/calib.f' |
|
235 |
|
|
236 |
character*40 fname_binning |
* ********************************************************** |
237 |
character*40 fname_param |
* ************************** FIT *** FIT *** FIT *** FIT *** |
238 |
c character*120 cmd1 |
* ********************************************************** |
239 |
c character*120 cmd2 |
do i=1,5 |
240 |
|
AL(i)=dble(AL_STORE(i,icand)) |
241 |
|
enddo |
242 |
|
ifail=0 !error flag in chi2 computation |
243 |
|
jstep=0 !# minimization steps |
244 |
|
|
245 |
|
call mini_2(jstep,ifail) |
246 |
|
if(ifail.ne.0) then |
247 |
|
if(DEBUG)then |
248 |
|
print *, |
249 |
|
$ '*** MINIMIZATION FAILURE *** (mini_2) ' |
250 |
|
$ ,iev |
251 |
|
endif |
252 |
|
chi2=-chi2 |
253 |
|
endif |
254 |
|
|
255 |
|
if(DEBUG)then |
256 |
|
print*,'----------------------------- improved track coord' |
257 |
|
22222 format(i2,' * ',3f10.4,' --- ',4f10.4,' --- ',2f4.0,2f10.5) |
258 |
|
do ip=1,6 |
259 |
|
write(*,22222)ip,zm(ip),xm(ip),ym(ip) |
260 |
|
$ ,xm_A(ip),ym_A(ip),xm_B(ip),ym_B(ip) |
261 |
|
$ ,xgood(ip),ygood(ip),resx(ip),resy(ip) |
262 |
|
enddo |
263 |
|
endif |
264 |
|
|
265 |
******retrieve ANGULAR BINNING info |
c rchi2=chi2/dble(ndof) |
266 |
fname_binning='binning.dat' |
if(DEBUG)then |
267 |
print *,'Opening file: ',fname_binning |
print*,' ' |
268 |
open(10, |
print*,'****** SELECTED TRACK *************' |
269 |
$ FILE='./bin-aux/'//fname_binning(1:LNBLNK(fname_binning)) |
print*,'# R. chi2 RIG' |
270 |
$ ,STATUS='UNKNOWN' |
print*,' --- ',chi2,' --- ' |
271 |
$ ,IOSTAT=iostat |
$ ,1./abs(AL(5)) |
272 |
$ ) |
print*,'***********************************' |
273 |
if(iostat.ne.0)then |
endif |
274 |
print*,'READETAPARAM: *** Error in opening file ***' |
* ********************************************************** |
275 |
return |
* ************************** FIT *** FIT *** FIT *** FIT *** |
276 |
endif |
* ********************************************************** |
|
print*,'---- ANGULAR BINNING ----' |
|
|
print*,'Bin - angL - angR' |
|
|
101 format(i2,' ',f6.2,' ',f6.2) |
|
|
do ibin=1,nangmax |
|
|
read(10,* |
|
|
$ ,IOSTAT=iostat |
|
|
$ )xnn,angL(ibin),angR(ibin) |
|
|
if(iostat.ne.0)goto 1000 |
|
|
write(*,101)int(xnn),angL(ibin),angR(ibin) |
|
|
enddo |
|
|
1000 nangbin=int(xnn) |
|
|
close(10) |
|
|
print*,'-------------------------' |
|
|
|
|
277 |
|
|
278 |
|
|
279 |
do ieta=2,4 !loop on eta 2,3,4 |
* ------------- search if the track has an IMAGE ------------- |
280 |
******retrieve correction parameters |
* ------------- (also this is stored ) ------------- |
281 |
200 format(' Opening eta',i1,' files...') |
if(FIMAGE)goto 122 !>>> jump! (this is already an image) |
282 |
write(*,200)ieta |
* now search for track-image, by comparing couples IDs |
283 |
|
do i=1,ntracks |
284 |
201 format('eta',i1,'-bin',i1,'-l',i1,'.dat') |
iimage=i |
285 |
202 format('eta',i1,'-bin',i2,'-l',i1,'.dat') |
do ip=1,nplanes |
286 |
do iang=1,nangbin |
if( CP_STORE(nplanes-ip+1,icand).ne. |
287 |
do ilad=1,nladders_view |
$ -1*CP_STORE(nplanes-ip+1,i) )iimage=0 |
|
if(iang.lt.10)write(fname_param,201)ieta,iang,ilad |
|
|
if(iang.ge.10)write(fname_param,202)ieta,iang,ilad |
|
|
c print *,'Opening file: ',fname_param |
|
|
open(10, |
|
|
$ FILE='./bin-aux/'//fname_param(1:LNBLNK(fname_param)) |
|
|
$ ,STATUS='UNKNOWN' |
|
|
$ ,IOSTAT=iostat |
|
|
$ ) |
|
|
if(iostat.ne.0)then |
|
|
print*,'READETAPARAM: *** Error in opening file ***' |
|
|
return |
|
|
endif |
|
|
do ival=1,netavalmax |
|
|
if(ieta.eq.2)read(10,* |
|
|
$ ,IOSTAT=iostat |
|
|
$ ) |
|
|
$ eta2(ival,iang), |
|
|
$ (feta2(ival,iv,ilad,iang),iv=1,nviews) |
|
|
if(ieta.eq.3)read(10,* |
|
|
$ ,IOSTAT=iostat |
|
|
$ ) |
|
|
$ eta3(ival,iang), |
|
|
$ (feta3(ival,iv,ilad,iang),iv=1,nviews) |
|
|
if(ieta.eq.4)read(10,* |
|
|
$ ,IOSTAT=iostat |
|
|
$ ) |
|
|
$ eta4(ival,iang), |
|
|
$ (feta4(ival,iv,ilad,iang),iv=1,nviews) |
|
|
if(iostat.ne.0)then |
|
|
netaval=ival-1 |
|
|
c$$$ if(eta2(1,iang).ne.-eta2(netaval,iang)) |
|
|
c$$$ $ print*,'**** ERROR on parameters !!! ****' |
|
|
goto 2000 |
|
|
endif |
|
|
enddo |
|
|
2000 close(10) |
|
|
* print*,'... done' |
|
288 |
enddo |
enddo |
289 |
|
if( iimage.ne.0.and. |
290 |
|
c $ RCHI2_STORE(i).le.CHI2MAX.and. |
291 |
|
c $ RCHI2_STORE(i).gt.0.and. |
292 |
|
$ .true.)then |
293 |
|
if(DEBUG)print*,'Track candidate ',iimage |
294 |
|
$ ,' >>> TRACK IMAGE >>> of' |
295 |
|
$ ,ibest |
296 |
|
goto 122 !image track found |
297 |
|
endif |
298 |
enddo |
enddo |
299 |
|
122 continue |
300 |
|
|
301 |
enddo !end loop on eta 2,3,4 |
* --- and store the results -------------------------------- |
302 |
|
ntrk = ntrk + 1 !counter of found tracks |
303 |
|
if(.not.FIMAGE |
304 |
|
$ .and.iimage.eq.0) image(ntrk)= 0 |
305 |
|
if(.not.FIMAGE |
306 |
|
$ .and.iimage.ne.0)image(ntrk)=ntrk+1 !this is the image of the next |
307 |
|
if(FIMAGE) image(ntrk)=ntrk-1 !this is the image of the previous |
308 |
|
|
309 |
|
call fill_level2_tracks(ntrk) !==> good2=.true. |
310 |
|
c print*,'++++++++++ iimage,fimage,ntrk,image ' |
311 |
|
c $ ,iimage,fimage,ntrk,image(ntrk) |
312 |
|
|
313 |
|
if(ntrk.eq.NTRKMAX)then |
314 |
|
if(DEBUG) |
315 |
|
$ print*, |
316 |
|
$ '** warning ** number of identified '// |
317 |
|
$ 'tracks exceeds vector dimension ' |
318 |
|
$ ,'( ',NTRKMAX,' )' |
319 |
|
cc good2=.false. |
320 |
|
goto 880 !fill ntp and go to next event |
321 |
|
endif |
322 |
|
if(iimage.ne.0)then |
323 |
|
FIMAGE=.true. ! |
324 |
|
goto 1212 !>>> fit image-track |
325 |
|
endif |
326 |
|
|
327 |
|
* --- then remove selected clusters (ibest+iimage) from clouds ---- |
328 |
|
call clean_XYclouds(ibest,iflag) |
329 |
|
if(iflag.eq.1)then !bad event |
330 |
|
goto 880 !fill ntp and go to next event |
331 |
|
endif |
332 |
|
|
333 |
return |
* ********************************************************** |
334 |
|
* condition to start a new search |
335 |
|
* ********************************************************** |
336 |
|
ixznew=0 |
337 |
|
do ixz=1,nclouds_xz |
338 |
|
if(ptcloud_xz(ixz).ge.nptxz_min)ixznew=1 |
339 |
|
enddo |
340 |
|
iyznew=0 |
341 |
|
do iyz=1,nclouds_yz |
342 |
|
if(ptcloud_yz(iyz).ge.nptyz_min)iyznew=1 |
343 |
|
enddo |
344 |
|
|
345 |
|
if(ixznew.ne.0.and. |
346 |
|
$ iyznew.ne.0.and. |
347 |
|
$ rchi2best.le.CHI2MAX.and. |
348 |
|
c $ rchi2best.lt.15..and. |
349 |
|
$ .true.)then |
350 |
|
if(DEBUG)then |
351 |
|
print*,'***** NEW SEARCH ****' |
352 |
|
endif |
353 |
|
goto 11111 !try new search |
354 |
|
|
355 |
|
endif |
356 |
|
* ********************************************** |
357 |
|
|
358 |
|
|
359 |
|
|
360 |
|
880 return |
361 |
end |
end |
362 |
|
|
363 |
|
|
364 |
|
|
365 |
|
|
366 |
|
c$$$************************************************************ |
367 |
|
c$$$ |
368 |
|
c$$$ subroutine readmipparam |
369 |
|
c$$$ |
370 |
|
c$$$ include '../common/commontracker.f' |
371 |
|
c$$$ include '../common/calib.f' |
372 |
|
c$$$ |
373 |
|
c$$$ character*60 fname_param |
374 |
|
c$$$ 201 format('trk-LADDER',i1,'-mip.dat') |
375 |
|
c$$$ do ilad=1,nladders_view |
376 |
|
c$$$ write(fname_param,201)ilad |
377 |
|
c$$$ print *,'Opening file: ',fname_param |
378 |
|
c$$$ open(10, |
379 |
|
c$$$ $ FILE='./bin-aux/'//fname_param(1:LNBLNK(fname_param)) |
380 |
|
c$$$ $ ,STATUS='UNKNOWN' |
381 |
|
c$$$ $ ,IOSTAT=iostat |
382 |
|
c$$$ $ ) |
383 |
|
c$$$ if(iostat.ne.0)then |
384 |
|
c$$$ print*,'READMIPPARAM: *** Error in opening file ***' |
385 |
|
c$$$ return |
386 |
|
c$$$ endif |
387 |
|
c$$$ do iv=1,nviews |
388 |
|
c$$$ read(10,* |
389 |
|
c$$$ $ ,IOSTAT=iostat |
390 |
|
c$$$ $ )pip, |
391 |
|
c$$$ $ mip(int(pip),ilad) |
392 |
|
c$$$c print*,ilad,iv,pip,mip(int(pip),ilad) |
393 |
|
c$$$ enddo |
394 |
|
c$$$ close(10) |
395 |
|
c$$$ enddo |
396 |
|
c$$$ |
397 |
|
c$$$ return |
398 |
|
c$$$ end |
399 |
|
c$$$*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
400 |
|
c$$$ subroutine readchargeparam |
401 |
|
c$$$ |
402 |
|
c$$$ |
403 |
|
c$$$ include '../common/commontracker.f' |
404 |
|
c$$$ include '../common/calib.f' |
405 |
|
c$$$ |
406 |
|
c$$$ character*60 fname_param |
407 |
|
c$$$ 201 format('charge-l',i1,'.dat') |
408 |
|
c$$$ do ilad=1,nladders_view |
409 |
|
c$$$ write(fname_param,201)ilad |
410 |
|
c$$$ print *,'Opening file: ',fname_param |
411 |
|
c$$$ open(10, |
412 |
|
c$$$ $ FILE='./bin-aux/'//fname_param(1:LNBLNK(fname_param)) |
413 |
|
c$$$ $ ,STATUS='UNKNOWN' |
414 |
|
c$$$ $ ,IOSTAT=iostat |
415 |
|
c$$$ $ ) |
416 |
|
c$$$ if(iostat.ne.0)then |
417 |
|
c$$$ print*,'READCHARGEPARAM: *** Error in opening file ***' |
418 |
|
c$$$ return |
419 |
|
c$$$ endif |
420 |
|
c$$$ do ip=1,nplanes |
421 |
|
c$$$ read(10,* |
422 |
|
c$$$ $ ,IOSTAT=iostat |
423 |
|
c$$$ $ )pip, |
424 |
|
c$$$ $ kch(ip,ilad),cch(ip,ilad),sch(ip,ilad) |
425 |
|
c$$$c print*,ilad,ip,pip,kch(ip,ilad), |
426 |
|
c$$$c $ cch(ip,ilad),sch(ip,ilad) |
427 |
|
c$$$ enddo |
428 |
|
c$$$ close(10) |
429 |
|
c$$$ enddo |
430 |
|
c$$$ |
431 |
|
c$$$ return |
432 |
|
c$$$ end |
433 |
|
c$$$*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
434 |
|
c$$$ subroutine readetaparam |
435 |
|
c$$$* ----------------------------------------- |
436 |
|
c$$$* read eta2,3,4 calibration parameters |
437 |
|
c$$$* and fill variables: |
438 |
|
c$$$* |
439 |
|
c$$$* eta2(netabin,nladders_view,nviews) |
440 |
|
c$$$* eta3(2*netabin,nladders_view,nviews) |
441 |
|
c$$$* eta4(2*netabin,nladders_view,nviews) |
442 |
|
c$$$* |
443 |
|
c$$$ include '../common/commontracker.f' |
444 |
|
c$$$ include '../common/calib.f' |
445 |
|
c$$$ |
446 |
|
c$$$ character*40 fname_binning |
447 |
|
c$$$ character*40 fname_param |
448 |
|
c$$$c character*120 cmd1 |
449 |
|
c$$$c character*120 cmd2 |
450 |
|
c$$$ |
451 |
|
c$$$ |
452 |
|
c$$$******retrieve ANGULAR BINNING info |
453 |
|
c$$$ fname_binning='binning.dat' |
454 |
|
c$$$ print *,'Opening file: ',fname_binning |
455 |
|
c$$$ open(10, |
456 |
|
c$$$ $ FILE='./bin-aux/'//fname_binning(1:LNBLNK(fname_binning)) |
457 |
|
c$$$ $ ,STATUS='UNKNOWN' |
458 |
|
c$$$ $ ,IOSTAT=iostat |
459 |
|
c$$$ $ ) |
460 |
|
c$$$ if(iostat.ne.0)then |
461 |
|
c$$$ print*,'READETAPARAM: *** Error in opening file ***' |
462 |
|
c$$$ return |
463 |
|
c$$$ endif |
464 |
|
c$$$ print*,'---- ANGULAR BINNING ----' |
465 |
|
c$$$ print*,'Bin - angL - angR' |
466 |
|
c$$$ 101 format(i2,' ',f6.2,' ',f6.2) |
467 |
|
c$$$ do ibin=1,nangmax |
468 |
|
c$$$ read(10,* |
469 |
|
c$$$ $ ,IOSTAT=iostat |
470 |
|
c$$$ $ )xnn,angL(ibin),angR(ibin) |
471 |
|
c$$$ if(iostat.ne.0)goto 1000 |
472 |
|
c$$$ write(*,101)int(xnn),angL(ibin),angR(ibin) |
473 |
|
c$$$ enddo |
474 |
|
c$$$ 1000 nangbin=int(xnn) |
475 |
|
c$$$ close(10) |
476 |
|
c$$$ print*,'-------------------------' |
477 |
|
c$$$ |
478 |
|
c$$$ |
479 |
|
c$$$ |
480 |
|
c$$$ do ieta=2,4 !loop on eta 2,3,4 |
481 |
|
c$$$******retrieve correction parameters |
482 |
|
c$$$ 200 format(' Opening eta',i1,' files...') |
483 |
|
c$$$ write(*,200)ieta |
484 |
|
c$$$ |
485 |
|
c$$$ 201 format('eta',i1,'-bin',i1,'-l',i1,'.dat') |
486 |
|
c$$$ 202 format('eta',i1,'-bin',i2,'-l',i1,'.dat') |
487 |
|
c$$$ do iang=1,nangbin |
488 |
|
c$$$ do ilad=1,nladders_view |
489 |
|
c$$$ if(iang.lt.10)write(fname_param,201)ieta,iang,ilad |
490 |
|
c$$$ if(iang.ge.10)write(fname_param,202)ieta,iang,ilad |
491 |
|
c$$$c print *,'Opening file: ',fname_param |
492 |
|
c$$$ open(10, |
493 |
|
c$$$ $ FILE='./bin-aux/'//fname_param(1:LNBLNK(fname_param)) |
494 |
|
c$$$ $ ,STATUS='UNKNOWN' |
495 |
|
c$$$ $ ,IOSTAT=iostat |
496 |
|
c$$$ $ ) |
497 |
|
c$$$ if(iostat.ne.0)then |
498 |
|
c$$$ print*,'READETAPARAM: *** Error in opening file ***' |
499 |
|
c$$$ return |
500 |
|
c$$$ endif |
501 |
|
c$$$ do ival=1,netavalmax |
502 |
|
c$$$ if(ieta.eq.2)read(10,* |
503 |
|
c$$$ $ ,IOSTAT=iostat |
504 |
|
c$$$ $ ) |
505 |
|
c$$$ $ eta2(ival,iang), |
506 |
|
c$$$ $ (feta2(ival,iv,ilad,iang),iv=1,nviews) |
507 |
|
c$$$ if(ieta.eq.3)read(10,* |
508 |
|
c$$$ $ ,IOSTAT=iostat |
509 |
|
c$$$ $ ) |
510 |
|
c$$$ $ eta3(ival,iang), |
511 |
|
c$$$ $ (feta3(ival,iv,ilad,iang),iv=1,nviews) |
512 |
|
c$$$ if(ieta.eq.4)read(10,* |
513 |
|
c$$$ $ ,IOSTAT=iostat |
514 |
|
c$$$ $ ) |
515 |
|
c$$$ $ eta4(ival,iang), |
516 |
|
c$$$ $ (feta4(ival,iv,ilad,iang),iv=1,nviews) |
517 |
|
c$$$ if(iostat.ne.0)then |
518 |
|
c$$$ netaval=ival-1 |
519 |
|
c$$$c$$$ if(eta2(1,iang).ne.-eta2(netaval,iang)) |
520 |
|
c$$$c$$$ $ print*,'**** ERROR on parameters !!! ****' |
521 |
|
c$$$ goto 2000 |
522 |
|
c$$$ endif |
523 |
|
c$$$ enddo |
524 |
|
c$$$ 2000 close(10) |
525 |
|
c$$$* print*,'... done' |
526 |
|
c$$$ enddo |
527 |
|
c$$$ enddo |
528 |
|
c$$$ |
529 |
|
c$$$ enddo !end loop on eta 2,3,4 |
530 |
|
c$$$ |
531 |
|
c$$$ |
532 |
|
c$$$ return |
533 |
|
c$$$ end |
534 |
|
c$$$ |
535 |
|
|
536 |
|
|
537 |
************************************************************ |
************************************************************ |
538 |
************************************************************ |
************************************************************ |