FairRoot/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 
24  struct frameTrailer{
26 
27  UInt_t fNEvents;
28  UInt_t fFrameCRC;
29  UInt_t fECC;
30  };
31 
32  struct pixel{
34 
35  UInt_t fPixelNumber;
36  UInt_t fLeadingEdge;
37  UInt_t fTrailingEdge;
38  };
39 
40  struct pixelAddress{
41  pixelAddress():fRow(0), fCol(0), fSide(0){};
42  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
43  pixelAddress(UInt_t row, UInt_t col):fRow(row){ //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;
50  };
51 }
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 
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 
76  ToPix4::pixelAddress MatrixAddressToPixelAddress(std::pair<UInt_t, UInt_t> matrixAddress);
77  ToPix4::pixelAddress MatrixAddressToPixelAddress(UInt_t matrix_col, UInt_t matrix_row){
78  return MatrixAddressToPixelAddress(std::make_pair(matrix_col, matrix_row));
79  };
80 
81  std::pair<UInt_t, UInt_t> MatrixAddressToPixelAddressConf(UInt_t matrix_col, UInt_t matrix_row){ //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  }
88 
89 
90 // ClassDef(PndTopix4, 1);
91 };
92 
93 #endif /* MVD_MVDOFFLINETBANALYSIS_TOPIX4_PNDTOPIX4_H_ */
int row
Definition: anaLmdDigi.C:67
ToPix4::frameTrailer BitAnalyzeTrailer(ULong64_t &trailer)
Definition: PndTopix4.cxx:75
ToPix4::frameHeader BitAnalyzeHeader(ULong64_t &header)
Definition: PndTopix4.cxx:61
std::pair< UInt_t, UInt_t > PixelAddressToMatrixAddress(ToPix4::pixelAddress address)
Definition: PndTopix4.cxx:258
int col
Definition: anaLmdDigi.C:67
ULong64_t ConvertToPix4HammingToStandardHamming(ULong64_t topixhamming)
Definition: PndTopix4.cxx:314
int GetFrameCount(ULong64_t data)
Definition: PndTopix4.cxx:55
ToPix4::pixel BitAnalyzePixelData(ULong64_t &data)
Definition: PndTopix4.cxx:91
ToPix4::pixelAddress MatrixAddressToPixelAddress(UInt_t matrix_col, UInt_t matrix_row)
Definition: PndTopix4.h:77
std::vector< ULong64_t > GetRawData(TMrfData_8b *data)
Definition: PndTopix4.cxx:25
std::pair< UInt_t, UInt_t > PixelNumberToMatrixAddress(UInt_t pixelnumber)
Definition: PndTopix4.cxx:128
UInt_t fLeadingEdge
Definition: PndTopix4.h:36
Base interface class for data storage and manipulation. Compatible with IO classes from MRF Suite...
ToPix4::pixelAddress MatrixAddressToPixelAddress(std::pair< UInt_t, UInt_t > matrixAddress)
Definition: PndTopix4.cxx:288
pixelAddress(UInt_t row, UInt_t dcol, Bool_t side)
Definition: PndTopix4.h:42
ToPix4::pixelAddress PixelNumberToPixelAddress(UInt_t pixelnumber)
Definition: PndTopix4.cxx:112
UInt_t fPixelNumber
Definition: PndTopix4.h:33
UInt_t fTrailingEdge
Definition: PndTopix4.h:37
pixelAddress(UInt_t row, UInt_t col)
Definition: PndTopix4.h:43
std::pair< UInt_t, UInt_t > MatrixAddressToPixelAddressConf(UInt_t matrix_col, UInt_t matrix_row)
Definition: PndTopix4.h:81
int GetType(ULong64_t data)
returns if the data word is a header (0b01), trailer (0b10) or data (0b11)
Definition: PndTopix4.cxx:49
virtual ~PndTopix4()
Definition: PndTopix4.cxx:21