11 |
extern "C" { |
extern "C" { |
12 |
|
|
13 |
// int readetaparam_(); |
// int readetaparam_(); |
14 |
float cog_(int*,int*); |
float cog_(int*,int*); |
15 |
float pfaeta_(int*,float*); |
float pfaeta_(int*,float*); |
16 |
float pfaeta2_(int*,float*); |
float pfaeta2_(int*,float*); |
17 |
float pfaeta3_(int*,float*); |
float pfaeta3_(int*,float*); |
18 |
float pfaeta4_(int*,float*); |
float pfaeta4_(int*,float*); |
19 |
|
|
20 |
} |
} |
21 |
//-------------------------------------- |
//-------------------------------------- |
24 |
//-------------------------------------- |
//-------------------------------------- |
25 |
TrkCluster::TrkCluster(){ |
TrkCluster::TrkCluster(){ |
26 |
|
|
27 |
view = 0; |
// cout << "TrkCluster::TrkCluster()"<<endl; |
28 |
maxs = 0; |
view = -1; |
29 |
indmax = 0; |
maxs = -1; |
30 |
|
indmax = -1; |
31 |
CLlength = 0; |
|
32 |
clsignal = 0; |
CLlength = 0; |
33 |
clsigma = 0; |
clsignal = 0; |
34 |
cladc = 0; |
clsigma = 0; |
35 |
clbad = 0; |
cladc = 0; |
36 |
|
clbad = 0; |
37 |
|
|
38 |
}; |
}; |
39 |
//-------------------------------------- |
//-------------------------------------- |
40 |
// |
// |
41 |
// |
// |
42 |
//-------------------------------------- |
//-------------------------------------- |
|
TrkCluster::~TrkCluster(){ |
|
|
|
|
|
delete [] clsignal; |
|
|
delete [] clsigma; |
|
|
delete [] cladc; |
|
|
delete [] clbad; |
|
|
}; |
|
|
//-------------------------------------- |
|
|
// |
|
|
// |
|
|
//-------------------------------------- |
|
43 |
TrkCluster::TrkCluster(const TrkCluster& t){ |
TrkCluster::TrkCluster(const TrkCluster& t){ |
44 |
|
|
45 |
view = t.view; |
view = t.view; |
46 |
maxs = t.maxs; |
maxs = t.maxs; |
47 |
indmax = t.indmax; |
indmax = t.indmax; |
48 |
|
|
49 |
CLlength = t.CLlength; |
CLlength = t.CLlength; |
50 |
|
if(CLlength){ |
51 |
clsignal = new Float_t[CLlength]; |
clsignal = new Float_t[CLlength]; |
52 |
clsigma = new Float_t[CLlength]; |
clsigma = new Float_t[CLlength]; |
53 |
cladc = new Int_t[CLlength]; |
cladc = new Int_t[CLlength]; |
54 |
clbad = new Bool_t[CLlength]; |
clbad = new Bool_t[CLlength]; |
55 |
for(Int_t i=0; i<CLlength;i++){ |
for(Int_t i=0; i<CLlength;i++){ |
56 |
clsignal[i] = t.clsignal[i]; |
clsignal[i] = t.clsignal[i]; |
57 |
clsigma[i] = t.clsigma[i]; |
clsigma[i] = t.clsigma[i]; |
58 |
cladc[i] = t.cladc[i]; |
cladc[i] = t.cladc[i]; |
59 |
clbad[i] = t.clbad[i]; |
clbad[i] = t.clbad[i]; |
60 |
}; |
}; |
61 |
|
}; |
62 |
|
}; |
63 |
|
//-------------------------------------- |
64 |
|
// |
65 |
|
// |
66 |
|
//-------------------------------------- |
67 |
|
void TrkCluster::Clear(){ |
68 |
|
|
69 |
|
// cout << "void TrkCluster::Clear()"<<endl; |
70 |
|
if(CLlength){ |
71 |
|
delete [] clsignal; |
72 |
|
delete [] clsigma; |
73 |
|
delete [] cladc; |
74 |
|
delete [] clbad; |
75 |
|
} |
76 |
|
|
77 |
|
view = 0; |
78 |
|
maxs = 0; |
79 |
|
indmax = 0; |
80 |
|
|
81 |
|
CLlength = 0; |
82 |
|
clsignal = 0; |
83 |
|
clsigma = 0; |
84 |
|
cladc = 0; |
85 |
|
clbad = 0; |
86 |
|
|
87 |
}; |
}; |
88 |
//-------------------------------------- |
//-------------------------------------- |
90 |
// |
// |
91 |
//-------------------------------------- |
//-------------------------------------- |
92 |
/** |
/** |
93 |
* Evaluate the cluster signal including all adjacent strip with a significant signal ( s > cut*sigma ). |
* Evaluate the cluster signal including a maximum number of adjacent |
94 |
* @param cut Inclusion cut. |
* strips, around maxs, having a significant signal. |
95 |
|
* @param nstrip Maximum number of strips. |
96 |
|
* @param cut Inclusion cut ( s > cut*sigma ). |
97 |
|
* If nstrip<=0 only the inclusion cut is used to determine the cluster size. |
98 |
*/ |
*/ |
99 |
Float_t TrkCluster::GetSignal(Float_t cut){ |
Float_t TrkCluster::GetSignal(Int_t nstrip, Float_t cut){ |
100 |
Float_t s = 0; |
|
101 |
for(Int_t is = 0; is < CLlength; is++){ |
if(CLlength<=0)return 0; |
102 |
Float_t scut = cut*clsigma[is]; |
|
103 |
if(clsignal[is] > scut) s += clsignal[is]; |
Float_t s = 0; |
104 |
|
|
105 |
|
if( nstrip<=0 ){ |
106 |
|
// for(Int_t is = 0; is < CLlength; is++){ |
107 |
|
// Float_t scut = cut*clsigma[is]; |
108 |
|
// if(clsignal[is] > scut) s += clsignal[is]; |
109 |
|
// }; |
110 |
|
for(Int_t is = indmax+1; is < CLlength; is++){ |
111 |
|
Float_t scut = cut*clsigma[is]; |
112 |
|
if(clsignal[is] > scut) s += clsignal[is]; |
113 |
|
else break; |
114 |
|
}; |
115 |
|
for(Int_t is = indmax; is >=0; is--){ |
116 |
|
Float_t scut = cut*clsigma[is]; |
117 |
|
if(clsignal[is] > scut) s += clsignal[is]; |
118 |
|
else break; |
119 |
}; |
}; |
120 |
return s; |
return s; |
121 |
|
}; |
122 |
|
|
123 |
|
|
124 |
|
Int_t il = indmax; |
125 |
|
Int_t ir = indmax; |
126 |
|
Int_t inc = 0; |
127 |
|
|
128 |
|
if( clsignal[indmax] < cut*clsigma[indmax] ) return 0; |
129 |
|
|
130 |
|
while ( inc < nstrip ){ |
131 |
|
Float_t sl = -100000; |
132 |
|
Float_t sr = -100000; |
133 |
|
if( il >= 0 ) sl = clsignal[il]; |
134 |
|
if( ir < CLlength ) sr = clsignal[ir]; |
135 |
|
if( sl == sr && inc == 0 ){ |
136 |
|
s += clsignal[il]; //cout << inc<<" - "<< clsignal[il]<<" "<<s<<endl; |
137 |
|
il--; |
138 |
|
ir++; |
139 |
|
}else if ( sl >= sr && sl > cut*clsigma[il] && inc !=0 ){ |
140 |
|
s += sl;//cout << inc<<" - "<< clsignal[il]<<" "<<s<<endl; |
141 |
|
il--; |
142 |
|
}else if ( sl < sr && sr > cut*clsigma[ir] ){ |
143 |
|
s += sr;//cout << inc<<" - " << clsignal[ir]<<" "<<s<<endl; |
144 |
|
ir++; |
145 |
|
}else break; |
146 |
|
|
147 |
|
inc++; |
148 |
|
} |
149 |
|
return s; |
150 |
}; |
}; |
151 |
|
|
152 |
|
|
153 |
/** |
/** |
154 |
* Evaluate the cluster signal including a ( maximum ) fixed number of adjacent strips (with s>0) around the maxs. |
* Evaluate the cluster signal-to-noise, as defined by Turchetta, including a |
155 |
* @param nstrip Number of strips. |
* maximum number of adjacent strips, around maxs, having a significant signal. |
156 |
|
* @param nstrip Maximum number of strips. |
157 |
|
* @param cut Inclusion cut ( s > cut*sigma ). |
158 |
|
* If nstrip<=0 only the inclusion cut is used to determine the cluster size. |
159 |
*/ |
*/ |
160 |
Float_t TrkCluster::GetSignal(Int_t nstrip){ |
Float_t TrkCluster::GetSignalToNoise(Int_t nstrip, Float_t cut){ |
161 |
|
|
162 |
Float_t s = 0; |
if(CLlength<=0)return 0; |
163 |
Int_t il = indmax; |
|
164 |
Int_t ir = indmax; |
Float_t sn = 0; |
165 |
Int_t inc = 0; |
|
166 |
|
if( nstrip<=0 ){ |
167 |
while ( inc<nstrip ){ |
for(Int_t is = indmax+1; is < CLlength; is++){ |
168 |
Float_t sl = 0; |
Float_t scut = cut*clsigma[is]; |
169 |
Float_t sr = 0; |
if(clsignal[is] > scut) sn += clsignal[is]/clsigma[is]; |
170 |
if( il >= 0 ) sl = clsignal[il]; |
else break; |
171 |
if( ir < CLlength ) sr = clsignal[ir]; |
}; |
172 |
if( sl == sr && inc == 0 ){ |
for(Int_t is = indmax; is >=0; is--){ |
173 |
s += clsignal[il]; |
Float_t scut = cut*clsigma[is]; |
174 |
il--; |
if(clsignal[is] > scut) sn += clsignal[is]/clsigma[is]; |
175 |
ir++; |
else break; |
|
}else if ( sl >= sr && sl>0 && inc !=0){ |
|
|
s += sl; |
|
|
il--; |
|
|
}else if ( sl < sr && sr>0 ){ |
|
|
s += sr; |
|
|
ir++; |
|
|
}else break; |
|
|
|
|
|
inc++; |
|
|
} |
|
|
return s; |
|
|
}; |
|
|
/** |
|
|
* Evaluate the cluster signal-to-noise, as defined by Turchetta, including all adjacent strip with a significant signal ( s > cut*sigma ). |
|
|
* @param cut Inclusion cut. |
|
|
*/ |
|
|
Float_t TrkCluster::GetSignalToNoise(Float_t cut){ |
|
|
Float_t sn = 0; |
|
|
for(Int_t is = 0; is < CLlength; is++){ |
|
|
Float_t scut = cut*clsigma[is]; |
|
|
if(clsignal[is] > scut) sn += clsignal[is]/clsigma[is]; |
|
176 |
}; |
}; |
177 |
return sn; |
return sn; |
178 |
}; |
}; |
179 |
/** |
|
180 |
* Evaluate the cluster signal-to-noise, as defined by Turchetta, including a ( maximum ) fixed number of adjacent strips (with s>0) around the maxs. |
|
181 |
* @param nstrip Number of strips. |
Int_t il = indmax; |
182 |
*/ |
Int_t ir = indmax; |
183 |
Float_t TrkCluster::GetSignalToNoise(Int_t nstrip){ |
Int_t inc = 0; |
184 |
|
|
185 |
Float_t sn = 0; |
if( clsignal[indmax] < cut*clsigma[indmax] ) return 0; |
186 |
Int_t il = indmax; |
|
187 |
Int_t ir = indmax; |
while ( inc < nstrip ){ |
188 |
Int_t inc = 0; |
Float_t sl = -100000; |
189 |
|
Float_t sr = -100000; |
190 |
while ( inc<nstrip ){ |
if( il >= 0 ) sl = clsignal[il]; |
191 |
Float_t sl = 0; |
if( ir < CLlength ) sr = clsignal[ir]; |
192 |
Float_t sr = 0; |
if( sl == sr && inc == 0 ){ |
193 |
if( il >= 0 ) sl = clsignal[il]; |
sn += clsignal[il]/clsigma[il]; |
194 |
if( ir < CLlength ) sr = clsignal[ir]; |
il--; |
195 |
if( sl == sr && inc == 0 ){ |
ir++; |
196 |
sn += clsignal[il]/clsigma[il]; |
}else if ( sl >= sr && sl > cut*clsigma[il] && inc !=0 ){ |
197 |
il--; |
sn += sl/clsigma[il]; |
198 |
ir++; |
il--; |
199 |
}else if ( sl >= sr && sl>0 && inc !=0){ |
}else if ( sl < sr && sr > cut*clsigma[ir] ){ |
200 |
sn += sl/clsigma[il]; |
sn += sr/clsigma[ir]; |
201 |
il--; |
ir++; |
202 |
}else if ( sl < sr && sr>0 ){ |
}else break; |
203 |
sn += sr/clsigma[ir]; |
|
204 |
ir++; |
inc++; |
205 |
}else break; |
} |
206 |
|
return sn; |
|
inc++; |
|
|
} |
|
|
return sn; |
|
207 |
}; |
}; |
208 |
/** |
/** |
209 |
* Evaluate the cluster multiplicity. |
* Evaluate the cluster multiplicity. |
210 |
* @param cut Inclusion cut. |
* @param cut Inclusion cut. |
211 |
*/ |
*/ |
212 |
Int_t TrkCluster::GetMultiplicity(Float_t cut){ |
Int_t TrkCluster::GetMultiplicity(Float_t cut){ |
213 |
Int_t m = 0; |
|
214 |
for(Int_t is = 0; is < CLlength; is++){ |
if(CLlength<=0)return 0; |
215 |
Float_t scut = cut*clsigma[is]; |
|
216 |
if(clsignal[is] > scut) m++; |
Int_t m = 0; |
217 |
}; |
|
218 |
return m; |
for(Int_t is = indmax+1; is < CLlength; is++){ |
219 |
|
Float_t scut = cut*clsigma[is]; |
220 |
|
if(clsignal[is] > scut) m++; |
221 |
|
else break; |
222 |
|
}; |
223 |
|
for(Int_t is = indmax; is >=0; is--){ |
224 |
|
Float_t scut = cut*clsigma[is]; |
225 |
|
if(clsignal[is] > scut) m++; |
226 |
|
else break; |
227 |
|
}; |
228 |
|
return m; |
229 |
}; |
}; |
230 |
/** |
/** |
231 |
* True if the cluster contains bad strips. |
* True if the cluster contains bad strips. |
232 |
* @param nbad Number of strips around the maximum. |
* @param nbad Number of strips around the maximum. |
233 |
*/ |
*/ |
234 |
Bool_t TrkCluster::IsBad(Int_t nbad){ |
Bool_t TrkCluster::IsBad(Int_t nbad){ |
235 |
|
|
236 |
/* Float_t max = 0; |
if(CLlength<=0)return 0; |
237 |
Int_t imax = 0; |
|
238 |
for(Int_t is = 0; is < CLlength; is++){ |
Int_t il,ir; |
239 |
if(clsignal[is] > max){ |
il = indmax; |
240 |
max = clsignal[is]; |
ir = indmax; |
241 |
imax = is; |
for(Int_t i=1; i<nbad; i++){ |
242 |
}; |
if (ir == CLlength && il == 0)break; |
243 |
}; |
else if (ir == CLlength && il != 0)il--; |
244 |
|
else if (ir != CLlength && il == 0)ir++; |
245 |
Int_t il,ir; |
else{ |
246 |
il = imax; |
if(clsignal[il-1] > clsignal[ir+1])il--; |
247 |
ir = imax;*/ |
else ir++; |
|
|
|
|
Int_t il,ir; |
|
|
il = indmax; |
|
|
ir = indmax; |
|
|
for(Int_t i=1; i<nbad; i++){ |
|
|
if (ir == CLlength && il == 0)break; |
|
|
else if (ir == CLlength && il != 0)il--; |
|
|
else if (ir != CLlength && il == 0)ir++; |
|
|
else{ |
|
|
if(clsignal[il-1] > clsignal[ir+1])il--; |
|
|
else ir++; |
|
|
} |
|
248 |
} |
} |
249 |
Int_t isbad = 0; |
} |
250 |
for(Int_t i=il; i<=ir; i++)isbad += clbad[i]; |
Int_t isbad = 0; |
251 |
|
for(Int_t i=il; i<=ir; i++)isbad += clbad[i]; |
252 |
return ( isbad != nbad ); |
|
253 |
|
return ( isbad != nbad ); |
254 |
}; |
}; |
255 |
|
/** |
256 |
|
* True if the cluster contains saturated strips. |
257 |
|
* @param nbad Number of strips around the maximum. |
258 |
|
*/ |
259 |
|
Bool_t TrkCluster::IsSaturated(Int_t nbad){ |
260 |
|
|
261 |
|
if(CLlength<=0)return 0; |
262 |
|
|
263 |
|
Int_t il,ir; |
264 |
|
il = indmax; |
265 |
|
ir = indmax; |
266 |
|
for(Int_t i=1; i<nbad; i++){ |
267 |
|
if (ir == CLlength && il == 0)break; |
268 |
|
else if (ir == CLlength && il != 0)il--; |
269 |
|
else if (ir != CLlength && il == 0)ir++; |
270 |
|
else{ |
271 |
|
if(clsignal[il-1] > clsignal[ir+1])il--; |
272 |
|
else ir++; |
273 |
|
} |
274 |
|
} |
275 |
|
Int_t isbad = 0; |
276 |
|
for(Int_t i=il; i<=ir; i++){ |
277 |
|
if( IsX() && cladc[i] > 2980 )isbad++; |
278 |
|
if( IsY() && cladc[i] < 80 )isbad++; |
279 |
|
} |
280 |
|
return ( isbad != 0 ); |
281 |
|
|
282 |
|
} |
283 |
//-------------------------------------- |
//-------------------------------------- |
284 |
// |
// |
285 |
// |
// |
286 |
//-------------------------------------- |
//-------------------------------------- |
287 |
void TrkCluster::Dump(){ |
void TrkCluster::Dump(){ |
288 |
|
|
289 |
cout << "----- Cluster" << endl; |
cout << "----- Cluster" << endl; |
290 |
cout << "View "<<view << " - Ladder "<<GetLadder()<<endl; |
cout << "View "<<view << " - Ladder "<<GetLadder()<<endl; |
291 |
cout << "Position of maximun "<< maxs <<endl; |
cout << "Position of maximun "<< maxs <<endl; |
292 |
cout << "Multiplicity "<< GetMultiplicity() <<endl; |
cout << "Multiplicity "<< GetMultiplicity() <<endl; |
293 |
cout << "Tot signal "<< GetSignal() << " (ADC channels)"<<endl ; |
cout << "Tot signal "<< GetSignal() << " (ADC channels)"<<endl ; |
294 |
cout << "Signal/Noise "<< GetSignalToNoise(); |
cout << "Signal/Noise "<< GetSignalToNoise(); |
295 |
cout <<endl<< "Strip signals "; |
cout <<endl<< "Strip signals "; |
296 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsignal[i]; |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsignal[i]; |
297 |
cout <<endl<< "Strip sigmas "; |
cout <<endl<< "Strip sigmas "; |
298 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsigma[i]; |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsigma[i]; |
299 |
cout <<endl<< "Strip ADC "; |
cout <<endl<< "Strip ADC "; |
300 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<cladc[i]; |
for(Int_t i =0; i<CLlength; i++)cout << " " <<cladc[i]; |
301 |
cout <<endl<< "Strip BAD "; |
cout <<endl<< "Strip BAD "; |
302 |
for(Int_t i =0; i<CLlength; i++){ |
for(Int_t i =0; i<CLlength; i++){ |
303 |
if(i==indmax)cout << " *" <<clbad[i]<<"*"; |
if(i==indmax)cout << " *" <<clbad[i]<<"*"; |
304 |
else cout << " " <<clbad[i]; |
else cout << " " <<clbad[i]; |
305 |
} |
} |
306 |
cout << endl; |
cout << endl; |
307 |
|
|
308 |
} |
} |
309 |
//-------------------------------------- |
//-------------------------------------- |
315 |
*/ |
*/ |
316 |
cTrkLevel1* TrkCluster::GetLevel1Struct(){ |
cTrkLevel1* TrkCluster::GetLevel1Struct(){ |
317 |
|
|
318 |
cTrkLevel1* l1 = new cTrkLevel1; |
// cTrkLevel1* l1 = new cTrkLevel1; |
319 |
|
|
320 |
l1->nclstr1 = 1; |
cTrkLevel1* l1 = &level1event_ ; |
|
l1->view[0] = view; |
|
|
l1->ladder[0] = GetLadder(); |
|
|
l1->maxs[0] = maxs; |
|
|
l1->mult[0] = GetMultiplicity(); |
|
|
l1->dedx[0] = GetSignal(); |
|
|
l1->indstart[0] = 1; |
|
|
l1->indmax[0] = indmax+1; |
|
|
l1->totCLlength = CLlength; |
|
|
for(Int_t i=0; i<CLlength; i++){ |
|
|
l1->clsignal[i] = clsignal[i]; |
|
|
l1->clsigma[i] = clsigma[i]; |
|
|
l1->cladc[i] = cladc[i]; |
|
|
l1->clbad[i] = clbad[i]; |
|
|
}; |
|
321 |
|
|
322 |
return l1; |
l1->nclstr1 = 1; |
323 |
|
l1->view[0] = view; |
324 |
|
l1->ladder[0] = GetLadder(); |
325 |
|
l1->maxs[0] = maxs; |
326 |
|
l1->mult[0] = GetMultiplicity(); |
327 |
|
l1->dedx[0] = GetSignal(); |
328 |
|
l1->indstart[0] = 1; |
329 |
|
l1->indmax[0] = indmax+1; |
330 |
|
l1->totCLlength = CLlength; |
331 |
|
for(Int_t i=0; i<CLlength; i++){ |
332 |
|
l1->clsignal[i] = clsignal[i]; |
333 |
|
l1->clsigma[i] = clsigma[i]; |
334 |
|
l1->cladc[i] = cladc[i]; |
335 |
|
l1->clbad[i] = clbad[i]; |
336 |
|
}; |
337 |
|
|
338 |
|
return l1; |
339 |
}; |
}; |
340 |
//-------------------------------------- |
//-------------------------------------- |
341 |
// |
// |
349 |
*/ |
*/ |
350 |
Float_t TrkCluster::GetCOG(Int_t ncog){ |
Float_t TrkCluster::GetCOG(Int_t ncog){ |
351 |
|
|
352 |
int ic = 1; |
int ic = 1; |
353 |
level1event_ = *GetLevel1Struct(); |
GetLevel1Struct(); |
354 |
return cog_(&ncog,&ic); |
return cog_(&ncog,&ic); |
355 |
|
|
356 |
|
}; |
357 |
|
/** |
358 |
|
* Evaluates the Center-Of-Gravity (COG) of the cluster, in strips, relative to the strip with the maximum signal (TrkCluster::maxs), |
359 |
|
* choosing the number of strips according to the angle, as implemented for the eta-algorythm . |
360 |
|
* @param angle Projected angle in degree. |
361 |
|
*/ |
362 |
|
Float_t TrkCluster::GetCOG(Float_t angle){ |
363 |
|
|
364 |
|
Int_t neta = 0; |
365 |
|
|
366 |
|
// Float_t eta = GetETA(0,angle); |
367 |
|
// for(neta=2; neta<10; neta++) if( eta == GetETA(neta,angle) ) break; |
368 |
|
// if(eta != GetETA(neta,angle) )cout << "Attenzione!! pasticcio "<<endl; |
369 |
|
|
370 |
|
if( view%2 ){ //Y |
371 |
|
neta=2; |
372 |
|
}else{ //X |
373 |
|
if( fabs(angle) <= 10. ){ |
374 |
|
neta = 2; |
375 |
|
}else if( fabs(angle) > 10. && fabs(angle) <= 15. ){ |
376 |
|
neta = 3; |
377 |
|
}else{ |
378 |
|
neta = 4; |
379 |
|
}; |
380 |
|
}; |
381 |
|
|
382 |
|
return GetCOG(neta); |
383 |
|
|
384 |
}; |
}; |
385 |
//-------------------------------------- |
//-------------------------------------- |
394 |
*/ |
*/ |
395 |
Float_t TrkCluster::GetETA(Int_t neta, float angle){ |
Float_t TrkCluster::GetETA(Int_t neta, float angle){ |
396 |
|
|
397 |
|
// cout << "GetETA(neta,angle) "<< neta << " "<< angle; |
398 |
// LoadPfaParam(); |
// LoadPfaParam(); |
399 |
int ic = 1; |
|
400 |
level1event_ = *GetLevel1Struct(); |
float ax = angle; |
401 |
if(neta == 0) return pfaeta_(&ic,&angle); |
int ic = 1; |
402 |
else if(neta == 2) return pfaeta2_(&ic,&angle); |
GetLevel1Struct(); |
403 |
else if(neta == 3) return pfaeta3_(&ic,&angle); |
if(neta == 0) return pfaeta_(&ic,&ax); |
404 |
else if(neta == 4) return pfaeta4_(&ic,&angle); |
else if(neta == 2) return pfaeta2_(&ic,&ax); |
405 |
else cout << "ETA"<<neta<<" not implemented\n"; |
else if(neta == 3) return pfaeta3_(&ic,&ax); |
406 |
return 0; |
else if(neta == 4) return pfaeta4_(&ic,&ax); |
407 |
|
else cout << "ETA"<<neta<<" not implemented\n"; |
408 |
|
return 0; |
409 |
|
|
410 |
}; |
}; |
411 |
|
|
412 |
//-------------------------------------- |
//-------------------------------------- |
414 |
// |
// |
415 |
//-------------------------------------- |
//-------------------------------------- |
416 |
TrkLevel1::TrkLevel1(){ |
TrkLevel1::TrkLevel1(){ |
417 |
|
|
418 |
// good1 = -1; |
// cout << "TrkLevel1::TrkLevel1()"<<endl; |
419 |
|
// Cluster = new TClonesArray("TrkCluster"); |
420 |
Cluster = new TClonesArray("TrkCluster"); |
Cluster = 0; |
421 |
|
for(Int_t i=0; i<12 ; i++){ |
422 |
for(Int_t i=0; i<12 ; i++){ |
good[i] = -1; |
423 |
// crc[i] = -1; |
for(Int_t j=0; j<24 ; j++){ |
424 |
good[i] = -1; |
cn[j][i]=0; |
425 |
for(Int_t j=0; j<24 ; j++){ |
cnn[j][i]=0; |
|
cnev[j][i]=0; |
|
|
cnnev[j][i]=0; |
|
|
}; |
|
|
// fshower[i]=0; |
|
426 |
}; |
}; |
427 |
|
}; |
428 |
} |
} |
429 |
//-------------------------------------- |
//-------------------------------------- |
430 |
// |
// |
432 |
//-------------------------------------- |
//-------------------------------------- |
433 |
void TrkLevel1::Dump(){ |
void TrkLevel1::Dump(){ |
434 |
|
|
435 |
cout<<"DSP status: "; |
cout<<"DSP status: "; |
436 |
for(Int_t i=0; i<12 ; i++)cout<<good[i]<<" "; |
for(Int_t i=0; i<12 ; i++)cout<<good[i]<<" "; |
437 |
cout<<endl; |
cout<<endl; |
438 |
|
cout<<"VA1 mask : "<<endl; |
439 |
TClonesArray &t = *Cluster; |
for(Int_t i=0; i<12 ; i++){ |
440 |
for(int i=0; i<this->nclstr(); i++) ((TrkCluster *)t[i])->Dump(); |
for(Int_t ii=0; ii<24 ; ii++){ |
441 |
|
Int_t mask = cnn[ii][i]; |
442 |
|
if(mask>0)mask=1; |
443 |
|
cout<<mask<<" "; |
444 |
|
} |
445 |
|
cout <<endl; |
446 |
|
} |
447 |
|
|
448 |
|
if(!Cluster)return; |
449 |
|
TClonesArray &t = *Cluster; |
450 |
|
for(int i=0; i<this->nclstr(); i++) ((TrkCluster *)t[i])->Dump(); |
451 |
|
|
452 |
} |
} |
453 |
//-------------------------------------- |
//-------------------------------------- |
454 |
// |
// |
457 |
/** |
/** |
458 |
* Fills a TrkLevel1 object with values from a struct cTrkLevel1 (to get data from F77 common). |
* Fills a TrkLevel1 object with values from a struct cTrkLevel1 (to get data from F77 common). |
459 |
*/ |
*/ |
460 |
void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1){ |
void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1, Bool_t full){ |
461 |
|
|
462 |
// *** CLUSTER *** |
// --------------- |
463 |
TrkCluster* t_cl = new TrkCluster(); |
// *** CLUSTER *** |
464 |
TClonesArray &t = *Cluster; |
// --------------- |
465 |
for(int i=0; i<l1->nclstr1; i++){ |
TrkCluster* t_cl = new TrkCluster(); |
466 |
|
if(!Cluster)Cluster = new TClonesArray("TrkCluster"); |
467 |
t_cl->view = l1->view[i]; |
TClonesArray &t = *Cluster; |
468 |
t_cl->maxs = l1->maxs[i]; |
for(int i=0; i<l1->nclstr1; i++){ |
469 |
t_cl->indmax = l1->indmax[i] - l1->indstart[i]; |
|
470 |
|
t_cl->Clear(); |
471 |
Int_t from = l1->indstart[i] -1; |
// if( full || (!full && l1->whichtrack[i]) ){ |
472 |
Int_t to = l1->totCLlength ; |
|
473 |
if(i != l1->nclstr1-1)to = l1->indstart[i+1] -1 ; |
t_cl->view = l1->view[i]; |
474 |
t_cl->CLlength = to - from ; |
t_cl->maxs = l1->maxs[i]; |
475 |
|
|
476 |
t_cl->clsignal = new Float_t[t_cl->CLlength]; |
if( full || (!full && l1->whichtrack[i]) ){ |
477 |
t_cl->clsigma = new Float_t[t_cl->CLlength]; |
t_cl->indmax = l1->indmax[i] - l1->indstart[i]; |
478 |
t_cl->cladc = new Int_t[t_cl->CLlength]; |
Int_t from = l1->indstart[i] -1; |
479 |
t_cl->clbad = new Bool_t[t_cl->CLlength]; |
Int_t to = l1->totCLlength ; |
480 |
Int_t index = 0; |
if(i != l1->nclstr1-1)to = l1->indstart[i+1] -1 ; |
481 |
for(Int_t is = from; is < to; is++ ){ |
t_cl->CLlength = to - from ; |
482 |
t_cl->clsignal[index] = (Float_t) l1->clsignal[is]; |
|
483 |
t_cl->clsigma[index] = (Float_t) l1->clsigma[is]; |
t_cl->clsignal = new Float_t[t_cl->CLlength]; |
484 |
t_cl->cladc[index] = (Int_t) l1->cladc[is]; |
t_cl->clsigma = new Float_t[t_cl->CLlength]; |
485 |
t_cl->clbad[index] = (Bool_t) l1->clbad[is]; |
t_cl->cladc = new Int_t[t_cl->CLlength]; |
486 |
index++; |
t_cl->clbad = new Bool_t[t_cl->CLlength]; |
487 |
}; |
Int_t index = 0; |
488 |
|
for(Int_t is = from; is < to; is++ ){ |
489 |
new(t[i]) TrkCluster(*t_cl); |
t_cl->clsignal[index] = (Float_t) l1->clsignal[is]; |
490 |
}; |
t_cl->clsigma[index] = (Float_t) l1->clsigma[is]; |
491 |
|
t_cl->cladc[index] = (Int_t) l1->cladc[is]; |
492 |
delete t_cl; |
t_cl->clbad[index] = (Bool_t) l1->clbad[is]; |
493 |
|
index++; |
494 |
// ****general variables**** |
}; |
495 |
|
} |
496 |
for(Int_t i=0; i<12 ; i++){ |
new(t[i]) TrkCluster(*t_cl); // <<< store cluster |
497 |
good[i] = -1; |
}; |
498 |
for(Int_t j=0; j<24 ; j++){ |
|
499 |
cnev[j][i] = l1->cnev[j][i]; |
delete t_cl; |
500 |
cnnev[j][i] = l1->cnnev[j][i]; |
|
501 |
}; |
// ------------------------- |
502 |
|
// ****general variables**** |
503 |
|
// ------------------------- |
504 |
|
for(Int_t i=0; i<12 ; i++){ |
505 |
|
good[i] = l1->good[i]; |
506 |
|
for(Int_t j=0; j<24 ; j++){ |
507 |
|
cn[j][i] = l1->cnev[j][i]; |
508 |
|
// cnrms[j][i] = l1->cnrmsev[j][i]; |
509 |
|
cnn[j][i] = l1->cnnev[j][i]; |
510 |
}; |
}; |
511 |
|
}; |
512 |
|
|
513 |
} |
} |
514 |
/** |
/** |
515 |
* Fills a struct cTrkLevel1 with values from a TrkLevel1 object (to put data into a F77 common). |
* Fills a struct cTrkLevel1 with values from a TrkLevel1 object (to put data into a F77 common). |
517 |
|
|
518 |
cTrkLevel1* TrkLevel1::GetLevel1Struct() { |
cTrkLevel1* TrkLevel1::GetLevel1Struct() { |
519 |
|
|
520 |
cTrkLevel1 *l1=0; |
cTrkLevel1 *l1=0; |
521 |
// |
// |
522 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
523 |
l1->good[i] = good[i]; |
l1->good[i] = good[i]; |
524 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
525 |
l1->cnev[j][i] = cnev[j][i]; |
l1->cnev[j][i] = cn[j][i]; |
526 |
l1->cnnev[j][i] = cnnev[j][i]; |
// l1->cnrmsev[j][i] = cnrms[j][i]; |
527 |
}; |
l1->cnnev[j][i] = cnn[j][i]; |
528 |
}; |
}; |
529 |
|
}; |
530 |
|
|
531 |
// *** CLUSTERS *** |
// *** CLUSTERS *** |
532 |
l1->nclstr1 = Cluster->GetEntries(); |
if(Cluster){ |
533 |
|
l1->nclstr1 = Cluster->GetEntries(); |
534 |
for(Int_t i=0;i<l1->nclstr1;i++){ |
for(Int_t i=0;i<l1->nclstr1;i++){ |
535 |
|
|
536 |
l1->view[i] = ((TrkCluster *)Cluster->At(i))->view; |
l1->view[i] = ((TrkCluster *)Cluster->At(i))->view; |
537 |
l1->maxs[i] = ((TrkCluster *)Cluster->At(i))->maxs; |
l1->maxs[i] = ((TrkCluster *)Cluster->At(i))->maxs; |
538 |
// COMPLETARE // |
// COMPLETARE // |
539 |
// COMPLETARE // |
// COMPLETARE // |
540 |
// COMPLETARE // |
// COMPLETARE // |
541 |
// COMPLETARE // |
// COMPLETARE // |
542 |
// COMPLETARE // |
// COMPLETARE // |
543 |
// COMPLETARE // |
// COMPLETARE // |
544 |
|
|
545 |
} |
} |
546 |
// COMPLETARE // |
// COMPLETARE // |
547 |
// COMPLETARE // |
// COMPLETARE // |
549 |
// COMPLETARE // |
// COMPLETARE // |
550 |
// COMPLETARE // |
// COMPLETARE // |
551 |
// COMPLETARE // |
// COMPLETARE // |
552 |
return l1; |
} |
553 |
|
return l1; |
554 |
} |
} |
555 |
//-------------------------------------- |
//-------------------------------------- |
556 |
// |
// |
557 |
// |
// |
558 |
//-------------------------------------- |
//-------------------------------------- |
559 |
void TrkLevel1::Clear(){ |
void TrkLevel1::Clear(){ |
560 |
|
|
561 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
562 |
good[i] = -1; |
good[i] = -1; |
563 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
564 |
cnev[j][i] = 0; |
cn[j][i] = 0; |
565 |
cnnev[j][i] = 0; |
cnn[j][i] = 0; |
566 |
}; |
}; |
567 |
}; |
}; |
568 |
// |
// if(Cluster)Cluster->Clear("C"); |
569 |
Cluster->Clear(); |
if(Cluster)Cluster->Delete(); |
570 |
|
|
571 |
} |
} |
572 |
//-------------------------------------- |
//-------------------------------------- |
573 |
// |
// |
574 |
// |
// |
575 |
//-------------------------------------- |
//-------------------------------------- |
576 |
void TrkLevel1::Delete(){ |
void TrkLevel1::Delete(){ |
577 |
|
|
578 |
for(Int_t i=0; i<12 ; i++){ |
// Clear(); |
579 |
good[i] = -1; |
if(Cluster)Cluster->Delete(); |
580 |
for(Int_t j=0; j<24 ; j++){ |
if(Cluster)delete Cluster; |
581 |
cnev[j][i] = 0; |
|
|
cnnev[j][i] = 0; |
|
|
}; |
|
|
}; |
|
|
// |
|
|
Cluster->Delete(); |
|
|
|
|
582 |
} |
} |
|
|
|
583 |
//-------------------------------------- |
//-------------------------------------- |
584 |
// |
// |
585 |
// |
// |
586 |
//-------------------------------------- |
//-------------------------------------- |
587 |
TrkCluster *TrkLevel1::GetCluster(int is){ |
TrkCluster *TrkLevel1::GetCluster(int is){ |
588 |
|
|
589 |
if(is >= this->nclstr()){ |
if(!Cluster)return 0; |
590 |
cout << "** TrkLevel1::GetCluster(int) ** Cluster "<< is << " does not exits! " << endl; |
if(is >= nclstr()){ |
591 |
cout << "( Stored clusters nclstr() = "<< this->nclstr()<<" )" << endl; |
cout << "** TrkLevel1::GetCluster(int) ** Cluster "<< is << " does not exits! " << endl; |
592 |
return 0; |
cout << "( Stored clusters nclstr() = "<< this->nclstr()<<" )" << endl; |
593 |
} |
return 0; |
594 |
TClonesArray &t = *(Cluster); |
} |
595 |
TrkCluster *cluster = (TrkCluster*)t[is]; |
|
596 |
return cluster; |
TClonesArray &t = *(Cluster); |
597 |
|
TrkCluster *cluster = (TrkCluster*)t[is]; |
598 |
|
return cluster; |
599 |
} |
} |
600 |
//-------------------------------------- |
//-------------------------------------- |
601 |
// |
// |
607 |
*/ |
*/ |
608 |
int TrkLevel1::LoadPfaParam(TString path){ |
int TrkLevel1::LoadPfaParam(TString path){ |
609 |
|
|
610 |
if( strcmp(path_.path,path.Data()) ){ |
if( strcmp(path_.path,path.Data()) ){ |
611 |
cout <<"Loading p.f.a. parameters\n"; |
cout <<"Loading p.f.a. param::eters\n"; |
612 |
strcpy(path_.path,path.Data()); |
strcpy(path_.path,path.Data()); |
613 |
path_.pathlen = path.Length(); |
path_.pathlen = path.Length(); |
614 |
path_.error = 0; |
path_.error = 0; |
615 |
return readetaparam_(); |
return readetaparam_(); |
616 |
} |
} |
617 |
return 0; |
return 0; |
618 |
} |
} |
619 |
|
|
620 |
|
|