]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/util/AliHLTCaloClusterDataStruct.h
Merge branch 'trackMatcher'
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTCaloClusterDataStruct.h
1
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
17 #ifndef ALIHLTCALOCLUSTERDATASTRUCT_H
18 #define ALIHLTCALOCLUSTERDATASTRUCT_H
19
20 /**
21  * Calo cluster struct for  HLT
22  *
23  * @file   AliHLTCaloClusterDataStruct.h
24  * @author Oystein Djuvsland
25  * @date
26  * @brief  Calo cluster struct for HLT
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"
36 #include "TArrayI.h"
37 #include "Rtypes.h"
38
39 /**
40  * @struct AliHLTCaloClusterHeaderStruct
41  * Calorimeter cluster header describing the number of 
42  * clusters in the following block
43  *
44  * @ingroup alihlt_phos
45  */
46
47
48 enum ESDClu_t {         kUndef,
49         kPHOSCluster,
50         kEMCALPseudoCluster,
51         kEMCALClusterv1
52 };      
53
54 struct AliHLTCaloClusterHeaderStruct
55 {
56   Short_t fNClusters;
57   Short_t fNDigits;
58 };
59
60 /**
61  * @struct AliHLTCaloClusterDataStruct
62  * Calorimeter cluster data struct for  HLT
63  * Similar to the AliESDCaloCluster class
64  * @ingroup alihlt_phos
65  */
66
67 struct AliHLTCaloClusterDataStruct
68 {
69    
70    /** Set the ID */
71   void SetID(Int_t id) {fID = id;}      //COMMENT
72   
73   /** Get the ID */
74   Int_t GetID() const {return fID;}  //COMMENT
75   
76   /** Get the cluster type */
77   void SetClusterType(Int_t type) { fClusterType = type; }  //COMMENT
78   
79   /** Set the cluster type */
80   Char_t GetClusterType() const {return fClusterType; } //COMMENT
81
82    /** Is it an EMCAL cluster? */
83   Bool_t IsEMCAL() const {return (fClusterType == kEMCALClusterv1);}  //COMMENT
84   
85   /** Is it a PHOS cluster */
86   Bool_t IsPHOS() const {return (fClusterType == kPHOSCluster);} //COMMENT
87
88   /** Set the global postion */
89   void SetPosition(const Float_t *pos) {
90     fGlobalPos[0] = pos[0]; fGlobalPos[1] = pos[1]; fGlobalPos[2] = pos[2];
91   }
92   
93   /** Get the global position */
94   void GetPosition(Float_t *pos) const {
95     pos[0] = fGlobalPos[0]; pos[1] = fGlobalPos[1]; pos[2] = fGlobalPos[2];
96   }
97   /** Set the energy */
98   void SetE(Float_t ene) { fEnergy = ene;} //COMMENT
99   
100   /** Get the energy */
101   Double_t E() const   { return fEnergy;} //COMMENT
102
103    /** Set the cluster dispersion */
104   void SetClusterDisp(Float_t disp)  { fDispersion = disp; } //COMMENT
105   
106   /** Get the cluster dispersion */
107   Double_t GetClusterDisp() const     { return fDispersion; } //COMMENT
108
109   /** Set the cluster chi2 */
110   void SetClusterChi2(Float_t chi2)  { fChi2 = chi2; } //COMMENT
111   
112   /** Get the cluster chi2 */
113   Double_t GetClusterChi2() const     { return fChi2; } //COMMENT
114
115   /** Set the PID data */
116   void SetPid(const Float_t *p) 
117   {
118    // Sets the probability of each particle type
119   // Copied from AliESDCaloCluster
120   // This function copies "n" PID weights from "scr" to "dest"
121   // and normalizes their sum to 1 thus producing conditional
122   // probabilities.
123   // The negative weights are set to 0.
124   // In case all the weights are non-positive they are replaced by
125   // uniform probabilities
126
127   Int_t n = AliPID::kSPECIESN;
128
129   Float_t uniform = 1./(Float_t)n;
130
131   Float_t sum = 0;
132   for (Int_t i=0; i<n; i++)
133     if (p[i]>=0) {
134       sum+=p[i];
135       fPID[i] = p[i];
136     }
137     else {
138       fPID[i] = 0;
139     }
140
141   if(sum>0)
142     for (Int_t i=0; i<n; i++) fPID[i] /= sum;
143   else
144     for (Int_t i=0; i<n; i++) fPID[i] = uniform;
145
146 }
147
148   /** Get the PID */
149   Float_t *GetPid() {return fPID;} //COMMENT
150
151    /** Set the M20 */
152   void SetM20(Float_t m20)                { fM20 = m20; } //COMMENT
153   
154   /** Get the M20 */
155   Double_t GetM20() const                  { return fM20; } //COMMENT
156
157   /** Set the the M02 */
158   void SetM02(Float_t m02)                { fM02 = m02; } //COMMENT
159   
160   /** Get the M02  */
161   Double_t GetM02() const                  { return fM02; } //COMMENT
162
163   /** Set number of ex-maxima */
164   void SetNExMax(UChar_t nExMax)         { fNExMax = nExMax; } //COMMENT
165   
166   /** Get the number of ex maxima */
167   UChar_t GetNExMax() const              { return fNExMax; } //COMMENT
168
169   /** Set the EMC CPV distance */
170   void SetEmcCpvDistance(Float_t dEmcCpv) { fEmcCpvDistance = dEmcCpv; } //COMMENT
171   
172   /** Get the EMC CPV distance */
173   Double_t GetEmcCpvDistance() const       { return fEmcCpvDistance; } //COMMENT
174   
175   /** Set the distance to track in x and z dimensions */
176   void SetTrackDistance(Double_t dx, Double_t dz){fTrackDx=dx; fTrackDz=dz;}
177   
178   /** Get the distance to track in x */
179   Double_t GetTrackDx(void)const {return fTrackDx;}  //COMMENT
180   
181   /** Get the distance to track in z */
182   Double_t GetTrackDz(void)const {return fTrackDz;} //COMMENT
183   
184   /** Set the distance to closest bad channel */
185   void SetDistanceToBadChannel(Float_t dist) {fDistToBadChannel=dist;}
186   
187   /** Get the distance to closest bad channel */
188   Double_t GetDistanceToBadChannel() const {return fDistToBadChannel;}
189
190   /** Set the TOF */
191   void SetTOF(Double_t tof) { fTOF = tof; } //COMMENT
192   
193   /** Geth the TOF */
194   Double_t GetTOF() const { return fTOF; } //COMMENT
195   
196   /** Add an array of tracks */
197    void AddTracksMatched(TArrayI & array)  
198    { 
199       fNTracksMatched = array.GetSize();
200        for(Int_t t = 0; (t < fNTracksMatched) && (t < 10); t++) //TODO: remove hard coded 10
201        {
202          fTracksMatched[t] = array[t];
203        }
204    }
205    
206   /** 
207   * Get the array of the matched tracks 
208   */    
209    const Int_t * GetTracksMatched() const 
210    {
211       return fTracksMatched;
212    }
213    
214    /** Get the best match */
215    Int_t GetTrackMatched() const   
216   {
217     if( fTracksMatched[0] >0)  return  fTracksMatched[0]; 
218     else return -1;
219   } //Most likely the track associated to the cluster
220
221 /** Get the number of tracks matched */
222   Int_t GetNTracksMatched() const 
223   { 
224     for(int i = 0; i < 10; i++) 
225       {
226         if (fTracksMatched[i] < 0)
227          {
228             return i;
229          }
230     }
231     return 10;
232   }
233
234   /** Number of cells in the cluster */
235   UInt_t fNCells;                                //COMMENT
236
237   /** Global position */
238   Float_t fGlobalPos[3];                      //COMMENT
239
240   /** The total energy of the cell */
241   Float_t fEnergy;                            //COMMENT
242
243   /** The time of flight */
244   Float_t fTOF;                               //COMMENT
245
246   /** Dispersion */
247   Float_t fDispersion;                        //COMMENT
248   
249   /** Chi2 */
250   Float_t fChi2; //COMMENT
251
252   /** Quality of cluster fit */
253   Float_t fFitQuality;                        //COMMENT
254
255   /** Second moment along the main eigen axis */
256   Float_t fM20;                               //COMMENT
257
258   /** Second moment along the second eigen axis */ 
259   Float_t fM02;                               //COMMENT
260
261   /** Distance to closest CPV rec point */
262   Float_t fEmcCpvDistance;                    //COMMENT
263
264   /** Distance to nearest bad channel */
265   Float_t fDistToBadChannel;                  //COMMENT
266
267   /** Distance to closest track in x direction */
268    Float_t fTrackDx;                                    //COMMENT
269
270   /** Distance to closest track in z direction */
271   Float_t fTrackDz; //COMMENT
272
273   /** PID */
274   Float_t fPID[AliPID::kSPECIESN];            //COMMENT
275
276   /** Unique ID of the cluster*/
277   Int_t fID;                                     //COMMENT
278
279   /** Number of (Ex) Maxima */
280   UChar_t fNExMax;                               //COMMENT 
281
282   /** Flag for differtent cluster type/versions */
283   Char_t fClusterType;                           //COMMENT
284
285   /** Distance to nearest bad channel */
286   Float_t fDistanceToBadChannel;              //COMMENT
287
288   /** Number of matched tracks */
289   Int_t fNTracksMatched; //COMMENT Obsolete?
290
291   /** the matced tracks */
292   Int_t fTracksMatched[10];           //COMMENT TODO: remove hardcoded 10
293
294   /** The absolute IDs of the cells*/
295   UShort_t fCellsAbsId;                      //COMMENT
296
297   /** */
298   Float_t fCellsAmpFraction;              //COMMENT
299   
300   
301 };
302
303
304 #endif