]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSClusterFinderV2SSD.cxx
fixes for DA makefile in order to parse the quotation mark character
[u/mrichter/AliRoot.git] / ITS / AliITSClusterFinderV2SSD.cxx
index 5b7f3ccf14beb1c0782e2adbfe0a08d0d0046d1a..cf157bb2e1096d5f6aad89b0e3579451e9ef4767 100644 (file)
@@ -30,6 +30,9 @@
 #include "AliITSdigitSSD.h"
 #include "AliITSCalibrationSSD.h"
 
+Short_t *AliITSClusterFinderV2SSD::fPairs = 0x0;
+Int_t    AliITSClusterFinderV2SSD::fPairsSize = 0;
+
 ClassImp(AliITSClusterFinderV2SSD)
 
 
@@ -63,7 +66,8 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(TClonesArray *alldigits) {
 
   Int_t smaxall=alldigits->GetEntriesFast();
   if (smaxall==0) return;
-  TObjArray *digits = new TObjArray;
+  //  TObjArray *digits = new TObjArray;
+  TObjArray digits;
   for (Int_t i=0;i<smaxall; i++){
     AliITSdigitSSD *d=(AliITSdigitSSD*)alldigits->UncheckedAt(i);
 
@@ -76,9 +80,9 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(TClonesArray *alldigits) {
     d->SetSignal(Int_t(q));
 
     if (d->GetSignal()<3) continue;
-    digits->AddLast(d);
+    digits.AddLast(d);
   }
-  Int_t smax = digits->GetEntriesFast();
+  Int_t smax = digits.GetEntriesFast();
   if (smax==0) return;
   
   const Int_t kMax=1000;
@@ -87,7 +91,7 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(TClonesArray *alldigits) {
   Float_t y=0., q=0., qmax=0.; 
   Int_t lab[4]={-2,-2,-2,-2};
   
-  AliITSdigitSSD *d=(AliITSdigitSSD*)digits->UncheckedAt(0);
+  AliITSdigitSSD *d=(AliITSdigitSSD*)digits.UncheckedAt(0);
   q += d->GetSignal();
   y += d->GetCoord2()*d->GetSignal();
   qmax=d->GetSignal();
@@ -104,7 +108,7 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(TClonesArray *alldigits) {
   milab[0]=d->GetTrack(0); milab[1]=d->GetTrack(1); milab[2]=d->GetTrack(2);
 
   for (Int_t s=1; s<smax; s++) {
-      d=(AliITSdigitSSD*)digits->UncheckedAt(s);      
+      d=(AliITSdigitSSD*)digits.UncheckedAt(s);      
       Int_t strip=d->GetCoord2();
       if ((strip-curr) > 1 || flag!=d->GetCoord1()) {
          c[*n].SetY(y/q);
@@ -342,13 +346,13 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
   for (Int_t i=0;i<3000;i++) {cnegative[i]=0; cused1[i]=0;}
   for (Int_t i=0;i<3000;i++) {cpositive[i]=0; cused2[i]=0;}
   for (Int_t i=0;i<30000;i++) {negativepair[i]=0; positivepair[i]=0;}
-  static Short_t pairs[1000][1000];
-  memset(pairs,0,sizeof(Short_t)*1000000);
-//   Short_t ** pairs = new Short_t*[1000];
-//   for (Int_t i=0; i<1000; i++) {
-//     pairs[i] = new Short_t[1000];
-//     memset(pairs[i],0,sizeof(Short_t)*1000);
-//   }  
+
+  if ((np*nn) > fPairsSize) {
+    if (fPairs) delete [] fPairs;
+    fPairsSize = 4*np*nn;
+    fPairs = new Short_t[fPairsSize];
+  }
+  memset(fPairs,0,sizeof(Short_t)*np*nn);
   //
   // find available pairs
   //
@@ -367,7 +371,7 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        positivepair[j*10+cpositive[j]] =i;
        cnegative[i]++;  //counters
        cpositive[j]++; 
-       pairs[i][j]=100;
+       fPairs[i*nn+j]=100;
       }
     }
   }
@@ -390,7 +394,7 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        positivepair[j*10+cpositive[j]] =i;
        cnegative[i]++;  //counters
        cpositive[j]++; 
-       pairs[i][j]=100;
+       fPairs[i*nn+j]=100;
       }
     }
   }
@@ -441,10 +445,10 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
        cl2->SetChargeRatio(ratio);     
        cl2->SetType(1);
-       pairs[ip][j]=1;
+       fPairs[ip*nn+j]=1;
        if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
          cl2->SetType(2);
-         pairs[ip][j]=2;
+         fPairs[ip*nn+j]=2;
        }
        cused1[ip]++;
        cused2[j]++;
@@ -454,10 +458,10 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        cl2 = new AliITSRecPoint(milab,lp,info);        
        cl2->SetChargeRatio(ratio);     
        cl2->SetType(1);
-       pairs[ip][j]=1;
+       fPairs[ip*nn+j]=1;
        if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
          cl2->SetType(2);
-         pairs[ip][j]=2;
+         fPairs[ip*nn+j]=2;
        }
        cused1[ip]++;
        cused2[j]++;
@@ -480,7 +484,7 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
       if (TMath::Abs(pcharge-neg[in].GetQ())<10){
        //
        // add first pair
-       if (pairs[ip][in]==100){  //
+       if (fPairs[ip*nn+in]==100){  //
          Float_t yp=pos[ip].GetY()*fYpitchSSD; 
          Float_t yn=neg[in].GetY()*fYpitchSSD;
          Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
@@ -514,20 +518,20 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
            cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
            cl2->SetChargeRatio(ratio);         
            cl2->SetType(5);
-           pairs[ip][in] = 5;
+           fPairs[ip*nn+in] = 5;
            if ((pos[ip].GetNd()+neg[in].GetNd())>6){ //multi cluster
              cl2->SetType(6);
-             pairs[ip][in] = 6;
+             fPairs[ip*nn+in] = 6;
            }       
          }
          else{
            cl2 = new AliITSRecPoint(milab,lp,info);
            cl2->SetChargeRatio(ratio);         
            cl2->SetType(5);
-           pairs[ip][in] = 5;
+           fPairs[ip*nn+in] = 5;
            if ((pos[ip].GetNd()+neg[in].GetNd())>6){ //multi cluster
              cl2->SetType(6);
-             pairs[ip][in] = 6;
+             fPairs[ip*nn+in] = 6;
            }
            
            fDetTypeRec->AddRecPoint(*cl2);
@@ -539,7 +543,7 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        // add second pair
        
       //       if (!(cused1[ip2] || cused2[in])){  //
-       if (pairs[ip2][in]==100){
+       if (fPairs[ip2*nn+in]==100){
          Float_t yp=pos[ip2].GetY()*fYpitchSSD;
          Float_t yn=neg[in].GetY()*fYpitchSSD;
          Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
@@ -573,20 +577,20 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
            cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
            cl2->SetChargeRatio(ratio);         
            cl2->SetType(5);
-           pairs[ip2][in] =5;
+           fPairs[ip2*nn+in] =5;
            if ((pos[ip2].GetNd()+neg[in].GetNd())>6){ //multi cluster
              cl2->SetType(6);
-             pairs[ip2][in] =6;
+             fPairs[ip2*nn+in] =6;
            }
          }
          else{
            cl2 = new AliITSRecPoint(milab,lp,info);
            cl2->SetChargeRatio(ratio);         
            cl2->SetType(5);
-           pairs[ip2][in] =5;
+           fPairs[ip2*nn+in] =5;
            if ((pos[ip2].GetNd()+neg[in].GetNd())>6){ //multi cluster
              cl2->SetType(6);
-             pairs[ip2][in] =6;
+             fPairs[ip2*nn+in] =6;
            }
 
            fDetTypeRec->AddRecPoint(*cl2);
@@ -615,7 +619,7 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        //
        // add first pair
        //      if (!(cused1[ip]||cused2[jn])){
-       if (pairs[ip][jn]==100){
+       if (fPairs[ip*nn+jn]==100){
          Float_t yn=neg[jn].GetY()*fYpitchSSD; 
          Float_t yp=pos[ip].GetY()*fYpitchSSD;
          Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
@@ -649,10 +653,10 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
            cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
            cl2->SetChargeRatio(ratio);         
            cl2->SetType(7);
-           pairs[ip][jn] =7;
+           fPairs[ip*nn+jn] =7;
            if ((pos[ip].GetNd()+neg[jn].GetNd())>6){ //multi cluster
              cl2->SetType(8);
-             pairs[ip][jn]=8;
+             fPairs[ip*nn+jn]=8;
            }
 
          }
@@ -660,10 +664,10 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
            cl2 = new AliITSRecPoint(milab,lp,info);
            cl2->SetChargeRatio(ratio);         
            cl2->SetType(7);
-           pairs[ip][jn] =7;
+           fPairs[ip*nn+jn] =7;
            if ((pos[ip].GetNd()+neg[jn].GetNd())>6){ //multi cluster
              cl2->SetType(8);
-             pairs[ip][jn]=8;
+             fPairs[ip*nn+jn]=8;
            }
 
            fDetTypeRec->AddRecPoint(*cl2);
@@ -673,7 +677,7 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        //
        // add second pair
        //      if (!(cused1[ip]||cused2[jn2])){
-       if (pairs[ip][jn2]==100){
+       if (fPairs[ip*nn+jn2]==100){
          Float_t yn=neg[jn2].GetY()*fYpitchSSD; 
          Double_t yp=pos[ip].GetY()*fYpitchSSD; 
          Double_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
@@ -705,22 +709,22 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
          if(clusters){
            cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
            cl2->SetChargeRatio(ratio);         
-           pairs[ip][jn2]=7;
+           fPairs[ip*nn+jn2]=7;
            cl2->SetType(7);
            if ((pos[ip].GetNd()+neg[jn2].GetNd())>6){ //multi cluster
              cl2->SetType(8);
-             pairs[ip][jn2]=8;
+             fPairs[ip*nn+jn2]=8;
            }
            
          }
          else{
            cl2 = new AliITSRecPoint(milab,lp,info);
            cl2->SetChargeRatio(ratio);         
-           pairs[ip][jn2]=7;
+           fPairs[ip*nn+jn2]=7;
            cl2->SetType(7);
            if ((pos[ip].GetNd()+neg[jn2].GetNd())>6){ //multi cluster
              cl2->SetType(8);
-             pairs[ip][jn2]=8;
+             fPairs[ip*nn+jn2]=8;
            }
            
            fDetTypeRec->AddRecPoint(*cl2);
@@ -777,7 +781,7 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        if (TMath::Abs(chargedif)<minchargediff+4.) count++;
       }
       if (count>1) continue;   
-      if (pairs[ip][j]<100) continue;
+      if (fPairs[ip*nn+j]<100) continue;
       //
       //almost gold clusters
       Float_t yp=pos[ip].GetY()*fYpitchSSD; 
@@ -811,10 +815,10 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
        cl2->SetChargeRatio(ratio);     
        cl2->SetType(10);
-       pairs[ip][j]=10;
+       fPairs[ip*nn+j]=10;
        if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
          cl2->SetType(11);
-         pairs[ip][j]=11;
+         fPairs[ip*nn+j]=11;
        }
        cused1[ip]++;
        cused2[j]++;      
@@ -823,10 +827,10 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        cl2 = new AliITSRecPoint(milab,lp,info);
        cl2->SetChargeRatio(ratio);     
        cl2->SetType(10);
-       pairs[ip][j]=10;
+       fPairs[ip*nn+j]=10;
        if ((pos[ip].GetNd()+neg[j].GetNd())>6){ //multi cluster
          cl2->SetType(11);
-         pairs[ip][j]=11;
+         fPairs[ip*nn+j]=11;
        }
        cused1[ip]++;
        cused2[j]++;      
@@ -848,7 +852,7 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
     //  Int_t j = negativepair[10*i+di];
       if (neg[j].GetQ()<3) continue;
       if (cused2[j]||cused1[i]) continue;      
-      if (pairs[i][j]>0 &&pairs[i][j]<100) continue;
+      if (fPairs[i*nn+j]>0 &&fPairs[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);
@@ -892,20 +896,17 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
        ncl++;
        //cl2->SetType(0);
        /*
-         if (pairs[i][j]<100){
-         printf("problem:- %d\n", pairs[i][j]);
+         if (fPairs[i*nn+j]<100){
+         printf("problem:- %d\n", fPairs[i*nn+j]);
          }
          if (cnegative[i]<2&&cpositive[j]<2){
-         printf("problem:- %d\n", pairs[i][j]);
+         printf("problem:- %d\n", fPairs[i*nn+j]);
          }
        */
       }
     }
   }
 
-//   for (Int_t i=0; i<1000; i++) delete [] pairs[i];
-//   delete [] pairs;
-
 }