]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/util/AliHLTESDCaloClusterMaker.cxx
tracking at slice borders improved
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTESDCaloClusterMaker.cxx
index 07d46c52f27bc5ab1226d0f94aed797efb5f66f0..f685bf36e74fa91a34c431aebb503fcbb51d83cc 100644 (file)
@@ -1,3 +1,5 @@
+//-*- Mode: C++ -*-
+// $Id$
 
 /**************************************************************************
  * This file is property of and copyright by the ALICE HLT Project        * 
@@ -48,7 +50,7 @@ AliHLTESDCaloClusterMaker::AliHLTESDCaloClusterMaker() :
 AliHLTESDCaloClusterMaker::~AliHLTESDCaloClusterMaker()
 {
   //See header file for documentation
-
+  delete fClusterReaderPtr;
 }
 
 Int_t 
@@ -67,29 +69,62 @@ AliHLTESDCaloClusterMaker::FillESD(AliESDEvent *esdPtr, const AliHLTCaloClusterH
       AliESDCaloCluster esdCluster;
 
       esdCluster.SetID(caloClusterStructPtr->fID);
+#ifndef HAVE_NOT_ALIVCLUSTER // backward compatibility for r42844
+      esdCluster.SetType(caloClusterStructPtr->fClusterType);
+#else
       esdCluster.SetClusterType(caloClusterStructPtr->fClusterType);
+#endif
       esdCluster.SetPosition((Float_t*)(caloClusterStructPtr->fGlobalPos));
       esdCluster.SetE(caloClusterStructPtr->fEnergy);
       esdCluster.SetTOF(caloClusterStructPtr->fTOF);
+#ifndef HAVE_NOT_ALIVCLUSTER // backward compatibility for r42844
+      esdCluster.SetDispersion(caloClusterStructPtr->fDispersion);
+      esdCluster.SetChi2(caloClusterStructPtr->fFitQuality);
+#else
       esdCluster.SetClusterDisp(caloClusterStructPtr->fDispersion);
       esdCluster.SetClusterChi2(caloClusterStructPtr->fFitQuality);
-      esdCluster.SetPid((Float_t*)(caloClusterStructPtr->fPID));
+#endif
+      const Float_t *pid = caloClusterStructPtr->fPID;
+#ifndef HAVE_NOT_ALIVCLUSTER // backward compatibility for r42844
+      esdCluster.SetPID(pid);
+#else
+      esdCluster.SetPid(pid);
+#endif
       esdCluster.SetM20(caloClusterStructPtr->fM20);
       esdCluster.SetM02(caloClusterStructPtr->fM02);
       esdCluster.SetNExMax(caloClusterStructPtr->fNExMax);
       esdCluster.SetEmcCpvDistance(caloClusterStructPtr->fEmcCpvDistance);
       esdCluster.SetDistanceToBadChannel(caloClusterStructPtr->fDistToBadChannel);
       esdCluster.SetNCells(caloClusterStructPtr->fNCells);
+      //esdCluster.SetNCells(0);
+      if(caloClusterStructPtr->GetNTracksMatched())
+      {
+        TArrayI tracksMatched(caloClusterStructPtr->GetNTracksMatched(), caloClusterStructPtr->fTracksMatched);
+        esdCluster.AddTracksMatched(tracksMatched);
+      }
       UShort_t *idArrayPtr = new UShort_t[caloClusterStructPtr->fNCells];
-      Double32_t *ampFracArrayPtr = new Double32_t[caloClusterStructPtr->fNCells];
+     Double32_t *ampFracArrayPtr = new Double32_t[caloClusterStructPtr->fNCells];
+      
       for(UInt_t index = 0; index < caloClusterStructPtr->fNCells; index++)
        {
-         //      fClusterReaderPtr->GetCell(caloClusterStructPtr, idArrayPtr[index], ampFracArrayPtr[index], index);
+           fClusterReaderPtr->GetCell(caloClusterStructPtr, idArrayPtr[index], ampFracArrayPtr[index], index);
+           //printf("EM: cellId: %d\n", idArrayPtr[index]);;
        }
-      //      esdCluster.SetCellsAbsId(idArrayPtr);
-      //      esdCluster.SetCellsAmplitudeFraction(ampFracArrayPtr);
-
+      esdCluster.SetCellsAbsId(idArrayPtr);
+      esdCluster.SetCellsAmplitudeFraction(ampFracArrayPtr);
+#ifndef HAVE_NOT_ALIESDCALOCLUSTER_r38477
+      // this is to ensure compilation with the v4-18-Release branch for the moment
+      // until the changes of AliESDCaloCluster have been ported
+      esdCluster.SetTrackDistance(caloClusterStructPtr->fTrackDx, caloClusterStructPtr->fTrackDz);
+#endif //HAVE_NOT_ALIESDCALOCLUSTER_r38477
+   
+      delete [] idArrayPtr;
+      delete [] ampFracArrayPtr;
+//      idArrayPtr = 0;
+      //ampFracArrayPtr = 0;
+      
       esdPtr->AddCaloCluster(&esdCluster);
+      //printf("EM: Energy: %f\n", esdCluster.E());
       nClusters++;
     }
   return nClusters;