--- DarthVader/TrackerLevel2/src/F77/reductionflight.f 2006/08/04 08:18:06 1.4 +++ DarthVader/TrackerLevel2/src/F77/reductionflight.f 2006/09/05 12:52:21 1.5 @@ -48,7 +48,8 @@ c-------------------------------------------------- do iv=1,nviews do ik=1,nva1_view - cn(iv,ik)=0 + cn(iv,ik) = 0 + cnn(iv,ik) = -1 mask_vk_ev(iv,ik)=1 iflag=0 if(mask_vk(iv,ik).eq.1)call cncomp(iv,ik,iflag) @@ -63,7 +64,7 @@ c ierror = 220 c endif - call stripmask !compute mask(i,j,k) + call stripmask !compute mask(i,j,k), combining mask_vk_ev and mask_vk c--------------------------------------------- c loops on views, VA1 and strips, c and computes strips signals using @@ -72,6 +73,7 @@ c--------------------------------------------- flag_shower = .false. ind=1 !clsignal array index + do iv=1,nviews !loop on views do is=1,nstrips_view !loop on strips (1) if(mod(iv,2).eq.1) then @@ -101,16 +103,24 @@ c $ print*,iv,is,' --- (ADC_PED_CN) ',value(is),clseedcut(is) enddo !end loop on strips (1) call search_cluster(iv) - if(flag_shower.eqv..true.)then - call init_level1 - good1=0 - goto 200 !jump to next event +c$$$ if(flag_shower.eqv..true.)then +c$$$ call init_level1 +c$$$ good1=0 +c$$$ goto 200 !jump to next event +c$$$ endif +ccc +ccc modified by Elena (08/2006) +ccc + if(.not.flag_shower)then + call save_cluster(iv) + else + fshower(iv) = 1 endif enddo ! end loop on views do iv=1,nviews do ik=1,nva1_view - cnev(iv,ik)=cn(iv,ik) !assigns computed CN to ntuple variables - cnevflag(iv,ik)=cnflag(iv,ik) !assigns computed CN to ntuple variables + cnev(iv,ik) = cn(iv,ik) !assigns computed CN to ntuple variables + cnnev(iv,ik) = cnn(iv,ik) !assigns computed CN to ntuple variables ccc print*,"cnev(",iv,",",ik,")(reduction)= ",cnev(iv,ik) enddo enddo @@ -146,26 +156,33 @@ include 'level1.f' include 'level0.f' - good1=0 - nclstr1=0 - totCLlength=0 + good1 = 0 + nclstr1 = 0 + totCLlength = 0 do ic=1,nclstrmax - view(ic)=0 - ladder(ic)=0 - indstart(ic)=0 - indmax(ic)=0 - maxs(ic)=0 - mult(ic)=0 - dedx(ic)=0 + view(ic) = 0 + ladder(ic) = 0 + indstart(ic) = 0 + indmax(ic) = 0 + maxs(ic) = 0 + mult(ic) = 0 + dedx(ic) = 0 + whichtrack(ic) = 0 + enddo do id=1,maxlength !??? - clsignal(id)=0. + clsignal(id) = 0. + clsigma(id) = 0. + cladc(id) = 0. + clbad(id) = 0. enddo do iv=1,nviews c crc1(iv)=0 do ik=1,nva1_view - cnev(iv,ik)=0 + cnev(iv,ik) = 0 + cnnev(iv,ik) = 0 enddo + fshower(iv) = 0 enddo return @@ -181,11 +198,11 @@ subroutine search_cluster(iv) include 'commontracker.f' - include 'common_reduction.f' include 'level0.f' include 'level1.f' include 'calib.f' + include 'common_reduction.f' c local variables @@ -196,8 +213,6 @@ integer multtemp !temporary multiplicity variable - integer CLlength !lunghezza in strip del cluster - external nst c------------------------------------------------------------------------ @@ -228,6 +243,8 @@ iseed=-999 !cluster seed index initialization + nclstr_view=0 + do jl=1,nladders_view !1..3 !loops on ladders first=1+nstrips_ladder*(jl-1) !1,1025,2049 last=nstrips_ladder*jl !1024,2048,3072 @@ -238,20 +255,32 @@ endif do is=first,last !loop on strips in each ladder if(is.le.iseed+1) goto 220 -c----------------------------------------- -c after a cluster seed as been found, -c look for next one skipping one strip on the right -c (i.e. look for double peak cluster) -c----------------------------------------- - if(is.ne.first) then - if(value(is).le.value(is-1)) goto 220 - endif -c----------------------------------------- -c skips cluster seed -c finding if strips values are descreasing (a strip -c can be a cluster seed only if previous strip value -c is lower) -c----------------------------------------- +******************************************************* +* Elena 08/2006 +* QUESTA PARTE NON E` ADEGUATA per cluster con grossi rilasci di carica +* perche` salva molte volte lo stesso cluster +* (salvo il cluster rispetto al massimo e basta...) +******************************************************* +c$$$c----------------------------------------- +c$$$c after a cluster seed as been found, +c$$$c look for next one skipping one strip on the right +c$$$c (i.e. look for double peak cluster) +c$$$c----------------------------------------- +c$$$ if(is.ne.first) then +c$$$ if(value(is).le.value(is-1)) goto 220 +c$$$ endif +c$$$c----------------------------------------- +c$$$c skips cluster seed +c$$$c finding if strips values are descreasing (a strip +c$$$c can be a cluster seed only if previous strip value +c$$$c is lower) +c$$$c----------------------------------------- +******************************************************* +* LA RICERCA PARTE DALL'ULTIMA STRIP SALVATA (***TEMPORANEO****) +******************************************************* + if(is.le.iseed+rmax+1) goto 220 +******************************************************* + if(value(is).gt.clseedcut(is)) then ccc print*,"value(",is,")=",value(is), ccc $ " .gt.clseedcut(",is,")=",clseedcut(is) @@ -260,10 +289,18 @@ c----------------------------------------- itemp=is if(itemp.eq.last) goto 230 !estremo... - do while(value(itemp) - $ /sigma(iv,nvk(itemp),nst(itemp)) - $ .le.value(itemp+1) - $ /sigma(iv,nvk(itemp+1),nst(itemp+1))) !BIAS: aggiustare il caso uguale!??? +**************************************************** +* modificato da Elena (08/2006) per salvare +* il cluster intorno al massimo assoluto +**************************************************** +c$$$ do while(value(itemp) +c$$$ $ /sigma(iv,nvk(itemp),nst(itemp)) +c$$$ $ .le.value(itemp+1) +c$$$ $ /sigma(iv,nvk(itemp+1),nst(itemp+1))) !BIAS: aggiustare il caso uguale!??? +c$$$ itemp=itemp+1 +c$$$ if(itemp.eq.last) goto 230 !stops if reaches last strip +c$$$ enddo ! of the ladder + do while(value(itemp).le.value(itemp+1)) itemp=itemp+1 if(itemp.eq.last) goto 230 !stops if reaches last strip enddo ! of the ladder @@ -473,37 +510,61 @@ c-------------------------------------------------------- c fills cluster variables c-------------------------------------------------------- - nclstr1=nclstr1+1 !cluster number -ccc print*,nclstr1,multtemp - if(nclstr1.gt.nclstrmax) then !too many clusters for the event: - if(verbose)print*,'Event ',eventn(1), - $ ': more than ',nclstrmax,' clusters' - good1=0 ! event - nclstr1=0 - totCLlength=0 +c$$$ nclstr1=nclstr1+1 !cluster number +c$$$ccc print*,nclstr1,multtemp +c$$$ if(nclstr1.gt.nclstrmax) then !too many clusters for the event: +c$$$ if(verbose)print*,'Event ',eventn(1), +c$$$ $ ': more than ',nclstrmax,' clusters' +c$$$ good1=0 ! event +c$$$ nclstr1=0 +c$$$ totCLlength=0 +c$$$ flag_shower = .true. +c$$$ goto 2000 +c$$$ endif +c$$$ view(nclstr1) = iv !vista del cluster +c$$$ ladder(nclstr1) = nld(iseed,iv) !ladder a cui appartiene il cluster seed +c$$$ maxs(nclstr1) = iseed !strip del cluster seed +c$$$ mult(nclstr1) = multtemp !molteplicita' +c$$$ +c$$$ indstart(nclstr1) = ind !posizione dell'inizio del cluster nell' +c$$$c ! array clsignal +c$$$ indmax(nclstr1) = indstart(nclstr1)+(iseed-lmax) !posizione del +c$$$c ! cluster seed nell'array clsignal +c$$$ +c$$$ CLlength = rmax-lmax+1 !numero di strip del cluster +c$$$ totCLlength = totCLlength+CLlength +c$$$ dedx(nclstr1) = 0 +c$$$ do j=lmax,rmax !stores sequentially cluter strip values in +c$$$ clsignal(ind) = value(j) ! clsignal array +c$$$ ind=ind+1 +c$$$c if(value(j).gt.0) +c$$$ if(value(j).gt.clinclcut(j)) +c$$$ $ dedx(nclstr1) = dedx(nclstr1) + value(j) !cluster charge +c$$$ enddo +ccc +ccc *** Modified by Elena (08/2006) *** +ccc + nclstr_view = nclstr_view + 1 !cluster number +c print*,'view ',iv,' -- search_cluster -- nclstr_view: ' +c $ ,nclstr_view + if(nclstr_view.gt.nclstrmax_view) then !too many clusters for the view: + if(verbose) print*,'Event ',eventn(1), + $ ': more than ',nclstrmax_view + $ ,' clusters on view ',iv +c good1=0 ! event +c nclstr1=0 +c totCLlength=0 flag_shower = .true. goto 2000 endif - view(nclstr1)=iv !vista del cluster - ladder(nclstr1)=nld(iseed,iv) !ladder a cui appartiene il cluster seed - maxs(nclstr1)=iseed !strip del cluster seed - mult(nclstr1)=multtemp !molteplicita' - - indstart(nclstr1)=ind !posizione dell'inizio del cluster nell' - ! array clsignal - indmax(nclstr1)=indstart(nclstr1)+(iseed-lmax) !posizione del - ! cluster seed nell'array clsignal - - CLlength=rmax-lmax+1 !numero di strip del cluster - totCLlength=totCLlength+CLlength - dedx(nclstr1)=0 - do j=lmax,rmax !stores sequentially cluter strip values in - clsignal(ind)=value(j) ! clsignal array - ind=ind+1 -c if(value(j).gt.0) - if(value(j).gt.clinclcut(j)) - $ dedx(nclstr1)=dedx(nclstr1)+value(j) !cluster charge - enddo + +c view(nclstr1) = iv !vista del cluster + ladder_view(nclstr_view) = nld(iseed,iv) !ladder a cui appartiene il cluster seed + maxs_view(nclstr_view) = iseed !strip del cluster seed + mult_view(nclstr_view) = multtemp !molteplicita' + rmax_view(nclstr_view) = rmax + lmax_view(nclstr_view) = lmax + c-------------------------------------------------------- c c-------------------------------------------------------- @@ -525,6 +586,68 @@ * *---***---***---***---***---***---***---***---*** + subroutine save_cluster(iv) +* +* (080/2006 Elena Vannuccini) +* Save the clusters view by view + + include 'commontracker.f' + include 'level1.f' + include 'calib.f' + include 'common_reduction.f' + + integer CLlength !lunghezza in strip del cluster + + do ic=1,nclstr_view + + nclstr1 = nclstr1+1 + view(nclstr1) = iv + ladder(nclstr1) = ladder_view(ic) + maxs(nclstr1) = maxs_view(ic) + mult(nclstr1) = mult_view(ic) + +c posizione dell'inizio del cluster nell' array clsignal + indstart(nclstr1) = ind +c posizione del cluster seed nell'array clsignal + indmax(nclstr1) = indstart(nclstr1) + $ +( maxs_view(ic) - lmax_view(ic) ) + + CLlength = rmax_view(ic) - lmax_view(ic) + 1 !numero di strip salvate + totCLlength = totCLlength + CLlength + dedx(nclstr1) = 0 + do j=lmax_view(ic),rmax_view(ic) !stores sequentially cluter strip values in + + clsignal(ind) = value(j) ! clsignal array + + ivk=nvk(j) + ist=nst(j) + + clsigma(ind) = sigma(iv,ivk,ist) + cladc(ind) = adc(iv,ivk,ist) + clbad(ind) = bad(iv,ivk,ist) +c clped(ind) = pedestal(iv,ivk,ist) + + ind=ind+1 +c if(value(j).gt.0) + if(value(j).gt.clinclcut(j)) + $ dedx(nclstr1) = dedx(nclstr1) + value(j) !cluster charge + enddo + +c print*,'view ',iv,' -- save_cluster -- nclstr1: ' +c $ ,nclstr1,maxs(nclstr1),mult(nclstr1),dedx(nclstr1) + + enddo + + return + end +*---***---***---***---***---***---***---***---*** +* +* +* +* +* +*---***---***---***---***---***---***---***---*** + subroutine stripmask @@ -535,7 +658,7 @@ * mask_vk(nviews,nva1_view) !VA1 mask * include 'commontracker.f' -c include 'level1.f' + include 'level1.f' include 'common_reduction.f' include 'calib.f'