PandaRoot
PndMvdReadInToPix4TBData.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  * PndMvdReadInToPix4TBData.h
15  *
16  * Created on: 23.10.2014
17  * Author: Stockmanns
18  */
19 
20 #ifndef PNDMVDREADINTOPIX4TBDATA_H_
21 #define PNDMVDREADINTOPIX4TBDATA_H_
22 
23 #include "Rtypes.h"
24 //#include "TString.h"
25 
26 #include "PndSdsDigiTopix4.h"
27 #include "PndSdsDigiTopix4Header.h"
28 
29 #include "PndTopix4.h"
30 #include "PndHammingDecoder.h"
31 
32 #include <fstream>
33 #include <iostream>
34 #include <utility>
35 #include <vector>
36 #include <string>
37 
38 //#include <unordered_map>
39 
40 //#include "FairMQDevice.h
41 
42 class TMrfData_8b;
43 
45  public:
46  enum {
63  };
65  virtual ~PndMvdReadInToPix4TBData();
66 
67  void SetFileName(std::vector<std::string> fileName)
68  {
69 
70  std::cout << "number of entires " << fileName.size() << std::endl;
71  for (int i = 0; i < fileName.size(); i++) {
72  std::cout << i << " " << fileName[i] << std::endl;
73  }
74  fFileNames = fileName;
75  }
76 
77  void SetFileName(std::string fileName)
78  {
79  std::vector<std::string> names;
80  names.push_back(fileName);
81  SetFileName(names);
82  }
83 
84  void Init();
85 
86  Bool_t ReadInData(std::vector<std::vector<PndSdsDigiTopix4>> &data);
87  // Bool_t ReadInRawData(std::ifstream* fileHandle, std::vector<ULong64_t>& rawData);//<input is fileHandle, output vector of raw data, output is end of file
88  virtual Bool_t ReadInDataFromFile(TMrfData_8b *&data);
89  // std::vector<ULong64_t> GetRawData(TMrfData_8b* data);
90  std::vector<std::vector<PndSdsDigiTopix4>> AnalyzeData(std::vector<ULong64_t> &rawData, Double_t clockFrequency);
91  bool BuildFrame(ULong64_t &rawData);
92 
93  Int_t GetDeltaFrameCount();
94 
95  // virtual void WriteoutToPix4Digi(PndSdsDigiTopix4& data);
96  // virtual void WriteoutToPix4Frames(std::vector<std::vector<PndSdsDigiTopix4> > &frames);
97 
98  PndSdsDigiTopix4 ProcessData(ULong64_t &data, ToPix4::frameHeader &header, Double_t &clockFrequency);
99  std::vector<PndSdsDigiTopix4> AnalyzeToPixFrame(Double_t clockFrequency);
100  bool CheckDataIntegrity(std::vector<ULong64_t> topix4Frame);
101 
102  void SetClockFrequency(Double_t val) { fClockFrequency = val; }
103  void SetTimeStampCorrection(Double_t val) { fTimeStampCorrection = val; }
104  void SetFE(Int_t val) { fFE = val; }
105  UInt_t GetNonSequenctialFC() const { return fNonSequentialFC; }
106  UInt_t GetDoubleHeader() const { return fDoubleHeader; }
107  UInt_t GetDoubleTrailer() const { return fDoubleTrailer; }
108  UInt_t GetSuperFrameCount() const { return fSuperFrameCount; }
109 
110  UInt_t GetTotalHitCount() const { return fTotalHitCount; }
111  UInt_t GetCorrectHitCount() const { return fCorrectHitCount; }
112  UInt_t GetPreFrameLossHitCount() const { return fPreFrameLossHitCount; }
113  UInt_t GetHammingLossHitCount() const { return fHammingLossHitCount; }
114  UInt_t GetCRCLossHitCount() const { return fCRCLossHitCount; }
115 
116  UInt_t GetTotalFrameCount() const { return fTotalFrameCount; }
117  UInt_t GetCorrectFrameCount() const { return fCorrectFrameCount; }
118  UInt_t GetHammingLossFrameCount() const { return fHammingLossFrameCount; }
119  UInt_t GetCRCLossFrameCount() const { return fCRCLossFrameCount; }
120 
121  UInt_t GetTotalHeaderCount() const { return fTotalHeaderCount; }
122  UInt_t GetTotalTrailerCount() const { return fTotalTrailerCount; }
123 
124  std::vector<int> GetStatusValues() const { return fStatusValues; }
125 
126  Int_t GetNFilteredHits() { return fNFilteredHits; }
127  Bool_t HitToFilter(PndSdsDigiTopix4 &hit);
128  void SetFilter(Bool_t val) { fFilter = val; }
129 
130  void SetVerbose(Int_t val) { fVerbose = val; }
131 
132  private:
133  std::vector<std::string> fFileNames;
134  std::ifstream *fFileHandle;
135  Double_t fClockFrequency;
136  Double_t fTimeStampCorrection;
137 
138  std::vector<int> fStatusValues;
139 
140  UInt_t fOldFrameCount;
141  UInt_t fOldAllHeaderCount;
142 
143  UInt_t fSuperFrameCount;
144  UInt_t fNonSequentialFC;
145  UInt_t fHammingLossFrameCount;
146  UInt_t fCRCLossFrameCount;
147 
148  UInt_t fTotalHitCount;
149  UInt_t fPreFrameLossHitCount;
150  UInt_t fHammingLossHitCount;
151  UInt_t fCRCLossHitCount;
152  UInt_t fCorrectHitCount;
153 
154  Bool_t fFilter;
155  UInt_t fNFilteredHits;
156 
157  ToPix4::frameHeader fRecentFrameHeader;
158  ToPix4::frameHeader fRecentAllFrameHeader;
159  ToPix4::frameTrailer fRecentFrameTrailer;
160  Bool_t fFirstHeader;
161  Bool_t fHeaderPresent;
162  Bool_t fTrailerPresent;
163 
164  UInt_t fDoubleHeader;
165  UInt_t fDoubleTrailer;
166 
167  UInt_t fTotalHeaderCount;
168  UInt_t fTotalTrailerCount;
169 
170  UInt_t fTotalFrameCount;
171  UInt_t fCorrectFrameCount;
172 
173  Int_t fVerbose; // fVerbose==5 gives all detected errors from ToPix build in error detection
174  Int_t fFE;
175  Int_t fFileCounter;
176 
177  std::vector<ULong64_t> fToPixFrame;
178  PndTopix4 fTopix;
179  PndHammingDecoder fHamming;
180 };
181 
182 #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:33
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...
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)