PandaRoot
PndCRCCalculator.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 
23 #ifndef MVD_MVDOFFLINETBANALYSIS_PNDCRCCALCULATOR_H_
24 #define MVD_MVDOFFLINETBANALYSIS_PNDCRCCALCULATOR_H_
25 
26 #include "Rtypes.h"
27 #include "TObject.h"
28 
29 class PndCRCCalculator : public TObject {
30  public:
32  PndCRCCalculator(UInt_t order, ULong64_t polynom, ULong64_t CRCXor, UInt_t refIn, UInt_t refOut, UInt_t CRCInit_direct);
33  // settings for ToPix: fOrder(16), fPolynom(0x8005), fCRCXor(0x0000), fRefIn(0), fRefOut(0), fCRCInit_direct(0)
34  // settings for PASTA: fOrder(16), fPolynom(0x1021), fCRCXor(0x0000), fRefIn(0), fRefOut(0), fCRCInit_direct(0x04FA)
35  virtual ~PndCRCCalculator();
36 
37  ULong64_t CalculateCRCTableFast(std::vector<char> p, ULong64_t len);
38  ULong64_t ReflectBitsStream(ULong64_t crc, int bitnum);
39  // std::vector<char> ConvertData(std::vector<ULong64_t> topixFrame);
40  void PrintCRCTable();
41 
42  protected:
43  void GenerateCRCTable();
44 
45  private:
46  // CRC parameters :
47 
48  const UInt_t fOrder;
49  const ULong64_t fPolynom;
50  const ULong64_t fCRCXor;
51  const UInt_t fRefIn;
52  const UInt_t fRefOut;
53 
54  ULong64_t fCRCMask;
55  ULong64_t fCRCHighBit;
56  ULong64_t fCRCInit_direct;
57  ULong64_t fCRCTab[256];
58 
59  ClassDef(PndCRCCalculator, 1);
60 };
61 
62 #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>