]>
Commit | Line | Data |
---|---|---|
7dceaa9b | 1 | // -*- Mode: C++ -*- |
7e914051 | 2 | // $Id$ |
7dceaa9b | 3 | |
4 | #ifndef ALIHLTTPCMAPPING_H | |
5 | #define ALIHLTTPCMAPPING_H | |
353508b1 | 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 * | |
7dceaa9b | 9 | |
10 | /** @file AliHLTTPCMapping.h | |
11 | @author Kenneth Aamodt | |
12 | @date | |
13 | @brief Mapping class for TPC. | |
14 | */ | |
15 | ||
7dceaa9b | 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). | |
353508b1 | 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 | * | |
7dceaa9b | 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 | */ | |
a74855c2 | 53 | UInt_t GetPad(UInt_t HWAddress) const; |
7dceaa9b | 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 | */ | |
a74855c2 | 60 | UInt_t GetRow(UInt_t HWAddress) const; |
7dceaa9b | 61 | |
353508b1 | 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 | ||
d2f725e4 | 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 | Int_t GetRowOffset() const {return fRowOffset;} | |
94 | ||
7dceaa9b | 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&); | |
7dceaa9b | 102 | |
353508b1 | 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 | |
7dceaa9b | 111 | |
112 | /** size of mapping arrays */ | |
353508b1 | 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 */ | |
a74855c2 | 125 | static const UInt_t fgkMapping0Size=3200; // see above |
7dceaa9b | 126 | /** size of mapping array for patch 1 */ |
a74855c2 | 127 | static const UInt_t fgkMapping1Size=3584; // see above |
7dceaa9b | 128 | /** size of mapping array for patch 2 */ |
a74855c2 | 129 | static const UInt_t fgkMapping2Size=3200; // see above |
7dceaa9b | 130 | /** size of mapping array for patch 3 */ |
a74855c2 | 131 | static const UInt_t fgkMapping3Size=3328; // see above |
7dceaa9b | 132 | /** size of mapping array for patch 4 */ |
a74855c2 | 133 | static const UInt_t fgkMapping4Size=3328; // see above |
7dceaa9b | 134 | /** size of mapping array for patch 5 */ |
a74855c2 | 135 | static const UInt_t fgkMapping5Size=3328; // see above |
7dceaa9b | 136 | |
353508b1 | 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 | ||
a74855c2 | 149 | /** row mapping array for patch 0 */ |
7dceaa9b | 150 | static UInt_t fgRowMapping0[fgkMapping0Size]; // see above |
a74855c2 | 151 | /** pad mapping array for patch 0 */ |
7dceaa9b | 152 | static UInt_t fgPadMapping0[fgkMapping0Size]; // see above |
353508b1 | 153 | /** hw address mapping array for patch 0 */ |
154 | static UInt_t fgHwaMapping0[fgkMappingHwaSize]; // see above | |
a74855c2 | 155 | /** row mapping array for patch 1 */ |
7dceaa9b | 156 | static UInt_t fgRowMapping1[fgkMapping1Size]; // see above |
a74855c2 | 157 | /** pad mapping array for patch 1 */ |
7dceaa9b | 158 | static UInt_t fgPadMapping1[fgkMapping1Size]; // see above |
353508b1 | 159 | /** hw address mapping array for patch 1 */ |
160 | static UInt_t fgHwaMapping1[fgkMappingHwaSize]; // see above | |
a74855c2 | 161 | /** row mapping array for patch 2 */ |
7dceaa9b | 162 | static UInt_t fgRowMapping2[fgkMapping2Size]; // see above |
a74855c2 | 163 | /** pad mapping array for patch 2 */ |
7dceaa9b | 164 | static UInt_t fgPadMapping2[fgkMapping2Size]; // see above |
353508b1 | 165 | /** hw address mapping array for patch 2 */ |
166 | static UInt_t fgHwaMapping2[fgkMappingHwaSize]; // see above | |
a74855c2 | 167 | /** row mapping array for patch 3 */ |
7dceaa9b | 168 | static UInt_t fgRowMapping3[fgkMapping3Size]; // see above |
a74855c2 | 169 | /** pad mapping array for patch 3 */ |
7dceaa9b | 170 | static UInt_t fgPadMapping3[fgkMapping3Size]; // see above |
353508b1 | 171 | /** hw addres mapping array for patch 3 */ |
172 | static UInt_t fgHwaMapping3[fgkMappingHwaSize]; // see above | |
a74855c2 | 173 | /** row mapping array for patch 4 */ |
7dceaa9b | 174 | static UInt_t fgRowMapping4[fgkMapping4Size]; // see above |
a74855c2 | 175 | /** pad mapping array for patch 4 */ |
7dceaa9b | 176 | static UInt_t fgPadMapping4[fgkMapping4Size]; // see above |
353508b1 | 177 | /** hw address mapping array for patch 4 */ |
178 | static UInt_t fgHwaMapping4[fgkMappingHwaSize]; // see above | |
a74855c2 | 179 | /** row mapping array for patch 5 */ |
7dceaa9b | 180 | static UInt_t fgRowMapping5[fgkMapping5Size]; // see above |
a74855c2 | 181 | /** pad mapping array for patch 5 */ |
7dceaa9b | 182 | static UInt_t fgPadMapping5[fgkMapping5Size]; // see above |
353508b1 | 183 | /** hw address mapping array for patch 5 */ |
184 | static UInt_t fgHwaMapping5[fgkMappingHwaSize]; // see above | |
7dceaa9b | 185 | |
a74855c2 | 186 | /** current row mapping array */ |
187 | UInt_t *fCurrentRowMapping; //!transient | |
188 | /** current pad mapping array */ | |
189 | UInt_t *fCurrentPadMapping; //!transient | |
7dceaa9b | 190 | |
353508b1 | 191 | /** number of rows */ |
192 | Int_t fNofRows; // see above | |
7dceaa9b | 193 | |
194 | /** Maximum number of hardware addresses */ | |
d2f725e4 | 195 | UInt_t fMaxHWAdd; //!transient |
196 | ||
353508b1 | 197 | /** row offset according to scheme A (see class description) */ |
d2f725e4 | 198 | Int_t fRowOffset; //!transient |
7dceaa9b | 199 | |
22240104 | 200 | ClassDef(AliHLTTPCMapping, 0) |
7dceaa9b | 201 | }; |
202 | #endif // ALIHLTTPCMAPPING_H |