FairRoot/PandaRoot
Public Member Functions | List of all members
PndTopix4 Class Reference

#include <PndTopix4.h>

Public Member Functions

 PndTopix4 ()
 
virtual ~PndTopix4 ()
 
ULong64_t ConvertToPix4HammingToStandardHamming (ULong64_t topixhamming)
 
int GetType (ULong64_t data)
 returns if the data word is a header (0b01), trailer (0b10) or data (0b11) More...
 
int GetFrameCount (ULong64_t data)
 
ToPix4::pixel BitAnalyzePixelData (ULong64_t &data)
 
ToPix4::frameHeader BitAnalyzeHeader (ULong64_t &header)
 
ToPix4::frameTrailer BitAnalyzeTrailer (ULong64_t &trailer)
 
std::vector< ULong64_t > GetRawData (TMrfData_8b *data)
 
ToPix4::pixelAddress PixelNumberToPixelAddress (UInt_t pixelnumber)
 
std::pair< UInt_t, UInt_t > PixelAddressToMatrixAddress (ToPix4::pixelAddress address)
 
std::pair< UInt_t, UInt_t > PixelAddressToMatrixAddress (UInt_t row, UInt_t col, Bool_t side)
 
std::pair< UInt_t, UInt_t > PixelNumberToMatrixAddress (UInt_t pixelnumber)
 
ToPix4::pixelAddress MatrixAddressToPixelAddress (std::pair< UInt_t, UInt_t > matrixAddress)
 
ToPix4::pixelAddress MatrixAddressToPixelAddress (UInt_t matrix_col, UInt_t matrix_row)
 
std::pair< UInt_t, UInt_t > MatrixAddressToPixelAddressConf (UInt_t matrix_col, UInt_t matrix_row)
 

Detailed Description

Definition at line 53 of file PndTopix4.h.

Constructor & Destructor Documentation

PndTopix4::PndTopix4 ( )

Definition at line 16 of file PndTopix4.cxx.

16  {
17  // TODO Auto-generated constructor stub
18 
19 }
PndTopix4::~PndTopix4 ( )
virtual

Definition at line 21 of file PndTopix4.cxx.

21  {
22  // TODO Auto-generated destructor stub
23 }

Member Function Documentation

ToPix4::frameHeader PndTopix4::BitAnalyzeHeader ( ULong64_t &  header)

Definition at line 61 of file PndTopix4.cxx.

References ToPix4::frameHeader::fChipAddress, ToPix4::frameHeader::fECC, and ToPix4::frameHeader::fFrameCount.

Referenced by PndMvdReadInToPix4TBData::AnalyzeToPixFrame(), and PndMvdReadInToPix4TBData::BuildFrame().

62 {
63  ToPix4::frameHeader tempHeader;
64  ULong_t temp = header;
65  tempHeader.fECC = temp & 0x3F;
66  temp = temp >> 18;
67  tempHeader.fFrameCount = temp & 0xFF;
68 
69  temp = temp >> 8;
70  tempHeader.fChipAddress = temp & 0xFFF;
71 
72  return tempHeader;
73 }
ToPix4::pixel PndTopix4::BitAnalyzePixelData ( ULong64_t &  data)

Definition at line 91 of file PndTopix4.cxx.

References ToPix4::pixel::fLeadingEdge, ToPix4::pixel::fPixelNumber, ToPix4::pixel::fTrailingEdge, and mrftools::grayToBin().

Referenced by PndMvdReadInToPix4TBData::ProcessData().

92 {
93  //le_dataword = ((dataword & 0x0000000000fff000)>>12);¬
94  //te_dataword = (dataword & 0x0000000000000fff);¬
95  //pixeladdress = ((dataword & 0x0000003fff000000)>>24);¬
96 
97  ToPix4::pixel tempPixel;
98  ULong_t temp = data;
99  tempPixel.fTrailingEdge = mrftools::grayToBin(temp & 0X0000000000000FFF);
100 
101  temp = temp >> 12;
102  tempPixel.fLeadingEdge = mrftools::grayToBin(temp & 0X0000000000000FFF);
103 
104  temp = temp >> 12;
105  tempPixel.fPixelNumber = temp & 0X00000000000003FFF;
106 
107 // if (fVerbose > 1) std::cout << "BitAnalyzePixelData: " << std::hex << data << " pixel " << std::dec << tempPixel.fPixelAddress << " " << tempPixel.fLeadingEdge << " " << tempPixel.fTrailingEdge << std::endl;
108 
109  return tempPixel;
110 }
UInt_t grayToBin(UInt_t gray)
Converts gray encoded values to bianry values.
UInt_t fLeadingEdge
Definition: PndTopix4.h:36
UInt_t fPixelNumber
Definition: PndTopix4.h:33
UInt_t fTrailingEdge
Definition: PndTopix4.h:37
ToPix4::frameTrailer PndTopix4::BitAnalyzeTrailer ( ULong64_t &  trailer)

Definition at line 75 of file PndTopix4.cxx.

References ToPix4::frameTrailer::fECC, ToPix4::frameTrailer::fFrameCRC, and ToPix4::frameTrailer::fNEvents.

Referenced by PndMvdReadInToPix4TBData::AnalyzeToPixFrame().

76 {
77  ToPix4::frameTrailer tempTrailer;
78  ULong_t temp = trailer;
79  tempTrailer.fECC = temp & 0x3F;
80 
81  temp = temp >> 6;
82  tempTrailer.fFrameCRC = temp & 0xFFFF;
83 
84  temp = temp >> 16;
85  tempTrailer.fNEvents = temp & 0xFFFF;
86 
87  return tempTrailer;
88 
89 }
ULong64_t PndTopix4::ConvertToPix4HammingToStandardHamming ( ULong64_t  topixhamming)

Definition at line 314 of file PndTopix4.cxx.

Referenced by PndMvdReadInToPix4TBData::CheckDataIntegrity().

315 {
316  // The ToPix header and trailer data word consists of 34 data bits and 6 hamming bits.
317  // bit no: 39 38 37 36 35 9 8 7 6 5 4 3 2 1 0
318  // In a ToPix4 dataword the hamming bits are at the end of the word: (d34)(d33)(d32)(d31)(d30) ... (d04)(d03)(d02)(d01)(H 6)(H 5)(H 4)(H 3)(H 2)(H 1)
319  // At the standard hamming encoding the hamming bits are at the 2^i positions (d34)(d33)(d32)(d31)(d30) ... (d07)(d06)(d05)(d04)(H 3)(d03)(d02)(d01)(H 2)(H 1)
320  // This function expects a ToPix4 encoded dataword and moves the hamming bits at the end to the defined positions.
321 
322  ULong64_t standard_hamming = 0;
323 
324  standard_hamming = ( topixhamming & 0xff00000000);
325  standard_hamming += ((topixhamming & 0x00fffe0000) >> 1 );
326  standard_hamming += ((topixhamming & 0x000001fc00) >> 2 );
327  standard_hamming += ((topixhamming & 0x0000000380) >> 3 );
328  standard_hamming += ((topixhamming & 0x0000000040) >> 4 );
329 
330  standard_hamming += ((topixhamming & 0x0000000020) << 26 );
331  standard_hamming += ((topixhamming & 0x0000000010) << 11 );
332  standard_hamming += ((topixhamming & 0x0000000008) << 4 );
333  standard_hamming += ((topixhamming & 0x0000000004) << 1 );
334  standard_hamming += ( topixhamming & 0x0000000002);
335  standard_hamming += ( topixhamming & 0x0000000001);
336 
337  return standard_hamming;
338 }
int PndTopix4::GetFrameCount ( ULong64_t  data)

Definition at line 55 of file PndTopix4.cxx.

55  {
56  ULong_t frame = data & 0x3FC0000;
57  frame = frame >> 18;
58  return (int)frame;
59 }
std::vector< ULong64_t > PndTopix4::GetRawData ( TMrfData_8b data)

Definition at line 25 of file PndTopix4.cxx.

References TMrfData_8b::getNumWords(), TMrfData_8b::getWord(), and i.

Referenced by PndMQTopix4ProcessorTask::Exec(), PndMvdReadInToPix4TBData::ReadInData(), and PndMQTopix4Processor::Run().

26 {
27  std::vector<ULong64_t> rawData;
28  for (UInt_t i = 0; i < data->getNumWords(); i += 5) {
29  ULong_t dataword = 0;
30  for (UInt_t j = 0; j < 5; j++) {
31  dataword = dataword << 8;
32  dataword += data->getWord(i + j);
33  }
34  rawData.push_back(dataword);
35 
36 // if (fVerbose > 2) {
37  ULong_t frameCount = -1;
38  ULong64_t header = GetType(dataword);
39  if (header == 1)
40  frameCount = GetFrameCount(dataword);
41 
42 // LOG(INFO) << std::dec << "dataword No " << i / 5 << "/" << data->getNumWords() / 5 << ": " << std::hex
43 // << dataword << " ";
44 // }
45  }
46  return rawData;
47 }
Int_t i
Definition: run_full.C:25
int GetFrameCount(ULong64_t data)
Definition: PndTopix4.cxx:55
const UChar_t & getWord(const UInt_t &position) const
Retrieves the word found at position.
const UInt_t & getNumWords() const
Retrieves the length of the register in words.
int GetType(ULong64_t data)
returns if the data word is a header (0b01), trailer (0b10) or data (0b11)
Definition: PndTopix4.cxx:49
int PndTopix4::GetType ( ULong64_t  data)

returns if the data word is a header (0b01), trailer (0b10) or data (0b11)

Definition at line 49 of file PndTopix4.cxx.

Referenced by PndMvdReadInToPix4TBData::AnalyzeToPixFrame(), and PndMvdReadInToPix4TBData::BuildFrame().

49  {
50  ULong_t header = data & 0xC000000000;
51  header = header >> 38;
52  return (int)header;
53 }
ToPix4::pixelAddress PndTopix4::MatrixAddressToPixelAddress ( std::pair< UInt_t, UInt_t >  matrixAddress)

Definition at line 288 of file PndTopix4.cxx.

References ToPix4::pixelAddress::fCol, ToPix4::pixelAddress::fRow, and ToPix4::pixelAddress::fSide.

Referenced by MatrixAddressToPixelAddress(), and MatrixAddressToPixelAddressConf().

289 {
290  UInt_t matrix_col = matrixAddress.first;
291  UInt_t matrix_row = matrixAddress.second;
292 
293  ToPix4::pixelAddress address;
294  if (matrix_col < 2 || matrix_col > 17){
295  address.fSide = !(matrix_col%2);
296  address.fCol = matrix_col/2;
297  address.fRow = matrix_row;
298  } else {
299  address.fCol = (matrix_col - 2) / 8 + 1;
300  if ( ((matrix_col - 2) / 2) % 2 == 0) {
301  address.fRow = (matrix_col - 2) / 2 * 32 + matrix_row;
302  address.fSide = !((matrix_col - 2) % 2);
303  } else {
304  address.fRow = ((((matrix_col - 2) % 8) / 2) + 1) * 32 - (matrix_row + 1);
305  address.fSide = ((matrix_col - 2) % 2);
306  }
307  }
308 
309  //std::cout << matrix_row << "/" << matrix_col << "-->" << address.fRow << "/" << address.fCol << "/" << address.fSide << std::endl;
310 
311  return address;
312 }
ToPix4::pixelAddress PndTopix4::MatrixAddressToPixelAddress ( UInt_t  matrix_col,
UInt_t  matrix_row 
)
inline

Definition at line 77 of file PndTopix4.h.

References MatrixAddressToPixelAddress().

77  {
78  return MatrixAddressToPixelAddress(std::make_pair(matrix_col, matrix_row));
79  };
ToPix4::pixelAddress MatrixAddressToPixelAddress(std::pair< UInt_t, UInt_t > matrixAddress)
Definition: PndTopix4.cxx:288
std::pair<UInt_t, UInt_t> PndTopix4::MatrixAddressToPixelAddressConf ( UInt_t  matrix_col,
UInt_t  matrix_row 
)
inline

Definition at line 81 of file PndTopix4.h.

References ToPix4::pixelAddress::fCol, ToPix4::pixelAddress::fRow, ToPix4::pixelAddress::fSide, and MatrixAddressToPixelAddress().

81  { //converts a matrix address (0-20, 0-31) into a ToPix configuration address col 0-7, row 0-31 / 0-127
82  ToPix4::pixelAddress address = MatrixAddressToPixelAddress(matrix_col, matrix_row);
83  UInt_t col = address.fCol * 2;
84  col += !(address.fSide);
85  UInt_t row = address.fRow;
86  return std::make_pair(col, row);
87  }
int row
Definition: anaLmdDigi.C:67
int col
Definition: anaLmdDigi.C:67
ToPix4::pixelAddress MatrixAddressToPixelAddress(std::pair< UInt_t, UInt_t > matrixAddress)
Definition: PndTopix4.cxx:288
std::pair< UInt_t, UInt_t > PndTopix4::PixelAddressToMatrixAddress ( ToPix4::pixelAddress  address)

Definition at line 258 of file PndTopix4.cxx.

References ToPix4::pixelAddress::fCol, ToPix4::pixelAddress::fRow, and ToPix4::pixelAddress::fSide.

259 {
260  UInt_t matrix_row = 0;
261  UInt_t matrix_col = 0;
262 
263  if (address.fCol == 0 || address.fCol == 3){
264  matrix_row = address.fRow;
265  matrix_col = address.fCol * 6 + !(address.fSide);
266  }
267 
268  else {
269  matrix_col = (address.fRow / 32) * 2 + 2 + ((address.fCol - 1) * 8);
270  if ( (address.fRow/32) % 2 == 0 ){
271  matrix_row = address.fRow % 32;
272  matrix_col += !(address.fSide);
273  }
274  else {
275  matrix_row = 31 - address.fRow % 32;
276  matrix_col += address.fSide;
277  }
278  }
279  //std::cout << address.fRow << "/" << address.fCol << "/" << address.fSide << " --> " << matrix_row << "/" << matrix_col << std::endl;
280  return std::pair<UInt_t, UInt_t>(matrix_col, matrix_row);
281 }
std::pair< UInt_t, UInt_t > PndTopix4::PixelAddressToMatrixAddress ( UInt_t  row,
UInt_t  col,
Bool_t  side 
)

Definition at line 283 of file PndTopix4.cxx.

283  {
284  ToPix4::pixelAddress address(row, col, side);
285  return PixelAddressToMatrixAddress(address);
286 }
int row
Definition: anaLmdDigi.C:67
std::pair< UInt_t, UInt_t > PixelAddressToMatrixAddress(ToPix4::pixelAddress address)
Definition: PndTopix4.cxx:258
int col
Definition: anaLmdDigi.C:67
std::pair< UInt_t, UInt_t > PndTopix4::PixelNumberToMatrixAddress ( UInt_t  pixelnumber)

Definition at line 128 of file PndTopix4.cxx.

Referenced by PndMvdReadInToPix4TBData::ProcessData().

129 {
130  // Matrix: 32 columns x 20 rows
131 
132  ToPix4::pixelAddress address;
133 
134  address = PixelNumberToPixelAddress(pixelnumber);
135 // UInt_t matrix_column, matrix_row;
136 
137  return PixelAddressToMatrixAddress(address);
138 
139 
140 // UInt_t sel = (double_column_address<<1) | (double_column_side);
141 //
142 // if(sel == 0)
143 // {
144 // matrix_row = pixel_address;
145 // matrix_column = 1;
146 // }
147 // else if(sel ==1)
148 // {
149 // matrix_row = pixel_address;
150 // matrix_column = 0;
151 // }
152 // else if(sel == 6)
153 // {
154 // matrix_row = pixel_address;
155 // matrix_column = 19;
156 // }
157 // else if(sel == 7)
158 // {
159 // matrix_row = pixel_address;
160 // matrix_column = 18;
161 // }
162 // else if (sel==2)
163 // {
164 // if (pixel_address <32)
165 // {
166 // matrix_row = pixel_address;
167 // matrix_column = 3;
168 // }
169 // else if (pixel_address < 64)
170 // {
171 // matrix_row = 31 - (pixel_address-32);
172 // matrix_column = 4;
173 // }
174 // else if (pixel_address < 96)
175 // {
176 // matrix_row = (pixel_address-64);
177 // matrix_column = 7;
178 // }
179 // else if (pixel_address < 128)
180 // {
181 // matrix_row = 31 - (pixel_address-96);
182 // matrix_column = 8;
183 // }
184 // }
185 // else if (sel==3)
186 // {
187 // if (pixel_address <32)
188 // {
189 // matrix_row = pixel_address;
190 // matrix_column = 2;
191 // }
192 // else if (pixel_address < 64)
193 // {
194 // matrix_row = 31 - (pixel_address-32);
195 // matrix_column = 5;
196 // }
197 // else if (pixel_address < 96)
198 // {
199 // matrix_row = (pixel_address-64);
200 // matrix_column = 6;
201 // }
202 // else if (pixel_address < 128)
203 // {
204 // matrix_row = 31 - (pixel_address-96);
205 // matrix_column = 9;
206 // }
207 // }
208 // else if (sel==4)
209 // {
210 // if (pixel_address < 32)
211 // {
212 // matrix_row = pixel_address;
213 // matrix_column = 10;
214 // }
215 // else if (pixel_address < 64)
216 // {
217 // matrix_row = 31 - (pixel_address-32);
218 // matrix_column = 13;
219 // }
220 // else if (pixel_address < 96)
221 // {
222 // matrix_row = (pixel_address-64);
223 // matrix_column = 14;
224 // }
225 // else if (pixel_address < 128)
226 // {
227 // matrix_row = 31 - (pixel_address-96);
228 // matrix_column = 17;
229 // }
230 // }
231 // else if (sel==5)
232 // {
233 // if (pixel_address < 32)
234 // {
235 // matrix_row = pixel_address;
236 // matrix_column = 11;
237 // }
238 // else if (pixel_address < 64)
239 // {
240 // matrix_row = 31 - (pixel_address-32);
241 // matrix_column = 12;
242 // }
243 // else if (pixel_address < 96)
244 // {
245 // matrix_row = (pixel_address-64);
246 // matrix_column = 15;
247 // }
248 // else if (pixel_address < 128)
249 // {
250 // matrix_row = 31 - (pixel_address-96);
251 // matrix_column = 16;
252 // }
253 // }
254 
255 // return std::pair<UInt_t, UInt_t>(matrix_column, matrix_row);
256 }
std::pair< UInt_t, UInt_t > PixelAddressToMatrixAddress(ToPix4::pixelAddress address)
Definition: PndTopix4.cxx:258
ToPix4::pixelAddress PixelNumberToPixelAddress(UInt_t pixelnumber)
Definition: PndTopix4.cxx:112
ToPix4::pixelAddress PndTopix4::PixelNumberToPixelAddress ( UInt_t  pixelnumber)

Definition at line 112 of file PndTopix4.cxx.

References ToPix4::pixelAddress::fCol, ToPix4::pixelAddress::fRow, and ToPix4::pixelAddress::fSide.

113 {
114  ToPix4::pixelAddress address;
115 
116  UInt_t temp = pixelnumber;
117 
118  address.fRow= temp & 0x7f; //todo check if this conversion is correct!
119  temp = temp >> 7;
120  address.fSide= temp & 0x1;
121  temp = temp >> 1;
122  address.fCol = temp & 0x3f;
123 // temp = temp >> 6;
124 
125  return address;
126 }

The documentation for this class was generated from the following files: