]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCRawCluster.h
adding protection for invalid array index
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCRawCluster.h
1 // $Id$
2 #ifndef ALIHLTTPCRAWCLUSTER_H
3 #define ALIHLTTPCRAWCLUSTER_H
4
5 #include "AliHLTTPCRootTypes.h"
6
7 /**
8  * @struct AliHLTTPCRawCluster
9  * Primitive data of a TPC cluster in raw coordinates. The plan is to store the
10  * data in a compressed format by limiting the resolution of the float values.
11  * @ingroup alihlt_tpc_datastructs
12  */
13 struct AliHLTTPCRawCluster {
14   /* UInt_t fP0;       // First  4 bytes of the packed data */
15   /* UInt_t fP1;       // Second 4 bytes of the packed data */
16   /* UInt_t fP2;       // Third  4 bytes of the packed data */
17   /* UInt_t fP3;       // Last   4 bytes of the packed data */
18   short fPadRow;
19   float fPad;
20   float fTime;
21   float fSigmaY2;
22   float fSigmaZ2;
23   unsigned short fCharge;
24   unsigned short fQMax;
25
26   Int_t   GetPadRow()  const {return fPadRow;}
27   Float_t GetPad()     const {return fPad;}
28   Float_t GetTime()    const {return fTime;}
29   Float_t GetSigmaY2() const {return fSigmaY2;}
30   Float_t GetSigmaZ2() const {return fSigmaZ2;}
31   Int_t   GetCharge()  const {return fCharge;}
32   Int_t   GetQMax()    const {return fQMax;}
33
34   void SetPadRow(Short_t padrow)  {fPadRow=padrow;}
35   void SetPad(Float_t pad)     {fPad=pad;}
36   void SetTime(Float_t time)    {fTime=time;}
37   void SetSigmaY2(Float_t sigmaY2) {fSigmaY2=sigmaY2;}
38   void SetSigmaZ2(Float_t sigmaZ2) {fSigmaZ2=sigmaZ2;}
39   void SetCharge(UShort_t charge)  {fCharge=charge;}
40   void SetQMax(UShort_t qmax)    {fQMax=qmax;}
41
42   /* Int_t GetPadRow()    const {return        (fP0>>24) &     0xff;} */
43   /* Float_t GetPad()     const {return (float( fP0      & 0xffffff)-8388608.)*1.e-4;} */
44   /* Float_t GetTime()    const {return (float( fP1      & 0xffffff)-8388608.)*1.e-4;} */
45   /* Float_t GetSigmaY2() const {return (float( fP2      &   0xffff)-32768.)*1.e-4;} */
46   /* Float_t GetSigmaZ2() const {return (float((fP2>>16) &   0xffff)-32768.)*1.e-4;} */
47   /* Int_t   GetCharge()  const {return         fP3      &  0xfffff;} */
48   /* Int_t   GetQMax()    const {return        (fP3>>20) &    0x3ff;} */
49
50   /* void SetPadRow(Int_t padrow)       { fP0&=0x00ffffff; fP0|=(padrow & 0xff)<<24;} */
51   /* void SetPad(Float_t pad)         { fP0&=0xff000000; float v=pad*1.e4+8388608.; */
52   /*                                       if( v<0 ) v=0; else if( v>0x00FFFFFF ) v=0x00FFFFFF; */
53   /*                                    UInt_t iv=(UInt_t) v; fP0|=iv; */
54   /* } */
55   /* void SetTime(Float_t time)       { fP1&=0xff000000; float v=time*1.e4+8388608.; */
56   /*                                       if( v<0 ) v=0; else if( v>0x00FFFFFF ) v=0x00FFFFFF; */
57   /*                                    UInt_t iv=(UInt_t) v; fP1|=iv; */
58   /* } */
59   /* void SetSigmaY2(Float_t sigmaY2) { fP2&=0xffff0000; float v=sigmaY2*1.e4+32768.; */
60   /*                                       if( v<0 ) v=0; else if( v>0x0000FFFF ) v=0x0000FFFF; */
61   /*                                    UInt_t iv=(UInt_t) v; fP2|=iv; */
62   /* } */
63   /* void SetSigmaZ2(Float_t sigmaZ2) { fP2&=0x0000ffff; float v=sigmaZ2*1.e4+32768.; */
64   /*                                       if( v<0 ) v=0; else if( v>0x0000FFFF ) v=0x0000FFFF; */
65   /*                                    UInt_t iv=(UInt_t) v; fP2|=iv<<16; */
66   /* } */
67   /* void SetCharge(Int_t charge)     { fP3&=0xfff00000; fP3|=charge&0xfffff;} */
68   /* void SetQMax(Int_t qmax)         { fP3&=0x000fffff; fP3|=(qmax&0x3ff)<<20;} */
69 };
70 typedef struct AliHLTTPCRawCluster AliHLTTPCRawCluster;
71
72 struct AliHLTTPCRawClusterData
73 {
74   UInt_t fVersion; // version number
75   UInt_t fCount;   // number of clusters
76 #if defined(__HP_aCC) || defined(__DECCXX) || defined(__SUNPRO_CC)
77   AliHLTTPCRawCluster  fClusters[1]; // array of clusters  
78 #else
79   AliHLTTPCRawCluster  fClusters[0]; // array of clusters 
80 #endif
81 };
82 typedef struct AliHLTTPCRawClusterData AliHLTTPCRawClusterData;
83
84 #endif