+void AliITSclustererV2::FindClustersSDD(AliITSRawStream* input,
+ TClonesArray** clusters)
+{
+ //------------------------------------------------------------
+ // Actual SDD cluster finder for raw data
+ //------------------------------------------------------------
+ Int_t nClustersSDD = 0;
+ Int_t kNzBins = fNzSDD + 2;
+ Int_t kMaxBin = kNzBins * (fNySDD+2);
+ AliBin* bins[2] = {NULL, NULL};
+
+ // read raw data input stream
+ while (kTRUE) {
+ Bool_t next = input->Next();
+ if (!next || input->IsNewModule()) {
+ Int_t iModule = input->GetPrevModuleID();
+
+ // when all data from a module was read, search for clusters
+ if (bins[0]) {
+ clusters[iModule] = new TClonesArray("AliITSclusterV2");
+ fI = iModule;
+ FindClustersSDD(bins, kMaxBin, kNzBins, NULL, clusters[iModule]);
+ Int_t nClusters = clusters[iModule]->GetEntriesFast();
+ nClustersSDD += nClusters;
+ delete[] bins[0];
+ delete[] bins[1];
+ }
+
+ if (!next) break;
+ bins[0] = new AliBin[kMaxBin];
+ bins[1] = new AliBin[kMaxBin];
+ }
+
+ // fill the current digit into the bins array
+ Int_t iz = input->GetCoord1()+1;
+ Int_t side = ((iz <= fNzSDD) ? 0 : 1);
+ iz -= side*fNzSDD;
+ Int_t index = (input->GetCoord2()+1) * kNzBins + iz;
+ bins[side][index].SetQ(input->GetSignal());
+ bins[side][index].SetMask(1);
+ bins[side][index].SetIndex(index);
+ }
+
+ Info("FindClustersSDD", "found clusters in ITS SDD: %d", nClustersSDD);
+}
+
+void AliITSclustererV2::
+FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
+ Ali1Dcluster* pos, Int_t np,
+ TClonesArray *clusters) {
+ //------------------------------------------------------------
+ // Actual SSD cluster finder
+ //------------------------------------------------------------
+ TClonesArray &cl=*clusters;
+
+ Int_t lab[4]={-2,-2,-2,-2};
+ Float_t tanp=fTanP, tann=fTanN;
+ if (fI>fLastSSD1) {tann=fTanP; tanp=fTanN;}
+
+ Int_t idet=fNdet[fI];
+ Int_t ncl=0;
+ for (Int_t i=0; i<np; i++) {
+ //Float_t dq_min=1.e+33;
+ Float_t ybest=1000,zbest=1000,qbest=0;
+ Float_t yp=pos[i].GetY()*fYpitchSSD;
+ for (Int_t j=0; j<nn; j++) {
+ //if (pos[i].fTracks[0] != neg[j].fTracks[0]) continue;
+ Float_t yn=neg[j].GetY()*fYpitchSSD;
+ Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
+ Float_t yt=yn + tann*zt;
+ zt-=fHlSSD; yt-=fHwSSD;
+ if (TMath::Abs(yt)<fHwSSD+0.01)
+ if (TMath::Abs(zt)<fHlSSD+0.01) {
+ //if (TMath::Abs(pos[i].GetQ()-neg[j].GetQ())<dq_min) {
+ //dq_min=TMath::Abs(pos[i].GetQ()-neg[j].GetQ());
+ ybest=yt; zbest=zt;
+ qbest=0.5*(pos[i].GetQ()+neg[j].GetQ());
+
+ lab[0]=pos[i].GetLabel(0);
+ lab[1]=pos[i].GetLabel(1);
+ lab[2]=neg[i].GetLabel(0);
+ lab[3]=(((i<<10) + j)<<10) + idet; // pos|neg|det
+ Float_t lp[5];
+ lp[0]=-ybest-fYshift[fI];
+ lp[1]= zbest+fZshift[fI];
+ lp[2]=0.0025*0.0025; //SigmaY2
+ lp[3]=0.110*0.110; //SigmaZ2
+ if (pos[i].GetNd()+neg[j].GetNd() > 4) {
+ lp[2]*=9;
+ lp[3]*=9;
+ }
+ lp[4]=qbest; //Q
+
+ //CheckLabels(lab);
+ new (cl[ncl]) AliITSclusterV2(lab,lp); ncl++;
+ }
+ }
+ /*
+ if (ybest<100) {
+ lab[3]=idet;
+ Float_t lp[5];
+ lp[0]=-ybest-fYshift[fI];
+ lp[1]= zbest+fZshift[fI];
+ lp[2]=0.002*0.002; //SigmaY2
+ lp[3]=0.080*0.080; //SigmaZ2
+ lp[4]=qbest; //Q
+ //
+ new (cl[ncl]) AliITSclusterV2(lab,lp); ncl++;
+ }
+ */
+ }
+}
+