]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliAODCaloCluster.cxx
New more general analysis implemention for particle identification and correlation...
[u/mrichter/AliRoot.git] / STEER / AliAODCaloCluster.cxx
index 260fab57791f232fffe4b19cb84b4a5000c4360f..f9d6efa03e314af19eff3cf11d700390824def99 100644 (file)
@@ -20,6 +20,7 @@
 //     Author: Markus Oldenburg, CERN
 //-------------------------------------------------------------------------
 
+#include <TLorentzVector.h>
 #include "AliAODCaloCluster.h"
 
 ClassImp(AliAODCaloCluster)
@@ -30,13 +31,14 @@ AliAODCaloCluster::AliAODCaloCluster() :
   fDistToBadChannel(-999.),
   fDispersion(-1),
   fM20(0.),
-  fM01(0.),
   fM02(0.),
-  fM11(0.),
   fEmcCpvDistance(-999.),
-  fNExMax(0),
+  fNExMax(0), 
+  fTOF(0.),
   fTracksMatched(),
-  fCellNumber()
+  fNCells(0),
+  fCellsAbsId(),
+  fCellsAmpFraction()
 {
   // default constructor
 
@@ -48,20 +50,21 @@ AliAODCaloCluster::AliAODCaloCluster(Int_t id,
                                     Int_t *label, 
                                     Double_t energy,
                                     Double_t x[3],
-                                    Double_t pid[9],
+                                    Double_t pid[13],
                                     Char_t ttype,
                                     UInt_t selectInfo) :
   AliAODCluster(id, nLabel, label, energy, x, pid, ttype, selectInfo),
   fDistToBadChannel(-999.),
   fDispersion(-1),
   fM20(0.),
-  fM01(0.),
   fM02(0.),
-  fM11(0.),
   fEmcCpvDistance(-999.),
   fNExMax(0),
+  fTOF(0.),
   fTracksMatched(),
-  fCellNumber()
+  fNCells(0),
+  fCellsAbsId(),
+  fCellsAmpFraction()
 {
   // constructor
 
@@ -73,20 +76,21 @@ AliAODCaloCluster::AliAODCaloCluster(Int_t id,
                                     Int_t *label, 
                                     Float_t energy,
                                     Float_t x[3],
-                                    Float_t pid[9],
+                                    Float_t pid[13],
                                     Char_t ttype,
                                     UInt_t selectInfo) :
   AliAODCluster(id, nLabel, label, energy, x, pid, ttype, selectInfo),
   fDistToBadChannel(-999.),
   fDispersion(-1),
   fM20(0.),
-  fM01(0.),
   fM02(0.),
-  fM11(0.),
   fEmcCpvDistance(-999.),
   fNExMax(0),
+  fTOF(0.),
   fTracksMatched(),
-  fCellNumber()
+  fNCells(0),
+  fCellsAbsId(),
+  fCellsAmpFraction()
 {
   // constructor
 }
@@ -96,6 +100,8 @@ AliAODCaloCluster::AliAODCaloCluster(Int_t id,
 AliAODCaloCluster::~AliAODCaloCluster() 
 {
   // destructor
+  if(fCellsAmpFraction) delete[] fCellsAmpFraction; fCellsAmpFraction=0;
+  if(fCellsAbsId) delete[] fCellsAbsId;  fCellsAbsId = 0;
 }
 
 
@@ -105,15 +111,33 @@ AliAODCaloCluster::AliAODCaloCluster(const AliAODCaloCluster& clus) :
   fDistToBadChannel(clus.fDistToBadChannel),
   fDispersion(clus.fDispersion),
   fM20(clus.fM20),
-  fM01(clus.fM01),
   fM02(clus.fM02),
-  fM11(clus.fM11),
   fEmcCpvDistance(clus.fEmcCpvDistance),
   fNExMax(clus.fNExMax),
+  fTOF(clus.fTOF),
   fTracksMatched(clus.fTracksMatched),
-  fCellNumber(clus.fCellNumber)
+  fNCells(clus.fNCells),
+  fCellsAbsId(),
+  fCellsAmpFraction()
 {
   // Copy constructor
+
+  if (clus.fNCells > 0) {
+    
+    if(clus.fCellsAbsId){
+      fCellsAbsId = new UShort_t[clus.fNCells];
+      for (Int_t i=0; i<clus.fNCells; i++)
+       fCellsAbsId[i]=clus.fCellsAbsId[i];
+    }
+    
+    if(clus.fCellsAmpFraction){
+      fCellsAmpFraction = new Double32_t[clus.fNCells];
+      for (Int_t i=0; i<clus.fNCells; i++)
+       fCellsAmpFraction[i]=clus.fCellsAmpFraction[i];
+    }
+    
+  }
+  
 }
 
 //______________________________________________________________________________
@@ -127,13 +151,29 @@ AliAODCaloCluster& AliAODCaloCluster::operator=(const AliAODCaloCluster& clus)
     fDistToBadChannel = clus.fDistToBadChannel;
     fDispersion = clus.fDispersion;
     fM20 = clus.fM20;
-    fM01 = clus.fM01;
     fM02 = clus.fM02;
-    fM11 = clus.fM11;
     fEmcCpvDistance = clus.fEmcCpvDistance;
     fNExMax = clus.fNExMax;
+    fTOF = clus.fTOF;
     fTracksMatched = clus.fTracksMatched;
-    fCellNumber = clus.fCellNumber;
+
+    fNCells= clus. fNCells;
+    if (clus.fNCells > 0) {
+      
+      if(clus.fCellsAbsId){
+       fCellsAbsId = new UShort_t[clus.fNCells];
+       for (Int_t i=0; i<clus.fNCells; i++)
+         fCellsAbsId[i]=clus.fCellsAbsId[i];
+      }
+      
+      if(clus.fCellsAmpFraction){
+       fCellsAmpFraction = new Double32_t[clus.fNCells];
+       for (Int_t i=0; i<clus.fNCells; i++)
+         fCellsAmpFraction[i]=clus.fCellsAmpFraction[i];
+      }
+      
+    }
+
   }
 
   return *this;
@@ -150,3 +190,47 @@ Bool_t AliAODCaloCluster::HasTrackMatched(TObject *trk) const
   }
   return kFALSE;
 }
+
+//_______________________________________________________________________
+void AliAODCaloCluster::GetMomentum(TLorentzVector& p, Double_t *vertex ) {
+  // Returns TLorentzVector with momentum of the cluster. Only valid for clusters 
+  // identified as photons or pi0 (overlapped gamma) produced on the vertex
+  //Vertex can be recovered with esd pointer doing:  
+  //" Double_t vertex[3] ; esd->GetVertex()->GetXYZ(vertex) ; "
+
+  Double32_t energy = E();
+  Double32_t pos[3];
+  GetPosition(pos);
+  
+  if(vertex){//calculate direction from vertex
+    pos[0]-=vertex[0];
+    pos[1]-=vertex[1];
+    pos[2]-=vertex[2];
+  }
+  
+  Double_t r = TMath::Sqrt(pos[0]*pos[0]+
+                          pos[1]*pos[1]+
+                          pos[2]*pos[2]   ) ; 
+  
+  p.SetPxPyPzE( energy*pos[0]/r,  energy*pos[1]/r,  energy*pos[2]/r,  energy) ; 
+  
+}
+
+
+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];
+    }
+}
+
+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];
+    }
+}