]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCDefinitions.h
minor coverity defect: added protection for self-assignment
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCDefinitions.h
1 // XEmacs -*-C++-*-
2 // @(#) $Id$
3
4 #ifndef ALIHLTTPCDEFINITIONS_H
5 #define ALIHLTTPCDEFINITIONS_H
6 //* This file is property of and copyright by the ALICE HLT Project        * 
7 //* ALICE Experiment at CERN, All rights reserved.                         *
8 //* See cxx source for full Copyright notice                               *
9
10 #include "AliHLTDataTypes.h"
11 #include "Rtypes.h"
12
13 /**
14  * @class AliHLTTPCDefinitions
15  * Data type definitions for the libAliHLTTPC library.
16  * 
17  * @ingroup alihlt_tpc
18  */
19 class AliHLTTPCDefinitions
20 {
21 public:
22
23         static AliHLTUInt8_t GetMinSliceNr( const AliHLTComponentBlockData& block )
24                 {
25                 return (AliHLTUInt8_t)( (block.fSpecification & 0x00FF0000) >> 16 );
26                 }
27         static AliHLTUInt8_t GetMinSliceNr( ULong_t spec )
28                 {
29                 return (AliHLTUInt8_t)( (spec & 0x00FF0000) >> 16 );
30                 }
31         static AliHLTUInt8_t GetMaxSliceNr( const AliHLTComponentBlockData& block )
32                 {
33                 return (AliHLTUInt8_t)( (block.fSpecification & 0xFF000000) >> 24 );
34                 }
35         static AliHLTUInt8_t GetMaxSliceNr( ULong_t spec )
36                 {
37                 return (AliHLTUInt8_t)( (spec & 0xFF000000) >> 24 );
38                 }
39         static AliHLTUInt8_t GetMinPatchNr( const AliHLTComponentBlockData& block )
40                 {
41                 return (AliHLTUInt8_t)( (block.fSpecification & 0x000000FF) );
42                 }
43         static AliHLTUInt8_t GetMinPatchNr( ULong_t spec )
44                 {
45                 return (AliHLTUInt8_t)( (spec & 0x000000FF) );
46                 }
47         static AliHLTUInt8_t GetMaxPatchNr( const AliHLTComponentBlockData& block )
48                 {
49                 return (AliHLTUInt8_t)( (block.fSpecification & 0x0000FF00) >> 8 );
50                 }
51         static AliHLTUInt8_t GetMaxPatchNr( ULong_t spec )
52                 {
53                 return (AliHLTUInt8_t)( (spec & 0x0000FF00) >> 8 );
54                 }
55         
56         static AliHLTUInt32_t EncodeDataSpecification( AliHLTUInt8_t minSliceNr, 
57                                                 AliHLTUInt8_t maxSliceNr,
58                                                 AliHLTUInt8_t minPatchNr,
59                                                 AliHLTUInt8_t maxPatchNr )
60                 {
61                 return ((maxSliceNr & 0xFF) << 24) | ((minSliceNr & 0xFF) << 16) | ((maxPatchNr & 0xFF) << 8) | ((minPatchNr & 0xFF));
62                 }
63         
64         /**
65          * Converts a slice and patch number to a DDL ID number for TPC.
66          * \param slice  The slice number in the range [0..35] (0..17 for A side and 18..35 for C side).
67          * \param patch  The patch number in the range [0..5].
68          * \returns the DDL ID number of TPC or -1 if the slice or patch was invalid.
69          * \note A side is in the -z axis direction (same side as the muon spectrometer)
70          *       and C side is in the +z axis direction.
71          */
72         static AliHLTInt32_t SlicePatchToDDLId(AliHLTUInt8_t slice, AliHLTUInt8_t patch)
73                 {
74                 if (slice > 35 or patch > 5) return -1;
75                 return 768 + (patch > 1 ? 72 + 4*slice + patch - 2 : 2*slice + patch);
76                 }
77                 
78         /**
79          * Converts a DDL ID number for the TPC to a slice and patch number.
80          * \param [in] ddlid  The DDL ID number to convert.
81          * \param [out] slice  The resultant slice number in the range [0..35].
82          * \param [out] patch  The resultant patch number in the range [0..5].
83          * \returns true if the DDL ID number was valid and slice and patch were set,
84          *     otherwise false for an invalid DDL ID.
85          */
86         static bool DDLIdToSlicePatch(AliHLTInt32_t ddlid, AliHLTUInt8_t& slice, AliHLTUInt8_t& patch);
87
88   /** DDL entropy encoded data */
89   static const AliHLTComponentDataType fgkDDLEncodedEntropyRawDataType; // see above
90   static const AliHLTComponentDataType& DDLEncodedEntropyRawDataType();
91   /** packed RAW data */
92   static const AliHLTComponentDataType fgkPackedRawDataType;            // see above
93   static const AliHLTComponentDataType& PackedRawDataType();
94   /** unpacked RAW data */
95   static const AliHLTComponentDataType fgkUnpackedRawDataType;          // see above
96   static const AliHLTComponentDataType& UnpackedRawDataType();
97   /** cluster data */
98   static const AliHLTComponentDataType fgkClustersDataType;             // see above
99   static const AliHLTComponentDataType& ClustersDataType();
100   /** raw cluster data (not transformed) */
101   static const AliHLTComponentDataType fgkRawClustersDataType;          // see above
102   static const AliHLTComponentDataType& RawClustersDataType();
103   /** HW cluster data */
104   static const AliHLTComponentDataType fgkHWClustersDataType;           // see above
105   static const AliHLTComponentDataType& HWClustersDataType();
106   /** HW alternative output cluster data */
107   static const AliHLTComponentDataType fgkAlterClustersDataType;        // see above
108   static const AliHLTComponentDataType& AlterClustersDataType();
109   /** track segments in local coordinates */
110   static const AliHLTComponentDataType fgkTrackSegmentsDataType;        // see above
111   static const AliHLTComponentDataType& TrackSegmentsDataType();
112   /** tracks in global koordinates */
113   static const AliHLTComponentDataType fgkTracksDataType;               // see above
114   static const AliHLTComponentDataType& TracksDataType();
115   /** vertex data structure */
116   static const AliHLTComponentDataType fgkVertexDataType;               // see above
117   static const AliHLTComponentDataType& VertexDataType();
118
119   // Cluster & Tracks model data
120   /** cluster tracks model data type */
121   static const AliHLTComponentDataType fgkClusterTracksModelDataType;          // see above
122   static const AliHLTComponentDataType& ClusterTracksModelDataType();
123   /** remaining clusters model data type */
124   static const AliHLTComponentDataType fgkRemainingClustersModelDataType;      // see above
125   static const AliHLTComponentDataType& RemainingClustersModelDataType();
126   /** track clusters compressed data type */
127   static const AliHLTComponentDataType fgkClusterTracksCompressedDataType;     // see above
128   static const AliHLTComponentDataType& ClusterTracksCompressedDataType();
129   /** track cluster ids data type */
130   static const AliHLTComponentDataType& ClusterIdTracksDataType();
131   /** remaining clusters compressed data type */
132   static const AliHLTComponentDataType fgkRemainingClustersCompressedDataType; // see above
133   static const AliHLTComponentDataType& RemainingClustersCompressedDataType();
134   /** remaining clusters ids data type */
135   static const AliHLTComponentDataType& RemainingClusterIdsDataType();
136
137   // Calibration data
138   /** pedestal calibration data */
139   static const AliHLTComponentDataType& CalibPedestalDataType();
140   /** signal calibration data */
141   static const AliHLTComponentDataType& CalibPulserDataType();
142   /** central electrode calibration data */
143   static const AliHLTComponentDataType& CalibCEDataType();
144
145   // offline calbration components
146
147   /** alignment calibration data */
148   static const AliHLTComponentDataType& OfflineCalibAlignDataType();
149   /** track calibration data */
150   static const AliHLTComponentDataType& OfflineCalibTracksDataType();
151   /** gain calibration data */
152   static const AliHLTComponentDataType& OfflineCalibTracksGainDataType();
153   /** cluster monte carlo information */
154   static const AliHLTComponentDataType fgkAliHLTDataTypeClusterMCInfo;    // see above
155   static const AliHLTComponentDataType& AliHLTDataTypeClusterMCInfo();
156
157   // ids for the different parameters of a cluster
158   enum AliClusterParameterId_t {
159     kPadRow = 0,
160     kPad,
161     kTime,
162     kSigmaY2,
163     kSigmaZ2,
164     kCharge,
165     kQMax,
166     kResidualPad,
167     kResidualTime,
168     kClusterCount,
169     kLast = kQMax
170   };
171
172   // helper struct for the definition of cluster parameters
173   struct AliClusterParameter {
174     AliClusterParameterId_t fId; //! id of the parameter
175     const char* fName;           //! name of the parameter
176     int fBitLength;              //! bit length
177     int fOptional;               //! optional parameter
178     int fScale;                  //! scale for conversion to int number
179   };
180
181   static const AliClusterParameter fgkClusterParameterDefinitions[];
182   static unsigned GetNumberOfClusterParameterDefinitions();
183   static const unsigned fgkMaxClusterDeltaPad;
184   static unsigned GetMaxClusterDeltaPad() {return fgkMaxClusterDeltaPad;}
185   static const unsigned fgkMaxClusterDeltaTime;
186   static unsigned GetMaxClusterDeltaTime() {return fgkMaxClusterDeltaTime;}
187
188 private:
189
190   /// Do not allow creation of this class since everything is static.
191   AliHLTTPCDefinitions();
192   virtual ~AliHLTTPCDefinitions();
193
194   ClassDef(AliHLTTPCDefinitions, 0)  // Useful static definitions and methods for TPC
195 };
196
197 #endif