PandaRoot
PndTopix4.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 /*
14  * PndTopix4.h
15  *
16  * Created on: 16.09.2015
17  * Author: Stockmanns
18  */
19 
20 #ifndef MVD_MVDOFFLINETBANALYSIS_TOPIX4_PNDTOPIX4_H_
21 #define MVD_MVDOFFLINETBANALYSIS_TOPIX4_PNDTOPIX4_H_
22 
23 #include "Rtypes.h"
24 #include "mrfdata_8b.h"
25 
26 namespace ToPix4 {
27 struct frameHeader {
29 
30  UInt_t fChipAddress;
31  UInt_t fFrameCount;
32  UInt_t fECC;
33 };
34 
35 struct frameTrailer {
36  frameTrailer() : fNEvents(0), fFrameCRC(0), fECC(0){};
37 
38  UInt_t fNEvents;
39  UInt_t fFrameCRC;
40  UInt_t fECC;
41 };
42 
43 struct pixel {
44  pixel() : fPixelNumber(0), fLeadingEdge(0), fTrailingEdge(0){};
45 
46  UInt_t fPixelNumber;
47  UInt_t fLeadingEdge;
48  UInt_t fTrailingEdge;
49 };
50 
51 struct pixelAddress {
52  pixelAddress() : fRow(0), fCol(0), fSide(0){};
53  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
54  pixelAddress(UInt_t row, UInt_t col) : fRow(row)
55  { // row 0-31 or 0-127; col 0-7 (needed to translate pixel configuration data into matrix
56  fCol = col / 2;
57  fSide = !(col % 2);
58  };
59  UInt_t fRow;
60  UInt_t fCol;
61  Bool_t fSide;
62 };
63 } // namespace ToPix4
64 
65 class PndTopix4 {
66  public:
67  PndTopix4();
68  virtual ~PndTopix4();
69 
70  ULong64_t ConvertToPix4HammingToStandardHamming(ULong64_t topixhamming);
71 
72  int GetType(ULong64_t data);
73  int GetFrameCount(ULong64_t data);
74  ToPix4::pixel BitAnalyzePixelData(ULong64_t &data);
75  ToPix4::frameHeader BitAnalyzeHeader(ULong64_t &header);
76  ToPix4::frameTrailer BitAnalyzeTrailer(ULong64_t &trailer);
77 
78  std::vector<ULong64_t> GetRawData(TMrfData_8b *data);
79 
80  ToPix4::pixelAddress PixelNumberToPixelAddress(UInt_t pixelnumber);
81 
82  std::pair<UInt_t, UInt_t> PixelAddressToMatrixAddress(ToPix4::pixelAddress address);
83  std::pair<UInt_t, UInt_t> PixelAddressToMatrixAddress(UInt_t row, UInt_t col, Bool_t side);
84 
85  std::pair<UInt_t, UInt_t> PixelNumberToMatrixAddress(UInt_t pixelnumber);
86 
87  ToPix4::pixelAddress MatrixAddressToPixelAddress(std::pair<UInt_t, UInt_t> matrixAddress);
88  ToPix4::pixelAddress MatrixAddressToPixelAddress(UInt_t matrix_col, UInt_t matrix_row) { return MatrixAddressToPixelAddress(std::make_pair(matrix_col, matrix_row)); };
89 
90  std::pair<UInt_t, UInt_t> MatrixAddressToPixelAddressConf(UInt_t matrix_col, UInt_t matrix_row)
91  { // converts a matrix address (0-20, 0-31) into a ToPix configuration address col 0-7, row 0-31 / 0-127
92  ToPix4::pixelAddress address = MatrixAddressToPixelAddress(matrix_col, matrix_row);
93  UInt_t col = address.fCol * 2;
94  col += !(address.fSide);
95  UInt_t row = address.fRow;
96  return std::make_pair(col, row);
97  }
98 
99  // ClassDef(PndTopix4, 1);
100 };
101 
102 #endif /* MVD_MVDOFFLINETBANALYSIS_TOPIX4_PNDTOPIX4_H_ */
ToPix4::pixelAddress MatrixAddressToPixelAddress(UInt_t matrix_col, UInt_t matrix_row)
Definition: PndTopix4.h:88
UInt_t fLeadingEdge
Definition: PndTopix4.h:47
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:53
UInt_t fTrailingEdge
Definition: PndTopix4.h:48
pixelAddress(UInt_t row, UInt_t col)
Definition: PndTopix4.h:54
std::pair< UInt_t, UInt_t > MatrixAddressToPixelAddressConf(UInt_t matrix_col, UInt_t matrix_row)
Definition: PndTopix4.h:90