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 Float_t q=d->GetSignal()/4.29;// temp. fix (for PID purposed - normalis. to be checked)
67 d->SetSignal(Int_t(q));
68 if (d->GetSignal()<3) continue;
71 Int_t smax = digits->GetEntriesFast();
74 const Int_t kMax=1000;
76 Ali1Dcluster pos[kMax], neg[kMax];
77 Float_t y=0., q=0., qmax=0.;
78 Int_t lab[4]={-2,-2,-2,-2};
80 AliITSdigitSSD *d=(AliITSdigitSSD*)digits->UncheckedAt(0);
82 y += d->GetCoord2()*d->GetSignal();
84 lab[0]=d->GetTrack(0); lab[1]=d->GetTrack(1); lab[2]=d->GetTrack(2);
85 Int_t curr=d->GetCoord2();
86 Int_t flag=d->GetCoord1();
91 for (Int_t ilab=0;ilab<10;ilab++){
94 milab[0]=d->GetTrack(0); milab[1]=d->GetTrack(1); milab[2]=d->GetTrack(2);
96 for (Int_t s=1; s<smax; s++) {
97 d=(AliITSdigitSSD*)digits->UncheckedAt(s);
98 Int_t strip=d->GetCoord2();
99 if ((strip-curr) > 1 || flag!=d->GetCoord1()) {
104 c[*n].SetLabels(milab);
105 //Split suspiciously big cluster
108 c[*n].SetY(y/q-0.3*nd);
112 Error("FindClustersSSD","Too many 1D clusters !");
115 c[*n].SetY(y/q-0.0*nd);
120 Error("FindClustersSSD","Too many 1D clusters !");
124 c[*n].SetY(y/q+0.3*nd);
127 c[*n].SetLabels(milab);
132 c[*n].SetY(y/q-0.25*nd);
136 Error("FindClustersSSD","Too many 1D clusters !");
139 c[*n].SetY(y/q+0.25*nd);
142 c[*n].SetLabels(milab);
146 Error("FindClustersSSD","Too many 1D clusters !");
151 lab[0]=lab[1]=lab[2]=-2;
153 for (Int_t ilab=0;ilab<10;ilab++){
157 if (flag!=d->GetCoord1()) { n=&np; c=pos; }
161 y += d->GetCoord2()*d->GetSignal();
163 if (d->GetSignal()>qmax) {
165 lab[0]=d->GetTrack(0); lab[1]=d->GetTrack(1); lab[2]=d->GetTrack(2);
167 for (Int_t ilab=0;ilab<10;ilab++) {
168 if (d->GetTrack(ilab)>=0) AddLabel(milab, (d->GetTrack(ilab)));
175 c[*n].SetLabels(lab);
176 //Split suspiciously big cluster
178 c[*n].SetY(y/q-0.25*nd);
182 Error("FindClustersSSD","Too many 1D clusters !");
185 c[*n].SetY(y/q+0.25*nd);
188 c[*n].SetLabels(lab);
192 Error("FindClustersSSD","Too many 1D clusters !");
196 FindClustersSSD(neg, nn, pos, np);
200 void AliITSClusterFinderV2SSD::RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters){
202 //------------------------------------------------------------
203 // This function creates ITS clusters from raw data
204 //------------------------------------------------------------
206 AliITSRawStreamSSD inputSSD(rawReader);
207 FindClustersSSD(&inputSSD,clusters);
211 void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStream* input,
212 TClonesArray** clusters)
214 //------------------------------------------------------------
215 // Actual SSD cluster finder for raw data
216 //------------------------------------------------------------
217 Int_t nClustersSSD = 0;
218 const Int_t kMax = 1000;
219 Ali1Dcluster clusters1D[2][kMax];
220 Int_t nClusters[2] = {0, 0};
221 Int_t lab[3]={-2,-2,-2};
225 Int_t prevStrip = -1;
227 Int_t prevModule = -1;
229 // read raw data input stream
231 Bool_t next = input->Next();
233 if(input->GetSignal()<3 && next) continue;
234 // check if a new cluster starts
235 Int_t strip = input->GetCoord2();
236 Int_t flag = input->GetCoord1();
237 if ((!next || (input->GetModuleID() != prevModule)||
238 (strip-prevStrip > 1) || (flag != prevFlag)) &&
240 if (nClusters[prevFlag] == kMax) {
241 Error("FindClustersSSD", "Too many 1D clusters !");
244 Ali1Dcluster& cluster = clusters1D[prevFlag][nClusters[prevFlag]++];
247 cluster.SetNd(nDigits);
248 cluster.SetLabels(lab);
250 //Split suspiciously big cluster
251 if (nDigits > 4&&nDigits < 25) {
252 cluster.SetY(y/q - 0.25*nDigits);
254 if (nClusters[prevFlag] == kMax) {
255 Error("FindClustersSSD", "Too many 1D clusters !");
258 Ali1Dcluster& cluster2 = clusters1D[prevFlag][nClusters[prevFlag]++];
259 cluster2.SetY(y/q + 0.25*nDigits);
260 cluster2.SetQ(0.5*q);
261 cluster2.SetNd(nDigits);
262 cluster2.SetLabels(lab);
268 if (!next || (input->GetModuleID() != prevModule)) {
269 Int_t iModule = prevModule;
271 // when all data from a module was read, search for clusters
273 clusters[iModule] = new TClonesArray("AliITSRecPoint");
275 FindClustersSSD(&clusters1D[0][0], nClusters[0],
276 &clusters1D[1][0], nClusters[1], clusters[iModule]);
277 Int_t nClusters = clusters[iModule]->GetEntriesFast();
278 nClustersSSD += nClusters;
282 nClusters[0] = nClusters[1] = 0;
287 // add digit to current cluster
288 q += input->GetSignal();
289 y += strip * input->GetSignal();
293 prevModule = input->GetModuleID();
297 Info("FindClustersSSD", "found clusters in ITS SSD: %d", nClustersSSD);
300 void AliITSClusterFinderV2SSD::
301 FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
302 Ali1Dcluster* pos, Int_t np,
303 TClonesArray *clusters) {
304 //------------------------------------------------------------
305 // Actual SSD cluster finder
306 //------------------------------------------------------------
307 TClonesArray &cl=*clusters;
309 Float_t tanp=fTanP, tann=fTanN;
310 if (fModule>fLastSSD1) {tann=fTanP; tanp=fTanN;}
311 Int_t idet=fNdet[fModule];
314 Int_t negativepair[30000];
315 Int_t cnegative[3000];
317 Int_t positivepair[30000];
318 Int_t cpositive[3000];
320 for (Int_t i=0;i<3000;i++) {cnegative[i]=0; cused1[i]=0;}
321 for (Int_t i=0;i<3000;i++) {cpositive[i]=0; cused2[i]=0;}
322 for (Int_t i=0;i<30000;i++) {negativepair[i]=0; positivepair[i]=0;}
323 static Short_t pairs[1000][1000];
324 memset(pairs,0,sizeof(Short_t)*1000000);
325 // Short_t ** pairs = new Short_t*[1000];
326 // for (Int_t i=0; i<1000; i++) {
327 // pairs[i] = new Short_t[1000];
328 // memset(pairs[i],0,sizeof(Short_t)*1000);
331 // find available pairs
333 for (Int_t i=0; i<np; i++) {
334 Float_t yp=pos[i].GetY()*fYpitchSSD;
335 if (pos[i].GetQ()<3) continue;
336 for (Int_t j=0; j<nn; j++) {
337 if (neg[j].GetQ()<3) continue;
338 Float_t yn=neg[j].GetY()*fYpitchSSD;
339 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
340 Float_t yt=yn + tann*zt;
341 zt-=fHlSSD; yt-=fHwSSD;
342 if (TMath::Abs(yt)<fHwSSD+0.01)
343 if (TMath::Abs(zt)<fHlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) {
344 negativepair[i*10+cnegative[i]] =j; //index
345 positivepair[j*10+cpositive[j]] =i;
346 cnegative[i]++; //counters
353 for (Int_t i=0; i<np; i++) {
354 Float_t yp=pos[i].GetY()*fYpitchSSD;
355 if (pos[i].GetQ()<3) continue;
356 for (Int_t j=0; j<nn; j++) {
357 if (neg[j].GetQ()<3) continue;
358 if (cpositive[j]&&cnegative[i]) continue;
359 Float_t yn=neg[j].GetY()*fYpitchSSD;
360 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
361 Float_t yt=yn + tann*zt;
362 zt-=fHlSSD; yt-=fHwSSD;
363 if (TMath::Abs(yt)<fHwSSD+0.1)
364 if (TMath::Abs(zt)<fHlSSD+0.15) {
365 if (cnegative[i]==0) pos[i].SetNd(100); // not available pair
366 if (cpositive[j]==0) neg[j].SetNd(100); // not available pair
367 negativepair[i*10+cnegative[i]] =j; //index
368 positivepair[j*10+cpositive[j]] =i;
369 cnegative[i]++; //counters
383 for (Int_t ip=0;ip<np;ip++){
384 Float_t ybest=1000,zbest=1000,qbest=0;
386 // select gold clusters
387 if ( (cnegative[ip]==1) && cpositive[negativepair[10*ip]]==1){
388 Float_t yp=pos[ip].GetY()*fYpitchSSD;
389 Int_t j = negativepair[10*ip];
390 ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ());
392 Float_t yn=neg[j].GetY()*fYpitchSSD;
393 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
394 Float_t yt=yn + tann*zt;
395 zt-=fHlSSD; yt-=fHwSSD;
397 qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
398 lp[0]=-(-ybest+fYshift[fModule]);
399 lp[1]= -zbest+fZshift[fModule];
400 lp[2]=0.0025*0.0025; //SigmaY2
401 lp[3]=0.110*0.110; //SigmaZ2
404 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
405 for (Int_t ilab=0;ilab<3;ilab++){
406 milab[ilab] = pos[ip].GetLabel(ilab);
407 milab[ilab+3] = neg[j].GetLabel(ilab);
411 milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
412 Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
413 AliITSRecPoint * cl2;
415 cl2 = new (cl[ncl]) AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
416 cl2->SetChargeRatio(ratio);
419 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
428 cl2 = new AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
429 cl2->SetChargeRatio(ratio);
432 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
438 fDetTypeRec->AddRecPoint(*cl2);
444 for (Int_t ip=0;ip<np;ip++){
445 Float_t ybest=1000,zbest=1000,qbest=0;
448 // select "silber" cluster
449 if ( cnegative[ip]==1 && cpositive[negativepair[10*ip]]==2){
450 Int_t in = negativepair[10*ip];
451 Int_t ip2 = positivepair[10*in];
452 if (ip2==ip) ip2 = positivepair[10*in+1];
453 Float_t pcharge = pos[ip].GetQ()+pos[ip2].GetQ();
454 if (TMath::Abs(pcharge-neg[in].GetQ())<10){
457 if (pairs[ip][in]==100){ //
458 Float_t yp=pos[ip].GetY()*fYpitchSSD;
459 Float_t yn=neg[in].GetY()*fYpitchSSD;
460 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
461 Float_t yt=yn + tann*zt;
462 zt-=fHlSSD; yt-=fHwSSD;
464 qbest =pos[ip].GetQ();
465 lp[0]=-(-ybest+fYshift[fModule]);
466 lp[1]= -zbest+fZshift[fModule];
467 lp[2]=0.0025*0.0025; //SigmaY2
468 lp[3]=0.110*0.110; //SigmaZ2
471 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
472 for (Int_t ilab=0;ilab<3;ilab++){
473 milab[ilab] = pos[ip].GetLabel(ilab);
474 milab[ilab+3] = neg[in].GetLabel(ilab);
478 ratio = (pos[ip].GetQ()-neg[in].GetQ())/(pos[ip].GetQ()+neg[in].GetQ());
479 milab[3]=(((ip<<10) + in)<<10) + idet; // pos|neg|det
480 Int_t info[3] = {pos[ip].GetNd(),neg[in].GetNd(),fNlayer[fModule]};
482 AliITSRecPoint * cl2;
484 cl2 = new (cl[ncl]) AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
485 cl2->SetChargeRatio(ratio);
488 if ((pos[ip].GetNd()+neg[in].GetNd())>6){ //multi cluster
494 cl2 = new AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
495 cl2->SetChargeRatio(ratio);
498 if ((pos[ip].GetNd()+neg[in].GetNd())>6){ //multi cluster
503 fDetTypeRec->AddRecPoint(*cl2);
511 // if (!(cused1[ip2] || cused2[in])){ //
512 if (pairs[ip2][in]==100){
513 Float_t yp=pos[ip2].GetY()*fYpitchSSD;
514 Float_t yn=neg[in].GetY()*fYpitchSSD;
515 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
516 Float_t yt=yn + tann*zt;
517 zt-=fHlSSD; yt-=fHwSSD;
519 qbest =pos[ip2].GetQ();
520 lp[0]=-(-ybest+fYshift[fModule]);
521 lp[1]= -zbest+fZshift[fModule];
522 lp[2]=0.0025*0.0025; //SigmaY2
523 lp[3]=0.110*0.110; //SigmaZ2
526 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
527 for (Int_t ilab=0;ilab<3;ilab++){
528 milab[ilab] = pos[ip2].GetLabel(ilab);
529 milab[ilab+3] = neg[in].GetLabel(ilab);
533 ratio = (pos[ip2].GetQ()-neg[in].GetQ())/(pos[ip2].GetQ()+neg[in].GetQ());
534 milab[3]=(((ip2<<10) + in)<<10) + idet; // pos|neg|det
535 Int_t info[3] = {pos[ip2].GetNd(),neg[in].GetNd(),fNlayer[fModule]};
537 AliITSRecPoint * cl2;
539 cl2 = new (cl[ncl]) AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
540 cl2->SetChargeRatio(ratio);
543 if ((pos[ip2].GetNd()+neg[in].GetNd())>6){ //multi cluster
549 cl2 = new AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
550 cl2->SetChargeRatio(ratio);
553 if ((pos[ip2].GetNd()+neg[in].GetNd())>6){ //multi cluster
558 fDetTypeRec->AddRecPoint(*cl2);
570 for (Int_t jn=0;jn<nn;jn++){
571 if (cused2[jn]) continue;
572 Float_t ybest=1000,zbest=1000,qbest=0;
573 // select "silber" cluster
574 if ( cpositive[jn]==1 && cnegative[positivepair[10*jn]]==2){
575 Int_t ip = positivepair[10*jn];
576 Int_t jn2 = negativepair[10*ip];
577 if (jn2==jn) jn2 = negativepair[10*ip+1];
578 Float_t pcharge = neg[jn].GetQ()+neg[jn2].GetQ();
580 if (TMath::Abs(pcharge-pos[ip].GetQ())<10){
583 // if (!(cused1[ip]||cused2[jn])){
584 if (pairs[ip][jn]==100){
585 Float_t yn=neg[jn].GetY()*fYpitchSSD;
586 Float_t yp=pos[ip].GetY()*fYpitchSSD;
587 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
588 Float_t yt=yn + tann*zt;
589 zt-=fHlSSD; yt-=fHwSSD;
591 qbest =neg[jn].GetQ();
592 lp[0]=-(-ybest+fYshift[fModule]);
593 lp[1]= -zbest+fZshift[fModule];
594 lp[2]=0.0025*0.0025; //SigmaY2
595 lp[3]=0.110*0.110; //SigmaZ2
598 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
599 for (Int_t ilab=0;ilab<3;ilab++){
600 milab[ilab] = pos[ip].GetLabel(ilab);
601 milab[ilab+3] = neg[jn].GetLabel(ilab);
605 ratio = (pos[ip].GetQ()-neg[jn].GetQ())/(pos[ip].GetQ()+neg[jn].GetQ());
606 milab[3]=(((ip<<10) + jn)<<10) + idet; // pos|neg|det
607 Int_t info[3] = {pos[ip].GetNd(),neg[jn].GetNd(),fNlayer[fModule]};
609 AliITSRecPoint * cl2;
611 cl2 = new (cl[ncl]) AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
612 cl2->SetChargeRatio(ratio);
615 if ((pos[ip].GetNd()+neg[jn].GetNd())>6){ //multi cluster
622 cl2 = new AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
623 cl2->SetChargeRatio(ratio);
626 if ((pos[ip].GetNd()+neg[jn].GetNd())>6){ //multi cluster
631 fDetTypeRec->AddRecPoint(*cl2);
637 // if (!(cused1[ip]||cused2[jn2])){
638 if (pairs[ip][jn2]==100){
639 Float_t yn=neg[jn2].GetY()*fYpitchSSD;
640 Double_t yp=pos[ip].GetY()*fYpitchSSD;
641 Double_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
642 Double_t yt=yn + tann*zt;
643 zt-=fHlSSD; yt-=fHwSSD;
645 qbest =neg[jn2].GetQ();
646 lp[0]=-(-ybest+fYshift[fModule]);
647 lp[1]= -zbest+fZshift[fModule];
648 lp[2]=0.0025*0.0025; //SigmaY2
649 lp[3]=0.110*0.110; //SigmaZ2
652 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
653 for (Int_t ilab=0;ilab<3;ilab++){
654 milab[ilab] = pos[ip].GetLabel(ilab);
655 milab[ilab+3] = neg[jn2].GetLabel(ilab);
659 ratio = (pos[ip].GetQ()-neg[jn2].GetQ())/(pos[ip].GetQ()+neg[jn2].GetQ());
660 milab[3]=(((ip<<10) + jn2)<<10) + idet; // pos|neg|det
661 Int_t info[3] = {pos[ip].GetNd(),neg[jn2].GetNd(),fNlayer[fModule]};
662 AliITSRecPoint * cl2;
664 cl2 = new (cl[ncl]) AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
665 cl2->SetChargeRatio(ratio);
668 if ((pos[ip].GetNd()+neg[jn2].GetNd())>6){ //multi cluster
675 cl2 = new AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
676 cl2->SetChargeRatio(ratio);
679 if ((pos[ip].GetNd()+neg[jn2].GetNd())>6){ //multi cluster
684 fDetTypeRec->AddRecPoint(*cl2);
696 for (Int_t ip=0;ip<np;ip++){
697 Float_t ybest=1000,zbest=1000,qbest=0;
701 if ( (cnegative[ip]<5) && cpositive[negativepair[10*ip]]<5){
702 Float_t minchargediff =4.;
704 for (Int_t di=0;di<cnegative[ip];di++){
705 Int_t jc = negativepair[ip*10+di];
706 Float_t chargedif = pos[ip].GetQ()-neg[jc].GetQ();
707 if (TMath::Abs(chargedif)<minchargediff){
709 minchargediff = TMath::Abs(chargedif);
712 if (j<0) continue; // not proper cluster
714 for (Int_t di=0;di<cnegative[ip];di++){
715 Int_t jc = negativepair[ip*10+di];
716 Float_t chargedif = pos[ip].GetQ()-neg[jc].GetQ();
717 if (TMath::Abs(chargedif)<minchargediff+3.) count++;
719 if (count>1) continue; // more than one "proper" cluster for positive
722 for (Int_t dj=0;dj<cpositive[j];dj++){
723 Int_t ic = positivepair[j*10+dj];
724 Float_t chargedif = pos[ic].GetQ()-neg[j].GetQ();
725 if (TMath::Abs(chargedif)<minchargediff+3.) count++;
727 if (count>1) continue; // more than one "proper" cluster for negative
732 for (Int_t dj=0;dj<cnegative[jp];dj++){
733 Int_t ic = positivepair[jp*10+dj];
734 Float_t chargedif = pos[ic].GetQ()-neg[jp].GetQ();
735 if (TMath::Abs(chargedif)<minchargediff+4.) count++;
737 if (count>1) continue;
738 if (pairs[ip][j]<100) continue;
740 //almost gold clusters
741 Float_t yp=pos[ip].GetY()*fYpitchSSD;
742 Float_t yn=neg[j].GetY()*fYpitchSSD;
743 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
744 Float_t yt=yn + tann*zt;
745 zt-=fHlSSD; yt-=fHwSSD;
747 qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
748 lp[0]=-(-ybest+fYshift[fModule]);
749 lp[1]= -zbest+fZshift[fModule];
750 lp[2]=0.0025*0.0025; //SigmaY2
751 lp[3]=0.110*0.110; //SigmaZ2
753 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
754 for (Int_t ilab=0;ilab<3;ilab++){
755 milab[ilab] = pos[ip].GetLabel(ilab);
756 milab[ilab+3] = neg[j].GetLabel(ilab);
760 ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ());
761 milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
762 Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
763 AliITSRecPoint * cl2;
765 cl2 = new (cl[ncl]) AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
766 cl2->SetChargeRatio(ratio);
769 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
777 cl2 = new AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
778 cl2->SetChargeRatio(ratio);
781 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
788 fDetTypeRec->AddRecPoint(*cl2);
796 for (Int_t i=0; i<np; i++) {
797 Float_t ybest=1000,zbest=1000,qbest=0;
798 Float_t yp=pos[i].GetY()*fYpitchSSD;
799 if (pos[i].GetQ()<3) continue;
800 for (Int_t j=0; j<nn; j++) {
801 // for (Int_t di = 0;di<cpositive[i];di++){
802 // Int_t j = negativepair[10*i+di];
803 if (neg[j].GetQ()<3) continue;
804 if (cused2[j]||cused1[i]) continue;
805 if (pairs[i][j]>0 &&pairs[i][j]<100) continue;
806 ratio = (pos[i].GetQ()-neg[j].GetQ())/(pos[i].GetQ()+neg[j].GetQ());
807 Float_t yn=neg[j].GetY()*fYpitchSSD;
808 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
809 Float_t yt=yn + tann*zt;
810 zt-=fHlSSD; yt-=fHwSSD;
811 if (TMath::Abs(yt)<fHwSSD+0.01)
812 if (TMath::Abs(zt)<fHlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) {
814 qbest=0.5*(pos[i].GetQ()+neg[j].GetQ());
815 lp[0]=-(-ybest+fYshift[fModule]);
816 lp[1]= -zbest+fZshift[fModule];
817 lp[2]=0.0025*0.0025; //SigmaY2
818 lp[3]=0.110*0.110; //SigmaZ2
821 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
822 for (Int_t ilab=0;ilab<3;ilab++){
823 milab[ilab] = pos[i].GetLabel(ilab);
824 milab[ilab+3] = neg[j].GetLabel(ilab);
828 milab[3]=(((i<<10) + j)<<10) + idet; // pos|neg|det
829 Int_t info[3] = {pos[i].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
830 AliITSRecPoint * cl2;
832 cl2 = new (cl[ncl]) AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
833 cl2->SetChargeRatio(ratio);
834 cl2->SetType(100+cpositive[j]+cnegative[i]);
837 cl2 = new AliITSRecPoint(fModule,fDetTypeRec->GetITSgeom(),milab,lp,info);
838 cl2->SetChargeRatio(ratio);
839 cl2->SetType(100+cpositive[j]+cnegative[i]);
840 fDetTypeRec->AddRecPoint(*cl2);
845 if (pairs[i][j]<100){
846 printf("problem:- %d\n", pairs[i][j]);
848 if (cnegative[i]<2&&cpositive[j]<2){
849 printf("problem:- %d\n", pairs[i][j]);
856 // for (Int_t i=0; i<1000; i++) delete [] pairs[i];