]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliESDCaloCluster.cxx
recMC.C submitMC.sh
[u/mrichter/AliRoot.git] / STEER / AliESDCaloCluster.cxx
index 3c3bc9f9c8d2016b50d314ab781a73a33e2ac208..4c411ae4947a966844e701aaa118c195f622d97c 100644 (file)
@@ -45,12 +45,11 @@ AliESDCaloCluster::AliESDCaloCluster() :
   fChi2(0),
   fM20(0),
   fM02(0),
-  fM11(0),
   fEmcCpvDistance(1024),
   fDistToBadChannel(1024),
   fID(0),
   fNExMax(0),
-  fClusterType(kUndef)
+  fClusterType(kUndef), fTOF(0.)
 {
   //
   // The default ESD constructor 
@@ -75,12 +74,12 @@ AliESDCaloCluster::AliESDCaloCluster(const AliESDCaloCluster& clus) :
   fChi2(clus.fChi2),
   fM20(clus.fM20),
   fM02(clus.fM02),
-  fM11(clus.fM11),
   fEmcCpvDistance(clus.fEmcCpvDistance),
   fDistToBadChannel(clus.fDistToBadChannel),
   fID(clus.fID),
   fNExMax(clus.fNExMax),
-  fClusterType(clus.fClusterType)
+  fClusterType(clus.fClusterType),
+  fTOF(clus.fTOF)
 {
   //
   // The copy constructor 
@@ -116,18 +115,15 @@ AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source)
 
   if(&source == this) return *this;
   TObject::operator=(source);
-
   fGlobalPos[0] = source.fGlobalPos[0];
   fGlobalPos[1] = source.fGlobalPos[1];
   fGlobalPos[2] = source.fGlobalPos[2];
 
-
   fEnergy = source.fEnergy;
   fDispersion = source.fDispersion;
   fChi2 = source.fChi2;
   fM20 = source.fM20;
   fM02 = source.fM02;
-  fM11 = source.fM11;
   fEmcCpvDistance = source.fEmcCpvDistance;
   fDistToBadChannel = source.fDistToBadChannel ;
   for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = source.fPID[i];
@@ -137,17 +133,18 @@ AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source)
 
   if (source.fNCells > 0) {
     if(source.fCellsAbsId){
-      if(fNCells != source.fNCells){
-       delete [] fCellsAbsId;
+      if(fNCells != source.fNCells||!fCellsAbsId){
+       if(fCellsAbsId)delete [] fCellsAbsId;
        fCellsAbsId = new UShort_t[source.fNCells];
       }
-      for (Int_t i=0; i<source.fNCells; i++)
+      for (Int_t i=0; i<source.fNCells; i++){
        fCellsAbsId[i]=source.fCellsAbsId[i];
+      }
     }
     
     if(source.fCellsAmpFraction){
-      if(fNCells != source.fNCells){
-       delete [] fCellsAmpFraction;
+      if(fNCells != source.fNCells||!fCellsAmpFraction){
+       if(fCellsAmpFraction) delete [] fCellsAmpFraction;
        fCellsAmpFraction = new Double32_t[source.fNCells];
       }
       for (Int_t i=0; i<source.fNCells; i++)
@@ -157,25 +154,30 @@ AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source)
 
   fNExMax = source.fNExMax;
   fClusterType = source.fClusterType;
+  fTOF = source.fTOF;
 
   //not in use
   if(source.fTracksMatched){
     // assign or copy construct
-    if(fTracksMatched) *fTracksMatched = *source.fTracksMatched;
+    if(fTracksMatched){
+      *fTracksMatched = *source.fTracksMatched;
+    }
     else fTracksMatched = new TArrayI(*source.fTracksMatched);
   }
   else{
-    delete fTracksMatched;
+    if(fTracksMatched)delete fTracksMatched;
     fTracksMatched = 0;
   }
 
   if(source.fLabels){
     // assign or copy construct
-    if(fLabels) *fLabels = *source.fLabels;
+    if(fLabels){ 
+      *fLabels = *source.fLabels;
+    }
     else fLabels = new TArrayI(*source.fLabels);
   }
   else{
-    delete fLabels;
+    if(fLabels)delete fLabels;
     fLabels = 0;
   }
 
@@ -184,7 +186,7 @@ AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source)
     // assign or copy construct
     if(fDigitAmplitude) *fDigitAmplitude = *source.fDigitAmplitude;
     else fDigitAmplitude = new TArrayS(*source.fDigitAmplitude);
-  }
+   }
   else{
     delete fDigitAmplitude;
     fDigitAmplitude = 0;
@@ -236,13 +238,13 @@ AliESDCaloCluster::~AliESDCaloCluster(){
   //
   // This is destructor according Coding Conventions 
   //
-  delete fTracksMatched;
-  delete fLabels;
+  if(fTracksMatched)delete fTracksMatched;fTracksMatched = 0;
+  if(fLabels) delete fLabels; fLabels = 0;
   delete fDigitAmplitude;  //not in use
   delete fDigitTime;  //not in use
   delete fDigitIndex;  //not in use
-  if(fCellsAmpFraction) delete[] fCellsAmpFraction; fCellsAmpFraction=0;
-  if(fCellsAbsId) delete[] fCellsAbsId;  fCellsAbsId = 0;
+  if(fCellsAmpFraction){ delete[] fCellsAmpFraction; fCellsAmpFraction=0;}
+  if(fCellsAbsId){ delete[] fCellsAbsId;  fCellsAbsId = 0;}
 }
 
 //_______________________________________________________________________
@@ -297,3 +299,23 @@ void AliESDCaloCluster::GetMomentum(TLorentzVector& p, Double_t *vertex ) {
   p.SetPxPyPzE( fEnergy*fGlobalPos[0]/r,  fEnergy*fGlobalPos[1]/r,  fEnergy*fGlobalPos[2]/r,  fEnergy) ; 
   
 }
+
+//_______________________________________________________________________
+void  AliESDCaloCluster::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];
+    }
+}
+
+//_______________________________________________________________________
+void  AliESDCaloCluster::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];
+    }
+}