ROOT logo
#ifndef ALIESDCALOCLUSTER_H
#define ALIESDCALOCLUSTER_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */
/* $Id$ */
/* $Log $ */

//-------------------------------------------------------------------------
//                          Class AliESDCaloCluster
//   This is the class to deal with during the physics analysis of data
//
//   New container for calorimeter clusters, which are the effective 
//   "tracks" for calorimeter detectors.  Can be used by PHOS and EMCAL
//
//     J.L. Klay (LLNL)
//-------------------------------------------------------------------------

#include <AliVCluster.h>
#include "AliPID.h"
#include "TArrayS.h"
#include "TArrayI.h"
#include "AliLog.h"

class TLorentzVector;

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;}
  Int_t GetID() const {return fID;}
  
  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::kSPECIESCN; ++i) pid[i]=fPID[i];}
  void SetPID  (const Float_t *pid) ;
  void SetPIDAt(Float_t p, Int_t i) {if(i>=0 && i<AliPID::kSPECIESCN) 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 AddLabels(TArrayI & array)         { 
    if(!fLabels)fLabels = new TArrayI(array) ;
    else *fLabels = array;
  }
  
  void SetLabel(Int_t *array, UInt_t size)
  {
    if(fLabels) delete fLabels ;
    fLabels = new TArrayI(size,array);
  }

  TArrayI * GetTracksMatched() const  {return  fTracksMatched;}
  TArrayI * GetLabelsArray() const    {return  fLabels;}
  Int_t   * GetLabels() const         {if (fLabels) return  fLabels->GetArray(); else return 0;}

  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); 
    else return -1;} //Most likely the track associated to the cluster
  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;}
  UInt_t GetNLabels() const       { if (fLabels) return  fLabels->GetSize(); 
    else return (0);}
  
  void GetMomentum(TLorentzVector& p, Double_t * vertexPosition ) const;
  
  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;}
  
  Double_t GetCellAmplitudeFraction(Int_t i) const {  
    if (fCellsAmpFraction && i >=0 && i < fNCells ) return fCellsAmpFraction[i];    
    else return -1;}

  Double_t    GetMCEnergyFraction() const           { return fMCEnergyFraction ; }
  void        SetMCEnergyFraction(Double_t e)       { fMCEnergyFraction = e    ; }

  virtual Double_t    GetCoreEnergy() const           {return fCoreEnergy ; }
  virtual void        SetCoreEnergy(Double_t e)         { fCoreEnergy=e; }
  
 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   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::kSPECIESCN]; //[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
  Double_t     fTOF;               //[0,0,12] time-of-flight
  
  Double_t     fMCEnergyFraction;          //!MC energy (embedding)
  Double32_t   fCoreEnergy;          // energy of the core of cluster
  
  ClassDef(AliESDCaloCluster,12)  //ESDCaloCluster 

    };

#endif 


 AliESDCaloCluster.h:1
 AliESDCaloCluster.h:2
 AliESDCaloCluster.h:3
 AliESDCaloCluster.h:4
 AliESDCaloCluster.h:5
 AliESDCaloCluster.h:6
 AliESDCaloCluster.h:7
 AliESDCaloCluster.h:8
 AliESDCaloCluster.h:9
 AliESDCaloCluster.h:10
 AliESDCaloCluster.h:11
 AliESDCaloCluster.h:12
 AliESDCaloCluster.h:13
 AliESDCaloCluster.h:14
 AliESDCaloCluster.h:15
 AliESDCaloCluster.h:16
 AliESDCaloCluster.h:17
 AliESDCaloCluster.h:18
 AliESDCaloCluster.h:19
 AliESDCaloCluster.h:20
 AliESDCaloCluster.h:21
 AliESDCaloCluster.h:22
 AliESDCaloCluster.h:23
 AliESDCaloCluster.h:24
 AliESDCaloCluster.h:25
 AliESDCaloCluster.h:26
 AliESDCaloCluster.h:27
 AliESDCaloCluster.h:28
 AliESDCaloCluster.h:29
 AliESDCaloCluster.h:30
 AliESDCaloCluster.h:31
 AliESDCaloCluster.h:32
 AliESDCaloCluster.h:33
 AliESDCaloCluster.h:34
 AliESDCaloCluster.h:35
 AliESDCaloCluster.h:36
 AliESDCaloCluster.h:37
 AliESDCaloCluster.h:38
 AliESDCaloCluster.h:39
 AliESDCaloCluster.h:40
 AliESDCaloCluster.h:41
 AliESDCaloCluster.h:42
 AliESDCaloCluster.h:43
 AliESDCaloCluster.h:44
 AliESDCaloCluster.h:45
 AliESDCaloCluster.h:46
 AliESDCaloCluster.h:47
 AliESDCaloCluster.h:48
 AliESDCaloCluster.h:49
 AliESDCaloCluster.h:50
 AliESDCaloCluster.h:51
 AliESDCaloCluster.h:52
 AliESDCaloCluster.h:53
 AliESDCaloCluster.h:54
 AliESDCaloCluster.h:55
 AliESDCaloCluster.h:56
 AliESDCaloCluster.h:57
 AliESDCaloCluster.h:58
 AliESDCaloCluster.h:59
 AliESDCaloCluster.h:60
 AliESDCaloCluster.h:61
 AliESDCaloCluster.h:62
 AliESDCaloCluster.h:63
 AliESDCaloCluster.h:64
 AliESDCaloCluster.h:65
 AliESDCaloCluster.h:66
 AliESDCaloCluster.h:67
 AliESDCaloCluster.h:68
 AliESDCaloCluster.h:69
 AliESDCaloCluster.h:70
 AliESDCaloCluster.h:71
 AliESDCaloCluster.h:72
 AliESDCaloCluster.h:73
 AliESDCaloCluster.h:74
 AliESDCaloCluster.h:75
 AliESDCaloCluster.h:76
 AliESDCaloCluster.h:77
 AliESDCaloCluster.h:78
 AliESDCaloCluster.h:79
 AliESDCaloCluster.h:80
 AliESDCaloCluster.h:81
 AliESDCaloCluster.h:82
 AliESDCaloCluster.h:83
 AliESDCaloCluster.h:84
 AliESDCaloCluster.h:85
 AliESDCaloCluster.h:86
 AliESDCaloCluster.h:87
 AliESDCaloCluster.h:88
 AliESDCaloCluster.h:89
 AliESDCaloCluster.h:90
 AliESDCaloCluster.h:91
 AliESDCaloCluster.h:92
 AliESDCaloCluster.h:93
 AliESDCaloCluster.h:94
 AliESDCaloCluster.h:95
 AliESDCaloCluster.h:96
 AliESDCaloCluster.h:97
 AliESDCaloCluster.h:98
 AliESDCaloCluster.h:99
 AliESDCaloCluster.h:100
 AliESDCaloCluster.h:101
 AliESDCaloCluster.h:102
 AliESDCaloCluster.h:103
 AliESDCaloCluster.h:104
 AliESDCaloCluster.h:105
 AliESDCaloCluster.h:106
 AliESDCaloCluster.h:107
 AliESDCaloCluster.h:108
 AliESDCaloCluster.h:109
 AliESDCaloCluster.h:110
 AliESDCaloCluster.h:111
 AliESDCaloCluster.h:112
 AliESDCaloCluster.h:113
 AliESDCaloCluster.h:114
 AliESDCaloCluster.h:115
 AliESDCaloCluster.h:116
 AliESDCaloCluster.h:117
 AliESDCaloCluster.h:118
 AliESDCaloCluster.h:119
 AliESDCaloCluster.h:120
 AliESDCaloCluster.h:121
 AliESDCaloCluster.h:122
 AliESDCaloCluster.h:123
 AliESDCaloCluster.h:124
 AliESDCaloCluster.h:125
 AliESDCaloCluster.h:126
 AliESDCaloCluster.h:127
 AliESDCaloCluster.h:128
 AliESDCaloCluster.h:129
 AliESDCaloCluster.h:130
 AliESDCaloCluster.h:131
 AliESDCaloCluster.h:132
 AliESDCaloCluster.h:133
 AliESDCaloCluster.h:134
 AliESDCaloCluster.h:135
 AliESDCaloCluster.h:136
 AliESDCaloCluster.h:137
 AliESDCaloCluster.h:138
 AliESDCaloCluster.h:139
 AliESDCaloCluster.h:140
 AliESDCaloCluster.h:141
 AliESDCaloCluster.h:142
 AliESDCaloCluster.h:143
 AliESDCaloCluster.h:144
 AliESDCaloCluster.h:145
 AliESDCaloCluster.h:146
 AliESDCaloCluster.h:147
 AliESDCaloCluster.h:148
 AliESDCaloCluster.h:149
 AliESDCaloCluster.h:150
 AliESDCaloCluster.h:151
 AliESDCaloCluster.h:152
 AliESDCaloCluster.h:153
 AliESDCaloCluster.h:154
 AliESDCaloCluster.h:155
 AliESDCaloCluster.h:156
 AliESDCaloCluster.h:157
 AliESDCaloCluster.h:158
 AliESDCaloCluster.h:159
 AliESDCaloCluster.h:160
 AliESDCaloCluster.h:161
 AliESDCaloCluster.h:162
 AliESDCaloCluster.h:163
 AliESDCaloCluster.h:164
 AliESDCaloCluster.h:165
 AliESDCaloCluster.h:166
 AliESDCaloCluster.h:167
 AliESDCaloCluster.h:168
 AliESDCaloCluster.h:169
 AliESDCaloCluster.h:170
 AliESDCaloCluster.h:171
 AliESDCaloCluster.h:172
 AliESDCaloCluster.h:173
 AliESDCaloCluster.h:174
 AliESDCaloCluster.h:175
 AliESDCaloCluster.h:176
 AliESDCaloCluster.h:177
 AliESDCaloCluster.h:178
 AliESDCaloCluster.h:179
 AliESDCaloCluster.h:180
 AliESDCaloCluster.h:181
 AliESDCaloCluster.h:182
 AliESDCaloCluster.h:183
 AliESDCaloCluster.h:184
 AliESDCaloCluster.h:185
 AliESDCaloCluster.h:186