1 |
************************************************************************* |
2 |
* |
3 |
* Subroutine fillpedsig.f |
4 |
* |
5 |
* - fills bad, pedestal and sigma variables with respective values from |
6 |
* level0 histograms, in order to perform cluster identification !??? |
7 |
* - fills bad, pedestal_t and sigma_t variables with respective truncated |
8 |
* values from level0 histograms, in order to perform data decompression |
9 |
* |
10 |
* needs: |
11 |
* - level0 pedestal, sigma and badstrip histograms |
12 |
* |
13 |
* output variables: |
14 |
* - bad |
15 |
* - pedestal |
16 |
* - pedestal_t |
17 |
* - sigma |
18 |
* - sigma_t |
19 |
* |
20 |
* to be called inside ./reduction.f |
21 |
* |
22 |
************************************************************************* |
23 |
|
24 |
|
25 |
subroutine fillpedsigfromdefault() |
26 |
|
27 |
include 'commontracker.f' |
28 |
include 'common_reduction.f' |
29 |
include 'common_c2f.f' |
30 |
include 'calib.f' |
31 |
|
32 |
external nvk |
33 |
external nst |
34 |
|
35 |
c------------------------------------------------------------------------ |
36 |
c |
37 |
c local variables |
38 |
c |
39 |
c------------------------------------------------------------------------ |
40 |
|
41 |
REAL hmemor(10000000) |
42 |
integer Iquest(100) |
43 |
COMMON /pawc/hmemor |
44 |
save /pawc/ |
45 |
C |
46 |
Common /QUEST/ Iquest |
47 |
save /quest/ |
48 |
|
49 |
real content(nstrips_view) !temporary array |
50 |
parameter (lun_data_file=70) !data file id number |
51 |
|
52 |
c character*60 fname_param |
53 |
|
54 |
|
55 |
CALL HLIMIT(10000000) |
56 |
|
57 |
IQUEST(10)=65000 |
58 |
|
59 |
c2f_error=0 |
60 |
|
61 |
|
62 |
if(C2F_DEBUG.eq.1)print*,c2f_path(1:c2f_pathlen) |
63 |
call HROPEN(lun_data_file, |
64 |
$ 'CALIB' |
65 |
$ ,c2f_path(1:c2f_pathlen) !<<<< C2F |
66 |
$ ,'QP',4096,istat) !opens |
67 |
if(istat.ne.0)then |
68 |
c2f_error=1 |
69 |
goto 19 |
70 |
endif |
71 |
call HRIN(0,9999,0) |
72 |
|
73 |
|
74 |
c------------------------------------------------------------------------ |
75 |
c |
76 |
c loops on views filling badstrip, pedestal and sigma variables from |
77 |
c level0 histograms |
78 |
c |
79 |
c------------------------------------------------------------------------ |
80 |
|
81 |
do iv=1,nviews |
82 |
call HUNPAK(id_hi_bad+iv,content,' ',0) !puts histo contents in an array |
83 |
do is=1,nstrips_view !fills variables with array values |
84 |
bad(iv,nvk(is),nst(is))=INT(content(is)) |
85 |
enddo |
86 |
|
87 |
call HUNPAK(id_hi_ped+iv,content,' ',0) |
88 |
do is=1,nstrips_view |
89 |
pedestal(iv,nvk(is),nst(is))=content(is) |
90 |
cc print*,'ped',pedestal(iv,nvk(is),nst(is)) |
91 |
pedestal_t(iv,nvk(is),nst(is))=AINT(content(is)) !truncated value |
92 |
cc print*,'ped_t',pedestal_t(iv,nvk(is),nst(is)) |
93 |
enddo |
94 |
|
95 |
call HUNPAK(id_hi_sig+iv,content,' ',0) |
96 |
do is=1,nstrips_view |
97 |
sigma(iv,nvk(is),nst(is))=content(is) |
98 |
sigma_t(iv,nvk(is),nst(is))=ANINT(content(is)) !truncated value |
99 |
enddo |
100 |
|
101 |
do is=1,nstrips_view!inversione (a volte ritornano, quasi...) badstrip!??? |
102 |
if(bad(iv,nvk(is),nst(is)).eq.1) then |
103 |
bad(iv,nvk(is),nst(is))=0 |
104 |
else |
105 |
bad(iv,nvk(is),nst(is))=1 |
106 |
endif |
107 |
enddo |
108 |
|
109 |
enddo |
110 |
|
111 |
do iview=1,nviews |
112 |
call HDELET(id_hi_bad+iview) |
113 |
call HDELET(id_hi_ped+iview) |
114 |
call HDELET(id_hi_sig+iview) |
115 |
enddo |
116 |
call HREND('CALIB') |
117 |
close(lun_data_file) |
118 |
|
119 |
|
120 |
|
121 |
c$$$ C |
122 |
c$$$ C inversione vista 11: devo riinvertire i valori contenuti negli istogrammi |
123 |
c$$$ C per poter decomprimere i dati compressi (che sono stati messi a diritto |
124 |
c$$$ C nel vettore datatracker, senza inversione 11). quello che mi serve e' di |
125 |
c$$$ C riinvertire pedestal_t(11,nvk(is),nst(is)) e (anche se forse non lo uso) |
126 |
c$$$ C sigma_t(11,nvk(is),nst(is)) !??? |
127 |
c$$$ C |
128 |
c$$$ do is=1,nstrips_view |
129 |
c$$$ content(is) = pedestal_t(11,nvk(is),nst(is)) |
130 |
c$$$ enddo |
131 |
c$$$ |
132 |
c$$$ do is=1,nstrips_view |
133 |
c$$$ offset=5121 |
134 |
c$$$ if(is.le.2048) offset=3073 |
135 |
c$$$ if(is.le.1024) offset=1025 |
136 |
c$$$ iss=offset-is |
137 |
c$$$ |
138 |
c$$$ pedestal_t(11,nvk(iss),nst(iss)) = content(is) |
139 |
c$$$ enddo |
140 |
c$$$ |
141 |
c$$$ |
142 |
c$$$ do is=1,nstrips_view |
143 |
c$$$ content(is) = sigma_t(11,nvk(is),nst(is)) |
144 |
c$$$ enddo |
145 |
c$$$ |
146 |
c$$$ do is=1,nstrips_view |
147 |
c$$$ offset=5121 |
148 |
c$$$ if(is.le.2048) offset=3073 |
149 |
c$$$ if(is.le.1024) offset=1025 |
150 |
c$$$ iss=offset-is |
151 |
c$$$ |
152 |
c$$$ sigma_t(11,nvk(iss),nst(iss)) = content(is) |
153 |
c$$$ enddo |
154 |
c$$$ C |
155 |
c$$$ C fine inversione vista 11 !??? |
156 |
c$$$ C |
157 |
19 continue |
158 |
return |
159 |
end |