Line data Source code
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 :
6 : //-------------------------------------------------------------------------
7 : /// \class AliESDCaloCluster
8 : /// \brief Calorimeter cluster data container
9 : ///
10 : /// This is the class to deal with during the physics analysis of calorimeters
11 : /// data. Container for calorimeter clusters, which are the effective
12 : /// "tracks" for calorimeter detectors. Can be used by PHOS and EMCAL
13 : ///
14 : /// \author J.L. Klay, <Gustavo.Conesa.Balbastre@cern.ch>, LLNL
15 : /// \author Gustavo Conesa Balbastre, <Gustavo.Conesa.Balbastre@cern.ch>, LPSC-Grenoble
16 : ///
17 : //-------------------------------------------------------------------------
18 :
19 : #include <AliVCluster.h>
20 : #include "AliPID.h"
21 : #include "TArrayS.h"
22 : #include "TArrayI.h"
23 : #include "AliLog.h"
24 :
25 : class TLorentzVector;
26 :
27 : class AliESDCaloCluster : public AliVCluster
28 : {
29 :
30 : public:
31 :
32 : AliESDCaloCluster();
33 : AliESDCaloCluster(const AliESDCaloCluster& clus);
34 : AliESDCaloCluster & operator=(const AliESDCaloCluster& source);
35 : virtual ~AliESDCaloCluster();
36 : virtual void Copy(TObject &) const;
37 : void Clear(const Option_t*);
38 :
39 86 : void SetID(Int_t id) {fID = id;}
40 122 : Int_t GetID() const {return fID;}
41 :
42 86 : void SetType(Char_t type) { fClusterType = type; }
43 86 : Char_t GetType() const {return fClusterType; }
44 :
45 516 : Bool_t IsEMCAL() const {if(fClusterType == kEMCALClusterv1) return kTRUE; else return kFALSE;}
46 129 : Bool_t IsPHOS() const {if(fClusterType == kPHOSNeutral || fClusterType == kPHOSCharged) return kTRUE;
47 76 : else return kFALSE;}
48 :
49 : void GetPosition (Float_t *x) const {
50 122 : x[0]=fGlobalPos[0]; x[1]=fGlobalPos[1]; x[2]=fGlobalPos[2];}
51 : void SetPosition (Float_t *x);
52 0 : void SetPositionAt(Float_t pos, Int_t ipos) {if(ipos>=0 && ipos<3) fGlobalPos[ipos] = pos ;
53 0 : else AliInfo(Form("Bad index for position array, i = %d\n",ipos));}
54 :
55 86 : void SetE(Double_t ene) { fEnergy = ene;}
56 152 : Double_t E() const { return fEnergy;}
57 :
58 86 : void SetDispersion(Double_t disp) { fDispersion = disp; }
59 86 : Double_t GetDispersion() const { return fDispersion; }
60 :
61 86 : void SetChi2(Double_t chi2) { fChi2 = chi2; }
62 0 : Double_t Chi2() const { return fChi2; }
63 :
64 86 : const Double_t *GetPID() const { return fPID; }
65 : //for(Int_t i=0; i<AliPID::kSPECIESCN; ++i) pid[i]=fPID[i];}
66 : void SetPID (const Float_t *pid) ;
67 0 : void SetPIDAt(Float_t p, Int_t i) {if(i>=0 && i<AliPID::kSPECIESCN) fPID[i] = p ;
68 0 : else AliInfo(Form("Bad index for PID array, i = %d \n",i));}
69 :
70 86 : void SetM20(Double_t m20) { fM20 = m20; }
71 86 : Double_t GetM20() const { return fM20; }
72 :
73 86 : void SetM02(Double_t m02) { fM02 = m02; }
74 152 : Double_t GetM02() const { return fM02; }
75 :
76 86 : void SetNExMax(UChar_t nExMax) { fNExMax = nExMax; }
77 86 : UChar_t GetNExMax() const { return fNExMax; }
78 :
79 20 : void SetEmcCpvDistance(Double_t dEmcCpv) { fEmcCpvDistance = dEmcCpv; }
80 86 : Double_t GetEmcCpvDistance() const { return fEmcCpvDistance; }
81 48 : void SetTrackDistance(Double_t dx, Double_t dz){fTrackDx=dx; fTrackDz=dz;}
82 86 : Double_t GetTrackDx(void)const {return fTrackDx;}
83 86 : Double_t GetTrackDz(void)const {return fTrackDz;}
84 :
85 86 : void SetDistanceToBadChannel(Double_t dist) {fDistToBadChannel=dist;}
86 86 : Double_t GetDistanceToBadChannel() const {return fDistToBadChannel;}
87 :
88 86 : void SetTOF(Double_t tof) { fTOF = tof; }
89 86 : Double_t GetTOF() const { return fTOF; }
90 :
91 : void AddTracksMatched(TArrayI & array) {
92 172 : if(!fTracksMatched)fTracksMatched = new TArrayI(array);
93 0 : else *fTracksMatched = array;
94 43 : }
95 :
96 : void AddLabels(TArrayI & array) {
97 40 : if(!fLabels)fLabels = new TArrayI(array) ;
98 0 : else *fLabels = array;
99 10 : fNLabel = fLabels->GetSize();
100 10 : }
101 :
102 : void SetLabel(Int_t *array, UInt_t size){
103 66 : if(fLabels) delete fLabels ;
104 66 : fLabels = new TArrayI(size,array);
105 33 : fNLabel = size;
106 33 : }
107 :
108 268 : TArrayI * GetTracksMatched() const {return fTracksMatched;}
109 0 : TArrayI * GetLabelsArray() const {return fLabels;}
110 172 : Int_t * GetLabels() const {if (fLabels) return fLabels->GetArray(); else return 0;}
111 :
112 : Int_t GetTrackMatchedIndex(Int_t i = 0) const;
113 :
114 : /// \return Label of MC particle that deposited more energy to the cluster
115 : Int_t GetLabel() const {
116 0 : if( fLabels && fLabels->GetSize() >0) return fLabels->At(0);
117 0 : else return -1;}
118 :
119 : Int_t GetLabelAt(UInt_t i) const {
120 0 : if (fLabels && i < (UInt_t)fLabels->GetSize()) return fLabels->At(i);
121 0 : else return -999; }
122 :
123 0 : Int_t GetNTracksMatched() const { if (fTracksMatched) return fTracksMatched->GetSize();
124 0 : else return -1;}
125 :
126 129 : UInt_t GetNLabels() const { if (fLabels) return fLabels->GetSize();
127 43 : else return (0);}
128 :
129 : void GetMomentum(TLorentzVector& p, const Double_t * vertexPosition ) const;
130 : void GetMomentum(TLorentzVector& p, const Double_t * vertexPosition, VCluUserDefEnergy_t t ) const;
131 :
132 86 : void SetNCells(Int_t n) { fNCells = n;}
133 86 : Int_t GetNCells() const { return fNCells;}
134 :
135 : void SetCellsAbsId(UShort_t *array) ;
136 86 : UShort_t *GetCellsAbsId() {return fCellsAbsId;}
137 :
138 : void SetCellsAmplitudeFraction(Double32_t *array) ;
139 86 : Double32_t *GetCellsAmplitudeFraction() {return fCellsAmpFraction;}
140 :
141 : Int_t GetCellAbsId(Int_t i) const {
142 0 : if (fCellsAbsId && i >=0 && i < fNCells ) return fCellsAbsId[i];
143 0 : else return -1;}
144 :
145 : Double_t GetCellAmplitudeFraction(Int_t i) const {
146 0 : if (fCellsAmpFraction && i >=0 && i < fNCells ) return fCellsAmpFraction[i];
147 0 : else return -1;}
148 :
149 0 : Double_t GetCoreEnergy() const { return fCoreEnergy ; }
150 0 : void SetCoreEnergy(Double_t e) { fCoreEnergy = e ; }
151 :
152 0 : Double_t GetMCEnergyFraction() const { return fMCEnergyFraction ; }
153 0 : void SetMCEnergyFraction(Double_t e) { fMCEnergyFraction = e ; }
154 :
155 0 : Bool_t GetIsExotic() const { return fIsExotic ; }
156 0 : void SetIsExotic(Bool_t b) { fIsExotic = b ; }
157 :
158 0 : Double_t GetUserDefEnergy(Int_t t) const { return AliVCluster::GetUserDefEnergy(t); }
159 0 : Double_t GetUserDefEnergy(VCluUserDefEnergy_t t) const { return E()*fUserDefEnergy[t] ; }
160 0 : void SetUserDefEnergy(Int_t t, Double_t e) { AliVCluster::SetUserDefEnergy(t,e);}
161 0 : void SetUserDefEnergy(VCluUserDefEnergy_t t, Double_t e) { fUserDefEnergy[t] = E() > 1e-6 ? e / E() : 1. ; }
162 0 : void SetUserDefEnergyCorrFactor(VCluUserDefEnergy_t t, Double_t f) { fUserDefEnergy[t] = f ; }
163 :
164 : void SetCellsMCEdepFractionMap(UInt_t *array) ;
165 86 : UInt_t * GetCellsMCEdepFractionMap() const { return fCellsMCEdepFractionMap ; }
166 :
167 : void GetCellMCEdepFractionArray(Int_t cellIndex, Float_t * eDep) const ;
168 : UInt_t PackMCEdepFraction(Float_t * eDep) const ;
169 :
170 : void SetClusterMCEdepFractionFromEdepArray(Float_t *array) ;
171 : void SetClusterMCEdepFraction (UShort_t *array) ;
172 86 : UShort_t * GetClusterMCEdepFraction() const { return fClusterMCEdepFraction ; }
173 : Float_t GetClusterMCEdepFraction(Int_t mcIndex) const ;
174 :
175 : protected:
176 :
177 : TArrayI * fTracksMatched; ///< Index of tracks close to cluster. First entry is the most likely match.
178 : TArrayI * fLabels; ///< List of MC particles that generated the cluster, ordered in deposited energy.
179 :
180 : Int_t fNCells ; ///< Number of cells in cluster.
181 :
182 : /// Array of cell absolute Id numbers.
183 : UShort_t * fCellsAbsId; //[fNCells]
184 :
185 : /// Array with cell amplitudes fraction. Only usable for unfolded clusters, where cell can be shared.
186 : /// here we store what fraction of the cell energy is assigned to a given cluster.
187 : Double32_t * fCellsAmpFraction; //[fNCells][0.,1.,16]
188 :
189 : Double32_t fGlobalPos[3]; ///< Position in global coordinate system (cm).
190 : Double32_t fEnergy; ///< Energy measured by calorimeter in GeV.
191 : Double32_t fDispersion; ///< Cluster shape dispersion.
192 : Double32_t fChi2; ///< Chi2 of cluster fit (unfolded clusters)
193 : Double32_t fM20; ///< 2-nd moment along the main eigen axis.
194 : Double32_t fM02; ///< 2-nd moment along the second eigen axis.
195 :
196 : Double32_t fEmcCpvDistance; ///< the distance from PHOS EMC rec.point to the closest CPV rec.point.
197 :
198 : Double32_t fTrackDx ; ///< Distance to closest track in phi.
199 : Double32_t fTrackDz ; ///< Distance to closest track in z.
200 :
201 : Double32_t fDistToBadChannel; ///< Distance to nearest bad channel.
202 :
203 : /// Detector response probabilities for the PID
204 : Double32_t fPID[AliPID::kSPECIESCN]; //[0,1,8]
205 :
206 : Int_t fID; ///< Unique Id of the cluster.
207 : UChar_t fNExMax ; ///< Number of Local (Ex-)maxima before unfolding.
208 : Char_t fClusterType; ///< Flag for different cluster type/versions. See enum VClu_t in AliVCluster
209 :
210 : /// Cluster time-of-flight
211 : Double_t fTOF; //[0,0,12]
212 :
213 : Double32_t fCoreEnergy; ///< Energy of the core of cluster. Used by PHOS.
214 :
215 : Double_t fMCEnergyFraction; //!<! MC energy (embedding)
216 : Bool_t fIsExotic; //!<! Cluster marked as "exotic" (high energy deposition concentrated in a single cell)
217 : Double_t fUserDefEnergy[kLastUserDefEnergy+1]; //!<!energy of the cluster after other higher level corrections (e.g. non-linearity, hadronic correction, ...)
218 :
219 : UInt_t fNLabel; ///< Number of MC particles associated to the cluster
220 :
221 : /// Array with fraction of deposited energy per MC particle contributing to the cluster
222 : UShort_t * fClusterMCEdepFraction; //[fNLabel]
223 :
224 : /// Array of maps (4 bits, each bit a different information) with fraction of deposited energy
225 : /// per MC particle contributing to the cluster (4 particles maximum) per cell in the cluster
226 : UInt_t * fCellsMCEdepFractionMap; //[fNCells]
227 :
228 : /// \cond CLASSIMP
229 184 : ClassDef(AliESDCaloCluster,13) ;
230 : /// \endcond
231 :
232 : };
233 :
234 : #endif
235 :
236 :
|