PandaRoot
PndTopix4.h
Go to the documentation of this file.
1 /*
2  * PndTopix4.h
3  *
4  * Created on: 16.09.2015
5  * Author: Stockmanns
6  */
7 
8 #ifndef MVD_MVDOFFLINETBANALYSIS_TOPIX4_PNDTOPIX4_H_
9 #define MVD_MVDOFFLINETBANALYSIS_TOPIX4_PNDTOPIX4_H_
10 
11 #include "Rtypes.h"
12 #include "mrfdata_8b.h"
13 
14 namespace ToPix4 {
15 struct frameHeader {
17 
18  UInt_t fChipAddress;
19  UInt_t fFrameCount;
20  UInt_t fECC;
21 };
22 
23 struct frameTrailer {
24  frameTrailer() : fNEvents(0), fFrameCRC(0), fECC(0){};
25 
26  UInt_t fNEvents;
27  UInt_t fFrameCRC;
28  UInt_t fECC;
29 };
30 
31 struct pixel {
32  pixel() : fPixelNumber(0), fLeadingEdge(0), fTrailingEdge(0){};
33 
34  UInt_t fPixelNumber;
35  UInt_t fLeadingEdge;
36  UInt_t fTrailingEdge;
37 };
38 
39 struct pixelAddress {
40  pixelAddress() : fRow(0), fCol(0), fSide(0){};
41  pixelAddress(UInt_t row, UInt_t dcol, Bool_t side) : fRow(row), fCol(dcol), fSide(side){}; // row 0-31 or 0-127; dcol 0-3; side 0-1
42  pixelAddress(UInt_t row, UInt_t col) : fRow(row)
43  { // row 0-31 or 0-127; col 0-7 (needed to translate pixel configuration data into matrix
44  fCol = col / 2;
45  fSide = !(col % 2);
46  };
47  UInt_t fRow;
48  UInt_t fCol;
49  Bool_t fSide;
50 };
51 } // namespace ToPix4
52 
53 class PndTopix4 {
54  public:
55  PndTopix4();
56  virtual ~PndTopix4();
57 
58  ULong64_t ConvertToPix4HammingToStandardHamming(ULong64_t topixhamming);
59 
60  int GetType(ULong64_t data);
61  int GetFrameCount(ULong64_t data);
62  ToPix4::pixel BitAnalyzePixelData(ULong64_t &data);
63  ToPix4::frameHeader BitAnalyzeHeader(ULong64_t &header);
64  ToPix4::frameTrailer BitAnalyzeTrailer(ULong64_t &trailer);
65 
66  std::vector<ULong64_t> GetRawData(TMrfData_8b *data);
67 
68  ToPix4::pixelAddress PixelNumberToPixelAddress(UInt_t pixelnumber);
69 
70  std::pair<UInt_t, UInt_t> PixelAddressToMatrixAddress(ToPix4::pixelAddress address);
71  std::pair<UInt_t, UInt_t> PixelAddressToMatrixAddress(UInt_t row, UInt_t col, Bool_t side);
72 
73  std::pair<UInt_t, UInt_t> PixelNumberToMatrixAddress(UInt_t pixelnumber);
74 
75  ToPix4::pixelAddress MatrixAddressToPixelAddress(std::pair<UInt_t, UInt_t> matrixAddress);
76  ToPix4::pixelAddress MatrixAddressToPixelAddress(UInt_t matrix_col, UInt_t matrix_row) { return MatrixAddressToPixelAddress(std::make_pair(matrix_col, matrix_row)); };
77 
78  std::pair<UInt_t, UInt_t> MatrixAddressToPixelAddressConf(UInt_t matrix_col, UInt_t matrix_row)
79  { // converts a matrix address (0-20, 0-31) into a ToPix configuration address col 0-7, row 0-31 / 0-127
80  ToPix4::pixelAddress address = MatrixAddressToPixelAddress(matrix_col, matrix_row);
81  UInt_t col = address.fCol * 2;
82  col += !(address.fSide);
83  UInt_t row = address.fRow;
84  return std::make_pair(col, row);
85  }
86 
87  // ClassDef(PndTopix4, 1);
88 };
89 
90 #endif /* MVD_MVDOFFLINETBANALYSIS_TOPIX4_PNDTOPIX4_H_ */
ToPix4::pixelAddress MatrixAddressToPixelAddress(UInt_t matrix_col, UInt_t matrix_row)
Definition: PndTopix4.h:76
UInt_t fLeadingEdge
Definition: PndTopix4.h:35
Base interface class for data storage and manipulation. Compatible with IO classes from MRF Suite...
pixelAddress(UInt_t row, UInt_t dcol, Bool_t side)
Definition: PndTopix4.h:41
UInt_t fTrailingEdge
Definition: PndTopix4.h:36
pixelAddress(UInt_t row, UInt_t col)
Definition: PndTopix4.h:42
std::pair< UInt_t, UInt_t > MatrixAddressToPixelAddressConf(UInt_t matrix_col, UInt_t matrix_row)
Definition: PndTopix4.h:78