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 "AliITSDetTypeRec.h"
26 #include "AliRawReader.h"
27 #include "AliITSRawStreamSSD.h"
28 #include <TClonesArray.h>
29 #include "AliITSdigitSSD.h"
31 ClassImp(AliITSClusterFinderV2SSD)
34 AliITSClusterFinderV2SSD::AliITSClusterFinderV2SSD(AliITSDetTypeRec* dettyp):AliITSClusterFinderV2(dettyp),
44 fLastSSD1=fDetTypeRec->GetITSgeom()->GetModuleIndex(6,1,1)-1;
49 void AliITSClusterFinderV2SSD::FindRawClusters(Int_t mod){
53 FindClustersSSD(fDigits);
57 void AliITSClusterFinderV2SSD::FindClustersSSD(TClonesArray *alldigits) {
58 //------------------------------------------------------------
59 // Actual SSD cluster finder
60 //------------------------------------------------------------
61 Int_t smaxall=alldigits->GetEntriesFast();
62 if (smaxall==0) return;
63 TObjArray *digits = new TObjArray;
64 for (Int_t i=0;i<smaxall; i++){
65 AliITSdigitSSD *d=(AliITSdigitSSD*)alldigits->UncheckedAt(i);
66 if (d->GetSignal()<3) continue;
69 Int_t smax = digits->GetEntriesFast();
72 const Int_t kMax=1000;
74 Ali1Dcluster pos[kMax], neg[kMax];
75 Float_t y=0., q=0., qmax=0.;
76 Int_t lab[4]={-2,-2,-2,-2};
78 AliITSdigitSSD *d=(AliITSdigitSSD*)digits->UncheckedAt(0);
80 y += d->GetCoord2()*d->GetSignal();
82 lab[0]=d->GetTrack(0); lab[1]=d->GetTrack(1); lab[2]=d->GetTrack(2);
83 Int_t curr=d->GetCoord2();
84 Int_t flag=d->GetCoord1();
89 for (Int_t ilab=0;ilab<10;ilab++){
92 milab[0]=d->GetTrack(0); milab[1]=d->GetTrack(1); milab[2]=d->GetTrack(2);
94 for (Int_t s=1; s<smax; s++) {
95 d=(AliITSdigitSSD*)digits->UncheckedAt(s);
96 Int_t strip=d->GetCoord2();
97 if ((strip-curr) > 1 || flag!=d->GetCoord1()) {
102 c[*n].SetLabels(milab);
103 //Split suspiciously big cluster
106 c[*n].SetY(y/q-0.3*nd);
110 Error("FindClustersSSD","Too many 1D clusters !");
113 c[*n].SetY(y/q-0.0*nd);
118 Error("FindClustersSSD","Too many 1D clusters !");
122 c[*n].SetY(y/q+0.3*nd);
125 c[*n].SetLabels(milab);
130 c[*n].SetY(y/q-0.25*nd);
134 Error("FindClustersSSD","Too many 1D clusters !");
137 c[*n].SetY(y/q+0.25*nd);
140 c[*n].SetLabels(milab);
144 Error("FindClustersSSD","Too many 1D clusters !");
149 lab[0]=lab[1]=lab[2]=-2;
151 for (Int_t ilab=0;ilab<10;ilab++){
155 if (flag!=d->GetCoord1()) { n=&np; c=pos; }
159 y += d->GetCoord2()*d->GetSignal();
161 if (d->GetSignal()>qmax) {
163 lab[0]=d->GetTrack(0); lab[1]=d->GetTrack(1); lab[2]=d->GetTrack(2);
165 for (Int_t ilab=0;ilab<10;ilab++) {
166 if (d->GetTrack(ilab)>=0) AddLabel(milab, (d->GetTrack(ilab)));
173 c[*n].SetLabels(lab);
174 //Split suspiciously big cluster
176 c[*n].SetY(y/q-0.25*nd);
180 Error("FindClustersSSD","Too many 1D clusters !");
183 c[*n].SetY(y/q+0.25*nd);
186 c[*n].SetLabels(lab);
190 Error("FindClustersSSD","Too many 1D clusters !");
194 FindClustersSSD(neg, nn, pos, np);
198 void AliITSClusterFinderV2SSD::RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters){
200 //------------------------------------------------------------
201 // This function creates ITS clusters from raw data
202 //------------------------------------------------------------
204 AliITSRawStreamSSD inputSSD(rawReader);
205 FindClustersSSD(&inputSSD,clusters);
209 void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStream* input,
210 TClonesArray** clusters)
212 //------------------------------------------------------------
213 // Actual SSD cluster finder for raw data
214 //------------------------------------------------------------
215 Int_t nClustersSSD = 0;
216 const Int_t kMax = 1000;
217 Ali1Dcluster clusters1D[2][kMax];
218 Int_t nClusters[2] = {0, 0};
219 Int_t lab[3]={-2,-2,-2};
223 Int_t prevStrip = -1;
225 Int_t prevModule = -1;
227 // read raw data input stream
229 Bool_t next = input->Next();
231 if(input->GetSignal()<3 && next) continue;
232 // check if a new cluster starts
233 Int_t strip = input->GetCoord2();
234 Int_t flag = input->GetCoord1();
235 if ((!next || (input->GetModuleID() != prevModule)||
236 (strip-prevStrip > 1) || (flag != prevFlag)) &&
238 if (nClusters[prevFlag] == kMax) {
239 Error("FindClustersSSD", "Too many 1D clusters !");
242 Ali1Dcluster& cluster = clusters1D[prevFlag][nClusters[prevFlag]++];
245 cluster.SetNd(nDigits);
246 cluster.SetLabels(lab);
248 //Split suspiciously big cluster
249 if (nDigits > 4&&nDigits < 25) {
250 cluster.SetY(y/q - 0.25*nDigits);
252 if (nClusters[prevFlag] == kMax) {
253 Error("FindClustersSSD", "Too many 1D clusters !");
256 Ali1Dcluster& cluster2 = clusters1D[prevFlag][nClusters[prevFlag]++];
257 cluster2.SetY(y/q + 0.25*nDigits);
258 cluster2.SetQ(0.5*q);
259 cluster2.SetNd(nDigits);
260 cluster2.SetLabels(lab);
266 if (!next || (input->GetModuleID() != prevModule)) {
267 Int_t iModule = prevModule;
269 // when all data from a module was read, search for clusters
271 clusters[iModule] = new TClonesArray("AliITSRecPoint");
273 FindClustersSSD(&clusters1D[0][0], nClusters[0],
274 &clusters1D[1][0], nClusters[1], clusters[iModule]);
275 Int_t nClusters = clusters[iModule]->GetEntriesFast();
276 nClustersSSD += nClusters;
280 nClusters[0] = nClusters[1] = 0;
285 // add digit to current cluster
286 q += input->GetSignal();
287 y += strip * input->GetSignal();
291 prevModule = input->GetModuleID();
295 Info("FindClustersSSD", "found clusters in ITS SSD: %d", nClustersSSD);
298 void AliITSClusterFinderV2SSD::
299 FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
300 Ali1Dcluster* pos, Int_t np,
301 TClonesArray *clusters) {
302 //------------------------------------------------------------
303 // Actual SSD cluster finder
304 //------------------------------------------------------------
305 TClonesArray &cl=*clusters;
307 Float_t tanp=fTanP, tann=fTanN;
308 if (fModule>fLastSSD1) {tann=fTanP; tanp=fTanN;}
309 Int_t idet=fNdet[fModule];
312 Int_t negativepair[30000];
313 Int_t cnegative[3000];
315 Int_t positivepair[30000];
316 Int_t cpositive[3000];
318 for (Int_t i=0;i<3000;i++) {cnegative[i]=0; cused1[i]=0;}
319 for (Int_t i=0;i<3000;i++) {cpositive[i]=0; cused2[i]=0;}
320 for (Int_t i=0;i<30000;i++) {negativepair[i]=0; positivepair[i]=0;}
321 static Short_t pairs[1000][1000];
322 memset(pairs,0,sizeof(Short_t)*1000000);
323 // Short_t ** pairs = new Short_t*[1000];
324 // for (Int_t i=0; i<1000; i++) {
325 // pairs[i] = new Short_t[1000];
326 // memset(pairs[i],0,sizeof(Short_t)*1000);
329 // find available pairs
331 for (Int_t i=0; i<np; i++) {
332 Float_t yp=pos[i].GetY()*fYpitchSSD;
333 if (pos[i].GetQ()<3) continue;
334 for (Int_t j=0; j<nn; j++) {
335 if (neg[j].GetQ()<3) continue;
336 Float_t yn=neg[j].GetY()*fYpitchSSD;
337 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
338 Float_t yt=yn + tann*zt;
339 zt-=fHlSSD; yt-=fHwSSD;
340 if (TMath::Abs(yt)<fHwSSD+0.01)
341 if (TMath::Abs(zt)<fHlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) {
342 negativepair[i*10+cnegative[i]] =j; //index
343 positivepair[j*10+cpositive[j]] =i;
344 cnegative[i]++; //counters
351 for (Int_t i=0; i<np; i++) {
352 Float_t yp=pos[i].GetY()*fYpitchSSD;
353 if (pos[i].GetQ()<3) continue;
354 for (Int_t j=0; j<nn; j++) {
355 if (neg[j].GetQ()<3) continue;
356 if (cpositive[j]&&cnegative[i]) continue;
357 Float_t yn=neg[j].GetY()*fYpitchSSD;
358 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
359 Float_t yt=yn + tann*zt;
360 zt-=fHlSSD; yt-=fHwSSD;
361 if (TMath::Abs(yt)<fHwSSD+0.1)
362 if (TMath::Abs(zt)<fHlSSD+0.15) {
363 if (cnegative[i]==0) pos[i].SetNd(100); // not available pair
364 if (cpositive[j]==0) neg[j].SetNd(100); // not available pair
365 negativepair[i*10+cnegative[i]] =j; //index
366 positivepair[j*10+cpositive[j]] =i;
367 cnegative[i]++; //counters
381 for (Int_t ip=0;ip<np;ip++){
382 Float_t ybest=1000,zbest=1000,qbest=0;
384 // select gold clusters
385 if ( (cnegative[ip]==1) && cpositive[negativepair[10*ip]]==1){
386 Float_t yp=pos[ip].GetY()*fYpitchSSD;
387 Int_t j = negativepair[10*ip];
388 ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ());
390 Float_t yn=neg[j].GetY()*fYpitchSSD;
391 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
392 Float_t yt=yn + tann*zt;
393 zt-=fHlSSD; yt-=fHwSSD;
395 qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
396 lp[0]=-(-ybest+fYshift[fModule]);
397 lp[1]= -zbest+fZshift[fModule];
398 lp[2]=0.0025*0.0025; //SigmaY2
399 lp[3]=0.110*0.110; //SigmaZ2
402 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
403 for (Int_t ilab=0;ilab<3;ilab++){
404 milab[ilab] = pos[ip].GetLabel(ilab);
405 milab[ilab+3] = neg[j].GetLabel(ilab);
409 milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
410 Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
411 AliITSRecPoint * cl2;
413 cl2 = new (cl[ncl]) AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
414 cl2->SetChargeRatio(ratio);
417 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
426 cl2 = new AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
427 cl2->SetChargeRatio(ratio);
430 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
436 fDetTypeRec->AddRecPoint(*cl2);
442 for (Int_t ip=0;ip<np;ip++){
443 Float_t ybest=1000,zbest=1000,qbest=0;
446 // select "silber" cluster
447 if ( cnegative[ip]==1 && cpositive[negativepair[10*ip]]==2){
448 Int_t in = negativepair[10*ip];
449 Int_t ip2 = positivepair[10*in];
450 if (ip2==ip) ip2 = positivepair[10*in+1];
451 Float_t pcharge = pos[ip].GetQ()+pos[ip2].GetQ();
452 if (TMath::Abs(pcharge-neg[in].GetQ())<10){
455 if (pairs[ip][in]==100){ //
456 Float_t yp=pos[ip].GetY()*fYpitchSSD;
457 Float_t yn=neg[in].GetY()*fYpitchSSD;
458 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
459 Float_t yt=yn + tann*zt;
460 zt-=fHlSSD; yt-=fHwSSD;
462 qbest =pos[ip].GetQ();
463 lp[0]=-(-ybest+fYshift[fModule]);
464 lp[1]= -zbest+fZshift[fModule];
465 lp[2]=0.0025*0.0025; //SigmaY2
466 lp[3]=0.110*0.110; //SigmaZ2
469 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
470 for (Int_t ilab=0;ilab<3;ilab++){
471 milab[ilab] = pos[ip].GetLabel(ilab);
472 milab[ilab+3] = neg[in].GetLabel(ilab);
476 ratio = (pos[ip].GetQ()-neg[in].GetQ())/(pos[ip].GetQ()+neg[in].GetQ());
477 milab[3]=(((ip<<10) + in)<<10) + idet; // pos|neg|det
478 Int_t info[3] = {pos[ip].GetNd(),neg[in].GetNd(),fNlayer[fModule]};
480 AliITSRecPoint * cl2;
482 cl2 = new (cl[ncl]) AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
483 cl2->SetChargeRatio(ratio);
486 if ((pos[ip].GetNd()+neg[in].GetNd())>6){ //multi cluster
492 cl2 = new AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
493 cl2->SetChargeRatio(ratio);
496 if ((pos[ip].GetNd()+neg[in].GetNd())>6){ //multi cluster
501 fDetTypeRec->AddRecPoint(*cl2);
509 // if (!(cused1[ip2] || cused2[in])){ //
510 if (pairs[ip2][in]==100){
511 Float_t yp=pos[ip2].GetY()*fYpitchSSD;
512 Float_t yn=neg[in].GetY()*fYpitchSSD;
513 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
514 Float_t yt=yn + tann*zt;
515 zt-=fHlSSD; yt-=fHwSSD;
517 qbest =pos[ip2].GetQ();
518 lp[0]=-(-ybest+fYshift[fModule]);
519 lp[1]= -zbest+fZshift[fModule];
520 lp[2]=0.0025*0.0025; //SigmaY2
521 lp[3]=0.110*0.110; //SigmaZ2
524 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
525 for (Int_t ilab=0;ilab<3;ilab++){
526 milab[ilab] = pos[ip2].GetLabel(ilab);
527 milab[ilab+3] = neg[in].GetLabel(ilab);
531 ratio = (pos[ip2].GetQ()-neg[in].GetQ())/(pos[ip2].GetQ()+neg[in].GetQ());
532 milab[3]=(((ip2<<10) + in)<<10) + idet; // pos|neg|det
533 Int_t info[3] = {pos[ip2].GetNd(),neg[in].GetNd(),fNlayer[fModule]};
535 AliITSRecPoint * cl2;
537 cl2 = new (cl[ncl]) AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
538 cl2->SetChargeRatio(ratio);
541 if ((pos[ip2].GetNd()+neg[in].GetNd())>6){ //multi cluster
547 cl2 = new AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
548 cl2->SetChargeRatio(ratio);
551 if ((pos[ip2].GetNd()+neg[in].GetNd())>6){ //multi cluster
556 fDetTypeRec->AddRecPoint(*cl2);
568 for (Int_t jn=0;jn<nn;jn++){
569 if (cused2[jn]) continue;
570 Float_t ybest=1000,zbest=1000,qbest=0;
571 // select "silber" cluster
572 if ( cpositive[jn]==1 && cnegative[positivepair[10*jn]]==2){
573 Int_t ip = positivepair[10*jn];
574 Int_t jn2 = negativepair[10*ip];
575 if (jn2==jn) jn2 = negativepair[10*ip+1];
576 Float_t pcharge = neg[jn].GetQ()+neg[jn2].GetQ();
578 if (TMath::Abs(pcharge-pos[ip].GetQ())<10){
581 // if (!(cused1[ip]||cused2[jn])){
582 if (pairs[ip][jn]==100){
583 Float_t yn=neg[jn].GetY()*fYpitchSSD;
584 Float_t yp=pos[ip].GetY()*fYpitchSSD;
585 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
586 Float_t yt=yn + tann*zt;
587 zt-=fHlSSD; yt-=fHwSSD;
589 qbest =neg[jn].GetQ();
590 lp[0]=-(-ybest+fYshift[fModule]);
591 lp[1]= -zbest+fZshift[fModule];
592 lp[2]=0.0025*0.0025; //SigmaY2
593 lp[3]=0.110*0.110; //SigmaZ2
596 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
597 for (Int_t ilab=0;ilab<3;ilab++){
598 milab[ilab] = pos[ip].GetLabel(ilab);
599 milab[ilab+3] = neg[jn].GetLabel(ilab);
603 ratio = (pos[ip].GetQ()-neg[jn].GetQ())/(pos[ip].GetQ()+neg[jn].GetQ());
604 milab[3]=(((ip<<10) + jn)<<10) + idet; // pos|neg|det
605 Int_t info[3] = {pos[ip].GetNd(),neg[jn].GetNd(),fNlayer[fModule]};
607 AliITSRecPoint * cl2;
609 cl2 = new (cl[ncl]) AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
610 cl2->SetChargeRatio(ratio);
613 if ((pos[ip].GetNd()+neg[jn].GetNd())>6){ //multi cluster
620 cl2 = new AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
621 cl2->SetChargeRatio(ratio);
624 if ((pos[ip].GetNd()+neg[jn].GetNd())>6){ //multi cluster
629 fDetTypeRec->AddRecPoint(*cl2);
635 // if (!(cused1[ip]||cused2[jn2])){
636 if (pairs[ip][jn2]==100){
637 Float_t yn=neg[jn2].GetY()*fYpitchSSD;
638 Double_t yp=pos[ip].GetY()*fYpitchSSD;
639 Double_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
640 Double_t yt=yn + tann*zt;
641 zt-=fHlSSD; yt-=fHwSSD;
643 qbest =neg[jn2].GetQ();
644 lp[0]=-(-ybest+fYshift[fModule]);
645 lp[1]= -zbest+fZshift[fModule];
646 lp[2]=0.0025*0.0025; //SigmaY2
647 lp[3]=0.110*0.110; //SigmaZ2
650 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
651 for (Int_t ilab=0;ilab<3;ilab++){
652 milab[ilab] = pos[ip].GetLabel(ilab);
653 milab[ilab+3] = neg[jn2].GetLabel(ilab);
657 ratio = (pos[ip].GetQ()-neg[jn2].GetQ())/(pos[ip].GetQ()+neg[jn2].GetQ());
658 milab[3]=(((ip<<10) + jn2)<<10) + idet; // pos|neg|det
659 Int_t info[3] = {pos[ip].GetNd(),neg[jn2].GetNd(),fNlayer[fModule]};
660 AliITSRecPoint * cl2;
662 cl2 = new (cl[ncl]) AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
663 cl2->SetChargeRatio(ratio);
666 if ((pos[ip].GetNd()+neg[jn2].GetNd())>6){ //multi cluster
673 cl2 = new AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
674 cl2->SetChargeRatio(ratio);
677 if ((pos[ip].GetNd()+neg[jn2].GetNd())>6){ //multi cluster
682 fDetTypeRec->AddRecPoint(*cl2);
694 for (Int_t ip=0;ip<np;ip++){
695 Float_t ybest=1000,zbest=1000,qbest=0;
699 if ( (cnegative[ip]<5) && cpositive[negativepair[10*ip]]<5){
700 Float_t minchargediff =4.;
702 for (Int_t di=0;di<cnegative[ip];di++){
703 Int_t jc = negativepair[ip*10+di];
704 Float_t chargedif = pos[ip].GetQ()-neg[jc].GetQ();
705 if (TMath::Abs(chargedif)<minchargediff){
707 minchargediff = TMath::Abs(chargedif);
710 if (j<0) continue; // not proper cluster
712 for (Int_t di=0;di<cnegative[ip];di++){
713 Int_t jc = negativepair[ip*10+di];
714 Float_t chargedif = pos[ip].GetQ()-neg[jc].GetQ();
715 if (TMath::Abs(chargedif)<minchargediff+3.) count++;
717 if (count>1) continue; // more than one "proper" cluster for positive
720 for (Int_t dj=0;dj<cpositive[j];dj++){
721 Int_t ic = positivepair[j*10+dj];
722 Float_t chargedif = pos[ic].GetQ()-neg[j].GetQ();
723 if (TMath::Abs(chargedif)<minchargediff+3.) count++;
725 if (count>1) continue; // more than one "proper" cluster for negative
730 for (Int_t dj=0;dj<cnegative[jp];dj++){
731 Int_t ic = positivepair[jp*10+dj];
732 Float_t chargedif = pos[ic].GetQ()-neg[jp].GetQ();
733 if (TMath::Abs(chargedif)<minchargediff+4.) count++;
735 if (count>1) continue;
736 if (pairs[ip][j]<100) continue;
738 //almost gold clusters
739 Float_t yp=pos[ip].GetY()*fYpitchSSD;
740 Float_t yn=neg[j].GetY()*fYpitchSSD;
741 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
742 Float_t yt=yn + tann*zt;
743 zt-=fHlSSD; yt-=fHwSSD;
745 qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
746 lp[0]=-(-ybest+fYshift[fModule]);
747 lp[1]= -zbest+fZshift[fModule];
748 lp[2]=0.0025*0.0025; //SigmaY2
749 lp[3]=0.110*0.110; //SigmaZ2
751 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
752 for (Int_t ilab=0;ilab<3;ilab++){
753 milab[ilab] = pos[ip].GetLabel(ilab);
754 milab[ilab+3] = neg[j].GetLabel(ilab);
758 ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ());
759 milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
760 Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
761 AliITSRecPoint * cl2;
763 cl2 = new (cl[ncl]) AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
764 cl2->SetChargeRatio(ratio);
767 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
775 cl2 = new AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
776 cl2->SetChargeRatio(ratio);
779 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
786 fDetTypeRec->AddRecPoint(*cl2);
794 for (Int_t i=0; i<np; i++) {
795 Float_t ybest=1000,zbest=1000,qbest=0;
796 Float_t yp=pos[i].GetY()*fYpitchSSD;
797 if (pos[i].GetQ()<3) continue;
798 for (Int_t j=0; j<nn; j++) {
799 // for (Int_t di = 0;di<cpositive[i];di++){
800 // Int_t j = negativepair[10*i+di];
801 if (neg[j].GetQ()<3) continue;
802 if (cused2[j]||cused1[i]) continue;
803 if (pairs[i][j]>0 &&pairs[i][j]<100) continue;
804 ratio = (pos[i].GetQ()-neg[j].GetQ())/(pos[i].GetQ()+neg[j].GetQ());
805 Float_t yn=neg[j].GetY()*fYpitchSSD;
806 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
807 Float_t yt=yn + tann*zt;
808 zt-=fHlSSD; yt-=fHwSSD;
809 if (TMath::Abs(yt)<fHwSSD+0.01)
810 if (TMath::Abs(zt)<fHlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) {
812 qbest=0.5*(pos[i].GetQ()+neg[j].GetQ());
813 lp[0]=-(-ybest+fYshift[fModule]);
814 lp[1]= -zbest+fZshift[fModule];
815 lp[2]=0.0025*0.0025; //SigmaY2
816 lp[3]=0.110*0.110; //SigmaZ2
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[i].GetLabel(ilab);
822 milab[ilab+3] = neg[j].GetLabel(ilab);
826 milab[3]=(((i<<10) + j)<<10) + idet; // pos|neg|det
827 Int_t info[3] = {pos[i].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
828 AliITSRecPoint * cl2;
830 cl2 = new (cl[ncl]) AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
831 cl2->SetChargeRatio(ratio);
832 cl2->SetType(100+cpositive[j]+cnegative[i]);
835 cl2 = new AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
836 cl2->SetChargeRatio(ratio);
837 cl2->SetType(100+cpositive[j]+cnegative[i]);
838 fDetTypeRec->AddRecPoint(*cl2);
843 if (pairs[i][j]<100){
844 printf("problem:- %d\n", pairs[i][j]);
846 if (cnegative[i]<2&&cpositive[j]<2){
847 printf("problem:- %d\n", pairs[i][j]);
854 // for (Int_t i=0; i<1000; i++) delete [] pairs[i];