]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/CALO/AliHLTCaloClusterAnalyser.cxx
RWGCF converted to native cmake
[u/mrichter/AliRoot.git] / HLT / CALO / AliHLTCaloClusterAnalyser.cxx
index 2a1c940dcc5af75273d1e2f57db7fe2152922361..d38841bbab335f624c8969ac77724839fc461b71 100644 (file)
@@ -57,11 +57,7 @@ AliHLTCaloClusterAnalyser::AliHLTCaloClusterAnalyser() :
   fDoPID(false),
   fHaveDistanceToBadChannel(false),
   fGeometry(0),
-#ifndef HAVE_NOT_ALIVCLUSTER // backward compatibility for r42844
   fClusterType(AliVCluster::kPHOSNeutral),
-#else
-  fClusterType(AliESDCaloCluster::kPHOSCluster),
-#endif
   fRecoParamsPtr(0),
   fCutOnSingleCellClusters(false),
   fSingleCellEnergyCut(0.5)
@@ -124,45 +120,47 @@ AliHLTCaloClusterAnalyser::CalculateCenterOfGravity()
 /*       Float_t maxAmp = 0;
        Int_t maxX = 0;
        Int_t maxZ = 0;*/
-      for(iDigit = 0; iDigit < recPoint->fMultiplicity; iDigit++)
-       {
-
-         digit = fDigitDataArray[*digitIndexPtr];
-
-         xi = digit->fX;
-         zi = digit->fZ;
-
-         //xi = digit->fX+0.5;
-         //zi = digit->fZ+0.5;
-
-         if (recPoint->fAmp > 0 && digit->fEnergy > 0) 
-           {
-             Float_t w = TMath::Max( 0., fLogWeight + TMath::Log( digit->fEnergy / recPoint->fAmp ) ) ;
-             x    += xi * w ;
-             z    += zi * w ;
-             wtot += w ;
-/*           if(digit->fEnergy > maxAmp)
-             {
-                maxAmp = digit->fEnergy;
-                maxX = digit->fX;// + 0.5;
-                maxZ = digit->fZ;// + 0.5;
-             }*/
-           }
-         digitIndexPtr++;
-       }
-
-      if (wtot>0) 
-       {
-         recPoint->fX = x/wtot ;
-         recPoint->fZ = z/wtot ;
-       }
-      else
-       {
-         recPoint->fX = -9999;
-          recPoint->fZ =-9999;
-         // no good crashes depth with FP exception
-         //recPoint->fAmp = 0;
-       }
+       if (fDigitDataArray[*digitIndexPtr])
+
+        for(iDigit = 0; iDigit < recPoint->fMultiplicity; iDigit++)
+          {
+            
+            digit = fDigitDataArray[*digitIndexPtr];
+            
+            xi = digit->fX;
+            zi = digit->fZ;
+            
+            //xi = digit->fX+0.5;
+            //zi = digit->fZ+0.5;
+            
+            if (recPoint->fAmp > 0 && digit->fEnergy > 0) 
+              {
+                Float_t w = TMath::Max( 0., fLogWeight + TMath::Log( digit->fEnergy / recPoint->fAmp ) ) ;
+                x    += xi * w ;
+                z    += zi * w ;
+                wtot += w ;
+                /*           if(digit->fEnergy > maxAmp)
+                             {
+                             maxAmp = digit->fEnergy;
+                             maxX = digit->fX;// + 0.5;
+                             maxZ = digit->fZ;// + 0.5;
+                             }*/
+              }
+            digitIndexPtr++;
+          }
+       
+       if (wtot>0) 
+        {
+          recPoint->fX = x/wtot ;
+          recPoint->fZ = z/wtot ;
+        }
+       else
+        {
+          recPoint->fX = -9999;
+          recPoint->fZ =-9999;
+          // no good crashes depth with FP exception
+          //recPoint->fAmp = 0;
+        }
 //     printf("Max digit: E = %f, x = %d, z= %d, cluster: E = %f, x = %f, z = %f\n" , maxAmp, maxX, maxZ, recPoint->fAmp, recPoint->fX, recPoint->fZ);
     }
   return 0;
@@ -286,7 +284,7 @@ AliHLTCaloClusterAnalyser::CreateClusters(Int_t nRecPoints, UInt_t availableSize
       Int_t id = 0;
 
        AliHLTCaloCellDataStruct *cellPtr = &(caloClusterPtr->fCaloCells);
-       
+      Float_t maxTime = 0; //time of maximum amplitude cell is assigned to cluster 
       for(UInt_t j = 0; j < caloClusterPtr->fNCells; j++)
        {
           digitPtr = fDigitDataArray[*digitIndexPtr];
@@ -294,6 +292,7 @@ AliHLTCaloClusterAnalyser::CreateClusters(Int_t nRecPoints, UInt_t availableSize
           
          cellPtr->fCellsAbsId= id;
          cellPtr->fCellsAmpFraction = digitPtr->fEnergy/recPointPtr->fAmp;
+               if(digitPtr->fTime > maxTime) maxTime = digitPtr->fTime; 
          //printf("Cell ID pointer: %x\n", cellIDPtr);
         //printf("Cell Amp Pointer: %x\n", cellAmpFracPtr);
         //printf("Cell pos: x = %d, z = %d\n", digitPtr->fX, digitPtr->fZ);
@@ -315,7 +314,11 @@ AliHLTCaloClusterAnalyser::CreateClusters(Int_t nRecPoints, UInt_t availableSize
         caloClusterPtr->fEnergy = recPointPtr->fAmp;
       }
       
-      HLTDebug("Cluster global position: x = %f, y = %f, z = %f, energy: %f, number of cells: %d, cluster pointer: %x", globalCoord.fX, globalCoord.fY, globalCoord.fZ, caloClusterPtr->fEnergy, caloClusterPtr->fNCells,  caloClusterPtr);
+      // Set the time of the maximum digit as cluster time
+      //caloClusterPtr->fTOF = recPointPtr->fTime;
+                       caloClusterPtr->fTOF = maxTime;
+      
+      HLTDebug("Cluster global position: x = %f, y = %f, z = %f, energy: %f, time: %f, number of cells: %d, cluster pointer: %x", globalCoord.fX, globalCoord.fY, globalCoord.fZ, caloClusterPtr->fEnergy, caloClusterPtr->fTOF, caloClusterPtr->fNCells,  caloClusterPtr);
 
       if(fDoClusterFit)
        {
@@ -343,7 +346,7 @@ AliHLTCaloClusterAnalyser::CreateClusters(Int_t nRecPoints, UInt_t availableSize
        }
       else
        {
-         for(Int_t k = 0; k < AliPID::kSPECIESN; k++)
+         for(Int_t k = 0; k < AliPID::kSPECIESCN; k++)
            {
              caloClusterPtr->fPID[k] = 0;
            }