]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliESDCaloCluster.h
Coverity 16571
[u/mrichter/AliRoot.git] / STEER / AliESDCaloCluster.h
index f221528abc8f9742a38e64dcb4eebb7edb166799..f7d21b110b1b0990d677e429951227fd635514d3 100644 (file)
 //     J.L. Klay (LLNL)
 //-------------------------------------------------------------------------
 
-#include <TObject.h>
+#include <AliVCluster.h>
 #include "AliPID.h"
 #include "TArrayS.h"
+#include "TArrayI.h"
+#include "AliLog.h"
 
 class TLorentzVector;
 
-class AliESDCaloCluster : public TObject {
-
-public:
-
+class AliESDCaloCluster : public AliVCluster 
+{
+  
+ public:
+  
   AliESDCaloCluster();
   AliESDCaloCluster(const AliESDCaloCluster& clus);
   AliESDCaloCluster & operator=(const AliESDCaloCluster& source);
   virtual ~AliESDCaloCluster();
+  virtual void Copy(TObject &) const;
+  void Clear(const Option_t*);
 
-  void SetID(Int_t id) {fID = id;}
+  void  SetID(Int_t id) {fID = id;}
   Int_t GetID() const {return fID;}
-
-  //similar to AliAODCluster but offset by one for
-  // backward comp. -1 was undefined, which only applied
-  // for PHOS clusters before
-  enum ESDClu_t {kUndef = -2, 
-                kPHOSCluster,
-                kEMCALPseudoCluster, 
-                kEMCALClusterv1};
-  void SetClusterType(Int_t type) { fClusterType = type; }
-  Char_t GetClusterType() const {return fClusterType; }
-
-  Bool_t IsEMCAL() const {return (fClusterType == kEMCALClusterv1||fClusterType == kEMCALPseudoCluster);}
-  Bool_t IsEMCALPseudo() {return (fClusterType == kEMCALPseudoCluster);}
-  Bool_t IsPHOS() const {return (fClusterType == kPHOSCluster);}
-
-  void SetPosition(const Float_t *pos) {
-    fGlobalPos[0] = pos[0]; fGlobalPos[1] = pos[1]; fGlobalPos[2] = pos[2];
+  
+  void   SetType(Char_t type) { fClusterType = type; }
+  Char_t GetType() const {return fClusterType; }
+  
+  Bool_t IsEMCAL() const {if(fClusterType == kEMCALClusterv1) return kTRUE; else return kFALSE;}
+  Bool_t IsPHOS()  const {if(fClusterType == kPHOSNeutral || fClusterType == kPHOSCharged) return kTRUE;
+    else return kFALSE;}
+  
+  void GetPosition  (Float_t *x) const {
+    x[0]=fGlobalPos[0]; x[1]=fGlobalPos[1]; x[2]=fGlobalPos[2];}
+  void SetPosition  (Float_t *x);
+  void SetPositionAt(Float_t pos, Int_t ipos) {if(ipos>=0 && ipos<3) fGlobalPos[ipos] = pos ; 
+    else AliInfo(Form("Bad index for position array, i = %d\n",ipos));}
+  
+  void  SetE(Double_t ene) { fEnergy = ene;}
+  Double_t E() const       { return fEnergy;}
+  
+  void     SetDispersion(Double_t disp)  { fDispersion = disp; }
+  Double_t GetDispersion() const         { return fDispersion; }
+  
+  void  SetChi2(Double_t chi2)  { fChi2 = chi2; }
+  Double_t Chi2() const         { return fChi2; }
+  
+  const Double_t *GetPID() const { return fPID; }
+  //for(Int_t i=0; i<AliPID::kSPECIESN; ++i) pid[i]=fPID[i];}
+  void SetPID  (const Float_t *pid) ;
+  void SetPIDAt(Float_t p, Int_t i) {if(i>=0 && i<AliPID::kSPECIESN) fPID[i] = p ; 
+    else AliInfo(Form("Bad index for PID array, i = %d \n",i));}
+  
+  void     SetM20(Double_t m20) { fM20 = m20; }
+  Double_t GetM20() const       { return fM20; }
+  
+  void     SetM02(Double_t m02) { fM02 = m02; }
+  Double_t GetM02() const       { return fM02; }
+  
+  void    SetNExMax(UChar_t nExMax) { fNExMax = nExMax; }
+  UChar_t GetNExMax() const         { return fNExMax; }
+  
+  void SetEmcCpvDistance(Double_t dEmcCpv) { fEmcCpvDistance = dEmcCpv; }
+  Double_t GetEmcCpvDistance() const       { return fEmcCpvDistance; }
+  void SetTrackDistance(Double_t dx, Double_t dz){fTrackDx=dx; fTrackDz=dz;}
+  Double_t GetTrackDx(void)const {return fTrackDx;}
+  Double_t GetTrackDz(void)const {return fTrackDz;}
+  
+  void     SetDistanceToBadChannel(Double_t dist) {fDistToBadChannel=dist;}
+  Double_t GetDistanceToBadChannel() const        {return fDistToBadChannel;}
+  
+  void     SetTOF(Double_t tof) { fTOF = tof; }
+  Double_t GetTOF() const       { return fTOF; }
+  
+  void AddTracksMatched(TArrayI & array)  { 
+    if(!fTracksMatched)fTracksMatched   = new TArrayI(array);
+    else *fTracksMatched = array;
   }
-  void GetPosition(Float_t *pos) const {
-    pos[0] = fGlobalPos[0]; pos[1] = fGlobalPos[1]; pos[2] = fGlobalPos[2];
+  void AddLabels(TArrayI & array)         { 
+    if(!fLabels)fLabels = new TArrayI(array) ; 
+    else *fLabels = array;
   }
+  
+  TArrayI * GetTracksMatched() const  {return  fTracksMatched;}
+  TArrayI * GetLabelsArray() const    {return  fLabels;}
+  Int_t   * GetLabels() const         {return  fLabels->GetArray();}
 
-  void SetE(Float_t ene) { fEnergy = ene;}
-  Double_t E() const   { return fEnergy;}
-
-  void SetClusterDisp(Float_t disp)  { fDispersion = disp; }
-  Double_t GetClusterDisp() const     { return fDispersion; }
-
-  void SetClusterChi2(Float_t chi2)  { fChi2 = chi2; }
-  Double_t GetClusterChi2() const     { return fChi2; }
-
-  void SetPid(const Float_t *p);
-  Double_t *GetPid() {return fPID;}
-
-  void SetM20(Float_t m20)                { fM20 = m20; }
-  Double_t GetM20() const                  { return fM20; }
-
-  void SetM02(Float_t m02)                { fM02 = m02; }
-  Double_t GetM02() const                  { return fM02; }
-
-  void SetM11(Float_t m11)                { fM11 = m11; }
-  Double_t GetM11() const                  { return fM11; }
-
-  void SetNExMax(UChar_t nExMax)         { fNExMax = nExMax; }
-  UChar_t GetNExMax() const              { return fNExMax; }
-
-  void SetEmcCpvDistance(Float_t dEmcCpv) { fEmcCpvDistance = dEmcCpv; }
-  Double_t GetEmcCpvDistance() const       { return fEmcCpvDistance; }
-
-  void SetDistanceToBadChannel(Float_t dist) {fDistToBadChannel=dist;}
-  Double_t GetDistanceToBadChannel() const {return fDistToBadChannel;}
-
-  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   
+  Int_t GetTrackMatchedIndex() 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); 
+  
+  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(); 
+  Int_t GetLabelAt(UInt_t i) const {
+    if (fLabels && i < (UInt_t)fLabels->GetSize()) return fLabels->At(i);
+    else return -999; }
+  
+  Int_t GetNTracksMatched() const { if (fTracksMatched) return  fTracksMatched->GetSize(); 
     else return -1;}
-  Int_t GetNLabels() const        { if (fLabels) return  fLabels->GetSize(); 
+  UInt_t GetNLabels() const       { if (fLabels) return  fLabels->GetSize(); 
+    else return (0);}
+  
+  void GetMomentum(TLorentzVector& p, Double_t * vertexPosition );
+  
+  void  SetNCells(Int_t n)  { fNCells = n;}
+  Int_t GetNCells() const   { return fNCells;}
+  
+  void      SetCellsAbsId(UShort_t *array) ;
+  UShort_t *GetCellsAbsId() {return  fCellsAbsId;}
+  
+  void        SetCellsAmplitudeFraction(Double32_t *array) ;
+  Double32_t *GetCellsAmplitudeFraction() {return  fCellsAmpFraction;}
+  
+  Int_t GetCellAbsId(Int_t i) const {  
+    if (fCellsAbsId && i >=0 && i < fNCells ) return fCellsAbsId[i];    
     else return -1;}
-  Int_t GetNumberOfDigits() const        { if (fDigitAmplitude) return  fDigitAmplitude->GetSize(); 
+  
+  Double_t GetCellAmplitudeFraction(Int_t i) const {  
+    if (fCellsAmpFraction && i >=0 && i < fNCells ) return fCellsAmpFraction[i];    
     else return -1;}
-  void GetMomentum(TLorentzVector& p, Double_t * vertexPosition );
-  // Sep 7, 2007
-  Int_t    GetTrueDigitAmplitude(Int_t i, Double_t cc);
-  Double_t GetTrueDigitEnergy(Int_t i, Double_t cc);
-  Double_t GetRecalibratedDigitEnergy(Int_t i, Double_t ccOld, Double_t ccNew);
-
-protected:
-
-  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 
-
-
+  
+ protected:
+  
+  TArrayI * fTracksMatched; //Index of tracks close to cluster. First entry is the most likely match.
+  TArrayI * fLabels;        //list of primaries that generated the cluster, ordered in deposited energy.
+  
+  Int_t        fNCells ;
+  UShort_t   * fCellsAbsId;       //[fNCells] array of cell absId numbers
+  Double32_t * fCellsAmpFraction; //[fNCells][0.,1.,16] array with cell amplitudes fraction.
+  
   Double32_t   fGlobalPos[3];     // position in global coordinate systemD
   Double32_t   fEnergy;           // energy measured by calorimeter
   Double32_t   fDispersion;       // cluster dispersion, for shape analysis
   Double32_t   fChi2;             // chi2 of cluster fi
   Double32_t   fM20;              // 2-nd moment along the main eigen axis
   Double32_t   fM02;              // 2-nd moment along the second eigen axis
-  Double32_t   fM11;              // 2-nd mixed moment Mxy
+  
   Double32_t   fEmcCpvDistance;   // the distance from PHOS EMC rec.point to the closest CPV rec.point
+  Double32_t   fTrackDx ;         // Distance to closest track in phi
+  Double32_t   fTrackDz ;         // Distance to closest track in z
+  
   Double32_t   fDistToBadChannel; // Distance to nearest bad channel
   Double32_t   fPID[AliPID::kSPECIESN]; //[0,1,8]"detector response  probabilities" (for the PID)
-  Int_t       fID;               // Unique Id of the cluster
-  UChar_t  fNExMax ;          // number of (Ex-)maxima before unfolding  
-  Char_t  fClusterType;      // Flag for different cluster type/versions
+  Int_t        fID;                // Unique Id of the cluster
+  UChar_t      fNExMax ;           // number of (Ex-)maxima before unfolding  
+  Char_t       fClusterType;       // Flag for different cluster type/versions
+  Double_t     fTOF;               //[0,0,12] time-of-flight
+  
+  
+  ClassDef(AliESDCaloCluster,11)  //ESDCaloCluster 
 
-  ClassDef(AliESDCaloCluster,5)  //ESDCaloCluster 
-};
+    };
 
 #endif 
 
+