PandaRoot
PndCRCCalculator.h
Go to the documentation of this file.
1 
11 #ifndef MVD_MVDOFFLINETBANALYSIS_PNDCRCCALCULATOR_H_
12 #define MVD_MVDOFFLINETBANALYSIS_PNDCRCCALCULATOR_H_
13 
14 #include "Rtypes.h"
15 #include "TObject.h"
16 
17 class PndCRCCalculator : public TObject {
18  public:
20  PndCRCCalculator(UInt_t order, ULong64_t polynom, ULong64_t CRCXor, UInt_t refIn, UInt_t refOut, UInt_t CRCInit_direct);
21  // settings for ToPix: fOrder(16), fPolynom(0x8005), fCRCXor(0x0000), fRefIn(0), fRefOut(0), fCRCInit_direct(0)
22  // settings for PASTA: fOrder(16), fPolynom(0x1021), fCRCXor(0x0000), fRefIn(0), fRefOut(0), fCRCInit_direct(0x04FA)
23  virtual ~PndCRCCalculator();
24 
25  ULong64_t CalculateCRCTableFast(std::vector<char> p, ULong64_t len);
26  ULong64_t ReflectBitsStream(ULong64_t crc, int bitnum);
27  // std::vector<char> ConvertData(std::vector<ULong64_t> topixFrame);
28  void PrintCRCTable();
29 
30  protected:
31  void GenerateCRCTable();
32 
33  private:
34  // CRC parameters :
35 
36  const UInt_t fOrder;
37  const ULong64_t fPolynom;
38  const ULong64_t fCRCXor;
39  const UInt_t fRefIn;
40  const UInt_t fRefOut;
41 
42  ULong64_t fCRCMask;
43  ULong64_t fCRCHighBit;
44  ULong64_t fCRCInit_direct;
45  ULong64_t fCRCTab[256];
46 
47  ClassDef(PndCRCCalculator, 1);
48 };
49 
50 #endif /* MVD_MVDOFFLINETBANALYSIS_TOPIX4_PNDHAMMINGDECODER_H_ */
ULong64_t ReflectBitsStream(ULong64_t crc, int bitnum)
void GenerateCRCTable()
ULong64_t CalculateCRCTableFast(std::vector< char > p, ULong64_t len)
virtual ~PndCRCCalculator()
PndCRCCalculator calculates the CRC checksum from a given vector<char>