- Reshuffling of the particle codes in AliPID. Now the light nuclei are between the
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTCaloClusterDataStruct.h
CommitLineData
3f694121 1// $Id$
6a76e30e 2/**************************************************************************
3 * This file is property of and copyright by the ALICE HLT Project *
4 * All rights reserved. *
5 * *
6 * Primary Authors: Oystein Djuvsland *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
7fc04b67 17#ifndef ALIHLTCALOCLUSTERDATASTRUCT_H
18#define ALIHLTCALOCLUSTERDATASTRUCT_H
6a76e30e 19
20/**
7fc04b67 21 * Calo cluster struct for HLT
6a76e30e 22 *
7fc04b67 23 * @file AliHLTCaloClusterDataStruct.h
6a76e30e 24 * @author Oystein Djuvsland
25 * @date
7fc04b67 26 * @brief Calo cluster struct for HLT
6a76e30e 27 */
28
29// see below for class documentation
30// or
31// refer to README to build package
32// or
33// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
34
35#include "AliPID.h"
de31859c 36#include "TArrayI.h"
2a1edad1 37#include "Rtypes.h"
38
6a76e30e 39/**
7fc04b67 40 * @struct AliHLTCaloClusterHeaderStruct
41 * Calorimeter cluster header describing the number of
42 * clusters in the following block
6a76e30e 43 *
44 * @ingroup alihlt_phos
45 */
46
2a1edad1 47
420fd6a0 48enum ESDClu_t { kUndef = -2,
2a1edad1 49 kPHOSCluster,
50 kEMCALPseudoCluster,
51 kEMCALClusterv1
52};
53
7fc04b67 54struct AliHLTCaloClusterHeaderStruct
55{
56 Short_t fNClusters;
7c80a370 57 Short_t fNDigits;
7fc04b67 58};
59
7fdb2519 60struct AliHLTCaloCellDataStruct
61{
62 Short_t fCellsAbsId;
63 Float_t fCellsAmpFraction;
64};
65
66
7fc04b67 67/**
68 * @struct AliHLTCaloClusterDataStruct
69 * Calorimeter cluster data struct for HLT
70 * Similar to the AliESDCaloCluster class
71 * @ingroup alihlt_phos
72 */
73
74struct AliHLTCaloClusterDataStruct
6a76e30e 75{
2a1edad1 76
77 /** Set the ID */
78 void SetID(Int_t id) {fID = id;} //COMMENT
79
80 /** Get the ID */
81 Int_t GetID() const {return fID;} //COMMENT
82
83 /** Get the cluster type */
84 void SetClusterType(Int_t type) { fClusterType = type; } //COMMENT
85
86 /** Set the cluster type */
87 Char_t GetClusterType() const {return fClusterType; } //COMMENT
88
89 /** Is it an EMCAL cluster? */
90 Bool_t IsEMCAL() const {return (fClusterType == kEMCALClusterv1);} //COMMENT
91
92 /** Is it a PHOS cluster */
93 Bool_t IsPHOS() const {return (fClusterType == kPHOSCluster);} //COMMENT
94
95 /** Set the global postion */
96 void SetPosition(const Float_t *pos) {
97 fGlobalPos[0] = pos[0]; fGlobalPos[1] = pos[1]; fGlobalPos[2] = pos[2];
98 }
99
100 /** Get the global position */
101 void GetPosition(Float_t *pos) const {
102 pos[0] = fGlobalPos[0]; pos[1] = fGlobalPos[1]; pos[2] = fGlobalPos[2];
103 }
104 /** Set the energy */
105 void SetE(Float_t ene) { fEnergy = ene;} //COMMENT
106
107 /** Get the energy */
108 Double_t E() const { return fEnergy;} //COMMENT
109
110 /** Set the cluster dispersion */
111 void SetClusterDisp(Float_t disp) { fDispersion = disp; } //COMMENT
112
113 /** Get the cluster dispersion */
114 Double_t GetClusterDisp() const { return fDispersion; } //COMMENT
6a76e30e 115
2a1edad1 116 /** Set the cluster chi2 */
117 void SetClusterChi2(Float_t chi2) { fChi2 = chi2; } //COMMENT
118
119 /** Get the cluster chi2 */
120 Double_t GetClusterChi2() const { return fChi2; } //COMMENT
121
122 /** Set the PID data */
123 void SetPid(const Float_t *p)
124 {
125 // Sets the probability of each particle type
126 // Copied from AliESDCaloCluster
127 // This function copies "n" PID weights from "scr" to "dest"
128 // and normalizes their sum to 1 thus producing conditional
129 // probabilities.
130 // The negative weights are set to 0.
131 // In case all the weights are non-positive they are replaced by
132 // uniform probabilities
133
00a38d07 134 Int_t n = AliPID::kSPECIESCN;
2a1edad1 135
136 Float_t uniform = 1./(Float_t)n;
137
138 Float_t sum = 0;
139 for (Int_t i=0; i<n; i++)
140 if (p[i]>=0) {
141 sum+=p[i];
142 fPID[i] = p[i];
143 }
144 else {
145 fPID[i] = 0;
146 }
147
148 if(sum>0)
149 for (Int_t i=0; i<n; i++) fPID[i] /= sum;
150 else
151 for (Int_t i=0; i<n; i++) fPID[i] = uniform;
152
153}
154
155 /** Get the PID */
156 Float_t *GetPid() {return fPID;} //COMMENT
157
158 /** Set the M20 */
159 void SetM20(Float_t m20) { fM20 = m20; } //COMMENT
160
161 /** Get the M20 */
162 Double_t GetM20() const { return fM20; } //COMMENT
163
164 /** Set the the M02 */
165 void SetM02(Float_t m02) { fM02 = m02; } //COMMENT
166
167 /** Get the M02 */
168 Double_t GetM02() const { return fM02; } //COMMENT
169
170 /** Set number of ex-maxima */
171 void SetNExMax(UChar_t nExMax) { fNExMax = nExMax; } //COMMENT
172
173 /** Get the number of ex maxima */
174 UChar_t GetNExMax() const { return fNExMax; } //COMMENT
175
176 /** Set the EMC CPV distance */
177 void SetEmcCpvDistance(Float_t dEmcCpv) { fEmcCpvDistance = dEmcCpv; } //COMMENT
178
179 /** Get the EMC CPV distance */
180 Double_t GetEmcCpvDistance() const { return fEmcCpvDistance; } //COMMENT
181
182 /** Set the distance to track in x and z dimensions */
183 void SetTrackDistance(Double_t dx, Double_t dz){fTrackDx=dx; fTrackDz=dz;}
184
185 /** Get the distance to track in x */
186 Double_t GetTrackDx(void)const {return fTrackDx;} //COMMENT
187
188 /** Get the distance to track in z */
189 Double_t GetTrackDz(void)const {return fTrackDz;} //COMMENT
190
191 /** Set the distance to closest bad channel */
192 void SetDistanceToBadChannel(Float_t dist) {fDistToBadChannel=dist;}
193
194 /** Get the distance to closest bad channel */
195 Double_t GetDistanceToBadChannel() const {return fDistToBadChannel;}
196
197 /** Set the TOF */
198 void SetTOF(Double_t tof) { fTOF = tof; } //COMMENT
199
200 /** Geth the TOF */
201 Double_t GetTOF() const { return fTOF; } //COMMENT
202
203 /** Add an array of tracks */
204 void AddTracksMatched(TArrayI & array)
205 {
206 fNTracksMatched = array.GetSize();
207 for(Int_t t = 0; (t < fNTracksMatched) && (t < 10); t++) //TODO: remove hard coded 10
208 {
209 fTracksMatched[t] = array[t];
210 }
211 }
212
213 /**
214 * Get the array of the matched tracks
2a1edad1 215 */
2f7b4116 216 Int_t * GetTracksMatched()
81381085 217 {
218 return fTracksMatched;
219 }
220
2a1edad1 221 /** Get the best match */
222 Int_t GetTrackMatched() const
223 {
2a24cbbe 224 if( fTracksMatched[0] >0) return fTracksMatched[0];
2a1edad1 225 else return -1;
226 } //Most likely the track associated to the cluster
227
228/** Get the number of tracks matched */
2a24cbbe 229 Int_t GetNTracksMatched() const
230 {
231 for(int i = 0; i < 10; i++)
232 {
233 if (fTracksMatched[i] < 0)
234 {
235 return i;
236 }
237 }
238 return 10;
239 }
240
7b5c97a1 241 Int_t GetNCells() const
242 {
243 return ( Int_t ) (fNCells);
244 }
245
6a76e30e 246 /** Number of cells in the cluster */
247 UInt_t fNCells; //COMMENT
248
6a76e30e 249 /** Global position */
e304ea31 250 Float_t fGlobalPos[3]; //COMMENT
6a76e30e 251
252 /** The total energy of the cell */
e304ea31 253 Float_t fEnergy; //COMMENT
254
255 /** The time of flight */
256 Float_t fTOF; //COMMENT
6a76e30e 257
258 /** Dispersion */
e304ea31 259 Float_t fDispersion; //COMMENT
2a1edad1 260
261 /** Chi2 */
262 Float_t fChi2; //COMMENT
6a76e30e 263
264 /** Quality of cluster fit */
e304ea31 265 Float_t fFitQuality; //COMMENT
6a76e30e 266
267 /** Second moment along the main eigen axis */
e304ea31 268 Float_t fM20; //COMMENT
6a76e30e 269
270 /** Second moment along the second eigen axis */
e304ea31 271 Float_t fM02; //COMMENT
6a76e30e 272
6a76e30e 273 /** Distance to closest CPV rec point */
e304ea31 274 Float_t fEmcCpvDistance; //COMMENT
6a76e30e 275
276 /** Distance to nearest bad channel */
e304ea31 277 Float_t fDistToBadChannel; //COMMENT
6a76e30e 278
2a1edad1 279 /** Distance to closest track in x direction */
280 Float_t fTrackDx; //COMMENT
281
282 /** Distance to closest track in z direction */
283 Float_t fTrackDz; //COMMENT
284
6a76e30e 285 /** PID */
00a38d07 286 Float_t fPID[AliPID::kSPECIESCN]; //COMMENT
6a76e30e 287
288 /** Unique ID of the cluster*/
289 Int_t fID; //COMMENT
290
291 /** Number of (Ex) Maxima */
292 UChar_t fNExMax; //COMMENT
293
294 /** Flag for differtent cluster type/versions */
295 Char_t fClusterType; //COMMENT
296
297 /** Distance to nearest bad channel */
e304ea31 298 Float_t fDistanceToBadChannel; //COMMENT
299
2a1edad1 300 /** Number of matched tracks */
2a24cbbe 301 Int_t fNTracksMatched; //COMMENT Obsolete?
2a1edad1 302
303 /** the matced tracks */
304 Int_t fTracksMatched[10]; //COMMENT TODO: remove hardcoded 10
2a24cbbe 305
742571db 306 /** The module */
307 Int_t fModule; //COMMENT
308
7fdb2519 309 /** Struct containing cell ID and amplitude fraction for the cells */
310 AliHLTCaloCellDataStruct fCaloCells; //COMMENT
2a1edad1 311
6a76e30e 312};
313
de31859c 314
6a76e30e 315#endif