]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDCaloCluster.h
Changes for report #69974: Virtual class for calorimeter analysis objects
[u/mrichter/AliRoot.git] / STEER / AliESDCaloCluster.h
1 #ifndef ALIESDCALOCLUSTER_H
2 #define ALIESDCALOCLUSTER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5 /* $Id$ */
6 /* $Log $ */
7
8 //-------------------------------------------------------------------------
9 //                          Class AliESDCaloCluster
10 //   This is the class to deal with during the physics analysis of data
11 //
12 //   New container for calorimeter clusters, which are the effective 
13 //   "tracks" for calorimeter detectors.  Can be used by PHOS and EMCAL
14 //
15 //     J.L. Klay (LLNL)
16 //-------------------------------------------------------------------------
17
18 #include <AliVCluster.h>
19 #include "AliPID.h"
20 #include "TArrayS.h"
21 #include "TArrayI.h"
22 #include "AliLog.h"
23
24 class TLorentzVector;
25
26 class AliESDCaloCluster : public AliVCluster 
27 {
28   
29  public:
30   
31   AliESDCaloCluster();
32   AliESDCaloCluster(const AliESDCaloCluster& clus);
33   AliESDCaloCluster & operator=(const AliESDCaloCluster& source);
34   virtual ~AliESDCaloCluster();
35   virtual void Copy(TObject &) const;
36   
37   void  SetID(Int_t id) {fID = id;}
38   Int_t GetID() const {return fID;}
39   
40   void   SetType(Char_t type) { fClusterType = type; }
41   Char_t GetType() const {return fClusterType; }
42   
43   Bool_t IsEMCAL() const {if(fClusterType == kEMCALClusterv1) return kTRUE; else return kFALSE;}
44   Bool_t IsPHOS()  const {if(fClusterType == kPHOSNeutral || fClusterType == kPHOSCharged) return kTRUE;
45     else return kFALSE;}
46   
47   void GetPosition  (Float_t *x) const {
48     x[0]=fGlobalPos[0]; x[1]=fGlobalPos[1]; x[2]=fGlobalPos[2];}
49   void SetPosition  (Float_t *x);
50   void SetPositionAt(Float_t pos, Int_t ipos) {if(ipos>=0 && ipos<3) fGlobalPos[ipos] = pos ; 
51     else AliInfo(Form("Bad index for position array, i = %d\n",ipos));}
52   
53   void  SetE(Double_t ene) { fEnergy = ene;}
54   Double_t E() const       { return fEnergy;}
55   
56   void     SetDispersion(Double_t disp)  { fDispersion = disp; }
57   Double_t GetDispersion() const         { return fDispersion; }
58   
59   void  SetChi2(Double_t chi2)  { fChi2 = chi2; }
60   Double_t Chi2() const         { return fChi2; }
61   
62   const Double_t *GetPID() const { return fPID; }
63   //for(Int_t i=0; i<AliPID::kSPECIESN; ++i) pid[i]=fPID[i];}
64   void SetPID  (const Float_t *pid) ;
65   void SetPIDAt(Float_t p, Int_t i) {if(i>=0 && i<AliPID::kSPECIESN) fPID[i] = p ; 
66     else AliInfo(Form("Bad index for PID array, i = %d \n",i));}
67   
68   void     SetM20(Double_t m20) { fM20 = m20; }
69   Double_t GetM20() const       { return fM20; }
70   
71   void     SetM02(Double_t m02) { fM02 = m02; }
72   Double_t GetM02() const       { return fM02; }
73   
74   void    SetNExMax(UChar_t nExMax) { fNExMax = nExMax; }
75   UChar_t GetNExMax() const         { return fNExMax; }
76   
77   void SetEmcCpvDistance(Double_t dEmcCpv) { fEmcCpvDistance = dEmcCpv; }
78   Double_t GetEmcCpvDistance() const       { return fEmcCpvDistance; }
79   void SetTrackDistance(Double_t dx, Double_t dz){fTrackDx=dx; fTrackDz=dz;}
80   Double_t GetTrackDx(void)const {return fTrackDx;}
81   Double_t GetTrackDz(void)const {return fTrackDz;}
82   
83   void     SetDistanceToBadChannel(Double_t dist) {fDistToBadChannel=dist;}
84   Double_t GetDistanceToBadChannel() const        {return fDistToBadChannel;}
85   
86   void     SetTOF(Double_t tof) { fTOF = tof; }
87   Double_t GetTOF() const       { return fTOF; }
88   
89   void AddTracksMatched(TArrayI & array)  { 
90     if(!fTracksMatched)fTracksMatched   = new TArrayI(array);
91     else *fTracksMatched = array;
92   }
93   void AddLabels(TArrayI & array)         { 
94     if(!fLabels)fLabels = new TArrayI(array) ; 
95     else *fLabels = array;
96   }
97   
98   TArrayI * GetTracksMatched() const  {return  fTracksMatched;}
99   TArrayI * GetLabelsArray() const    {return  fLabels;}
100   Int_t   * GetLabels() const         {return  fLabels->GetArray();}
101
102   Int_t GetTrackMatchedIndex() const   
103   {if( fTracksMatched &&  fTracksMatched->GetSize() >0)  return  fTracksMatched->At(0); 
104     else return -1;} //Most likely the track associated to the cluster
105   
106   Int_t GetLabel() const   {
107     if( fLabels &&  fLabels->GetSize() >0)  return  fLabels->At(0); 
108     else return -1;} //Most likely the track associated to the cluster
109   Int_t GetLabelAt(UInt_t i) const {
110     if (fLabels && i < (UInt_t)fLabels->GetSize()) return fLabels->At(i);
111     else return -999; }
112   
113   Int_t GetNTracksMatched() const { if (fTracksMatched) return  fTracksMatched->GetSize(); 
114     else return -1;}
115   UInt_t GetNLabels() const       { if (fLabels) return  fLabels->GetSize(); 
116     else return -1;}
117   
118   void GetMomentum(TLorentzVector& p, Double_t * vertexPosition );
119   
120   void  SetNCells(Int_t n)  { fNCells = n;}
121   Int_t GetNCells() const   { return fNCells;}
122   
123   void      SetCellsAbsId(UShort_t *array) ;
124   UShort_t *GetCellsAbsId() {return  fCellsAbsId;}
125   
126   void        SetCellsAmplitudeFraction(Double32_t *array) ;
127   Double32_t *GetCellsAmplitudeFraction() {return  fCellsAmpFraction;}
128   
129   Int_t GetCellAbsId(Int_t i) const {  
130     if (fCellsAbsId && i >=0 && i < fNCells ) return fCellsAbsId[i];    
131     else return -1;}
132   
133   Double_t GetCellAmplitudeFraction(Int_t i) const {  
134     if (fCellsAmpFraction && i >=0 && i < fNCells ) return fCellsAmpFraction[i];    
135     else return -1;}
136   
137  protected:
138   
139   TArrayI * fTracksMatched; //Index of tracks close to cluster. First entry is the most likely match.
140   TArrayI * fLabels;        //list of primaries that generated the cluster, ordered in deposited energy.
141   
142   Int_t        fNCells ;
143   UShort_t   * fCellsAbsId;       //[fNCells] array of cell absId numbers
144   Double32_t * fCellsAmpFraction; //[fNCells][0.,1.,16] array with cell amplitudes fraction.
145   
146   Double32_t   fGlobalPos[3];     // position in global coordinate systemD
147   Double32_t   fEnergy;           // energy measured by calorimeter
148   Double32_t   fDispersion;       // cluster dispersion, for shape analysis
149   Double32_t   fChi2;             // chi2 of cluster fi
150   Double32_t   fM20;              // 2-nd moment along the main eigen axis
151   Double32_t   fM02;              // 2-nd moment along the second eigen axis
152   
153   Double32_t   fEmcCpvDistance;   // the distance from PHOS EMC rec.point to the closest CPV rec.point
154   Double32_t   fTrackDx ;         // Distance to closest track in phi
155   Double32_t   fTrackDz ;         // Distance to closest track in z
156   
157   Double32_t   fDistToBadChannel; // Distance to nearest bad channel
158   Double32_t   fPID[AliPID::kSPECIESN]; //[0,1,8]"detector response  probabilities" (for the PID)
159   Int_t        fID;                // Unique Id of the cluster
160   UChar_t      fNExMax ;           // number of (Ex-)maxima before unfolding  
161   Char_t       fClusterType;       // Flag for different cluster type/versions
162   Double_t     fTOF;               //[0,0,12] time-of-flight
163   
164   
165   ClassDef(AliESDCaloCluster,11)  //ESDCaloCluster 
166
167     };
168
169 #endif 
170
171