]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSClusterizerv1.cxx
Continuous progress on the Fast Simulation: AliPHOSFastRecParticle is born
[u/mrichter/AliRoot.git] / PHOS / AliPHOSClusterizerv1.cxx
index 0ef7b04ee6176978667f1f367988a4d7309a19ff..ecd030fca0100ff7d1e2d67e4182b45a9b7f4917 100644 (file)
@@ -24,7 +24,7 @@
 
 // --- Standard library ---
 
-#include "iostream.h"
+#include <iostream>
 
 // --- AliRoot header files ---
 
@@ -55,9 +55,9 @@ AliPHOSClusterizerv1::AliPHOSClusterizerv1()
 //____________________________________________________________________________
 Int_t AliPHOSClusterizerv1::AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)
 {
-  // neigbours are defined as digits having at least common virtix
+  // neigbours are defined as digits having at least common vertex
   // The order of A and B in AreNeighbours(A,B) is important: first (A) should be digit 
-  // in cluster, which compared with digits, which not clasterized yet  
+  // in cluster, which compared with digits not clusterized yet  
   Int_t rv = 0 ; 
 
   AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
@@ -69,10 +69,10 @@ Int_t AliPHOSClusterizerv1::AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)
   geom->AbsToRelNumbering(d2->GetId(), relid2) ; 
  
   if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module 
-    Int_t RowDiff = TMath::Abs( relid1[2] - relid2[2] ) ;  
-    Int_t ColDiff = TMath::Abs( relid1[3] - relid2[3] ) ;  
+    Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;  
+    Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;  
     
-    if (( ColDiff<=1 )  && ( RowDiff <= 1 )){
+    if (( coldiff <= 1 )  && ( rowdiff <= 1 )){
       rv = 1 ; 
     }
     else {
@@ -97,7 +97,6 @@ void AliPHOSClusterizerv1::FillandSort(const DigitsList * dl, TObjArray * tl)
   // copies the digits with energy above thershold and sorts the list
   // according to increasing Id number
 
-
   AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
   Int_t relid[4] ;  
   
@@ -105,7 +104,13 @@ void AliPHOSClusterizerv1::FillandSort(const DigitsList * dl, TObjArray * tl)
   AliPHOSDigit * digit ;
   
   while ( (digit = (AliPHOSDigit *)next()) ) { 
-    
+
+//     cout << " clusterizerv1 " << endl ;
+//     int nprim = digit->GetNprimary() ;
+//     int * aprim = digit->GetPrimary() ;
+//     for ( int ii = 0 ; ii < nprim ; ii++)
+//       cout << ii << " prim = " << aprim[ii] << endl ;
+
     Int_t id    = digit->GetId() ; 
     Float_t ene = Calibrate(digit->GetAmp()) ; 
     geom->AbsToRelNumbering(id, relid) ;
@@ -134,7 +139,7 @@ void AliPHOSClusterizerv1:: GetNumberOfClustersFound(Int_t * numb)
 //____________________________________________________________________________
 Bool_t AliPHOSClusterizerv1::IsInEmc(AliPHOSDigit * digit) 
 {
-   Bool_t rv = kFALSE ; 
+  Bool_t rv = kFALSE ; 
 
   AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;  
 
@@ -150,59 +155,60 @@ Bool_t AliPHOSClusterizerv1::IsInEmc(AliPHOSDigit * digit)
 //____________________________________________________________________________
 void AliPHOSClusterizerv1::MakeClusters(const DigitsList * dl, RecPointsList * emcl, RecPointsList * ppsdl)
 {
-
   // Fill and sort the working digits list
-  TObjArray TempoDigitsList( dl->GetEntries() ) ;
-  this->FillandSort(dl, &TempoDigitsList) ; 
-
-
+  TObjArray tempodigitslist( dl->GetEntries() ) ;
+  FillandSort(dl, &tempodigitslist) ; 
 
   // Clusterization starts  
-  TIter nextdigit(&TempoDigitsList) ; 
+  TIter nextdigit(&tempodigitslist) ; 
   AliPHOSDigit * digit ; 
-  Bool_t NotRemoved = kTRUE ;
+  Bool_t notremoved = kTRUE ;
 
   while ( (digit = (AliPHOSDigit *)nextdigit()) ) { // scan over the list of digits
     AliPHOSRecPoint * clu ; 
-
-    int * ClusterDigitsList[dl->GetEntries()] ;   
+   
+    int * clusterdigitslist[dl->GetEntries()] ;   
     Int_t index ;
-    if (( (this->IsInEmc(digit)) && (Calibrate(digit->GetAmp()) > fEmcClusteringThreshold ) ) || 
-        ( (!this->IsInEmc(digit)) && (Calibrate(digit->GetAmp()) > fPpsdClusteringThreshold ) ) ) {
+    if (( ( IsInEmc(digit) ) && ( Calibrate(digit->GetAmp() ) > fEmcClusteringThreshold ) ) || 
+        ( ( !IsInEmc(digit) ) && ( Calibrate(digit->GetAmp() ) > fPpsdClusteringThreshold ) ) ) {
   
       Int_t iDigitInCluster = 0 ; 
 
-      if  (this->IsInEmc(digit) ) {   
-        new ((*emcl)[fNumberOfEmcClusters]) AliPHOSEmcRecPoint(fW0, fLocMaxCut) ;// start a new EMC RecPoint
-
-       clu = (AliPHOSEmcRecPoint *) (*emcl)[fNumberOfEmcClusters++] ; 
-       clu->AddDigit(*digit,Calibrate(digit->GetAmp())) ; 
+      if  ( IsInEmc(digit) ) {   
+        new ((*emcl)[fNumberOfEmcClusters]) AliPHOSEmcRecPoint(fW0, fLocMaxCut) ; // start a new EMC RecPoint
+       clu = (AliPHOSEmcRecPoint *) (*emcl)[fNumberOfEmcClusters] ; 
+       fNumberOfEmcClusters++ ; 
+       clu->AddDigit(*digit, Calibrate(digit->GetAmp())) ; 
 
-       ClusterDigitsList[iDigitInCluster++] = (int* ) digit ;  
-       TempoDigitsList.Remove(digit) ; 
+       clusterdigitslist[iDigitInCluster] = (int* ) digit ;    
+       iDigitInCluster++ ; 
+       tempodigitslist.Remove(digit) ; 
       }
 
       else { 
-       new ((*ppsdl)[fNumberOfPpsdClusters]) AliPHOSPpsdRecPoint() ;// start a new PPSD cluster
-       clu =  (AliPHOSPpsdRecPoint *) ppsdl->At(fNumberOfPpsdClusters++)  ;  
-       clu->AddDigit(*digit,0.) ;      
-       ClusterDigitsList[iDigitInCluster++] = (int* ) digit ;  
-        TempoDigitsList.Remove(digit) ; 
+       new ((*ppsdl)[fNumberOfPpsdClusters]) AliPHOSPpsdRecPoint() ; // start a new PPSD cluster
+       clu =  (AliPHOSPpsdRecPoint *) ppsdl->At(fNumberOfPpsdClusters)  ;  
+       fNumberOfPpsdClusters++ ; 
+       clu->AddDigit(*digit, Calibrate(digit->GetAmp()) ) ;    
+       clusterdigitslist[iDigitInCluster] = (int* ) digit ;    
+       iDigitInCluster++ ; 
+       tempodigitslist.Remove(digit) ; 
         nextdigit.Reset() ;
        
-       //Here we remove resting EMC digits, which can not make cluster
-        if(NotRemoved){ 
+       // Here we remove resting EMC digits, which cannot make cluster
+
+        if( notremoved ) { 
          
-         while( (digit = (AliPHOSDigit *)nextdigit()) ){
+         while( ( digit = (AliPHOSDigit *)nextdigit() ) ) {
            
-            if(IsInEmc(digit)) TempoDigitsList.Remove(digit) ;
+            if( IsInEmc(digit) ) 
+             tempodigitslist.Remove(digit) ;
             else 
              break ;
-           
-         }// while digit  
          
-       } // if NotRemoved 
+         } // while digit  
+         
+       } // if notremoved 
        
       } // else        
       
@@ -210,20 +216,21 @@ void AliPHOSClusterizerv1::MakeClusters(const DigitsList * dl, RecPointsList * e
 
       AliPHOSDigit * digitN ; 
       index = 0 ;
-      while (index < iDigitInCluster){ // scan over digits already in claster 
-       digit = (AliPHOSDigit *) ClusterDigitsList[index++]  ;      
-
+      while (index < iDigitInCluster){ // scan over digits already in cluster 
+       digit = (AliPHOSDigit *) clusterdigitslist[index]  ;      
+       index++ ; 
         while ( (digitN = (AliPHOSDigit *)nextdigit()) ) { // scan over the reduced list of digits 
          Int_t ineb = AreNeighbours(digit, digitN);   //  call (digit,digitN) in THAT oder !!!!!
           switch (ineb ) {
-          case 0 :   // not a neibors
+          case 0 :   // not a neighbour
            break ;      
-         case 1 :    // Are neibors 
-           clu->AddDigit(*digitN,Calibrate(digitN->GetAmp())) ;
-           ClusterDigitsList[iDigitInCluster++] =(int*) digitN ; 
-           TempoDigitsList.Remove(digitN) ;
+         case 1 :   // are neighbours 
+           clu->AddDigit( *digitN, Calibrate( digitN->GetAmp() ) ) ;
+           clusterdigitslist[iDigitInCluster] =(int*) digitN ; 
+           iDigitInCluster++ ; 
+           tempodigitslist.Remove(digitN) ;
            break ;
-          case 2 :  // to far from each other
+          case 2 :   // too far from each other
            goto endofloop;   
          } // switch
          
@@ -238,7 +245,7 @@ void AliPHOSClusterizerv1::MakeClusters(const DigitsList * dl, RecPointsList * e
   
   } // while digit
 
-  TempoDigitsList.Clear() ; 
+  tempodigitslist.Clear() ; 
 }
 
 //____________________________________________________________________________