PandaRoot
PndMvdReadInToPix4TBData.h
Go to the documentation of this file.
1 /*
2  * PndMvdReadInToPix4TBData.h
3  *
4  * Created on: 23.10.2014
5  * Author: Stockmanns
6  */
7 
8 #ifndef PNDMVDREADINTOPIX4TBDATA_H_
9 #define PNDMVDREADINTOPIX4TBDATA_H_
10 
11 #include "Rtypes.h"
12 //#include "TString.h"
13 
14 #include "PndSdsDigiTopix4.h"
15 #include "PndSdsDigiTopix4Header.h"
16 
17 #include "PndTopix4.h"
18 #include "PndHammingDecoder.h"
19 
20 #include <fstream>
21 #include <iostream>
22 #include <utility>
23 #include <vector>
24 #include <string>
25 
26 //#include <unordered_map>
27 
28 //#include "FairMQDevice.h
29 
30 class TMrfData_8b;
31 
33  public:
34  enum {
51  };
53  virtual ~PndMvdReadInToPix4TBData();
54 
55  void SetFileName(std::vector<std::string> fileName)
56  {
57 
58  std::cout << "number of entires " << fileName.size() << std::endl;
59  for (int i = 0; i < fileName.size(); i++) {
60  std::cout << i << " " << fileName[i] << std::endl;
61  }
62  fFileNames = fileName;
63  }
64 
65  void SetFileName(std::string fileName)
66  {
67  std::vector<std::string> names;
68  names.push_back(fileName);
69  SetFileName(names);
70  }
71 
72  void Init();
73 
74  Bool_t ReadInData(std::vector<std::vector<PndSdsDigiTopix4>> &data);
75  // Bool_t ReadInRawData(std::ifstream* fileHandle, std::vector<ULong64_t>& rawData);//<input is fileHandle, output vector of raw data, output is end of file
76  virtual Bool_t ReadInDataFromFile(TMrfData_8b *&data);
77  // std::vector<ULong64_t> GetRawData(TMrfData_8b* data);
78  std::vector<std::vector<PndSdsDigiTopix4>> AnalyzeData(std::vector<ULong64_t> &rawData, Double_t clockFrequency);
79  bool BuildFrame(ULong64_t &rawData);
80 
81  Int_t GetDeltaFrameCount();
82 
83  // virtual void WriteoutToPix4Digi(PndSdsDigiTopix4& data);
84  // virtual void WriteoutToPix4Frames(std::vector<std::vector<PndSdsDigiTopix4> > &frames);
85 
86  PndSdsDigiTopix4 ProcessData(ULong64_t &data, ToPix4::frameHeader &header, Double_t &clockFrequency);
87  std::vector<PndSdsDigiTopix4> AnalyzeToPixFrame(Double_t clockFrequency);
88  bool CheckDataIntegrity(std::vector<ULong64_t> topix4Frame);
89 
90  void SetClockFrequency(Double_t val) { fClockFrequency = val; }
91  void SetTimeStampCorrection(Double_t val) { fTimeStampCorrection = val; }
92  void SetFE(Int_t val) { fFE = val; }
93  UInt_t GetNonSequenctialFC() const { return fNonSequentialFC; }
94  UInt_t GetDoubleHeader() const { return fDoubleHeader; }
95  UInt_t GetDoubleTrailer() const { return fDoubleTrailer; }
96  UInt_t GetSuperFrameCount() const { return fSuperFrameCount; }
97 
98  UInt_t GetTotalHitCount() const { return fTotalHitCount; }
99  UInt_t GetCorrectHitCount() const { return fCorrectHitCount; }
100  UInt_t GetPreFrameLossHitCount() const { return fPreFrameLossHitCount; }
101  UInt_t GetHammingLossHitCount() const { return fHammingLossHitCount; }
102  UInt_t GetCRCLossHitCount() const { return fCRCLossHitCount; }
103 
104  UInt_t GetTotalFrameCount() const { return fTotalFrameCount; }
105  UInt_t GetCorrectFrameCount() const { return fCorrectFrameCount; }
106  UInt_t GetHammingLossFrameCount() const { return fHammingLossFrameCount; }
107  UInt_t GetCRCLossFrameCount() const { return fCRCLossFrameCount; }
108 
109  UInt_t GetTotalHeaderCount() const { return fTotalHeaderCount; }
110  UInt_t GetTotalTrailerCount() const { return fTotalTrailerCount; }
111 
112  std::vector<int> GetStatusValues() const { return fStatusValues; }
113 
114  Int_t GetNFilteredHits() { return fNFilteredHits; }
115  Bool_t HitToFilter(PndSdsDigiTopix4 &hit);
116  void SetFilter(Bool_t val) { fFilter = val; }
117 
118  void SetVerbose(Int_t val) { fVerbose = val; }
119 
120  private:
121  std::vector<std::string> fFileNames;
122  std::ifstream *fFileHandle;
123  Double_t fClockFrequency;
124  Double_t fTimeStampCorrection;
125 
126  std::vector<int> fStatusValues;
127 
128  UInt_t fOldFrameCount;
129  UInt_t fOldAllHeaderCount;
130 
131  UInt_t fSuperFrameCount;
132  UInt_t fNonSequentialFC;
133  UInt_t fHammingLossFrameCount;
134  UInt_t fCRCLossFrameCount;
135 
136  UInt_t fTotalHitCount;
137  UInt_t fPreFrameLossHitCount;
138  UInt_t fHammingLossHitCount;
139  UInt_t fCRCLossHitCount;
140  UInt_t fCorrectHitCount;
141 
142  Bool_t fFilter;
143  UInt_t fNFilteredHits;
144 
145  ToPix4::frameHeader fRecentFrameHeader;
146  ToPix4::frameHeader fRecentAllFrameHeader;
147  ToPix4::frameTrailer fRecentFrameTrailer;
148  Bool_t fFirstHeader;
149  Bool_t fHeaderPresent;
150  Bool_t fTrailerPresent;
151 
152  UInt_t fDoubleHeader;
153  UInt_t fDoubleTrailer;
154 
155  UInt_t fTotalHeaderCount;
156  UInt_t fTotalTrailerCount;
157 
158  UInt_t fTotalFrameCount;
159  UInt_t fCorrectFrameCount;
160 
161  Int_t fVerbose; // fVerbose==5 gives all detected errors from ToPix build in error detection
162  Int_t fFE;
163  Int_t fFileCounter;
164 
165  std::vector<ULong64_t> fToPixFrame;
166  PndTopix4 fTopix;
167  PndHammingDecoder fHamming;
168 };
169 
170 #endif /* PNDMVDREADINTBDATA_H_ */
std::vector< std::vector< PndSdsDigiTopix4 > > AnalyzeData(std::vector< ULong64_t > &rawData, Double_t clockFrequency)
Data class to store the digi output of a pixel module.
Bool_t HitToFilter(PndSdsDigiTopix4 &hit)
std::vector< int > GetStatusValues() const
unsigned int i
Definition: P4_F32vec4.h:21
PndSdsDigiTopix4 ProcessData(ULong64_t &data, ToPix4::frameHeader &header, Double_t &clockFrequency)
Bool_t ReadInData(std::vector< std::vector< PndSdsDigiTopix4 >> &data)
void SetTimeStampCorrection(Double_t val)
virtual ~PndMvdReadInToPix4TBData()
Base interface class for data storage and manipulation. Compatible with IO classes from MRF Suite...
void SetClockFrequency(Double_t val)
std::vector< PndSdsDigiTopix4 > AnalyzeToPixFrame(Double_t clockFrequency)
virtual Bool_t ReadInDataFromFile(TMrfData_8b *&data)
void SetFileName(std::vector< std::string > fileName)
bool BuildFrame(ULong64_t &rawData)
bool CheckDataIntegrity(std::vector< ULong64_t > topix4Frame)
void SetFileName(std::string fileName)