]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- Names of methods GetClusterEnergy(), GetGlobalPosition(), GetPrimaryIndex(),...
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 11 Jun 2007 20:36:31 +0000 (20:36 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 11 Jun 2007 20:36:31 +0000 (20:36 +0000)
 - The  Int_t* or UShort_t* arrays  that we had, have been changed into TArrayS*, for example, all the Digits arrays, have been translated into TArrayS.
 - Now there will we only one data member which contains the MC information, instead of the previous 3, a TArrayS whose first element is the MC particle which deposited more energy (this is not true for PHOS, I have asked Yuri to update the code to order the list entries as a function of the deposited energy)
- Same functionality for the track matching as for the fLabels

Gustavo

STEER/AliESDCaloCluster.cxx
STEER/AliESDCaloCluster.h

index 74ce659a60a6fd36b3904e3451ab9df2d11a25fd..f7bae2b262098701dd909c243e95cf1c593ec7e8 100644 (file)
@@ -35,20 +35,17 @@ AliESDCaloCluster::AliESDCaloCluster() :
   fClusterType(-1),
   fEMCALCluster(kFALSE),
   fPHOSCluster(kFALSE),
-  fTrackMatched(-1),
   fEnergy(-1),
   fDispersion(-1),
   fChi2(-1),
-  fPrimaryIndex(-1),
   fM20(0),
   fM02(0),
   fM11(0),
   fNExMax(0),
   fEmcCpvDistance(9999),
   fDistToBadChannel(9999),
-  fNumberOfPrimaries(-1),
-  fListOfPrimaries(0x0),
-  fNumberOfDigits(0),
+  fTracksMatched(0x0),
+  fLabels(0x0),
   fDigitAmplitude(0x0),
   fDigitTime(0x0),
   fDigitIndex(0x0)
@@ -67,23 +64,20 @@ AliESDCaloCluster::AliESDCaloCluster(const AliESDCaloCluster& clus) :
   fClusterType(clus.fClusterType),
   fEMCALCluster(clus.fEMCALCluster),
   fPHOSCluster(clus.fPHOSCluster),
-  fTrackMatched(clus.fTrackMatched),
   fEnergy(clus.fEnergy),
   fDispersion(clus.fDispersion),
   fChi2(clus.fChi2),
-  fPrimaryIndex(clus.fPrimaryIndex),
   fM20(clus.fM20),
   fM02(clus.fM02),
   fM11(clus.fM11),
   fNExMax(clus.fNExMax),
   fEmcCpvDistance(clus.fEmcCpvDistance),
   fDistToBadChannel(clus.fDistToBadChannel),
-  fNumberOfPrimaries(clus.fNumberOfPrimaries),
-  fListOfPrimaries(0x0),
-  fNumberOfDigits(clus.fNumberOfDigits),
-  fDigitAmplitude(0x0),
-  fDigitTime(0x0),
-  fDigitIndex(0x0)
+  fTracksMatched(clus.fTracksMatched),
+  fLabels(clus.fLabels),
+  fDigitAmplitude(clus.fDigitAmplitude),
+  fDigitTime(clus.fDigitTime),
+  fDigitIndex(clus.fDigitIndex)
 {
   //
   // The copy constructor 
@@ -94,28 +88,6 @@ AliESDCaloCluster::AliESDCaloCluster(const AliESDCaloCluster& clus) :
 
   for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = clus.fPID[i];
 
-  if (clus.fNumberOfDigits > 0) {
-    if (clus.fDigitAmplitude) {
-      fDigitAmplitude = new UShort_t[clus.fNumberOfDigits];
-      for (Int_t i=0; i<clus.fNumberOfDigits; i++)
-       fDigitAmplitude[i]=clus.fDigitAmplitude[i];
-    }
-    if (clus.fDigitTime) {
-      fDigitTime = new UShort_t[clus.fNumberOfDigits];
-      for (Int_t i=0; i<clus.fNumberOfDigits; i++)
-       fDigitTime[i]=clus.fDigitTime[i];
-    }
-    if (clus.fDigitIndex) {
-      fDigitIndex = new UShort_t[clus.fNumberOfDigits];
-      for (Int_t i=0; i<clus.fNumberOfDigits; i++)
-       fDigitIndex[i]=clus.fDigitIndex[i];
-    }
-   if (clus.fListOfPrimaries) {
-      fListOfPrimaries = new UShort_t[clus.fNumberOfPrimaries];
-      for (Int_t i=0; i<clus.fNumberOfPrimaries; i++)
-       fListOfPrimaries[i]=clus.fListOfPrimaries[i];
-    }
-  }
 }
 
 //_______________________________________________________________________
@@ -129,24 +101,15 @@ AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source)
   fClusterType = source.fClusterType;
   fEMCALCluster = source.fEMCALCluster;
   fPHOSCluster = source.fPHOSCluster;
-  fTrackMatched = source.fTrackMatched;
   fEnergy = source.fEnergy;
   fDispersion = source.fDispersion;
   fChi2 = source.fChi2;
-  fPrimaryIndex = source.fPrimaryIndex;
   fM20 = source.fM20;
   fM02 = source.fM02;
   fM11 = source.fM11;
   fNExMax = source.fNExMax;
   fEmcCpvDistance = source.fEmcCpvDistance;
   fDistToBadChannel = source.fDistToBadChannel ;
-  fNumberOfPrimaries = source.fNumberOfPrimaries;
-  delete fListOfPrimaries; fListOfPrimaries=0x0;
-
-  fNumberOfDigits = source.fNumberOfDigits;
-  delete fDigitAmplitude; fDigitAmplitude=0x0;
-  delete fDigitTime; fDigitTime = 0x0;
-  delete fDigitIndex; fDigitIndex = 0x0;
 
   fGlobalPos[0] = source.fGlobalPos[0];
   fGlobalPos[1] = source.fGlobalPos[1];
@@ -154,28 +117,12 @@ AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source)
 
   for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = source.fPID[i];
 
-  if (source.fNumberOfDigits > 0) {
-    if (source.fDigitAmplitude) {
-      fDigitAmplitude = new UShort_t[source.fNumberOfDigits];
-      for (Int_t i=0; i<source.fNumberOfDigits; i++)
-       fDigitAmplitude[i]=source.fDigitAmplitude[i];
-    }
-    if (source.fDigitTime) {
-      fDigitTime = new UShort_t[source.fNumberOfDigits];
-      for (Int_t i=0; i<source.fNumberOfDigits; i++)
-       fDigitTime[i]=source.fDigitTime[i];
-    }
-    if (source.fDigitIndex) {
-      fDigitIndex = new UShort_t[source.fNumberOfDigits];
-      for (Int_t i=0; i<source.fNumberOfDigits; i++)
-       fDigitIndex[i]=source.fDigitIndex[i];
-    }
-   if (source.fListOfPrimaries) {
-      fListOfPrimaries = new UShort_t[source.fNumberOfPrimaries];
-      for (Int_t i=0; i<source.fNumberOfPrimaries; i++)
-       fListOfPrimaries[i]=source.fListOfPrimaries[i];
-    }
-  }
+  fTracksMatched = source.fTracksMatched;
+  fLabels = source.fLabels;
+  fDigitAmplitude = source.fDigitAmplitude;
+  fDigitTime = source.fDigitTime;
+  fDigitIndex = source.fDigitIndex;
+
 
   return *this;
 
@@ -185,14 +132,13 @@ AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source)
 //_______________________________________________________________________
 AliESDCaloCluster::~AliESDCaloCluster(){ 
   //
-  // This is destructor according Coding Conventrions 
+  // This is destructor according Coding Conventions 
   //
-  // AliESDCaloCluster is the owner of the arrays
-  // even if they are created outside
-  delete[] fListOfPrimaries;
-  delete[] fDigitAmplitude;
-  delete[] fDigitTime;
-  delete[] fDigitIndex;
+  delete fTracksMatched;
+  delete fLabels;
+  delete fDigitAmplitude;
+  delete fDigitTime;
+  delete fDigitIndex;
 
 }
 
@@ -229,9 +175,17 @@ void AliESDCaloCluster::SetPid(const Float_t *p) {
 }
 
 //_______________________________________________________________________
-void AliESDCaloCluster::GetMomentum(TLorentzVector& p) {
+void AliESDCaloCluster::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) ; "
+
+  if(vertex){//calculate direction from vertex
+    fGlobalPos[0]-=vertex[0];
+    fGlobalPos[1]-=vertex[1];
+    fGlobalPos[2]-=vertex[2];
+  }
   
   Double_t r = TMath::Sqrt(fGlobalPos[0]*fGlobalPos[0]+
                            fGlobalPos[1]*fGlobalPos[1]+
index 771c987350d491fd9c48556b11355c916b5f6613..2e18ad4acfb8cdcdd3d8c33e98b8261ed5464644 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <TObject.h>
 #include "AliPID.h"
+#include "TArrayS.h"
 
 class TLorentzVector;
 
@@ -44,18 +45,15 @@ public:
   void SetPHOS(Bool_t phos) { fPHOSCluster = phos;}
   Bool_t IsPHOS() const {return fPHOSCluster;}
 
-  void SetTrackMatchedIndex(Int_t match) { fTrackMatched = match;}
-  Int_t GetTrackMatchedIndex() const {return fTrackMatched;}
-
-  void SetGlobalPosition(const Float_t *pos) {
+  void SetPosition(const Float_t *pos) {
     fGlobalPos[0] = pos[0]; fGlobalPos[1] = pos[1]; fGlobalPos[2] = pos[2];
   }
-  void GetGlobalPosition(Float_t *pos) const {
+  void GetPosition(Float_t *pos) const {
     pos[0] = fGlobalPos[0]; pos[1] = fGlobalPos[1]; pos[2] = fGlobalPos[2];
   }
 
-  void SetClusterEnergy(Float_t ene) { fEnergy = ene;}
-  Float_t GetClusterEnergy() const   { return fEnergy;}
+  void SetE(Float_t ene) { fEnergy = ene;}
+  Float_t E() const   { return fEnergy;}
 
   void SetClusterDisp(Float_t disp)  { fDispersion = disp; }
   Float_t GetClusterDisp() const     { return fDispersion; }
@@ -66,9 +64,6 @@ public:
   void SetPid(const Float_t *p);
   Float_t *GetPid() {return fPID;}
 
-  void SetPrimaryIndex(Int_t primary)     { fPrimaryIndex = primary; }
-  Int_t GetPrimaryIndex() const           { return fPrimaryIndex; }
-
   void SetM20(Float_t m20)                { fM20 = m20; }
   Float_t GetM20() const                  { return fM20; }
 
@@ -87,25 +82,34 @@ public:
   void SetDistanceToBadChannel(Float_t dist) {fDistToBadChannel=dist;}
   Float_t GetDistanceToBadChannel() const {return fDistToBadChannel;}
 
-  void SetNumberOfPrimaries(Int_t nprim)      { fNumberOfPrimaries = nprim; }
-  Int_t GetNumberOfPrimaries() const         { return fNumberOfPrimaries; }
-  
-  void SetListOfPrimaries(UShort_t *prim)       { fListOfPrimaries = prim;}
-  UShort_t *GetListOfPrimaries() const          { return fListOfPrimaries;}
-  
-  void SetNumberOfDigits(Int_t ndig)      { fNumberOfDigits = ndig; }
-  Int_t GetNumberOfDigits() const         { return fNumberOfDigits; }
-  
-  void SetDigitAmplitude(UShort_t *adc)   { fDigitAmplitude = adc;}
-  UShort_t *GetDigitAmplitude() const     { return fDigitAmplitude;}
-
-  void SetDigitTime(UShort_t *time)       { fDigitTime = time;}
-  UShort_t *GetDigitTime() const          { return fDigitTime;}
-
-  void SetDigitIndex(UShort_t *digit)     { fDigitIndex = digit;}
-  UShort_t *GetDigitIndex() const         { return fDigitIndex; }
-
-  void GetMomentum(TLorentzVector& p);
+  void AddTracksMatched(TArrayS & array)  { fTracksMatched   = new TArrayS(array) ; }
+  void AddLabels(TArrayS & array)         { fLabels = new TArrayS(array) ; }
+  void AddDigitAmplitude(TArrayS & array) { fDigitAmplitude   = new TArrayS(array) ; }
+  void AddDigitTime(TArrayS & array)      { fDigitTime = new TArrayS(array) ; }
+  void AddDigitIndex(TArrayS & array)     { fDigitIndex   = new TArrayS(array) ; }
+
+  TArrayS * GetTracksMatched() const  {return  fTracksMatched;}
+  TArrayS * GetLabels() const         {return  fLabels;}
+  TArrayS * GetDigitAmplitude() const {return  fDigitAmplitude;}
+  TArrayS * GetDigitTime() const      {return  fDigitTime;}
+  TArrayS * GetDigitIndex() const     {return  fDigitIndex;}
+  Int_t GetTrackMatched() const   
+  {if( fTracksMatched &&  fTracksMatched->GetSize() >0)  return  fTracksMatched->At(0); 
+    else return -1;} //Most likely the track associated to the cluster
+  Int_t GetLabel() const   
+  {if( fLabels &&  fLabels->GetSize() >0)  return  fLabels->At(0); 
+    else return -1;} //Most likely the track associated to the cluster
+
+
+  Int_t GetNTracksMatched() const {if (fTracksMatched) return  fTracksMatched->GetSize(); 
+    else return -1;}
+  Int_t GetNLabels() const        { if (fLabels) return  fLabels->GetSize(); 
+    else return -1;}
+  Int_t GetNumberOfDigits() const        { if (fDigitAmplitude) return  fDigitAmplitude->GetSize(); 
+    else return -1;}
+  void GetMomentum(TLorentzVector& p, Double_t * vertexPosition );
 
 protected:
 
@@ -113,13 +117,11 @@ protected:
   Int_t     fClusterType;      // Flag for different clustering versions
   Bool_t    fEMCALCluster;     // Is this is an EMCAL cluster?
   Bool_t    fPHOSCluster;      // Is this is a PHOS cluster?
-  Int_t       fTrackMatched;      // Index of track to which the cluster belongs
   Float_t   fGlobalPos[3];     // position in global coordinate system
   Float_t   fEnergy;           // energy measured by calorimeter
   Float_t   fDispersion;       // cluster dispersion, for shape analysis
   Float_t   fChi2;             // chi2 of cluster fit
   Float_t   fPID[AliPID::kSPECIESN]; //"detector response probabilities" (for the PID)
-  Int_t     fPrimaryIndex;     // primary track number associated with this cluster
   Float_t   fM20;              // 2-nd moment along the main eigen axis
   Float_t   fM02;              // 2-nd moment along the second eigen axis
   Float_t   fM11;              // 2-nd mixed moment Mxy
@@ -127,18 +129,13 @@ protected:
   Float_t   fEmcCpvDistance;   // the distance from PHOS EMC rec.point to the closest CPV rec.point
  Float_t   fDistToBadChannel; // Distance to nearest bad channel
 
-  Int_t     fNumberOfPrimaries;   // number of primaries that generated the cluster
-  UShort_t*   fListOfPrimaries;   //[fNumberOfPrimaries] list of primaries that generated the cluster
-
-  Int_t     fNumberOfDigits;   // number of calorimeter digits in cluster
-                               // Very important! The streamer needs to
-                               // know how big these arrays are for
-                               // each event that is written out: 
-  UShort_t* fDigitAmplitude;   //[fNumberOfDigits] digit energy (integer units)
-  UShort_t* fDigitTime;        //[fNumberOfDigits] time of this digit (integer units)
-  UShort_t* fDigitIndex;       //[fNumberOfDigits] calorimeter digit index
+  TArrayS * fTracksMatched; //Index of tracks close to cluster. First entry is the most likely match.
+  TArrayS * fLabels;   //list of primaries that generated the cluster, ordered in deposited energy.
+  TArrayS * fDigitAmplitude;   //digit energy (integer units) 
+  TArrayS * fDigitTime;        //time of this digit (integer units) 
+  TArrayS * fDigitIndex;       //calorimeter digit index 
 
-  ClassDef(AliESDCaloCluster,2)  //ESDCaloCluster 
+  ClassDef(AliESDCaloCluster,3)  //ESDCaloCluster 
 };
 
 #endif