]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliAODCaloCluster.cxx
Update MC pt shape syst
[u/mrichter/AliRoot.git] / STEER / AliAODCaloCluster.cxx
index f9d6efa03e314af19eff3cf11d700390824def99..e04ab505e92f0d3401d4e5efdaedce286ea402a8 100644 (file)
@@ -37,8 +37,8 @@ AliAODCaloCluster::AliAODCaloCluster() :
   fTOF(0.),
   fTracksMatched(),
   fNCells(0),
-  fCellsAbsId(),
-  fCellsAmpFraction()
+  fCellsAbsId(0x0),
+  fCellsAmpFraction(0x0)
 {
   // default constructor
 
@@ -63,8 +63,8 @@ AliAODCaloCluster::AliAODCaloCluster(Int_t id,
   fTOF(0.),
   fTracksMatched(),
   fNCells(0),
-  fCellsAbsId(),
-  fCellsAmpFraction()
+  fCellsAbsId(0x0),
+  fCellsAmpFraction(0x0)
 {
   // constructor
 
@@ -89,8 +89,8 @@ AliAODCaloCluster::AliAODCaloCluster(Int_t id,
   fTOF(0.),
   fTracksMatched(),
   fNCells(0),
-  fCellsAbsId(),
-  fCellsAmpFraction()
+  fCellsAbsId(0x0),
+  fCellsAmpFraction(0x0)
 {
   // constructor
 }
@@ -101,9 +101,17 @@ AliAODCaloCluster::~AliAODCaloCluster()
 {
   // destructor
   if(fCellsAmpFraction) delete[] fCellsAmpFraction; fCellsAmpFraction=0;
-  if(fCellsAbsId) delete[] fCellsAbsId;  fCellsAbsId = 0;
+  if(fCellsAbsId)       delete[] fCellsAbsId;       fCellsAbsId = 0;
 }
 
+//______________________________________________________________________________
+void AliAODCaloCluster::Clear(const Option_t*) 
+{
+  // clear
+  RemoveLabel();
+  if(fCellsAmpFraction) delete[] fCellsAmpFraction; fCellsAmpFraction=0;
+  if(fCellsAbsId)       delete[] fCellsAbsId;       fCellsAbsId = 0;
+}
 
 //______________________________________________________________________________
 AliAODCaloCluster::AliAODCaloCluster(const AliAODCaloCluster& clus) :
@@ -117,8 +125,8 @@ AliAODCaloCluster::AliAODCaloCluster(const AliAODCaloCluster& clus) :
   fTOF(clus.fTOF),
   fTracksMatched(clus.fTracksMatched),
   fNCells(clus.fNCells),
-  fCellsAbsId(),
-  fCellsAmpFraction()
+  fCellsAbsId(0x0),
+  fCellsAmpFraction(0x0)
 {
   // Copy constructor
 
@@ -158,6 +166,10 @@ AliAODCaloCluster& AliAODCaloCluster::operator=(const AliAODCaloCluster& clus)
     fTracksMatched = clus.fTracksMatched;
 
     fNCells= clus. fNCells;
+    // delete anyway 
+    if(fCellsAbsId)delete [] fCellsAbsId;
+    if(fCellsAmpFraction)delete [] fCellsAmpFraction;
+
     if (clus.fNCells > 0) {
       
       if(clus.fCellsAbsId){
@@ -199,7 +211,7 @@ void AliAODCaloCluster::GetMomentum(TLorentzVector& p, Double_t *vertex ) {
   //" Double_t vertex[3] ; esd->GetVertex()->GetXYZ(vertex) ; "
 
   Double32_t energy = E();
-  Double32_t pos[3];
+  Float_t    pos[3];
   GetPosition(pos);
   
   if(vertex){//calculate direction from vertex
@@ -221,8 +233,8 @@ void  AliAODCaloCluster::SetCellsAbsId(UShort_t *array)
 {
     //  Set the array of cell absId numbers 
     if (fNCells) {
-       fCellsAbsId = new  UShort_t[fNCells];
-       for (Int_t i = 0; i < fNCells; i++) fCellsAbsId[i] = array[i];
+      if(!fCellsAbsId)fCellsAbsId = new  UShort_t[fNCells];
+      for (Int_t i = 0; i < fNCells; i++) fCellsAbsId[i] = array[i];
     }
 }
 
@@ -230,7 +242,7 @@ void  AliAODCaloCluster::SetCellsAmplitudeFraction(Double32_t *array)
 {
     //  Set the array of cell amplitude fraction
     if (fNCells) {
-       fCellsAmpFraction = new  Double32_t[fNCells];
-       for (Int_t i = 0; i < fNCells; i++) fCellsAmpFraction[i] = array[i];
+      if(!fCellsAmpFraction)fCellsAmpFraction = new  Double32_t[fNCells];
+      for (Int_t i = 0; i < fNCells; i++) fCellsAmpFraction[i] = array[i];
     }
 }