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' |
21 |
include 'level1.f' |
c include 'level1.f' |
22 |
include 'level2.f' |
include 'level2.f' |
23 |
|
|
24 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
25 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
|
|
|
26 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
27 |
* STEP 1 |
* STEP 1 |
28 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
45 |
c iflag=0 |
c iflag=0 |
46 |
call cl_to_couples(iflag) |
call cl_to_couples(iflag) |
47 |
if(iflag.eq.1)then !bad event |
if(iflag.eq.1)then !bad event |
48 |
goto 880 !fill ntp and go to next event |
goto 880 !go to next event |
49 |
endif |
endif |
50 |
|
|
|
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
|
* 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 |
|
|
|
|
|
|
|
|
|
|
51 |
*----------------------------------------------------- |
*----------------------------------------------------- |
52 |
*----------------------------------------------------- |
*----------------------------------------------------- |
53 |
* HOUGH TRASFORM |
* HOUGH TRASFORM |
79 |
c iflag=0 |
c iflag=0 |
80 |
call cp_to_doubtrip(iflag) |
call cp_to_doubtrip(iflag) |
81 |
if(iflag.eq.1)then !bad event |
if(iflag.eq.1)then !bad event |
82 |
goto 880 !fill ntp and go to next event |
goto 880 !go to next event |
83 |
endif |
endif |
84 |
|
|
85 |
|
|
108 |
* $ ,ptcloud_xz,tr_cloud,cpcloud_xz |
* $ ,ptcloud_xz,tr_cloud,cpcloud_xz |
109 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
110 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
111 |
|
* count number of hit planes |
112 |
|
planehit=0 |
113 |
|
do np=1,nplanes |
114 |
|
if(ncp_plane(np).ne.0)then |
115 |
|
planehit=planehit+1 |
116 |
|
endif |
117 |
|
enddo |
118 |
|
if(planehit.lt.3) goto 880 ! exit |
119 |
|
|
120 |
|
nptxz_min=x_min_start |
121 |
|
nplxz_min=x_min_start |
122 |
|
|
123 |
|
nptyz_min=y_min_start |
124 |
|
nplyz_min=y_min_start |
125 |
|
|
126 |
c iflag=0 |
cutdistyz=cutystart |
127 |
|
cutdistxz=cutxstart |
128 |
|
|
129 |
|
878 continue |
130 |
call doub_to_YZcloud(iflag) |
call doub_to_YZcloud(iflag) |
131 |
if(iflag.eq.1)then !bad event |
if(iflag.eq.1)then !bad event |
132 |
goto 880 !fill ntp and go to next event |
goto 880 !fill ntp and go to next event |
133 |
endif |
endif |
134 |
c iflag=0 |
if(nclouds_yz.eq.0.and.cutdistyz.lt.maxcuty)then |
135 |
|
if(cutdistyz.lt.maxcuty/2)then |
136 |
|
cutdistyz=cutdistyz+cutystep |
137 |
|
else |
138 |
|
cutdistyz=cutdistyz+(3*cutystep) |
139 |
|
endif |
140 |
|
goto 878 |
141 |
|
endif |
142 |
|
|
143 |
|
if(planehit.eq.3) goto 881 |
144 |
|
|
145 |
|
879 continue |
146 |
call trip_to_XZcloud(iflag) |
call trip_to_XZcloud(iflag) |
147 |
if(iflag.eq.1)then !bad event |
if(iflag.eq.1)then !bad event |
148 |
goto 880 !fill ntp and go to next event |
goto 880 !fill ntp and go to next event |
149 |
endif |
endif |
150 |
|
|
151 |
|
if(nclouds_xz.eq.0.and.cutdistxz.lt.maxcutx)then |
152 |
|
cutdistxz=cutdistxz+cutxstep |
153 |
|
goto 879 |
154 |
|
endif |
155 |
|
|
156 |
|
|
157 |
|
881 continue |
158 |
|
* if there is at least three planes on the Y view decreases cuts on X view |
159 |
|
if(nclouds_xz.eq.0.and.nclouds_yz.gt.0.and. |
160 |
|
$ nplxz_min.ne.y_min_start)then |
161 |
|
nptxz_min=x_min_step |
162 |
|
nplxz_min=x_min_start-x_min_step |
163 |
|
goto 879 |
164 |
|
endif |
165 |
|
|
166 |
880 return |
880 return |
167 |
end |
end |
168 |
|
|
172 |
subroutine track_fitting(iflag) |
subroutine track_fitting(iflag) |
173 |
|
|
174 |
include 'commontracker.f' |
include 'commontracker.f' |
175 |
|
include 'level1.f' |
176 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
177 |
include 'common_mech.f' |
include 'common_mech.f' |
178 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
179 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
180 |
include 'calib.f' |
include 'calib.f' |
|
include 'level1.f' |
|
181 |
include 'level2.f' |
include 'level2.f' |
182 |
|
|
183 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
184 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
|
|
|
185 |
logical FIMAGE ! |
logical FIMAGE ! |
186 |
|
real*8 AL_GUESS(5) |
187 |
|
|
188 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
189 |
* STEP 4 (ITERATED until any other physical track isn't found) |
* STEP 4 (ITERATED until any other physical track isn't found) |
224 |
ibest=0 !best track among candidates |
ibest=0 !best track among candidates |
225 |
iimage=0 !track image |
iimage=0 !track image |
226 |
* ------------- select the best track ------------- |
* ------------- select the best track ------------- |
227 |
|
c$$$ rchi2best=1000000000. |
228 |
|
c$$$ do i=1,ntracks |
229 |
|
c$$$ if(RCHI2_STORE(i).lt.rchi2best.and. |
230 |
|
c$$$ $ RCHI2_STORE(i).gt.0)then |
231 |
|
c$$$ ibest=i |
232 |
|
c$$$ rchi2best=RCHI2_STORE(i) |
233 |
|
c$$$ endif |
234 |
|
c$$$ enddo |
235 |
|
c$$$ if(ibest.eq.0)goto 880 !>> no good candidates |
236 |
|
|
237 |
rchi2best=1000000000. |
rchi2best=1000000000. |
238 |
|
ndofbest=0 !(1) |
239 |
do i=1,ntracks |
do i=1,ntracks |
240 |
if(RCHI2_STORE(i).lt.rchi2best.and. |
if(RCHI2_STORE(i).lt.rchi2best.and. |
241 |
$ RCHI2_STORE(i).gt.0)then |
$ RCHI2_STORE(i).gt.0)then |
242 |
|
ndof=0 !(1) |
243 |
|
do ii=1,nplanes !(1) |
244 |
|
ndof=ndof !(1) |
245 |
|
$ +int(xgood_store(ii,i)) !(1) |
246 |
|
$ +int(ygood_store(ii,i)) !(1) |
247 |
|
enddo !(1) |
248 |
|
if(ndof.ge.ndofbest)then !(1) |
249 |
ibest=i |
ibest=i |
250 |
rchi2best=RCHI2_STORE(i) |
rchi2best=RCHI2_STORE(i) |
251 |
endif |
ndofbest=ndof !(1) |
252 |
|
endif !(1) |
253 |
|
endif |
254 |
enddo |
enddo |
255 |
if(ibest.eq.0)goto 880 !>> no good candidates |
if(ibest.eq.0)goto 880 !>> no good candidates |
256 |
*------------------------------------------------------------------------------- |
*------------------------------------------------------------------------------- |
282 |
* ********************************************************** |
* ********************************************************** |
283 |
* ************************** FIT *** FIT *** FIT *** FIT *** |
* ************************** FIT *** FIT *** FIT *** FIT *** |
284 |
* ********************************************************** |
* ********************************************************** |
285 |
|
call guess() |
286 |
|
do i=1,5 |
287 |
|
AL_GUESS(i)=AL(i) |
288 |
|
enddo |
289 |
|
|
290 |
do i=1,5 |
do i=1,5 |
291 |
AL(i)=dble(AL_STORE(i,icand)) |
AL(i)=dble(AL_STORE(i,icand)) |
292 |
enddo |
enddo |
293 |
|
|
294 |
IDCAND = icand !fitted track-candidate |
IDCAND = icand !fitted track-candidate |
295 |
ifail=0 !error flag in chi2 computation |
ifail=0 !error flag in chi2 computation |
296 |
jstep=0 !# minimization steps |
jstep=0 !# minimization steps |
297 |
|
|
298 |
iprint=0 |
iprint=0 |
299 |
if(DEBUG)iprint=1 |
c if(DEBUG)iprint=1 |
300 |
|
if(.true.)iprint=1 |
301 |
call mini2(jstep,ifail,iprint) |
call mini2(jstep,ifail,iprint) |
302 |
if(ifail.ne.0) then |
if(ifail.ne.0) then |
303 |
if(DEBUG)then |
if(.true.)then |
304 |
print *, |
print *, |
305 |
$ '*** MINIMIZATION FAILURE *** (mini2) ' |
$ '*** MINIMIZATION FAILURE *** (after refinement) ' |
306 |
$ ,iev |
$ ,iev |
307 |
|
|
308 |
|
c$$$ print*,'guess: ',(al_guess(i),i=1,5) |
309 |
|
c$$$ print*,'previous: ',(al_store(i,icand),i=1,5) |
310 |
|
c$$$ print*,'result: ',(al(i),i=1,5) |
311 |
|
c$$$ print*,'xgood ',xgood |
312 |
|
c$$$ print*,'ygood ',ygood |
313 |
|
c$$$ print*,'----------------------------------------------' |
314 |
endif |
endif |
315 |
chi2=-chi2 |
c chi2=-chi2 |
316 |
endif |
endif |
317 |
|
|
318 |
if(DEBUG)then |
if(DEBUG)then |
669 |
c***************************************************** |
c***************************************************** |
670 |
|
|
671 |
include 'commontracker.f' |
include 'commontracker.f' |
|
include 'calib.f' |
|
672 |
include 'level1.f' |
include 'level1.f' |
673 |
|
include 'calib.f' |
674 |
|
c include 'level1.f' |
675 |
include 'common_align.f' |
include 'common_align.f' |
676 |
include 'common_mech.f' |
include 'common_mech.f' |
677 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
678 |
include 'common_resxy.f' |
c include 'common_resxy.f' |
679 |
|
|
680 |
c logical DEBUG |
c logical DEBUG |
681 |
c common/dbg/DEBUG |
c common/dbg/DEBUG |
1347 |
* it returns the plane number |
* it returns the plane number |
1348 |
* |
* |
1349 |
include 'commontracker.f' |
include 'commontracker.f' |
1350 |
|
include 'level1.f' |
1351 |
c include 'common_analysis.f' |
c include 'common_analysis.f' |
1352 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
1353 |
|
|
1385 |
* it returns the id number ON THE PLANE |
* it returns the id number ON THE PLANE |
1386 |
* |
* |
1387 |
include 'commontracker.f' |
include 'commontracker.f' |
1388 |
|
include 'level1.f' |
1389 |
c include 'common_analysis.f' |
c include 'common_analysis.f' |
1390 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
1391 |
|
|
1414 |
* positive if sensor =2 |
* positive if sensor =2 |
1415 |
* |
* |
1416 |
include 'commontracker.f' |
include 'commontracker.f' |
1417 |
|
include 'level1.f' |
1418 |
c include 'calib.f' |
c include 'calib.f' |
1419 |
c include 'level1.f' |
c include 'level1.f' |
1420 |
c include 'common_analysis.f' |
c include 'common_analysis.f' |
1726 |
subroutine cl_to_couples(iflag) |
subroutine cl_to_couples(iflag) |
1727 |
|
|
1728 |
include 'commontracker.f' |
include 'commontracker.f' |
1729 |
|
include 'level1.f' |
1730 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
1731 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
1732 |
include 'calib.f' |
include 'calib.f' |
1733 |
include 'level1.f' |
c include 'level1.f' |
|
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
1734 |
|
|
1735 |
* output flag |
* output flag |
1736 |
* -------------- |
* -------------- |
1755 |
ncls(ip)=0 |
ncls(ip)=0 |
1756 |
enddo |
enddo |
1757 |
do icl=1,nclstrmax_level2 |
do icl=1,nclstrmax_level2 |
1758 |
cl_single(icl)=1 |
cl_single(icl) = 1 |
1759 |
cl_good(icl)=0 |
cl_good(icl) = 0 |
1760 |
|
enddo |
1761 |
|
do iv=1,nviews |
1762 |
|
ncl_view(iv) = 0 |
1763 |
|
mask_view(iv) = 0 !all included |
1764 |
enddo |
enddo |
1765 |
|
|
1766 |
|
* count number of cluster per view |
1767 |
|
do icl=1,nclstr1 |
1768 |
|
ncl_view(VIEW(icl)) = ncl_view(VIEW(icl)) + 1 |
1769 |
|
enddo |
1770 |
|
* mask views with too many clusters |
1771 |
|
do iv=1,nviews |
1772 |
|
if( ncl_view(iv).gt. nclustermax)then |
1773 |
|
mask_view(iv) = 1 |
1774 |
|
if(DEBUG)print*,' * WARNING * cl_to_couple: n.clusters > ' |
1775 |
|
$ ,nclustermax,' on view ', iv,' --> masked!' |
1776 |
|
endif |
1777 |
|
enddo |
1778 |
|
|
1779 |
|
|
1780 |
* start association |
* start association |
1781 |
ncouples=0 |
ncouples=0 |
1782 |
do icx=1,nclstr1 !loop on cluster (X) |
do icx=1,nclstr1 !loop on cluster (X) |
1783 |
if(mod(VIEW(icx),2).eq.1)goto 10 |
if(mod(VIEW(icx),2).eq.1)goto 10 |
1784 |
|
|
1785 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
1786 |
* cut on charge (X VIEW) |
* jump masked views (X VIEW) |
1787 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
1788 |
if(dedx(icx).lt.dedx_x_min)then |
if( mask_view(VIEW(icx)).ne.0 ) goto 10 |
|
cl_single(icx)=0 |
|
|
goto 10 |
|
|
endif |
|
1789 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
1790 |
* cut on multiplicity (X VIEW) |
* cut on charge (X VIEW) |
1791 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
1792 |
if(mult(icx).ge.mult_x_max)then |
if(dedx(icx).lt.dedx_x_min)then |
1793 |
cl_single(icx)=0 |
cl_single(icx)=0 |
1794 |
goto 10 |
goto 10 |
1795 |
endif |
endif |
1832 |
if(mod(VIEW(icy),2).eq.0)goto 20 |
if(mod(VIEW(icy),2).eq.0)goto 20 |
1833 |
|
|
1834 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
1835 |
* cut on charge (Y VIEW) |
* jump masked views (Y VIEW) |
1836 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
1837 |
if(dedx(icy).lt.dedx_y_min)then |
if( mask_view(VIEW(icy)).ne.0 ) goto 20 |
1838 |
cl_single(icy)=0 |
|
|
goto 20 |
|
|
endif |
|
1839 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
1840 |
* cut on multiplicity (X VIEW) |
* cut on charge (Y VIEW) |
1841 |
* ---------------------------------------------------- |
* ---------------------------------------------------- |
1842 |
if(mult(icy).ge.mult_y_max)then |
if(dedx(icy).lt.dedx_y_min)then |
1843 |
cl_single(icy)=0 |
cl_single(icy)=0 |
1844 |
goto 20 |
goto 20 |
1845 |
endif |
endif |
1885 |
* charge correlation |
* charge correlation |
1886 |
* (modified to be applied only below saturation... obviously) |
* (modified to be applied only below saturation... obviously) |
1887 |
|
|
|
* ------------------------------------------------------------- |
|
|
* >>> eliminata (TEMPORANEAMENTE) la correlazione di carica <<< |
|
|
* ------------------------------------------------------------- |
|
1888 |
if( .not.(dedx(icy).gt.chsaty.and.dedx(icx).gt.chsatx) |
if( .not.(dedx(icy).gt.chsaty.and.dedx(icx).gt.chsatx) |
1889 |
$ .and. |
$ .and. |
1890 |
$ .not.(dedx(icy).lt.chmipy.and.dedx(icx).lt.chmipx) |
$ .not.(dedx(icy).lt.chmipy.and.dedx(icx).lt.chmipx) |
1930 |
$ 'exceeds vector dimention ' |
$ 'exceeds vector dimention ' |
1931 |
$ ,'( ',ncouplemax,' )' |
$ ,'( ',ncouplemax,' )' |
1932 |
c good2=.false. |
c good2=.false. |
1933 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
1934 |
iflag=1 |
mask_view(nviewx(nplx)) = 2 |
1935 |
return |
mask_view(nviewy(nply)) = 2 |
1936 |
|
c iflag=1 |
1937 |
|
c return |
1938 |
endif |
endif |
1939 |
|
|
1940 |
ncp_plane(nplx) = ncp_plane(nplx) + 1 |
ncp_plane(nplx) = ncp_plane(nplx) + 1 |
1969 |
endif |
endif |
1970 |
|
|
1971 |
do ip=1,6 |
do ip=1,6 |
1972 |
ncp_tot=ncp_tot+ncp_plane(ip) |
ncp_tot = ncp_tot + ncp_plane(ip) |
1973 |
enddo |
enddo |
1974 |
c if(ncp_tot.gt.ncp_max)goto 100!next event (TEMPORANEO!!!) |
c if(ncp_tot.gt.ncp_max)goto 100!next event (TEMPORANEO!!!) |
1975 |
|
|
1976 |
if(ncp_tot.gt.ncp_max)then |
c$$$ if(ncp_tot.gt.ncp_max)then |
1977 |
if(verbose)print*, |
c$$$ if(verbose)print*, |
1978 |
$ '** warning ** number of identified '// |
c$$$ $ '** warning ** number of identified '// |
1979 |
$ 'couples exceeds upper limit for Hough tr. ' |
c$$$ $ 'couples exceeds upper limit for Hough tr. ' |
1980 |
$ ,'( ',ncp_max,' )' |
c$$$ $ ,'( ',ncp_max,' )' |
1981 |
c good2=.false. |
c$$$ iflag=1 |
1982 |
c goto 880 !fill ntp and go to next event |
c$$$ return |
1983 |
iflag=1 |
c$$$ endif |
|
return |
|
|
endif |
|
1984 |
|
|
1985 |
return |
return |
1986 |
end |
end |
1993 |
* * |
* * |
1994 |
* * |
* * |
1995 |
************************************************** |
************************************************** |
1996 |
subroutine cl_to_couples_nocharge(iflag) |
c$$$ subroutine cl_to_couples_nocharge(iflag) |
1997 |
|
c$$$ |
1998 |
include 'commontracker.f' |
c$$$ include 'commontracker.f' |
1999 |
include 'common_momanhough.f' |
c$$$ include 'level1.f' |
2000 |
include 'momanhough_init.f' |
c$$$ include 'common_momanhough.f' |
2001 |
include 'calib.f' |
c$$$c include 'momanhough_init.f' |
2002 |
include 'level1.f' |
c$$$ include 'calib.f' |
2003 |
|
c$$$c include 'level1.f' |
2004 |
c logical DEBUG |
c$$$ |
2005 |
c common/dbg/DEBUG |
c$$$ |
2006 |
|
c$$$* output flag |
2007 |
* output flag |
c$$$* -------------- |
2008 |
* -------------- |
c$$$* 0 = good event |
2009 |
* 0 = good event |
c$$$* 1 = bad event |
2010 |
* 1 = bad event |
c$$$* -------------- |
2011 |
* -------------- |
c$$$ integer iflag |
2012 |
integer iflag |
c$$$ |
2013 |
|
c$$$ integer badseed,badcl |
2014 |
integer badseed,badcl |
c$$$ |
2015 |
|
c$$$* init variables |
2016 |
* init variables |
c$$$ ncp_tot=0 |
2017 |
ncp_tot=0 |
c$$$ do ip=1,nplanes |
2018 |
do ip=1,nplanes |
c$$$ do ico=1,ncouplemax |
2019 |
do ico=1,ncouplemax |
c$$$ clx(ip,ico)=0 |
2020 |
clx(ip,ico)=0 |
c$$$ cly(ip,ico)=0 |
2021 |
cly(ip,ico)=0 |
c$$$ enddo |
2022 |
enddo |
c$$$ ncp_plane(ip)=0 |
2023 |
ncp_plane(ip)=0 |
c$$$ do icl=1,nclstrmax_level2 |
2024 |
do icl=1,nclstrmax_level2 |
c$$$ cls(ip,icl)=1 |
2025 |
cls(ip,icl)=1 |
c$$$ enddo |
2026 |
enddo |
c$$$ ncls(ip)=0 |
2027 |
ncls(ip)=0 |
c$$$ enddo |
2028 |
enddo |
c$$$ do icl=1,nclstrmax_level2 |
2029 |
do icl=1,nclstrmax_level2 |
c$$$ cl_single(icl)=1 |
2030 |
cl_single(icl)=1 |
c$$$ cl_good(icl)=0 |
2031 |
cl_good(icl)=0 |
c$$$ enddo |
2032 |
enddo |
c$$$ |
2033 |
|
c$$$* start association |
2034 |
* start association |
c$$$ ncouples=0 |
2035 |
ncouples=0 |
c$$$ do icx=1,nclstr1 !loop on cluster (X) |
2036 |
do icx=1,nclstr1 !loop on cluster (X) |
c$$$ if(mod(VIEW(icx),2).eq.1)goto 10 |
2037 |
if(mod(VIEW(icx),2).eq.1)goto 10 |
c$$$ |
2038 |
|
c$$$* ---------------------------------------------------- |
2039 |
* ---------------------------------------------------- |
c$$$* cut on charge (X VIEW) |
2040 |
* cut on charge (X VIEW) |
c$$$ if(dedx(icx).lt.dedx_x_min)then |
2041 |
if(dedx(icx).lt.dedx_x_min)then |
c$$$ cl_single(icx)=0 |
2042 |
cl_single(icx)=0 |
c$$$ goto 10 |
2043 |
goto 10 |
c$$$ endif |
2044 |
endif |
c$$$* cut BAD (X VIEW) |
2045 |
* cut BAD (X VIEW) |
c$$$ badseed=BAD(VIEW(icx),nvk(MAXS(icx)),nst(MAXS(icx))) |
2046 |
badseed=BAD(VIEW(icx),nvk(MAXS(icx)),nst(MAXS(icx))) |
c$$$ ifirst=INDSTART(icx) |
2047 |
ifirst=INDSTART(icx) |
c$$$ if(icx.ne.nclstr1) then |
2048 |
if(icx.ne.nclstr1) then |
c$$$ ilast=INDSTART(icx+1)-1 |
2049 |
ilast=INDSTART(icx+1)-1 |
c$$$ else |
2050 |
else |
c$$$ ilast=TOTCLLENGTH |
2051 |
ilast=TOTCLLENGTH |
c$$$ endif |
2052 |
endif |
c$$$ badcl=badseed |
2053 |
badcl=badseed |
c$$$ do igood=-ngoodstr,ngoodstr |
2054 |
do igood=-ngoodstr,ngoodstr |
c$$$ ibad=1 |
2055 |
ibad=1 |
c$$$ if((INDMAX(icx)+igood).gt.ifirst.and. |
2056 |
if((INDMAX(icx)+igood).gt.ifirst.and. |
c$$$ $ (INDMAX(icx)+igood).lt.ilast.and. |
2057 |
$ (INDMAX(icx)+igood).lt.ilast.and. |
c$$$ $ .true.)then |
2058 |
$ .true.)then |
c$$$ ibad=BAD(VIEW(icx), |
2059 |
ibad=BAD(VIEW(icx), |
c$$$ $ nvk(MAXS(icx)+igood), |
2060 |
$ nvk(MAXS(icx)+igood), |
c$$$ $ nst(MAXS(icx)+igood)) |
2061 |
$ nst(MAXS(icx)+igood)) |
c$$$ endif |
2062 |
endif |
c$$$ badcl=badcl*ibad |
2063 |
badcl=badcl*ibad |
c$$$ enddo |
2064 |
enddo |
c$$$ if(badcl.eq.0)then !<<<<<<<<<<<<<< BAD cut |
2065 |
if(badcl.eq.0)then !<<<<<<<<<<<<<< BAD cut |
c$$$ cl_single(icx)=0 !<<<<<<<<<<<<<< BAD cut |
2066 |
cl_single(icx)=0 !<<<<<<<<<<<<<< BAD cut |
c$$$ goto 10 !<<<<<<<<<<<<<< BAD cut |
2067 |
goto 10 !<<<<<<<<<<<<<< BAD cut |
c$$$ endif !<<<<<<<<<<<<<< BAD cut |
2068 |
endif !<<<<<<<<<<<<<< BAD cut |
c$$$* ---------------------------------------------------- |
2069 |
* ---------------------------------------------------- |
c$$$ |
2070 |
|
c$$$ cl_good(icx)=1 |
2071 |
cl_good(icx)=1 |
c$$$ nplx=npl(VIEW(icx)) |
2072 |
nplx=npl(VIEW(icx)) |
c$$$ nldx=nld(MAXS(icx),VIEW(icx)) |
2073 |
nldx=nld(MAXS(icx),VIEW(icx)) |
c$$$ |
2074 |
|
c$$$ do icy=1,nclstr1 !loop on cluster (Y) |
2075 |
do icy=1,nclstr1 !loop on cluster (Y) |
c$$$ if(mod(VIEW(icy),2).eq.0)goto 20 |
2076 |
if(mod(VIEW(icy),2).eq.0)goto 20 |
c$$$ |
2077 |
|
c$$$* ---------------------------------------------------- |
2078 |
* ---------------------------------------------------- |
c$$$* cut on charge (Y VIEW) |
2079 |
* cut on charge (Y VIEW) |
c$$$ if(dedx(icy).lt.dedx_y_min)then |
2080 |
if(dedx(icy).lt.dedx_y_min)then |
c$$$ cl_single(icy)=0 |
2081 |
cl_single(icy)=0 |
c$$$ goto 20 |
2082 |
goto 20 |
c$$$ endif |
2083 |
endif |
c$$$* cut BAD (Y VIEW) |
2084 |
* cut BAD (Y VIEW) |
c$$$ badseed=BAD(VIEW(icy),nvk(MAXS(icy)),nst(MAXS(icy))) |
2085 |
badseed=BAD(VIEW(icy),nvk(MAXS(icy)),nst(MAXS(icy))) |
c$$$ ifirst=INDSTART(icy) |
2086 |
ifirst=INDSTART(icy) |
c$$$ if(icy.ne.nclstr1) then |
2087 |
if(icy.ne.nclstr1) then |
c$$$ ilast=INDSTART(icy+1)-1 |
2088 |
ilast=INDSTART(icy+1)-1 |
c$$$ else |
2089 |
else |
c$$$ ilast=TOTCLLENGTH |
2090 |
ilast=TOTCLLENGTH |
c$$$ endif |
2091 |
endif |
c$$$ badcl=badseed |
2092 |
badcl=badseed |
c$$$ do igood=-ngoodstr,ngoodstr |
2093 |
do igood=-ngoodstr,ngoodstr |
c$$$ ibad=1 |
2094 |
ibad=1 |
c$$$ if((INDMAX(icy)+igood).gt.ifirst.and. |
2095 |
if((INDMAX(icy)+igood).gt.ifirst.and. |
c$$$ $ (INDMAX(icy)+igood).lt.ilast.and. |
2096 |
$ (INDMAX(icy)+igood).lt.ilast.and. |
c$$$ $ .true.) |
2097 |
$ .true.) |
c$$$ $ ibad=BAD(VIEW(icy), |
2098 |
$ ibad=BAD(VIEW(icy), |
c$$$ $ nvk(MAXS(icy)+igood), |
2099 |
$ nvk(MAXS(icy)+igood), |
c$$$ $ nst(MAXS(icy)+igood)) |
2100 |
$ nst(MAXS(icy)+igood)) |
c$$$ badcl=badcl*ibad |
2101 |
badcl=badcl*ibad |
c$$$ enddo |
2102 |
enddo |
c$$$ if(badcl.eq.0)then !<<<<<<<<<<<<<< BAD cut |
2103 |
if(badcl.eq.0)then !<<<<<<<<<<<<<< BAD cut |
c$$$ cl_single(icy)=0 !<<<<<<<<<<<<<< BAD cut |
2104 |
cl_single(icy)=0 !<<<<<<<<<<<<<< BAD cut |
c$$$ goto 20 !<<<<<<<<<<<<<< BAD cut |
2105 |
goto 20 !<<<<<<<<<<<<<< BAD cut |
c$$$ endif !<<<<<<<<<<<<<< BAD cut |
2106 |
endif !<<<<<<<<<<<<<< BAD cut |
c$$$* ---------------------------------------------------- |
2107 |
* ---------------------------------------------------- |
c$$$ |
2108 |
|
c$$$ |
2109 |
|
c$$$ cl_good(icy)=1 |
2110 |
cl_good(icy)=1 |
c$$$ nply=npl(VIEW(icy)) |
2111 |
nply=npl(VIEW(icy)) |
c$$$ nldy=nld(MAXS(icy),VIEW(icy)) |
2112 |
nldy=nld(MAXS(icy),VIEW(icy)) |
c$$$ |
2113 |
|
c$$$* ---------------------------------------------- |
2114 |
* ---------------------------------------------- |
c$$$* CONDITION TO FORM A COUPLE |
2115 |
* CONDITION TO FORM A COUPLE |
c$$$* ---------------------------------------------- |
2116 |
* ---------------------------------------------- |
c$$$* geometrical consistency (same plane and ladder) |
2117 |
* geometrical consistency (same plane and ladder) |
c$$$ if(nply.eq.nplx.and.nldy.eq.nldx)then |
2118 |
if(nply.eq.nplx.and.nldy.eq.nldx)then |
c$$$* charge correlation |
2119 |
* charge correlation |
c$$$* =========================================================== |
2120 |
* =========================================================== |
c$$$* this version of the subroutine is used for the calibration |
2121 |
* this version of the subroutine is used for the calibration |
c$$$* thus charge-correlation selection is obviously removed |
2122 |
* thus charge-correlation selection is obviously removed |
c$$$* =========================================================== |
2123 |
* =========================================================== |
c$$$c$$$ ddd=(dedx(icy) |
2124 |
c$$$ ddd=(dedx(icy) |
c$$$c$$$ $ -kch(nplx,nldx)*dedx(icx)-cch(nplx,nldx)) |
2125 |
c$$$ $ -kch(nplx,nldx)*dedx(icx)-cch(nplx,nldx)) |
c$$$c$$$ ddd=ddd/sqrt(kch(nplx,nldx)**2+1) |
2126 |
c$$$ ddd=ddd/sqrt(kch(nplx,nldx)**2+1) |
c$$$c$$$ cut=chcut*sch(nplx,nldx) |
2127 |
c$$$ cut=chcut*sch(nplx,nldx) |
c$$$c$$$ if(abs(ddd).gt.cut)goto 20 !charge not consistent |
2128 |
c$$$ if(abs(ddd).gt.cut)goto 20 !charge not consistent |
c$$$* =========================================================== |
2129 |
* =========================================================== |
c$$$ |
2130 |
|
c$$$ |
2131 |
|
c$$$* ------------------> COUPLE <------------------ |
2132 |
* ------------------> COUPLE <------------------ |
c$$$* check to do not overflow vector dimentions |
2133 |
* check to do not overflow vector dimentions |
c$$$c$$$ if(ncp_plane(nplx).gt.ncouplemax)then |
2134 |
c$$$ if(ncp_plane(nplx).gt.ncouplemax)then |
c$$$c$$$ if(DEBUG)print*, |
2135 |
c$$$ if(DEBUG)print*, |
c$$$c$$$ $ ' ** warning ** number of identified'// |
2136 |
c$$$ $ ' ** warning ** number of identified'// |
c$$$c$$$ $ ' couples on plane ',nplx, |
2137 |
c$$$ $ ' couples on plane ',nplx, |
c$$$c$$$ $ ' exceeds vector dimention'// |
2138 |
c$$$ $ ' exceeds vector dimention'// |
c$$$c$$$ $ ' ( ',ncouplemax,' )' |
2139 |
c$$$ $ ' ( ',ncouplemax,' )' |
c$$$c$$$c good2=.false. |
2140 |
|
c$$$c$$$c goto 880 !fill ntp and go to next event |
2141 |
|
c$$$c$$$ iflag=1 |
2142 |
|
c$$$c$$$ return |
2143 |
|
c$$$c$$$ endif |
2144 |
|
c$$$ |
2145 |
|
c$$$ if(ncp_plane(nplx).eq.ncouplemax)then |
2146 |
|
c$$$ if(verbose)print*, |
2147 |
|
c$$$ $ '** warning ** number of identified '// |
2148 |
|
c$$$ $ 'couples on plane ',nplx, |
2149 |
|
c$$$ $ 'exceeds vector dimention ' |
2150 |
|
c$$$ $ ,'( ',ncouplemax,' )' |
2151 |
c$$$c good2=.false. |
c$$$c good2=.false. |
2152 |
c$$$c goto 880 !fill ntp and go to next event |
c$$$c goto 880 !fill ntp and go to next event |
2153 |
c$$$ iflag=1 |
c$$$ iflag=1 |
2154 |
c$$$ return |
c$$$ return |
2155 |
c$$$ endif |
c$$$ endif |
2156 |
|
c$$$ |
2157 |
if(ncp_plane(nplx).eq.ncouplemax)then |
c$$$ ncp_plane(nplx) = ncp_plane(nplx) + 1 |
2158 |
if(verbose)print*, |
c$$$ clx(nplx,ncp_plane(nplx))=icx |
2159 |
$ '** warning ** number of identified '// |
c$$$ cly(nply,ncp_plane(nplx))=icy |
2160 |
$ 'couples on plane ',nplx, |
c$$$ cl_single(icx)=0 |
2161 |
$ 'exceeds vector dimention ' |
c$$$ cl_single(icy)=0 |
2162 |
$ ,'( ',ncouplemax,' )' |
c$$$ endif |
2163 |
c good2=.false. |
c$$$* ---------------------------------------------- |
2164 |
c goto 880 !fill ntp and go to next event |
c$$$ |
2165 |
iflag=1 |
c$$$ 20 continue |
2166 |
return |
c$$$ enddo !end loop on clusters(Y) |
2167 |
endif |
c$$$ |
2168 |
|
c$$$ 10 continue |
2169 |
ncp_plane(nplx) = ncp_plane(nplx) + 1 |
c$$$ enddo !end loop on clusters(X) |
2170 |
clx(nplx,ncp_plane(nplx))=icx |
c$$$ |
2171 |
cly(nply,ncp_plane(nplx))=icy |
c$$$ |
2172 |
cl_single(icx)=0 |
c$$$ do icl=1,nclstr1 |
2173 |
cl_single(icy)=0 |
c$$$ if(cl_single(icl).eq.1)then |
2174 |
endif |
c$$$ ip=npl(VIEW(icl)) |
2175 |
* ---------------------------------------------- |
c$$$ ncls(ip)=ncls(ip)+1 |
2176 |
|
c$$$ cls(ip,ncls(ip))=icl |
2177 |
20 continue |
c$$$ endif |
2178 |
enddo !end loop on clusters(Y) |
c$$$ enddo |
2179 |
|
c$$$ |
2180 |
10 continue |
c$$$ |
2181 |
enddo !end loop on clusters(X) |
c$$$ if(DEBUG)then |
2182 |
|
c$$$ print*,'clusters ',nclstr1 |
2183 |
|
c$$$ print*,'good ',(cl_good(i),i=1,nclstr1) |
2184 |
do icl=1,nclstr1 |
c$$$ print*,'singles ',(cl_single(i),i=1,nclstr1) |
2185 |
if(cl_single(icl).eq.1)then |
c$$$ print*,'couples per plane: ',(ncp_plane(ip),ip=1,nplanes) |
2186 |
ip=npl(VIEW(icl)) |
c$$$ endif |
2187 |
ncls(ip)=ncls(ip)+1 |
c$$$ |
2188 |
cls(ip,ncls(ip))=icl |
c$$$ do ip=1,6 |
2189 |
endif |
c$$$ ncp_tot=ncp_tot+ncp_plane(ip) |
2190 |
enddo |
c$$$ enddo |
2191 |
|
c$$$c if(ncp_tot.gt.ncp_max)goto 100!next event (TEMPORANEO!!!) |
2192 |
|
c$$$ |
2193 |
if(DEBUG)then |
c$$$ if(ncp_tot.gt.ncp_max)then |
2194 |
print*,'clusters ',nclstr1 |
c$$$ if(verbose)print*, |
2195 |
print*,'good ',(cl_good(i),i=1,nclstr1) |
c$$$ $ '** warning ** number of identified '// |
2196 |
print*,'singles ',(cl_single(i),i=1,nclstr1) |
c$$$ $ 'couples exceeds upper limit for Hough tr. ' |
2197 |
print*,'couples per plane: ',(ncp_plane(ip),ip=1,nplanes) |
c$$$ $ ,'( ',ncp_max,' )' |
2198 |
endif |
c$$$c good2=.false. |
2199 |
|
c$$$c goto 880 !fill ntp and go to next event |
2200 |
do ip=1,6 |
c$$$ iflag=1 |
2201 |
ncp_tot=ncp_tot+ncp_plane(ip) |
c$$$ return |
2202 |
enddo |
c$$$ endif |
2203 |
c if(ncp_tot.gt.ncp_max)goto 100!next event (TEMPORANEO!!!) |
c$$$ |
2204 |
|
c$$$ return |
2205 |
if(ncp_tot.gt.ncp_max)then |
c$$$ end |
2206 |
if(verbose)print*, |
c$$$ |
|
$ '** 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 |
|
|
|
|
2207 |
|
|
2208 |
*************************************************** |
*************************************************** |
2209 |
* * |
* * |
2220 |
c***************************************************** |
c***************************************************** |
2221 |
|
|
2222 |
include 'commontracker.f' |
include 'commontracker.f' |
2223 |
|
include 'level1.f' |
2224 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
2225 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
2226 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
2227 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
2228 |
include 'calib.f' |
include 'calib.f' |
2229 |
include 'level1.f' |
c include 'level1.f' |
2230 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
2231 |
|
|
2232 |
* output flag |
* output flag |
2233 |
* -------------- |
* -------------- |
2301 |
$ ,'( ',ndblt_max,' )' |
$ ,'( ',ndblt_max,' )' |
2302 |
c good2=.false. |
c good2=.false. |
2303 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
2304 |
|
do iv=1,12 |
2305 |
|
mask_view(iv) = 3 |
2306 |
|
enddo |
2307 |
iflag=1 |
iflag=1 |
2308 |
return |
return |
2309 |
endif |
endif |
2374 |
$ ,'( ',ntrpt_max,' )' |
$ ,'( ',ntrpt_max,' )' |
2375 |
c good2=.false. |
c good2=.false. |
2376 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
2377 |
|
do iv=1,nviews |
2378 |
|
mask_view(iv) = 4 |
2379 |
|
enddo |
2380 |
iflag=1 |
iflag=1 |
2381 |
return |
return |
2382 |
endif |
endif |
2451 |
subroutine doub_to_YZcloud(iflag) |
subroutine doub_to_YZcloud(iflag) |
2452 |
|
|
2453 |
include 'commontracker.f' |
include 'commontracker.f' |
2454 |
|
include 'level1.f' |
2455 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
2456 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
2457 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
2458 |
|
|
2459 |
* output flag |
* output flag |
2460 |
* -------------- |
* -------------- |
2486 |
distance=0 |
distance=0 |
2487 |
nclouds_yz=0 !number of clouds |
nclouds_yz=0 !number of clouds |
2488 |
npt_tot=0 |
npt_tot=0 |
2489 |
|
nloop=0 |
2490 |
|
90 continue |
2491 |
do idb1=1,ndblt !loop (1) on DOUBLETS |
do idb1=1,ndblt !loop (1) on DOUBLETS |
2492 |
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 |
2493 |
|
|
2591 |
nplused=nplused+ hit_plane(ip) |
nplused=nplused+ hit_plane(ip) |
2592 |
enddo |
enddo |
2593 |
c print*,'>>>> ',ncpused,npt,nplused |
c print*,'>>>> ',ncpused,npt,nplused |
2594 |
if(ncpused.lt.ncpyz_min)goto 2228 !next doublet |
c if(ncpused.lt.ncpyz_min)goto 2228 !next doublet |
2595 |
if(npt.lt.nptyz_min)goto 2228 !next doublet |
if(npt.lt.nptyz_min)goto 2228 !next doublet |
2596 |
if(nplused.lt.nplyz_min)goto 2228 !next doublet |
if(nplused.lt.nplyz_min)goto 2228 !next doublet |
2597 |
|
|
2605 |
$ ,'( ',ncloyz_max,' )' |
$ ,'( ',ncloyz_max,' )' |
2606 |
c good2=.false. |
c good2=.false. |
2607 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
2608 |
|
do iv=1,nviews |
2609 |
|
mask_view(iv) = 5 |
2610 |
|
enddo |
2611 |
iflag=1 |
iflag=1 |
2612 |
return |
return |
2613 |
endif |
endif |
2645 |
enddo !end loop (1) on DOUBLETS |
enddo !end loop (1) on DOUBLETS |
2646 |
|
|
2647 |
|
|
2648 |
|
if(nloop.lt.nstepy)then |
2649 |
|
cutdistyz = cutdistyz+cutystep |
2650 |
|
nloop = nloop+1 |
2651 |
|
goto 90 |
2652 |
|
endif |
2653 |
|
|
2654 |
if(DEBUG)then |
if(DEBUG)then |
2655 |
print*,'---------------------- ' |
print*,'---------------------- ' |
2656 |
print*,'Y-Z total clouds ',nclouds_yz |
print*,'Y-Z total clouds ',nclouds_yz |
2677 |
subroutine trip_to_XZcloud(iflag) |
subroutine trip_to_XZcloud(iflag) |
2678 |
|
|
2679 |
include 'commontracker.f' |
include 'commontracker.f' |
2680 |
|
include 'level1.f' |
2681 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
2682 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
2683 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
2684 |
|
|
2685 |
* output flag |
* output flag |
2686 |
* -------------- |
* -------------- |
2711 |
distance=0 |
distance=0 |
2712 |
nclouds_xz=0 !number of clouds |
nclouds_xz=0 !number of clouds |
2713 |
npt_tot=0 !total number of selected triplets |
npt_tot=0 !total number of selected triplets |
2714 |
|
nloop=0 |
2715 |
|
91 continue |
2716 |
do itr1=1,ntrpt !loop (1) on TRIPLETS |
do itr1=1,ntrpt !loop (1) on TRIPLETS |
2717 |
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 |
2718 |
c print*,'--------------' |
c print*,'--------------' |
2814 |
do ip=1,nplanes |
do ip=1,nplanes |
2815 |
nplused=nplused+ hit_plane(ip) |
nplused=nplused+ hit_plane(ip) |
2816 |
enddo |
enddo |
2817 |
if(ncpused.lt.ncpxz_min)goto 22288 !next triplet |
c if(ncpused.lt.ncpxz_min)goto 22288 !next triplet |
2818 |
if(npt.lt.nptxz_min)goto 22288 !next triplet |
if(npt.lt.nptxz_min)goto 22288 !next triplet |
2819 |
if(nplused.lt.nplxz_min)goto 22288 !next doublet |
if(nplused.lt.nplxz_min)goto 22288 !next doublet |
2820 |
|
|
2827 |
$ ,'( ',ncloxz_max,' )' |
$ ,'( ',ncloxz_max,' )' |
2828 |
c good2=.false. |
c good2=.false. |
2829 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
2830 |
|
do iv=1,nviews |
2831 |
|
mask_view(iv) = 6 |
2832 |
|
enddo |
2833 |
iflag=1 |
iflag=1 |
2834 |
return |
return |
2835 |
endif |
endif |
2865 |
* ~~~~~~~~~~~~~~~~~ |
* ~~~~~~~~~~~~~~~~~ |
2866 |
22288 continue |
22288 continue |
2867 |
enddo !end loop (1) on DOUBLETS |
enddo !end loop (1) on DOUBLETS |
2868 |
|
|
2869 |
|
if(nloop.lt.nstepx)then |
2870 |
|
cutdistxz=cutdistxz+cutxstep |
2871 |
|
nloop=nloop+1 |
2872 |
|
goto 91 |
2873 |
|
endif |
2874 |
|
|
2875 |
if(DEBUG)then |
if(DEBUG)then |
2876 |
print*,'---------------------- ' |
print*,'---------------------- ' |
2877 |
print*,'X-Z total clouds ',nclouds_xz |
print*,'X-Z total clouds ',nclouds_xz |
2898 |
c***************************************************** |
c***************************************************** |
2899 |
|
|
2900 |
include 'commontracker.f' |
include 'commontracker.f' |
2901 |
|
include 'level1.f' |
2902 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
2903 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
2904 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
2905 |
include 'common_mech.f' |
include 'common_mech.f' |
2906 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
2907 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
2908 |
|
|
2909 |
* output flag |
* output flag |
2910 |
* -------------- |
* -------------- |
2920 |
* ----------------------------------------------------------- |
* ----------------------------------------------------------- |
2921 |
* list of matching couples in the combination |
* list of matching couples in the combination |
2922 |
* between a XZ and YZ cloud |
* between a XZ and YZ cloud |
2923 |
integer cp_match(nplanes,ncouplemax) |
integer cp_match(nplanes,2*ncouplemax) |
2924 |
integer ncp_match(nplanes) |
integer ncp_match(nplanes) |
2925 |
* ----------------------------------------------------------- |
* ----------------------------------------------------------- |
2926 |
integer hit_plane(nplanes) |
integer hit_plane(nplanes) |
2927 |
* ----------------------------------------------------------- |
* ----------------------------------------------------------- |
2928 |
* variables for track fitting |
* variables for track fitting |
2929 |
double precision AL_INI(5) |
double precision AL_INI(5) |
2930 |
double precision tath |
c double precision tath |
2931 |
* ----------------------------------------------------------- |
* ----------------------------------------------------------- |
2932 |
c real fitz(nplanes) !z coordinates of the planes in cm |
c real fitz(nplanes) !z coordinates of the planes in cm |
2933 |
|
|
3020 |
c$$$ print*,'~~~~~~~~~~~~~~~~~~~~~~~~~' |
c$$$ print*,'~~~~~~~~~~~~~~~~~~~~~~~~~' |
3021 |
|
|
3022 |
* -------> INITIAL GUESS <------- |
* -------> INITIAL GUESS <------- |
3023 |
AL_INI(1)=dreal(alfaxz1_av(ixz)) |
cccc SBAGLIATO |
3024 |
AL_INI(2)=dreal(alfayz1_av(iyz)) |
c$$$ AL_INI(1) = dreal(alfaxz1_av(ixz)) |
3025 |
AL_INI(4)=datan(dreal(alfayz2_av(iyz)) |
c$$$ AL_INI(2) = dreal(alfayz1_av(iyz)) |
3026 |
$ /dreal(alfaxz2_av(ixz))) |
c$$$ AL_INI(4) = PIGR + datan(dreal(alfayz2_av(iyz)) |
3027 |
tath=-dreal(alfaxz2_av(ixz))/dcos(AL_INI(4)) |
c$$$ $ /dreal(alfaxz2_av(ixz))) |
3028 |
AL_INI(3)=tath/sqrt(1+tath**2) |
c$$$ tath = -dreal(alfaxz2_av(ixz))/dcos(AL_INI(4)) |
3029 |
AL_INI(5)=(1.e2*alfaxz3_av(ixz))/(0.3*0.43) !0. |
c$$$ AL_INI(3) = tath/sqrt(1+tath**2) |
3030 |
|
c$$$ AL_INI(5) = (1.e2*alfaxz3_av(ixz))/(0.3*0.43) !0. |
3031 |
c print*,'*******',AL_INI(5) |
cccc GIUSTO (ma si sua guess()) |
3032 |
if(AL_INI(5).gt.defmax)goto 888 !next cloud |
c$$$ AL_INI(1) = dreal(alfaxz1_av(ixz)) |
3033 |
|
c$$$ AL_INI(2) = dreal(alfayz1_av(iyz)) |
3034 |
c print*,'alfaxz2, alfayz2 ' |
c$$$ tath = -dreal(alfaxz2_av(ixz))/dcos(AL_INI(4)) |
3035 |
c $ ,alfaxz2_av(ixz),alfayz2_av(iyz) |
c$$$ AL_INI(3) = tath/sqrt(1+tath**2) |
3036 |
|
c$$$ IF(alfaxz2_av(ixz).NE.0)THEN |
3037 |
* -------> INITIAL GUESS <------- |
c$$$ AL_INI(4) = PIGR + datan(dreal(alfayz2_av(iyz)) |
3038 |
c print*,'AL_INI ',(al_ini(i),i=1,5) |
c$$$ $ /dreal(alfaxz2_av(ixz))) |
3039 |
|
c$$$ ELSE |
3040 |
|
c$$$ AL_INI(4) = acos(-1.)/2 |
3041 |
|
c$$$ IF(alfayz2_av(iyz).LT.0)AL_INI(4) = AL_INI(4)+acos(-1.) |
3042 |
|
c$$$ ENDIF |
3043 |
|
c$$$ IF(alfaxz2_av(ixz).LT.0)AL_INI(4)= acos(-1.)+ AL_INI(4) |
3044 |
|
c$$$ AL_INI(4) = -acos(-1.) + AL_INI(4) !from incidence direction to tracking rs |
3045 |
|
c$$$ |
3046 |
|
c$$$ AL_INI(5) = (1.e2*alfaxz3_av(ixz))/(0.3*0.43) !0. |
3047 |
|
c$$$ |
3048 |
|
c$$$ if(AL_INI(5).gt.defmax)goto 888 !next cloud |
3049 |
|
|
3050 |
if(DEBUG)then |
if(DEBUG)then |
3051 |
print*,'1 >>> ',(cp_match(6,i),i=1,ncp_match(6)) |
print*,'1 >>> ',(cp_match(6,i),i=1,ncp_match(6)) |
3052 |
print*,'2 >>> ',(cp_match(5,i),i=1,ncp_match(5)) |
print*,'2 >>> ',(cp_match(5,i),i=1,ncp_match(5)) |
3114 |
* ********************************************************** |
* ********************************************************** |
3115 |
* ************************** FIT *** FIT *** FIT *** FIT *** |
* ************************** FIT *** FIT *** FIT *** FIT *** |
3116 |
* ********************************************************** |
* ********************************************************** |
3117 |
|
cccc scommentare se si usa al_ini della nuvola |
3118 |
|
c$$$ do i=1,5 |
3119 |
|
c$$$ AL(i)=AL_INI(i) |
3120 |
|
c$$$ enddo |
3121 |
|
call guess() |
3122 |
do i=1,5 |
do i=1,5 |
3123 |
AL(i)=AL_INI(i) |
AL_INI(i)=AL(i) |
3124 |
enddo |
enddo |
3125 |
ifail=0 !error flag in chi^2 computation |
ifail=0 !error flag in chi^2 computation |
3126 |
jstep=0 !number of minimization steps |
jstep=0 !number of minimization steps |
3127 |
iprint=0 |
iprint=0 |
3128 |
|
c if(DEBUG)iprint=1 |
3129 |
if(DEBUG)iprint=1 |
if(DEBUG)iprint=1 |
3130 |
call mini2(jstep,ifail,iprint) |
call mini2(jstep,ifail,iprint) |
3131 |
if(ifail.ne.0) then |
if(ifail.ne.0) then |
3132 |
if(DEBUG)then |
if(DEBUG)then |
3133 |
print *, |
print *, |
3134 |
$ '*** MINIMIZATION FAILURE *** ' |
$ '*** MINIMIZATION FAILURE *** ' |
3135 |
$ //'(mini2 in clouds_to_ctrack)' |
$ //'(clouds_to_ctrack)' |
3136 |
|
print*,'initial guess: ' |
3137 |
|
|
3138 |
|
print*,'AL_INI(1) = ',AL_INI(1) |
3139 |
|
print*,'AL_INI(2) = ',AL_INI(2) |
3140 |
|
print*,'AL_INI(3) = ',AL_INI(3) |
3141 |
|
print*,'AL_INI(4) = ',AL_INI(4) |
3142 |
|
print*,'AL_INI(5) = ',AL_INI(5) |
3143 |
endif |
endif |
3144 |
chi2=-chi2 |
c chi2=-chi2 |
3145 |
endif |
endif |
3146 |
* ********************************************************** |
* ********************************************************** |
3147 |
* ************************** FIT *** FIT *** FIT *** FIT *** |
* ************************** FIT *** FIT *** FIT *** FIT *** |
3160 |
$ ,'( ',NTRACKSMAX,' )' |
$ ,'( ',NTRACKSMAX,' )' |
3161 |
c good2=.false. |
c good2=.false. |
3162 |
c goto 880 !fill ntp and go to next event |
c goto 880 !fill ntp and go to next event |
3163 |
|
do iv=1,nviews |
3164 |
|
mask_view(iv) = 7 |
3165 |
|
enddo |
3166 |
iflag=1 |
iflag=1 |
3167 |
return |
return |
3168 |
endif |
endif |
3261 |
c****************************************************** |
c****************************************************** |
3262 |
|
|
3263 |
include 'commontracker.f' |
include 'commontracker.f' |
3264 |
|
include 'level1.f' |
3265 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
3266 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
3267 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
3268 |
include 'common_mech.f' |
include 'common_mech.f' |
3269 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
3270 |
include 'level1.f' |
c include 'level1.f' |
3271 |
include 'calib.f' |
include 'calib.f' |
3272 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
3273 |
|
|
3274 |
* flag to chose PFA |
* flag to chose PFA |
3275 |
character*10 PFA |
character*10 PFA |
3283 |
call track_init |
call track_init |
3284 |
do ip=1,nplanes !loop on planes |
do ip=1,nplanes !loop on planes |
3285 |
|
|
3286 |
|
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
3287 |
* ------------------------------------------------- |
* ------------------------------------------------- |
3288 |
* If the plane has been already included, it just |
* If the plane has been already included, it just |
3289 |
* computes again the coordinates of the x-y couple |
* computes again the coordinates of the x-y couple |
3290 |
* using improved PFAs |
* using improved PFAs |
3291 |
* ------------------------------------------------- |
* ------------------------------------------------- |
3292 |
|
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
3293 |
if(XGOOD_STORE(nplanes-ip+1,ibest).eq.1..and. |
if(XGOOD_STORE(nplanes-ip+1,ibest).eq.1..and. |
3294 |
$ YGOOD_STORE(nplanes-ip+1,ibest).eq.1. )then |
$ YGOOD_STORE(nplanes-ip+1,ibest).eq.1. )then |
3295 |
|
|
3324 |
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) |
3325 |
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) |
3326 |
|
|
3327 |
|
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
3328 |
* ------------------------------------------------- |
* ------------------------------------------------- |
3329 |
* If the plane has NOT been already included, |
* If the plane has NOT been already included, |
3330 |
* it tries to include a COUPLE or a single cluster |
* it tries to include a COUPLE or a single cluster |
3331 |
* ------------------------------------------------- |
* ------------------------------------------------- |
3332 |
|
* ||||||||||||||||||||||||||||||||||||||||||||||||| |
3333 |
else |
else |
3334 |
|
|
3335 |
xgood(nplanes-ip+1)=0 |
xgood(nplanes-ip+1)=0 |
3384 |
$ AYV_STORE(nplanes-ip+1,ibest)) |
$ AYV_STORE(nplanes-ip+1,ibest)) |
3385 |
|
|
3386 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
3387 |
|
distance = distance / RCHI2_STORE(ibest)!<<< MS |
3388 |
id=id_cp(ip,icp,ist) |
id=id_cp(ip,icp,ist) |
3389 |
if(DEBUG)print*,'( couple ',id |
if(DEBUG)print*,'( couple ',id |
3390 |
$ ,' ) normalized distance ',distance |
$ ,' ) normalized distance ',distance |
3455 |
$ PFA,PFA, |
$ PFA,PFA, |
3456 |
$ AXV_STORE(nplanes-ip+1,ibest),0.) |
$ AXV_STORE(nplanes-ip+1,ibest),0.) |
3457 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
3458 |
c if(DEBUG)print*,'normalized distance ',distance |
distance = distance / RCHI2_STORE(ibest)!<<< MS |
3459 |
if(DEBUG)print*,'( cl-X ',icx |
if(DEBUG)print*,'( cl-X ',icx |
3460 |
$ ,' in cp ',id,' ) normalized distance ',distance |
$ ,' in cp ',id,' ) normalized distance ',distance |
3461 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
3483 |
$ PFA,PFA, |
$ PFA,PFA, |
3484 |
$ 0.,AYV_STORE(nplanes-ip+1,ibest)) |
$ 0.,AYV_STORE(nplanes-ip+1,ibest)) |
3485 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
3486 |
|
distance = distance / RCHI2_STORE(ibest)!<<< MS |
3487 |
if(DEBUG)print*,'( cl-Y ',icy |
if(DEBUG)print*,'( cl-Y ',icy |
3488 |
$ ,' in cp ',id,' ) normalized distance ',distance |
$ ,' in cp ',id,' ) normalized distance ',distance |
3489 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
3523 |
endif |
endif |
3524 |
|
|
3525 |
distance = distance_to(XP,YP) |
distance = distance_to(XP,YP) |
3526 |
|
distance = distance / RCHI2_STORE(ibest)!<<< MS |
3527 |
if(DEBUG)print*,'( cl-s ',icl |
if(DEBUG)print*,'( cl-s ',icl |
3528 |
$ ,' ) normalized distance ',distance |
$ ,' ) normalized distance ',distance |
3529 |
if(distance.lt.distmin)then |
if(distance.lt.distmin)then |
3553 |
|
|
3554 |
CLS_STORE(nplanes-ip+1,ibest)=iclm !<<<< |
CLS_STORE(nplanes-ip+1,ibest)=iclm !<<<< |
3555 |
* ---------------------------- |
* ---------------------------- |
3556 |
|
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
3557 |
if(mod(VIEW(iclm),2).eq.0)then |
if(mod(VIEW(iclm),2).eq.0)then |
3558 |
XGOOD(nplanes-ip+1)=1. |
XGOOD(nplanes-ip+1)=1. |
3559 |
resx(nplanes-ip+1)=rxmm |
resx(nplanes-ip+1)=rxmm |
3560 |
if(DEBUG)print*,'%%%% included X-cl ',iclm |
if(DEBUG)print*,'%%%% included X-cl ',iclm |
3561 |
$ ,' ( norm.dist.= ',distmin,', cut ',clinc,' )' |
c if(.true.)print*,'%%%% included X-cl ',iclm |
3562 |
|
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
3563 |
|
$ ,', norm.dist.= ',distmin |
3564 |
|
$ ,', cut ',clinc,' )' |
3565 |
else |
else |
3566 |
YGOOD(nplanes-ip+1)=1. |
YGOOD(nplanes-ip+1)=1. |
3567 |
resy(nplanes-ip+1)=rymm |
resy(nplanes-ip+1)=rymm |
3568 |
if(DEBUG)print*,'%%%% included Y-cl ',iclm |
if(DEBUG)print*,'%%%% included Y-cl ',iclm |
3569 |
$ ,' ( norm.dist.= ',distmin,', cut ',clinc,' )' |
c if(.true.)print*,'%%%% included Y-cl ',iclm |
3570 |
|
$ ,'( chi^2, ',RCHI2_STORE(ibest) |
3571 |
|
$ ,', norm.dist.= ', distmin |
3572 |
|
$ ,', cut ',clinc,' )' |
3573 |
endif |
endif |
3574 |
|
c print*,'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
3575 |
* ---------------------------- |
* ---------------------------- |
3576 |
xm_A(nplanes-ip+1) = xmm_A |
xm_A(nplanes-ip+1) = xmm_A |
3577 |
ym_A(nplanes-ip+1) = ymm_A |
ym_A(nplanes-ip+1) = ymm_A |
3605 |
subroutine clean_XYclouds(ibest,iflag) |
subroutine clean_XYclouds(ibest,iflag) |
3606 |
|
|
3607 |
include 'commontracker.f' |
include 'commontracker.f' |
3608 |
|
include 'level1.f' |
3609 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
3610 |
include 'momanhough_init.f' |
c include 'momanhough_init.f' |
3611 |
include 'level2.f' !(1) |
include 'level2.f' !(1) |
3612 |
c include 'calib.f' |
c include 'calib.f' |
3613 |
c include 'level1.f' |
c include 'level1.f' |
3614 |
|
|
|
c logical DEBUG |
|
|
c common/dbg/DEBUG |
|
3615 |
|
|
3616 |
|
|
3617 |
do ip=1,nplanes !loop on planes |
do ip=1,nplanes !loop on planes |
3787 |
|
|
3788 |
subroutine init_level2 |
subroutine init_level2 |
3789 |
|
|
|
c***************************************************** |
|
|
c 07/10/2005 modified by elena vannuccini --> (1) |
|
|
c***************************************************** |
|
|
|
|
3790 |
include 'commontracker.f' |
include 'commontracker.f' |
3791 |
|
include 'level1.f' |
3792 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
3793 |
include 'level2.f' |
include 'level2.f' |
3794 |
include 'level1.f' |
c include 'level1.f' |
3795 |
|
|
3796 |
do i=1,nviews |
do i=1,nviews |
3797 |
good2(i)=good1(i) |
good2(i)=good1(i) |
3798 |
enddo |
enddo |
3799 |
|
|
|
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***************************************************** |
|
3800 |
|
|
3801 |
NTRK = 0 |
NTRK = 0 |
3802 |
do it=1,NTRKMAX!NTRACKSMAX |
do it=1,NTRKMAX |
3803 |
IMAGE(IT)=0 |
IMAGE(IT)=0 |
3804 |
CHI2_nt(IT) = -100000. |
CHI2_nt(IT) = -100000. |
|
c BdL(IT) = 0. |
|
3805 |
do ip=1,nplanes |
do ip=1,nplanes |
3806 |
XM_nt(IP,IT) = 0 |
XM_nt(IP,IT) = 0 |
3807 |
YM_nt(IP,IT) = 0 |
YM_nt(IP,IT) = 0 |
3810 |
RESY_nt(IP,IT) = 0 |
RESY_nt(IP,IT) = 0 |
3811 |
XGOOD_nt(IP,IT) = 0 |
XGOOD_nt(IP,IT) = 0 |
3812 |
YGOOD_nt(IP,IT) = 0 |
YGOOD_nt(IP,IT) = 0 |
|
c***************************************************** |
|
|
cccccc 11/9/2005 modified by david fedele |
|
3813 |
DEDX_X(IP,IT) = 0 |
DEDX_X(IP,IT) = 0 |
3814 |
DEDX_Y(IP,IT) = 0 |
DEDX_Y(IP,IT) = 0 |
|
c****************************************************** |
|
|
cccccc 17/8/2006 modified by elena |
|
3815 |
CLTRX(IP,IT) = 0 |
CLTRX(IP,IT) = 0 |
3816 |
CLTRY(IP,IT) = 0 |
CLTRY(IP,IT) = 0 |
3817 |
enddo |
enddo |
3822 |
enddo |
enddo |
3823 |
enddo |
enddo |
3824 |
enddo |
enddo |
|
|
|
|
|
|
|
c***************************************************** |
|
|
cccccc 11/9/2005 modified by david fedele |
|
3825 |
nclsx=0 |
nclsx=0 |
3826 |
nclsy=0 |
nclsy=0 |
3827 |
do ip=1,NSINGMAX |
do ip=1,NSINGMAX |
3828 |
planex(ip)=0 |
planex(ip)=0 |
|
c xs(ip)=0 |
|
3829 |
xs(1,ip)=0 |
xs(1,ip)=0 |
3830 |
xs(2,ip)=0 |
xs(2,ip)=0 |
3831 |
sgnlxs(ip)=0 |
sgnlxs(ip)=0 |
3832 |
planey(ip)=0 |
planey(ip)=0 |
|
c ys(ip)=0 |
|
3833 |
ys(1,ip)=0 |
ys(1,ip)=0 |
3834 |
ys(2,ip)=0 |
ys(2,ip)=0 |
3835 |
sgnlys(ip)=0 |
sgnlys(ip)=0 |
3836 |
enddo |
enddo |
|
c******************************************************* |
|
3837 |
end |
end |
3838 |
|
|
3839 |
|
|
3848 |
************************************************************ |
************************************************************ |
3849 |
|
|
3850 |
|
|
3851 |
|
subroutine init_hough |
3852 |
|
|
3853 |
|
include 'commontracker.f' |
3854 |
|
include 'level1.f' |
3855 |
|
include 'common_momanhough.f' |
3856 |
|
include 'common_hough.f' |
3857 |
|
include 'level2.f' |
3858 |
|
|
3859 |
|
ntrpt_nt=0 |
3860 |
|
ndblt_nt=0 |
3861 |
|
NCLOUDS_XZ_nt=0 |
3862 |
|
NCLOUDS_YZ_nt=0 |
3863 |
|
do idb=1,ndblt_max_nt |
3864 |
|
db_cloud_nt(idb)=0 |
3865 |
|
alfayz1_nt(idb)=0 |
3866 |
|
alfayz2_nt(idb)=0 |
3867 |
|
enddo |
3868 |
|
do itr=1,ntrpl_max_nt |
3869 |
|
tr_cloud_nt(itr)=0 |
3870 |
|
alfaxz1_nt(itr)=0 |
3871 |
|
alfaxz2_nt(itr)=0 |
3872 |
|
alfaxz3_nt(itr)=0 |
3873 |
|
enddo |
3874 |
|
do idb=1,ncloyz_max |
3875 |
|
ptcloud_yz_nt(idb)=0 |
3876 |
|
alfayz1_av_nt(idb)=0 |
3877 |
|
alfayz2_av_nt(idb)=0 |
3878 |
|
enddo |
3879 |
|
do itr=1,ncloxz_max |
3880 |
|
ptcloud_xz_nt(itr)=0 |
3881 |
|
alfaxz1_av_nt(itr)=0 |
3882 |
|
alfaxz2_av_nt(itr)=0 |
3883 |
|
alfaxz3_av_nt(itr)=0 |
3884 |
|
enddo |
3885 |
|
|
3886 |
|
ntrpt=0 |
3887 |
|
ndblt=0 |
3888 |
|
NCLOUDS_XZ=0 |
3889 |
|
NCLOUDS_YZ=0 |
3890 |
|
do idb=1,ndblt_max |
3891 |
|
db_cloud(idb)=0 |
3892 |
|
cpyz1(idb)=0 |
3893 |
|
cpyz2(idb)=0 |
3894 |
|
alfayz1(idb)=0 |
3895 |
|
alfayz2(idb)=0 |
3896 |
|
enddo |
3897 |
|
do itr=1,ntrpl_max |
3898 |
|
tr_cloud(itr)=0 |
3899 |
|
cpxz1(itr)=0 |
3900 |
|
cpxz2(itr)=0 |
3901 |
|
cpxz3(itr)=0 |
3902 |
|
alfaxz1(itr)=0 |
3903 |
|
alfaxz2(itr)=0 |
3904 |
|
alfaxz3(itr)=0 |
3905 |
|
enddo |
3906 |
|
do idb=1,ncloyz_max |
3907 |
|
ptcloud_yz(idb)=0 |
3908 |
|
alfayz1_av(idb)=0 |
3909 |
|
alfayz2_av(idb)=0 |
3910 |
|
do idbb=1,ncouplemaxtot |
3911 |
|
cpcloud_yz(idb,idbb)=0 |
3912 |
|
enddo |
3913 |
|
enddo |
3914 |
|
do itr=1,ncloxz_max |
3915 |
|
ptcloud_xz(itr)=0 |
3916 |
|
alfaxz1_av(itr)=0 |
3917 |
|
alfaxz2_av(itr)=0 |
3918 |
|
alfaxz3_av(itr)=0 |
3919 |
|
do itrr=1,ncouplemaxtot |
3920 |
|
cpcloud_xz(itr,itrr)=0 |
3921 |
|
enddo |
3922 |
|
enddo |
3923 |
|
end |
3924 |
|
************************************************************ |
3925 |
|
* |
3926 |
|
* |
3927 |
|
* |
3928 |
|
* |
3929 |
|
* |
3930 |
|
* |
3931 |
|
* |
3932 |
|
************************************************************ |
3933 |
|
|
3934 |
|
|
3935 |
subroutine fill_level2_tracks(ntr) |
subroutine fill_level2_tracks(ntr) |
3936 |
|
|
3937 |
* ------------------------------------------------------- |
* ------------------------------------------------------- |
3942 |
|
|
3943 |
|
|
3944 |
include 'commontracker.f' |
include 'commontracker.f' |
3945 |
|
c include 'level1.f' |
3946 |
include 'level1.f' |
include 'level1.f' |
3947 |
|
include 'common_momanhough.f' |
3948 |
include 'level2.f' |
include 'level2.f' |
3949 |
include 'common_mini_2.f' |
include 'common_mini_2.f' |
3950 |
include 'common_momanhough.f' |
real sinth,phi,pig |
|
real sinth,phi,pig !(4) |
|
3951 |
pig=acos(-1.) |
pig=acos(-1.) |
3952 |
|
|
|
c good2=1!.true. |
|
3953 |
chi2_nt(ntr) = sngl(chi2) |
chi2_nt(ntr) = sngl(chi2) |
3954 |
nstep_nt(ntr) = nstep |
nstep_nt(ntr) = nstep |
3955 |
|
|
3956 |
phi = al(4) !(4) |
phi = al(4) |
3957 |
sinth = al(3) !(4) |
sinth = al(3) |
3958 |
if(sinth.lt.0)then !(4) |
if(sinth.lt.0)then |
3959 |
sinth = -sinth !(4) |
sinth = -sinth |
3960 |
phi = phi + pig !(4) |
phi = phi + pig |
3961 |
endif !(4) |
endif |
3962 |
npig = aint(phi/(2*pig)) !(4) |
npig = aint(phi/(2*pig)) |
3963 |
phi = phi - npig*2*pig !(4) |
phi = phi - npig*2*pig |
3964 |
if(phi.lt.0) !(4) |
if(phi.lt.0) |
3965 |
$ phi = phi + 2*pig !(4) |
$ phi = phi + 2*pig |
3966 |
al(4) = phi !(4) |
al(4) = phi |
3967 |
al(3) = sinth !(4) |
al(3) = sinth |
3968 |
***************************************************** |
|
3969 |
do i=1,5 |
do i=1,5 |
3970 |
al_nt(i,ntr) = sngl(al(i)) |
al_nt(i,ntr) = sngl(al(i)) |
3971 |
do j=1,5 |
do j=1,5 |
3972 |
coval(i,j,ntr) = sngl(cov(i,j)) |
coval(i,j,ntr) = sngl(cov(i,j)) |
3973 |
enddo |
enddo |
|
c print*,al_nt(i,ntr) |
|
3974 |
enddo |
enddo |
3975 |
|
|
3976 |
do ip=1,nplanes ! loop on planes |
do ip=1,nplanes ! loop on planes |
3986 |
zv_nt(ip,ntr) = sngl(zv(ip)) |
zv_nt(ip,ntr) = sngl(zv(ip)) |
3987 |
axv_nt(ip,ntr) = sngl(axv(ip)) |
axv_nt(ip,ntr) = sngl(axv(ip)) |
3988 |
ayv_nt(ip,ntr) = sngl(ayv(ip)) |
ayv_nt(ip,ntr) = sngl(ayv(ip)) |
|
c dedxp(ip,ntr) = sngl(dedxtrk(ip)) !(1) |
|
3989 |
dedx_x(ip,ntr) = sngl(dedxtrk_x(ip)) !(2) |
dedx_x(ip,ntr) = sngl(dedxtrk_x(ip)) !(2) |
3990 |
dedx_y(ip,ntr) = sngl(dedxtrk_y(ip)) !(2) |
dedx_y(ip,ntr) = sngl(dedxtrk_y(ip)) !(2) |
3991 |
|
|
4002 |
endif |
endif |
4003 |
|
|
4004 |
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) |
|
4005 |
|
|
4006 |
|
|
4007 |
end |
end |
4008 |
|
|
4009 |
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***************************************************** |
|
4010 |
|
|
4011 |
* ------------------------------------------------------- |
* ------------------------------------------------------- |
4012 |
* This routine fills the elements of the variables |
* This routine fills the elements of the variables |
4015 |
* ------------------------------------------------------- |
* ------------------------------------------------------- |
4016 |
|
|
4017 |
include 'commontracker.f' |
include 'commontracker.f' |
4018 |
include 'level1.f' |
c include 'level1.f' |
|
include 'level2.f' |
|
4019 |
include 'calib.f' |
include 'calib.f' |
4020 |
|
include 'level1.f' |
4021 |
include 'common_momanhough.f' |
include 'common_momanhough.f' |
4022 |
|
include 'level2.f' |
4023 |
include 'common_xyzPAM.f' |
include 'common_xyzPAM.f' |
4024 |
|
|
4025 |
* count #cluster per plane not associated to any track |
* count #cluster per plane not associated to any track |
4027 |
nclsx = 0 |
nclsx = 0 |
4028 |
nclsy = 0 |
nclsy = 0 |
4029 |
|
|
4030 |
|
do iv = 1,nviews |
4031 |
|
if( mask_view(iv).ne.0 )good2(iv) = 20+mask_view(iv) |
4032 |
|
enddo |
4033 |
|
|
4034 |
do icl=1,nclstr1 |
do icl=1,nclstr1 |
4035 |
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 |
4036 |
ip=nplanes-npl(VIEW(icl))+1 |
ip=nplanes-npl(VIEW(icl))+1 |
4074 |
enddo |
enddo |
4075 |
end |
end |
4076 |
|
|
4077 |
|
*************************************************** |
4078 |
|
* * |
4079 |
|
* * |
4080 |
|
* * |
4081 |
|
* * |
4082 |
|
* * |
4083 |
|
* * |
4084 |
|
************************************************** |
4085 |
|
|
4086 |
|
subroutine fill_hough |
4087 |
|
|
4088 |
|
* ------------------------------------------------------- |
4089 |
|
* This routine fills the variables related to the hough |
4090 |
|
* transform, for the debig n-tuple |
4091 |
|
* ------------------------------------------------------- |
4092 |
|
|
4093 |
|
include 'commontracker.f' |
4094 |
|
include 'level1.f' |
4095 |
|
include 'common_momanhough.f' |
4096 |
|
include 'common_hough.f' |
4097 |
|
include 'level2.f' |
4098 |
|
|
4099 |
|
if(.false. |
4100 |
|
$ .or.ntrpt.gt.ntrpt_max_nt |
4101 |
|
$ .or.ndblt.gt.ndblt_max_nt |
4102 |
|
$ .or.NCLOUDS_XZ.gt.ncloxz_max |
4103 |
|
$ .or.NCLOUDS_yZ.gt.ncloyz_max |
4104 |
|
$ )then |
4105 |
|
ntrpt_nt=0 |
4106 |
|
ndblt_nt=0 |
4107 |
|
NCLOUDS_XZ_nt=0 |
4108 |
|
NCLOUDS_YZ_nt=0 |
4109 |
|
else |
4110 |
|
ndblt_nt=ndblt |
4111 |
|
ntrpt_nt=ntrpt |
4112 |
|
if(ndblt.ne.0)then |
4113 |
|
do id=1,ndblt |
4114 |
|
alfayz1_nt(id)=alfayz1(id) !Y0 |
4115 |
|
alfayz2_nt(id)=alfayz2(id) !tg theta-yz |
4116 |
|
enddo |
4117 |
|
endif |
4118 |
|
if(ndblt.ne.0)then |
4119 |
|
do it=1,ntrpt |
4120 |
|
alfaxz1_nt(it)=alfaxz1(it) !X0 |
4121 |
|
alfaxz2_nt(it)=alfaxz2(it) !tg theta-xz |
4122 |
|
alfaxz3_nt(it)=alfaxz3(it) !1/r |
4123 |
|
enddo |
4124 |
|
endif |
4125 |
|
nclouds_yz_nt=nclouds_yz |
4126 |
|
nclouds_xz_nt=nclouds_xz |
4127 |
|
if(nclouds_yz.ne.0)then |
4128 |
|
nnn=0 |
4129 |
|
do iyz=1,nclouds_yz |
4130 |
|
ptcloud_yz_nt(iyz)=ptcloud_yz(iyz) |
4131 |
|
alfayz1_av_nt(iyz)=alfayz1_av(iyz) |
4132 |
|
alfayz2_av_nt(iyz)=alfayz2_av(iyz) |
4133 |
|
nnn=nnn+ptcloud_yz(iyz) |
4134 |
|
enddo |
4135 |
|
do ipt=1,nnn |
4136 |
|
db_cloud_nt(ipt)=db_cloud(ipt) |
4137 |
|
enddo |
4138 |
|
endif |
4139 |
|
if(nclouds_xz.ne.0)then |
4140 |
|
nnn=0 |
4141 |
|
do ixz=1,nclouds_xz |
4142 |
|
ptcloud_xz_nt(ixz)=ptcloud_xz(ixz) |
4143 |
|
alfaxz1_av_nt(ixz)=alfaxz1_av(ixz) |
4144 |
|
alfaxz2_av_nt(ixz)=alfaxz2_av(ixz) |
4145 |
|
alfaxz3_av_nt(ixz)=alfaxz3_av(ixz) |
4146 |
|
nnn=nnn+ptcloud_xz(ixz) |
4147 |
|
enddo |
4148 |
|
do ipt=1,nnn |
4149 |
|
tr_cloud_nt(ipt)=tr_cloud(ipt) |
4150 |
|
enddo |
4151 |
|
endif |
4152 |
|
endif |
4153 |
|
end |
4154 |
|
|