]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSClusterFinderV2SSD.cxx
Add precision to covariance matrix elements (E. Fragiacomo)
[u/mrichter/AliRoot.git] / ITS / AliITSClusterFinderV2SSD.cxx
index 057582daa538a433b03b26df73d05b5042224876..3e46291731ad4b1e7bec1676309c3f2240b28f3b 100644 (file)
@@ -744,6 +744,18 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
 
   const TGeoHMatrix *mT2L=AliITSgeomTGeo::GetTracking2LocalMatrix(fModule);
 
+  //---------------------------------------
+  // load recoparam
+  // 
+  static AliITSRecoParam *repa = NULL;  
+  if(!repa){
+    repa = (AliITSRecoParam*) AliITSReconstructor::GetRecoParam();
+    if(!repa){
+      repa = AliITSRecoParam::GetHighFluxParam();
+      AliWarning("Using default AliITSRecoParam class");
+    }
+  }
+
   TClonesArray &cl=*clusters;
   
   AliITSsegmentationSSD *seg = dynamic_cast<AliITSsegmentationSSD*>(fDetTypeRec->GetSegmentationModel(2));
@@ -792,18 +804,24 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
       seg->GetPadCxz(yn, yp, xt, zt);
       //cout<<yn<<" "<<yp<<" "<<xt<<" "<<zt<<endl;
       
-      if (TMath::Abs(xt)<hwSSD+0.01)
-      if (TMath::Abs(zt)<hlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) {
-       negativepair[i*10+cnegative[i]] =j;  //index
-       positivepair[j*10+cpositive[j]] =i;
-       cnegative[i]++;  //counters
-       cpositive[j]++; 
-       fgPairs[i*nn+j]=100;
+      if (TMath::Abs(xt)<hwSSD)
+      if (TMath::Abs(zt)<hlSSD) {
+       Int_t in = i*10+cnegative[i];
+       Int_t ip = j*10+cpositive[j];
+       if ((in < 10*np) && (ip < 10*nn)) {
+         negativepair[in] =j;  //index
+         positivepair[ip] =i;
+         cnegative[i]++;  //counters
+         cpositive[j]++;       
+         fgPairs[i*nn+j]=100;
+       }
+       else
+         AliError(Form("Index out of range: ip=%d, in=%d",ip,in));
       }
     }
   }
 
-  //
+  /* //
   // try to recover points out of but close to the module boundaries 
   //
   for (Int_t i=0; i<np; i++) {
@@ -823,14 +841,21 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        // tag 1Dcluster (eventually will produce low quality recpoint)
        if (cnegative[i]==0) pos[i].SetNd(100);  // not available pair
        if (cpositive[j]==0) neg[j].SetNd(100);  // not available pair
-       negativepair[i*10+cnegative[i]] =j;  //index
-       positivepair[j*10+cpositive[j]] =i;
-       cnegative[i]++;  //counters
-       cpositive[j]++; 
-       fgPairs[i*nn+j]=100;
+       Int_t in = i*10+cnegative[i];
+       Int_t ip = j*10+cpositive[j];
+       if ((in < 10*np) && (ip < 10*nn)) {
+         negativepair[in] =j;  //index
+         positivepair[ip] =i;
+         cnegative[i]++;  //counters
+         cpositive[j]++;       
+         fgPairs[i*nn+j]=100;
+       }
+       else
+         AliError(Form("Index out of range: ip=%d, in=%d",ip,in));
       }
     }
   }
+  */
 
   //
   Float_t lp[6];
@@ -838,15 +863,6 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
   Double_t ratio;
   
 
-  static AliITSRecoParam *repa = NULL;
-  if(!repa){
-    repa = (AliITSRecoParam*) AliITSReconstructor::GetRecoParam();
-    if(!repa){
-      repa = AliITSRecoParam::GetHighFluxParam();
-      AliWarning("Using default AliITSRecoParam class");
-    }
-  }
-
   if(repa->GetUseChargeMatchingInClusterFinderSSD()==kTRUE) {
 
 
@@ -904,19 +920,26 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
        Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
 
-       lp[2]=0.0022*0.0022;  //SigmaY2
-       lp[3]=0.110*0.110;  //SigmaZ2
+       lp[2]=4.968e-06;     // 0.00223*0.00223;  //SigmaY2
+       lp[3]=0.012;         // 0.110*0.110;  //SigmaZ2
        // out-of-diagonal element of covariance matrix
        if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
        else if ( (info[0]>1) && (info[1]>1) ) { 
-         lp[2]=0.0016*0.0016;  //SigmaY2
-         lp[3]=0.08*0.08;  //SigmaZ2
-         lp[5]=-0.00006;
+         lp[2]=2.63e-06;    // 0.0016*0.0016;  //SigmaY2
+         lp[3]=0.0065;      // 0.08*0.08;   //SigmaZ2
+         lp[5]=-6.48e-05;
        }
        else {
-         lp[3]=0.0093*0.0093;
-         if (info[0]==1) { lp[5]=-0.00014;}
-         else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
+         lp[2]=4.80e-06;      // 0.00219*0.00219
+         lp[3]=0.0093;        // 0.0964*0.0964;
+         if (info[0]==1) {
+           lp[5]=-0.00014;
+         }
+         else { 
+           lp[2]=2.79e-06;    // 0.0017*0.0017; 
+           lp[3]=0.00935;     // 0.967*0.967;
+           lp[5]=-4.32e-05;
+         }
        }
 
        AliITSRecPoint * cl2;
@@ -1014,22 +1037,29 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
            milab[3]=(((ip<<10) + in)<<10) + idet; // pos|neg|det
            Int_t info[3] = {pos[ip].GetNd(),neg[in].GetNd(),fNlayer[fModule]};
            
-       lp[2]=0.0022*0.0022;  //SigmaY2
-       lp[3]=0.110*0.110;  //SigmaZ2
+       lp[2]=4.968e-06;     // 0.00223*0.00223;  //SigmaY2
+       lp[3]=0.012;         // 0.110*0.110;  //SigmaZ2
        // out-of-diagonal element of covariance matrix
        if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
        else if ( (info[0]>1) && (info[1]>1) ) { 
-         lp[2]=0.0016*0.0016;  //SigmaY2
-         lp[3]=0.08*0.08;  //SigmaZ2
-         lp[5]=-0.00006;
+         lp[2]=2.63e-06;    // 0.0016*0.0016;  //SigmaY2
+         lp[3]=0.0065;      // 0.08*0.08;   //SigmaZ2
+         lp[5]=-6.48e-05;
        }
        else {
-         lp[3]=0.0093*0.0093;
-         if (info[0]==1) { lp[5]=-0.00014;}
-         else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
+         lp[2]=4.80e-06;      // 0.00219*0.00219
+         lp[3]=0.0093;        // 0.0964*0.0964;
+         if (info[0]==1) {
+           lp[5]=-0.00014;
+         }
+         else { 
+           lp[2]=2.79e-06;    // 0.0017*0.0017; 
+           lp[3]=0.00935;     // 0.967*0.967;
+           lp[5]=-4.32e-05;
+         }
        }
 
-           AliITSRecPoint * cl2;
+       AliITSRecPoint * cl2;
            if(clusters){
              
              cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
@@ -1090,19 +1120,26 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
            milab[3]=(((ip2<<10) + in)<<10) + idet; // pos|neg|det
            Int_t info[3] = {pos[ip2].GetNd(),neg[in].GetNd(),fNlayer[fModule]};
            
-       lp[2]=0.0022*0.0022;  //SigmaY2
-       lp[3]=0.110*0.110;  //SigmaZ2
+       lp[2]=4.968e-06;     // 0.00223*0.00223;  //SigmaY2
+       lp[3]=0.012;         // 0.110*0.110;  //SigmaZ2
        // out-of-diagonal element of covariance matrix
        if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
        else if ( (info[0]>1) && (info[1]>1) ) { 
-         lp[2]=0.0016*0.0016;  //SigmaY2
-         lp[3]=0.08*0.08;  //SigmaZ2
-         lp[5]=-0.00006;
+         lp[2]=2.63e-06;    // 0.0016*0.0016;  //SigmaY2
+         lp[3]=0.0065;      // 0.08*0.08;   //SigmaZ2
+         lp[5]=-6.48e-05;
        }
        else {
-         lp[3]=0.0093*0.0093;
-         if (info[0]==1) { lp[5]=-0.00014;}
-         else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
+         lp[2]=4.80e-06;      // 0.00219*0.00219
+         lp[3]=0.0093;        // 0.0964*0.0964;
+         if (info[0]==1) {
+           lp[5]=-0.00014;
+         }
+         else { 
+           lp[2]=2.79e-06;    // 0.0017*0.0017; 
+           lp[3]=0.00935;     // 0.967*0.967;
+           lp[5]=-4.32e-05;
+         }
        }
 
            AliITSRecPoint * cl2;
@@ -1199,19 +1236,26 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
          milab[3]=(((ip<<10) + jn)<<10) + idet; // pos|neg|det
          Int_t info[3] = {pos[ip].GetNd(),neg[jn].GetNd(),fNlayer[fModule]};
 
-       lp[2]=0.0022*0.0022;  //SigmaY2
-       lp[3]=0.110*0.110;  //SigmaZ2
+       lp[2]=4.968e-06;     // 0.00223*0.00223;  //SigmaY2
+       lp[3]=0.012;         // 0.110*0.110;  //SigmaZ2
        // out-of-diagonal element of covariance matrix
        if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
        else if ( (info[0]>1) && (info[1]>1) ) { 
-         lp[2]=0.0016*0.0016;  //SigmaY2
-         lp[3]=0.08*0.08;  //SigmaZ2
-         lp[5]=-0.00006;
+         lp[2]=2.63e-06;    // 0.0016*0.0016;  //SigmaY2
+         lp[3]=0.0065;      // 0.08*0.08;   //SigmaZ2
+         lp[5]=-6.48e-05;
        }
        else {
-         lp[3]=0.0093*0.0093;
-         if (info[0]==1) { lp[5]=-0.00014;}
-         else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
+         lp[2]=4.80e-06;      // 0.00219*0.00219
+         lp[3]=0.0093;        // 0.0964*0.0964;
+         if (info[0]==1) {
+           lp[5]=-0.00014;
+         }
+         else { 
+           lp[2]=2.79e-06;    // 0.0017*0.0017; 
+           lp[3]=0.00935;     // 0.967*0.967;
+           lp[5]=-4.32e-05;
+         }
        }
 
          AliITSRecPoint * cl2;
@@ -1275,19 +1319,26 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
          milab[3]=(((ip<<10) + jn2)<<10) + idet; // pos|neg|det
          Int_t info[3] = {pos[ip].GetNd(),neg[jn2].GetNd(),fNlayer[fModule]};
 
-       lp[2]=0.0022*0.0022;  //SigmaY2
-       lp[3]=0.110*0.110;  //SigmaZ2
+       lp[2]=4.968e-06;     // 0.00223*0.00223;  //SigmaY2
+       lp[3]=0.012;         // 0.110*0.110;  //SigmaZ2
        // out-of-diagonal element of covariance matrix
        if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
        else if ( (info[0]>1) && (info[1]>1) ) { 
-         lp[2]=0.0016*0.0016;  //SigmaY2
-         lp[3]=0.08*0.08;  //SigmaZ2
-         lp[5]=-0.00006;
+         lp[2]=2.63e-06;    // 0.0016*0.0016;  //SigmaY2
+         lp[3]=0.0065;      // 0.08*0.08;   //SigmaZ2
+         lp[5]=-6.48e-05;
        }
        else {
-         lp[3]=0.0093*0.0093;
-         if (info[0]==1) { lp[5]=-0.00014;}
-         else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
+         lp[2]=4.80e-06;      // 0.00219*0.00219
+         lp[3]=0.0093;        // 0.0964*0.0964;
+         if (info[0]==1) {
+           lp[5]=-0.00014;
+         }
+         else { 
+           lp[2]=2.79e-06;    // 0.0017*0.0017; 
+           lp[3]=0.00935;     // 0.967*0.967;
+           lp[5]=-4.32e-05;
+         }
        }
 
          AliITSRecPoint * cl2;
@@ -1415,19 +1466,26 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
        Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
 
-       lp[2]=0.0022*0.0022;  //SigmaY2
-       lp[3]=0.110*0.110;  //SigmaZ2
+       lp[2]=4.968e-06;     // 0.00223*0.00223;  //SigmaY2
+       lp[3]=0.012;         // 0.110*0.110;  //SigmaZ2
        // out-of-diagonal element of covariance matrix
        if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
        else if ( (info[0]>1) && (info[1]>1) ) { 
-         lp[2]=0.0016*0.0016;  //SigmaY2
-         lp[3]=0.08*0.08;  //SigmaZ2
-         lp[5]=-0.00006;
+         lp[2]=2.63e-06;    // 0.0016*0.0016;  //SigmaY2
+         lp[3]=0.0065;      // 0.08*0.08;   //SigmaZ2
+         lp[5]=-6.48e-05;
        }
        else {
-         lp[3]=0.0093*0.0093;
-         if (info[0]==1) { lp[5]=-0.00014;}
-         else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
+         lp[2]=4.80e-06;      // 0.00219*0.00219
+         lp[3]=0.0093;        // 0.0964*0.0964;
+         if (info[0]==1) {
+           lp[5]=-0.00014;
+         }
+         else { 
+           lp[2]=2.79e-06;    // 0.0017*0.0017; 
+           lp[3]=0.00935;     // 0.967*0.967;
+           lp[5]=-4.32e-05;
+         }
        }
 
        AliITSRecPoint * cl2;
@@ -1547,19 +1605,26 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
        Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
 
-       lp[2]=0.0022*0.0022;  //SigmaY2
-       lp[3]=0.110*0.110;  //SigmaZ2
+       lp[2]=4.968e-06;     // 0.00223*0.00223;  //SigmaY2
+       lp[3]=0.012;         // 0.110*0.110;  //SigmaZ2
        // out-of-diagonal element of covariance matrix
        if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
        else if ( (info[0]>1) && (info[1]>1) ) { 
-         lp[2]=0.0016*0.0016;  //SigmaY2
-         lp[3]=0.08*0.08;  //SigmaZ2
-         lp[5]=-0.00006;
+         lp[2]=2.63e-06;    // 0.0016*0.0016;  //SigmaY2
+         lp[3]=0.0065;      // 0.08*0.08;   //SigmaZ2
+         lp[5]=-6.48e-05;
        }
        else {
-         lp[3]=0.0093*0.0093;
-         if (info[0]==1) { lp[5]=-0.00014;}
-         else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
+         lp[2]=4.80e-06;      // 0.00219*0.00219
+         lp[3]=0.0093;        // 0.0964*0.0964;
+         if (info[0]==1) {
+           lp[5]=-0.00014;
+         }
+         else { 
+           lp[2]=2.79e-06;    // 0.0017*0.0017; 
+           lp[3]=0.00935;     // 0.967*0.967;
+           lp[5]=-4.32e-05;
+         }
        }
 
        AliITSRecPoint * cl2;
@@ -1619,8 +1684,8 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
       Float_t xt, zt;
       seg->GetPadCxz(yn, yp, xt, zt);
       
-      if (TMath::Abs(xt)<hwSSD+0.01)
-      if (TMath::Abs(zt)<hlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) {
+      if (TMath::Abs(xt)<hwSSD)
+      if (TMath::Abs(zt)<hlSSD) {
        xbest=xt; zbest=zt; 
 
         qbest=0.5*(pos[i].GetQ()+neg[j].GetQ());
@@ -1642,19 +1707,26 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        milab[3]=(((i<<10) + j)<<10) + idet; // pos|neg|det
        Int_t info[3] = {pos[i].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
 
-       lp[2]=0.0022*0.0022;  //SigmaY2
-       lp[3]=0.110*0.110;  //SigmaZ2
+       lp[2]=4.968e-06;     // 0.00223*0.00223;  //SigmaY2
+       lp[3]=0.012;         // 0.110*0.110;  //SigmaZ2
        // out-of-diagonal element of covariance matrix
        if( (info[0]==1) && (info[1]==1) ) lp[5]=-0.00012;
        else if ( (info[0]>1) && (info[1]>1) ) { 
-         lp[2]=0.0016*0.0016;  //SigmaY2
-         lp[3]=0.08*0.08;  //SigmaZ2
-         lp[5]=-0.00006;
+         lp[2]=2.63e-06;    // 0.0016*0.0016;  //SigmaY2
+         lp[3]=0.0065;      // 0.08*0.08;   //SigmaZ2
+         lp[5]=-6.48e-05;
        }
        else {
-         lp[3]=0.0093*0.0093;
-         if (info[0]==1) { lp[5]=-0.00014;}
-         else { lp[2]=0.0017*0.0017; lp[5]=-0.00004;}
+         lp[2]=4.80e-06;      // 0.00219*0.00219
+         lp[3]=0.0093;        // 0.0964*0.0964;
+         if (info[0]==1) {
+           lp[5]=-0.00014;
+         }
+         else { 
+           lp[2]=2.79e-06;    // 0.0017*0.0017; 
+           lp[3]=0.00935;     // 0.967*0.967;
+           lp[5]=-4.32e-05;
+         }
        }
 
        AliITSRecPoint * cl2;
@@ -1684,233 +1756,246 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
   }
 
 
-  //---------------------------------------------------------
-  // recover crosses of good 1D clusters with bad strips on the other side
-  // Note1: at first iteration skip modules with a bad side (or almost), (would produce too many fake!) 
-  // Note2: for modules with a bad side see below 
-  
-  AliITSCalibrationSSD* cal = (AliITSCalibrationSSD*)GetResp(fModule);
-  Int_t countPbad=0, countNbad=0;
-  for(Int_t ib=0; ib<768; ib++) {
-    if(cal->IsPChannelBad(ib)) countPbad++;
-    if(cal->IsNChannelBad(ib)) countNbad++;
-  }
-  //  AliInfo(Form("module %d has %d P- and %d N-bad strips",fModule,countPbad,countNbad));
 
-  if( (countPbad<100) && (countNbad<100) ) { // no bad side!!
+  if(repa->GetUseBadChannelsInClusterFinderSSD()==kTRUE) {
+    
+    //---------------------------------------------------------
+    // recover crosses of good 1D clusters with bad strips on the other side
+    // Note1: at first iteration skip modules with a bad side (or almost), (would produce too many fake!) 
+    // Note2: for modules with a bad side see below 
+    
+    AliITSCalibrationSSD* cal = (AliITSCalibrationSSD*)GetResp(fModule);
+    Int_t countPbad=0, countNbad=0;
+    for(Int_t ib=0; ib<768; ib++) {
+      if(cal->IsPChannelBad(ib)) countPbad++;
+      if(cal->IsNChannelBad(ib)) countNbad++;
+    }
+    //  AliInfo(Form("module %d has %d P- and %d N-bad strips",fModule,countPbad,countNbad));
     
-    for (Int_t i=0; i<np; i++) { // loop over Nside 1Dclusters with no crosses
-      if(cnegative[i]) continue; // if intersecting Pside clusters continue;
+    if( (countPbad<100) && (countNbad<100) ) { // no bad side!!
       
-      //      for(Int_t ib=0; ib<768; ib++) { // loop over all Pstrips
-      for(Int_t ib=15; ib<753; ib++) { // loop over all Pstrips
+      for (Int_t i=0; i<np; i++) { // loop over Nside 1Dclusters with no crosses
+       if(cnegative[i]) continue; // if intersecting Pside clusters continue;
        
-       if(cal->IsPChannelBad(ib)) { // check if strips is bad
-         Float_t yN=pos[i].GetY();     
-         Float_t xt, zt;
-         seg->GetPadCxz(1.*ib, yN, xt, zt);    
+       //      for(Int_t ib=0; ib<768; ib++) { // loop over all Pstrips
+       for(Int_t ib=15; ib<753; ib++) { // loop over all Pstrips
          
-         //----------
-         // bad Pstrip is crossing the Nside 1Dcluster -> create recpoint
-         // 
-         if ( (TMath::Abs(xt)<hwSSD+0.01) && (TMath::Abs(zt)<hlSSD+0.01) ) {
-           Double_t loc[3]={xt,0.,zt},trk[3]={0.,0.,0.};
-           mT2L->MasterToLocal(loc,trk);
-           lp[0]=trk[1];
-           lp[1]=trk[2];        
-           lp[4]=pos[i].GetQ(); //Q
-           for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
-           for (Int_t ilab=0;ilab<3;ilab++) milab[ilab] = pos[i].GetLabel(ilab);         
-           CheckLabels2(milab);
-           milab[3]=( (i<<10) << 10 ) + idet; // pos|neg|det
-           Int_t info[3] = {pos[i].GetNd(),0,fNlayer[fModule]};
+         if(cal->IsPChannelBad(ib)) { // check if strips is bad
+           Float_t yN=pos[i].GetY();   
+           Float_t xt, zt;
+           seg->GetPadCxz(1.*ib, yN, xt, zt);  
            
-           // out-of-diagonal element of covariance matrix
-           if (info[0]==1) lp[5]=0.0065;
-           else lp[5]=0.0093;
-
-       lp[2]=0.0022*0.0022;  //SigmaY2
-       lp[3]=0.110*0.110;  //SigmaZ2
-       lp[5]=-0.00012; // out-of-diagonal element of covariance matrix
-       
-           AliITSRecPoint * cl2;
-           if(clusters){
-             cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);            
-             cl2->SetChargeRatio(1.);
+           //----------
+           // bad Pstrip is crossing the Nside 1Dcluster -> create recpoint
+           // 
+           if ( (TMath::Abs(xt)<hwSSD) && (TMath::Abs(zt)<hlSSD) ) {
+             Double_t loc[3]={xt,0.,zt},trk[3]={0.,0.,0.};
+             mT2L->MasterToLocal(loc,trk);
+             lp[0]=trk[1];
+             lp[1]=trk[2];        
+             lp[4]=pos[i].GetQ(); //Q
+             for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
+             for (Int_t ilab=0;ilab<3;ilab++) milab[ilab] = pos[i].GetLabel(ilab);       
+             CheckLabels2(milab);
+             milab[3]=( (i<<10) << 10 ) + idet; // pos|neg|det
+             Int_t info[3] = {pos[i].GetNd(),0,fNlayer[fModule]};
+             
+             lp[2]=4.968e-06;     // 0.00223*0.00223;  //SigmaY2
+             lp[3]=0.012;         // 0.110*0.110;  //SigmaZ2
+             lp[5]=-0.00012; // out-of-diagonal element of covariance matrix
+             if (info[0]>1) {
+               lp[2]=4.80e-06;
+               lp[3]=0.0093;
+               lp[5]=0.00014;
+             }
+                     
+             AliITSRecPoint * cl2;
+             if(clusters){
+               cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);          
+               cl2->SetChargeRatio(1.);
              cl2->SetType(50);   
-           }
-           else{
-             cl2 = new AliITSRecPoint(milab,lp,info);
-             cl2->SetChargeRatio(1.);
-             cl2->SetType(50);
-             fDetTypeRec->AddRecPoint(*cl2);
-           }
-           ncl++;
-         } // cross is within the detector
-         //
-         //--------------
+             }
+             else{
+               cl2 = new AliITSRecPoint(milab,lp,info);
+               cl2->SetChargeRatio(1.);
+               cl2->SetType(50);
+               fDetTypeRec->AddRecPoint(*cl2);
+             }
+             ncl++;
+           } // cross is within the detector
+           //
+           //--------------
+           
+         } // bad Pstrip
          
-       } // bad Pstrip
+       } // end loop over Pstrips
        
-      } // end loop over Pstrips
+      } // end loop over Nside 1D clusters
       
-    } // end loop over Nside 1D clusters
+      for (Int_t j=0; j<nn; j++) { // loop over Pside 1D clusters with no crosses
+       if(cpositive[j]) continue;
+       
+       //      for(Int_t ib=0; ib<768; ib++) { // loop over all Nside strips
+       for(Int_t ib=15; ib<753; ib++) { // loop over all Nside strips
+         
+         if(cal->IsNChannelBad(ib)) { // check if strip is bad
+           Float_t yP=neg[j].GetY();   
+           Float_t xt, zt;
+           seg->GetPadCxz(yP, 1.*ib, xt, zt);  
+           
+           //----------
+           // bad Nstrip is crossing the Pside 1Dcluster -> create recpoint
+           // 
+           if ( (TMath::Abs(xt)<hwSSD) && (TMath::Abs(zt)<hlSSD) ) {
+             Double_t loc[3]={xt,0.,zt},trk[3]={0.,0.,0.};
+             mT2L->MasterToLocal(loc,trk);
+             lp[0]=trk[1];
+             lp[1]=trk[2];        
+             lp[4]=neg[j].GetQ(); //Q
+             for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
+             for (Int_t ilab=0;ilab<3;ilab++) milab[ilab] = neg[j].GetLabel(ilab);       
+             CheckLabels2(milab);
+             milab[3]=( j << 10 ) + idet; // pos|neg|det
+             Int_t info[3]={0,(Int_t)neg[j].GetNd(),fNlayer[fModule]};
+             
+             lp[2]=4.968e-06;     // 0.00223*0.00223;  //SigmaY2
+             lp[3]=0.012;         // 0.110*0.110;  //SigmaZ2
+             lp[5]=-0.00012; // out-of-diagonal element of covariance matrix
+             if (info[0]>1) {
+               lp[2]=2.79e-06;
+               lp[3]=0.00935;
+               lp[5]=-4.32e-05;
+             }
+             
+             AliITSRecPoint * cl2;
+             if(clusters){
+               cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);          
+               cl2->SetChargeRatio(1.);
+               cl2->SetType(60);         
+             }
+             else{
+               cl2 = new AliITSRecPoint(milab,lp,info);
+               cl2->SetChargeRatio(1.);
+               cl2->SetType(60);
+               fDetTypeRec->AddRecPoint(*cl2);
+             }
+             ncl++;
+           } // cross is within the detector
+           //
+           //--------------
+           
+         } // bad Nstrip
+       } // end loop over Nstrips
+      } // end loop over Pside 1D clusters
+      
+    } // no bad sides 
     
-    for (Int_t j=0; j<nn; j++) { // loop over Pside 1D clusters with no crosses
-      if(cpositive[j]) continue;
+    //---------------------------------------------------------
+    
+    else if( (countPbad>700) && (countNbad<100) ) { // bad Pside!!
       
-      //      for(Int_t ib=0; ib<768; ib++) { // loop over all Nside strips
-      for(Int_t ib=15; ib<753; ib++) { // loop over all Nside strips
+      for (Int_t i=0; i<np; i++) { // loop over Nside 1Dclusters with no crosses
+       if(cnegative[i]) continue; // if intersecting Pside clusters continue;
        
-       if(cal->IsNChannelBad(ib)) { // check if strip is bad
-         Float_t yP=neg[j].GetY();     
-         Float_t xt, zt;
-         seg->GetPadCxz(yP, 1.*ib, xt, zt);    
+       Float_t xt, zt;
+       Float_t yN=pos[i].GetY();       
+       Float_t yP=0.;
+       if (seg->GetLayer()==5) yP = yN + (7.6/1.9);
+       else yP = yN - (7.6/1.9);
+       seg->GetPadCxz(yP, yN, xt, zt); 
+       
+       if ( (TMath::Abs(xt)<hwSSD) && (TMath::Abs(zt)<hlSSD) ) {
+         Double_t loc[3]={xt,0.,zt},trk[3]={0.,0.,0.};
+         mT2L->MasterToLocal(loc,trk);
+         lp[0]=trk[1];
+         lp[1]=trk[2];        
+         lp[4]=pos[i].GetQ(); //Q
+         for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
+         for (Int_t ilab=0;ilab<3;ilab++) milab[ilab] = pos[i].GetLabel(ilab);   
+         CheckLabels2(milab);
+         milab[3]=( (i<<10) << 10 ) + idet; // pos|neg|det
+         Int_t info[3] = {(Int_t)pos[i].GetNd(),0,fNlayer[fModule]};
          
-         //----------
-         // bad Nstrip is crossing the Pside 1Dcluster -> create recpoint
-         // 
-         if ( (TMath::Abs(xt)<hwSSD+0.01) && (TMath::Abs(zt)<hlSSD+0.01) ) {
-           Double_t loc[3]={xt,0.,zt},trk[3]={0.,0.,0.};
-           mT2L->MasterToLocal(loc,trk);
-           lp[0]=trk[1];
-           lp[1]=trk[2];        
-           lp[4]=neg[j].GetQ(); //Q
-           for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
-           for (Int_t ilab=0;ilab<3;ilab++) milab[ilab] = neg[j].GetLabel(ilab);         
-           CheckLabels2(milab);
-           milab[3]=( j << 10 ) + idet; // pos|neg|det
-           Int_t info[3] = {0.,neg[j].GetNd(),fNlayer[fModule]};
+         lp[2]=0.00098;    // 0.031*0.031;  //SigmaY2
+         lp[3]=1.329;      // 1.15*1.15;  //SigmaZ2
+         lp[5]=-0.0359;
+         if(info[0]>1) lp[2]=0.00097;
 
-       lp[2]=0.0022*0.0022;  //SigmaY2
-       lp[3]=0.110*0.110;  //SigmaZ2
-       lp[5]=-0.00012; // out-of-diagonal element of covariance matrix
-       
-           AliITSRecPoint * cl2;
-           if(clusters){
-             cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);            
-             cl2->SetChargeRatio(1.);
-             cl2->SetType(60);   
-           }
-           else{
-             cl2 = new AliITSRecPoint(milab,lp,info);
-             cl2->SetChargeRatio(1.);
-             cl2->SetType(60);
-             fDetTypeRec->AddRecPoint(*cl2);
-           }
-           ncl++;
-         } // cross is within the detector
-         //
-         //--------------
-         
-       } // bad Nstrip
-      } // end loop over Nstrips
-    } // end loop over Pside 1D clusters
+         AliITSRecPoint * cl2;
+         if(clusters){
+           cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);      
+           cl2->SetChargeRatio(1.);
+           cl2->SetType(70);     
+         }
+         else{
+           cl2 = new AliITSRecPoint(milab,lp,info);
+           cl2->SetChargeRatio(1.);
+           cl2->SetType(70);
+           fDetTypeRec->AddRecPoint(*cl2);
+         }
+         ncl++;
+       } // cross is within the detector
+       //
+       //--------------
+       
+      } // end loop over Nside 1D clusters
+      
+    } // bad Pside module
     
-  } // no bad sides 
-
-  //---------------------------------------------------------
-
-  else if( (countPbad>700) && (countNbad<100) ) { // bad Pside!!
-
-    for (Int_t i=0; i<np; i++) { // loop over Nside 1Dclusters with no crosses
-      if(cnegative[i]) continue; // if intersecting Pside clusters continue;
+    else if( (countNbad>700) && (countPbad<100) ) { // bad Nside!!
       
-      Float_t xt, zt;
-      Float_t yN=pos[i].GetY();        
-      Float_t yP=0.;
-      if (seg->GetLayer()==5) yP = yN + (7.6/1.9);
-      else yP = yN - (7.6/1.9);
-      seg->GetPadCxz(yP, yN, xt, zt);  
+      for (Int_t j=0; j<nn; j++) { // loop over Pside 1D clusters with no crosses
+       if(cpositive[j]) continue;
+       
+       Float_t xt, zt;
+       Float_t yP=neg[j].GetY();       
+       Float_t yN=0.;
+       if (seg->GetLayer()==5) yN = yP - (7.6/1.9);
+       else yN = yP + (7.6/1.9);
+       seg->GetPadCxz(yP, yN, xt, zt); 
+       
+       if ( (TMath::Abs(xt)<hwSSD) && (TMath::Abs(zt)<hlSSD) ) {
+         Double_t loc[3]={xt,0.,zt},trk[3]={0.,0.,0.};
+         mT2L->MasterToLocal(loc,trk);
+         lp[0]=trk[1];
+         lp[1]=trk[2];        
+         lp[4]=neg[j].GetQ(); //Q
+         for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
+         for (Int_t ilab=0;ilab<3;ilab++) milab[ilab] = neg[j].GetLabel(ilab);   
+         CheckLabels2(milab);
+         milab[3]=( j << 10 ) + idet; // pos|neg|det
+         Int_t info[3] = {0,(Int_t)neg[j].GetNd(),fNlayer[fModule]};
          
-      if ( (TMath::Abs(xt)<hwSSD+0.01) && (TMath::Abs(zt)<hlSSD+0.01) ) {
-       Double_t loc[3]={xt,0.,zt},trk[3]={0.,0.,0.};
-       mT2L->MasterToLocal(loc,trk);
-       lp[0]=trk[1];
-       lp[1]=trk[2];        
-       lp[4]=pos[i].GetQ(); //Q
-       for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
-       for (Int_t ilab=0;ilab<3;ilab++) milab[ilab] = pos[i].GetLabel(ilab);     
-       CheckLabels2(milab);
-       milab[3]=( (i<<10) << 10 ) + idet; // pos|neg|det
-       Int_t info[3] = {pos[i].GetNd(),0.,fNlayer[fModule]};
-
-       lp[2]=0.031*0.031;  //SigmaY2
-       lp[3]=1.15*1.15;  //SigmaZ2
-       lp[5]=-0.036;
-
-       AliITSRecPoint * cl2;
-       if(clusters){
-         cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);        
-         cl2->SetChargeRatio(1.);
-         cl2->SetType(70);       
-       }
-       else{
-         cl2 = new AliITSRecPoint(milab,lp,info);
-         cl2->SetChargeRatio(1.);
-         cl2->SetType(70);
-         fDetTypeRec->AddRecPoint(*cl2);
-       }
-       ncl++;
-      } // cross is within the detector
-      //
-      //--------------
+         lp[2]=7.27e-05;   // 0.0085*0.0085;  //SigmaY2
+         lp[3]=1.33;       // 1.15*1.15;  //SigmaZ2
+         lp[5]=0.00931;
+         if(info[1]>1) lp[2]=6.91e-05;
+         
+         AliITSRecPoint * cl2;
+         if(clusters){
+           cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);      
+           cl2->SetChargeRatio(1.);
+           cl2->SetType(80);     
+         }
+         else{
+           cl2 = new AliITSRecPoint(milab,lp,info);
+           cl2->SetChargeRatio(1.);
+           cl2->SetType(80);
+           fDetTypeRec->AddRecPoint(*cl2);
+         }
+         ncl++;
+       } // cross is within the detector
+       //
+       //--------------
+       
+      } // end loop over Pside 1D clusters
       
-    } // end loop over Nside 1D clusters
+    } // bad Nside module
     
-  } // bad Pside module
-  
-  else if( (countNbad>700) && (countPbad<100) ) { // bad Nside!!
+    //---------------------------------------------------------
     
-    for (Int_t j=0; j<nn; j++) { // loop over Pside 1D clusters with no crosses
-      if(cpositive[j]) continue;
-      
-      Float_t xt, zt;
-      Float_t yP=neg[j].GetY();        
-      Float_t yN=0.;
-      if (seg->GetLayer()==5) yN = yP - (7.6/1.9);
-      else yN = yP + (7.6/1.9);
-      seg->GetPadCxz(yP, yN, xt, zt);  
-      
-      if ( (TMath::Abs(xt)<hwSSD+0.01) && (TMath::Abs(zt)<hlSSD+0.01) ) {
-       Double_t loc[3]={xt,0.,zt},trk[3]={0.,0.,0.};
-       mT2L->MasterToLocal(loc,trk);
-       lp[0]=trk[1];
-       lp[1]=trk[2];        
-       lp[4]=neg[j].GetQ(); //Q
-       for (Int_t ilab=0;ilab<10;ilab++) milab[ilab]=-2;
-       for (Int_t ilab=0;ilab<3;ilab++) milab[ilab] = neg[j].GetLabel(ilab);     
-       CheckLabels2(milab);
-       milab[3]=( j << 10 ) + idet; // pos|neg|det
-       Int_t info[3] = {0.,neg[j].GetNd(),fNlayer[fModule]};
-
-       lp[2]=0.0085*0.0085;  //SigmaY2
-       lp[3]=1.15*1.15;  //SigmaZ2
-       lp[5]=0.0093;
-
-       AliITSRecPoint * cl2;
-       if(clusters){
-         cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);        
-         cl2->SetChargeRatio(1.);
-         cl2->SetType(80);       
-       }
-       else{
-         cl2 = new AliITSRecPoint(milab,lp,info);
-         cl2->SetChargeRatio(1.);
-         cl2->SetType(80);
-         fDetTypeRec->AddRecPoint(*cl2);
-       }
-       ncl++;
-      } // cross is within the detector
-      //
-      //--------------
-      
-    } // end loop over Pside 1D clusters
+  } // use bad channels
     
-  } // bad Nside module
-  
-  //---------------------------------------------------------
-  
   //cout<<ncl<<" clusters for this module"<<endl;
 
   delete [] cnegative;
@@ -1921,3 +2006,4 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
   delete [] positivepair;
 
 }
+