]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSClusterFinderV2SSD.cxx
New macros to display the SDD calibration parameters from OCDB files (F. Prino)
[u/mrichter/AliRoot.git] / ITS / AliITSClusterFinderV2SSD.cxx
index 484106a160bafe969c7b295b14fd2ca6a5bf5398..d0f3bd2d44264b15c0cc77e80e46f38aef625abe 100644 (file)
@@ -20,6 +20,7 @@
 //                                                                        //
 //          Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch            //
 //          Revised: Enrico Fragiacomo, enrico.fragiacomo@ts.infn.it      //
+//          Revised 23/06/08: Marco Bregant
 //                                                                        //
 ///////////////////////////////////////////////////////////////////////////
 
@@ -49,7 +50,8 @@ fYpitchSSD(0.0095),
 fHwSSD(3.65),
 fHlSSD(2.00),
 fTanP(0.0275),
-fTanN(0.0075){
+fTanN(0.0075)
+{
 
   //Default constructor
 
@@ -64,7 +66,6 @@ fTanP(cf.fTanP),
 fTanN(cf.fTanN)
 {
   // Copy constructor
-
 }
 
 //______________________________________________________________________
@@ -91,6 +92,8 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(TClonesArray *alldigits) {
   //------------------------------------------------------------
 
   static AliITSRecoParam *repa = NULL;
+  
+  
   if(!repa){
     repa = (AliITSRecoParam*) AliITSReconstructor::GetRecoParam();
     if(!repa){
@@ -241,12 +244,7 @@ void AliITSClusterFinderV2SSD::RawdataToClusters(AliRawReader* rawReader,TClones
   // This function creates ITS clusters from raw data
   //------------------------------------------------------------
   rawReader->Reset();
-  /*
-  const UInt_t *evid; evid = rawReader->GetEventId();
-  cout<<"Event="<<evid[0]<<endl;
-  */
   AliITSRawStreamSSD inputSSD(rawReader);
-  //  rawReader->SelectEquipment(-1,0,15);
   FindClustersSSD(&inputSSD,clusters);
   
 }
@@ -314,8 +312,7 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input,
       Int_t strip = input->GetStrip();
       if(input->GetSideFlag()) strip=1535-strip;
       Int_t signal = input->GetSignal();
-      //cout<<ddl<<" "<<ad<<" "<<adc<<" "<<strip<<" "<<signal<<endl;
-      
+
       if((ddl==iddl)&&(ad==iad)) {n++; matrix[adc][strip] = signal;}
       else {oddl=iddl; oad=iad; oadc = adc; ostrip = strip; osignal=signal; iddl=ddl; iad=ad; break;}
       
@@ -327,7 +324,7 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input,
     if(!next && oddl<0) break;
     
     if(n==0) continue; // first occurence
-    n=0; osignal=0;
+    n=0; //osignal=0;
     
     // fill 1Dclusters
     for(Int_t iadc=0; iadc<12; iadc++) {  // loop over ADC index for ddl=oddl and ad=oad
@@ -335,7 +332,6 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input,
       Int_t iimod = (oad - 1)  * 12 + iadc;
       Int_t iModule = AliITSRawStreamSSD::GetModuleNumber(oddl,iimod);
       if(iModule==-1) continue;
-      //      cout<<"ddl="<<oddl<<" ad"<<oad<<" module="<<iModule<<endl;
       cal = (AliITSCalibrationSSD*)GetResp(iModule);
       
       Bool_t first = 0;
@@ -368,8 +364,7 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input,
        noise = cal->GetNoiseP(istrip); if(noise<1.) signal = 65535;
        if(signal<3*noise) signal = 65535; // in case ZS was not done in hw do it now
 
-       //if(cal->IsPChannelBad(istrip)) cout<<iModule<<" "<<istrip<<endl;
-        if(cal->IsPChannelBad(istrip)) signal=0;
+       //        if(cal->IsPChannelBad(istrip)) signal=0;
 
        if (signal!=65535) {
          gain = cal->GetGainP(istrip);
@@ -399,14 +394,16 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input,
              
              //Split suspiciously big cluster
              if (nDigits > 4&&nDigits < 25) {
-               cluster.SetY(y/q - 0.25*nDigits);
+               if(q!=0) cluster.SetY(y/q - 0.25*nDigits);
+               else cluster.SetY(istrip-1 - 0.25*nDigits);
                cluster.SetQ(0.5*q);
                if (nClusters[0] == kMax) {
                  Error("FindClustersSSD", "Too many 1D clusters !");
                  return;
                }
                Ali1Dcluster& cluster2 = clusters1D[0][nClusters[0]++];
-               cluster2.SetY(y/q + 0.25*nDigits);
+               if(q!=0) cluster2.SetY(y/q + 0.25*nDigits);
+               else cluster2.SetY(istrip-1 + 0.25*nDigits);
                cluster2.SetQ(0.5*q);
                cluster2.SetNd(nDigits);
                cluster2.SetLabels(lab);
@@ -439,14 +436,16 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input,
            
            //Split suspiciously big cluster
            if (nDigits > 4&&nDigits < 25) {
-             cluster.SetY(y/q - 0.25*nDigits);
+             if(q!=0) cluster.SetY(y/q - 0.25*nDigits);
+             else cluster.SetY(istrip-1 - 0.25*nDigits);
              cluster.SetQ(0.5*q);
              if (nClusters[0] == kMax) {
                Error("FindClustersSSD", "Too many 1D clusters !");
                return;
              }
              Ali1Dcluster& cluster2 = clusters1D[0][nClusters[0]++];
-             cluster2.SetY(y/q + 0.25*nDigits);
+             if(q!=0) cluster2.SetY(y/q + 0.25*nDigits);
+             else cluster2.SetY(istrip-1 + 0.25*nDigits);
              cluster2.SetQ(0.5*q);
              cluster2.SetNd(nDigits);
              cluster2.SetLabels(lab);
@@ -479,22 +478,19 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input,
       oldnoise = 0.;
       noise = 0.;
       Int_t strip=0;
-      for(Int_t istrip=768; istrip<1536; istrip++) { // N-side
+      for(Int_t iistrip=768; iistrip<1536; iistrip++) { // N-side
        
-       Int_t signal = TMath::Abs(matrix[iadc][istrip]);
-       //cout<<"####"<<" "<<oddl<<" "<<oad<<" "<<iadc<<" "<<istrip<<" "<<signal<<endl;      
-       strip = 1535-istrip;
+       Int_t signal = TMath::Abs(matrix[iadc][iistrip]);
+       strip = 1535-iistrip;
 
        oldnoise = noise;
        noise = cal->GetNoiseN(strip); if(noise<1.) signal=65535;
 
-        if(cal->IsNChannelBad(strip)) signal=0;
+       //        if(cal->IsNChannelBad(strip)) signal=0;
 
        if(signal<3*noise) signal = 65535; // in case ZS was not done in hw do it now
 
        if (signal!=65535) {
-         //      cout<<"ddl="<<oddl<<" ad"<<oad<<" module="<<iModule<<" strip= "<<istrip<<
-         //  " sig="<<signal<<" "<<cal->GetPedestalN(strip)<<endl;
          gain = cal->GetGainN(strip);
          signal = (Int_t) ( signal * gain); // signal is corrected for gain
          signal = (Int_t) cal->ADCToKeV( signal ); // signal is  converted in KeV 
@@ -562,14 +558,16 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input,
            
            //Split suspiciously big cluster
            if (nDigits > 4&&nDigits < 25) {
-             cluster.SetY(y/q - 0.25*nDigits);
+             if(q!=0) cluster.SetY(y/q - 0.25*nDigits);
+             else cluster.SetY(strip+1 - 0.25*nDigits);
              cluster.SetQ(0.5*q);
              if (nClusters[1] == kMax) {
                Error("FindClustersSSD", "Too many 1D clusters !");
                return;
              }
              Ali1Dcluster& cluster2 = clusters1D[1][nClusters[1]++];
-             cluster2.SetY(y/q + 0.25*nDigits);
+             if(q!=0) cluster2.SetY(y/q + 0.25*nDigits);
+             else cluster2.SetY(strip+1 + 0.25*nDigits);
              cluster2.SetQ(0.5*q);
              cluster2.SetNd(nDigits);
              cluster2.SetLabels(lab);
@@ -589,8 +587,8 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input,
        fModule = iModule;
        FindClustersSSD(&clusters1D[0][0], nClusters[0], 
                        &clusters1D[1][0], nClusters[1], clusters[iModule]);
-       Int_t nClusters = clusters[iModule]->GetEntriesFast();
-       nClustersSSD += nClusters;
+       Int_t nClustersn = clusters[iModule]->GetEntriesFast();
+       nClustersSSD += nClustersn;
       }
 
       nClusters[0] = nClusters[1] = 0;
@@ -613,16 +611,21 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
   // Actual SSD cluster finder
   //------------------------------------------------------------
 
-  //  Float_t xyz[3];
-
   const TGeoHMatrix *mT2L=AliITSgeomTGeo::GetTracking2LocalMatrix(fModule);
 
   TClonesArray &cl=*clusters;
   //
-  Float_t tanp=fTanP, tann=fTanN;
-  if (fModule>fLastSSD1) {tann=fTanP; tanp=fTanN;}
+  //  Float_t tanp=fTanP, tann=fTanN;
+  const Float_t kStartXzero=3.64325;
+  const Float_t kDeltaXzero5or6=0.02239;
+  const Float_t kDeltaZ5to6=7.6/7.0;
+  
+  Int_t is6=-1;
+  
+  if (fModule>fLastSSD1) is6=1;
   Int_t idet=fNdet[fModule];
   Int_t ncl=0;
+
   //
   Int_t negativepair[30000];
   Int_t cnegative[3000];  
@@ -635,6 +638,7 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
   for (Int_t i=0;i<30000;i++) {negativepair[i]=0; positivepair[i]=0;}
 
   if ((np*nn) > fgPairsSize) {
+
     if (fgPairs) delete [] fgPairs;
     fgPairsSize = 4*np*nn;
     fgPairs = new Short_t[fgPairsSize];
@@ -645,14 +649,15 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
   // find available pairs
   //
   for (Int_t i=0; i<np; i++) {
-    Float_t yp=pos[i].GetY()*fYpitchSSD
+    Float_t yp=pos[i].GetY(); 
     if ( (pos[i].GetQ()>0) && (pos[i].GetQ()<3) ) continue;
     for (Int_t j=0; j<nn; j++) {
       if ( (neg[j].GetQ()>0) && (neg[j].GetQ()<3) ) 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;
+      Float_t yn=neg[j].GetY();
+
+      Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+      Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
+      
       if (TMath::Abs(yt)<fHwSSD+0.01)
       if (TMath::Abs(zt)<fHlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) {
        negativepair[i*10+cnegative[i]] =j;  //index
@@ -668,16 +673,17 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
   // try to recover points out of but close to the module boundaries 
   //
   for (Int_t i=0; i<np; i++) {
-    Float_t yp=pos[i].GetY()*fYpitchSSD
+    Float_t yp=pos[i].GetY(); 
     if ( (pos[i].GetQ()>0) && (pos[i].GetQ()<3) ) continue;
     for (Int_t j=0; j<nn; j++) {
       if ( (neg[j].GetQ()>0) && (neg[j].GetQ()<3) ) continue;
       // if both 1Dclusters have an other cross continue
       if (cpositive[j]&&cnegative[i]) 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;
+     Float_t yn=neg[j].GetY();
+      
+      Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+      Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
+      
       if (TMath::Abs(yt)<fHwSSD+0.1)
       if (TMath::Abs(zt)<fHlSSD+0.15) {
        // tag 1Dcluster (eventually will produce low quality recpoint)
@@ -718,7 +724,7 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
       //
       // select gold clusters
       if ( (cnegative[ip]==1) && cpositive[negativepair[10*ip]]==1){ 
-       Float_t yp=pos[ip].GetY()*fYpitchSSD
+       Float_t yp=pos[ip].GetY(); 
        Int_t j = negativepair[10*ip];      
 
        if( (pos[ip].GetQ()==0) && (neg[j].GetQ() ==0) ) { 
@@ -732,19 +738,20 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ());
 
        // charge matching (note that if posQ or negQ is 0 -> ratio=1 and the following condition is met
-       if (TMath::Abs(ratio)>0.33) continue; // note: 0.33=3xsigma_ratio calculated in cosmics tests
+       if (TMath::Abs(ratio)>0.2) continue; // note: 0.2=3xsigma_ratio calculated in cosmics tests
 
        //
-       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;
+             Float_t yn=neg[j].GetY();
+      
+      Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+      Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
+      
        ybest=yt; zbest=zt; 
+
+       
        qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
        if( (pos[ip].GetQ()==0)||(neg[ip].GetQ()==0)) qbest*=2; // in case of bad strips on one side keep all charge from the other one
        
-       //cout<<yt<<" "<<zt<<" "<<qbest<<endl;
-       
        {
          Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
          mT2L->MasterToLocal(loc,trk);
@@ -823,20 +830,21 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        if (ip2==ip) ip2 =  positivepair[10*in+1];
        Float_t pcharge = pos[ip].GetQ()+pos[ip2].GetQ();
        
-       if ( (TMath::Abs(pcharge-neg[in].GetQ())<10) && (pcharge!=0) ) { // 
+       if ( (TMath::Abs(pcharge-neg[in].GetQ())<30) && (pcharge!=0) ) { // 
          
          //
          // add first pair
          if ( (fgPairs[ip*nn+in]==100)&&(pos[ip].GetQ() ) ) {  //
            
-           Float_t yp=pos[ip].GetY()*fYpitchSSD
-           Float_t yn=neg[in].GetY()*fYpitchSSD;
-           Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
-           Float_t yt=yn + tann*zt;
-           zt-=fHlSSD; yt-=fHwSSD;
+           Float_t yp=pos[ip].GetY(); 
+            Float_t yn=neg[in].GetY();
+      
+      Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+      Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
            ybest =yt;  zbest=zt; 
+
+
            qbest =pos[ip].GetQ();
-           
            Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
            mT2L->MasterToLocal(loc,trk);
            lp[0]=trk[1];
@@ -861,9 +869,6 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
            if(clusters){
              
              cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
-             
-             //        cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl;
-             
              cl2->SetChargeRatio(ratio);       
              cl2->SetType(5);
              fgPairs[ip*nn+in] = 5;
@@ -881,7 +886,6 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
                cl2->SetType(6);
                fgPairs[ip*nn+in] = 6;
              }
-             //cout<<"AliITSClusterFinderV2SSD "<<fModule<<" silver1"<<endl;
              
              fDetTypeRec->AddRecPoint(*cl2);
            }
@@ -895,12 +899,13 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
          //    if (!(cused1[ip2] || cused2[in])){  //
          if ( (fgPairs[ip2*nn+in]==100) && (pos[ip2].GetQ()) ) {
            
-           Float_t yp=pos[ip2].GetY()*fYpitchSSD;
-           Float_t yn=neg[in].GetY()*fYpitchSSD;
-           Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
-           Float_t yt=yn + tann*zt;
-           zt-=fHlSSD; yt-=fHwSSD;
+           Float_t yp=pos[ip2].GetY();
+            Float_t yn=neg[in].GetY();
+      
+      Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+      Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
            ybest =yt;  zbest=zt; 
+
            qbest =pos[ip2].GetQ();
            
            Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
@@ -927,8 +932,6 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
            if(clusters){
              cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
              
-             //        cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl;
-             
              cl2->SetChargeRatio(ratio);       
              cl2->SetType(5);
              fgPairs[ip2*nn+in] =5;
@@ -947,7 +950,6 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
                fgPairs[ip2*nn+in] =6;
              }
              
-             //         cout<<"AliITSClusterFinderV2SSD "<<fModule<<" silver2"<<endl;
              fDetTypeRec->AddRecPoint(*cl2);
            }
            ncl++;
@@ -976,7 +978,7 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        Float_t pcharge = neg[jn].GetQ()+neg[jn2].GetQ();
        //
        
-       if ( (TMath::Abs(pcharge-pos[ip].GetQ())<10) &&  // charge matching 
+       if ( (TMath::Abs(pcharge-pos[ip].GetQ())<30) &&  // charge matching 
             (pcharge!=0) ) { // reject combinations of bad strips
          
          //
@@ -984,13 +986,17 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
          //    if (!(cused1[ip]||cused2[jn])){
          if ( (fgPairs[ip*nn+jn]==100) && (neg[jn].GetQ()) ) {  //
            
-           Float_t yn=neg[jn].GetY()*fYpitchSSD; 
-           Float_t yp=pos[ip].GetY()*fYpitchSSD;
-           Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
-           Float_t yt=yn + tann*zt;
-           zt-=fHlSSD; yt-=fHwSSD;
+           Float_t yn=neg[jn].GetY(); 
+            Float_t yp=pos[ip].GetY();
+      
+      Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+      Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
+      
            ybest =yt;  zbest=zt; 
+
+
            qbest =neg[jn].GetQ();
+
            {
              Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
              mT2L->MasterToLocal(loc,trk);
@@ -1016,8 +1022,6 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
          if(clusters){
            cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
 
-           //  cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl;
-
            cl2->SetChargeRatio(ratio);         
            cl2->SetType(7);
            fgPairs[ip*nn+jn] =7;
@@ -1036,7 +1040,6 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
              cl2->SetType(8);
              fgPairs[ip*nn+jn]=8;
            }
-           //cout<<"AliITSClusterFinderV2SSD "<<fModule<<" silverN1"<<endl;
 
            fDetTypeRec->AddRecPoint(*cl2);
          }
@@ -1047,13 +1050,16 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        //      if (!(cused1[ip]||cused2[jn2])){
        if ( (fgPairs[ip*nn+jn2]==100)&&(neg[jn2].GetQ() ) ) {  //
 
-         Float_t yn=neg[jn2].GetY()*fYpitchSSD
-         Double_t yp=pos[ip].GetY()*fYpitchSSD
-         Double_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
-         Double_t yt=yn + tann*zt;
-         zt-=fHlSSD; yt-=fHwSSD;
+         Float_t yn=neg[jn2].GetY(); 
+         Double_t yp=pos[ip].GetY(); 
+         Double_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+         Double_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
+         
          ybest =yt;  zbest=zt; 
+
+
          qbest =neg[jn2].GetQ();
+
           {
           Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
           mT2L->MasterToLocal(loc,trk);
@@ -1078,7 +1084,6 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
          if(clusters){
            cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
 
-           //  cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl;
 
            cl2->SetChargeRatio(ratio);         
            fgPairs[ip*nn+jn2]=7;
@@ -1098,7 +1103,6 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
              cl2->SetType(8);
              fgPairs[ip*nn+jn2]=8;
            }
-           //cout<<"AliITSClusterFinderV2SSD "<<fModule<<" silverN2"<<endl;
 
            fDetTypeRec->AddRecPoint(*cl2);
          }
@@ -1164,13 +1168,15 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        //
        
        //almost gold clusters
-       Float_t yp=pos[ip].GetY()*fYpitchSSD; 
-       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;
+       Float_t yp=pos[ip].GetY(); 
+       Float_t yn=neg[j].GetY();
+      
+      Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+      Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
+      
        ybest=yt; zbest=zt; 
        qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
+
        {
          Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
          mT2L->MasterToLocal(loc,trk);
@@ -1187,15 +1193,14 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        }
        //
        CheckLabels2(milab);
+        if ((neg[j].GetQ()==0)&&(pos[ip].GetQ()==0)) continue; // reject crosses of bad strips!!
        ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ());
        milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
        Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
        AliITSRecPoint * cl2;
        if(clusters){
          cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
-         
-         //    cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl;
-         
+                 
          cl2->SetChargeRatio(ratio);           
          cl2->SetType(10);
          fgPairs[ip*nn+j]=10;
@@ -1218,8 +1223,6 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
          cused1[ip]++;
          cused2[j]++;      
          
-         //cout<<"AliITSClusterFinderV2SSD "<<fModule<<" 2x2"<<endl;
-         
          fDetTypeRec->AddRecPoint(*cl2);
        }      
        ncl++;
@@ -1235,7 +1238,7 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
   //  
   for (Int_t i=0; i<np; i++) {
     Float_t ybest=1000,zbest=1000,qbest=0;
-    Float_t yp=pos[i].GetY()*fYpitchSSD
+    Float_t yp=pos[i].GetY(); 
     if ((pos[i].GetQ()>0)&&(pos[i].GetQ()<3)) continue;
     for (Int_t j=0; j<nn; j++) {
     //    for (Int_t di = 0;di<cpositive[i];di++){
@@ -1247,14 +1250,16 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
       if (cused2[j]||cused1[i]) continue;      
       if (fgPairs[i*nn+j]>0 &&fgPairs[i*nn+j]<100) continue;
       ratio = (pos[i].GetQ()-neg[j].GetQ())/(pos[i].GetQ()+neg[j].GetQ());      
-      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;
+      Float_t yn=neg[j].GetY();
+      
+      Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+      Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
+      
       if (TMath::Abs(yt)<fHwSSD+0.01)
       if (TMath::Abs(zt)<fHlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) {
         ybest=yt; zbest=zt; 
         qbest=0.5*(pos[i].GetQ()+neg[j].GetQ());
+
         {
         Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
         mT2L->MasterToLocal(loc,trk);
@@ -1301,5 +1306,3 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
   }
 
 }
-
-