1 /**************************************************************************
2 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
15 ////////////////////////////////////////////////////////////////////////////
16 // Implementation of the ITS clusterer V2 class //
18 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch //
20 ///////////////////////////////////////////////////////////////////////////
23 #include "AliITSClusterFinderV2SSD.h"
24 #include "AliITSRecPoint.h"
25 #include "AliITSgeomTGeo.h"
26 #include "AliITSDetTypeRec.h"
27 #include "AliRawReader.h"
28 #include "AliITSRawStreamSSD.h"
29 #include <TClonesArray.h>
30 #include "AliITSdigitSSD.h"
32 ClassImp(AliITSClusterFinderV2SSD)
35 AliITSClusterFinderV2SSD::AliITSClusterFinderV2SSD(AliITSDetTypeRec* dettyp):AliITSClusterFinderV2(dettyp),
36 fLastSSD1(AliITSgeomTGeo::GetModuleIndex(6,1,1)-1),
48 void AliITSClusterFinderV2SSD::FindRawClusters(Int_t mod){
52 FindClustersSSD(fDigits);
56 void AliITSClusterFinderV2SSD::FindClustersSSD(TClonesArray *alldigits) {
57 //------------------------------------------------------------
58 // Actual SSD cluster finder
59 //------------------------------------------------------------
60 Int_t smaxall=alldigits->GetEntriesFast();
61 if (smaxall==0) return;
62 TObjArray *digits = new TObjArray;
63 for (Int_t i=0;i<smaxall; i++){
64 AliITSdigitSSD *d=(AliITSdigitSSD*)alldigits->UncheckedAt(i);
65 Float_t q=d->GetSignal()/4.29;// temp. fix (for PID purposed - normalis. to be checked)
66 d->SetSignal(Int_t(q));
67 if (d->GetSignal()<3) continue;
70 Int_t smax = digits->GetEntriesFast();
73 const Int_t kMax=1000;
75 Ali1Dcluster pos[kMax], neg[kMax];
76 Float_t y=0., q=0., qmax=0.;
77 Int_t lab[4]={-2,-2,-2,-2};
79 AliITSdigitSSD *d=(AliITSdigitSSD*)digits->UncheckedAt(0);
81 y += d->GetCoord2()*d->GetSignal();
83 lab[0]=d->GetTrack(0); lab[1]=d->GetTrack(1); lab[2]=d->GetTrack(2);
84 Int_t curr=d->GetCoord2();
85 Int_t flag=d->GetCoord1();
90 for (Int_t ilab=0;ilab<10;ilab++){
93 milab[0]=d->GetTrack(0); milab[1]=d->GetTrack(1); milab[2]=d->GetTrack(2);
95 for (Int_t s=1; s<smax; s++) {
96 d=(AliITSdigitSSD*)digits->UncheckedAt(s);
97 Int_t strip=d->GetCoord2();
98 if ((strip-curr) > 1 || flag!=d->GetCoord1()) {
103 c[*n].SetLabels(milab);
104 //Split suspiciously big cluster
107 c[*n].SetY(y/q-0.3*nd);
111 Error("FindClustersSSD","Too many 1D clusters !");
114 c[*n].SetY(y/q-0.0*nd);
119 Error("FindClustersSSD","Too many 1D clusters !");
123 c[*n].SetY(y/q+0.3*nd);
126 c[*n].SetLabels(milab);
131 c[*n].SetY(y/q-0.25*nd);
135 Error("FindClustersSSD","Too many 1D clusters !");
138 c[*n].SetY(y/q+0.25*nd);
141 c[*n].SetLabels(milab);
145 Error("FindClustersSSD","Too many 1D clusters !");
150 lab[0]=lab[1]=lab[2]=-2;
152 for (Int_t ilab=0;ilab<10;ilab++){
156 if (flag!=d->GetCoord1()) { n=&np; c=pos; }
160 y += d->GetCoord2()*d->GetSignal();
162 if (d->GetSignal()>qmax) {
164 lab[0]=d->GetTrack(0); lab[1]=d->GetTrack(1); lab[2]=d->GetTrack(2);
166 for (Int_t ilab=0;ilab<10;ilab++) {
167 if (d->GetTrack(ilab)>=0) AddLabel(milab, (d->GetTrack(ilab)));
174 c[*n].SetLabels(lab);
175 //Split suspiciously big cluster
177 c[*n].SetY(y/q-0.25*nd);
181 Error("FindClustersSSD","Too many 1D clusters !");
184 c[*n].SetY(y/q+0.25*nd);
187 c[*n].SetLabels(lab);
191 Error("FindClustersSSD","Too many 1D clusters !");
195 FindClustersSSD(neg, nn, pos, np);
199 void AliITSClusterFinderV2SSD::RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters){
201 //------------------------------------------------------------
202 // This function creates ITS clusters from raw data
203 //------------------------------------------------------------
205 AliITSRawStreamSSD inputSSD(rawReader);
206 FindClustersSSD(&inputSSD,clusters);
210 void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStream* input,
211 TClonesArray** clusters)
213 //------------------------------------------------------------
214 // Actual SSD cluster finder for raw data
215 //------------------------------------------------------------
216 Int_t nClustersSSD = 0;
217 const Int_t kMax = 1000;
218 Ali1Dcluster clusters1D[2][kMax];
219 Int_t nClusters[2] = {0, 0};
220 Int_t lab[3]={-2,-2,-2};
224 Int_t prevStrip = -1;
226 Int_t prevModule = -1;
228 // read raw data input stream
230 Bool_t next = input->Next();
232 if(input->GetSignal()<(3*4.29) && next) continue;
233 // check if a new cluster starts
234 Int_t strip = input->GetCoord2();
235 Int_t flag = input->GetCoord1();
236 if ((!next || (input->GetModuleID() != prevModule)||
237 (strip-prevStrip > 1) || (flag != prevFlag)) &&
239 if (nClusters[prevFlag] == kMax) {
240 Error("FindClustersSSD", "Too many 1D clusters !");
243 Ali1Dcluster& cluster = clusters1D[prevFlag][nClusters[prevFlag]++];
246 cluster.SetNd(nDigits);
247 cluster.SetLabels(lab);
249 //Split suspiciously big cluster
250 if (nDigits > 4&&nDigits < 25) {
251 cluster.SetY(y/q - 0.25*nDigits);
253 if (nClusters[prevFlag] == kMax) {
254 Error("FindClustersSSD", "Too many 1D clusters !");
257 Ali1Dcluster& cluster2 = clusters1D[prevFlag][nClusters[prevFlag]++];
258 cluster2.SetY(y/q + 0.25*nDigits);
259 cluster2.SetQ(0.5*q);
260 cluster2.SetNd(nDigits);
261 cluster2.SetLabels(lab);
267 if (!next || (input->GetModuleID() != prevModule)) {
268 Int_t iModule = prevModule;
270 // when all data from a module was read, search for clusters
272 clusters[iModule] = new TClonesArray("AliITSRecPoint");
274 FindClustersSSD(&clusters1D[0][0], nClusters[0],
275 &clusters1D[1][0], nClusters[1], clusters[iModule]);
276 Int_t nClusters = clusters[iModule]->GetEntriesFast();
277 nClustersSSD += nClusters;
281 nClusters[0] = nClusters[1] = 0;
286 // add digit to current cluster
287 q += input->GetSignal()/4.29;
288 y += strip * input->GetSignal()/4.29;
292 prevModule = input->GetModuleID();
296 Info("FindClustersSSD", "found clusters in ITS SSD: %d", nClustersSSD);
299 void AliITSClusterFinderV2SSD::
300 FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
301 Ali1Dcluster* pos, Int_t np,
302 TClonesArray *clusters) {
303 //------------------------------------------------------------
304 // Actual SSD cluster finder
305 //------------------------------------------------------------
306 TClonesArray &cl=*clusters;
308 Float_t tanp=fTanP, tann=fTanN;
309 if (fModule>fLastSSD1) {tann=fTanP; tanp=fTanN;}
310 Int_t idet=fNdet[fModule];
313 Int_t negativepair[30000];
314 Int_t cnegative[3000];
316 Int_t positivepair[30000];
317 Int_t cpositive[3000];
319 for (Int_t i=0;i<3000;i++) {cnegative[i]=0; cused1[i]=0;}
320 for (Int_t i=0;i<3000;i++) {cpositive[i]=0; cused2[i]=0;}
321 for (Int_t i=0;i<30000;i++) {negativepair[i]=0; positivepair[i]=0;}
322 static Short_t pairs[1000][1000];
323 memset(pairs,0,sizeof(Short_t)*1000000);
324 // Short_t ** pairs = new Short_t*[1000];
325 // for (Int_t i=0; i<1000; i++) {
326 // pairs[i] = new Short_t[1000];
327 // memset(pairs[i],0,sizeof(Short_t)*1000);
330 // find available pairs
332 for (Int_t i=0; i<np; i++) {
333 Float_t yp=pos[i].GetY()*fYpitchSSD;
334 if (pos[i].GetQ()<3) continue;
335 for (Int_t j=0; j<nn; j++) {
336 if (neg[j].GetQ()<3) continue;
337 Float_t yn=neg[j].GetY()*fYpitchSSD;
338 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
339 Float_t yt=yn + tann*zt;
340 zt-=fHlSSD; yt-=fHwSSD;
341 if (TMath::Abs(yt)<fHwSSD+0.01)
342 if (TMath::Abs(zt)<fHlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) {
343 negativepair[i*10+cnegative[i]] =j; //index
344 positivepair[j*10+cpositive[j]] =i;
345 cnegative[i]++; //counters
352 for (Int_t i=0; i<np; i++) {
353 Float_t yp=pos[i].GetY()*fYpitchSSD;
354 if (pos[i].GetQ()<3) continue;
355 for (Int_t j=0; j<nn; j++) {
356 if (neg[j].GetQ()<3) continue;
357 if (cpositive[j]&&cnegative[i]) continue;
358 Float_t yn=neg[j].GetY()*fYpitchSSD;
359 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
360 Float_t yt=yn + tann*zt;
361 zt-=fHlSSD; yt-=fHwSSD;
362 if (TMath::Abs(yt)<fHwSSD+0.1)
363 if (TMath::Abs(zt)<fHlSSD+0.15) {
364 if (cnegative[i]==0) pos[i].SetNd(100); // not available pair
365 if (cpositive[j]==0) neg[j].SetNd(100); // not available pair
366 negativepair[i*10+cnegative[i]] =j; //index
367 positivepair[j*10+cpositive[j]] =i;
368 cnegative[i]++; //counters
382 for (Int_t ip=0;ip<np;ip++){
383 Float_t ybest=1000,zbest=1000,qbest=0;
385 // select gold clusters
386 if ( (cnegative[ip]==1) && cpositive[negativepair[10*ip]]==1){
387 Float_t yp=pos[ip].GetY()*fYpitchSSD;
388 Int_t j = negativepair[10*ip];
389 ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ());
391 Float_t yn=neg[j].GetY()*fYpitchSSD;
392 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
393 Float_t yt=yn + tann*zt;
394 zt-=fHlSSD; yt-=fHwSSD;
396 qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
397 lp[0]=-(-ybest+fYshift[fModule]);
398 lp[1]= -zbest+fZshift[fModule];
399 lp[2]=0.0025*0.0025; //SigmaY2
400 lp[3]=0.110*0.110; //SigmaZ2
403 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
404 for (Int_t ilab=0;ilab<3;ilab++){
405 milab[ilab] = pos[ip].GetLabel(ilab);
406 milab[ilab+3] = neg[j].GetLabel(ilab);
410 milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
411 Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
412 AliITSRecPoint * cl2;
414 cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
415 cl2->SetChargeRatio(ratio);
418 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
427 cl2 = new AliITSRecPoint(milab,lp,info);
428 cl2->SetChargeRatio(ratio);
431 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
437 fDetTypeRec->AddRecPoint(*cl2);
443 for (Int_t ip=0;ip<np;ip++){
444 Float_t ybest=1000,zbest=1000,qbest=0;
447 // select "silber" cluster
448 if ( cnegative[ip]==1 && cpositive[negativepair[10*ip]]==2){
449 Int_t in = negativepair[10*ip];
450 Int_t ip2 = positivepair[10*in];
451 if (ip2==ip) ip2 = positivepair[10*in+1];
452 Float_t pcharge = pos[ip].GetQ()+pos[ip2].GetQ();
453 if (TMath::Abs(pcharge-neg[in].GetQ())<10){
456 if (pairs[ip][in]==100){ //
457 Float_t yp=pos[ip].GetY()*fYpitchSSD;
458 Float_t yn=neg[in].GetY()*fYpitchSSD;
459 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
460 Float_t yt=yn + tann*zt;
461 zt-=fHlSSD; yt-=fHwSSD;
463 qbest =pos[ip].GetQ();
464 lp[0]=-(-ybest+fYshift[fModule]);
465 lp[1]= -zbest+fZshift[fModule];
466 lp[2]=0.0025*0.0025; //SigmaY2
467 lp[3]=0.110*0.110; //SigmaZ2
470 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
471 for (Int_t ilab=0;ilab<3;ilab++){
472 milab[ilab] = pos[ip].GetLabel(ilab);
473 milab[ilab+3] = neg[in].GetLabel(ilab);
477 ratio = (pos[ip].GetQ()-neg[in].GetQ())/(pos[ip].GetQ()+neg[in].GetQ());
478 milab[3]=(((ip<<10) + in)<<10) + idet; // pos|neg|det
479 Int_t info[3] = {pos[ip].GetNd(),neg[in].GetNd(),fNlayer[fModule]};
481 AliITSRecPoint * cl2;
483 cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
484 cl2->SetChargeRatio(ratio);
487 if ((pos[ip].GetNd()+neg[in].GetNd())>6){ //multi cluster
493 cl2 = new AliITSRecPoint(milab,lp,info);
494 cl2->SetChargeRatio(ratio);
497 if ((pos[ip].GetNd()+neg[in].GetNd())>6){ //multi cluster
502 fDetTypeRec->AddRecPoint(*cl2);
510 // if (!(cused1[ip2] || cused2[in])){ //
511 if (pairs[ip2][in]==100){
512 Float_t yp=pos[ip2].GetY()*fYpitchSSD;
513 Float_t yn=neg[in].GetY()*fYpitchSSD;
514 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
515 Float_t yt=yn + tann*zt;
516 zt-=fHlSSD; yt-=fHwSSD;
518 qbest =pos[ip2].GetQ();
519 lp[0]=-(-ybest+fYshift[fModule]);
520 lp[1]= -zbest+fZshift[fModule];
521 lp[2]=0.0025*0.0025; //SigmaY2
522 lp[3]=0.110*0.110; //SigmaZ2
525 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
526 for (Int_t ilab=0;ilab<3;ilab++){
527 milab[ilab] = pos[ip2].GetLabel(ilab);
528 milab[ilab+3] = neg[in].GetLabel(ilab);
532 ratio = (pos[ip2].GetQ()-neg[in].GetQ())/(pos[ip2].GetQ()+neg[in].GetQ());
533 milab[3]=(((ip2<<10) + in)<<10) + idet; // pos|neg|det
534 Int_t info[3] = {pos[ip2].GetNd(),neg[in].GetNd(),fNlayer[fModule]};
536 AliITSRecPoint * cl2;
538 cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
539 cl2->SetChargeRatio(ratio);
542 if ((pos[ip2].GetNd()+neg[in].GetNd())>6){ //multi cluster
548 cl2 = new AliITSRecPoint(milab,lp,info);
549 cl2->SetChargeRatio(ratio);
552 if ((pos[ip2].GetNd()+neg[in].GetNd())>6){ //multi cluster
557 fDetTypeRec->AddRecPoint(*cl2);
569 for (Int_t jn=0;jn<nn;jn++){
570 if (cused2[jn]) continue;
571 Float_t ybest=1000,zbest=1000,qbest=0;
572 // select "silber" cluster
573 if ( cpositive[jn]==1 && cnegative[positivepair[10*jn]]==2){
574 Int_t ip = positivepair[10*jn];
575 Int_t jn2 = negativepair[10*ip];
576 if (jn2==jn) jn2 = negativepair[10*ip+1];
577 Float_t pcharge = neg[jn].GetQ()+neg[jn2].GetQ();
579 if (TMath::Abs(pcharge-pos[ip].GetQ())<10){
582 // if (!(cused1[ip]||cused2[jn])){
583 if (pairs[ip][jn]==100){
584 Float_t yn=neg[jn].GetY()*fYpitchSSD;
585 Float_t yp=pos[ip].GetY()*fYpitchSSD;
586 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
587 Float_t yt=yn + tann*zt;
588 zt-=fHlSSD; yt-=fHwSSD;
590 qbest =neg[jn].GetQ();
591 lp[0]=-(-ybest+fYshift[fModule]);
592 lp[1]= -zbest+fZshift[fModule];
593 lp[2]=0.0025*0.0025; //SigmaY2
594 lp[3]=0.110*0.110; //SigmaZ2
597 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
598 for (Int_t ilab=0;ilab<3;ilab++){
599 milab[ilab] = pos[ip].GetLabel(ilab);
600 milab[ilab+3] = neg[jn].GetLabel(ilab);
604 ratio = (pos[ip].GetQ()-neg[jn].GetQ())/(pos[ip].GetQ()+neg[jn].GetQ());
605 milab[3]=(((ip<<10) + jn)<<10) + idet; // pos|neg|det
606 Int_t info[3] = {pos[ip].GetNd(),neg[jn].GetNd(),fNlayer[fModule]};
608 AliITSRecPoint * cl2;
610 cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
611 cl2->SetChargeRatio(ratio);
614 if ((pos[ip].GetNd()+neg[jn].GetNd())>6){ //multi cluster
621 cl2 = new AliITSRecPoint(milab,lp,info);
622 cl2->SetChargeRatio(ratio);
625 if ((pos[ip].GetNd()+neg[jn].GetNd())>6){ //multi cluster
630 fDetTypeRec->AddRecPoint(*cl2);
636 // if (!(cused1[ip]||cused2[jn2])){
637 if (pairs[ip][jn2]==100){
638 Float_t yn=neg[jn2].GetY()*fYpitchSSD;
639 Double_t yp=pos[ip].GetY()*fYpitchSSD;
640 Double_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
641 Double_t yt=yn + tann*zt;
642 zt-=fHlSSD; yt-=fHwSSD;
644 qbest =neg[jn2].GetQ();
645 lp[0]=-(-ybest+fYshift[fModule]);
646 lp[1]= -zbest+fZshift[fModule];
647 lp[2]=0.0025*0.0025; //SigmaY2
648 lp[3]=0.110*0.110; //SigmaZ2
651 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
652 for (Int_t ilab=0;ilab<3;ilab++){
653 milab[ilab] = pos[ip].GetLabel(ilab);
654 milab[ilab+3] = neg[jn2].GetLabel(ilab);
658 ratio = (pos[ip].GetQ()-neg[jn2].GetQ())/(pos[ip].GetQ()+neg[jn2].GetQ());
659 milab[3]=(((ip<<10) + jn2)<<10) + idet; // pos|neg|det
660 Int_t info[3] = {pos[ip].GetNd(),neg[jn2].GetNd(),fNlayer[fModule]};
661 AliITSRecPoint * cl2;
663 cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
664 cl2->SetChargeRatio(ratio);
667 if ((pos[ip].GetNd()+neg[jn2].GetNd())>6){ //multi cluster
674 cl2 = new AliITSRecPoint(milab,lp,info);
675 cl2->SetChargeRatio(ratio);
678 if ((pos[ip].GetNd()+neg[jn2].GetNd())>6){ //multi cluster
683 fDetTypeRec->AddRecPoint(*cl2);
695 for (Int_t ip=0;ip<np;ip++){
696 Float_t ybest=1000,zbest=1000,qbest=0;
700 if ( (cnegative[ip]<5) && cpositive[negativepair[10*ip]]<5){
701 Float_t minchargediff =4.;
703 for (Int_t di=0;di<cnegative[ip];di++){
704 Int_t jc = negativepair[ip*10+di];
705 Float_t chargedif = pos[ip].GetQ()-neg[jc].GetQ();
706 if (TMath::Abs(chargedif)<minchargediff){
708 minchargediff = TMath::Abs(chargedif);
711 if (j<0) continue; // not proper cluster
713 for (Int_t di=0;di<cnegative[ip];di++){
714 Int_t jc = negativepair[ip*10+di];
715 Float_t chargedif = pos[ip].GetQ()-neg[jc].GetQ();
716 if (TMath::Abs(chargedif)<minchargediff+3.) count++;
718 if (count>1) continue; // more than one "proper" cluster for positive
721 for (Int_t dj=0;dj<cpositive[j];dj++){
722 Int_t ic = positivepair[j*10+dj];
723 Float_t chargedif = pos[ic].GetQ()-neg[j].GetQ();
724 if (TMath::Abs(chargedif)<minchargediff+3.) count++;
726 if (count>1) continue; // more than one "proper" cluster for negative
731 for (Int_t dj=0;dj<cnegative[jp];dj++){
732 Int_t ic = positivepair[jp*10+dj];
733 Float_t chargedif = pos[ic].GetQ()-neg[jp].GetQ();
734 if (TMath::Abs(chargedif)<minchargediff+4.) count++;
736 if (count>1) continue;
737 if (pairs[ip][j]<100) continue;
739 //almost gold clusters
740 Float_t yp=pos[ip].GetY()*fYpitchSSD;
741 Float_t yn=neg[j].GetY()*fYpitchSSD;
742 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
743 Float_t yt=yn + tann*zt;
744 zt-=fHlSSD; yt-=fHwSSD;
746 qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
747 lp[0]=-(-ybest+fYshift[fModule]);
748 lp[1]= -zbest+fZshift[fModule];
749 lp[2]=0.0025*0.0025; //SigmaY2
750 lp[3]=0.110*0.110; //SigmaZ2
752 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
753 for (Int_t ilab=0;ilab<3;ilab++){
754 milab[ilab] = pos[ip].GetLabel(ilab);
755 milab[ilab+3] = neg[j].GetLabel(ilab);
759 ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ());
760 milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
761 Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
762 AliITSRecPoint * cl2;
764 cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
765 cl2->SetChargeRatio(ratio);
768 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
776 cl2 = new AliITSRecPoint(milab,lp,info);
777 cl2->SetChargeRatio(ratio);
780 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
787 fDetTypeRec->AddRecPoint(*cl2);
795 for (Int_t i=0; i<np; i++) {
796 Float_t ybest=1000,zbest=1000,qbest=0;
797 Float_t yp=pos[i].GetY()*fYpitchSSD;
798 if (pos[i].GetQ()<3) continue;
799 for (Int_t j=0; j<nn; j++) {
800 // for (Int_t di = 0;di<cpositive[i];di++){
801 // Int_t j = negativepair[10*i+di];
802 if (neg[j].GetQ()<3) continue;
803 if (cused2[j]||cused1[i]) continue;
804 if (pairs[i][j]>0 &&pairs[i][j]<100) continue;
805 ratio = (pos[i].GetQ()-neg[j].GetQ())/(pos[i].GetQ()+neg[j].GetQ());
806 Float_t yn=neg[j].GetY()*fYpitchSSD;
807 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
808 Float_t yt=yn + tann*zt;
809 zt-=fHlSSD; yt-=fHwSSD;
810 if (TMath::Abs(yt)<fHwSSD+0.01)
811 if (TMath::Abs(zt)<fHlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) {
813 qbest=0.5*(pos[i].GetQ()+neg[j].GetQ());
814 lp[0]=-(-ybest+fYshift[fModule]);
815 lp[1]= -zbest+fZshift[fModule];
816 lp[2]=0.0025*0.0025; //SigmaY2
817 lp[3]=0.110*0.110; //SigmaZ2
820 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
821 for (Int_t ilab=0;ilab<3;ilab++){
822 milab[ilab] = pos[i].GetLabel(ilab);
823 milab[ilab+3] = neg[j].GetLabel(ilab);
827 milab[3]=(((i<<10) + j)<<10) + idet; // pos|neg|det
828 Int_t info[3] = {pos[i].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
829 AliITSRecPoint * cl2;
831 cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
832 cl2->SetChargeRatio(ratio);
833 cl2->SetType(100+cpositive[j]+cnegative[i]);
836 cl2 = new AliITSRecPoint(milab,lp,info);
837 cl2->SetChargeRatio(ratio);
838 cl2->SetType(100+cpositive[j]+cnegative[i]);
839 fDetTypeRec->AddRecPoint(*cl2);
844 if (pairs[i][j]<100){
845 printf("problem:- %d\n", pairs[i][j]);
847 if (cnegative[i]<2&&cpositive[j]<2){
848 printf("problem:- %d\n", pairs[i][j]);
855 // for (Int_t i=0; i<1000; i++) delete [] pairs[i];