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