]>
Commit | Line | Data |
---|---|---|
04366a57 | 1 | /************************************************************************** |
b42cfa25 | 2 | * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * |
04366a57 | 3 | * * |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
308b5ea4 | 15 | |
16 | /* $Id$ */ | |
17 | ||
04366a57 | 18 | //////////////////////////////////////////////////////////////////////////// |
19 | // Implementation of the ITS clusterer V2 class // | |
20 | // // | |
21 | // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch // | |
308b5ea4 | 22 | // Revised: Enrico Fragiacomo, enrico.fragiacomo@ts.infn.it // |
04366a57 | 23 | // // |
24 | /////////////////////////////////////////////////////////////////////////// | |
25 | ||
308b5ea4 | 26 | #include <Riostream.h> |
27 | ||
04366a57 | 28 | |
29 | #include "AliITSClusterFinderV2SSD.h" | |
00a7cc50 | 30 | #include "AliITSRecPoint.h" |
1f3e997f | 31 | #include "AliITSgeomTGeo.h" |
7d62fb64 | 32 | #include "AliITSDetTypeRec.h" |
04366a57 | 33 | #include "AliRawReader.h" |
34 | #include "AliITSRawStreamSSD.h" | |
04366a57 | 35 | #include <TClonesArray.h> |
04366a57 | 36 | #include "AliITSdigitSSD.h" |
3a4139a2 | 37 | #include "AliITSCalibrationSSD.h" |
04366a57 | 38 | |
308b5ea4 | 39 | Short_t *AliITSClusterFinderV2SSD::fgPairs = 0x0; |
40 | Int_t AliITSClusterFinderV2SSD::fgPairsSize = 0; | |
c157c94e | 41 | |
04366a57 | 42 | ClassImp(AliITSClusterFinderV2SSD) |
43 | ||
44 | ||
e56160b8 | 45 | AliITSClusterFinderV2SSD::AliITSClusterFinderV2SSD(AliITSDetTypeRec* dettyp):AliITSClusterFinderV2(dettyp), |
1f3e997f | 46 | fLastSSD1(AliITSgeomTGeo::GetModuleIndex(6,1,1)-1), |
e56160b8 | 47 | fYpitchSSD(0.0095), |
48 | fHwSSD(3.65), | |
49 | fHlSSD(2.00), | |
50 | fTanP(0.0275), | |
51 | fTanN(0.0075){ | |
04366a57 | 52 | |
53 | //Default constructor | |
54 | ||
04366a57 | 55 | } |
56 | ||
308b5ea4 | 57 | //______________________________________________________________________ |
58 | AliITSClusterFinderV2SSD::AliITSClusterFinderV2SSD(const AliITSClusterFinderV2SSD &cf) : AliITSClusterFinderV2(cf), fLastSSD1(cf.fLastSSD1), | |
59 | fYpitchSSD(cf.fYpitchSSD), | |
60 | fHwSSD(cf.fHwSSD), | |
61 | fHlSSD(cf.fHlSSD), | |
62 | fTanP(cf.fTanP), | |
63 | fTanN(cf.fTanN) | |
64 | { | |
65 | // Copy constructor | |
66 | ||
67 | } | |
68 | ||
69 | //______________________________________________________________________ | |
70 | AliITSClusterFinderV2SSD& AliITSClusterFinderV2SSD::operator=(const AliITSClusterFinderV2SSD& cf ){ | |
71 | // Assignment operator | |
72 | ||
73 | this->~AliITSClusterFinderV2SSD(); | |
74 | new(this) AliITSClusterFinderV2SSD(cf); | |
75 | return *this; | |
76 | } | |
77 | ||
04366a57 | 78 | |
79 | void AliITSClusterFinderV2SSD::FindRawClusters(Int_t mod){ | |
80 | ||
81 | //Find clusters V2 | |
82 | SetModule(mod); | |
83 | FindClustersSSD(fDigits); | |
84 | ||
85 | } | |
86 | ||
87 | void AliITSClusterFinderV2SSD::FindClustersSSD(TClonesArray *alldigits) { | |
88 | //------------------------------------------------------------ | |
89 | // Actual SSD cluster finder | |
90 | //------------------------------------------------------------ | |
3a4139a2 | 91 | AliITSCalibrationSSD* cal = (AliITSCalibrationSSD*)GetResp(fModule); |
92 | Float_t gain=0; | |
93 | ||
04366a57 | 94 | Int_t smaxall=alldigits->GetEntriesFast(); |
95 | if (smaxall==0) return; | |
f7b30404 | 96 | // TObjArray *digits = new TObjArray; |
97 | TObjArray digits; | |
04366a57 | 98 | for (Int_t i=0;i<smaxall; i++){ |
99 | AliITSdigitSSD *d=(AliITSdigitSSD*)alldigits->UncheckedAt(i); | |
3a4139a2 | 100 | |
101 | if(d->IsSideP()) gain = cal->GetGainP(d->GetStripNumber()); | |
102 | else gain = cal->GetGainN(d->GetStripNumber()); | |
103 | ||
104 | Float_t q=gain*d->GetSignal(); // calibration brings mip peaks around 120 (in ADC units) | |
105 | q=cal->ADCToKeV(q); // converts the charge in KeV from ADC units | |
106 | //Float_t q=d->GetSignal()/4.29;// temp. fix (for PID purposed - normalis. to be checked) | |
6490e1c5 | 107 | d->SetSignal(Int_t(q)); |
3a4139a2 | 108 | |
04366a57 | 109 | if (d->GetSignal()<3) continue; |
f7b30404 | 110 | digits.AddLast(d); |
04366a57 | 111 | } |
f7b30404 | 112 | Int_t smax = digits.GetEntriesFast(); |
04366a57 | 113 | if (smax==0) return; |
114 | ||
115 | const Int_t kMax=1000; | |
116 | Int_t np=0, nn=0; | |
117 | Ali1Dcluster pos[kMax], neg[kMax]; | |
118 | Float_t y=0., q=0., qmax=0.; | |
119 | Int_t lab[4]={-2,-2,-2,-2}; | |
120 | ||
f7b30404 | 121 | AliITSdigitSSD *d=(AliITSdigitSSD*)digits.UncheckedAt(0); |
04366a57 | 122 | q += d->GetSignal(); |
123 | y += d->GetCoord2()*d->GetSignal(); | |
124 | qmax=d->GetSignal(); | |
125 | lab[0]=d->GetTrack(0); lab[1]=d->GetTrack(1); lab[2]=d->GetTrack(2); | |
126 | Int_t curr=d->GetCoord2(); | |
127 | Int_t flag=d->GetCoord1(); | |
128 | Int_t *n=&nn; | |
129 | Ali1Dcluster *c=neg; | |
130 | Int_t nd=1; | |
131 | Int_t milab[10]; | |
132 | for (Int_t ilab=0;ilab<10;ilab++){ | |
133 | milab[ilab]=-2; | |
134 | } | |
135 | milab[0]=d->GetTrack(0); milab[1]=d->GetTrack(1); milab[2]=d->GetTrack(2); | |
136 | ||
137 | for (Int_t s=1; s<smax; s++) { | |
f7b30404 | 138 | d=(AliITSdigitSSD*)digits.UncheckedAt(s); |
04366a57 | 139 | Int_t strip=d->GetCoord2(); |
140 | if ((strip-curr) > 1 || flag!=d->GetCoord1()) { | |
141 | c[*n].SetY(y/q); | |
142 | c[*n].SetQ(q); | |
143 | c[*n].SetNd(nd); | |
144 | CheckLabels2(milab); | |
145 | c[*n].SetLabels(milab); | |
146 | //Split suspiciously big cluster | |
04366a57 | 147 | if (nd>4&&nd<25) { |
148 | c[*n].SetY(y/q-0.25*nd); | |
149 | c[*n].SetQ(0.5*q); | |
150 | (*n)++; | |
151 | if (*n==kMax) { | |
152 | Error("FindClustersSSD","Too many 1D clusters !"); | |
153 | return; | |
154 | } | |
155 | c[*n].SetY(y/q+0.25*nd); | |
156 | c[*n].SetQ(0.5*q); | |
157 | c[*n].SetNd(nd); | |
158 | c[*n].SetLabels(milab); | |
159 | } | |
160 | (*n)++; | |
161 | if (*n==kMax) { | |
162 | Error("FindClustersSSD","Too many 1D clusters !"); | |
163 | return; | |
164 | } | |
165 | y=q=qmax=0.; | |
166 | nd=0; | |
167 | lab[0]=lab[1]=lab[2]=-2; | |
168 | // | |
169 | for (Int_t ilab=0;ilab<10;ilab++){ | |
170 | milab[ilab]=-2; | |
171 | } | |
172 | // | |
173 | if (flag!=d->GetCoord1()) { n=&np; c=pos; } | |
174 | } | |
175 | flag=d->GetCoord1(); | |
176 | q += d->GetSignal(); | |
177 | y += d->GetCoord2()*d->GetSignal(); | |
178 | nd++; | |
179 | if (d->GetSignal()>qmax) { | |
180 | qmax=d->GetSignal(); | |
181 | lab[0]=d->GetTrack(0); lab[1]=d->GetTrack(1); lab[2]=d->GetTrack(2); | |
182 | } | |
183 | for (Int_t ilab=0;ilab<10;ilab++) { | |
184 | if (d->GetTrack(ilab)>=0) AddLabel(milab, (d->GetTrack(ilab))); | |
185 | } | |
186 | curr=strip; | |
187 | } | |
188 | c[*n].SetY(y/q); | |
189 | c[*n].SetQ(q); | |
190 | c[*n].SetNd(nd); | |
191 | c[*n].SetLabels(lab); | |
192 | //Split suspiciously big cluster | |
193 | if (nd>4 && nd<25) { | |
194 | c[*n].SetY(y/q-0.25*nd); | |
195 | c[*n].SetQ(0.5*q); | |
196 | (*n)++; | |
197 | if (*n==kMax) { | |
198 | Error("FindClustersSSD","Too many 1D clusters !"); | |
199 | return; | |
200 | } | |
201 | c[*n].SetY(y/q+0.25*nd); | |
202 | c[*n].SetQ(0.5*q); | |
203 | c[*n].SetNd(nd); | |
204 | c[*n].SetLabels(lab); | |
205 | } | |
206 | (*n)++; | |
207 | if (*n==kMax) { | |
208 | Error("FindClustersSSD","Too many 1D clusters !"); | |
209 | return; | |
210 | } | |
211 | ||
212 | FindClustersSSD(neg, nn, pos, np); | |
213 | } | |
214 | ||
215 | ||
216 | void AliITSClusterFinderV2SSD::RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters){ | |
217 | ||
218 | //------------------------------------------------------------ | |
219 | // This function creates ITS clusters from raw data | |
220 | //------------------------------------------------------------ | |
221 | rawReader->Reset(); | |
b42cfa25 | 222 | /* |
223 | const UInt_t *evid; evid = rawReader->GetEventId(); | |
224 | cout<<"Event="<<evid[0]<<endl; | |
225 | */ | |
04366a57 | 226 | AliITSRawStreamSSD inputSSD(rawReader); |
8297cd8f | 227 | // rawReader->SelectEquipment(-1,0,15); |
04366a57 | 228 | FindClustersSSD(&inputSSD,clusters); |
229 | ||
230 | } | |
231 | ||
3a4139a2 | 232 | void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input, |
04366a57 | 233 | TClonesArray** clusters) |
234 | { | |
235 | //------------------------------------------------------------ | |
236 | // Actual SSD cluster finder for raw data | |
237 | //------------------------------------------------------------ | |
238 | Int_t nClustersSSD = 0; | |
239 | const Int_t kMax = 1000; | |
240 | Ali1Dcluster clusters1D[2][kMax]; | |
241 | Int_t nClusters[2] = {0, 0}; | |
242 | Int_t lab[3]={-2,-2,-2}; | |
243 | Float_t q = 0.; | |
244 | Float_t y = 0.; | |
245 | Int_t nDigits = 0; | |
3a4139a2 | 246 | Float_t gain=0; |
308b5ea4 | 247 | Float_t noise=0.; |
5ffe058f | 248 | // Float_t pedestal=0.; |
308b5ea4 | 249 | Float_t oldnoise=0.; |
b4704be3 | 250 | AliITSCalibrationSSD* cal=NULL; |
308b5ea4 | 251 | |
308b5ea4 | 252 | Int_t matrix[12][1536]; |
d5ad0697 | 253 | Int_t iddl=-1; |
254 | Int_t iad=-1; | |
255 | Int_t oddl = -1; | |
256 | Int_t oad = -1; | |
257 | Int_t oadc = -1; | |
258 | Int_t ostrip = -1; | |
308b5ea4 | 259 | Int_t osignal = 65535; |
308b5ea4 | 260 | Int_t n=0; |
261 | Bool_t next=0; | |
04366a57 | 262 | |
263 | // read raw data input stream | |
264 | while (kTRUE) { | |
308b5ea4 | 265 | |
266 | // reset signal matrix | |
267 | for(Int_t i=0; i<12; i++) { for(Int_t j=0; j<1536; j++) { matrix[i][j] = 65535;} } | |
b42cfa25 | 268 | |
308b5ea4 | 269 | if(osignal!=65535) { |
270 | n++; | |
271 | matrix[oadc][ostrip] = osignal; // recover data from previous occurence of input->Next() | |
272 | } | |
b42cfa25 | 273 | |
308b5ea4 | 274 | // buffer data for ddl=iddl and ad=iad |
275 | while(kTRUE) { | |
bc4dd89a | 276 | |
308b5ea4 | 277 | next = input->Next(); |
d5ad0697 | 278 | if((!next)&&(input->flag)) continue; |
279 | Int_t ddl=input->GetDDL(); | |
280 | Int_t ad=input->GetAD(); | |
281 | Int_t adc = input->GetADC(); adc = (adc<6)? adc : adc - 2; | |
282 | Int_t strip = input->GetStrip(); | |
308b5ea4 | 283 | if(input->GetSideFlag()) strip=1535-strip; |
d5ad0697 | 284 | Int_t signal = input->GetSignal(); |
308b5ea4 | 285 | //cout<<ddl<<" "<<ad<<" "<<adc<<" "<<strip<<" "<<signal<<endl; |
b42cfa25 | 286 | |
308b5ea4 | 287 | if((ddl==iddl)&&(ad==iad)) {n++; matrix[adc][strip] = signal;} |
288 | else {oddl=iddl; oad=iad; oadc = adc; ostrip = strip; osignal=signal; iddl=ddl; iad=ad; break;} | |
289 | ||
b42cfa25 | 290 | if(!next) {oddl=iddl; oad=iad; oadc = adc; ostrip = strip; osignal=signal; iddl=ddl; iad=ad; break;} |
291 | //break; | |
308b5ea4 | 292 | } |
b42cfa25 | 293 | |
294 | // No SSD data | |
d5ad0697 | 295 | if(!next && oddl<0) break; |
b42cfa25 | 296 | |
308b5ea4 | 297 | if(n==0) continue; // first occurence |
298 | n=0; osignal=0; | |
b42cfa25 | 299 | |
308b5ea4 | 300 | // fill 1Dclusters |
301 | for(Int_t iadc=0; iadc<12; iadc++) { // loop over ADC index for ddl=oddl and ad=oad | |
b42cfa25 | 302 | |
308b5ea4 | 303 | Int_t iimod = (oad - 1) * 12 + iadc; |
d5ad0697 | 304 | Int_t iModule = AliITSRawStreamSSD::GetModuleNumber(oddl,iimod); |
308b5ea4 | 305 | if(iModule==-1) continue; |
b42cfa25 | 306 | // cout<<"ddl="<<oddl<<" ad"<<oad<<" module="<<iModule<<endl; |
308b5ea4 | 307 | cal = (AliITSCalibrationSSD*)GetResp(iModule); |
b42cfa25 | 308 | |
308b5ea4 | 309 | Bool_t first = 0; |
b42cfa25 | 310 | |
bc4dd89a | 311 | /* |
308b5ea4 | 312 | for(Int_t istrip=0; istrip<768; istrip++) { // P-side |
d5ad0697 | 313 | Int_t signal = matrix[iadc][istrip]; |
b42cfa25 | 314 | pedestal = cal->GetPedestalP(istrip); |
e7f0e76b | 315 | matrix[iadc][istrip]=signal-(Int_t)pedestal; |
bc4dd89a | 316 | } |
317 | */ | |
318 | ||
319 | /* | |
b42cfa25 | 320 | Float_t cmode=0; |
321 | for(Int_t l=0; l<6; l++) { | |
322 | cmode=0; | |
323 | for(Int_t n=20; n<108; n++) cmode+=matrix[iadc][l*128+n]; | |
324 | cmode/=88.; | |
e7f0e76b | 325 | for(Int_t n=0; n<128; n++) matrix[iadc][l*128+n]-=(Int_t)cmode; |
b42cfa25 | 326 | |
327 | } | |
bc4dd89a | 328 | */ |
329 | ||
b42cfa25 | 330 | for(Int_t istrip=0; istrip<768; istrip++) { // P-side |
331 | ||
332 | Int_t signal = TMath::Abs(matrix[iadc][istrip]); | |
333 | ||
308b5ea4 | 334 | oldnoise = noise; |
b42cfa25 | 335 | noise = cal->GetNoiseP(istrip); if(noise<1.) signal = 65535; |
336 | if(signal<5*noise) signal = 65535; // in case ZS was not done in hw do it now | |
337 | if( (signal<30.) || (istrip<10) || (istrip>758) ) signal=65535; | |
308b5ea4 | 338 | |
339 | if (signal!=65535) { | |
340 | gain = cal->GetGainP(istrip); | |
341 | signal = (Int_t) ( signal * gain ); // signal is corrected for gain | |
308b5ea4 | 342 | signal = (Int_t) cal->ADCToKeV( signal ); // signal is converted in KeV |
b42cfa25 | 343 | |
308b5ea4 | 344 | q += signal; // add digit to current cluster |
345 | y += istrip * signal; | |
346 | nDigits++; | |
347 | first=1; | |
348 | } | |
b42cfa25 | 349 | |
308b5ea4 | 350 | else if(first) { |
b42cfa25 | 351 | |
308b5ea4 | 352 | if ( ((nDigits==1)&&(q>5*oldnoise)) || (nDigits>1) ) { |
b42cfa25 | 353 | |
308b5ea4 | 354 | Ali1Dcluster& cluster = clusters1D[0][nClusters[0]++]; |
355 | cluster.SetY(y/q); | |
356 | cluster.SetQ(q); | |
357 | cluster.SetNd(nDigits); | |
358 | cluster.SetLabels(lab); | |
359 | ||
360 | //Split suspiciously big cluster | |
361 | if (nDigits > 4&&nDigits < 25) { | |
362 | cluster.SetY(y/q - 0.25*nDigits); | |
363 | cluster.SetQ(0.5*q); | |
364 | if (nClusters[0] == kMax) { | |
365 | Error("FindClustersSSD", "Too many 1D clusters !"); | |
366 | return; | |
367 | } | |
368 | Ali1Dcluster& cluster2 = clusters1D[0][nClusters[0]++]; | |
369 | cluster2.SetY(y/q + 0.25*nDigits); | |
370 | cluster2.SetQ(0.5*q); | |
371 | cluster2.SetNd(nDigits); | |
372 | cluster2.SetLabels(lab); | |
373 | } | |
374 | ||
375 | } | |
376 | ||
377 | y = q = 0.; | |
378 | nDigits = 0; | |
379 | first=0; | |
04366a57 | 380 | } |
308b5ea4 | 381 | |
382 | } // loop over strip on P-side | |
383 | ||
384 | // if last strip does have signal | |
385 | if(first) { | |
386 | ||
387 | if ( ((nDigits==1)&&(q>5*oldnoise)) || (nDigits>1) ) { | |
388 | ||
389 | Ali1Dcluster& cluster = clusters1D[0][nClusters[0]++]; | |
390 | cluster.SetY(y/q); | |
391 | cluster.SetQ(q); | |
392 | cluster.SetNd(nDigits); | |
393 | cluster.SetLabels(lab); | |
394 | ||
395 | //Split suspiciously big cluster | |
396 | if (nDigits > 4&&nDigits < 25) { | |
397 | cluster.SetY(y/q - 0.25*nDigits); | |
398 | cluster.SetQ(0.5*q); | |
399 | if (nClusters[0] == kMax) { | |
400 | Error("FindClustersSSD", "Too many 1D clusters !"); | |
401 | return; | |
402 | } | |
403 | Ali1Dcluster& cluster2 = clusters1D[0][nClusters[0]++]; | |
404 | cluster2.SetY(y/q + 0.25*nDigits); | |
405 | cluster2.SetQ(0.5*q); | |
406 | cluster2.SetNd(nDigits); | |
407 | cluster2.SetLabels(lab); | |
408 | } | |
409 | ||
410 | } | |
411 | y = q = 0.; | |
412 | nDigits = 0; | |
413 | first=0; | |
04366a57 | 414 | } |
308b5ea4 | 415 | |
bc4dd89a | 416 | /* |
b42cfa25 | 417 | for(Int_t istrip=768; istrip<1536; istrip++) { // P-side |
418 | Int_t signal = matrix[iadc][istrip]; | |
419 | pedestal = cal->GetPedestalN(1535-istrip); | |
e7f0e76b | 420 | matrix[iadc][istrip]=signal-(Int_t)pedestal; |
b42cfa25 | 421 | } |
bc4dd89a | 422 | */ |
b42cfa25 | 423 | |
bc4dd89a | 424 | /* |
b42cfa25 | 425 | for(Int_t l=6; l<12; l++) { |
426 | Float_t cmode=0; | |
427 | for(Int_t n=20; n<108; n++) cmode+=matrix[iadc][l*128+n]; | |
428 | cmode/=88.; | |
e7f0e76b | 429 | for(Int_t n=0; n<128; n++) matrix[iadc][l*128+n]-=(Int_t)cmode; |
b42cfa25 | 430 | } |
bc4dd89a | 431 | */ |
b42cfa25 | 432 | |
308b5ea4 | 433 | oldnoise = 0.; |
434 | noise = 0.; | |
435 | for(Int_t istrip=768; istrip<1536; istrip++) { // N-side | |
436 | ||
b42cfa25 | 437 | Int_t signal = TMath::Abs(matrix[iadc][istrip]); |
438 | //cout<<"####"<<" "<<oddl<<" "<<oad<<" "<<iadc<<" "<<istrip<<" "<<signal<<endl; | |
439 | ||
d5ad0697 | 440 | Int_t strip = 1535-istrip; |
b42cfa25 | 441 | |
308b5ea4 | 442 | oldnoise = noise; |
b42cfa25 | 443 | noise = cal->GetNoiseN(strip); if(noise<1.) signal=65535; |
444 | if(signal<5*noise) signal = 65535; // in case ZS was not done in hw do it now | |
445 | if( (signal<30.) || (istrip<778) || (istrip>1526) ) signal=65535; | |
308b5ea4 | 446 | |
447 | if (signal!=65535) { | |
b42cfa25 | 448 | // cout<<"ddl="<<oddl<<" ad"<<oad<<" module="<<iModule<<" strip= "<<istrip<< |
449 | // " sig="<<signal<<" "<<cal->GetPedestalN(strip)<<endl; | |
308b5ea4 | 450 | gain = cal->GetGainN(strip); |
451 | signal = (Int_t) ( signal * gain); // signal is corrected for gain | |
452 | signal = (Int_t) cal->ADCToKeV( signal ); // signal is converted in KeV | |
453 | ||
454 | // add digit to current cluster | |
455 | q += signal; | |
456 | y += strip * signal; | |
457 | nDigits++; | |
458 | first=1; | |
459 | } | |
460 | ||
461 | else if(first) { | |
462 | ||
463 | if ( ((nDigits==1)&&(q>5*oldnoise)) || (nDigits>1) ) { | |
464 | ||
465 | Ali1Dcluster& cluster = clusters1D[1][nClusters[1]++]; | |
466 | cluster.SetY(y/q); | |
467 | cluster.SetQ(q); | |
468 | cluster.SetNd(nDigits); | |
469 | cluster.SetLabels(lab); | |
470 | ||
471 | //Split suspiciously big cluster | |
472 | if (nDigits > 4&&nDigits < 25) { | |
473 | cluster.SetY(y/q - 0.25*nDigits); | |
474 | cluster.SetQ(0.5*q); | |
475 | if (nClusters[1] == kMax) { | |
476 | Error("FindClustersSSD", "Too many 1D clusters !"); | |
477 | return; | |
478 | } | |
479 | Ali1Dcluster& cluster2 = clusters1D[1][nClusters[1]++]; | |
480 | cluster2.SetY(y/q + 0.25*nDigits); | |
481 | cluster2.SetQ(0.5*q); | |
482 | cluster2.SetNd(nDigits); | |
483 | cluster2.SetLabels(lab); | |
484 | } | |
485 | ||
486 | } | |
487 | y = q = 0.; | |
488 | nDigits = 0; | |
489 | first=0; | |
490 | } | |
491 | ||
492 | } // loop over strips on N-side | |
04366a57 | 493 | |
308b5ea4 | 494 | if(first) { |
495 | ||
496 | if ( ((nDigits==1)&&(q>5*oldnoise)) || (nDigits>1) ) { | |
04366a57 | 497 | |
308b5ea4 | 498 | Ali1Dcluster& cluster = clusters1D[1][nClusters[1]++]; |
499 | cluster.SetY(y/q); | |
500 | cluster.SetQ(q); | |
501 | cluster.SetNd(nDigits); | |
502 | cluster.SetLabels(lab); | |
503 | ||
504 | //Split suspiciously big cluster | |
505 | if (nDigits > 4&&nDigits < 25) { | |
506 | cluster.SetY(y/q - 0.25*nDigits); | |
507 | cluster.SetQ(0.5*q); | |
508 | if (nClusters[1] == kMax) { | |
509 | Error("FindClustersSSD", "Too many 1D clusters !"); | |
510 | return; | |
511 | } | |
512 | Ali1Dcluster& cluster2 = clusters1D[1][nClusters[1]++]; | |
513 | cluster2.SetY(y/q + 0.25*nDigits); | |
514 | cluster2.SetQ(0.5*q); | |
515 | cluster2.SetNd(nDigits); | |
516 | cluster2.SetLabels(lab); | |
517 | } | |
518 | ||
519 | } | |
520 | y = q = 0.; | |
521 | nDigits = 0; | |
522 | first=0; | |
523 | } | |
524 | ||
525 | // create recpoints | |
526 | if((nClusters[0])&&(nClusters[1])) { | |
527 | ||
528 | //cout<<"creating recpoint for module="<<iModule<<" "<<nClusters[0]<<" "<<nClusters[1]<<endl; | |
00a7cc50 | 529 | clusters[iModule] = new TClonesArray("AliITSRecPoint"); |
04366a57 | 530 | fModule = iModule; |
308b5ea4 | 531 | // fModule = 500; |
04366a57 | 532 | FindClustersSSD(&clusters1D[0][0], nClusters[0], |
533 | &clusters1D[1][0], nClusters[1], clusters[iModule]); | |
534 | Int_t nClusters = clusters[iModule]->GetEntriesFast(); | |
535 | nClustersSSD += nClusters; | |
536 | } | |
537 | ||
04366a57 | 538 | nClusters[0] = nClusters[1] = 0; |
539 | y = q = 0.; | |
540 | nDigits = 0; | |
3a4139a2 | 541 | |
308b5ea4 | 542 | } // loop over adc |
04366a57 | 543 | |
d5ad0697 | 544 | if(!next) break; |
04366a57 | 545 | } |
308b5ea4 | 546 | |
04366a57 | 547 | Info("FindClustersSSD", "found clusters in ITS SSD: %d", nClustersSSD); |
548 | } | |
549 | ||
550 | void AliITSClusterFinderV2SSD:: | |
551 | FindClustersSSD(Ali1Dcluster* neg, Int_t nn, | |
552 | Ali1Dcluster* pos, Int_t np, | |
553 | TClonesArray *clusters) { | |
554 | //------------------------------------------------------------ | |
555 | // Actual SSD cluster finder | |
556 | //------------------------------------------------------------ | |
b4704be3 | 557 | |
308b5ea4 | 558 | // Float_t xyz[3]; |
559 | ||
b4704be3 | 560 | const TGeoHMatrix *mT2L=AliITSgeomTGeo::GetTracking2LocalMatrix(fModule); |
561 | ||
04366a57 | 562 | TClonesArray &cl=*clusters; |
563 | // | |
564 | Float_t tanp=fTanP, tann=fTanN; | |
565 | if (fModule>fLastSSD1) {tann=fTanP; tanp=fTanN;} | |
566 | Int_t idet=fNdet[fModule]; | |
567 | Int_t ncl=0; | |
568 | // | |
569 | Int_t negativepair[30000]; | |
570 | Int_t cnegative[3000]; | |
571 | Int_t cused1[3000]; | |
572 | Int_t positivepair[30000]; | |
573 | Int_t cpositive[3000]; | |
574 | Int_t cused2[3000]; | |
575 | for (Int_t i=0;i<3000;i++) {cnegative[i]=0; cused1[i]=0;} | |
576 | for (Int_t i=0;i<3000;i++) {cpositive[i]=0; cused2[i]=0;} | |
78538bfe | 577 | for (Int_t i=0;i<30000;i++) {negativepair[i]=0; positivepair[i]=0;} |
c157c94e | 578 | |
308b5ea4 | 579 | if ((np*nn) > fgPairsSize) { |
580 | if (fgPairs) delete [] fgPairs; | |
581 | fgPairsSize = 4*np*nn; | |
582 | fgPairs = new Short_t[fgPairsSize]; | |
c157c94e | 583 | } |
308b5ea4 | 584 | memset(fgPairs,0,sizeof(Short_t)*np*nn); |
585 | ||
04366a57 | 586 | // |
587 | // find available pairs | |
588 | // | |
589 | for (Int_t i=0; i<np; i++) { | |
590 | Float_t yp=pos[i].GetY()*fYpitchSSD; | |
591 | if (pos[i].GetQ()<3) continue; | |
592 | for (Int_t j=0; j<nn; j++) { | |
593 | if (neg[j].GetQ()<3) continue; | |
594 | Float_t yn=neg[j].GetY()*fYpitchSSD; | |
595 | Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp); | |
596 | Float_t yt=yn + tann*zt; | |
597 | zt-=fHlSSD; yt-=fHwSSD; | |
598 | if (TMath::Abs(yt)<fHwSSD+0.01) | |
599 | if (TMath::Abs(zt)<fHlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) { | |
600 | negativepair[i*10+cnegative[i]] =j; //index | |
601 | positivepair[j*10+cpositive[j]] =i; | |
602 | cnegative[i]++; //counters | |
603 | cpositive[j]++; | |
308b5ea4 | 604 | fgPairs[i*nn+j]=100; |
04366a57 | 605 | } |
606 | } | |
607 | } | |
308b5ea4 | 608 | |
609 | // | |
610 | // try to recover points out of but close to the module boundaries | |
04366a57 | 611 | // |
612 | for (Int_t i=0; i<np; i++) { | |
613 | Float_t yp=pos[i].GetY()*fYpitchSSD; | |
614 | if (pos[i].GetQ()<3) continue; | |
615 | for (Int_t j=0; j<nn; j++) { | |
616 | if (neg[j].GetQ()<3) continue; | |
308b5ea4 | 617 | // if both 1Dclusters have an other cross continue |
04366a57 | 618 | if (cpositive[j]&&cnegative[i]) continue; |
619 | Float_t yn=neg[j].GetY()*fYpitchSSD; | |
620 | Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp); | |
621 | Float_t yt=yn + tann*zt; | |
622 | zt-=fHlSSD; yt-=fHwSSD; | |
623 | if (TMath::Abs(yt)<fHwSSD+0.1) | |
624 | if (TMath::Abs(zt)<fHlSSD+0.15) { | |
308b5ea4 | 625 | // tag 1Dcluster (eventually will produce low quality recpoint) |
04366a57 | 626 | if (cnegative[i]==0) pos[i].SetNd(100); // not available pair |
627 | if (cpositive[j]==0) neg[j].SetNd(100); // not available pair | |
628 | negativepair[i*10+cnegative[i]] =j; //index | |
629 | positivepair[j*10+cpositive[j]] =i; | |
630 | cnegative[i]++; //counters | |
631 | cpositive[j]++; | |
308b5ea4 | 632 | fgPairs[i*nn+j]=100; |
04366a57 | 633 | } |
634 | } | |
635 | } | |
308b5ea4 | 636 | |
04366a57 | 637 | // |
638 | Float_t lp[5]; | |
639 | Int_t milab[10]; | |
640 | Double_t ratio; | |
641 | ||
642 | // | |
643 | // sign gold tracks | |
644 | // | |
645 | for (Int_t ip=0;ip<np;ip++){ | |
646 | Float_t ybest=1000,zbest=1000,qbest=0; | |
647 | // | |
648 | // select gold clusters | |
649 | if ( (cnegative[ip]==1) && cpositive[negativepair[10*ip]]==1){ | |
650 | Float_t yp=pos[ip].GetY()*fYpitchSSD; | |
651 | Int_t j = negativepair[10*ip]; | |
652 | ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ()); | |
653 | // | |
654 | Float_t yn=neg[j].GetY()*fYpitchSSD; | |
655 | Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp); | |
656 | Float_t yt=yn + tann*zt; | |
657 | zt-=fHlSSD; yt-=fHwSSD; | |
658 | ybest=yt; zbest=zt; | |
659 | qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ()); | |
b42cfa25 | 660 | |
661 | //cout<<yt<<" "<<zt<<" "<<qbest<<endl; | |
662 | ||
b4704be3 | 663 | { |
664 | Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.}; | |
665 | mT2L->MasterToLocal(loc,trk); | |
666 | lp[0]=trk[1]; | |
667 | lp[1]=trk[2]; | |
668 | } | |
04366a57 | 669 | lp[2]=0.0025*0.0025; //SigmaY2 |
670 | lp[3]=0.110*0.110; //SigmaZ2 | |
671 | ||
672 | lp[4]=qbest; //Q | |
673 | for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2; | |
674 | for (Int_t ilab=0;ilab<3;ilab++){ | |
675 | milab[ilab] = pos[ip].GetLabel(ilab); | |
676 | milab[ilab+3] = neg[j].GetLabel(ilab); | |
677 | } | |
678 | // | |
679 | CheckLabels2(milab); | |
680 | milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det | |
681 | Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]}; | |
00a7cc50 | 682 | AliITSRecPoint * cl2; |
308b5ea4 | 683 | |
684 | if(clusters){ // Note clusters != 0 when method is called for rawdata | |
685 | ||
686 | ||
75fb37cc | 687 | cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info); |
308b5ea4 | 688 | |
689 | // cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl; | |
690 | ||
00a7cc50 | 691 | cl2->SetChargeRatio(ratio); |
692 | cl2->SetType(1); | |
308b5ea4 | 693 | fgPairs[ip*nn+j]=1; |
00a7cc50 | 694 | if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster |
695 | cl2->SetType(2); | |
308b5ea4 | 696 | fgPairs[ip*nn+j]=2; |
00a7cc50 | 697 | } |
698 | cused1[ip]++; | |
699 | cused2[j]++; | |
700 | ||
701 | } | |
308b5ea4 | 702 | else{ // Note clusters == 0 when method is called for digits |
703 | ||
75fb37cc | 704 | cl2 = new AliITSRecPoint(milab,lp,info); |
308b5ea4 | 705 | |
706 | // cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl; | |
707 | ||
00a7cc50 | 708 | cl2->SetChargeRatio(ratio); |
709 | cl2->SetType(1); | |
308b5ea4 | 710 | fgPairs[ip*nn+j]=1; |
00a7cc50 | 711 | if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster |
712 | cl2->SetType(2); | |
308b5ea4 | 713 | fgPairs[ip*nn+j]=2; |
00a7cc50 | 714 | } |
715 | cused1[ip]++; | |
716 | cused2[j]++; | |
308b5ea4 | 717 | //cout<<"AliITSClusterFinderV2SSD "<<fModule<<" gold"<<endl; |
00a7cc50 | 718 | fDetTypeRec->AddRecPoint(*cl2); |
04366a57 | 719 | } |
720 | ncl++; | |
04366a57 | 721 | } |
722 | } | |
723 | ||
724 | for (Int_t ip=0;ip<np;ip++){ | |
725 | Float_t ybest=1000,zbest=1000,qbest=0; | |
726 | // | |
727 | // | |
728 | // select "silber" cluster | |
729 | if ( cnegative[ip]==1 && cpositive[negativepair[10*ip]]==2){ | |
730 | Int_t in = negativepair[10*ip]; | |
731 | Int_t ip2 = positivepair[10*in]; | |
732 | if (ip2==ip) ip2 = positivepair[10*in+1]; | |
733 | Float_t pcharge = pos[ip].GetQ()+pos[ip2].GetQ(); | |
734 | if (TMath::Abs(pcharge-neg[in].GetQ())<10){ | |
735 | // | |
736 | // add first pair | |
308b5ea4 | 737 | if (fgPairs[ip*nn+in]==100){ // |
04366a57 | 738 | Float_t yp=pos[ip].GetY()*fYpitchSSD; |
739 | Float_t yn=neg[in].GetY()*fYpitchSSD; | |
740 | Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp); | |
741 | Float_t yt=yn + tann*zt; | |
742 | zt-=fHlSSD; yt-=fHwSSD; | |
743 | ybest =yt; zbest=zt; | |
744 | qbest =pos[ip].GetQ(); | |
b4704be3 | 745 | { |
746 | Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.}; | |
747 | mT2L->MasterToLocal(loc,trk); | |
748 | lp[0]=trk[1]; | |
749 | lp[1]=trk[2]; | |
750 | } | |
04366a57 | 751 | lp[2]=0.0025*0.0025; //SigmaY2 |
752 | lp[3]=0.110*0.110; //SigmaZ2 | |
753 | ||
754 | lp[4]=qbest; //Q | |
755 | for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2; | |
756 | for (Int_t ilab=0;ilab<3;ilab++){ | |
757 | milab[ilab] = pos[ip].GetLabel(ilab); | |
758 | milab[ilab+3] = neg[in].GetLabel(ilab); | |
759 | } | |
760 | // | |
761 | CheckLabels2(milab); | |
762 | ratio = (pos[ip].GetQ()-neg[in].GetQ())/(pos[ip].GetQ()+neg[in].GetQ()); | |
763 | milab[3]=(((ip<<10) + in)<<10) + idet; // pos|neg|det | |
764 | Int_t info[3] = {pos[ip].GetNd(),neg[in].GetNd(),fNlayer[fModule]}; | |
765 | ||
00a7cc50 | 766 | AliITSRecPoint * cl2; |
767 | if(clusters){ | |
308b5ea4 | 768 | |
75fb37cc | 769 | cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info); |
308b5ea4 | 770 | |
771 | // cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl; | |
772 | ||
00a7cc50 | 773 | cl2->SetChargeRatio(ratio); |
774 | cl2->SetType(5); | |
308b5ea4 | 775 | fgPairs[ip*nn+in] = 5; |
00a7cc50 | 776 | if ((pos[ip].GetNd()+neg[in].GetNd())>6){ //multi cluster |
777 | cl2->SetType(6); | |
308b5ea4 | 778 | fgPairs[ip*nn+in] = 6; |
00a7cc50 | 779 | } |
780 | } | |
04366a57 | 781 | else{ |
75fb37cc | 782 | cl2 = new AliITSRecPoint(milab,lp,info); |
00a7cc50 | 783 | cl2->SetChargeRatio(ratio); |
784 | cl2->SetType(5); | |
308b5ea4 | 785 | fgPairs[ip*nn+in] = 5; |
00a7cc50 | 786 | if ((pos[ip].GetNd()+neg[in].GetNd())>6){ //multi cluster |
787 | cl2->SetType(6); | |
308b5ea4 | 788 | fgPairs[ip*nn+in] = 6; |
00a7cc50 | 789 | } |
308b5ea4 | 790 | //cout<<"AliITSClusterFinderV2SSD "<<fModule<<" silver1"<<endl; |
791 | ||
00a7cc50 | 792 | fDetTypeRec->AddRecPoint(*cl2); |
04366a57 | 793 | } |
794 | ncl++; | |
04366a57 | 795 | } |
00a7cc50 | 796 | |
04366a57 | 797 | // |
798 | // add second pair | |
799 | ||
00a7cc50 | 800 | // if (!(cused1[ip2] || cused2[in])){ // |
308b5ea4 | 801 | if (fgPairs[ip2*nn+in]==100){ |
04366a57 | 802 | Float_t yp=pos[ip2].GetY()*fYpitchSSD; |
803 | Float_t yn=neg[in].GetY()*fYpitchSSD; | |
804 | Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp); | |
805 | Float_t yt=yn + tann*zt; | |
806 | zt-=fHlSSD; yt-=fHwSSD; | |
807 | ybest =yt; zbest=zt; | |
808 | qbest =pos[ip2].GetQ(); | |
b4704be3 | 809 | { |
810 | Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.}; | |
811 | mT2L->MasterToLocal(loc,trk); | |
812 | lp[0]=trk[1]; | |
813 | lp[1]=trk[2]; | |
814 | } | |
04366a57 | 815 | lp[2]=0.0025*0.0025; //SigmaY2 |
816 | lp[3]=0.110*0.110; //SigmaZ2 | |
817 | ||
818 | lp[4]=qbest; //Q | |
819 | for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2; | |
820 | for (Int_t ilab=0;ilab<3;ilab++){ | |
821 | milab[ilab] = pos[ip2].GetLabel(ilab); | |
822 | milab[ilab+3] = neg[in].GetLabel(ilab); | |
823 | } | |
824 | // | |
825 | CheckLabels2(milab); | |
826 | ratio = (pos[ip2].GetQ()-neg[in].GetQ())/(pos[ip2].GetQ()+neg[in].GetQ()); | |
827 | milab[3]=(((ip2<<10) + in)<<10) + idet; // pos|neg|det | |
828 | Int_t info[3] = {pos[ip2].GetNd(),neg[in].GetNd(),fNlayer[fModule]}; | |
00a7cc50 | 829 | |
830 | AliITSRecPoint * cl2; | |
831 | if(clusters){ | |
75fb37cc | 832 | cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info); |
308b5ea4 | 833 | |
834 | // cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl; | |
835 | ||
00a7cc50 | 836 | cl2->SetChargeRatio(ratio); |
837 | cl2->SetType(5); | |
308b5ea4 | 838 | fgPairs[ip2*nn+in] =5; |
00a7cc50 | 839 | if ((pos[ip2].GetNd()+neg[in].GetNd())>6){ //multi cluster |
840 | cl2->SetType(6); | |
308b5ea4 | 841 | fgPairs[ip2*nn+in] =6; |
00a7cc50 | 842 | } |
843 | } | |
04366a57 | 844 | else{ |
75fb37cc | 845 | cl2 = new AliITSRecPoint(milab,lp,info); |
00a7cc50 | 846 | cl2->SetChargeRatio(ratio); |
847 | cl2->SetType(5); | |
308b5ea4 | 848 | fgPairs[ip2*nn+in] =5; |
00a7cc50 | 849 | if ((pos[ip2].GetNd()+neg[in].GetNd())>6){ //multi cluster |
850 | cl2->SetType(6); | |
308b5ea4 | 851 | fgPairs[ip2*nn+in] =6; |
00a7cc50 | 852 | } |
308b5ea4 | 853 | |
854 | // cout<<"AliITSClusterFinderV2SSD "<<fModule<<" silver2"<<endl; | |
00a7cc50 | 855 | fDetTypeRec->AddRecPoint(*cl2); |
04366a57 | 856 | } |
857 | ncl++; | |
04366a57 | 858 | } |
859 | cused1[ip]++; | |
860 | cused1[ip2]++; | |
861 | cused2[in]++; | |
862 | } | |
863 | } | |
864 | } | |
00a7cc50 | 865 | |
04366a57 | 866 | // |
867 | for (Int_t jn=0;jn<nn;jn++){ | |
868 | if (cused2[jn]) continue; | |
869 | Float_t ybest=1000,zbest=1000,qbest=0; | |
870 | // select "silber" cluster | |
871 | if ( cpositive[jn]==1 && cnegative[positivepair[10*jn]]==2){ | |
872 | Int_t ip = positivepair[10*jn]; | |
873 | Int_t jn2 = negativepair[10*ip]; | |
874 | if (jn2==jn) jn2 = negativepair[10*ip+1]; | |
875 | Float_t pcharge = neg[jn].GetQ()+neg[jn2].GetQ(); | |
876 | // | |
877 | if (TMath::Abs(pcharge-pos[ip].GetQ())<10){ | |
878 | // | |
879 | // add first pair | |
880 | // if (!(cused1[ip]||cused2[jn])){ | |
308b5ea4 | 881 | if (fgPairs[ip*nn+jn]==100){ |
04366a57 | 882 | Float_t yn=neg[jn].GetY()*fYpitchSSD; |
883 | Float_t yp=pos[ip].GetY()*fYpitchSSD; | |
884 | Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp); | |
885 | Float_t yt=yn + tann*zt; | |
886 | zt-=fHlSSD; yt-=fHwSSD; | |
887 | ybest =yt; zbest=zt; | |
888 | qbest =neg[jn].GetQ(); | |
b4704be3 | 889 | { |
890 | Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.}; | |
891 | mT2L->MasterToLocal(loc,trk); | |
892 | lp[0]=trk[1]; | |
893 | lp[1]=trk[2]; | |
894 | } | |
04366a57 | 895 | lp[2]=0.0025*0.0025; //SigmaY2 |
896 | lp[3]=0.110*0.110; //SigmaZ2 | |
897 | ||
898 | lp[4]=qbest; //Q | |
899 | for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2; | |
900 | for (Int_t ilab=0;ilab<3;ilab++){ | |
901 | milab[ilab] = pos[ip].GetLabel(ilab); | |
902 | milab[ilab+3] = neg[jn].GetLabel(ilab); | |
903 | } | |
904 | // | |
905 | CheckLabels2(milab); | |
906 | ratio = (pos[ip].GetQ()-neg[jn].GetQ())/(pos[ip].GetQ()+neg[jn].GetQ()); | |
907 | milab[3]=(((ip<<10) + jn)<<10) + idet; // pos|neg|det | |
908 | Int_t info[3] = {pos[ip].GetNd(),neg[jn].GetNd(),fNlayer[fModule]}; | |
909 | ||
00a7cc50 | 910 | AliITSRecPoint * cl2; |
911 | if(clusters){ | |
75fb37cc | 912 | cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info); |
308b5ea4 | 913 | |
914 | // cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl; | |
915 | ||
00a7cc50 | 916 | cl2->SetChargeRatio(ratio); |
917 | cl2->SetType(7); | |
308b5ea4 | 918 | fgPairs[ip*nn+jn] =7; |
00a7cc50 | 919 | if ((pos[ip].GetNd()+neg[jn].GetNd())>6){ //multi cluster |
920 | cl2->SetType(8); | |
308b5ea4 | 921 | fgPairs[ip*nn+jn]=8; |
00a7cc50 | 922 | } |
923 | ||
924 | } | |
04366a57 | 925 | else{ |
75fb37cc | 926 | cl2 = new AliITSRecPoint(milab,lp,info); |
00a7cc50 | 927 | cl2->SetChargeRatio(ratio); |
928 | cl2->SetType(7); | |
308b5ea4 | 929 | fgPairs[ip*nn+jn] =7; |
00a7cc50 | 930 | if ((pos[ip].GetNd()+neg[jn].GetNd())>6){ //multi cluster |
931 | cl2->SetType(8); | |
308b5ea4 | 932 | fgPairs[ip*nn+jn]=8; |
00a7cc50 | 933 | } |
308b5ea4 | 934 | //cout<<"AliITSClusterFinderV2SSD "<<fModule<<" silverN1"<<endl; |
00a7cc50 | 935 | |
936 | fDetTypeRec->AddRecPoint(*cl2); | |
04366a57 | 937 | } |
938 | ncl++; | |
04366a57 | 939 | } |
940 | // | |
941 | // add second pair | |
942 | // if (!(cused1[ip]||cused2[jn2])){ | |
308b5ea4 | 943 | if (fgPairs[ip*nn+jn2]==100){ |
04366a57 | 944 | Float_t yn=neg[jn2].GetY()*fYpitchSSD; |
945 | Double_t yp=pos[ip].GetY()*fYpitchSSD; | |
946 | Double_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp); | |
947 | Double_t yt=yn + tann*zt; | |
948 | zt-=fHlSSD; yt-=fHwSSD; | |
949 | ybest =yt; zbest=zt; | |
950 | qbest =neg[jn2].GetQ(); | |
b4704be3 | 951 | { |
952 | Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.}; | |
953 | mT2L->MasterToLocal(loc,trk); | |
954 | lp[0]=trk[1]; | |
955 | lp[1]=trk[2]; | |
956 | } | |
04366a57 | 957 | lp[2]=0.0025*0.0025; //SigmaY2 |
958 | lp[3]=0.110*0.110; //SigmaZ2 | |
959 | ||
960 | lp[4]=qbest; //Q | |
961 | for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2; | |
962 | for (Int_t ilab=0;ilab<3;ilab++){ | |
963 | milab[ilab] = pos[ip].GetLabel(ilab); | |
964 | milab[ilab+3] = neg[jn2].GetLabel(ilab); | |
965 | } | |
966 | // | |
967 | CheckLabels2(milab); | |
968 | ratio = (pos[ip].GetQ()-neg[jn2].GetQ())/(pos[ip].GetQ()+neg[jn2].GetQ()); | |
969 | milab[3]=(((ip<<10) + jn2)<<10) + idet; // pos|neg|det | |
970 | Int_t info[3] = {pos[ip].GetNd(),neg[jn2].GetNd(),fNlayer[fModule]}; | |
00a7cc50 | 971 | AliITSRecPoint * cl2; |
972 | if(clusters){ | |
75fb37cc | 973 | cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info); |
308b5ea4 | 974 | |
975 | // cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl; | |
976 | ||
00a7cc50 | 977 | cl2->SetChargeRatio(ratio); |
308b5ea4 | 978 | fgPairs[ip*nn+jn2]=7; |
00a7cc50 | 979 | cl2->SetType(7); |
980 | if ((pos[ip].GetNd()+neg[jn2].GetNd())>6){ //multi cluster | |
981 | cl2->SetType(8); | |
308b5ea4 | 982 | fgPairs[ip*nn+jn2]=8; |
00a7cc50 | 983 | } |
984 | ||
985 | } | |
04366a57 | 986 | else{ |
75fb37cc | 987 | cl2 = new AliITSRecPoint(milab,lp,info); |
00a7cc50 | 988 | cl2->SetChargeRatio(ratio); |
308b5ea4 | 989 | fgPairs[ip*nn+jn2]=7; |
00a7cc50 | 990 | cl2->SetType(7); |
991 | if ((pos[ip].GetNd()+neg[jn2].GetNd())>6){ //multi cluster | |
992 | cl2->SetType(8); | |
308b5ea4 | 993 | fgPairs[ip*nn+jn2]=8; |
00a7cc50 | 994 | } |
308b5ea4 | 995 | //cout<<"AliITSClusterFinderV2SSD "<<fModule<<" silverN2"<<endl; |
996 | ||
00a7cc50 | 997 | fDetTypeRec->AddRecPoint(*cl2); |
04366a57 | 998 | } |
999 | ||
1000 | ncl++; | |
04366a57 | 1001 | } |
1002 | cused1[ip]++; | |
1003 | cused2[jn]++; | |
1004 | cused2[jn2]++; | |
1005 | } | |
1006 | } | |
1007 | } | |
1008 | ||
1009 | for (Int_t ip=0;ip<np;ip++){ | |
1010 | Float_t ybest=1000,zbest=1000,qbest=0; | |
1011 | // | |
1012 | // 2x2 clusters | |
1013 | // | |
1014 | if ( (cnegative[ip]<5) && cpositive[negativepair[10*ip]]<5){ | |
1015 | Float_t minchargediff =4.; | |
1016 | Int_t j=-1; | |
1017 | for (Int_t di=0;di<cnegative[ip];di++){ | |
1018 | Int_t jc = negativepair[ip*10+di]; | |
1019 | Float_t chargedif = pos[ip].GetQ()-neg[jc].GetQ(); | |
1020 | if (TMath::Abs(chargedif)<minchargediff){ | |
1021 | j =jc; | |
1022 | minchargediff = TMath::Abs(chargedif); | |
1023 | } | |
1024 | } | |
1025 | if (j<0) continue; // not proper cluster | |
308b5ea4 | 1026 | |
04366a57 | 1027 | Int_t count =0; |
1028 | for (Int_t di=0;di<cnegative[ip];di++){ | |
1029 | Int_t jc = negativepair[ip*10+di]; | |
1030 | Float_t chargedif = pos[ip].GetQ()-neg[jc].GetQ(); | |
1031 | if (TMath::Abs(chargedif)<minchargediff+3.) count++; | |
1032 | } | |
1033 | if (count>1) continue; // more than one "proper" cluster for positive | |
1034 | // | |
1035 | count =0; | |
1036 | for (Int_t dj=0;dj<cpositive[j];dj++){ | |
1037 | Int_t ic = positivepair[j*10+dj]; | |
1038 | Float_t chargedif = pos[ic].GetQ()-neg[j].GetQ(); | |
1039 | if (TMath::Abs(chargedif)<minchargediff+3.) count++; | |
1040 | } | |
1041 | if (count>1) continue; // more than one "proper" cluster for negative | |
1042 | ||
1043 | Int_t jp = 0; | |
1044 | ||
1045 | count =0; | |
1046 | for (Int_t dj=0;dj<cnegative[jp];dj++){ | |
1047 | Int_t ic = positivepair[jp*10+dj]; | |
1048 | Float_t chargedif = pos[ic].GetQ()-neg[jp].GetQ(); | |
1049 | if (TMath::Abs(chargedif)<minchargediff+4.) count++; | |
1050 | } | |
1051 | if (count>1) continue; | |
308b5ea4 | 1052 | if (fgPairs[ip*nn+j]<100) continue; |
04366a57 | 1053 | // |
1054 | //almost gold clusters | |
1055 | Float_t yp=pos[ip].GetY()*fYpitchSSD; | |
1056 | Float_t yn=neg[j].GetY()*fYpitchSSD; | |
1057 | Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp); | |
1058 | Float_t yt=yn + tann*zt; | |
1059 | zt-=fHlSSD; yt-=fHwSSD; | |
1060 | ybest=yt; zbest=zt; | |
1061 | qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ()); | |
b4704be3 | 1062 | { |
1063 | Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.}; | |
1064 | mT2L->MasterToLocal(loc,trk); | |
1065 | lp[0]=trk[1]; | |
1066 | lp[1]=trk[2]; | |
1067 | } | |
04366a57 | 1068 | lp[2]=0.0025*0.0025; //SigmaY2 |
1069 | lp[3]=0.110*0.110; //SigmaZ2 | |
1070 | lp[4]=qbest; //Q | |
1071 | for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2; | |
1072 | for (Int_t ilab=0;ilab<3;ilab++){ | |
1073 | milab[ilab] = pos[ip].GetLabel(ilab); | |
1074 | milab[ilab+3] = neg[j].GetLabel(ilab); | |
1075 | } | |
1076 | // | |
1077 | CheckLabels2(milab); | |
1078 | ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ()); | |
1079 | milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det | |
1080 | Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]}; | |
00a7cc50 | 1081 | AliITSRecPoint * cl2; |
1082 | if(clusters){ | |
75fb37cc | 1083 | cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info); |
308b5ea4 | 1084 | |
1085 | // cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl; | |
1086 | ||
00a7cc50 | 1087 | cl2->SetChargeRatio(ratio); |
1088 | cl2->SetType(10); | |
308b5ea4 | 1089 | fgPairs[ip*nn+j]=10; |
00a7cc50 | 1090 | if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster |
1091 | cl2->SetType(11); | |
308b5ea4 | 1092 | fgPairs[ip*nn+j]=11; |
00a7cc50 | 1093 | } |
1094 | cused1[ip]++; | |
1095 | cused2[j]++; | |
04366a57 | 1096 | } |
00a7cc50 | 1097 | else{ |
75fb37cc | 1098 | cl2 = new AliITSRecPoint(milab,lp,info); |
00a7cc50 | 1099 | cl2->SetChargeRatio(ratio); |
1100 | cl2->SetType(10); | |
308b5ea4 | 1101 | fgPairs[ip*nn+j]=10; |
00a7cc50 | 1102 | if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster |
1103 | cl2->SetType(11); | |
308b5ea4 | 1104 | fgPairs[ip*nn+j]=11; |
00a7cc50 | 1105 | } |
1106 | cused1[ip]++; | |
1107 | cused2[j]++; | |
1108 | ||
308b5ea4 | 1109 | //cout<<"AliITSClusterFinderV2SSD "<<fModule<<" 2x2"<<endl; |
1110 | ||
00a7cc50 | 1111 | fDetTypeRec->AddRecPoint(*cl2); |
1112 | } | |
04366a57 | 1113 | ncl++; |
04366a57 | 1114 | } |
1115 | ||
1116 | } | |
1117 | ||
1118 | // | |
1119 | for (Int_t i=0; i<np; i++) { | |
1120 | Float_t ybest=1000,zbest=1000,qbest=0; | |
1121 | Float_t yp=pos[i].GetY()*fYpitchSSD; | |
1122 | if (pos[i].GetQ()<3) continue; | |
1123 | for (Int_t j=0; j<nn; j++) { | |
1124 | // for (Int_t di = 0;di<cpositive[i];di++){ | |
1125 | // Int_t j = negativepair[10*i+di]; | |
1126 | if (neg[j].GetQ()<3) continue; | |
1127 | if (cused2[j]||cused1[i]) continue; | |
308b5ea4 | 1128 | if (fgPairs[i*nn+j]>0 &&fgPairs[i*nn+j]<100) continue; |
04366a57 | 1129 | ratio = (pos[i].GetQ()-neg[j].GetQ())/(pos[i].GetQ()+neg[j].GetQ()); |
1130 | Float_t yn=neg[j].GetY()*fYpitchSSD; | |
1131 | Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp); | |
1132 | Float_t yt=yn + tann*zt; | |
1133 | zt-=fHlSSD; yt-=fHwSSD; | |
1134 | if (TMath::Abs(yt)<fHwSSD+0.01) | |
1135 | if (TMath::Abs(zt)<fHlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) { | |
1136 | ybest=yt; zbest=zt; | |
1137 | qbest=0.5*(pos[i].GetQ()+neg[j].GetQ()); | |
b4704be3 | 1138 | { |
1139 | Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.}; | |
1140 | mT2L->MasterToLocal(loc,trk); | |
1141 | lp[0]=trk[1]; | |
1142 | lp[1]=trk[2]; | |
1143 | } | |
04366a57 | 1144 | lp[2]=0.0025*0.0025; //SigmaY2 |
1145 | lp[3]=0.110*0.110; //SigmaZ2 | |
1146 | ||
1147 | lp[4]=qbest; //Q | |
1148 | for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2; | |
1149 | for (Int_t ilab=0;ilab<3;ilab++){ | |
1150 | milab[ilab] = pos[i].GetLabel(ilab); | |
1151 | milab[ilab+3] = neg[j].GetLabel(ilab); | |
1152 | } | |
1153 | // | |
1154 | CheckLabels2(milab); | |
1155 | milab[3]=(((i<<10) + j)<<10) + idet; // pos|neg|det | |
1156 | Int_t info[3] = {pos[i].GetNd(),neg[j].GetNd(),fNlayer[fModule]}; | |
00a7cc50 | 1157 | AliITSRecPoint * cl2; |
1158 | if(clusters){ | |
75fb37cc | 1159 | cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info); |
308b5ea4 | 1160 | |
1161 | // cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl; | |
1162 | ||
00a7cc50 | 1163 | cl2->SetChargeRatio(ratio); |
1164 | cl2->SetType(100+cpositive[j]+cnegative[i]); | |
1165 | } | |
04366a57 | 1166 | else{ |
75fb37cc | 1167 | cl2 = new AliITSRecPoint(milab,lp,info); |
00a7cc50 | 1168 | cl2->SetChargeRatio(ratio); |
1169 | cl2->SetType(100+cpositive[j]+cnegative[i]); | |
308b5ea4 | 1170 | |
1171 | //cout<<"AliITSClusterFinderV2SSD "<<fModule<<" other"<<endl; | |
1172 | ||
00a7cc50 | 1173 | fDetTypeRec->AddRecPoint(*cl2); |
04366a57 | 1174 | } |
1175 | ncl++; | |
04366a57 | 1176 | //cl2->SetType(0); |
1177 | /* | |
308b5ea4 | 1178 | if (fgPairs[i*nn+j]<100){ |
1179 | printf("problem:- %d\n", fgPairs[i*nn+j]); | |
04366a57 | 1180 | } |
1181 | if (cnegative[i]<2&&cpositive[j]<2){ | |
308b5ea4 | 1182 | printf("problem:- %d\n", fgPairs[i*nn+j]); |
04366a57 | 1183 | } |
1184 | */ | |
1185 | } | |
1186 | } | |
1187 | } | |
1188 | ||
04366a57 | 1189 | } |
1190 | ||
1191 |