Line data Source code
1 : // -*- Mode: C++ -*-
2 : // $Id$
3 :
4 : #ifndef ALIHLTTPCMAPPING_H
5 : #define ALIHLTTPCMAPPING_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 : /** @file AliHLTTPCMapping.h
11 : @author Kenneth Aamodt
12 : @date
13 : @brief Mapping class for TPC.
14 : */
15 :
16 : #include "AliHLTLogging.h"
17 :
18 : /**
19 : * @class AliHLTTPCMapping
20 : * This is a mapping class for the TPC. It contains the mappping for all six partitions in static arrays.
21 : * This ensures that the asci files containing the mapping numbers is only read once per partition.
22 : * The only two methods interesting for the users are GetPad(hwaddress) and GetRow(hwaddress).
23 : *
24 : * There are several possibilities to count the rows:
25 : * - A: absolute number: 0 to 158 over all partitions
26 : * - B: sectorwise: 0 to 62 for inner, 0 to 95 for outer sector
27 : * - C: within a partition
28 : *
29 : * This mappping class is designed to return the mapping within a partition (C), while the
30 : * mapping files use scheme B. The first row of each partition counted in scheme B has to
31 : * be subtracted.
32 : *
33 : * @ingroup alihlt_tpc
34 : */
35 : class AliHLTTPCMapping : public AliHLTLogging {
36 : public:
37 : /** standard constructor */
38 : AliHLTTPCMapping(UInt_t patch);
39 :
40 : /** standard destructor */
41 : virtual ~AliHLTTPCMapping();
42 :
43 : /**
44 : * Create mapping for the given patch.
45 : */
46 : void InitializeMap(UInt_t patch);
47 :
48 : /**
49 : * Get the pad number belonging to hardware address.
50 : * @param HWAddress The hardware address of the given pad
51 : * @return Pad number of given HWAddress
52 : */
53 : UInt_t GetPad(UInt_t HWAddress) const;
54 :
55 : /**
56 : * Get the row number belonging to hardware address.
57 : * @param HWAddress The hardware address of the given pad you are on.
58 : * @return Row number of hardware address (Pad).
59 : */
60 : UInt_t GetRow(UInt_t HWAddress) const;
61 :
62 : /**
63 : * Get the HW addess (channel no) for a row/pad coordinate.
64 : * @param row The row in the partition
65 : * @param pad The pad in the row
66 : * @return hardware address (channel no).
67 : */
68 : UInt_t GetHwAddress(UInt_t row, UInt_t pad) const;
69 :
70 : /**
71 : * Read the mapping array from file.
72 : * @param patch the patch (partition) to read
73 : * @param arraySize size of the mapping arrays
74 : * @param rowArray array of row mapping
75 : * @param padArray array of pad mapping
76 : * @param hwaMappingSize size of the HW address mapping
77 : * @param hwaArray array of HW address mapping (backwards mapping)
78 : * @return kTRUE if successful
79 : */
80 : Bool_t ReadArray(UInt_t patch, UInt_t arraySize, UInt_t rowArray[], UInt_t padArray[], UInt_t hwaMappingSize, UInt_t hwaArray[]) const;
81 :
82 : /**
83 : * Checks if the hw address is valid
84 : * @param HWAddress The hardware address of the pad
85 : * @return kTRUE if valid HWAddress
86 : */
87 : Bool_t IsValidHWAddress(UInt_t HWAddress) const;
88 :
89 : /**
90 : * Method which returns the row offset of the patch.
91 : * @return row offset of patch.
92 : */
93 0 : Int_t GetRowOffset() const {return fRowOffset;}
94 :
95 : private:
96 : /** standard constructor prohibited, pad no always required */
97 : AliHLTTPCMapping();
98 : /** copy constructor prohibited */
99 : AliHLTTPCMapping(const AliHLTTPCMapping&);
100 : /** assignment operator prohibited */
101 : AliHLTTPCMapping& operator=(const AliHLTTPCMapping&);
102 :
103 : /** the readout partition/patch */
104 : UInt_t fPatch; //! transient
105 :
106 : /** global number of patches */
107 : static const UChar_t fgkNofPatches=6; //! transient
108 :
109 : /** Flags to check if mapping is done for the six patches */
110 : static Bool_t fgMappingIsDone[fgkNofPatches]; //! transient
111 :
112 : /** size of mapping arrays */
113 : static const UInt_t fgkMappingSize[fgkNofPatches]; // see above
114 :
115 : /** array of the row mappings */
116 : static UInt_t* fgRowMapping[fgkNofPatches]; //! transient
117 :
118 : /** array of the pad mappings */
119 : static UInt_t* fgPadMapping[fgkNofPatches]; //! transient
120 :
121 : /** array of the HW address mappings */
122 : static UInt_t* fgHwaMapping[fgkNofPatches]; //! transient
123 :
124 : /** size of mapping array for patch 0 */
125 : static const UInt_t fgkMapping0Size=3200; // see above
126 : /** size of mapping array for patch 1 */
127 : static const UInt_t fgkMapping1Size=3584; // see above
128 : /** size of mapping array for patch 2 */
129 : static const UInt_t fgkMapping2Size=3200; // see above
130 : /** size of mapping array for patch 3 */
131 : static const UInt_t fgkMapping3Size=3328; // see above
132 : /** size of mapping array for patch 4 */
133 : static const UInt_t fgkMapping4Size=3328; // see above
134 : /** size of mapping array for patch 5 */
135 : static const UInt_t fgkMapping5Size=3328; // see above
136 :
137 : /** name space for HW address mapping pad encoding */
138 : static const UInt_t fgkMappingHwaPadMask=0xff; //! transient
139 : /** bit shift for HW address mapping row encoding */
140 : static const UInt_t fgkMappingHwaRowMask=0x3f00; //! transient
141 : /** name space for HW address mapping row encoding */
142 : static const UChar_t fgkMappingHwaRowBitShift=8; //! transient
143 : /** size of row/pad to channel mapping
144 : * bit 0-8 encode pad
145 : * bit 9-11 encode row
146 : */
147 : static const UInt_t fgkMappingHwaSize=0x4000; // see above
148 :
149 : /** row mapping array for patch 0 */
150 : static UInt_t fgRowMapping0[fgkMapping0Size]; // see above
151 : /** pad mapping array for patch 0 */
152 : static UInt_t fgPadMapping0[fgkMapping0Size]; // see above
153 : /** hw address mapping array for patch 0 */
154 : static UInt_t fgHwaMapping0[fgkMappingHwaSize]; // see above
155 : /** row mapping array for patch 1 */
156 : static UInt_t fgRowMapping1[fgkMapping1Size]; // see above
157 : /** pad mapping array for patch 1 */
158 : static UInt_t fgPadMapping1[fgkMapping1Size]; // see above
159 : /** hw address mapping array for patch 1 */
160 : static UInt_t fgHwaMapping1[fgkMappingHwaSize]; // see above
161 : /** row mapping array for patch 2 */
162 : static UInt_t fgRowMapping2[fgkMapping2Size]; // see above
163 : /** pad mapping array for patch 2 */
164 : static UInt_t fgPadMapping2[fgkMapping2Size]; // see above
165 : /** hw address mapping array for patch 2 */
166 : static UInt_t fgHwaMapping2[fgkMappingHwaSize]; // see above
167 : /** row mapping array for patch 3 */
168 : static UInt_t fgRowMapping3[fgkMapping3Size]; // see above
169 : /** pad mapping array for patch 3 */
170 : static UInt_t fgPadMapping3[fgkMapping3Size]; // see above
171 : /** hw addres mapping array for patch 3 */
172 : static UInt_t fgHwaMapping3[fgkMappingHwaSize]; // see above
173 : /** row mapping array for patch 4 */
174 : static UInt_t fgRowMapping4[fgkMapping4Size]; // see above
175 : /** pad mapping array for patch 4 */
176 : static UInt_t fgPadMapping4[fgkMapping4Size]; // see above
177 : /** hw address mapping array for patch 4 */
178 : static UInt_t fgHwaMapping4[fgkMappingHwaSize]; // see above
179 : /** row mapping array for patch 5 */
180 : static UInt_t fgRowMapping5[fgkMapping5Size]; // see above
181 : /** pad mapping array for patch 5 */
182 : static UInt_t fgPadMapping5[fgkMapping5Size]; // see above
183 : /** hw address mapping array for patch 5 */
184 : static UInt_t fgHwaMapping5[fgkMappingHwaSize]; // see above
185 :
186 : /** current row mapping array */
187 : UInt_t *fCurrentRowMapping; //!transient
188 : /** current pad mapping array */
189 : UInt_t *fCurrentPadMapping; //!transient
190 :
191 : /** number of rows */
192 : Int_t fNofRows; // see above
193 :
194 : /** Maximum number of hardware addresses */
195 : UInt_t fMaxHWAdd; //!transient
196 :
197 : /** row offset according to scheme A (see class description) */
198 : Int_t fRowOffset; //!transient
199 :
200 6 : ClassDef(AliHLTTPCMapping, 0)
201 : };
202 : #endif // ALIHLTTPCMAPPING_H
|