12 |
subroutine track_finding(iflag) |
subroutine track_finding(iflag) |
13 |
|
|
14 |
include 'commontracker.f' |
include 'commontracker.f' |
15 |
|
include 'level1.f' |
16 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
17 |
include 'common_mech.f' |
include 'common_mech.f' |
18 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
19 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
20 |
include 'calib.f' |
include 'calib.f' |
|
include 'level1.f' |
|
21 |
include 'level2.f' |
include 'level2.f' |
22 |
|
|
23 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
24 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
|
|
|
25 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
26 |
* STEP 1 |
* STEP 1 |
27 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
44 |
c iflag=0 |
c iflag=0 |
45 |
call cl_to_couples(iflag) |
call cl_to_couples(iflag) |
46 |
if(iflag.eq.1)then !bad event |
if(iflag.eq.1)then !bad event |
47 |
goto 880 !fill ntp and go to next event |
goto 880 !go to next event |
48 |
endif |
endif |
49 |
|
|
|
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
|
* selezione di tracce pulite per diagnostica |
|
|
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
|
c$$$ if(DEBUG)then |
|
|
c$$$ do ip=1,nplanes |
|
|
c$$$ if(ncp_plane(ip).ne.1)good2=.false. |
|
|
c$$$ enddo |
|
|
c$$$c if(good2.eq.0)goto 100!next event |
|
|
c$$$c if(good2.eq.0)goto 880!fill ntp and go to next event |
|
|
c$$$ endif |
|
|
|
|
|
|
|
|
|
|
50 |
*----------------------------------------------------- |
*----------------------------------------------------- |
51 |
*----------------------------------------------------- |
*----------------------------------------------------- |
52 |
* HOUGH TRASFORM |
* HOUGH TRASFORM |
78 |
c iflag=0 |
c iflag=0 |
79 |
call cp_to_doubtrip(iflag) |
call cp_to_doubtrip(iflag) |
80 |
if(iflag.eq.1)then !bad event |
if(iflag.eq.1)then !bad event |
81 |
goto 880 !fill ntp and go to next event |
goto 880 !go to next event |
82 |
endif |
endif |
83 |
|
|
84 |
|
|
107 |
* $ ,ptcloud_xz,tr_cloud,cpcloud_xz |
* $ ,ptcloud_xz,tr_cloud,cpcloud_xz |
108 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
109 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
110 |
|
* count number of hit planes |
111 |
|
planehit=0 |
112 |
|
do np=1,nplanes |
113 |
|
if(ncp_plane(np).ne.0)then |
114 |
|
planehit=planehit+1 |
115 |
|
endif |
116 |
|
enddo |
117 |
|
if(planehit.lt.3) goto 880 ! exit |
118 |
|
|
119 |
|
nptxz_min=x_min_start |
120 |
|
nplxz_min=x_min_start |
121 |
|
|
122 |
|
nptyz_min=y_min_start |
123 |
|
nplyz_min=y_min_start |
124 |
|
|
125 |
c iflag=0 |
cutdistyz=cutystart |
126 |
|
cutdistxz=cutxstart |
127 |
|
|
128 |
|
878 continue |
129 |
call doub_to_YZcloud(iflag) |
call doub_to_YZcloud(iflag) |
130 |
if(iflag.eq.1)then !bad event |
if(iflag.eq.1)then !bad event |
131 |
goto 880 !fill ntp and go to next event |
goto 880 !fill ntp and go to next event |
132 |
endif |
endif |
133 |
c iflag=0 |
if(nclouds_yz.eq.0.and.cutdistyz.lt.maxcuty)then |
134 |
|
if(cutdistyz.lt.maxcuty/2)then |
135 |
|
cutdistyz=cutdistyz+cutystep |
136 |
|
else |
137 |
|
cutdistyz=cutdistyz+(3*cutystep) |
138 |
|
endif |
139 |
|
goto 878 |
140 |
|
endif |
141 |
|
|
142 |
|
if(planehit.eq.3) goto 881 |
143 |
|
|
144 |
|
879 continue |
145 |
call trip_to_XZcloud(iflag) |
call trip_to_XZcloud(iflag) |
146 |
if(iflag.eq.1)then !bad event |
if(iflag.eq.1)then !bad event |
147 |
goto 880 !fill ntp and go to next event |
goto 880 !fill ntp and go to next event |
148 |
endif |
endif |
149 |
|
|
150 |
|
if(nclouds_xz.eq.0.and.cutdistxz.lt.maxcutx)then |
151 |
|
cutdistxz=cutdistxz+cutxstep |
152 |
|
goto 879 |
153 |
|
endif |
154 |
|
|
155 |
|
|
156 |
|
881 continue |
157 |
|
* if there is at least three planes on the Y view decreases cuts on X view |
158 |
|
if(nclouds_xz.eq.0.and.nclouds_yz.gt.0.and. |
159 |
|
$ nplxz_min.ne.y_min_start)then |
160 |
|
nptxz_min=x_min_step |
161 |
|
nplxz_min=x_min_start-x_min_step |
162 |
|
goto 879 |
163 |
|
endif |
164 |
|
|
165 |
880 return |
880 return |
166 |
end |
end |
167 |
|
|
171 |
subroutine track_fitting(iflag) |
subroutine track_fitting(iflag) |
172 |
|
|
173 |
include 'commontracker.f' |
include 'commontracker.f' |
174 |
|
include 'level1.f' |
175 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
176 |
include 'common_mech.f' |
include 'common_mech.f' |
177 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
178 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
179 |
include 'calib.f' |
include 'calib.f' |
|
include 'level1.f' |
|
180 |
include 'level2.f' |
include 'level2.f' |
181 |
|
|
182 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
183 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
|
|
|
184 |
logical FIMAGE ! |
logical FIMAGE ! |
185 |
|
real*8 AL_GUESS(5) |
186 |
|
|
187 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
188 |
* STEP 4 (ITERATED until any other physical track isn't found) |
* STEP 4 (ITERATED until any other physical track isn't found) |
223 |
ibest=0 !best track among candidates |
ibest=0 !best track among candidates |
224 |
iimage=0 !track image |
iimage=0 !track image |
225 |
* ------------- select the best track ------------- |
* ------------- select the best track ------------- |
226 |
rchi2best=1000000000. |
c$$$ rchi2best=1000000000. |
227 |
|
c$$$ do i=1,ntracks |
228 |
|
c$$$ if(RCHI2_STORE(i).lt.rchi2best.and. |
229 |
|
c$$$ $ RCHI2_STORE(i).gt.0)then |
230 |
|
c$$$ ibest=i |
231 |
|
c$$$ rchi2best=RCHI2_STORE(i) |
232 |
|
c$$$ endif |
233 |
|
c$$$ enddo |
234 |
|
c$$$ if(ibest.eq.0)goto 880 !>> no good candidates |
235 |
|
|
236 |
|
* ------------------------------------------------------- |
237 |
|
* order track-candidates according to: |
238 |
|
* 1st) decreasing n.points |
239 |
|
* 2nd) increasing chi**2 |
240 |
|
* ------------------------------------------------------- |
241 |
|
rchi2best=1000000000. |
242 |
|
ndofbest=0 !(1) |
243 |
do i=1,ntracks |
do i=1,ntracks |
244 |
if(RCHI2_STORE(i).lt.rchi2best.and. |
ndof=0 !(1) |
245 |
$ RCHI2_STORE(i).gt.0)then |
do ii=1,nplanes !(1) |
246 |
|
ndof=ndof !(1) |
247 |
|
$ +int(xgood_store(ii,i)) !(1) |
248 |
|
$ +int(ygood_store(ii,i)) !(1) |
249 |
|
enddo !(1) |
250 |
|
if(ndof.gt.ndofbest)then !(1) |
251 |
|
ibest=i |
252 |
|
rchi2best=RCHI2_STORE(i) |
253 |
|
ndofbest=ndof !(1) |
254 |
|
elseif(ndof.eq.ndofbest)then !(1) |
255 |
|
if(RCHI2_STORE(i).lt.rchi2best.and. |
256 |
|
$ RCHI2_STORE(i).gt.0)then |
257 |
ibest=i |
ibest=i |
258 |
rchi2best=RCHI2_STORE(i) |
rchi2best=RCHI2_STORE(i) |
259 |
endif |
ndofbest=ndof !(1) |
260 |
enddo |
endif !(1) |
261 |
|
endif |
262 |
|
enddo |
263 |
|
|
264 |
|
c$$$ rchi2best=1000000000. |
265 |
|
c$$$ ndofbest=0 !(1) |
266 |
|
c$$$ do i=1,ntracks |
267 |
|
c$$$ if(RCHI2_STORE(i).lt.rchi2best.and. |
268 |
|
c$$$ $ RCHI2_STORE(i).gt.0)then |
269 |
|
c$$$ ndof=0 !(1) |
270 |
|
c$$$ do ii=1,nplanes !(1) |
271 |
|
c$$$ ndof=ndof !(1) |
272 |
|
c$$$ $ +int(xgood_store(ii,i)) !(1) |
273 |
|
c$$$ $ +int(ygood_store(ii,i)) !(1) |
274 |
|
c$$$ enddo !(1) |
275 |
|
c$$$ if(ndof.ge.ndofbest)then !(1) |
276 |
|
c$$$ ibest=i |
277 |
|
c$$$ rchi2best=RCHI2_STORE(i) |
278 |
|
c$$$ ndofbest=ndof !(1) |
279 |
|
c$$$ endif !(1) |
280 |
|
c$$$ endif |
281 |
|
c$$$ enddo |
282 |
|
|
283 |
if(ibest.eq.0)goto 880 !>> no good candidates |
if(ibest.eq.0)goto 880 !>> no good candidates |
284 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
285 |
* The best track candidate (ibest) is selected and a new fitting is performed. |
* The best track candidate (ibest) is selected and a new fitting is performed. |
310 |
* ********************************************************** |
* ********************************************************** |
311 |
* ************************** FIT *** FIT *** FIT *** FIT *** |
* ************************** FIT *** FIT *** FIT *** FIT *** |
312 |
* ********************************************************** |
* ********************************************************** |
313 |
|
call guess() |
314 |
|
do i=1,5 |
315 |
|
AL_GUESS(i)=AL(i) |
316 |
|
enddo |
317 |
|
c print*,'## guess: ',al |
318 |
|
|
319 |
do i=1,5 |
do i=1,5 |
320 |
AL(i)=dble(AL_STORE(i,icand)) |
AL(i)=dble(AL_STORE(i,icand)) |
321 |
enddo |
enddo |
322 |
|
|
323 |
IDCAND = icand !fitted track-candidate |
IDCAND = icand !fitted track-candidate |
324 |
ifail=0 !error flag in chi2 computation |
ifail=0 !error flag in chi2 computation |
325 |
jstep=0 !# minimization steps |
jstep=0 !# minimization steps |
326 |
|
|
327 |
call mini_2(jstep,ifail) |
iprint=0 |
328 |
|
c if(DEBUG)iprint=1 |
329 |
|
if(VERBOSE)iprint=1 |
330 |
|
if(DEBUG)iprint=2 |
331 |
|
call mini2(jstep,ifail,iprint) |
332 |
if(ifail.ne.0) then |
if(ifail.ne.0) then |
333 |
if(DEBUG)then |
if(VERBOSE)then |
334 |
print *, |
print *, |
335 |
$ '*** MINIMIZATION FAILURE *** (mini_2) ' |
$ '*** MINIMIZATION FAILURE *** (after refinement) ' |
336 |
$ ,iev |
$ ,iev |
337 |
|
|
338 |
|
c$$$ print*,'guess: ',(al_guess(i),i=1,5) |
339 |
|
c$$$ print*,'previous: ',(al_store(i,icand),i=1,5) |
340 |
|
c$$$ print*,'result: ',(al(i),i=1,5) |
341 |
|
c$$$ print*,'xgood ',xgood |
342 |
|
c$$$ print*,'ygood ',ygood |
343 |
|
c$$$ print*,'----------------------------------------------' |
344 |
endif |
endif |
345 |
chi2=-chi2 |
c chi2=-chi2 |
346 |
endif |
endif |
347 |
|
|
348 |
if(DEBUG)then |
if(DEBUG)then |
403 |
c $ ,iimage,fimage,ntrk,image(ntrk) |
c $ ,iimage,fimage,ntrk,image(ntrk) |
404 |
|
|
405 |
if(ntrk.eq.NTRKMAX)then |
if(ntrk.eq.NTRKMAX)then |
406 |
if(DEBUG) |
if(verbose) |
407 |
$ print*, |
$ print*, |
408 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
409 |
$ 'tracks exceeds vector dimension ' |
$ 'tracks exceeds vector dimension ' |
453 |
end |
end |
454 |
|
|
455 |
|
|
|
|
|
|
|
|
|
c$$$************************************************************ |
|
|
c$$$ |
|
|
c$$$ subroutine readmipparam |
|
|
c$$$ |
|
|
c$$$ include 'commontracker.f' |
|
|
c$$$ include 'calib.f' |
|
|
c$$$ |
|
|
c$$$ character*60 fname_param |
|
|
c$$$ 201 format('trk-LADDER',i1,'-mip.dat') |
|
|
c$$$ do ilad=1,nladders_view |
|
|
c$$$ write(fname_param,201)ilad |
|
|
c$$$ print *,'Opening file: ',fname_param |
|
|
c$$$ open(10, |
|
|
c$$$ $ FILE='./bin-aux/'//fname_param(1:LNBLNK(fname_param)) |
|
|
c$$$ $ ,STATUS='UNKNOWN' |
|
|
c$$$ $ ,IOSTAT=iostat |
|
|
c$$$ $ ) |
|
|
c$$$ if(iostat.ne.0)then |
|
|
c$$$ print*,'READMIPPARAM: *** Error in opening file ***' |
|
|
c$$$ return |
|
|
c$$$ endif |
|
|
c$$$ do iv=1,nviews |
|
|
c$$$ read(10,* |
|
|
c$$$ $ ,IOSTAT=iostat |
|
|
c$$$ $ )pip, |
|
|
c$$$ $ mip(int(pip),ilad) |
|
|
c$$$c print*,ilad,iv,pip,mip(int(pip),ilad) |
|
|
c$$$ enddo |
|
|
c$$$ close(10) |
|
|
c$$$ enddo |
|
|
c$$$ |
|
|
c$$$ return |
|
|
c$$$ end |
|
|
c$$$*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
|
|
c$$$ subroutine readchargeparam |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ include 'commontracker.f' |
|
|
c$$$ include 'calib.f' |
|
|
c$$$ |
|
|
c$$$ character*60 fname_param |
|
|
c$$$ 201 format('charge-l',i1,'.dat') |
|
|
c$$$ do ilad=1,nladders_view |
|
|
c$$$ write(fname_param,201)ilad |
|
|
c$$$ print *,'Opening file: ',fname_param |
|
|
c$$$ open(10, |
|
|
c$$$ $ FILE='./bin-aux/'//fname_param(1:LNBLNK(fname_param)) |
|
|
c$$$ $ ,STATUS='UNKNOWN' |
|
|
c$$$ $ ,IOSTAT=iostat |
|
|
c$$$ $ ) |
|
|
c$$$ if(iostat.ne.0)then |
|
|
c$$$ print*,'READCHARGEPARAM: *** Error in opening file ***' |
|
|
c$$$ return |
|
|
c$$$ endif |
|
|
c$$$ do ip=1,nplanes |
|
|
c$$$ read(10,* |
|
|
c$$$ $ ,IOSTAT=iostat |
|
|
c$$$ $ )pip, |
|
|
c$$$ $ kch(ip,ilad),cch(ip,ilad),sch(ip,ilad) |
|
|
c$$$c print*,ilad,ip,pip,kch(ip,ilad), |
|
|
c$$$c $ cch(ip,ilad),sch(ip,ilad) |
|
|
c$$$ enddo |
|
|
c$$$ close(10) |
|
|
c$$$ enddo |
|
|
c$$$ |
|
|
c$$$ return |
|
|
c$$$ end |
|
|
c$$$*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
|
|
c$$$ subroutine readetaparam |
|
|
c$$$* ----------------------------------------- |
|
|
c$$$* read eta2,3,4 calibration parameters |
|
|
c$$$* and fill variables: |
|
|
c$$$* |
|
|
c$$$* eta2(netabin,nladders_view,nviews) |
|
|
c$$$* eta3(2*netabin,nladders_view,nviews) |
|
|
c$$$* eta4(2*netabin,nladders_view,nviews) |
|
|
c$$$* |
|
|
c$$$ include 'commontracker.f' |
|
|
c$$$ include 'calib.f' |
|
|
c$$$ |
|
|
c$$$ character*40 fname_binning |
|
|
c$$$ character*40 fname_param |
|
|
c$$$c character*120 cmd1 |
|
|
c$$$c character*120 cmd2 |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$******retrieve ANGULAR BINNING info |
|
|
c$$$ fname_binning='binning.dat' |
|
|
c$$$ print *,'Opening file: ',fname_binning |
|
|
c$$$ open(10, |
|
|
c$$$ $ FILE='./bin-aux/'//fname_binning(1:LNBLNK(fname_binning)) |
|
|
c$$$ $ ,STATUS='UNKNOWN' |
|
|
c$$$ $ ,IOSTAT=iostat |
|
|
c$$$ $ ) |
|
|
c$$$ if(iostat.ne.0)then |
|
|
c$$$ print*,'READETAPARAM: *** Error in opening file ***' |
|
|
c$$$ return |
|
|
c$$$ endif |
|
|
c$$$ print*,'---- ANGULAR BINNING ----' |
|
|
c$$$ print*,'Bin - angL - angR' |
|
|
c$$$ 101 format(i2,' ',f6.2,' ',f6.2) |
|
|
c$$$ do ibin=1,nangmax |
|
|
c$$$ read(10,* |
|
|
c$$$ $ ,IOSTAT=iostat |
|
|
c$$$ $ )xnn,angL(ibin),angR(ibin) |
|
|
c$$$ if(iostat.ne.0)goto 1000 |
|
|
c$$$ write(*,101)int(xnn),angL(ibin),angR(ibin) |
|
|
c$$$ enddo |
|
|
c$$$ 1000 nangbin=int(xnn) |
|
|
c$$$ close(10) |
|
|
c$$$ print*,'-------------------------' |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ do ieta=2,4 !loop on eta 2,3,4 |
|
|
c$$$******retrieve correction parameters |
|
|
c$$$ 200 format(' Opening eta',i1,' files...') |
|
|
c$$$ write(*,200)ieta |
|
|
c$$$ |
|
|
c$$$ 201 format('eta',i1,'-bin',i1,'-l',i1,'.dat') |
|
|
c$$$ 202 format('eta',i1,'-bin',i2,'-l',i1,'.dat') |
|
|
c$$$ do iang=1,nangbin |
|
|
c$$$ do ilad=1,nladders_view |
|
|
c$$$ if(iang.lt.10)write(fname_param,201)ieta,iang,ilad |
|
|
c$$$ if(iang.ge.10)write(fname_param,202)ieta,iang,ilad |
|
|
c$$$c print *,'Opening file: ',fname_param |
|
|
c$$$ open(10, |
|
|
c$$$ $ FILE='./bin-aux/'//fname_param(1:LNBLNK(fname_param)) |
|
|
c$$$ $ ,STATUS='UNKNOWN' |
|
|
c$$$ $ ,IOSTAT=iostat |
|
|
c$$$ $ ) |
|
|
c$$$ if(iostat.ne.0)then |
|
|
c$$$ print*,'READETAPARAM: *** Error in opening file ***' |
|
|
c$$$ return |
|
|
c$$$ endif |
|
|
c$$$ do ival=1,netavalmax |
|
|
c$$$ if(ieta.eq.2)read(10,* |
|
|
c$$$ $ ,IOSTAT=iostat |
|
|
c$$$ $ ) |
|
|
c$$$ $ eta2(ival,iang), |
|
|
c$$$ $ (feta2(ival,iv,ilad,iang),iv=1,nviews) |
|
|
c$$$ if(ieta.eq.3)read(10,* |
|
|
c$$$ $ ,IOSTAT=iostat |
|
|
c$$$ $ ) |
|
|
c$$$ $ eta3(ival,iang), |
|
|
c$$$ $ (feta3(ival,iv,ilad,iang),iv=1,nviews) |
|
|
c$$$ if(ieta.eq.4)read(10,* |
|
|
c$$$ $ ,IOSTAT=iostat |
|
|
c$$$ $ ) |
|
|
c$$$ $ eta4(ival,iang), |
|
|
c$$$ $ (feta4(ival,iv,ilad,iang),iv=1,nviews) |
|
|
c$$$ if(iostat.ne.0)then |
|
|
c$$$ netaval=ival-1 |
|
|
c$$$c$$$ if(eta2(1,iang).ne.-eta2(netaval,iang)) |
|
|
c$$$c$$$ $ print*,'**** ERROR on parameters !!! ****' |
|
|
c$$$ goto 2000 |
|
|
c$$$ endif |
|
|
c$$$ enddo |
|
|
c$$$ 2000 close(10) |
|
|
c$$$* print*,'... done' |
|
|
c$$$ enddo |
|
|
c$$$ enddo |
|
|
c$$$ |
|
|
c$$$ enddo !end loop on eta 2,3,4 |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ return |
|
|
c$$$ end |
|
|
c$$$ |
|
|
|
|
456 |
|
|
457 |
************************************************************ |
************************************************************ |
458 |
************************************************************ |
************************************************************ |
527 |
c***************************************************** |
c***************************************************** |
528 |
|
|
529 |
include 'commontracker.f' |
include 'commontracker.f' |
|
include 'calib.f' |
|
530 |
include 'level1.f' |
include 'level1.f' |
531 |
|
include 'calib.f' |
532 |
|
c include 'level1.f' |
533 |
include 'common_align.f' |
include 'common_align.f' |
534 |
include 'common_mech.f' |
include 'common_mech.f' |
535 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
536 |
include 'common_resxy.f' |
c include 'common_resxy.f' |
537 |
|
|
538 |
c logical DEBUG |
c logical DEBUG |
539 |
c common/dbg/DEBUG |
c common/dbg/DEBUG |
568 |
xPAM_B = 0. |
xPAM_B = 0. |
569 |
yPAM_B = 0. |
yPAM_B = 0. |
570 |
zPAM_B = 0. |
zPAM_B = 0. |
571 |
|
c print*,'## xyz_PAM: ',icx,icy,sensor,PFAx,PFAy,angx,angy |
572 |
* ----------------- |
* ----------------- |
573 |
* CLUSTER X |
* CLUSTER X |
574 |
* ----------------- |
* ----------------- |
588 |
resxPAM = resxPAM*fbad_cog(2,icx) |
resxPAM = resxPAM*fbad_cog(2,icx) |
589 |
elseif(PFAx.eq.'ETA2')then |
elseif(PFAx.eq.'ETA2')then |
590 |
c cog2 = cog(2,icx) |
c cog2 = cog(2,icx) |
591 |
c etacorr = pfa_eta2(cog2,viewx,nldx,angx) |
c etacorr = pfaeta2(cog2,viewx,nldx,angx) |
592 |
c stripx = stripx + etacorr |
c stripx = stripx + etacorr |
593 |
stripx = stripx + pfa_eta2(icx,angx) !(3) |
stripx = stripx + pfaeta2(icx,angx) !(3) |
594 |
resxPAM = risx_eta2(angx) ! (4) |
resxPAM = risx_eta2(angx) ! (4) |
595 |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
if(DEBUG.and.fbad_cog(2,icx).ne.1) |
596 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx) |
597 |
resxPAM = resxPAM*fbad_cog(2,icx) |
resxPAM = resxPAM*fbad_cog(2,icx) |
598 |
elseif(PFAx.eq.'ETA3')then !(3) |
elseif(PFAx.eq.'ETA3')then !(3) |
599 |
stripx = stripx + pfa_eta3(icx,angx) !(3) |
stripx = stripx + pfaeta3(icx,angx) !(3) |
600 |
resxPAM = risx_eta3(angx) ! (4) |
resxPAM = risx_eta3(angx) ! (4) |
601 |
if(DEBUG.and.fbad_cog(3,icx).ne.1) !(3) |
if(DEBUG.and.fbad_cog(3,icx).ne.1) !(3) |
602 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx)!(3) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(3,icx)!(3) |
603 |
resxPAM = resxPAM*fbad_cog(3,icx) !(3) |
resxPAM = resxPAM*fbad_cog(3,icx) !(3) |
604 |
elseif(PFAx.eq.'ETA4')then !(3) |
elseif(PFAx.eq.'ETA4')then !(3) |
605 |
stripx = stripx + pfa_eta4(icx,angx) !(3) |
stripx = stripx + pfaeta4(icx,angx) !(3) |
606 |
resxPAM = risx_eta4(angx) ! (4) |
resxPAM = risx_eta4(angx) ! (4) |
607 |
if(DEBUG.and.fbad_cog(4,icx).ne.1) !(3) |
if(DEBUG.and.fbad_cog(4,icx).ne.1) !(3) |
608 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx)!(3) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(4,icx)!(3) |
609 |
resxPAM = resxPAM*fbad_cog(4,icx) !(3) |
resxPAM = resxPAM*fbad_cog(4,icx) !(3) |
610 |
elseif(PFAx.eq.'ETA')then !(3) |
elseif(PFAx.eq.'ETA')then !(3) |
611 |
stripx = stripx + pfa_eta(icx,angx) !(3) |
stripx = stripx + pfaeta(icx,angx) !(3) |
612 |
resxPAM = ris_eta(icx,angx) ! (4) |
resxPAM = ris_eta(icx,angx) ! (4) |
613 |
if(DEBUG.and.fbad_cog(2,icx).ne.1) !(3) |
if(DEBUG.and.fbad_cog(2,icx).ne.1) !(3) |
614 |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx)!(3) |
$ print*,'BAD icx >>> ',viewx,fbad_cog(2,icx)!(3) |
652 |
resyPAM = resyPAM*fbad_cog(2,icy) |
resyPAM = resyPAM*fbad_cog(2,icy) |
653 |
elseif(PFAy.eq.'ETA2')then |
elseif(PFAy.eq.'ETA2')then |
654 |
c cog2 = cog(2,icy) |
c cog2 = cog(2,icy) |
655 |
c etacorr = pfa_eta2(cog2,viewy,nldy,angy) |
c etacorr = pfaeta2(cog2,viewy,nldy,angy) |
656 |
c stripy = stripy + etacorr |
c stripy = stripy + etacorr |
657 |
stripy = stripy + pfa_eta2(icy,angy) !(3) |
stripy = stripy + pfaeta2(icy,angy) !(3) |
658 |
resyPAM = risy_eta2(angy) ! (4) |
resyPAM = risy_eta2(angy) ! (4) |
659 |
resyPAM = resyPAM*fbad_cog(2,icy) |
resyPAM = resyPAM*fbad_cog(2,icy) |
660 |
if(DEBUG.and.fbad_cog(2,icy).ne.1) |
if(DEBUG.and.fbad_cog(2,icy).ne.1) |
661 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
$ print*,'BAD icy >>> ',viewy,fbad_cog(2,icy) |
662 |
elseif(PFAy.eq.'ETA3')then !(3) |
elseif(PFAy.eq.'ETA3')then !(3) |
663 |
stripy = stripy + pfa_eta3(icy,angy) !(3) |
stripy = stripy + pfaeta3(icy,angy) !(3) |
664 |
resyPAM = resyPAM*fbad_cog(3,icy) !(3) |
resyPAM = resyPAM*fbad_cog(3,icy) !(3) |
665 |
if(DEBUG.and.fbad_cog(3,icy).ne.1) !(3) |
if(DEBUG.and.fbad_cog(3,icy).ne.1) !(3) |
666 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy)!(3) |
$ print*,'BAD icy >>> ',viewy,fbad_cog(3,icy)!(3) |
667 |
elseif(PFAy.eq.'ETA4')then !(3) |
elseif(PFAy.eq.'ETA4')then !(3) |
668 |
stripy = stripy + pfa_eta4(icy,angy) !(3) |
stripy = stripy + pfaeta4(icy,angy) !(3) |
669 |
resyPAM = resyPAM*fbad_cog(4,icy) !(3) |
resyPAM = resyPAM*fbad_cog(4,icy) !(3) |
670 |
if(DEBUG.and.fbad_cog(4,icy).ne.1) !(3) |
if(DEBUG.and.fbad_cog(4,icy).ne.1) !(3) |
671 |
$ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy)!(3) |
$ print*,'BAD icy >>> ',viewy,fbad_cog(4,icy)!(3) |
672 |
elseif(PFAy.eq.'ETA')then !(3) |
elseif(PFAy.eq.'ETA')then !(3) |
673 |
stripy = stripy + pfa_eta(icy,angy) !(3) |
stripy = stripy + pfaeta(icy,angy) !(3) |
674 |
resyPAM = ris_eta(icy,angy) ! (4) |
resyPAM = ris_eta(icy,angy) ! (4) |
675 |
c resyPAM = resyPAM*fbad_cog(2,icy) !(3)TEMPORANEO |
c resyPAM = resyPAM*fbad_cog(2,icy) !(3)TEMPORANEO |
676 |
resyPAM = resyPAM*fbad_eta(icy,angy) ! (4) |
resyPAM = resyPAM*fbad_eta(icy,angy) ! (4) |
687 |
|
|
688 |
endif |
endif |
689 |
|
|
690 |
|
c print*,'## stripx,stripy ',stripx,stripy |
691 |
|
|
692 |
c=========================================================== |
c=========================================================== |
693 |
C COUPLE |
C COUPLE |
694 |
C=========================================================== |
C=========================================================== |
890 |
|
|
891 |
endif |
endif |
892 |
|
|
893 |
|
|
894 |
|
c print*,'## xPAM,yPAM,zPAM ',xPAM,yPAM,zPAM |
895 |
|
c print*,'## xPAM_A,yPAM_A,zPAM_A ',xPAM_A,yPAM_A,zPAM_A |
896 |
|
c print*,'## xPAM_B,yPAM_B,zPAM_B ',xPAM_B,yPAM_B,zPAM_B |
897 |
|
|
898 |
100 continue |
100 continue |
899 |
end |
end |
900 |
|
|
1211 |
* it returns the plane number |
* it returns the plane number |
1212 |
* |
* |
1213 |
include 'commontracker.f' |
include 'commontracker.f' |
1214 |
|
include 'level1.f' |
1215 |
c include 'common_analysis.f' |
c include 'common_analysis.f' |
1216 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
1217 |
|
|
1249 |
* it returns the id number ON THE PLANE |
* it returns the id number ON THE PLANE |
1250 |
* |
* |
1251 |
include 'commontracker.f' |
include 'commontracker.f' |
1252 |
|
include 'level1.f' |
1253 |
c include 'common_analysis.f' |
c include 'common_analysis.f' |
1254 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
1255 |
|
|
1278 |
* positive if sensor =2 |
* positive if sensor =2 |
1279 |
* |
* |
1280 |
include 'commontracker.f' |
include 'commontracker.f' |
1281 |
|
include 'level1.f' |
1282 |
c include 'calib.f' |
c include 'calib.f' |
1283 |
c include 'level1.f' |
c include 'level1.f' |
1284 |
c include 'common_analysis.f' |
c include 'common_analysis.f' |
1308 |
************************************************************************* |
************************************************************************* |
1309 |
************************************************************************* |
************************************************************************* |
1310 |
************************************************************************* |
************************************************************************* |
|
c$$$ subroutine book_debug |
|
|
c$$$ |
|
|
c$$$ include 'commontracker.f' |
|
|
c$$$ include 'common_momanhough.f' |
|
|
c$$$ include 'common_level2debug.f' |
|
|
c$$$ |
|
|
c$$$ character*35 block1,block2,block3!,block4 |
|
|
c$$$ $ ,block5!,block6 |
|
|
c$$$ |
|
|
c$$$* * * * * * * * * * * * * * * * * * * * * * * * |
|
|
c$$$* HOUGH TRANSFORM PARAMETERS |
|
|
c$$$ |
|
|
c$$$ call HBOOK2(1003 |
|
|
c$$$ $ ,'y vs tg thyz' |
|
|
c$$$ $ ,300,-1.,1. !x |
|
|
c$$$ $ ,3000,-70.,70.,0.) !y |
|
|
c$$$ |
|
|
c$$$ call HBOOK1(1004 |
|
|
c$$$ $ ,'Dy' |
|
|
c$$$ $ ,100,0.,2.,0.) |
|
|
c$$$ |
|
|
c$$$ call HBOOK1(1005 |
|
|
c$$$ $ ,'D thyz' |
|
|
c$$$ $ ,100,0.,.05,0.) |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$* DEBUG ntuple: |
|
|
c$$$ call HBNT(ntp_level2+1,'LEVEL2',' ') |
|
|
c$$$ |
|
|
c$$$ call HBNAME(ntp_level2+1,'EVENT',good2_nt, |
|
|
c$$$ $ 'GOOD2:L,NEV2:I') |
|
|
c$$$ |
|
|
c$$$ 411 format('NDBLT:I::[0,',I5,']') |
|
|
c$$$ write(block1,411) ndblt_max_nt |
|
|
c$$$ call HBNAME(ntp_level2+1,'HOUGH YZ',ndblt_nt, |
|
|
c$$$ $ block1//' |
|
|
c$$$ $ ,ALFAYZ1(NDBLT):R |
|
|
c$$$ $ ,ALFAYZ2(NDBLT):R |
|
|
c$$$ $ ,DB_CLOUD(NDBLT):I |
|
|
c$$$ $ ') |
|
|
c$$$ |
|
|
c$$$ 412 format('NTRPT:I::[0,',I5,']') |
|
|
c$$$ write(block2,412) ntrpt_max_nt |
|
|
c$$$ call HBNAME(ntp_level2+1,'HOUGH XZ',NTRPT_nt, |
|
|
c$$$ $ block2//' |
|
|
c$$$ $ ,ALFAXZ1(NTRPT):R |
|
|
c$$$ $ ,ALFAXZ2(NTRPT):R |
|
|
c$$$ $ ,ALFAXZ3(NTRPT):R |
|
|
c$$$ $ ,TR_CLOUD(NTRPT):I |
|
|
c$$$ $ ') |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ 413 format('NCLOUDS_YZ:I::[0,',I4,']') |
|
|
c$$$c$$$ 414 format('DB_CLOUD(',I4,'):I') |
|
|
c$$$ write(block3,413) ncloyz_max |
|
|
c$$$c$$$ write(block4,414) ndblt_max_nt |
|
|
c$$$ call HBNAME(ntp_level2+1,'CLOUD YZ',NCLOUDS_YZ, |
|
|
c$$$ $ block3//' |
|
|
c$$$ $ ,ALFAYZ1_AV(NCLOUDS_YZ):R |
|
|
c$$$ $ ,ALFAYZ2_AV(NCLOUDS_YZ):R |
|
|
c$$$ $ ,PTCLOUD_YZ(NCLOUDS_YZ):I' |
|
|
c$$$c$$$ $ ,'//block4 |
|
|
c$$$ $ ) |
|
|
c$$$ |
|
|
c$$$ 415 format('NCLOUDS_XZ:I::[0,',I4,']') |
|
|
c$$$c$$$ 416 format('TR_CLOUD(',I5,'):I') |
|
|
c$$$ write(block5,415) ncloxz_max |
|
|
c$$$c$$$ write(block6,416) ntrpt_max_nt |
|
|
c$$$ call HBNAME(ntp_level2+1,'CLOUD XZ',NCLOUDS_XZ, |
|
|
c$$$ $ block5//' |
|
|
c$$$ $ ,ALFAXZ1_AV(NCLOUDS_XZ):R |
|
|
c$$$ $ ,ALFAXZ2_AV(NCLOUDS_XZ):R |
|
|
c$$$ $ ,ALFAXZ3_AV(NCLOUDS_XZ):R |
|
|
c$$$ $ ,PTCLOUD_XZ(NCLOUDS_XZ):I' |
|
|
c$$$c$$$ $ ,'//block6 |
|
|
c$$$ $ ) |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ return |
|
|
c$$$ end |
|
|
***...***...***...***...***...***...***...***...***...***...***...***...***...***...***...*** |
|
|
* |
|
|
* |
|
|
* |
|
|
* |
|
|
* |
|
|
* |
|
|
* |
|
|
* |
|
|
* |
|
|
***...***...***...***...***...***...***...***...***...***...***...***...***...***...***...*** |
|
|
c$$$ subroutine book_level2 |
|
|
c$$$c***************************************************** |
|
|
c$$$cccccc 11/9/2005 modified by david fedele |
|
|
c$$$cccccc 07/10/2005 modified by elena vannuccini --> (2) |
|
|
c$$$c***************************************************** |
|
|
c$$$ |
|
|
c$$$ include 'commontracker.f' |
|
|
c$$$ include 'common_momanhough.f' |
|
|
c$$$ include 'level2.f' |
|
|
c$$$ |
|
|
c$$$ character*35 block1,block2 |
|
|
c$$$ |
|
|
c$$$c print*,'__________ booking LEVEL2 n-tuple __________' |
|
|
c$$$ |
|
|
c$$$* LEVEL1 ntuple: |
|
|
c$$$ call HBNT(ntp_level2,'LEVEL2',' ') |
|
|
c$$$ |
|
|
c$$$c***************************************************** |
|
|
c$$$cccccc 11/9/2005 modified by david fedele |
|
|
c$$$c call HBNAME(ntp_level2,'EVENT',good2,'GOOD2:L,NEV2:I') |
|
|
c$$$cccccc 06/10/2005 modified by elena vannuccini |
|
|
c$$$c call HBNAME(ntp_level2,'GENERAL',good2,'GOOD2:L,NEV2:I |
|
|
c$$$c $ ,WHIC_CALIB:I,SWCODE:I') |
|
|
c$$$ call HBNAME(ntp_level2,'GENERAL',good2,'GOOD2:L,NEV2:I |
|
|
c$$$ $ ,WHICH_CALIB:I,SWCODE:I,CRC(12):L') |
|
|
c$$$c********************************************************* |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$c$$$# ifndef TEST2003 |
|
|
c$$$c$$$ |
|
|
c$$$c$$$ call HBNAME(ntp_level2,'CPU',pkt_type |
|
|
c$$$c$$$ $ ,'PKT_TYPE:I::[0,50] |
|
|
c$$$c$$$ $ ,PKT_NUM:I |
|
|
c$$$c$$$ $ ,OBT:I'// |
|
|
c$$$c$$$c******************************************************** |
|
|
c$$$c$$$cccccc 11/9/2005 modified by david fedele |
|
|
c$$$c$$$c $ ,WHICH_CALIB:I::[0,50]') |
|
|
c$$$c$$$ $ ',CPU_CRC:L') |
|
|
c$$$c$$$c******************************************************** |
|
|
c$$$c$$$ |
|
|
c$$$c$$$# endif |
|
|
c$$$ |
|
|
c$$$ 417 format('NTRK:I::[0,',I4,']') |
|
|
c$$$ 418 format(',IMAGE(NTRK):I::[0,',I4,']') |
|
|
c$$$ write(block1,417)NTRKMAX |
|
|
c$$$ write(block2,418)NTRKMAX |
|
|
c$$$ call HBNAME(ntp_level2,'TRACKS',NTRK, |
|
|
c$$$ $ block1// |
|
|
c$$$ $ block2//' |
|
|
c$$$ $ ,XM(6,NTRK):R |
|
|
c$$$ $ ,YM(6,NTRK):R |
|
|
c$$$ $ ,ZM(6,NTRK):R |
|
|
c$$$ $ ,RESX(6,NTRK):R |
|
|
c$$$ $ ,RESY(6,NTRK):R |
|
|
c$$$ $ ,AL(5,NTRK):R |
|
|
c$$$ $ ,COVAL(5,5,NTRK):R |
|
|
c$$$ $ ,CHI2(NTRK):R |
|
|
c$$$ $ ,XGOOD(6,NTRK):I::[0,1] |
|
|
c$$$ $ ,YGOOD(6,NTRK):I::[0,1] |
|
|
c$$$ $ ,XV(6,NTRK):R |
|
|
c$$$ $ ,YV(6,NTRK):R |
|
|
c$$$ $ ,ZV(6,NTRK):R |
|
|
c$$$ $ ,AXV(6,NTRK):R |
|
|
c$$$ $ ,AYV(6,NTRK):R'// |
|
|
c$$$c***************************************************** |
|
|
c$$$cccccc 11/9/2005 modified by david fedele |
|
|
c$$$c $ ,DEDXP(6,NTRK):R'// |
|
|
c$$$c $ ') |
|
|
c$$$ $ ',DEDX_X(6,NTRK):R |
|
|
c$$$ $ ,DEDX_Y(6,NTRK):R'// |
|
|
c$$$c**************************************************** |
|
|
c$$$cccccc 06/10/2005 modified by elena vannuccini |
|
|
c$$$c $ ,CRC(12):L |
|
|
c$$$ $ ',BdL(NTRK):R' |
|
|
c$$$ $ ) |
|
|
c$$$c**************************************************** |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ call HBNAME(ntp_level2,'SINGLETX',nclsx, |
|
|
c$$$c***************************************************** |
|
|
c$$$cccccc 11/9/2005 modified by david fedele |
|
|
c$$$c $ 'NCLSX(6):I,NCLSY(6):I') |
|
|
c$$$ $ 'NCLSX:I::[0,500],PLANEX(NCLSX):I |
|
|
c$$$ $ ,XS(2,NCLSX):R,SGNLXS(NCLSX):R') !(2) |
|
|
c$$$c $ ,XS(NCLSX):R,SGNLXS(NCLSX):R') !(2) |
|
|
c$$$ call HBNAME(ntp_level2,'SINGLETY',nclsy, |
|
|
c$$$ $ 'NCLSY:I::[0,500],PLANEY(NCLSY):I |
|
|
c$$$ $ ,YS(2,NCLSY):R,SGNLYS(NCLSY):R') !(2) |
|
|
c$$$c $ ,YS(NCLSY):R,SGNLYS(NCLSY):R') !(2) |
|
|
c$$$ return |
|
|
c$$$ end |
|
|
|
|
|
c$$$ subroutine fill_level2_clouds |
|
|
c$$$c***************************************************** |
|
|
c$$$c 29/11/2005 created by elena vannuccini |
|
|
c$$$c***************************************************** |
|
|
c$$$ |
|
|
c$$$* ------------------------------------------------------- |
|
|
c$$$* This routine fills the variables related to the hough |
|
|
c$$$* transform, for the debig n-tuple |
|
|
c$$$* ------------------------------------------------------- |
|
|
c$$$ |
|
|
c$$$ include 'commontracker.f' |
|
|
c$$$ include 'common_momanhough.f' |
|
|
c$$$ include 'common_level2debug.f' |
|
|
c$$$ include 'level2.f' |
|
|
c$$$ |
|
|
c$$$ good2_nt=.true.!good2 |
|
|
c$$$c nev2_nt=nev2 |
|
|
c$$$ |
|
|
c$$$ if(.false. |
|
|
c$$$ $ .or.ntrpt.gt.ntrpt_max_nt |
|
|
c$$$ $ .or.ndblt.gt.ndblt_max_nt |
|
|
c$$$ $ .or.NCLOUDS_XZ.gt.ncloxz_max |
|
|
c$$$ $ .or.NCLOUDS_yZ.gt.ncloyz_max |
|
|
c$$$ $ )then |
|
|
c$$$ good2_nt=.false. |
|
|
c$$$ ntrpt_nt=0 |
|
|
c$$$ ndblt_nt=0 |
|
|
c$$$ NCLOUDS_XZ_nt=0 |
|
|
c$$$ NCLOUDS_YZ_nt=0 |
|
|
c$$$ else |
|
|
c$$$ ndblt_nt=ndblt |
|
|
c$$$ ntrpt_nt=ntrpt |
|
|
c$$$ if(ndblt.ne.0)then |
|
|
c$$$ do id=1,ndblt |
|
|
c$$$ alfayz1_nt(id)=alfayz1(id) !Y0 |
|
|
c$$$ alfayz2_nt(id)=alfayz2(id) !tg theta-yz |
|
|
c$$$c db_cloud_nt(id)=db_cloud(id) |
|
|
c$$$ enddo |
|
|
c$$$ endif |
|
|
c$$$ if(ndblt.ne.0)then |
|
|
c$$$ do it=1,ntrpt |
|
|
c$$$ alfaxz1_nt(it)=alfaxz1(it) !X0 |
|
|
c$$$ alfaxz2_nt(it)=alfaxz2(it) !tg theta-xz |
|
|
c$$$ alfaxz3_nt(it)=alfaxz3(it) !1/r |
|
|
c$$$c tr_cloud_nt(it)=tr_cloud(it) |
|
|
c$$$ enddo |
|
|
c$$$ endif |
|
|
c$$$ nclouds_yz_nt=nclouds_yz |
|
|
c$$$ nclouds_xz_nt=nclouds_xz |
|
|
c$$$ if(nclouds_yz.ne.0)then |
|
|
c$$$ nnn=0 |
|
|
c$$$ do iyz=1,nclouds_yz |
|
|
c$$$ ptcloud_yz_nt(iyz)=ptcloud_yz(iyz) |
|
|
c$$$ alfayz1_av_nt(iyz)=alfayz1_av(iyz) |
|
|
c$$$ alfayz2_av_nt(iyz)=alfayz2_av(iyz) |
|
|
c$$$ nnn=nnn+ptcloud_yz(iyz) |
|
|
c$$$ enddo |
|
|
c$$$ do ipt=1,nnn |
|
|
c$$$ db_cloud_nt(ipt)=db_cloud(ipt) |
|
|
c$$$ enddo |
|
|
c$$$c print*,'#### ntupla #### ptcloud_yz ' |
|
|
c$$$c $ ,(ptcloud_yz(i),i=1,nclouds_yz) |
|
|
c$$$c print*,'#### ntupla #### db_cloud ' |
|
|
c$$$c $ ,(db_cloud(i),i=1,nnn) |
|
|
c$$$ endif |
|
|
c$$$ if(nclouds_xz.ne.0)then |
|
|
c$$$ nnn=0 |
|
|
c$$$ do ixz=1,nclouds_xz |
|
|
c$$$ ptcloud_xz_nt(ixz)=ptcloud_xz(ixz) |
|
|
c$$$ alfaxz1_av_nt(ixz)=alfaxz1_av(ixz) |
|
|
c$$$ alfaxz2_av_nt(ixz)=alfaxz2_av(ixz) |
|
|
c$$$ alfaxz3_av_nt(ixz)=alfaxz3_av(ixz) |
|
|
c$$$ nnn=nnn+ptcloud_xz(ixz) |
|
|
c$$$ enddo |
|
|
c$$$ do ipt=1,nnn |
|
|
c$$$ tr_cloud_nt(ipt)=tr_cloud(ipt) |
|
|
c$$$ enddo |
|
|
c$$$c print*,'#### ntupla #### ptcloud_xz ' |
|
|
c$$$c $ ,(ptcloud_xz(i),i=1,nclouds_xz) |
|
|
c$$$c print*,'#### ntupla #### tr_cloud ' |
|
|
c$$$c $ ,(tr_cloud(i),i=1,nnn) |
|
|
c$$$ endif |
|
|
c$$$ endif |
|
|
c$$$ end |
|
1311 |
|
|
1312 |
|
|
1313 |
*************************************************** |
*************************************************** |
1322 |
subroutine cl_to_couples(iflag) |
subroutine cl_to_couples(iflag) |
1323 |
|
|
1324 |
include 'commontracker.f' |
include 'commontracker.f' |
1325 |
|
include 'level1.f' |
1326 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
1327 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
1328 |
include 'calib.f' |
include 'calib.f' |
1329 |
include 'level1.f' |
c include 'level1.f' |
|
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
1330 |
|
|
1331 |
* output flag |
* output flag |
1332 |
* -------------- |
* -------------- |
1335 |
* -------------- |
* -------------- |
1336 |
integer iflag |
integer iflag |
1337 |
|
|
1338 |
integer badseed,badcl |
integer badseed,badclx,badcly |
1339 |
|
|
1340 |
* init variables |
* init variables |
1341 |
ncp_tot=0 |
ncp_tot=0 |
1351 |
ncls(ip)=0 |
ncls(ip)=0 |
1352 |
enddo |
enddo |
1353 |
do icl=1,nclstrmax_level2 |
do icl=1,nclstrmax_level2 |
1354 |
cl_single(icl)=1 |
cl_single(icl) = 1 |
1355 |
cl_good(icl)=0 |
cl_good(icl) = 0 |
1356 |
|
enddo |
1357 |
|
do iv=1,nviews |
1358 |
|
ncl_view(iv) = 0 |
1359 |
|
mask_view(iv) = 0 !all included |
1360 |
enddo |
enddo |
1361 |
|
|
1362 |
|
* count number of cluster per view |
1363 |
|
do icl=1,nclstr1 |
1364 |
|
ncl_view(VIEW(icl)) = ncl_view(VIEW(icl)) + 1 |
1365 |
|
enddo |
1366 |
|
* mask views with too many clusters |
1367 |
|
do iv=1,nviews |
1368 |
|
if( ncl_view(iv).gt. nclusterlimit)then |
1369 |
|
mask_view(iv) = 1 |
1370 |
|
if(DEBUG)print*,' * WARNING * cl_to_couple: n.clusters > ' |
1371 |
|
$ ,nclusterlimit,' on view ', iv,' --> masked!' |
1372 |
|
endif |
1373 |
|
enddo |
1374 |
|
|
1375 |
|
|
1376 |
* start association |
* start association |
1377 |
ncouples=0 |
ncouples=0 |
1378 |
do icx=1,nclstr1 !loop on cluster (X) |
do icx=1,nclstr1 !loop on cluster (X) |
1379 |
if(mod(VIEW(icx),2).eq.1)goto 10 |
if(mod(VIEW(icx),2).eq.1)goto 10 |
1380 |
|
|
1381 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
1382 |
|
* jump masked views (X VIEW) |
1383 |
|
* ---------------------------------------------------- |
1384 |
|
if( mask_view(VIEW(icx)).ne.0 ) goto 10 |
1385 |
|
* ---------------------------------------------------- |
1386 |
* cut on charge (X VIEW) |
* cut on charge (X VIEW) |
1387 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
1388 |
if(dedx(icx).lt.dedx_x_min)then |
if(dedx(icx).lt.dedx_x_min)then |
1399 |
else |
else |
1400 |
ilast=TOTCLLENGTH |
ilast=TOTCLLENGTH |
1401 |
endif |
endif |
1402 |
badcl=badseed |
badclx=badseed |
1403 |
do igood=-ngoodstr,ngoodstr |
do igood=-ngoodstr,ngoodstr |
1404 |
ibad=1 |
ibad=1 |
1405 |
if((INDMAX(icx)+igood).gt.ifirst.and. |
if((INDMAX(icx)+igood).gt.ifirst.and. |
1409 |
$ nvk(MAXS(icx)+igood), |
$ nvk(MAXS(icx)+igood), |
1410 |
$ nst(MAXS(icx)+igood)) |
$ nst(MAXS(icx)+igood)) |
1411 |
endif |
endif |
1412 |
badcl=badcl*ibad |
badclx=badclx*ibad |
1413 |
enddo |
enddo |
1414 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
1415 |
* >>> eliminato il taglio sulle BAD <<< |
* >>> eliminato il taglio sulle BAD <<< |
1428 |
if(mod(VIEW(icy),2).eq.0)goto 20 |
if(mod(VIEW(icy),2).eq.0)goto 20 |
1429 |
|
|
1430 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
1431 |
|
* jump masked views (Y VIEW) |
1432 |
|
* ---------------------------------------------------- |
1433 |
|
if( mask_view(VIEW(icy)).ne.0 ) goto 20 |
1434 |
|
|
1435 |
|
* ---------------------------------------------------- |
1436 |
* cut on charge (Y VIEW) |
* cut on charge (Y VIEW) |
1437 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
1438 |
if(dedx(icy).lt.dedx_y_min)then |
if(dedx(icy).lt.dedx_y_min)then |
1449 |
else |
else |
1450 |
ilast=TOTCLLENGTH |
ilast=TOTCLLENGTH |
1451 |
endif |
endif |
1452 |
badcl=badseed |
badcly=badseed |
1453 |
do igood=-ngoodstr,ngoodstr |
do igood=-ngoodstr,ngoodstr |
1454 |
ibad=1 |
ibad=1 |
1455 |
if((INDMAX(icy)+igood).gt.ifirst.and. |
if((INDMAX(icy)+igood).gt.ifirst.and. |
1458 |
$ ibad=BAD(VIEW(icy), |
$ ibad=BAD(VIEW(icy), |
1459 |
$ nvk(MAXS(icy)+igood), |
$ nvk(MAXS(icy)+igood), |
1460 |
$ nst(MAXS(icy)+igood)) |
$ nst(MAXS(icy)+igood)) |
1461 |
badcl=badcl*ibad |
badcly=badcly*ibad |
1462 |
enddo |
enddo |
1463 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
1464 |
* >>> eliminato il taglio sulle BAD <<< |
* >>> eliminato il taglio sulle BAD <<< |
1481 |
* charge correlation |
* charge correlation |
1482 |
* (modified to be applied only below saturation... obviously) |
* (modified to be applied only below saturation... obviously) |
1483 |
|
|
1484 |
* ------------------------------------------------------------- |
if( .not.(dedx(icy).gt.chsaty.and.dedx(icx).gt.chsatx) |
1485 |
* >>> eliminata (TEMPORANEAMENTE) la correlazione di carica <<< |
$ .and. |
1486 |
* ------------------------------------------------------------- |
$ .not.(dedx(icy).lt.chmipy.and.dedx(icx).lt.chmipx) |
1487 |
c$$$ if(dedx(icy).lt.chsaty.or.dedx(icx).lt.chsatx)then |
$ .and. |
1488 |
c$$$ ddd=(dedx(icy) |
$ (badclx.eq.1.and.badcly.eq.1) |
1489 |
c$$$ $ -kch(nplx,nldx)*dedx(icx)-cch(nplx,nldx)) |
$ .and. |
1490 |
c$$$ ddd=ddd/sqrt(kch(nplx,nldx)**2+1) |
$ .true.)then |
1491 |
c$$$ cut=chcut*sch(nplx,nldx) |
|
1492 |
c$$$ if(abs(ddd).gt.cut)goto 20 !charge not consistent |
ddd=(dedx(icy) |
1493 |
c$$$ endif |
$ -kch(nplx,nldx)*dedx(icx)-cch(nplx,nldx)) |
1494 |
|
ddd=ddd/sqrt(kch(nplx,nldx)**2+1) |
1495 |
* ------------------> COUPLE <------------------ |
|
1496 |
* check to do not overflow vector dimentions |
c cut = chcut * sch(nplx,nldx) |
1497 |
if(ncp_plane(nplx).gt.ncouplemax)then |
|
1498 |
if(DEBUG)print*, |
sss=(kch(nplx,nldx)*dedx(icy)+dedx(icx) |
1499 |
$ ' ** warning ** number of identified'// |
$ -kch(nplx,nldx)*cch(nplx,nldx)) |
1500 |
$ ' couples on plane ',nplx, |
sss=sss/sqrt(kch(nplx,nldx)**2+1) |
1501 |
$ ' exceeds vector dimention'// |
cut = chcut * (16 + sss/50.) |
|
$ ' ( ',ncouplemax,' )' |
|
|
c good2=.false. |
|
|
c goto 880 !fill ntp and go to next event |
|
|
iflag=1 |
|
|
return |
|
|
endif |
|
|
|
|
|
c$$$ if(ncp_plane(nplx).eq.ncouplemax)then |
|
|
c$$$ if(DEBUG)print*, |
|
|
c$$$ $ '** warning ** number of identified '// |
|
|
c$$$ $ 'couples on plane ',nplx, |
|
|
c$$$ $ 'exceeds vector dimention ' |
|
|
c$$$ $ ,'( ',ncouplemax,' )' |
|
|
c$$$c good2=.false. |
|
|
c$$$c goto 880 !fill ntp and go to next event |
|
|
c$$$ iflag=1 |
|
|
c$$$ return |
|
|
c$$$ endif |
|
|
|
|
|
ncp_plane(nplx) = ncp_plane(nplx) + 1 |
|
|
clx(nplx,ncp_plane(nplx))=icx |
|
|
cly(nply,ncp_plane(nplx))=icy |
|
|
cl_single(icx)=0 |
|
|
cl_single(icy)=0 |
|
|
endif |
|
|
* ---------------------------------------------- |
|
1502 |
|
|
1503 |
20 continue |
if(abs(ddd).gt.cut)then |
1504 |
enddo !end loop on clusters(Y) |
goto 20 !charge not consistent |
1505 |
|
endif |
1506 |
10 continue |
endif |
|
enddo !end loop on clusters(X) |
|
|
|
|
|
|
|
|
do icl=1,nclstr1 |
|
|
if(cl_single(icl).eq.1)then |
|
|
ip=npl(VIEW(icl)) |
|
|
ncls(ip)=ncls(ip)+1 |
|
|
cls(ip,ncls(ip))=icl |
|
|
endif |
|
|
enddo |
|
|
|
|
|
|
|
|
if(DEBUG)then |
|
|
print*,'clusters ',nclstr1 |
|
|
print*,'good ',(cl_good(i),i=1,nclstr1) |
|
|
print*,'singles ',(cl_single(i),i=1,nclstr1) |
|
|
print*,'couples per plane: ',(ncp_plane(ip),ip=1,nplanes) |
|
|
endif |
|
|
|
|
|
do ip=1,6 |
|
|
ncp_tot=ncp_tot+ncp_plane(ip) |
|
|
enddo |
|
|
c if(ncp_tot.gt.ncp_max)goto 100!next event (TEMPORANEO!!!) |
|
|
|
|
|
if(ncp_tot.gt.ncp_max)then |
|
|
if(DEBUG)print*, |
|
|
$ '** warning ** number of identified '// |
|
|
$ 'couples exceeds upper limit for Hough tr. ' |
|
|
$ ,'( ',ncp_max,' )' |
|
|
c good2=.false. |
|
|
c goto 880 !fill ntp and go to next event |
|
|
iflag=1 |
|
|
return |
|
|
endif |
|
|
|
|
|
return |
|
|
end |
|
|
|
|
|
*************************************************** |
|
|
* * |
|
|
* * |
|
|
* * |
|
|
* * |
|
|
* * |
|
|
* * |
|
|
************************************************** |
|
|
subroutine cl_to_couples_nocharge(iflag) |
|
|
|
|
|
include 'commontracker.f' |
|
|
include 'common_momanhough.f' |
|
|
include 'momanhough_init.f' |
|
|
include 'calib.f' |
|
|
include 'level1.f' |
|
|
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
|
|
|
|
* output flag |
|
|
* -------------- |
|
|
* 0 = good event |
|
|
* 1 = bad event |
|
|
* -------------- |
|
|
integer iflag |
|
|
|
|
|
integer badseed,badcl |
|
1507 |
|
|
|
* init variables |
|
|
ncp_tot=0 |
|
|
do ip=1,nplanes |
|
|
do ico=1,ncouplemax |
|
|
clx(ip,ico)=0 |
|
|
cly(ip,ico)=0 |
|
|
enddo |
|
|
ncp_plane(ip)=0 |
|
|
do icl=1,nclstrmax_level2 |
|
|
cls(ip,icl)=1 |
|
|
enddo |
|
|
ncls(ip)=0 |
|
|
enddo |
|
|
do icl=1,nclstrmax_level2 |
|
|
cl_single(icl)=1 |
|
|
cl_good(icl)=0 |
|
|
enddo |
|
|
|
|
|
* start association |
|
|
ncouples=0 |
|
|
do icx=1,nclstr1 !loop on cluster (X) |
|
|
if(mod(VIEW(icx),2).eq.1)goto 10 |
|
|
|
|
|
* ---------------------------------------------------- |
|
|
* cut on charge (X VIEW) |
|
|
if(dedx(icx).lt.dedx_x_min)then |
|
|
cl_single(icx)=0 |
|
|
goto 10 |
|
|
endif |
|
|
* cut BAD (X VIEW) |
|
|
badseed=BAD(VIEW(icx),nvk(MAXS(icx)),nst(MAXS(icx))) |
|
|
ifirst=INDSTART(icx) |
|
|
if(icx.ne.nclstr1) then |
|
|
ilast=INDSTART(icx+1)-1 |
|
|
else |
|
|
ilast=TOTCLLENGTH |
|
|
endif |
|
|
badcl=badseed |
|
|
do igood=-ngoodstr,ngoodstr |
|
|
ibad=1 |
|
|
if((INDMAX(icx)+igood).gt.ifirst.and. |
|
|
$ (INDMAX(icx)+igood).lt.ilast.and. |
|
|
$ .true.)then |
|
|
ibad=BAD(VIEW(icx), |
|
|
$ nvk(MAXS(icx)+igood), |
|
|
$ nst(MAXS(icx)+igood)) |
|
|
endif |
|
|
badcl=badcl*ibad |
|
|
enddo |
|
|
if(badcl.eq.0)then !<<<<<<<<<<<<<< BAD cut |
|
|
cl_single(icx)=0 !<<<<<<<<<<<<<< BAD cut |
|
|
goto 10 !<<<<<<<<<<<<<< BAD cut |
|
|
endif !<<<<<<<<<<<<<< BAD cut |
|
|
* ---------------------------------------------------- |
|
|
|
|
|
cl_good(icx)=1 |
|
|
nplx=npl(VIEW(icx)) |
|
|
nldx=nld(MAXS(icx),VIEW(icx)) |
|
|
|
|
|
do icy=1,nclstr1 !loop on cluster (Y) |
|
|
if(mod(VIEW(icy),2).eq.0)goto 20 |
|
|
|
|
|
* ---------------------------------------------------- |
|
|
* cut on charge (Y VIEW) |
|
|
if(dedx(icy).lt.dedx_y_min)then |
|
|
cl_single(icy)=0 |
|
|
goto 20 |
|
|
endif |
|
|
* cut BAD (Y VIEW) |
|
|
badseed=BAD(VIEW(icy),nvk(MAXS(icy)),nst(MAXS(icy))) |
|
|
ifirst=INDSTART(icy) |
|
|
if(icy.ne.nclstr1) then |
|
|
ilast=INDSTART(icy+1)-1 |
|
|
else |
|
|
ilast=TOTCLLENGTH |
|
|
endif |
|
|
badcl=badseed |
|
|
do igood=-ngoodstr,ngoodstr |
|
|
ibad=1 |
|
|
if((INDMAX(icy)+igood).gt.ifirst.and. |
|
|
$ (INDMAX(icy)+igood).lt.ilast.and. |
|
|
$ .true.) |
|
|
$ ibad=BAD(VIEW(icy), |
|
|
$ nvk(MAXS(icy)+igood), |
|
|
$ nst(MAXS(icy)+igood)) |
|
|
badcl=badcl*ibad |
|
|
enddo |
|
|
if(badcl.eq.0)then !<<<<<<<<<<<<<< BAD cut |
|
|
cl_single(icy)=0 !<<<<<<<<<<<<<< BAD cut |
|
|
goto 20 !<<<<<<<<<<<<<< BAD cut |
|
|
endif !<<<<<<<<<<<<<< BAD cut |
|
|
* ---------------------------------------------------- |
|
|
|
|
|
|
|
|
cl_good(icy)=1 |
|
|
nply=npl(VIEW(icy)) |
|
|
nldy=nld(MAXS(icy),VIEW(icy)) |
|
|
|
|
|
* ---------------------------------------------- |
|
|
* CONDITION TO FORM A COUPLE |
|
|
* ---------------------------------------------- |
|
|
* geometrical consistency (same plane and ladder) |
|
|
if(nply.eq.nplx.and.nldy.eq.nldx)then |
|
|
* charge correlation |
|
|
* =========================================================== |
|
|
* this version of the subroutine is used for the calibration |
|
|
* thus charge-correlation selection is obviously removed |
|
|
* =========================================================== |
|
|
c$$$ ddd=(dedx(icy) |
|
|
c$$$ $ -kch(nplx,nldx)*dedx(icx)-cch(nplx,nldx)) |
|
|
c$$$ ddd=ddd/sqrt(kch(nplx,nldx)**2+1) |
|
|
c$$$ cut=chcut*sch(nplx,nldx) |
|
|
c$$$ if(abs(ddd).gt.cut)goto 20 !charge not consistent |
|
|
* =========================================================== |
|
|
|
|
|
|
|
|
* ------------------> COUPLE <------------------ |
|
|
* check to do not overflow vector dimentions |
|
1508 |
if(ncp_plane(nplx).gt.ncouplemax)then |
if(ncp_plane(nplx).gt.ncouplemax)then |
1509 |
if(DEBUG)print*, |
if(verbose)print*, |
1510 |
$ ' ** warning ** number of identified'// |
$ '** warning ** number of identified '// |
1511 |
$ ' couples on plane ',nplx, |
$ 'couples on plane ',nplx, |
1512 |
$ ' exceeds vector dimention'// |
$ 'exceeds vector dimention ' |
1513 |
$ ' ( ',ncouplemax,' )' |
$ ,'( ',ncouplemax,' ) --> masked!' |
1514 |
c good2=.false. |
mask_view(nviewx(nplx)) = 2 |
1515 |
c goto 880 !fill ntp and go to next event |
mask_view(nviewy(nply)) = 2 |
1516 |
iflag=1 |
goto 10 |
|
return |
|
1517 |
endif |
endif |
1518 |
|
|
1519 |
c$$$ if(ncp_plane(nplx).eq.ncouplemax)then |
* ------------------> COUPLE <------------------ |
|
c$$$ if(DEBUG)print*, |
|
|
c$$$ $ '** warning ** number of identified '// |
|
|
c$$$ $ 'couples on plane ',nplx, |
|
|
c$$$ $ 'exceeds vector dimention ' |
|
|
c$$$ $ ,'( ',ncouplemax,' )' |
|
|
c$$$c good2=.false. |
|
|
c$$$c goto 880 !fill ntp and go to next event |
|
|
c$$$ iflag=1 |
|
|
c$$$ return |
|
|
c$$$ endif |
|
|
|
|
1520 |
ncp_plane(nplx) = ncp_plane(nplx) + 1 |
ncp_plane(nplx) = ncp_plane(nplx) + 1 |
1521 |
clx(nplx,ncp_plane(nplx))=icx |
clx(nplx,ncp_plane(nplx))=icx |
1522 |
cly(nply,ncp_plane(nplx))=icy |
cly(nply,ncp_plane(nplx))=icy |
1523 |
cl_single(icx)=0 |
cl_single(icx)=0 |
1524 |
cl_single(icy)=0 |
cl_single(icy)=0 |
|
endif |
|
1525 |
* ---------------------------------------------- |
* ---------------------------------------------- |
1526 |
|
|
1527 |
|
endif |
1528 |
|
|
1529 |
20 continue |
20 continue |
1530 |
enddo !end loop on clusters(Y) |
enddo !end loop on clusters(Y) |
1531 |
|
|
1550 |
endif |
endif |
1551 |
|
|
1552 |
do ip=1,6 |
do ip=1,6 |
1553 |
ncp_tot=ncp_tot+ncp_plane(ip) |
ncp_tot = ncp_tot + ncp_plane(ip) |
1554 |
enddo |
enddo |
|
c if(ncp_tot.gt.ncp_max)goto 100!next event (TEMPORANEO!!!) |
|
|
|
|
|
if(ncp_tot.gt.ncp_max)then |
|
|
if(DEBUG)print*, |
|
|
$ '** warning ** number of identified '// |
|
|
$ 'couples exceeds upper limit for Hough tr. ' |
|
|
$ ,'( ',ncp_max,' )' |
|
|
c good2=.false. |
|
|
c goto 880 !fill ntp and go to next event |
|
|
iflag=1 |
|
|
return |
|
|
endif |
|
1555 |
|
|
1556 |
return |
return |
1557 |
end |
end |
|
|
|
|
c$$$ subroutine cl_to_couples_2(iflag) |
|
|
c$$$ |
|
|
c$$$ include 'commontracker.f' |
|
|
c$$$ include 'common_momanhough.f' |
|
|
c$$$ include 'momanhough_init.f' |
|
|
c$$$ include 'calib.f' |
|
|
c$$$ include 'level1.f' |
|
|
c$$$ |
|
|
c$$$ logical DEBUG |
|
|
c$$$ common/dbg/DEBUG |
|
|
c$$$ |
|
|
c$$$* output flag |
|
|
c$$$* -------------- |
|
|
c$$$* 0 = good event |
|
|
c$$$* 1 = bad event |
|
|
c$$$* -------------- |
|
|
c$$$ integer iflag |
|
|
c$$$ |
|
|
c$$$ integer badseed,badcl |
|
|
c$$$ |
|
|
c$$$* init variables |
|
|
c$$$ ncp_tot=0 |
|
|
c$$$ do ip=1,nplanes |
|
|
c$$$ do ico=1,ncouplemax |
|
|
c$$$ clx(ip,ico)=0 |
|
|
c$$$ cly(ip,ico)=0 |
|
|
c$$$ enddo |
|
|
c$$$ ncp_plane(ip)=0 |
|
|
c$$$ do icl=1,nclstrmax_level2 |
|
|
c$$$ cls(ip,icl)=1 |
|
|
c$$$ enddo |
|
|
c$$$ ncls(ip)=0 |
|
|
c$$$ enddo |
|
|
c$$$ do icl=1,nclstrmax_level2 |
|
|
c$$$ cl_single(icl)=1 |
|
|
c$$$ cl_good(icl)=0 |
|
|
c$$$ enddo |
|
|
c$$$ |
|
|
c$$$* start association |
|
|
c$$$ ncouples=0 |
|
|
c$$$ do icx=1,nclstr1 !loop on cluster (X) |
|
|
c$$$ if(mod(VIEW(icx),2).eq.1)goto 10 |
|
|
c$$$ |
|
|
c$$$* ---------------------------------------------------- |
|
|
c$$$* cut on charge (X VIEW) |
|
|
c$$$ if(dedx(icx).lt.dedx_x_min)then |
|
|
c$$$ cl_single(icx)=0 |
|
|
c$$$ goto 10 |
|
|
c$$$ endif |
|
|
c$$$* cut BAD (X VIEW) |
|
|
c$$$ badseed=BAD(VIEW(icx),nvk(MAXS(icx)),nst(MAXS(icx))) |
|
|
c$$$ ifirst=INDSTART(icx) |
|
|
c$$$ if(icx.ne.nclstr1) then |
|
|
c$$$ ilast=INDSTART(icx+1)-1 |
|
|
c$$$ else |
|
|
c$$$ ilast=TOTCLLENGTH |
|
|
c$$$ endif |
|
|
c$$$ badcl=badseed |
|
|
c$$$ do igood=-ngoodstr,ngoodstr |
|
|
c$$$ ibad=1 |
|
|
c$$$ if((INDMAX(icx)+igood).gt.ifirst.and. |
|
|
c$$$ $ (INDMAX(icx)+igood).lt.ilast.and. |
|
|
c$$$ $ .true.)then |
|
|
c$$$ ibad=BAD(VIEW(icx), |
|
|
c$$$ $ nvk(MAXS(icx)+igood), |
|
|
c$$$ $ nst(MAXS(icx)+igood)) |
|
|
c$$$ endif |
|
|
c$$$ badcl=badcl*ibad |
|
|
c$$$ enddo |
|
|
c$$$* print*,'icx ',icx,badcl |
|
|
c$$$ if(badcl.eq.0)then |
|
|
c$$$ cl_single(icx)=0 |
|
|
c$$$ goto 10 |
|
|
c$$$ endif |
|
|
c$$$* ---------------------------------------------------- |
|
|
c$$$ |
|
|
c$$$ cl_good(icx)=1 |
|
|
c$$$ nplx=npl(VIEW(icx)) |
|
|
c$$$ nldx=nld(MAXS(icx),VIEW(icx)) |
|
|
c$$$ |
|
|
c$$$ do icy=1,nclstr1 !loop on cluster (Y) |
|
|
c$$$ if(mod(VIEW(icy),2).eq.0)goto 20 |
|
|
c$$$ |
|
|
c$$$* ---------------------------------------------------- |
|
|
c$$$* cut on charge (Y VIEW) |
|
|
c$$$ if(dedx(icy).lt.dedx_y_min)then |
|
|
c$$$ cl_single(icy)=0 |
|
|
c$$$ goto 20 |
|
|
c$$$ endif |
|
|
c$$$* cut BAD (Y VIEW) |
|
|
c$$$ badseed=BAD(VIEW(icy),nvk(MAXS(icy)),nst(MAXS(icy))) |
|
|
c$$$ ifirst=INDSTART(icy) |
|
|
c$$$ if(icy.ne.nclstr1) then |
|
|
c$$$ ilast=INDSTART(icy+1)-1 |
|
|
c$$$ else |
|
|
c$$$ ilast=TOTCLLENGTH |
|
|
c$$$ endif |
|
|
c$$$ badcl=badseed |
|
|
c$$$ do igood=-ngoodstr,ngoodstr |
|
|
c$$$ ibad=1 |
|
|
c$$$ if((INDMAX(icy)+igood).gt.ifirst.and. |
|
|
c$$$ $ (INDMAX(icy)+igood).lt.ilast.and. |
|
|
c$$$ $ .true.) |
|
|
c$$$ $ ibad=BAD(VIEW(icy), |
|
|
c$$$ $ nvk(MAXS(icy)+igood), |
|
|
c$$$ $ nst(MAXS(icy)+igood)) |
|
|
c$$$ badcl=badcl*ibad |
|
|
c$$$ enddo |
|
|
c$$$* print*,'icy ',icy,badcl |
|
|
c$$$ if(badcl.eq.0)then |
|
|
c$$$ cl_single(icy)=0 |
|
|
c$$$ goto 20 |
|
|
c$$$ endif |
|
|
c$$$* ---------------------------------------------------- |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ cl_good(icy)=1 |
|
|
c$$$ nply=npl(VIEW(icy)) |
|
|
c$$$ nldy=nld(MAXS(icy),VIEW(icy)) |
|
|
c$$$ |
|
|
c$$$* ---------------------------------------------- |
|
|
c$$$* CONDITION TO FORM A COUPLE |
|
|
c$$$* ---------------------------------------------- |
|
|
c$$$* geometrical consistency (same plane and ladder) |
|
|
c$$$ if(nply.eq.nplx.and.nldy.eq.nldx)then |
|
|
c$$$ |
|
|
c$$$c$$$* charge correlation |
|
|
c$$$c$$$ ddd=(dedx(icy) |
|
|
c$$$c$$$ $ -kch(nplx,nldx)*dedx(icx)-cch(nplx,nldx)) |
|
|
c$$$c$$$ ddd=ddd/sqrt(kch(nplx,nldx)**2+1) |
|
|
c$$$c$$$ cut=chcut*sch(nplx,nldx) |
|
|
c$$$c$$$ if(abs(ddd).gt.cut)goto 20 !charge not consistent |
|
|
c$$$ |
|
|
c$$$* ------------------> COUPLE <------------------ |
|
|
c$$$* check to do not overflow vector dimentions |
|
|
c$$$ if(ncp_plane(nplx).gt.ncouplemax)then |
|
|
c$$$ if(DEBUG)print*, |
|
|
c$$$ $ ' ** warning ** number of identified'// |
|
|
c$$$ $ ' couples on plane ',nplx, |
|
|
c$$$ $ ' exceeds vector dimention'// |
|
|
c$$$ $ ' ( ',ncouplemax,' )' |
|
|
c$$$c good2=.false. |
|
|
c$$$c goto 880 !fill ntp and go to next event |
|
|
c$$$ iflag=1 |
|
|
c$$$ return |
|
|
c$$$ endif |
|
|
c$$$ |
|
|
c$$$ if(ncp_plane(nplx).eq.ncouplemax)then |
|
|
c$$$ if(DEBUG)print*, |
|
|
c$$$ $ '** warning ** number of identified '// |
|
|
c$$$ $ 'couples on plane ',nplx, |
|
|
c$$$ $ 'exceeds vector dimention ' |
|
|
c$$$ $ ,'( ',ncouplemax,' )' |
|
|
c$$$c good2=.false. |
|
|
c$$$c goto 880 !fill ntp and go to next event |
|
|
c$$$ iflag=1 |
|
|
c$$$ return |
|
|
c$$$ endif |
|
|
c$$$ |
|
|
c$$$ ncp_plane(nplx) = ncp_plane(nplx) + 1 |
|
|
c$$$ clx(nplx,ncp_plane(nplx))=icx |
|
|
c$$$ cly(nply,ncp_plane(nplx))=icy |
|
|
c$$$ cl_single(icx)=0 |
|
|
c$$$ cl_single(icy)=0 |
|
|
c$$$c print*,'couple ',nplx,ncp_plane(nplx),' --- ',icx,icy |
|
|
c$$$ endif |
|
|
c$$$* ---------------------------------------------- |
|
|
c$$$ |
|
|
c$$$ 20 continue |
|
|
c$$$ enddo !end loop on clusters(Y) |
|
|
c$$$ |
|
|
c$$$ 10 continue |
|
|
c$$$ enddo !end loop on clusters(X) |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ do icl=1,nclstr1 |
|
|
c$$$ if(cl_single(icl).eq.1)then |
|
|
c$$$ ip=npl(VIEW(icl)) |
|
|
c$$$ ncls(ip)=ncls(ip)+1 |
|
|
c$$$ cls(ip,ncls(ip))=icl |
|
|
c$$$ endif |
|
|
c$$$ enddo |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ if(DEBUG)then |
|
|
c$$$ print*,'clusters ',nclstr1 |
|
|
c$$$ print*,'good ',(cl_good(i),i=1,nclstr1) |
|
|
c$$$ print*,'singles ',(cl_single(i),i=1,nclstr1) |
|
|
c$$$ print*,'couples per plane: ',(ncp_plane(ip),ip=1,nplanes) |
|
|
c$$$ endif |
|
|
c$$$ |
|
|
c$$$ do ip=1,6 |
|
|
c$$$ ncp_tot=ncp_tot+ncp_plane(ip) |
|
|
c$$$ enddo |
|
|
c$$$c if(ncp_tot.gt.ncp_max)goto 100!next event (TEMPORANEO!!!) |
|
|
c$$$ |
|
|
c$$$ if(ncp_tot.gt.ncp_max)then |
|
|
c$$$ if(DEBUG)print*, |
|
|
c$$$ $ '** warning ** number of identified '// |
|
|
c$$$ $ 'couples exceeds upper limit for Hough tr. ' |
|
|
c$$$ $ ,'( ',ncp_max,' )' |
|
|
c$$$c good2=.false. |
|
|
c$$$c goto 880 !fill ntp and go to next event |
|
|
c$$$ iflag=1 |
|
|
c$$$ return |
|
|
c$$$ endif |
|
|
c$$$ |
|
|
c$$$ return |
|
|
c$$$ end |
|
1558 |
|
|
1559 |
*************************************************** |
*************************************************** |
1560 |
* * |
* * |
1566 |
************************************************** |
************************************************** |
1567 |
|
|
1568 |
subroutine cp_to_doubtrip(iflag) |
subroutine cp_to_doubtrip(iflag) |
|
c***************************************************** |
|
|
c 02/02/2006 modified by Elena Vannuccini --> (1) |
|
|
c***************************************************** |
|
1569 |
|
|
1570 |
include 'commontracker.f' |
include 'commontracker.f' |
1571 |
|
include 'level1.f' |
1572 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
|
include 'momanhough_init.f' |
|
1573 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
1574 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
1575 |
include 'calib.f' |
include 'calib.f' |
|
include 'level1.f' |
|
1576 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
1577 |
|
|
1578 |
* output flag |
* output flag |
1579 |
* -------------- |
* -------------- |
1606 |
* ----------------------------- |
* ----------------------------- |
1607 |
|
|
1608 |
|
|
1609 |
|
* -------------------------------------------- |
1610 |
|
* put a limit to the maximum number of couples |
1611 |
|
* per plane, in order to apply hough transform |
1612 |
|
* (couples recovered during track refinement) |
1613 |
|
* -------------------------------------------- |
1614 |
|
do ip=1,nplanes |
1615 |
|
if(ncp_plane(ip).gt.ncouplelimit)then |
1616 |
|
mask_view(nviewx(ip)) = 8 |
1617 |
|
mask_view(nviewy(ip)) = 8 |
1618 |
|
endif |
1619 |
|
enddo |
1620 |
|
|
1621 |
|
|
1622 |
ndblt=0 !number of doublets |
ndblt=0 !number of doublets |
1623 |
ntrpt=0 !number of triplets |
ntrpt=0 !number of triplets |
1624 |
|
|
1625 |
do ip1=1,(nplanes-1) !loop on planes - COPPIA 1 |
do ip1=1,(nplanes-1) !loop on planes - COPPIA 1 |
1626 |
do is1=1,2 !loop on sensors - COPPIA 1 |
if( mask_view(nviewx(ip1)).ne.0 .or. |
1627 |
|
$ mask_view(nviewy(ip1)).ne.0 )goto 10 !skip plane |
1628 |
|
do is1=1,2 !loop on sensors - COPPIA 1 |
1629 |
do icp1=1,ncp_plane(ip1) !loop on COPPIA 1 |
do icp1=1,ncp_plane(ip1) !loop on COPPIA 1 |
1630 |
icx1=clx(ip1,icp1) |
icx1=clx(ip1,icp1) |
1631 |
icy1=cly(ip1,icp1) |
icy1=cly(ip1,icp1) |
1635 |
ym1=yPAM |
ym1=yPAM |
1636 |
zm1=zPAM |
zm1=zPAM |
1637 |
c print*,'***',is1,xm1,ym1,zm1 |
c print*,'***',is1,xm1,ym1,zm1 |
1638 |
|
|
1639 |
do ip2=(ip1+1),nplanes !loop on planes - COPPIA 2 |
do ip2=(ip1+1),nplanes !loop on planes - COPPIA 2 |
1640 |
|
if( mask_view(nviewx(ip2)).ne.0 .or. |
1641 |
|
$ mask_view(nviewy(ip2)).ne.0 )goto 20 !skip plane |
1642 |
do is2=1,2 !loop on sensors -ndblt COPPIA 2 |
do is2=1,2 !loop on sensors -ndblt COPPIA 2 |
1643 |
|
|
1644 |
do icp2=1,ncp_plane(ip2) !loop on COPPIA 2 |
do icp2=1,ncp_plane(ip2) !loop on COPPIA 2 |
1657 |
* (2 couples needed) |
* (2 couples needed) |
1658 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
1659 |
if(ndblt.eq.ndblt_max)then |
if(ndblt.eq.ndblt_max)then |
1660 |
if(DEBUG)print*, |
if(verbose)print*, |
1661 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
1662 |
$ 'doublets exceeds vector dimention ' |
$ 'doublets exceeds vector dimention ' |
1663 |
$ ,'( ',ndblt_max,' )' |
$ ,'( ',ndblt_max,' )' |
1664 |
c good2=.false. |
c good2=.false. |
1665 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
1666 |
|
do iv=1,12 |
1667 |
|
mask_view(iv) = 3 |
1668 |
|
enddo |
1669 |
iflag=1 |
iflag=1 |
1670 |
return |
return |
1671 |
endif |
endif |
1699 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
1700 |
|
|
1701 |
|
|
1702 |
if(ip2.eq.nplanes)goto 30 !no possible combination with 3 couples |
if(ip2.eq.nplanes)goto 31 !no possible combination with 3 couples |
1703 |
|
|
1704 |
do ip3=(ip2+1),nplanes !loop on planes - COPPIA 3 |
do ip3=(ip2+1),nplanes !loop on planes - COPPIA 3 |
1705 |
|
if( mask_view(nviewx(ip3)).ne.0 .or. |
1706 |
|
$ mask_view(nviewy(ip3)).ne.0 )goto 30 !skip plane |
1707 |
do is3=1,2 !loop on sensors - COPPIA 3 |
do is3=1,2 !loop on sensors - COPPIA 3 |
1708 |
|
|
1709 |
do icp3=1,ncp_plane(ip3) !loop on COPPIA 3 |
do icp3=1,ncp_plane(ip3) !loop on COPPIA 3 |
1733 |
* (3 couples needed) |
* (3 couples needed) |
1734 |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
1735 |
if(ntrpt.eq.ntrpt_max)then |
if(ntrpt.eq.ntrpt_max)then |
1736 |
if(DEBUG)print*, |
if(verbose)print*, |
1737 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
1738 |
$ 'triplets exceeds vector dimention ' |
$ 'triplets exceeds vector dimention ' |
1739 |
$ ,'( ',ntrpt_max,' )' |
$ ,'( ',ntrpt_max,' )' |
1740 |
c good2=.false. |
c good2=.false. |
1741 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
1742 |
|
do iv=1,nviews |
1743 |
|
mask_view(iv) = 4 |
1744 |
|
enddo |
1745 |
iflag=1 |
iflag=1 |
1746 |
return |
return |
1747 |
endif |
endif |
1780 |
endif |
endif |
1781 |
enddo !end loop on COPPIA 3 |
enddo !end loop on COPPIA 3 |
1782 |
enddo !end loop on sensors - COPPIA 3 |
enddo !end loop on sensors - COPPIA 3 |
1783 |
|
30 continue |
1784 |
enddo !end loop on planes - COPPIA 3 |
enddo !end loop on planes - COPPIA 3 |
1785 |
30 continue |
31 continue |
1786 |
|
|
1787 |
1 enddo !end loop on COPPIA 2 |
1 enddo !end loop on COPPIA 2 |
1788 |
enddo !end loop on sensors - COPPIA 2 |
enddo !end loop on sensors - COPPIA 2 |
1789 |
|
20 continue |
1790 |
enddo !end loop on planes - COPPIA 2 |
enddo !end loop on planes - COPPIA 2 |
1791 |
|
|
1792 |
enddo !end loop on COPPIA1 |
enddo !end loop on COPPIA1 |
1793 |
enddo !end loop on sensors - COPPIA 1 |
enddo !end loop on sensors - COPPIA 1 |
1794 |
|
10 continue |
1795 |
enddo !end loop on planes - COPPIA 1 |
enddo !end loop on planes - COPPIA 1 |
1796 |
|
|
1797 |
if(DEBUG)then |
if(DEBUG)then |
1819 |
subroutine doub_to_YZcloud(iflag) |
subroutine doub_to_YZcloud(iflag) |
1820 |
|
|
1821 |
include 'commontracker.f' |
include 'commontracker.f' |
1822 |
|
include 'level1.f' |
1823 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
1824 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
1825 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
1826 |
|
|
1827 |
* output flag |
* output flag |
1828 |
* -------------- |
* -------------- |
1854 |
distance=0 |
distance=0 |
1855 |
nclouds_yz=0 !number of clouds |
nclouds_yz=0 !number of clouds |
1856 |
npt_tot=0 |
npt_tot=0 |
1857 |
|
nloop=0 |
1858 |
|
90 continue |
1859 |
do idb1=1,ndblt !loop (1) on DOUBLETS |
do idb1=1,ndblt !loop (1) on DOUBLETS |
1860 |
if(db_used(idb1).eq.1)goto 2228 !db already included in a cloud |
if(db_used(idb1).eq.1)goto 2228 !db already included in a cloud |
1861 |
|
|
1959 |
nplused=nplused+ hit_plane(ip) |
nplused=nplused+ hit_plane(ip) |
1960 |
enddo |
enddo |
1961 |
c print*,'>>>> ',ncpused,npt,nplused |
c print*,'>>>> ',ncpused,npt,nplused |
1962 |
if(ncpused.lt.ncpyz_min)goto 2228 !next doublet |
c if(ncpused.lt.ncpyz_min)goto 2228 !next doublet |
1963 |
if(npt.lt.nptyz_min)goto 2228 !next doublet |
if(npt.lt.nptyz_min)goto 2228 !next doublet |
1964 |
if(nplused.lt.nplyz_min)goto 2228 !next doublet |
if(nplused.lt.nplyz_min)goto 2228 !next doublet |
1965 |
|
|
1967 |
* >>> NEW CLOUD <<< |
* >>> NEW CLOUD <<< |
1968 |
|
|
1969 |
if(nclouds_yz.ge.ncloyz_max)then |
if(nclouds_yz.ge.ncloyz_max)then |
1970 |
if(DEBUG)print*, |
if(verbose)print*, |
1971 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
1972 |
$ 'YZ clouds exceeds vector dimention ' |
$ 'YZ clouds exceeds vector dimention ' |
1973 |
$ ,'( ',ncloyz_max,' )' |
$ ,'( ',ncloyz_max,' )' |
1974 |
c good2=.false. |
c good2=.false. |
1975 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
1976 |
|
do iv=1,nviews |
1977 |
|
mask_view(iv) = 5 |
1978 |
|
enddo |
1979 |
iflag=1 |
iflag=1 |
1980 |
return |
return |
1981 |
endif |
endif |
2013 |
enddo !end loop (1) on DOUBLETS |
enddo !end loop (1) on DOUBLETS |
2014 |
|
|
2015 |
|
|
2016 |
|
if(nloop.lt.nstepy)then |
2017 |
|
cutdistyz = cutdistyz+cutystep |
2018 |
|
nloop = nloop+1 |
2019 |
|
goto 90 |
2020 |
|
endif |
2021 |
|
|
2022 |
if(DEBUG)then |
if(DEBUG)then |
2023 |
print*,'---------------------- ' |
print*,'---------------------- ' |
2024 |
print*,'Y-Z total clouds ',nclouds_yz |
print*,'Y-Z total clouds ',nclouds_yz |
2045 |
subroutine trip_to_XZcloud(iflag) |
subroutine trip_to_XZcloud(iflag) |
2046 |
|
|
2047 |
include 'commontracker.f' |
include 'commontracker.f' |
2048 |
|
include 'level1.f' |
2049 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
2050 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
2051 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
2052 |
|
|
2053 |
* output flag |
* output flag |
2054 |
* -------------- |
* -------------- |
2079 |
distance=0 |
distance=0 |
2080 |
nclouds_xz=0 !number of clouds |
nclouds_xz=0 !number of clouds |
2081 |
npt_tot=0 !total number of selected triplets |
npt_tot=0 !total number of selected triplets |
2082 |
|
nloop=0 |
2083 |
|
91 continue |
2084 |
do itr1=1,ntrpt !loop (1) on TRIPLETS |
do itr1=1,ntrpt !loop (1) on TRIPLETS |
2085 |
if(tr_used(itr1).eq.1)goto 22288 !already included in a cloud |
if(tr_used(itr1).eq.1)goto 22288 !already included in a cloud |
2086 |
c print*,'--------------' |
c print*,'--------------' |
2182 |
do ip=1,nplanes |
do ip=1,nplanes |
2183 |
nplused=nplused+ hit_plane(ip) |
nplused=nplused+ hit_plane(ip) |
2184 |
enddo |
enddo |
2185 |
if(ncpused.lt.ncpxz_min)goto 22288 !next triplet |
c if(ncpused.lt.ncpxz_min)goto 22288 !next triplet |
2186 |
if(npt.lt.nptxz_min)goto 22288 !next triplet |
if(npt.lt.nptxz_min)goto 22288 !next triplet |
2187 |
if(nplused.lt.nplxz_min)goto 22288 !next doublet |
if(nplused.lt.nplxz_min)goto 22288 !next doublet |
2188 |
|
|
2189 |
* ~~~~~~~~~~~~~~~~~ |
* ~~~~~~~~~~~~~~~~~ |
2190 |
* >>> NEW CLOUD <<< |
* >>> NEW CLOUD <<< |
2191 |
if(nclouds_xz.ge.ncloxz_max)then |
if(nclouds_xz.ge.ncloxz_max)then |
2192 |
if(DEBUG)print*, |
if(verbose)print*, |
2193 |
$ '** warning ** number of identified '// |
$ '** warning ** number of identified '// |
2194 |
$ 'XZ clouds exceeds vector dimention ' |
$ 'XZ clouds exceeds vector dimention ' |
2195 |
$ ,'( ',ncloxz_max,' )' |
$ ,'( ',ncloxz_max,' )' |
2196 |
c good2=.false. |
c good2=.false. |
2197 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
2198 |
|
do iv=1,nviews |
2199 |
|
mask_view(iv) = 6 |
2200 |
|
enddo |
2201 |
iflag=1 |
iflag=1 |
2202 |
return |
return |
2203 |
endif |
endif |
2233 |
* ~~~~~~~~~~~~~~~~~ |
* ~~~~~~~~~~~~~~~~~ |
2234 |
22288 continue |
22288 continue |
2235 |
enddo !end loop (1) on DOUBLETS |
enddo !end loop (1) on DOUBLETS |
2236 |
|
|
2237 |
|
if(nloop.lt.nstepx)then |
2238 |
|
cutdistxz=cutdistxz+cutxstep |
2239 |
|
nloop=nloop+1 |
2240 |
|
goto 91 |
2241 |
|
endif |
2242 |
|
|
2243 |
if(DEBUG)then |
if(DEBUG)then |
2244 |
print*,'---------------------- ' |
print*,'---------------------- ' |
2245 |
print*,'X-Z total clouds ',nclouds_xz |
print*,'X-Z total clouds ',nclouds_xz |
2266 |
c***************************************************** |
c***************************************************** |
2267 |
|
|
2268 |
include 'commontracker.f' |
include 'commontracker.f' |
2269 |
|
include 'level1.f' |
2270 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
2271 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
2272 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
2273 |
include 'common_mech.f' |
include 'common_mech.f' |
2274 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
2275 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
2276 |
|
|
2277 |
* output flag |
* output flag |
2278 |
* -------------- |
* -------------- |
2288 |
* ----------------------------------------------------------- |
* ----------------------------------------------------------- |
2289 |
* list of matching couples in the combination |
* list of matching couples in the combination |
2290 |
* between a XZ and YZ cloud |
* between a XZ and YZ cloud |
2291 |
integer cp_match(nplanes,ncouplemax) |
integer cp_match(nplanes,2*ncouplemax) |
2292 |
integer ncp_match(nplanes) |
integer ncp_match(nplanes) |
2293 |
* ----------------------------------------------------------- |
* ----------------------------------------------------------- |
2294 |
integer hit_plane(nplanes) |
integer hit_plane(nplanes) |
2295 |
* ----------------------------------------------------------- |
* ----------------------------------------------------------- |
2296 |
* variables for track fitting |
* variables for track fitting |
2297 |
double precision AL_INI(5) |
double precision AL_INI(5) |
2298 |
double precision tath |
c double precision tath |
2299 |
* ----------------------------------------------------------- |
* ----------------------------------------------------------- |
2300 |
c real fitz(nplanes) !z coordinates of the planes in cm |
c real fitz(nplanes) !z coordinates of the planes in cm |
2301 |
|
|
2361 |
nplused=nplused+ hit_plane(ip) |
nplused=nplused+ hit_plane(ip) |
2362 |
enddo |
enddo |
2363 |
|
|
2364 |
if(nplused.lt.nplxz_min)goto 888 !next doublet |
c if(nplused.lt.nplxz_min)goto 888 !next doublet |
2365 |
|
if(nplused.lt.nplyz_min)goto 888 !next doublet |
2366 |
if(ncp_ok.lt.ncpok)goto 888 !next cloud |
if(ncp_ok.lt.ncpok)goto 888 !next cloud |
2367 |
|
|
2368 |
if(DEBUG)then |
if(DEBUG)then |
2389 |
c$$$ print*,'~~~~~~~~~~~~~~~~~~~~~~~~~' |
c$$$ print*,'~~~~~~~~~~~~~~~~~~~~~~~~~' |
2390 |
|
|
2391 |
* -------> INITIAL GUESS <------- |
* -------> INITIAL GUESS <------- |
2392 |
AL_INI(1)=dreal(alfaxz1_av(ixz)) |
cccc SBAGLIATO |
2393 |
AL_INI(2)=dreal(alfayz1_av(iyz)) |
c$$$ AL_INI(1) = dreal(alfaxz1_av(ixz)) |
2394 |
AL_INI(4)=datan(dreal(alfayz2_av(iyz)) |
c$$$ AL_INI(2) = dreal(alfayz1_av(iyz)) |
2395 |
$ /dreal(alfaxz2_av(ixz))) |
c$$$ AL_INI(4) = PIGR + datan(dreal(alfayz2_av(iyz)) |
2396 |
tath=-dreal(alfaxz2_av(ixz))/dcos(AL_INI(4)) |
c$$$ $ /dreal(alfaxz2_av(ixz))) |
2397 |
AL_INI(3)=tath/sqrt(1+tath**2) |
c$$$ tath = -dreal(alfaxz2_av(ixz))/dcos(AL_INI(4)) |
2398 |
AL_INI(5)=(1.e2*alfaxz3_av(ixz))/(0.3*0.43) !0. |
c$$$ AL_INI(3) = tath/sqrt(1+tath**2) |
2399 |
|
c$$$ AL_INI(5) = (1.e2*alfaxz3_av(ixz))/(0.3*0.43) !0. |
2400 |
c print*,'*******',AL_INI(5) |
cccc GIUSTO (ma si sua guess()) |
2401 |
if(AL_INI(5).gt.defmax)goto 888 !next cloud |
c$$$ AL_INI(1) = dreal(alfaxz1_av(ixz)) |
2402 |
|
c$$$ AL_INI(2) = dreal(alfayz1_av(iyz)) |
2403 |
c print*,'alfaxz2, alfayz2 ' |
c$$$ tath = -dreal(alfaxz2_av(ixz))/dcos(AL_INI(4)) |
2404 |
c $ ,alfaxz2_av(ixz),alfayz2_av(iyz) |
c$$$ AL_INI(3) = tath/sqrt(1+tath**2) |
2405 |
|
c$$$ IF(alfaxz2_av(ixz).NE.0)THEN |
2406 |
* -------> INITIAL GUESS <------- |
c$$$ AL_INI(4) = PIGR + datan(dreal(alfayz2_av(iyz)) |
2407 |
c print*,'AL_INI ',(al_ini(i),i=1,5) |
c$$$ $ /dreal(alfaxz2_av(ixz))) |
2408 |
|
c$$$ ELSE |
2409 |
|
c$$$ AL_INI(4) = acos(-1.)/2 |
2410 |
|
c$$$ IF(alfayz2_av(iyz).LT.0)AL_INI(4) = AL_INI(4)+acos(-1.) |
2411 |
|
c$$$ ENDIF |
2412 |
|
c$$$ IF(alfaxz2_av(ixz).LT.0)AL_INI(4)= acos(-1.)+ AL_INI(4) |
2413 |
|
c$$$ AL_INI(4) = -acos(-1.) + AL_INI(4) !from incidence direction to tracking rs |
2414 |
|
c$$$ |
2415 |
|
c$$$ AL_INI(5) = (1.e2*alfaxz3_av(ixz))/(0.3*0.43) !0. |
2416 |
|
c$$$ |
2417 |
|
c$$$ if(AL_INI(5).gt.defmax)goto 888 !next cloud |
2418 |
|
|
2419 |
if(DEBUG)then |
if(DEBUG)then |
2420 |
print*,'1 >>> ',(cp_match(6,i),i=1,ncp_match(6)) |
print*,'1 >>> ',(cp_match(6,i),i=1,ncp_match(6)) |
2421 |
print*,'2 >>> ',(cp_match(5,i),i=1,ncp_match(5)) |
print*,'2 >>> ',(cp_match(5,i),i=1,ncp_match(5)) |
2483 |
* ********************************************************** |
* ********************************************************** |
2484 |
* ************************** FIT *** FIT *** FIT *** FIT *** |
* ************************** FIT *** FIT *** FIT *** FIT *** |
2485 |
* ********************************************************** |
* ********************************************************** |
2486 |
|
cccc scommentare se si usa al_ini della nuvola |
2487 |
|
c$$$ do i=1,5 |
2488 |
|
c$$$ AL(i)=AL_INI(i) |
2489 |
|
c$$$ enddo |
2490 |
|
call guess() |
2491 |
do i=1,5 |
do i=1,5 |
2492 |
AL(i)=AL_INI(i) |
AL_INI(i)=AL(i) |
2493 |
enddo |
enddo |
2494 |
ifail=0 !error flag in chi^2 computation |
ifail=0 !error flag in chi^2 computation |
2495 |
jstep=0 !number of minimization steps |
jstep=0 !number of minimization steps |
2496 |
call mini_2(jstep,ifail) |
iprint=0 |
2497 |
|
c if(DEBUG)iprint=1 |
2498 |
|
if(DEBUG)iprint=2 |
2499 |
|
call mini2(jstep,ifail,iprint) |
2500 |
if(ifail.ne.0) then |
if(ifail.ne.0) then |
2501 |
if(DEBUG)then |
if(DEBUG)then |
2502 |
print *, |
print *, |
2503 |
$ '*** MINIMIZATION FAILURE *** ' |
$ '*** MINIMIZATION FAILURE *** ' |
2504 |
$ //'(mini_2 in clouds_to_ctrack)' |
$ //'(clouds_to_ctrack)' |
2505 |
|
print*,'initial guess: ' |
2506 |
|
|
2507 |
|
print*,'AL_INI(1) = ',AL_INI(1) |
2508 |
|
print*,'AL_INI(2) = ',AL_INI(2) |
2509 |
|
print*,'AL_INI(3) = ',AL_INI(3) |
2510 |
|
print*,'AL_INI(4) = ',AL_INI(4) |
2511 |
|
print*,'AL_INI(5) = ',AL_INI(5) |
2512 |
endif |
endif |
2513 |
chi2=-chi2 |
c chi2=-chi2 |
2514 |
endif |
endif |
2515 |
* ********************************************************** |
* ********************************************************** |
2516 |
* ************************** FIT *** FIT *** FIT *** FIT *** |
* ************************** FIT *** FIT *** FIT *** FIT *** |
2523 |
* -------------------------- |
* -------------------------- |
2524 |
if(ntracks.eq.NTRACKSMAX)then |
if(ntracks.eq.NTRACKSMAX)then |
2525 |
|
|
2526 |
if(DEBUG)print*, |
if(verbose)print*, |
2527 |
$ '** warning ** number of candidate tracks '// |
$ '** warning ** number of candidate tracks '// |
2528 |
$ ' exceeds vector dimension ' |
$ ' exceeds vector dimension ' |
2529 |
$ ,'( ',NTRACKSMAX,' )' |
$ ,'( ',NTRACKSMAX,' )' |
2530 |
c good2=.false. |
c good2=.false. |
2531 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
2532 |
|
do iv=1,nviews |
2533 |
|
mask_view(iv) = 7 |
2534 |
|
enddo |
2535 |
iflag=1 |
iflag=1 |
2536 |
return |
return |
2537 |
endif |
endif |
2630 |
c****************************************************** |
c****************************************************** |
2631 |
|
|
2632 |
include 'commontracker.f' |
include 'commontracker.f' |
2633 |
|
include 'level1.f' |
2634 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
2635 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
2636 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
2637 |
include 'common_mech.f' |
include 'common_mech.f' |
2638 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
2639 |
include 'level1.f' |
c include 'level1.f' |
2640 |
include 'calib.f' |
include 'calib.f' |
2641 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
2642 |
|
|
2643 |
* flag to chose PFA |
* flag to chose PFA |
2644 |
character*10 PFA |
character*10 PFA |
2652 |
call track_init |
call track_init |
2653 |
do ip=1,nplanes !loop on planes |
do ip=1,nplanes !loop on planes |
2654 |
|
|
2655 |
|
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
2656 |
* ------------------------------------------------- |
* ------------------------------------------------- |
2657 |
* If the plane has been already included, it just |
* If the plane has been already included, it just |
2658 |
* computes again the coordinates of the x-y couple |
* computes again the coordinates of the x-y couple |
2659 |
* using improved PFAs |
* using improved PFAs |
2660 |
* ------------------------------------------------- |
* ------------------------------------------------- |
2661 |
|
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
2662 |
if(XGOOD_STORE(nplanes-ip+1,ibest).eq.1..and. |
if(XGOOD_STORE(nplanes-ip+1,ibest).eq.1..and. |
2663 |
$ YGOOD_STORE(nplanes-ip+1,ibest).eq.1. )then |
$ YGOOD_STORE(nplanes-ip+1,ibest).eq.1. )then |
2664 |
|
|
2693 |
dedxtrk_x(nplanes-ip+1)=dedx(icx)/mip(VIEW(icx),LADDER(icx)) !(1)(2) |
dedxtrk_x(nplanes-ip+1)=dedx(icx)/mip(VIEW(icx),LADDER(icx)) !(1)(2) |
2694 |
dedxtrk_y(nplanes-ip+1)=dedx(icy)/mip(VIEW(icy),LADDER(icy)) !(1)(2) |
dedxtrk_y(nplanes-ip+1)=dedx(icy)/mip(VIEW(icy),LADDER(icy)) !(1)(2) |
2695 |
|
|
2696 |
|
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
2697 |
* ------------------------------------------------- |
* ------------------------------------------------- |
2698 |
* If the plane has NOT been already included, |
* If the plane has NOT been already included, |
2699 |
* it tries to include a COUPLE or a single cluster |
* it tries to include a COUPLE or a single cluster |
2700 |
* ------------------------------------------------- |
* ------------------------------------------------- |
2701 |
|
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
2702 |
else |
else |
2703 |
|
|
2704 |
xgood(nplanes-ip+1)=0 |
xgood(nplanes-ip+1)=0 |
2753 |
$ AYV_STORE(nplanes-ip+1,ibest)) |
$ AYV_STORE(nplanes-ip+1,ibest)) |
2754 |
|
|
2755 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
2756 |
|
distance = distance / RCHI2_STORE(ibest)!<<< MS |
2757 |
id=id_cp(ip,icp,ist) |
id=id_cp(ip,icp,ist) |
2758 |
if(DEBUG)print*,'( couple ',id |
if(DEBUG)print*,'( couple ',id |
2759 |
$ ,' ) normalized distance ',distance |
$ ,' ) normalized distance ',distance |
2824 |
$ PFA,PFA, |
$ PFA,PFA, |
2825 |
$ AXV_STORE(nplanes-ip+1,ibest),0.) |
$ AXV_STORE(nplanes-ip+1,ibest),0.) |
2826 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
2827 |
c if(DEBUG)print*,'normalized distance ',distance |
distance = distance / RCHI2_STORE(ibest)!<<< MS |
2828 |
if(DEBUG)print*,'( cl-X ',icx |
if(DEBUG)print*,'( cl-X ',icx |
2829 |
$ ,' in cp ',id,' ) normalized distance ',distance |
$ ,' in cp ',id,' ) normalized distance ',distance |
2830 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
2852 |
$ PFA,PFA, |
$ PFA,PFA, |
2853 |
$ 0.,AYV_STORE(nplanes-ip+1,ibest)) |
$ 0.,AYV_STORE(nplanes-ip+1,ibest)) |
2854 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
2855 |
|
distance = distance / RCHI2_STORE(ibest)!<<< MS |
2856 |
if(DEBUG)print*,'( cl-Y ',icy |
if(DEBUG)print*,'( cl-Y ',icy |
2857 |
$ ,' in cp ',id,' ) normalized distance ',distance |
$ ,' in cp ',id,' ) normalized distance ',distance |
2858 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
2872 |
endif |
endif |
2873 |
11882 continue |
11882 continue |
2874 |
enddo !end loop on cluster inside couples |
enddo !end loop on cluster inside couples |
2875 |
*----- single clusters ----------------------------------------------- |
*----- single clusters ----------------------------------------------- |
2876 |
|
c print*,'## ncls(',ip,') ',ncls(ip) |
2877 |
do ic=1,ncls(ip) !loop on single clusters |
do ic=1,ncls(ip) !loop on single clusters |
2878 |
icl=cls(ip,ic) |
icl=cls(ip,ic) |
2879 |
|
c print*,'## ic ',ic,' ist ',ist |
2880 |
c if(cl_used(icl).eq.1.or. !if the cluster is already used |
c if(cl_used(icl).eq.1.or. !if the cluster is already used |
2881 |
if(cl_used(icl).ne.0.or. !if the cluster is already used !(3) |
if(cl_used(icl).ne.0.or. !if the cluster is already used !(3) |
2882 |
$ LADDER(icl).ne.nldt.or. !or the ladder number does not match |
$ LADDER(icl).ne.nldt.or. !or the ladder number does not match |
2894 |
endif |
endif |
2895 |
|
|
2896 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
2897 |
|
distance = distance / RCHI2_STORE(ibest)!<<< MS |
2898 |
if(DEBUG)print*,'( cl-s ',icl |
if(DEBUG)print*,'( cl-s ',icl |
2899 |
$ ,' ) normalized distance ',distance |
$ ,' ) normalized distance ',distance,'<',distmin,' ?' |
2900 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
2901 |
|
if(DEBUG)print*,'YES' |
2902 |
xmm_A = xPAM_A |
xmm_A = xPAM_A |
2903 |
ymm_A = yPAM_A |
ymm_A = yPAM_A |
2904 |
zmm_A = zPAM_A |
zmm_A = zPAM_A |
2920 |
endif |
endif |
2921 |
18882 continue |
18882 continue |
2922 |
enddo !end loop on single clusters |
enddo !end loop on single clusters |
2923 |
|
c print*,'## distmin ', distmin,' clinc ',clinc |
2924 |
if(distmin.le.clinc)then |
if(distmin.le.clinc)then |
2925 |
|
|
2926 |
CLS_STORE(nplanes-ip+1,ibest)=iclm !<<<< |
CLS_STORE(nplanes-ip+1,ibest)=iclm !<<<< |
2927 |
* ---------------------------- |
* ---------------------------- |
2928 |
|
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
2929 |
if(mod(VIEW(iclm),2).eq.0)then |
if(mod(VIEW(iclm),2).eq.0)then |
2930 |
XGOOD(nplanes-ip+1)=1. |
XGOOD(nplanes-ip+1)=1. |
2931 |
resx(nplanes-ip+1)=rxmm |
resx(nplanes-ip+1)=rxmm |
2932 |
if(DEBUG)print*,'%%%% included X-cl ',iclm |
if(DEBUG)print*,'%%%% included X-cl ',iclm |
2933 |
$ ,' ( norm.dist.= ',distmin,', cut ',clinc,' )' |
c if(.true.)print*,'%%%% included X-cl ',iclm |
2934 |
|
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
2935 |
|
$ ,', norm.dist.= ',distmin |
2936 |
|
$ ,', cut ',clinc,' )' |
2937 |
else |
else |
2938 |
YGOOD(nplanes-ip+1)=1. |
YGOOD(nplanes-ip+1)=1. |
2939 |
resy(nplanes-ip+1)=rymm |
resy(nplanes-ip+1)=rymm |
2940 |
if(DEBUG)print*,'%%%% included Y-cl ',iclm |
if(DEBUG)print*,'%%%% included Y-cl ',iclm |
2941 |
$ ,' ( norm.dist.= ',distmin,', cut ',clinc,' )' |
c if(.true.)print*,'%%%% included Y-cl ',iclm |
2942 |
|
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
2943 |
|
$ ,', norm.dist.= ', distmin |
2944 |
|
$ ,', cut ',clinc,' )' |
2945 |
endif |
endif |
2946 |
|
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
2947 |
* ---------------------------- |
* ---------------------------- |
2948 |
xm_A(nplanes-ip+1) = xmm_A |
xm_A(nplanes-ip+1) = xmm_A |
2949 |
ym_A(nplanes-ip+1) = ymm_A |
ym_A(nplanes-ip+1) = ymm_A |
2977 |
subroutine clean_XYclouds(ibest,iflag) |
subroutine clean_XYclouds(ibest,iflag) |
2978 |
|
|
2979 |
include 'commontracker.f' |
include 'commontracker.f' |
2980 |
|
include 'level1.f' |
2981 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
2982 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
2983 |
include 'level2.f' !(1) |
include 'level2.f' !(1) |
2984 |
c include 'calib.f' |
c include 'calib.f' |
2985 |
c include 'level1.f' |
c include 'level1.f' |
2986 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
2987 |
|
|
2988 |
|
|
2989 |
do ip=1,nplanes !loop on planes |
do ip=1,nplanes !loop on planes |
3056 |
|
|
3057 |
|
|
3058 |
|
|
|
c$$$*** * * * *** * * * *** * * * *** * * * *** * * * *** * * * *** |
|
|
c$$$ real function fbad_cog(ncog,ic) |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ include 'commontracker.f' |
|
|
c$$$ include 'level1.f' |
|
|
c$$$ include 'calib.f' |
|
|
c$$$ |
|
|
c$$$* --> signal of the central strip |
|
|
c$$$ sc = CLSIGNAL(INDMAX(ic)) !center |
|
|
c$$$ |
|
|
c$$$* signal of adjacent strips |
|
|
c$$$* --> left |
|
|
c$$$ sl1 = 0 !left 1 |
|
|
c$$$ if( |
|
|
c$$$ $ (INDMAX(ic)-1).ge.INDSTART(ic) |
|
|
c$$$ $ ) |
|
|
c$$$ $ sl1 = max(0.,CLSIGNAL(INDMAX(ic)-1)) |
|
|
c$$$ |
|
|
c$$$ sl2 = 0 !left 2 |
|
|
c$$$ if( |
|
|
c$$$ $ (INDMAX(ic)-2).ge.INDSTART(ic) |
|
|
c$$$ $ ) |
|
|
c$$$ $ sl2 = max(0.,CLSIGNAL(INDMAX(ic)-2)) |
|
|
c$$$ |
|
|
c$$$* --> right |
|
|
c$$$ sr1 = 0 !right 1 |
|
|
c$$$ if( |
|
|
c$$$ $ (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1)) |
|
|
c$$$ $ .or. |
|
|
c$$$ $ (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH) |
|
|
c$$$ $ ) |
|
|
c$$$ $ sr1 = max(0.,CLSIGNAL(INDMAX(ic)+1)) |
|
|
c$$$ |
|
|
c$$$ sr2 = 0 !right 2 |
|
|
c$$$ if( |
|
|
c$$$ $ (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1)) |
|
|
c$$$ $ .or. |
|
|
c$$$ $ (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH) |
|
|
c$$$ $ ) |
|
|
c$$$ $ sr2 = max(0.,CLSIGNAL(INDMAX(ic)+2)) |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ if(mod(int(VIEW(ic)),2).eq.1)then !Y-view |
|
|
c$$$ f = 4. |
|
|
c$$$ si = 8.4 |
|
|
c$$$ else !X-view |
|
|
c$$$ f = 6. |
|
|
c$$$ si = 3.9 |
|
|
c$$$ endif |
|
|
c$$$ |
|
|
c$$$ fbad_cog = 1. |
|
|
c$$$ f0 = 1 |
|
|
c$$$ f1 = 1 |
|
|
c$$$ f2 = 1 |
|
|
c$$$ f3 = 1 |
|
|
c$$$ if(sl1.gt.sr1.and.sl1.gt.0.)then |
|
|
c$$$ |
|
|
c$$$ if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)) ).eq.0)f0=f |
|
|
c$$$ if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)-1)).eq.0)f1=f |
|
|
c$$$c if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)+1)).eq.0)f3=f |
|
|
c$$$ |
|
|
c$$$ if(ncog.eq.2.and.sl1.ne.0)then |
|
|
c$$$ fbad_cog = (f1**2*sc**2/sl1**2+f0**2)/(sc**2/sl1**2+1.) |
|
|
c$$$ elseif(ncog.eq.3.and.sl1.ne.0.and.sr1.ne.0)then |
|
|
c$$$ fbad_cog = 1. |
|
|
c$$$ elseif(ncog.eq.4.and.sl1.ne.0.and.sr1.ne.0.and.sl2.ne.0)then |
|
|
c$$$ fbad_cog = 1. |
|
|
c$$$ else |
|
|
c$$$ fbad_cog = 1. |
|
|
c$$$ endif |
|
|
c$$$ |
|
|
c$$$ elseif(sl1.le.sr1.and.sr1.gt.0.)then |
|
|
c$$$ |
|
|
c$$$ |
|
|
c$$$ if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)) ).eq.0)f0=f |
|
|
c$$$ if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)+1)).eq.0)f1=f |
|
|
c$$$c if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)-1)).eq.0)f3=f |
|
|
c$$$ |
|
|
c$$$ if(ncog.eq.2.and.sr1.ne.0)then |
|
|
c$$$ fbad_cog = (f1**2*sc**2/sr1**2+f0**2)/(sc**2/sr1**2+1.) |
|
|
c$$$ elseif(ncog.eq.3.and.sr1.ne.0.and.sl1.ne.0)then |
|
|
c$$$ fbad_cog = 1. |
|
|
c$$$ elseif(ncog.eq.4.and.sr1.ne.0.and.sl1.ne.0.and.sr2.ne.0)then |
|
|
c$$$ fbad_cog = 1. |
|
|
c$$$ else |
|
|
c$$$ fbad_cog = 1. |
|
|
c$$$ endif |
|
|
c$$$ |
|
|
c$$$ endif |
|
|
c$$$ |
|
|
c$$$ fbad_cog = sqrt(fbad_cog) |
|
|
c$$$ |
|
|
c$$$ return |
|
|
c$$$ end |
|
|
c$$$ |
|
|
|
|
3059 |
|
|
3060 |
|
|
3061 |
* **************************************************** |
* **************************************************** |
3062 |
|
|
3063 |
subroutine init_level2 |
subroutine init_level2 |
3064 |
|
|
|
c***************************************************** |
|
|
c 07/10/2005 modified by elena vannuccini --> (1) |
|
|
c***************************************************** |
|
|
|
|
3065 |
include 'commontracker.f' |
include 'commontracker.f' |
3066 |
|
include 'level1.f' |
3067 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
3068 |
include 'level2.f' |
include 'level2.f' |
3069 |
include 'level1.f' |
c include 'level1.f' |
3070 |
|
|
3071 |
do i=1,nviews |
do i=1,nviews |
3072 |
good2(i)=good1(i) |
good2(i)=good1(i) |
3073 |
enddo |
enddo |
3074 |
|
|
|
c good2 = 0!.false. |
|
|
c$$$ nev2 = nev1 |
|
|
|
|
|
c$$$# ifndef TEST2003 |
|
|
c$$$c***************************************************** |
|
|
c$$$cccccc 11/9/2005 modified by david fedele |
|
|
c$$$c pkt_type = pkt_type1 |
|
|
c$$$c pkt_num = pkt_num1 |
|
|
c$$$c obt = obt1 |
|
|
c$$$c which_calib = which_calib1 |
|
|
c$$$ swcode = 302 |
|
|
c$$$ |
|
|
c$$$ which_calib = which_calib1 |
|
|
c$$$ pkt_type = pkt_type1 |
|
|
c$$$ pkt_num = pkt_num1 |
|
|
c$$$ obt = obt1 |
|
|
c$$$ cpu_crc = cpu_crc1 |
|
|
c$$$ do iv=1,12 |
|
|
c$$$ crc(iv)=crc1(iv) |
|
|
c$$$ enddo |
|
|
c$$$# endif |
|
|
c***************************************************** |
|
3075 |
|
|
3076 |
NTRK = 0 |
NTRK = 0 |
3077 |
do it=1,NTRKMAX!NTRACKSMAX |
do it=1,NTRKMAX |
3078 |
IMAGE(IT)=0 |
IMAGE(IT)=0 |
3079 |
CHI2_nt(IT) = -100000. |
CHI2_nt(IT) = -100000. |
|
c BdL(IT) = 0. |
|
3080 |
do ip=1,nplanes |
do ip=1,nplanes |
3081 |
XM_nt(IP,IT) = 0 |
XM_nt(IP,IT) = 0 |
3082 |
YM_nt(IP,IT) = 0 |
YM_nt(IP,IT) = 0 |
3085 |
RESY_nt(IP,IT) = 0 |
RESY_nt(IP,IT) = 0 |
3086 |
XGOOD_nt(IP,IT) = 0 |
XGOOD_nt(IP,IT) = 0 |
3087 |
YGOOD_nt(IP,IT) = 0 |
YGOOD_nt(IP,IT) = 0 |
|
c***************************************************** |
|
|
cccccc 11/9/2005 modified by david fedele |
|
3088 |
DEDX_X(IP,IT) = 0 |
DEDX_X(IP,IT) = 0 |
3089 |
DEDX_Y(IP,IT) = 0 |
DEDX_Y(IP,IT) = 0 |
|
c****************************************************** |
|
|
cccccc 17/8/2006 modified by elena |
|
3090 |
CLTRX(IP,IT) = 0 |
CLTRX(IP,IT) = 0 |
3091 |
CLTRY(IP,IT) = 0 |
CLTRY(IP,IT) = 0 |
3092 |
enddo |
enddo |
3097 |
enddo |
enddo |
3098 |
enddo |
enddo |
3099 |
enddo |
enddo |
|
|
|
|
|
|
|
c***************************************************** |
|
|
cccccc 11/9/2005 modified by david fedele |
|
3100 |
nclsx=0 |
nclsx=0 |
3101 |
nclsy=0 |
nclsy=0 |
3102 |
do ip=1,NSINGMAX |
do ip=1,NSINGMAX |
3103 |
planex(ip)=0 |
planex(ip)=0 |
|
c xs(ip)=0 |
|
3104 |
xs(1,ip)=0 |
xs(1,ip)=0 |
3105 |
xs(2,ip)=0 |
xs(2,ip)=0 |
3106 |
sgnlxs(ip)=0 |
sgnlxs(ip)=0 |
3107 |
planey(ip)=0 |
planey(ip)=0 |
|
c ys(ip)=0 |
|
3108 |
ys(1,ip)=0 |
ys(1,ip)=0 |
3109 |
ys(2,ip)=0 |
ys(2,ip)=0 |
3110 |
sgnlys(ip)=0 |
sgnlys(ip)=0 |
3111 |
enddo |
enddo |
|
c******************************************************* |
|
3112 |
end |
end |
3113 |
|
|
3114 |
|
|
3123 |
************************************************************ |
************************************************************ |
3124 |
|
|
3125 |
|
|
3126 |
|
subroutine init_hough |
3127 |
|
|
3128 |
|
include 'commontracker.f' |
3129 |
|
include 'level1.f' |
3130 |
|
include 'common_momanhough.f' |
3131 |
|
include 'common_hough.f' |
3132 |
|
include 'level2.f' |
3133 |
|
|
3134 |
|
ntrpt_nt=0 |
3135 |
|
ndblt_nt=0 |
3136 |
|
NCLOUDS_XZ_nt=0 |
3137 |
|
NCLOUDS_YZ_nt=0 |
3138 |
|
do idb=1,ndblt_max_nt |
3139 |
|
db_cloud_nt(idb)=0 |
3140 |
|
alfayz1_nt(idb)=0 |
3141 |
|
alfayz2_nt(idb)=0 |
3142 |
|
enddo |
3143 |
|
do itr=1,ntrpt_max_nt |
3144 |
|
tr_cloud_nt(itr)=0 |
3145 |
|
alfaxz1_nt(itr)=0 |
3146 |
|
alfaxz2_nt(itr)=0 |
3147 |
|
alfaxz3_nt(itr)=0 |
3148 |
|
enddo |
3149 |
|
do idb=1,ncloyz_max |
3150 |
|
ptcloud_yz_nt(idb)=0 |
3151 |
|
alfayz1_av_nt(idb)=0 |
3152 |
|
alfayz2_av_nt(idb)=0 |
3153 |
|
enddo |
3154 |
|
do itr=1,ncloxz_max |
3155 |
|
ptcloud_xz_nt(itr)=0 |
3156 |
|
alfaxz1_av_nt(itr)=0 |
3157 |
|
alfaxz2_av_nt(itr)=0 |
3158 |
|
alfaxz3_av_nt(itr)=0 |
3159 |
|
enddo |
3160 |
|
|
3161 |
|
ntrpt=0 |
3162 |
|
ndblt=0 |
3163 |
|
NCLOUDS_XZ=0 |
3164 |
|
NCLOUDS_YZ=0 |
3165 |
|
do idb=1,ndblt_max |
3166 |
|
db_cloud(idb)=0 |
3167 |
|
cpyz1(idb)=0 |
3168 |
|
cpyz2(idb)=0 |
3169 |
|
alfayz1(idb)=0 |
3170 |
|
alfayz2(idb)=0 |
3171 |
|
enddo |
3172 |
|
do itr=1,ntrpt_max |
3173 |
|
tr_cloud(itr)=0 |
3174 |
|
cpxz1(itr)=0 |
3175 |
|
cpxz2(itr)=0 |
3176 |
|
cpxz3(itr)=0 |
3177 |
|
alfaxz1(itr)=0 |
3178 |
|
alfaxz2(itr)=0 |
3179 |
|
alfaxz3(itr)=0 |
3180 |
|
enddo |
3181 |
|
do idb=1,ncloyz_max |
3182 |
|
ptcloud_yz(idb)=0 |
3183 |
|
alfayz1_av(idb)=0 |
3184 |
|
alfayz2_av(idb)=0 |
3185 |
|
do idbb=1,ncouplemaxtot |
3186 |
|
cpcloud_yz(idb,idbb)=0 |
3187 |
|
enddo |
3188 |
|
enddo |
3189 |
|
do itr=1,ncloxz_max |
3190 |
|
ptcloud_xz(itr)=0 |
3191 |
|
alfaxz1_av(itr)=0 |
3192 |
|
alfaxz2_av(itr)=0 |
3193 |
|
alfaxz3_av(itr)=0 |
3194 |
|
do itrr=1,ncouplemaxtot |
3195 |
|
cpcloud_xz(itr,itrr)=0 |
3196 |
|
enddo |
3197 |
|
enddo |
3198 |
|
end |
3199 |
|
************************************************************ |
3200 |
|
* |
3201 |
|
* |
3202 |
|
* |
3203 |
|
* |
3204 |
|
* |
3205 |
|
* |
3206 |
|
* |
3207 |
|
************************************************************ |
3208 |
|
|
3209 |
|
|
3210 |
subroutine fill_level2_tracks(ntr) |
subroutine fill_level2_tracks(ntr) |
3211 |
|
|
3212 |
* ------------------------------------------------------- |
* ------------------------------------------------------- |
3217 |
|
|
3218 |
|
|
3219 |
include 'commontracker.f' |
include 'commontracker.f' |
3220 |
|
c include 'level1.f' |
3221 |
include 'level1.f' |
include 'level1.f' |
3222 |
|
include 'common_momanhough.f' |
3223 |
include 'level2.f' |
include 'level2.f' |
3224 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
3225 |
include 'common_momanhough.f' |
real sinth,phi,pig |
|
real sinth,phi,pig !(4) |
|
3226 |
pig=acos(-1.) |
pig=acos(-1.) |
3227 |
|
|
|
c good2=1!.true. |
|
3228 |
chi2_nt(ntr) = sngl(chi2) |
chi2_nt(ntr) = sngl(chi2) |
3229 |
nstep_nt(ntr) = 0!nstep |
nstep_nt(ntr) = nstep |
3230 |
|
|
3231 |
|
phi = al(4) |
3232 |
|
sinth = al(3) |
3233 |
|
if(sinth.lt.0)then |
3234 |
|
sinth = -sinth |
3235 |
|
phi = phi + pig |
3236 |
|
endif |
3237 |
|
npig = aint(phi/(2*pig)) |
3238 |
|
phi = phi - npig*2*pig |
3239 |
|
if(phi.lt.0) |
3240 |
|
$ phi = phi + 2*pig |
3241 |
|
al(4) = phi |
3242 |
|
al(3) = sinth |
3243 |
|
|
|
phi = al(4) !(4) |
|
|
sinth = al(3) !(4) |
|
|
if(sinth.lt.0)then !(4) |
|
|
sinth = -sinth !(4) |
|
|
phi = phi + pig !(4) |
|
|
endif !(4) |
|
|
npig = aint(phi/(2*pig)) !(4) |
|
|
phi = phi - npig*2*pig !(4) |
|
|
if(phi.lt.0) !(4) |
|
|
$ phi = phi + 2*pig !(4) |
|
|
al(4) = phi !(4) |
|
|
al(3) = sinth !(4) |
|
|
***************************************************** |
|
3244 |
do i=1,5 |
do i=1,5 |
3245 |
al_nt(i,ntr) = sngl(al(i)) |
al_nt(i,ntr) = sngl(al(i)) |
3246 |
do j=1,5 |
do j=1,5 |
3247 |
coval(i,j,ntr) = sngl(cov(i,j)) |
coval(i,j,ntr) = sngl(cov(i,j)) |
3248 |
enddo |
enddo |
|
c print*,al_nt(i,ntr) |
|
3249 |
enddo |
enddo |
3250 |
|
|
3251 |
do ip=1,nplanes ! loop on planes |
do ip=1,nplanes ! loop on planes |
3261 |
zv_nt(ip,ntr) = sngl(zv(ip)) |
zv_nt(ip,ntr) = sngl(zv(ip)) |
3262 |
axv_nt(ip,ntr) = sngl(axv(ip)) |
axv_nt(ip,ntr) = sngl(axv(ip)) |
3263 |
ayv_nt(ip,ntr) = sngl(ayv(ip)) |
ayv_nt(ip,ntr) = sngl(ayv(ip)) |
|
c dedxp(ip,ntr) = sngl(dedxtrk(ip)) !(1) |
|
3264 |
dedx_x(ip,ntr) = sngl(dedxtrk_x(ip)) !(2) |
dedx_x(ip,ntr) = sngl(dedxtrk_x(ip)) !(2) |
3265 |
dedx_y(ip,ntr) = sngl(dedxtrk_y(ip)) !(2) |
dedx_y(ip,ntr) = sngl(dedxtrk_y(ip)) !(2) |
3266 |
|
|
3277 |
endif |
endif |
3278 |
|
|
3279 |
enddo |
enddo |
|
c call CalcBdL(100,xxxx,IFAIL) |
|
|
c if(ifps(xxxx).eq.1)BdL(ntr) = xxxx |
|
|
c$$$ print*,'xgood(ip,ntr) ',(xgood_nt(ip,ntr),ip=1,6) |
|
|
c$$$ print*,'ygood(ip,ntr) ',(ygood_nt(ip,ntr),ip=1,6) |
|
|
c$$$ print*,'dedx_x(ip,ntr) ',(dedx_x(ip,ntr),ip=1,6) |
|
|
c$$$ print*,'dedx_y(ip,ntr) ',(dedx_y(ip,ntr),ip=1,6) |
|
3280 |
|
|
3281 |
|
|
3282 |
end |
end |
3283 |
|
|
3284 |
subroutine fill_level2_siglets |
subroutine fill_level2_siglets |
|
c***************************************************** |
|
|
c 07/10/2005 created by elena vannuccini |
|
|
c 31/01/2006 modified by elena vannuccini |
|
|
* to convert adc to mip --> (2) |
|
|
c***************************************************** |
|
3285 |
|
|
3286 |
* ------------------------------------------------------- |
* ------------------------------------------------------- |
3287 |
* This routine fills the elements of the variables |
* This routine fills the elements of the variables |
3290 |
* ------------------------------------------------------- |
* ------------------------------------------------------- |
3291 |
|
|
3292 |
include 'commontracker.f' |
include 'commontracker.f' |
3293 |
include 'level1.f' |
c include 'level1.f' |
|
include 'level2.f' |
|
3294 |
include 'calib.f' |
include 'calib.f' |
3295 |
|
include 'level1.f' |
3296 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
3297 |
|
include 'level2.f' |
3298 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
3299 |
|
|
3300 |
* count #cluster per plane not associated to any track |
* count #cluster per plane not associated to any track |
3302 |
nclsx = 0 |
nclsx = 0 |
3303 |
nclsy = 0 |
nclsy = 0 |
3304 |
|
|
3305 |
|
do iv = 1,nviews |
3306 |
|
if( mask_view(iv).ne.0 )good2(iv) = 20+mask_view(iv) |
3307 |
|
enddo |
3308 |
|
|
3309 |
do icl=1,nclstr1 |
do icl=1,nclstr1 |
3310 |
if(cl_used(icl).eq.0)then !cluster not included in any track |
if(cl_used(icl).eq.0)then !cluster not included in any track |
3311 |
ip=nplanes-npl(VIEW(icl))+1 |
ip=nplanes-npl(VIEW(icl))+1 |
3349 |
enddo |
enddo |
3350 |
end |
end |
3351 |
|
|
3352 |
|
*************************************************** |
3353 |
|
* * |
3354 |
|
* * |
3355 |
|
* * |
3356 |
|
* * |
3357 |
|
* * |
3358 |
|
* * |
3359 |
|
************************************************** |
3360 |
|
|
3361 |
|
subroutine fill_hough |
3362 |
|
|
3363 |
|
* ------------------------------------------------------- |
3364 |
|
* This routine fills the variables related to the hough |
3365 |
|
* transform, for the debig n-tuple |
3366 |
|
* ------------------------------------------------------- |
3367 |
|
|
3368 |
|
include 'commontracker.f' |
3369 |
|
include 'level1.f' |
3370 |
|
include 'common_momanhough.f' |
3371 |
|
include 'common_hough.f' |
3372 |
|
include 'level2.f' |
3373 |
|
|
3374 |
|
if(.false. |
3375 |
|
$ .or.ntrpt.gt.ntrpt_max_nt |
3376 |
|
$ .or.ndblt.gt.ndblt_max_nt |
3377 |
|
$ .or.NCLOUDS_XZ.gt.ncloxz_max |
3378 |
|
$ .or.NCLOUDS_yZ.gt.ncloyz_max |
3379 |
|
$ )then |
3380 |
|
ntrpt_nt=0 |
3381 |
|
ndblt_nt=0 |
3382 |
|
NCLOUDS_XZ_nt=0 |
3383 |
|
NCLOUDS_YZ_nt=0 |
3384 |
|
else |
3385 |
|
ndblt_nt=ndblt |
3386 |
|
ntrpt_nt=ntrpt |
3387 |
|
if(ndblt.ne.0)then |
3388 |
|
do id=1,ndblt |
3389 |
|
alfayz1_nt(id)=alfayz1(id) !Y0 |
3390 |
|
alfayz2_nt(id)=alfayz2(id) !tg theta-yz |
3391 |
|
enddo |
3392 |
|
endif |
3393 |
|
if(ndblt.ne.0)then |
3394 |
|
do it=1,ntrpt |
3395 |
|
alfaxz1_nt(it)=alfaxz1(it) !X0 |
3396 |
|
alfaxz2_nt(it)=alfaxz2(it) !tg theta-xz |
3397 |
|
alfaxz3_nt(it)=alfaxz3(it) !1/r |
3398 |
|
enddo |
3399 |
|
endif |
3400 |
|
nclouds_yz_nt=nclouds_yz |
3401 |
|
nclouds_xz_nt=nclouds_xz |
3402 |
|
if(nclouds_yz.ne.0)then |
3403 |
|
nnn=0 |
3404 |
|
do iyz=1,nclouds_yz |
3405 |
|
ptcloud_yz_nt(iyz)=ptcloud_yz(iyz) |
3406 |
|
alfayz1_av_nt(iyz)=alfayz1_av(iyz) |
3407 |
|
alfayz2_av_nt(iyz)=alfayz2_av(iyz) |
3408 |
|
nnn=nnn+ptcloud_yz(iyz) |
3409 |
|
enddo |
3410 |
|
do ipt=1,nnn |
3411 |
|
db_cloud_nt(ipt)=db_cloud(ipt) |
3412 |
|
enddo |
3413 |
|
endif |
3414 |
|
if(nclouds_xz.ne.0)then |
3415 |
|
nnn=0 |
3416 |
|
do ixz=1,nclouds_xz |
3417 |
|
ptcloud_xz_nt(ixz)=ptcloud_xz(ixz) |
3418 |
|
alfaxz1_av_nt(ixz)=alfaxz1_av(ixz) |
3419 |
|
alfaxz2_av_nt(ixz)=alfaxz2_av(ixz) |
3420 |
|
alfaxz3_av_nt(ixz)=alfaxz3_av(ixz) |
3421 |
|
nnn=nnn+ptcloud_xz(ixz) |
3422 |
|
enddo |
3423 |
|
do ipt=1,nnn |
3424 |
|
tr_cloud_nt(ipt)=tr_cloud(ipt) |
3425 |
|
enddo |
3426 |
|
endif |
3427 |
|
endif |
3428 |
|
end |
3429 |
|
|