/[PAMELA software]/DarthVader/TrackerLevel2/src/F77/reductionflight.f
ViewVC logotype

Annotation of /DarthVader/TrackerLevel2/src/F77/reductionflight.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations) (download)
Fri Sep 29 08:13:04 2006 UTC (18 years, 2 months ago) by pam-fi
Branch: MAIN
Changes since 1.6: +5 -1 lines
bug fixed

1 mocchiut 1.1 *************************************************************************
2     *
3     * Program reductionflight.f
4     *
5     * - reads readraw.f output files: LEVEL0 ntuple, and ped, sig and bad histograms
6     * - decodes raw data (DATATRACKER) using DSP ped, sig and bad values
7     * - looks for clusters information using ped, sig and bad values from
8     * DSP histograms
9     * - fills LEVEL1 ntuple
10     *
11     *************************************************************************
12    
13 pam-fi 1.2 subroutine reductionflight(ierror)
14 mocchiut 1.1
15     include 'commontracker.f'
16     include 'level0.f'
17     include 'level1.f'
18     include 'common_reduction.f'
19     include 'calib.f'
20    
21 pam-fi 1.6 data eventn_old/nviews*0/
22    
23 pam-fi 1.2 integer ierror
24     ierror = 0
25 mocchiut 1.1
26     * -------------------------------------------------------
27     * STRIP MASK
28     * -------------------------------------------------------
29    
30 pam-fi 1.4 c call stripmask !called later, after CN computation
31 mocchiut 1.1 call init_level1
32    
33 pam-fi 1.6 c good1 = good0
34     c--------------------------------------------------
35     c check the LEVEL0 event status for missing
36     c sections or DSP alarms
37     c ==> set the variable GOOD1(12)
38     c--------------------------------------------------
39     do iv=1,nviews
40     if(DSPnumber(iv).gt.0.and.DSPnumber(iv).le.12)then
41     c ------------------------
42     c GOOD
43     c ------------------------
44     GOOD1(DSPnumber(iv))=0 !OK
45     c ------------------------
46     c CRC error
47     c ------------------------
48     if(crc(iv).eq.1) then
49     GOOD1(DSPnumber(iv)) = 2
50     goto 18 !next view
51     endif
52     c ------------------------
53     c online-software alarm
54     c ------------------------
55     if(
56     $ fl1(iv).ne.0.or.
57     $ fl2(iv).ne.0.or.
58     $ fl3(iv).ne.0.or.
59     $ fl4(iv).ne.0.or.
60     $ fl5(iv).ne.0.or.
61     $ fl6(iv).ne.0.or.
62     $ fc(iv).ne.0.or.
63     $ DATAlength(iv).eq.0.or.
64     $ .false.)then
65     GOOD1(DSPnumber(iv))=3
66     goto 18
67     endif
68     c ------------------------
69     c DSP-counter jump
70     c ------------------------
71     if(
72     $ eventn_old(iv).ne.0.and. !first event in this file
73     $ eventn(iv).ne.1.and. !first event in run
74     $ good_old(DSPnumber(iv)).ne.0.and. !previous event corrupted
75     $ .true.)then
76    
77     if(eventn(iv).ne.(eventn_old(iv)+1))then
78     GOOD1(DSPnumber(iv))=4
79     goto 18
80     endif
81    
82     endif
83     c ------------------------
84     18 continue
85     endif
86     enddo
87    
88     ngood = 0
89     do iv = 1,nviews
90     eventn_old(iv) = eventn(iv)
91     good_old(iv) = good1(iv)
92     ngood = ngood + good1(iv)
93     enddo
94     c if(ngood.ne.0)print*,'* WARNING * LEVEL0 event status: '
95     c $ ,(good1(i),i=1,nviews)
96 mocchiut 1.1 c--------------------------------------------------
97     c read the variable DATATRACKER from LEVEL0
98 pam-fi 1.6 c and fill the variable ADC (invertin view 11)
99 mocchiut 1.1 c--------------------------------------------------
100     call filladc(iflag)
101     if(iflag.ne.0)then
102 pam-fi 1.6 c good1=0!<<<<<<<<<<<<<<<
103 pam-fi 1.2 c if(DEBUG)print*,'event ',eventn(1),' >>>>> decode ERROR'
104 pam-fi 1.6 ierror = 220
105     c goto 200
106     c print*,'filladc error'
107 mocchiut 1.1 endif
108    
109     c--------------------------------------------------
110     c computes common noise for each VA1
111     c (excluding strips affected by signal,
112     c tagged with the flag CLSTR)
113     c--------------------------------------------------
114     do iv=1,nviews
115     do ik=1,nva1_view
116 pam-fi 1.5 cn(iv,ik) = 0
117     cnn(iv,ik) = -1
118 pam-fi 1.4 mask_vk_ev(iv,ik)=1
119 pam-fi 1.2 iflag=0
120     if(mask_vk(iv,ik).eq.1)call cncomp(iv,ik,iflag)
121 pam-fi 1.4 c if(iflag.ne.0)good1=0
122     if(iflag.ne.0)then
123     mask_vk_ev(iv,ik)=0
124     ierror = 220
125 pam-fi 1.7 if(verbose)
126     $ print*,' * WARNING * Event ',eventn(1)
127     $ ,': masked vk ',ik,' on view',iv
128 pam-fi 1.4 endif
129 mocchiut 1.1 enddo
130     enddo
131 pam-fi 1.4 c if(good1.eq.0)then
132     c ierror = 220
133     c endif
134 mocchiut 1.1
135 pam-fi 1.5 call stripmask !compute mask(i,j,k), combining mask_vk_ev and mask_vk
136 mocchiut 1.1 c---------------------------------------------
137     c loops on views, VA1 and strips,
138     c and computes strips signals using
139     c badstrip, pedestals, and
140     c sigma informations from histograms
141     c---------------------------------------------
142     flag_shower = .false.
143     ind=1 !clsignal array index
144 pam-fi 1.5
145 mocchiut 1.1 do iv=1,nviews !loop on views
146     do is=1,nstrips_view !loop on strips (1)
147     if(mod(iv,2).eq.1) then
148     C=== > Y view
149     value(is)= -(DBLE(adc(iv,nvk(is),nst(is)))
150     $ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is)))
151     $ *mask(iv,nvk(is),nst(is))
152     clseedcut(is)=clcuty*sigma(iv,nvk(is),nst(is))
153     $ *mask(iv,nvk(is),nst(is))
154     clinclcut(is)=incuty*sigma(iv,nvk(is),nst(is))
155     $ *mask(iv,nvk(is),nst(is))
156     ccc print*,"value(",is,")(reduction)= ",value(is)
157     else
158     C=== > X view
159     value(is)= (DBLE(adc(iv,nvk(is),nst(is)))
160     $ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is)))
161     $ *mask(iv,nvk(is),nst(is))
162     clseedcut(is)=clcutx*sigma(iv,nvk(is),nst(is))
163     $ *mask(iv,nvk(is),nst(is))
164     clinclcut(is)=incutx*sigma(iv,nvk(is),nst(is))
165     $ *mask(iv,nvk(is),nst(is))
166     endif
167 pam-fi 1.4 c$$$ print*,iv,is,' --- ',adc(iv,nvk(is),nst(is)),cn(iv,nvk(is))
168     c$$$ $ ,pedestal(iv,nvk(is),nst(is)),value(is)
169     c$$$ $ ,sigma(iv,nvk(is),nst(is))
170     c if(value(is).gt.clseedcut(is))
171     c $ print*,iv,is,' --- (ADC_PED_CN) ',value(is),clseedcut(is)
172 mocchiut 1.1 enddo !end loop on strips (1)
173     call search_cluster(iv)
174 pam-fi 1.5 c$$$ if(flag_shower.eqv..true.)then
175     c$$$ call init_level1
176     c$$$ good1=0
177     c$$$ goto 200 !jump to next event
178     c$$$ endif
179     ccc
180     ccc modified by Elena (08/2006)
181     ccc
182     if(.not.flag_shower)then
183     call save_cluster(iv)
184     else
185     fshower(iv) = 1
186 pam-fi 1.6 GOOD1(DSPn) = 11
187 mocchiut 1.1 endif
188     enddo ! end loop on views
189     do iv=1,nviews
190     do ik=1,nva1_view
191 pam-fi 1.5 cnev(iv,ik) = cn(iv,ik) !assigns computed CN to ntuple variables
192     cnnev(iv,ik) = cnn(iv,ik) !assigns computed CN to ntuple variables
193 mocchiut 1.1 ccc print*,"cnev(",iv,",",ik,")(reduction)= ",cnev(iv,ik)
194     enddo
195     enddo
196     C---------------------------------------------
197     C come here if GOOD1=0
198     C or the event has too many clusters
199     C---------------------------------------------
200     200 continue
201 pam-fi 1.6
202     ngood = 0
203     do iv = 1,nviews
204     ngood = ngood + good1(iv)
205     enddo
206 pam-fi 1.7 if(ngood.ne.0)print*,'* WARNING * Event ',eventn(1)
207     $ ,':LEVEL1 event status: '
208 pam-fi 1.6 $ ,(good1(i),i=1,nviews)
209 mocchiut 1.1 c------------------------------------------------------------------------
210 pam-fi 1.2 c
211 mocchiut 1.1 c closes files and exits
212 pam-fi 1.2 c
213 mocchiut 1.1 c------------------------------------------------------------------------
214 pam-fi 1.2 RETURN
215     END
216 mocchiut 1.1
217     ***...***...***...***...***...***...***...***...***...***...***...***...***...***...***...***
218     *
219     *
220     *
221     *
222     *
223     *
224     *
225     *
226     *
227     ***...***...***...***...***...***...***...***...***...***...***...***...***...***...***...***
228    
229    
230     subroutine init_level1
231    
232     include 'commontracker.f'
233     include 'level1.f'
234     include 'level0.f'
235    
236 pam-fi 1.6 c good1 = 0
237     do iv=1,12
238     good1(iv) = 1 !missing packet
239     enddo
240 pam-fi 1.5 nclstr1 = 0
241     totCLlength = 0
242 mocchiut 1.1 do ic=1,nclstrmax
243 pam-fi 1.5 view(ic) = 0
244     ladder(ic) = 0
245     indstart(ic) = 0
246     indmax(ic) = 0
247     maxs(ic) = 0
248     mult(ic) = 0
249     dedx(ic) = 0
250     whichtrack(ic) = 0
251    
252 mocchiut 1.1 enddo
253     do id=1,maxlength !???
254 pam-fi 1.5 clsignal(id) = 0.
255     clsigma(id) = 0.
256     cladc(id) = 0.
257     clbad(id) = 0.
258 mocchiut 1.1 enddo
259     do iv=1,nviews
260     c crc1(iv)=0
261     do ik=1,nva1_view
262 pam-fi 1.5 cnev(iv,ik) = 0
263     cnnev(iv,ik) = 0
264 mocchiut 1.1 enddo
265 pam-fi 1.5 fshower(iv) = 0
266 mocchiut 1.1 enddo
267    
268     return
269     end
270     *---***---***---***---***---***---***---***---***
271     *
272     *
273     *
274     *
275     *
276     *---***---***---***---***---***---***---***---***
277    
278     subroutine search_cluster(iv)
279    
280     include 'commontracker.f'
281     include 'level0.f'
282     include 'level1.f'
283     include 'calib.f'
284    
285 pam-fi 1.5 include 'common_reduction.f'
286 mocchiut 1.1
287    
288     c local variables
289     integer rmax,lmax !estremi del cluster
290     integer rstop,lstop !per decidere quali strip includere nel cluster
291     ! oltre il seed
292     integer first,last,diff !per includere le strip giuste... !???
293    
294     integer multtemp !temporary multiplicity variable
295    
296     external nst
297    
298     c------------------------------------------------------------------------
299     c looks for clusters on each view
300     C : CERCO STRIP SOPRA CLSEEDCUT, POI SCORRO A DX FINCHE'
301     c NON TROVO
302     C STRIP PIU' BASSA (in segnale/rumore)
303     C => L'ULTIMA DELLA SERIE CRESCENTE
304     C (LA PIU' ALTA) E' IL
305     C CLUSTER SEED. POI SCORRO A SX E DX INCLUDENDO TUTTE
306     C LE STRIP (FINO A 17 AL
307     C MAX) CHE SUPERANO CLINCLCUT.
308     C QUANDO CERCO IL CLUSTER SEED SUCCESSIVO SALTO LA STRIP
309     C ADIACENTE A DESTRA
310     C DELL'ULTIMO CLUSTER SEED (CHE SARA' NECESSARIAMENTE
311     C PIU' BASSA) E PRENDO
312     C COME SEED UNA STRIP SOLO SE IL SUO SEGNALE E'
313     C MAGGIORE DI QUELLO DELLA STRIP
314     C PRECEDENTE (PRATICAMENTE PER EVITARE CHE L'ULTIMA
315     C STRIP DI UN GRUPPO DI STRIP
316     C TUTTE SOPRA IL CLSEEDCUT VENGA AUTOMATICAMENTE PRESA
317     C COME SEED... DEVE ESSERE
318     C PRESA SOLO SE IL CLUSTER E' DOUBLE PEAKED...)
319     c------------------------------------------------------------------------
320     c 6 ottobre 2003
321     c Elena: CLSEEDCUT = 7 (old value 10)
322     c Elena: CLINCLCUT = 4 (old value 5)
323    
324     iseed=-999 !cluster seed index initialization
325    
326 pam-fi 1.5 nclstr_view=0
327    
328 mocchiut 1.1 do jl=1,nladders_view !1..3 !loops on ladders
329     first=1+nstrips_ladder*(jl-1) !1,1025,2049
330     last=nstrips_ladder*jl !1024,2048,3072
331     c X views have 1018 strips instead of 1024
332     if(mod(iv,2).eq.0) then
333     first=first+3
334     last=last-3
335     endif
336 pam-fi 1.6
337 mocchiut 1.1 do is=first,last !loop on strips in each ladder
338 pam-fi 1.6
339 mocchiut 1.1 if(is.le.iseed+1) goto 220
340 pam-fi 1.5 *******************************************************
341     * Elena 08/2006
342     * QUESTA PARTE NON E` ADEGUATA per cluster con grossi rilasci di carica
343     * perche` salva molte volte lo stesso cluster
344 pam-fi 1.6 * (salvo il cluster rispetto al primo massimo e basta...)
345 pam-fi 1.5 *******************************************************
346     c$$$c-----------------------------------------
347     c$$$c after a cluster seed as been found,
348     c$$$c look for next one skipping one strip on the right
349     c$$$c (i.e. look for double peak cluster)
350     c$$$c-----------------------------------------
351     c$$$ if(is.ne.first) then
352     c$$$ if(value(is).le.value(is-1)) goto 220
353     c$$$ endif
354     c$$$c-----------------------------------------
355     c$$$c skips cluster seed
356     c$$$c finding if strips values are descreasing (a strip
357     c$$$c can be a cluster seed only if previous strip value
358     c$$$c is lower)
359     c$$$c-----------------------------------------
360     *******************************************************
361     * LA RICERCA PARTE DALL'ULTIMA STRIP SALVATA (***TEMPORANEO****)
362     *******************************************************
363     if(is.le.iseed+rmax+1) goto 220
364     *******************************************************
365    
366 mocchiut 1.1 if(value(is).gt.clseedcut(is)) then
367     ccc print*,"value(",is,")=",value(is),
368     ccc $ " .gt.clseedcut(",is,")=",clseedcut(is)
369     c-----------------------------------------
370     c possible SEED...
371     c-----------------------------------------
372     itemp=is
373     if(itemp.eq.last) goto 230 !estremo...
374 pam-fi 1.5 ****************************************************
375     * modificato da Elena (08/2006) per salvare
376     * il cluster intorno al massimo assoluto
377     ****************************************************
378     c$$$ do while(value(itemp)
379     c$$$ $ /sigma(iv,nvk(itemp),nst(itemp))
380     c$$$ $ .le.value(itemp+1)
381     c$$$ $ /sigma(iv,nvk(itemp+1),nst(itemp+1))) !BIAS: aggiustare il caso uguale!???
382     c$$$ itemp=itemp+1
383     c$$$ if(itemp.eq.last) goto 230 !stops if reaches last strip
384     c$$$ enddo ! of the ladder
385 pam-fi 1.6 do while(
386     $ value(itemp).le.value(itemp+1)
387     $ .and.value(itemp+1).gt.clseedcut(itemp+1))
388 mocchiut 1.1 itemp=itemp+1
389     if(itemp.eq.last) goto 230 !stops if reaches last strip
390     enddo ! of the ladder
391     230 continue
392     c-----------------------------------------
393     c fownd SEED!!!
394     c-----------------------------------------
395     iseed=itemp
396     c----------------------------------------------------------
397     c after finding a cluster seed, checks also adjacent strips,
398     C and marks the ones exceeding clinclcut
399     c----------------------------------------------------------
400     ir=iseed !indici destro
401     il=iseed ! e sinistro
402    
403     rmax=ir !estremo destro del cluster
404     lmax=il ! e sinistro
405    
406     rstop=0 !initialize flags used to exit from
407     lstop=0 ! inclusion loop
408    
409     do while(lstop.eq.0.or.rstop.eq.0) !shifts left and right from
410     ir=ir+1 !position index for strips on right side of
411     ! cluster seed
412     il=il-1 !and for left side
413     c------------------------------------------------------------------------
414     c checks for last or first strip of the ladder
415     c------------------------------------------------------------------------
416     if(ir.gt.last) then !when index goes beyond last strip
417     rstop=1 ! of the ladder, change rstop flag in order
418     ! to "help" exiting from loop
419     endif
420    
421     if(il.lt.first) then !idem when index goes beyond
422     lstop=1 ! first strip of the ladder
423     endif
424    
425     c------------------------------------------------------------------------
426     c check for clusters including more than nclstrp strips
427     c------------------------------------------------------------------------
428     if((rmax-lmax+1).ge.nclstrp) then
429     goto 210 !exits inclusion loop:
430     ! lmax and rmax maintain last value
431     ! NB .ge.!???
432     endif
433     c------------------------------------------------------------------------
434     c marks strips exceeding inclusion cut
435     c------------------------------------------------------------------------
436     if(rstop.eq.0) then !if last strip of the ladder or last
437     ! over-cut strip has not been reached
438     if(value(ir).gt.clinclcut(ir)) then !puts in rmax the
439     rmax=ir ! last right over-cut strip
440     else
441     rstop=1 !otherwise cluster ends on right and rstop
442     endif ! flag=1 signals it
443     endif
444     if(lstop.eq.0) then
445     if(value(il).gt.clinclcut(il)) then
446     lmax=il
447     else
448     lstop=1
449     endif
450     endif
451    
452     enddo !ends strip inclusion loop
453     210 continue !jumps here if more than nclstrp have been included
454    
455     multtemp=rmax-lmax+1 !stores multiplicity in temp
456     ! variable. NB rmax and lmax can change later in
457     ! order to include enough strips to calculate eta3
458     ! and eta4. so mult is not always equal to cllength
459     c------------------------------------------------------------------------
460     c NB per essere sicuro di poter calcolare eta3 e eta4 devo includere
461     c sempre e comunque le 2 strip adiacenti al cluster seed e quella
462     c adiacente ulteriore dalla parte della piu' alta fra queste due
463     c (vedi oltre...)!???
464     c------------------------------------------------------------------------
465    
466     c nel caso di estremi del ladder...!???
467    
468     c ho meno di 4 strip nel cluster --> se sono sui bordi o quasi del ladder
469     c costruisco il cluster ad hoc e poi esco, se non sono sui bordi o quasi
470     c vado oltre (aggiungero' quindi strip a sx e dx in modo da poter calcolare
471     c eta3e4)
472     if((rmax-lmax+1).lt.4) then
473    
474     if(iseed.eq.first) then !estremi...
475     rmax=iseed+2 !NB in questo modo puo' anche capitare di
476     lmax=iseed ! includere strip sotto taglio di inclusione
477     goto 250 ! che non serviranno per eta3e4!???
478     endif
479    
480     if(iseed.eq.last) then !estremi...
481     rmax=iseed
482     lmax=iseed-2 !NB 2 e non 3, perche' altrimenti sarei in
483     goto 250 ! ((rmax-lmax+1).lt.4).eq.false. !???
484     endif !NMB questo e' l'unico caso di cllength=3!???
485    
486     if(iseed.eq.first+1) then !quasi estremi...
487     rmax=iseed+2
488     lmax=iseed-1
489     goto 250
490     endif
491     if(iseed.eq.last-1) then
492     rmax=iseed+1
493     lmax=iseed-2
494     goto 250
495     endif
496     c se ho 4 o piu' strip --> se sono sui bordi esco, se sono sui quasi bordi
497     c includo la strip del bordo
498     else
499    
500     if(iseed.eq.first) goto 250 !estremi... non includo altro
501     if(iseed.eq.last) goto 250
502     if(iseed.eq.first+1) then !quasi estremi... mi assicuro di
503     lmax=first ! avere le strip adiacenti al seed
504     if((rmax-lmax+1).gt.nclstrp) rmax=rmax-1 !NB effetto
505     goto 250 ! coperta: se la lunghezza del cluster era gia'
506     endif ! al limite (nclstrp), per poter aggiungere questa
507     ! strip a sinistra devo toglierne una a destra...!???
508     if(iseed.eq.last-1) then
509     rmax=last
510     if((rmax-lmax+1).gt.nclstrp) lmax=lmax+1
511     goto 250
512     endif
513     endif
514     c------------------------------------------------------------------------
515     c be sure to include in the cluster the cluster seed with its 2 adjacent
516     c strips, and the one adjacent to the greatest between this two strip, as the
517     c fourth one. if the strips have the same value (!) the fourth one is chosen
518     c as the one having the greatest value between the second neighbors
519     c------------------------------------------------------------------------
520     if(value(iseed+1).eq.value(iseed-1)) then
521     if(value(iseed+2).ge.value(iseed-2)) then !??? qui cmq c'e'
522     diff=(iseed+2)-rmax
523     if(diff.gt.0) then
524     rmax=rmax+diff
525     if((rmax-lmax+1).gt.nclstrp) then
526     lmax=rmax-nclstrp+1
527     endif
528     endif
529     diff=(iseed-1)-lmax
530     if(diff.lt.0) then
531     lmax=lmax+diff
532     if((rmax-lmax+1).gt.nclstrp) then
533     rmax=lmax+nclstrp-1
534     endif
535     endif
536     else
537     diff=(iseed-2)-lmax
538     if(diff.lt.0) then
539     lmax=lmax+diff
540     if((rmax-lmax+1).gt.nclstrp) then
541     rmax=lmax+nclstrp-1
542     endif
543     endif
544     diff=(iseed+1)-rmax
545     if(diff.gt.0) then
546     rmax=rmax+diff
547     if((rmax-lmax+1).gt.nclstrp) then
548     lmax=rmax-nclstrp+1
549     endif
550     endif
551     endif
552     elseif(value(iseed+1).gt.value(iseed-1)) then
553     c !??? sposto il limite del cluster a destra per includere sempre le strip
554     c necessarie al calcolo di eta-i
555     c se il cluster diventa troppo lungo lo accorcio a sinistra per avere non piu'
556     c di nclstrp (in questo caso sono sicuro di aver gia' incluso le strip
557     c necessarie al calcolo di eta-i a sinistra, quindi se voglio posso uscire)
558     diff=(iseed+2)-rmax
559     if(diff.gt.0) then
560     rmax=rmax+diff
561     if((rmax-lmax+1).gt.nclstrp) then
562     lmax=rmax-nclstrp+1
563     c goto 250
564     endif
565     endif
566     diff=(iseed-1)-lmax
567     if(diff.lt.0) then
568     lmax=lmax+diff
569     if((rmax-lmax+1).gt.nclstrp) then
570     rmax=lmax+nclstrp-1
571     c goto 250 !inutile!???
572     endif
573     endif
574     else
575     diff=(iseed-2)-lmax
576     if(diff.lt.0) then
577     lmax=lmax+diff
578     if((rmax-lmax+1).gt.nclstrp) then
579     rmax=lmax+nclstrp-1
580     c goto 250
581     endif
582     endif
583     diff=(iseed+1)-rmax
584     if(diff.gt.0) then
585     rmax=rmax+diff
586     if((rmax-lmax+1).gt.nclstrp) then
587     lmax=rmax-nclstrp+1
588     c goto 250 !inutile!???
589     endif
590     endif
591     endif
592     250 continue
593    
594     c--------------------------------------------------------
595 pam-fi 1.4 c fills cluster variables
596 mocchiut 1.1 c--------------------------------------------------------
597 pam-fi 1.5 c$$$ nclstr1=nclstr1+1 !cluster number
598     c$$$ccc print*,nclstr1,multtemp
599     c$$$ if(nclstr1.gt.nclstrmax) then !too many clusters for the event:
600     c$$$ if(verbose)print*,'Event ',eventn(1),
601     c$$$ $ ': more than ',nclstrmax,' clusters'
602     c$$$ good1=0 ! event
603     c$$$ nclstr1=0
604     c$$$ totCLlength=0
605     c$$$ flag_shower = .true.
606     c$$$ goto 2000
607     c$$$ endif
608     c$$$ view(nclstr1) = iv !vista del cluster
609     c$$$ ladder(nclstr1) = nld(iseed,iv) !ladder a cui appartiene il cluster seed
610     c$$$ maxs(nclstr1) = iseed !strip del cluster seed
611     c$$$ mult(nclstr1) = multtemp !molteplicita'
612     c$$$
613     c$$$ indstart(nclstr1) = ind !posizione dell'inizio del cluster nell'
614     c$$$c ! array clsignal
615     c$$$ indmax(nclstr1) = indstart(nclstr1)+(iseed-lmax) !posizione del
616     c$$$c ! cluster seed nell'array clsignal
617     c$$$
618     c$$$ CLlength = rmax-lmax+1 !numero di strip del cluster
619     c$$$ totCLlength = totCLlength+CLlength
620     c$$$ dedx(nclstr1) = 0
621     c$$$ do j=lmax,rmax !stores sequentially cluter strip values in
622     c$$$ clsignal(ind) = value(j) ! clsignal array
623     c$$$ ind=ind+1
624     c$$$c if(value(j).gt.0)
625     c$$$ if(value(j).gt.clinclcut(j))
626     c$$$ $ dedx(nclstr1) = dedx(nclstr1) + value(j) !cluster charge
627     c$$$ enddo
628     ccc
629     ccc *** Modified by Elena (08/2006) ***
630     ccc
631     nclstr_view = nclstr_view + 1 !cluster number
632     c print*,'view ',iv,' -- search_cluster -- nclstr_view: '
633     c $ ,nclstr_view
634     if(nclstr_view.gt.nclstrmax_view) then !too many clusters for the view:
635     if(verbose) print*,'Event ',eventn(1),
636     $ ': more than ',nclstrmax_view
637     $ ,' clusters on view ',iv
638     c good1=0 ! event
639     c nclstr1=0
640     c totCLlength=0
641 mocchiut 1.1 flag_shower = .true.
642     goto 2000
643     endif
644 pam-fi 1.5
645     c view(nclstr1) = iv !vista del cluster
646     ladder_view(nclstr_view) = nld(iseed,iv) !ladder a cui appartiene il cluster seed
647     maxs_view(nclstr_view) = iseed !strip del cluster seed
648     mult_view(nclstr_view) = multtemp !molteplicita'
649     rmax_view(nclstr_view) = rmax
650     lmax_view(nclstr_view) = lmax
651    
652 mocchiut 1.1 c--------------------------------------------------------
653 pam-fi 1.2 c
654 mocchiut 1.1 c--------------------------------------------------------
655     endif !end possible seed conditio
656     220 continue !jumps here to skip strips left of last seed
657    
658     enddo ! end loop on strips
659     enddo !end loop on ladders
660     2000 continue
661     return
662     end
663    
664    
665     *---***---***---***---***---***---***---***---***
666     *
667     *
668     *
669     *
670     *
671     *---***---***---***---***---***---***---***---***
672    
673 pam-fi 1.5 subroutine save_cluster(iv)
674     *
675     * (080/2006 Elena Vannuccini)
676     * Save the clusters view by view
677    
678     include 'commontracker.f'
679     include 'level1.f'
680     include 'calib.f'
681     include 'common_reduction.f'
682    
683     integer CLlength !lunghezza in strip del cluster
684    
685     do ic=1,nclstr_view
686    
687     nclstr1 = nclstr1+1
688     view(nclstr1) = iv
689     ladder(nclstr1) = ladder_view(ic)
690     maxs(nclstr1) = maxs_view(ic)
691     mult(nclstr1) = mult_view(ic)
692    
693     c posizione dell'inizio del cluster nell' array clsignal
694     indstart(nclstr1) = ind
695     c posizione del cluster seed nell'array clsignal
696     indmax(nclstr1) = indstart(nclstr1)
697     $ +( maxs_view(ic) - lmax_view(ic) )
698    
699     CLlength = rmax_view(ic) - lmax_view(ic) + 1 !numero di strip salvate
700     totCLlength = totCLlength + CLlength
701     dedx(nclstr1) = 0
702     do j=lmax_view(ic),rmax_view(ic) !stores sequentially cluter strip values in
703    
704     clsignal(ind) = value(j) ! clsignal array
705    
706     ivk=nvk(j)
707     ist=nst(j)
708    
709     clsigma(ind) = sigma(iv,ivk,ist)
710     cladc(ind) = adc(iv,ivk,ist)
711     clbad(ind) = bad(iv,ivk,ist)
712     c clped(ind) = pedestal(iv,ivk,ist)
713    
714     ind=ind+1
715     c if(value(j).gt.0)
716     if(value(j).gt.clinclcut(j))
717     $ dedx(nclstr1) = dedx(nclstr1) + value(j) !cluster charge
718     enddo
719    
720     c print*,'view ',iv,' -- save_cluster -- nclstr1: '
721     c $ ,nclstr1,maxs(nclstr1),mult(nclstr1),dedx(nclstr1)
722    
723     enddo
724    
725     return
726     end
727     *---***---***---***---***---***---***---***---***
728     *
729     *
730     *
731     *
732     *
733     *---***---***---***---***---***---***---***---***
734    
735 mocchiut 1.1
736     subroutine stripmask
737    
738     * this routine set va1 and single-strip masks,
739     * on the basis of the VA1 mask saved in the DB
740     *
741     * mask(nviews,nva1_view,nstrips_va1) !strip mask
742     * mask_vk(nviews,nva1_view) !VA1 mask
743     *
744     include 'commontracker.f'
745 pam-fi 1.5 include 'level1.f'
746 pam-fi 1.4 include 'common_reduction.f'
747 mocchiut 1.1 include 'calib.f'
748    
749     * init mask
750     do iv=1,nviews
751     do ivk=1,nva1_view
752     do is=1,nstrips_va1
753 pam-fi 1.4 c mask(iv,ivk,is) = mask_vk(iv,ivk)
754     mask(iv,ivk,is) = mask_vk(iv,ivk) * mask_vk_ev(iv,ivk)
755 mocchiut 1.1 enddo
756     enddo
757     enddo
758    
759    
760     return
761     end
762    

  ViewVC Help
Powered by ViewVC 1.1.23