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"
31 #include "AliITSCalibrationSSD.h"
33 ClassImp(AliITSClusterFinderV2SSD)
36 AliITSClusterFinderV2SSD::AliITSClusterFinderV2SSD(AliITSDetTypeRec* dettyp):AliITSClusterFinderV2(dettyp),
37 fLastSSD1(AliITSgeomTGeo::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 AliITSCalibrationSSD* cal = (AliITSCalibrationSSD*)GetResp(fModule);
64 Int_t smaxall=alldigits->GetEntriesFast();
65 if (smaxall==0) return;
66 TObjArray *digits = new TObjArray;
67 for (Int_t i=0;i<smaxall; i++){
68 AliITSdigitSSD *d=(AliITSdigitSSD*)alldigits->UncheckedAt(i);
70 if(d->IsSideP()) gain = cal->GetGainP(d->GetStripNumber());
71 else gain = cal->GetGainN(d->GetStripNumber());
73 Float_t q=gain*d->GetSignal(); // calibration brings mip peaks around 120 (in ADC units)
74 q=cal->ADCToKeV(q); // converts the charge in KeV from ADC units
75 //Float_t q=d->GetSignal()/4.29;// temp. fix (for PID purposed - normalis. to be checked)
76 d->SetSignal(Int_t(q));
78 if (d->GetSignal()<3) continue;
81 Int_t smax = digits->GetEntriesFast();
84 const Int_t kMax=1000;
86 Ali1Dcluster pos[kMax], neg[kMax];
87 Float_t y=0., q=0., qmax=0.;
88 Int_t lab[4]={-2,-2,-2,-2};
90 AliITSdigitSSD *d=(AliITSdigitSSD*)digits->UncheckedAt(0);
92 y += d->GetCoord2()*d->GetSignal();
94 lab[0]=d->GetTrack(0); lab[1]=d->GetTrack(1); lab[2]=d->GetTrack(2);
95 Int_t curr=d->GetCoord2();
96 Int_t flag=d->GetCoord1();
101 for (Int_t ilab=0;ilab<10;ilab++){
104 milab[0]=d->GetTrack(0); milab[1]=d->GetTrack(1); milab[2]=d->GetTrack(2);
106 for (Int_t s=1; s<smax; s++) {
107 d=(AliITSdigitSSD*)digits->UncheckedAt(s);
108 Int_t strip=d->GetCoord2();
109 if ((strip-curr) > 1 || flag!=d->GetCoord1()) {
114 c[*n].SetLabels(milab);
115 //Split suspiciously big cluster
118 c[*n].SetY(y/q-0.3*nd);
122 Error("FindClustersSSD","Too many 1D clusters !");
125 c[*n].SetY(y/q-0.0*nd);
130 Error("FindClustersSSD","Too many 1D clusters !");
134 c[*n].SetY(y/q+0.3*nd);
137 c[*n].SetLabels(milab);
142 c[*n].SetY(y/q-0.25*nd);
146 Error("FindClustersSSD","Too many 1D clusters !");
149 c[*n].SetY(y/q+0.25*nd);
152 c[*n].SetLabels(milab);
156 Error("FindClustersSSD","Too many 1D clusters !");
161 lab[0]=lab[1]=lab[2]=-2;
163 for (Int_t ilab=0;ilab<10;ilab++){
167 if (flag!=d->GetCoord1()) { n=&np; c=pos; }
171 y += d->GetCoord2()*d->GetSignal();
173 if (d->GetSignal()>qmax) {
175 lab[0]=d->GetTrack(0); lab[1]=d->GetTrack(1); lab[2]=d->GetTrack(2);
177 for (Int_t ilab=0;ilab<10;ilab++) {
178 if (d->GetTrack(ilab)>=0) AddLabel(milab, (d->GetTrack(ilab)));
185 c[*n].SetLabels(lab);
186 //Split suspiciously big cluster
188 c[*n].SetY(y/q-0.25*nd);
192 Error("FindClustersSSD","Too many 1D clusters !");
195 c[*n].SetY(y/q+0.25*nd);
198 c[*n].SetLabels(lab);
202 Error("FindClustersSSD","Too many 1D clusters !");
206 FindClustersSSD(neg, nn, pos, np);
210 void AliITSClusterFinderV2SSD::RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters){
212 //------------------------------------------------------------
213 // This function creates ITS clusters from raw data
214 //------------------------------------------------------------
216 AliITSRawStreamSSD inputSSD(rawReader);
217 FindClustersSSD(&inputSSD,clusters);
221 void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input,
222 TClonesArray** clusters)
224 //------------------------------------------------------------
225 // Actual SSD cluster finder for raw data
226 //------------------------------------------------------------
227 Int_t nClustersSSD = 0;
228 const Int_t kMax = 1000;
229 Ali1Dcluster clusters1D[2][kMax];
230 Int_t nClusters[2] = {0, 0};
231 Int_t lab[3]={-2,-2,-2};
235 Int_t prevStrip = -1;
237 Int_t prevModule = -1;
239 AliITSCalibrationSSD* cal;
242 // read raw data input stream
244 Bool_t next = input->Next();
246 if(input->GetSignal()<(3*4.) && next) continue;
247 // check if a new cluster starts
248 Int_t strip = input->GetCoord2();
249 Int_t flag = input->GetCoord1();
250 if ((!next || (input->GetModuleID() != prevModule)||
251 (strip-prevStrip > 1) || (flag != prevFlag)) &&
253 if (nClusters[prevFlag] == kMax) {
254 Error("FindClustersSSD", "Too many 1D clusters !");
257 Ali1Dcluster& cluster = clusters1D[prevFlag][nClusters[prevFlag]++];
260 cluster.SetNd(nDigits);
261 cluster.SetLabels(lab);
263 //Split suspiciously big cluster
264 if (nDigits > 4&&nDigits < 25) {
265 cluster.SetY(y/q - 0.25*nDigits);
267 if (nClusters[prevFlag] == kMax) {
268 Error("FindClustersSSD", "Too many 1D clusters !");
271 Ali1Dcluster& cluster2 = clusters1D[prevFlag][nClusters[prevFlag]++];
272 cluster2.SetY(y/q + 0.25*nDigits);
273 cluster2.SetQ(0.5*q);
274 cluster2.SetNd(nDigits);
275 cluster2.SetLabels(lab);
281 if (!next || (input->GetModuleID() != prevModule)) {
282 Int_t iModule = prevModule;
284 // when all data from a module was read, search for clusters
286 clusters[iModule] = new TClonesArray("AliITSRecPoint");
288 FindClustersSSD(&clusters1D[0][0], nClusters[0],
289 &clusters1D[1][0], nClusters[1], clusters[iModule]);
290 Int_t nClusters = clusters[iModule]->GetEntriesFast();
291 nClustersSSD += nClusters;
295 nClusters[0] = nClusters[1] = 0;
299 cal = (AliITSCalibrationSSD*)GetResp(input->GetModuleID());
303 if(input->GetSideFlag()==0) gain = cal->GetGainP(input->GetStrip());
304 else gain = cal->GetGainN(input->GetStrip());
306 // add digit to current cluster
307 q += cal->ADCToKeV( gain * input->GetSignal() ); // signal is corrected for gain and converted in KeV
308 y += strip * cal->ADCToKeV( gain * input->GetSignal() );
312 prevModule = input->GetModuleID();
316 Info("FindClustersSSD", "found clusters in ITS SSD: %d", nClustersSSD);
319 void AliITSClusterFinderV2SSD::
320 FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
321 Ali1Dcluster* pos, Int_t np,
322 TClonesArray *clusters) {
323 //------------------------------------------------------------
324 // Actual SSD cluster finder
325 //------------------------------------------------------------
326 TClonesArray &cl=*clusters;
328 Float_t tanp=fTanP, tann=fTanN;
329 if (fModule>fLastSSD1) {tann=fTanP; tanp=fTanN;}
330 Int_t idet=fNdet[fModule];
333 Int_t negativepair[30000];
334 Int_t cnegative[3000];
336 Int_t positivepair[30000];
337 Int_t cpositive[3000];
339 for (Int_t i=0;i<3000;i++) {cnegative[i]=0; cused1[i]=0;}
340 for (Int_t i=0;i<3000;i++) {cpositive[i]=0; cused2[i]=0;}
341 for (Int_t i=0;i<30000;i++) {negativepair[i]=0; positivepair[i]=0;}
342 static Short_t pairs[1000][1000];
343 memset(pairs,0,sizeof(Short_t)*1000000);
344 // Short_t ** pairs = new Short_t*[1000];
345 // for (Int_t i=0; i<1000; i++) {
346 // pairs[i] = new Short_t[1000];
347 // memset(pairs[i],0,sizeof(Short_t)*1000);
350 // find available pairs
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 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.01)
362 if (TMath::Abs(zt)<fHlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) {
363 negativepair[i*10+cnegative[i]] =j; //index
364 positivepair[j*10+cpositive[j]] =i;
365 cnegative[i]++; //counters
372 for (Int_t i=0; i<np; i++) {
373 Float_t yp=pos[i].GetY()*fYpitchSSD;
374 if (pos[i].GetQ()<3) continue;
375 for (Int_t j=0; j<nn; j++) {
376 if (neg[j].GetQ()<3) continue;
377 if (cpositive[j]&&cnegative[i]) continue;
378 Float_t yn=neg[j].GetY()*fYpitchSSD;
379 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
380 Float_t yt=yn + tann*zt;
381 zt-=fHlSSD; yt-=fHwSSD;
382 if (TMath::Abs(yt)<fHwSSD+0.1)
383 if (TMath::Abs(zt)<fHlSSD+0.15) {
384 if (cnegative[i]==0) pos[i].SetNd(100); // not available pair
385 if (cpositive[j]==0) neg[j].SetNd(100); // not available pair
386 negativepair[i*10+cnegative[i]] =j; //index
387 positivepair[j*10+cpositive[j]] =i;
388 cnegative[i]++; //counters
402 for (Int_t ip=0;ip<np;ip++){
403 Float_t ybest=1000,zbest=1000,qbest=0;
405 // select gold clusters
406 if ( (cnegative[ip]==1) && cpositive[negativepair[10*ip]]==1){
407 Float_t yp=pos[ip].GetY()*fYpitchSSD;
408 Int_t j = negativepair[10*ip];
409 ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ());
411 Float_t yn=neg[j].GetY()*fYpitchSSD;
412 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
413 Float_t yt=yn + tann*zt;
414 zt-=fHlSSD; yt-=fHwSSD;
416 qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
417 lp[0]=-(-ybest+fYshift[fModule]);
418 lp[1]= -zbest+fZshift[fModule];
419 lp[2]=0.0025*0.0025; //SigmaY2
420 lp[3]=0.110*0.110; //SigmaZ2
423 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
424 for (Int_t ilab=0;ilab<3;ilab++){
425 milab[ilab] = pos[ip].GetLabel(ilab);
426 milab[ilab+3] = neg[j].GetLabel(ilab);
430 milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
431 Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
432 AliITSRecPoint * cl2;
434 cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
435 cl2->SetChargeRatio(ratio);
438 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
447 cl2 = new AliITSRecPoint(milab,lp,info);
448 cl2->SetChargeRatio(ratio);
451 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
457 fDetTypeRec->AddRecPoint(*cl2);
463 for (Int_t ip=0;ip<np;ip++){
464 Float_t ybest=1000,zbest=1000,qbest=0;
467 // select "silber" cluster
468 if ( cnegative[ip]==1 && cpositive[negativepair[10*ip]]==2){
469 Int_t in = negativepair[10*ip];
470 Int_t ip2 = positivepair[10*in];
471 if (ip2==ip) ip2 = positivepair[10*in+1];
472 Float_t pcharge = pos[ip].GetQ()+pos[ip2].GetQ();
473 if (TMath::Abs(pcharge-neg[in].GetQ())<10){
476 if (pairs[ip][in]==100){ //
477 Float_t yp=pos[ip].GetY()*fYpitchSSD;
478 Float_t yn=neg[in].GetY()*fYpitchSSD;
479 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
480 Float_t yt=yn + tann*zt;
481 zt-=fHlSSD; yt-=fHwSSD;
483 qbest =pos[ip].GetQ();
484 lp[0]=-(-ybest+fYshift[fModule]);
485 lp[1]= -zbest+fZshift[fModule];
486 lp[2]=0.0025*0.0025; //SigmaY2
487 lp[3]=0.110*0.110; //SigmaZ2
490 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
491 for (Int_t ilab=0;ilab<3;ilab++){
492 milab[ilab] = pos[ip].GetLabel(ilab);
493 milab[ilab+3] = neg[in].GetLabel(ilab);
497 ratio = (pos[ip].GetQ()-neg[in].GetQ())/(pos[ip].GetQ()+neg[in].GetQ());
498 milab[3]=(((ip<<10) + in)<<10) + idet; // pos|neg|det
499 Int_t info[3] = {pos[ip].GetNd(),neg[in].GetNd(),fNlayer[fModule]};
501 AliITSRecPoint * cl2;
503 cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
504 cl2->SetChargeRatio(ratio);
507 if ((pos[ip].GetNd()+neg[in].GetNd())>6){ //multi cluster
513 cl2 = new AliITSRecPoint(milab,lp,info);
514 cl2->SetChargeRatio(ratio);
517 if ((pos[ip].GetNd()+neg[in].GetNd())>6){ //multi cluster
522 fDetTypeRec->AddRecPoint(*cl2);
530 // if (!(cused1[ip2] || cused2[in])){ //
531 if (pairs[ip2][in]==100){
532 Float_t yp=pos[ip2].GetY()*fYpitchSSD;
533 Float_t yn=neg[in].GetY()*fYpitchSSD;
534 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
535 Float_t yt=yn + tann*zt;
536 zt-=fHlSSD; yt-=fHwSSD;
538 qbest =pos[ip2].GetQ();
539 lp[0]=-(-ybest+fYshift[fModule]);
540 lp[1]= -zbest+fZshift[fModule];
541 lp[2]=0.0025*0.0025; //SigmaY2
542 lp[3]=0.110*0.110; //SigmaZ2
545 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
546 for (Int_t ilab=0;ilab<3;ilab++){
547 milab[ilab] = pos[ip2].GetLabel(ilab);
548 milab[ilab+3] = neg[in].GetLabel(ilab);
552 ratio = (pos[ip2].GetQ()-neg[in].GetQ())/(pos[ip2].GetQ()+neg[in].GetQ());
553 milab[3]=(((ip2<<10) + in)<<10) + idet; // pos|neg|det
554 Int_t info[3] = {pos[ip2].GetNd(),neg[in].GetNd(),fNlayer[fModule]};
556 AliITSRecPoint * cl2;
558 cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
559 cl2->SetChargeRatio(ratio);
562 if ((pos[ip2].GetNd()+neg[in].GetNd())>6){ //multi cluster
568 cl2 = new AliITSRecPoint(milab,lp,info);
569 cl2->SetChargeRatio(ratio);
572 if ((pos[ip2].GetNd()+neg[in].GetNd())>6){ //multi cluster
577 fDetTypeRec->AddRecPoint(*cl2);
589 for (Int_t jn=0;jn<nn;jn++){
590 if (cused2[jn]) continue;
591 Float_t ybest=1000,zbest=1000,qbest=0;
592 // select "silber" cluster
593 if ( cpositive[jn]==1 && cnegative[positivepair[10*jn]]==2){
594 Int_t ip = positivepair[10*jn];
595 Int_t jn2 = negativepair[10*ip];
596 if (jn2==jn) jn2 = negativepair[10*ip+1];
597 Float_t pcharge = neg[jn].GetQ()+neg[jn2].GetQ();
599 if (TMath::Abs(pcharge-pos[ip].GetQ())<10){
602 // if (!(cused1[ip]||cused2[jn])){
603 if (pairs[ip][jn]==100){
604 Float_t yn=neg[jn].GetY()*fYpitchSSD;
605 Float_t yp=pos[ip].GetY()*fYpitchSSD;
606 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
607 Float_t yt=yn + tann*zt;
608 zt-=fHlSSD; yt-=fHwSSD;
610 qbest =neg[jn].GetQ();
611 lp[0]=-(-ybest+fYshift[fModule]);
612 lp[1]= -zbest+fZshift[fModule];
613 lp[2]=0.0025*0.0025; //SigmaY2
614 lp[3]=0.110*0.110; //SigmaZ2
617 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
618 for (Int_t ilab=0;ilab<3;ilab++){
619 milab[ilab] = pos[ip].GetLabel(ilab);
620 milab[ilab+3] = neg[jn].GetLabel(ilab);
624 ratio = (pos[ip].GetQ()-neg[jn].GetQ())/(pos[ip].GetQ()+neg[jn].GetQ());
625 milab[3]=(((ip<<10) + jn)<<10) + idet; // pos|neg|det
626 Int_t info[3] = {pos[ip].GetNd(),neg[jn].GetNd(),fNlayer[fModule]};
628 AliITSRecPoint * cl2;
630 cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
631 cl2->SetChargeRatio(ratio);
634 if ((pos[ip].GetNd()+neg[jn].GetNd())>6){ //multi cluster
641 cl2 = new AliITSRecPoint(milab,lp,info);
642 cl2->SetChargeRatio(ratio);
645 if ((pos[ip].GetNd()+neg[jn].GetNd())>6){ //multi cluster
650 fDetTypeRec->AddRecPoint(*cl2);
656 // if (!(cused1[ip]||cused2[jn2])){
657 if (pairs[ip][jn2]==100){
658 Float_t yn=neg[jn2].GetY()*fYpitchSSD;
659 Double_t yp=pos[ip].GetY()*fYpitchSSD;
660 Double_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
661 Double_t yt=yn + tann*zt;
662 zt-=fHlSSD; yt-=fHwSSD;
664 qbest =neg[jn2].GetQ();
665 lp[0]=-(-ybest+fYshift[fModule]);
666 lp[1]= -zbest+fZshift[fModule];
667 lp[2]=0.0025*0.0025; //SigmaY2
668 lp[3]=0.110*0.110; //SigmaZ2
671 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
672 for (Int_t ilab=0;ilab<3;ilab++){
673 milab[ilab] = pos[ip].GetLabel(ilab);
674 milab[ilab+3] = neg[jn2].GetLabel(ilab);
678 ratio = (pos[ip].GetQ()-neg[jn2].GetQ())/(pos[ip].GetQ()+neg[jn2].GetQ());
679 milab[3]=(((ip<<10) + jn2)<<10) + idet; // pos|neg|det
680 Int_t info[3] = {pos[ip].GetNd(),neg[jn2].GetNd(),fNlayer[fModule]};
681 AliITSRecPoint * cl2;
683 cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
684 cl2->SetChargeRatio(ratio);
687 if ((pos[ip].GetNd()+neg[jn2].GetNd())>6){ //multi cluster
694 cl2 = new AliITSRecPoint(milab,lp,info);
695 cl2->SetChargeRatio(ratio);
698 if ((pos[ip].GetNd()+neg[jn2].GetNd())>6){ //multi cluster
703 fDetTypeRec->AddRecPoint(*cl2);
715 for (Int_t ip=0;ip<np;ip++){
716 Float_t ybest=1000,zbest=1000,qbest=0;
720 if ( (cnegative[ip]<5) && cpositive[negativepair[10*ip]]<5){
721 Float_t minchargediff =4.;
723 for (Int_t di=0;di<cnegative[ip];di++){
724 Int_t jc = negativepair[ip*10+di];
725 Float_t chargedif = pos[ip].GetQ()-neg[jc].GetQ();
726 if (TMath::Abs(chargedif)<minchargediff){
728 minchargediff = TMath::Abs(chargedif);
731 if (j<0) continue; // not proper cluster
733 for (Int_t di=0;di<cnegative[ip];di++){
734 Int_t jc = negativepair[ip*10+di];
735 Float_t chargedif = pos[ip].GetQ()-neg[jc].GetQ();
736 if (TMath::Abs(chargedif)<minchargediff+3.) count++;
738 if (count>1) continue; // more than one "proper" cluster for positive
741 for (Int_t dj=0;dj<cpositive[j];dj++){
742 Int_t ic = positivepair[j*10+dj];
743 Float_t chargedif = pos[ic].GetQ()-neg[j].GetQ();
744 if (TMath::Abs(chargedif)<minchargediff+3.) count++;
746 if (count>1) continue; // more than one "proper" cluster for negative
751 for (Int_t dj=0;dj<cnegative[jp];dj++){
752 Int_t ic = positivepair[jp*10+dj];
753 Float_t chargedif = pos[ic].GetQ()-neg[jp].GetQ();
754 if (TMath::Abs(chargedif)<minchargediff+4.) count++;
756 if (count>1) continue;
757 if (pairs[ip][j]<100) continue;
759 //almost gold clusters
760 Float_t yp=pos[ip].GetY()*fYpitchSSD;
761 Float_t yn=neg[j].GetY()*fYpitchSSD;
762 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
763 Float_t yt=yn + tann*zt;
764 zt-=fHlSSD; yt-=fHwSSD;
766 qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
767 lp[0]=-(-ybest+fYshift[fModule]);
768 lp[1]= -zbest+fZshift[fModule];
769 lp[2]=0.0025*0.0025; //SigmaY2
770 lp[3]=0.110*0.110; //SigmaZ2
772 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
773 for (Int_t ilab=0;ilab<3;ilab++){
774 milab[ilab] = pos[ip].GetLabel(ilab);
775 milab[ilab+3] = neg[j].GetLabel(ilab);
779 ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ());
780 milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
781 Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
782 AliITSRecPoint * cl2;
784 cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
785 cl2->SetChargeRatio(ratio);
788 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
796 cl2 = new AliITSRecPoint(milab,lp,info);
797 cl2->SetChargeRatio(ratio);
800 if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
807 fDetTypeRec->AddRecPoint(*cl2);
815 for (Int_t i=0; i<np; i++) {
816 Float_t ybest=1000,zbest=1000,qbest=0;
817 Float_t yp=pos[i].GetY()*fYpitchSSD;
818 if (pos[i].GetQ()<3) continue;
819 for (Int_t j=0; j<nn; j++) {
820 // for (Int_t di = 0;di<cpositive[i];di++){
821 // Int_t j = negativepair[10*i+di];
822 if (neg[j].GetQ()<3) continue;
823 if (cused2[j]||cused1[i]) continue;
824 if (pairs[i][j]>0 &&pairs[i][j]<100) continue;
825 ratio = (pos[i].GetQ()-neg[j].GetQ())/(pos[i].GetQ()+neg[j].GetQ());
826 Float_t yn=neg[j].GetY()*fYpitchSSD;
827 Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
828 Float_t yt=yn + tann*zt;
829 zt-=fHlSSD; yt-=fHwSSD;
830 if (TMath::Abs(yt)<fHwSSD+0.01)
831 if (TMath::Abs(zt)<fHlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) {
833 qbest=0.5*(pos[i].GetQ()+neg[j].GetQ());
834 lp[0]=-(-ybest+fYshift[fModule]);
835 lp[1]= -zbest+fZshift[fModule];
836 lp[2]=0.0025*0.0025; //SigmaY2
837 lp[3]=0.110*0.110; //SigmaZ2
840 for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
841 for (Int_t ilab=0;ilab<3;ilab++){
842 milab[ilab] = pos[i].GetLabel(ilab);
843 milab[ilab+3] = neg[j].GetLabel(ilab);
847 milab[3]=(((i<<10) + j)<<10) + idet; // pos|neg|det
848 Int_t info[3] = {pos[i].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
849 AliITSRecPoint * cl2;
851 cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
852 cl2->SetChargeRatio(ratio);
853 cl2->SetType(100+cpositive[j]+cnegative[i]);
856 cl2 = new AliITSRecPoint(milab,lp,info);
857 cl2->SetChargeRatio(ratio);
858 cl2->SetType(100+cpositive[j]+cnegative[i]);
859 fDetTypeRec->AddRecPoint(*cl2);
864 if (pairs[i][j]<100){
865 printf("problem:- %d\n", pairs[i][j]);
867 if (cnegative[i]<2&&cpositive[j]<2){
868 printf("problem:- %d\n", pairs[i][j]);
875 // for (Int_t i=0; i<1000; i++) delete [] pairs[i];