FairRoot/PandaRoot
Public Types | Public Member Functions | Private Attributes | List of all members
PndMvdReadInToPix4TBData Class Reference

#include <PndMvdReadInToPix4TBData.h>

Public Types

enum  {
  SuperFrameCount = 0, NonSequentialFC, HammingLossFrameCount, CRCLossFrameCount,
  TotalHitCount, PreFrameLossHitCount, HammingLossHitCount, CRCLossHitCount,
  CorrectHitCount, DoubleHeader, DoubleTrailer, TotalHeaderCount,
  TotalTrailerCount, TotalFrameCount, NFilteredHits, Last
}
 

Public Member Functions

 PndMvdReadInToPix4TBData ()
 
virtual ~PndMvdReadInToPix4TBData ()
 
void SetFileName (std::vector< std::string > fileName)
 
void SetFileName (std::string fileName)
 
void Init ()
 
Bool_t ReadInData (std::vector< std::vector< PndSdsDigiTopix4 > > &data)
 
virtual Bool_t ReadInDataFromFile (TMrfData_8b *&data)
 
std::vector< std::vector
< PndSdsDigiTopix4 > > 
AnalyzeData (std::vector< ULong64_t > &rawData, Double_t clockFrequency)
 
bool BuildFrame (ULong64_t &rawData)
 
Int_t GetDeltaFrameCount ()
 
PndSdsDigiTopix4 ProcessData (ULong64_t &data, ToPix4::frameHeader &header, Double_t &clockFrequency)
 
std::vector< PndSdsDigiTopix4AnalyzeToPixFrame (Double_t clockFrequency)
 
bool CheckDataIntegrity (std::vector< ULong64_t > topix4Frame)
 
void SetClockFrequency (Double_t val)
 
void SetTimeStampCorrection (Double_t val)
 
void SetFE (Int_t val)
 
UInt_t GetNonSequenctialFC () const
 
UInt_t GetDoubleHeader () const
 
UInt_t GetDoubleTrailer () const
 
UInt_t GetSuperFrameCount () const
 
UInt_t GetTotalHitCount () const
 
UInt_t GetCorrectHitCount () const
 
UInt_t GetPreFrameLossHitCount () const
 
UInt_t GetHammingLossHitCount () const
 
UInt_t GetCRCLossHitCount () const
 
UInt_t GetTotalFrameCount () const
 
UInt_t GetCorrectFrameCount () const
 
UInt_t GetHammingLossFrameCount () const
 
UInt_t GetCRCLossFrameCount () const
 
UInt_t GetTotalHeaderCount () const
 
UInt_t GetTotalTrailerCount () const
 
std::vector< int > GetStatusValues () const
 
Int_t GetNFilteredHits ()
 
Bool_t HitToFilter (PndSdsDigiTopix4 &hit)
 
void SetFilter (Bool_t val)
 
void SetVerbose (Int_t val)
 

Private Attributes

std::vector< std::string > fFileNames
 
std::ifstream * fFileHandle
 
Double_t fClockFrequency
 
Double_t fTimeStampCorrection
 
std::vector< int > fStatusValues
 
UInt_t fOldFrameCount
 
UInt_t fOldAllHeaderCount
 
UInt_t fSuperFrameCount
 
UInt_t fNonSequentialFC
 
UInt_t fHammingLossFrameCount
 
UInt_t fCRCLossFrameCount
 
UInt_t fTotalHitCount
 
UInt_t fPreFrameLossHitCount
 
UInt_t fHammingLossHitCount
 
UInt_t fCRCLossHitCount
 
UInt_t fCorrectHitCount
 
Bool_t fFilter
 
UInt_t fNFilteredHits
 
ToPix4::frameHeader fRecentFrameHeader
 
ToPix4::frameHeader fRecentAllFrameHeader
 
ToPix4::frameTrailer fRecentFrameTrailer
 
Bool_t fFirstHeader
 
Bool_t fHeaderPresent
 
Bool_t fTrailerPresent
 
UInt_t fDoubleHeader
 
UInt_t fDoubleTrailer
 
UInt_t fTotalHeaderCount
 
UInt_t fTotalTrailerCount
 
UInt_t fTotalFrameCount
 
UInt_t fCorrectFrameCount
 
Int_t fVerbose
 
Int_t fFE
 
Int_t fFileCounter
 
std::vector< ULong64_t > fToPixFrame
 
PndTopix4 fTopix
 
PndHammingDecoder fHamming
 

Detailed Description

Definition at line 33 of file PndMvdReadInToPix4TBData.h.

Member Enumeration Documentation

anonymous enum
Enumerator
SuperFrameCount 
NonSequentialFC 
HammingLossFrameCount 
CRCLossFrameCount 
TotalHitCount 
PreFrameLossHitCount 
HammingLossHitCount 
CRCLossHitCount 
CorrectHitCount 
DoubleHeader 
DoubleTrailer 
TotalHeaderCount 
TotalTrailerCount 
TotalFrameCount 
NFilteredHits 
Last 

Definition at line 35 of file PndMvdReadInToPix4TBData.h.

35  {
36  SuperFrameCount = 0,
51  Last
52  };

Constructor & Destructor Documentation

PndMvdReadInToPix4TBData::PndMvdReadInToPix4TBData ( )

Definition at line 21 of file PndMvdReadInToPix4TBData.cxx.

References fStatusValues, and Last.

28 {
29  fStatusValues.resize(Last, 0);
30 }
PndMvdReadInToPix4TBData::~PndMvdReadInToPix4TBData ( )
virtual

Definition at line 32 of file PndMvdReadInToPix4TBData.cxx.

References fFileHandle.

33 {
34  if (fFileHandle != 0){
35  fFileHandle->close();
36  delete(fFileHandle);
37  }
38 }

Member Function Documentation

std::vector< std::vector< PndSdsDigiTopix4 > > PndMvdReadInToPix4TBData::AnalyzeData ( std::vector< ULong64_t > &  rawData,
Double_t  clockFrequency 
)

Definition at line 206 of file PndMvdReadInToPix4TBData.cxx.

References AnalyzeToPixFrame(), BuildFrame(), DEBUG, fToPixFrame, fVerbose, hitList, and i.

Referenced by PndMQTopix4ProcessorTask::Exec(), ReadInData(), and PndMQTopix4Processor::Run().

206  {
207  std::vector<std::vector<PndSdsDigiTopix4> > result;
208  if (fVerbose > 2)
209  LOG(DEBUG) << "PndMvdReadInToPix4TBData::AnalyzeData rawData.size(): " << rawData.size();
210  for (int i = 0; i < rawData.size(); i++) {
211  if (BuildFrame(rawData[i]) == true){ //a frame was found
212  std::vector<PndSdsDigiTopix4> hitList = AnalyzeToPixFrame(clockFrequency);
213  //LOG(INFO) << "TestData: " << hitList.front() << std::endl;
214  result.push_back(hitList);
215  fToPixFrame.clear();
216  }
217  }
218  return result;
219 }
Int_t i
Definition: run_full.C:25
#define DEBUG
std::vector< CbmEmcHit * > hitList
Definition: digi_analys.C:26
std::vector< PndSdsDigiTopix4 > AnalyzeToPixFrame(Double_t clockFrequency)
std::vector< ULong64_t > fToPixFrame
bool BuildFrame(ULong64_t &rawData)
std::vector< PndSdsDigiTopix4 > PndMvdReadInToPix4TBData::AnalyzeToPixFrame ( Double_t  clockFrequency)

Definition at line 322 of file PndMvdReadInToPix4TBData.cxx.

References PndTopix4::BitAnalyzeHeader(), PndTopix4::BitAnalyzeTrailer(), CheckDataIntegrity(), CorrectHitCount, ToPix4::frameHeader::fChipAddress, fCorrectHitCount, fFE, fFilter, ToPix4::frameHeader::fFrameCount, ToPix4::frameTrailer::fFrameCRC, ToPix4::frameTrailer::fNEvents, fNFilteredHits, fNonSequentialFC, fOldFrameCount, fRecentFrameHeader, fRecentFrameTrailer, fStatusValues, fSuperFrameCount, fTopix, fToPixFrame, fVerbose, GetDeltaFrameCount(), PndTopix4::GetType(), hitList, HitToFilter(), i, NFilteredHits, NonSequentialFC, ProcessData(), SuperFrameCount, and y.

Referenced by AnalyzeData().

322  {
323  std::vector<PndSdsDigiTopix4> hitList;
324  if (fVerbose > 2) {
325  std::cout << fFE << " PndMvdReadInToPix4TBData::AnalyzeToPixFrame: fToPixFrame size: "
326  << std::dec << fToPixFrame.size() << " header " << std::hex << fToPixFrame[0] << std::endl;
327  }
328 
329  if (CheckDataIntegrity(fToPixFrame) != true){
330  fToPixFrame.clear();
331  return hitList;
332  }
333 
334  for (int i = 0; i < fToPixFrame.size(); i++) {
335  ULong64_t header = fTopix.GetType(fToPixFrame[i]);
336 
337  switch (header) {
338  case 1: {
340 
341  if (fVerbose > 2)
342  std::cout << fFE << " FrameHeader: rawData: " << std::hex
343  << fToPixFrame[i] << " chip " << std::dec
344  << fRecentFrameHeader.fChipAddress << " framecount "
345  << fRecentFrameHeader.fFrameCount << std::endl;
346 
347  Int_t deltaFrameCount = GetDeltaFrameCount();
348  if (deltaFrameCount > 1){
349  if (fVerbose > 1)
350  std::cout << fFE << "-E- non sequential FC: " << fOldFrameCount << " " << fRecentFrameHeader.fFrameCount << std::endl;
353  }
354 
358  if (fVerbose > 1)
359  std::cout << fFE << " SuperFrameCount increased: " << std::dec << fSuperFrameCount << " oldFC "
360  << fOldFrameCount << " recent FC " << fRecentFrameHeader.fFrameCount << std::endl;
361  }
362  //fOldFrameCount = fRecentFrameHeader.fFrameCount;
363 
364  // new ((*fOutputArrayHeader)[fOutputArrayHeader->GetEntriesFast()]) PndSdsDigiTopix4Header(fRecentFrameHeader.fFrameCount, fFE, fRecentFrameHeader.fChipAddress, fRecentFrameHeader.fECC, fTotalFrameCount,deltaFrameCount, 0, fToPixFrame.size()-2 );
365  //new ((*fOutputArrayHeader)[fOutputArrayHeader->GetEntriesFast()]) PndSdsDigiTopix4Header(fRecentFrameHeader.fFrameCount, 0, fFE,
366  // fRecentFrameHeader.fECC, fTotalFrameCount, deltaFrameCount, 0, fToPixFrame.size() - 2);
367 
369  }
370  break;
371 
372  case 2: {
374  if (fRecentFrameTrailer.fFrameCRC != 0 && (fToPixFrame.size() < 20)) {
375  // std::cout << fFE << " Frame counter " << fRecentFrameHeader.fFrameCount << std::endl;
376  if (fVerbose == -1) {
377  for (int y = 0; y < fToPixFrame.size(); y++) {
378  if (y == 0) {
379  std::cout << fFE << " " << std::hex << fToPixFrame[y] << " - FCount " << fRecentFrameHeader.fFrameCount << std::endl;
380  } else {
381  std::cout << fFE << " " << std::hex << fToPixFrame[y] << std::endl;
382  }
383  }
384  std::cout << std::endl;
385  }
386  }
387  if (fVerbose > 2)
388  std::cout << fFE << " FrameTrailer: nEvents " << fRecentFrameTrailer.fNEvents << " frame CRC: "
389  << fRecentFrameTrailer.fFrameCRC << std::endl;
390 
391  //PndSdsDigiTopix4Header * header_trailer = (PndSdsDigiTopix4Header*) (fOutputArrayHeader->Last());
392  //header_trailer->SetNumberOfEvents(fRecentFrameTrailer.fNEvents);
393  }
394  break;
395 
396  case 3:
397  PndSdsDigiTopix4 recentPixel = ProcessData(fToPixFrame[i], fRecentFrameHeader, clockFrequency);
398  if (fVerbose > 1)
399  LOG(INFO) << "RecentPixel: " << recentPixel;
400  if (fFilter == kTRUE){
401  if (HitToFilter(recentPixel) == true){
402  //LOG(INFO) << "Hit to Filter found!";
403  fNFilteredHits++;
405  break;
406  }
407  }
408  hitList.push_back(recentPixel);
409  if (fVerbose > 2)
410  std::cout << fFE << " Pixel: " << recentPixel << std::endl;
411  //WriteoutToPix4Digi(recentPixel);
414  break;
415  }
416  }
417  return hitList;
418 }
Int_t i
Definition: run_full.C:25
Data class to store the digi output of a pixel module.
ToPix4::frameTrailer BitAnalyzeTrailer(ULong64_t &trailer)
Definition: PndTopix4.cxx:75
ToPix4::frameHeader BitAnalyzeHeader(ULong64_t &header)
Definition: PndTopix4.cxx:61
Bool_t HitToFilter(PndSdsDigiTopix4 &hit)
PndSdsDigiTopix4 ProcessData(ULong64_t &data, ToPix4::frameHeader &header, Double_t &clockFrequency)
std::vector< CbmEmcHit * > hitList
Definition: digi_analys.C:26
ToPix4::frameTrailer fRecentFrameTrailer
ToPix4::frameHeader fRecentFrameHeader
Double_t y
std::vector< ULong64_t > fToPixFrame
int GetType(ULong64_t data)
returns if the data word is a header (0b01), trailer (0b10) or data (0b11)
Definition: PndTopix4.cxx:49
bool CheckDataIntegrity(std::vector< ULong64_t > topix4Frame)
bool PndMvdReadInToPix4TBData::BuildFrame ( ULong64_t &  rawData)

Definition at line 221 of file PndMvdReadInToPix4TBData.cxx.

References PndTopix4::BitAnalyzeHeader(), DoubleHeader, DoubleTrailer, fDoubleHeader, fDoubleTrailer, fFE, fFirstHeader, ToPix4::frameHeader::fFrameCount, fHeaderPresent, fOldAllHeaderCount, fPreFrameLossHitCount, fStatusValues, fTopix, fToPixFrame, fTotalHitCount, fTotalTrailerCount, fTrailerPresent, fVerbose, PndTopix4::GetType(), PreFrameLossHitCount, TotalFrameCount, TotalHeaderCount, TotalHitCount, and TotalTrailerCount.

Referenced by AnalyzeData().

222 {
223  int header = fTopix.GetType(rawData);
224  if (fFirstHeader) { // if data stream does not start with a header all data is thrown away until a header is present
225  if (header == 1) {
226  fFirstHeader = kFALSE;
227  } else {
228  return false;
229  }
230  }
231 
232  if (header == 1) // header word found
233  {
235 
237 
238  Int_t deltaAllFrameCount = ((int) (frameHeader.fFrameCount - fOldAllHeaderCount) < 0 ?
239  ((frameHeader.fFrameCount - fOldAllHeaderCount) + 256) :
240  (frameHeader.fFrameCount - fOldAllHeaderCount));
241 // new ((*fOutputArrayAllHeader)[fOutputArrayAllHeader->GetEntriesFast()]) PndSdsDigiTopix4Header(frameHeader.fFrameCount, fFE,
242 // frameHeader.fChipAddress, frameHeader.fECC, fTotalHeaderCount, deltaAllFrameCount, 0, 0);
243  if (deltaAllFrameCount > 1 && fVerbose > 0)
244  std::cout << "-W- deltaAllFrameCount > 1: " << deltaAllFrameCount << std::endl;
245  fOldAllHeaderCount = frameHeader.fFrameCount;
246 
247  if (fHeaderPresent == kTRUE) {
248  // double header found, cannot check previous data without trailer, clear vector
249  fDoubleHeader++;
251 
252  if (fVerbose > 1) {
253  std::cout << "Double Header Found! count: " << fDoubleHeader << "| FE: " << fFE << std::hex << " last ToPixFrame element: "
254  << fToPixFrame.back() << " new frame header " << rawData << std::endl;
255  }
256  fPreFrameLossHitCount += fToPixFrame.size() - 1;
257  fToPixFrame.clear();
258  // load new header into vector
259  fToPixFrame.push_back(rawData);
260  } else {
261  // header found, start recording topix frame
262  fTrailerPresent = kFALSE;
263  fHeaderPresent = kTRUE;
264  fToPixFrame.push_back(rawData);
265  }
266  }
267 
268  else if (header == 2) // trailer word found
269  {
272  if (fTrailerPresent == kTRUE) {
273  // double trailer found, cannot give the hits a valid timestamp without the header, clear vector
274 
275  fToPixFrame.clear();
277 
278  if (fVerbose > 1) {
279  std::cout << "Double Trailer Found! Double header counter: " << fDoubleTrailer << std::endl;
280  }
281  } else {
282  if (fHeaderPresent == kTRUE) {
283  // one topix frame found! Go and analyze the vector...
284  fHeaderPresent = kFALSE;
285  fTrailerPresent = kTRUE;
286  fToPixFrame.push_back(rawData);
287  // if (fVerbose > 1)
288  // {
289  // std::cout << "ToPix Frame found! Go and analyze this amount of data: " << fToPixFrame.size() << std::endl;
290  //}
291 
293  //AnalyzeToPixFrame(clockFrequency);
294  return true;
295  } else {
296  if (fVerbose > 1) {
297  std::cout << "Trailer without header found! Double header counter: " << fDoubleHeader << std::endl;
298  }
299  // trailer without header, can happen at the beginning of the file or the header was not detected correctly
300  // this case is in principle impossible to enter
301  fPreFrameLossHitCount += fToPixFrame.size() - 1;
302  fDoubleTrailer++;
304  fToPixFrame.clear();
305  }
306  }
307  } else if (header == 3) // data word found
308  {
309  fTotalHitCount++;
311  if (fHeaderPresent == kTRUE) { // found data while a active header is present, go and save the data
312  fToPixFrame.push_back(rawData);
313  } else { // found data without a valid header, may happen at the beginning of the file or the header was detected
316  }
317  }
318  return false;
319 }
ToPix4::frameHeader BitAnalyzeHeader(ULong64_t &header)
Definition: PndTopix4.cxx:61
std::vector< ULong64_t > fToPixFrame
int GetType(ULong64_t data)
returns if the data word is a header (0b01), trailer (0b10) or data (0b11)
Definition: PndTopix4.cxx:49
bool PndMvdReadInToPix4TBData::CheckDataIntegrity ( std::vector< ULong64_t >  topix4Frame)

Definition at line 438 of file PndMvdReadInToPix4TBData.cxx.

References PndHammingDecoder::CalculateCRCTableFast(), PndHammingDecoder::CheckHammingCode(), PndHammingDecoder::ConvertData(), PndTopix4::ConvertToPix4HammingToStandardHamming(), CRCLossFrameCount, CRCLossHitCount, fCRCLossFrameCount, fCRCLossHitCount, fFE, ToPix4::frameHeader::fFrameCount, fHamming, fHammingLossFrameCount, fHammingLossHitCount, fRecentFrameHeader, fStatusValues, fTopix, fVerbose, HammingLossFrameCount, HammingLossHitCount, and y.

Referenced by AnalyzeToPixFrame().

439 {
440  ULong_t hammingcheck = fHamming.CheckHammingCode(fTopix.ConvertToPix4HammingToStandardHamming(topix4Frame[0]), 40); // check hamming of header
441  if (hammingcheck != 0) {
442  if (fVerbose > 1) {
443  std::cout << "Wrong Hamming Code found! (Header) : " << std::hex<< topix4Frame[0] << " Parity bits " << hammingcheck << std::endl;
444  }
447  fHammingLossHitCount += topix4Frame.size() - 2;
448  fStatusValues[HammingLossHitCount] += topix4Frame.size() - 2;
449  return false;
450  }
451 
452  hammingcheck = fHamming.CheckHammingCode(fTopix.ConvertToPix4HammingToStandardHamming(topix4Frame[topix4Frame.size() - 1]), 40); // check hamming of trailer
453  if (hammingcheck != 0) {
454  if (fVerbose > 1) {
455  std::cout << "Wrong Hamming Code found! (Trailer): " << std::hex << topix4Frame[0] << " Parity bits " << hammingcheck << std::endl;
456  }
459  fHammingLossHitCount += topix4Frame.size() - 2;
460  fStatusValues[HammingLossHitCount] += topix4Frame.size() - 2;
461  return false;
462  }
463 
464  std::vector<char> topix_data = fHamming.ConvertData(topix4Frame);
465  ULong64_t crc_calculated = fHamming.CalculateCRCTableFast(topix_data, topix_data.size());
466 
467  if (crc_calculated != ((topix4Frame.back() >> 6) & 0xffff)) {
470  fCRCLossHitCount += topix4Frame.size() - 2;
471  fStatusValues[CRCLossHitCount] += topix4Frame.size() - 2;
472  if (fVerbose == -1) {
473  std::cout << fFE << " CRC WRONG! Frame will be deleted. Calculated CRC: " << std::hex << crc_calculated <<
474  " topix CRC: " << ((topix4Frame.back() >> 6) & 0xffff) << std::endl;
475 
476  for (int y = 0; y < topix4Frame.size(); y++) {
477  if (y == 0) {
478  std::cout << fFE << " " << std::hex << topix4Frame[y] << " - FCount " << fRecentFrameHeader.fFrameCount << std::endl;
479  } else {
480  std::cout << fFE << " " << std::hex << topix4Frame[y] << std::endl;
481  }
482  }
483  std::cout << std::endl;
484  }
485  topix4Frame.clear(); // delete topix frame due to negative CRC check.
486  return false;
487  }
488  return true;
489 }
std::vector< char > ConvertData(std::vector< ULong64_t > topixFrame)
ULong64_t ConvertToPix4HammingToStandardHamming(ULong64_t topixhamming)
Definition: PndTopix4.cxx:314
ToPix4::frameHeader fRecentFrameHeader
ULong64_t CalculateCRCTableFast(std::vector< char > p, ULong64_t len)
Double_t y
UShort_t CheckHammingCode(ULong64_t dataword, int dataword_length)
UInt_t PndMvdReadInToPix4TBData::GetCorrectFrameCount ( ) const
inline

Definition at line 107 of file PndMvdReadInToPix4TBData.h.

References fCorrectFrameCount.

UInt_t PndMvdReadInToPix4TBData::GetCorrectHitCount ( ) const
inline

Definition at line 101 of file PndMvdReadInToPix4TBData.h.

References fCorrectHitCount.

UInt_t PndMvdReadInToPix4TBData::GetCRCLossFrameCount ( ) const
inline

Definition at line 109 of file PndMvdReadInToPix4TBData.h.

References fCRCLossFrameCount.

UInt_t PndMvdReadInToPix4TBData::GetCRCLossHitCount ( ) const
inline

Definition at line 104 of file PndMvdReadInToPix4TBData.h.

References fCRCLossHitCount.

Int_t PndMvdReadInToPix4TBData::GetDeltaFrameCount ( )
UInt_t PndMvdReadInToPix4TBData::GetDoubleHeader ( ) const
inline

Definition at line 95 of file PndMvdReadInToPix4TBData.h.

References fDoubleHeader.

UInt_t PndMvdReadInToPix4TBData::GetDoubleTrailer ( ) const
inline

Definition at line 96 of file PndMvdReadInToPix4TBData.h.

References fDoubleTrailer.

UInt_t PndMvdReadInToPix4TBData::GetHammingLossFrameCount ( ) const
inline

Definition at line 108 of file PndMvdReadInToPix4TBData.h.

References fHammingLossFrameCount.

UInt_t PndMvdReadInToPix4TBData::GetHammingLossHitCount ( ) const
inline

Definition at line 103 of file PndMvdReadInToPix4TBData.h.

References fHammingLossHitCount.

Int_t PndMvdReadInToPix4TBData::GetNFilteredHits ( )
inline

Definition at line 116 of file PndMvdReadInToPix4TBData.h.

References fNFilteredHits.

UInt_t PndMvdReadInToPix4TBData::GetNonSequenctialFC ( ) const
inline

Definition at line 94 of file PndMvdReadInToPix4TBData.h.

References fNonSequentialFC.

UInt_t PndMvdReadInToPix4TBData::GetPreFrameLossHitCount ( ) const
inline

Definition at line 102 of file PndMvdReadInToPix4TBData.h.

References fPreFrameLossHitCount.

std::vector<int> PndMvdReadInToPix4TBData::GetStatusValues ( ) const
inline

Definition at line 114 of file PndMvdReadInToPix4TBData.h.

References fStatusValues.

Referenced by PndMQTopix4Processor::Run().

114 {return fStatusValues;}
UInt_t PndMvdReadInToPix4TBData::GetSuperFrameCount ( ) const
inline

Definition at line 97 of file PndMvdReadInToPix4TBData.h.

References fSuperFrameCount.

UInt_t PndMvdReadInToPix4TBData::GetTotalFrameCount ( ) const
inline

Definition at line 106 of file PndMvdReadInToPix4TBData.h.

References fTotalFrameCount.

UInt_t PndMvdReadInToPix4TBData::GetTotalHeaderCount ( ) const
inline

Definition at line 111 of file PndMvdReadInToPix4TBData.h.

References fTotalHeaderCount.

UInt_t PndMvdReadInToPix4TBData::GetTotalHitCount ( ) const
inline

Definition at line 100 of file PndMvdReadInToPix4TBData.h.

References fTotalHitCount.

UInt_t PndMvdReadInToPix4TBData::GetTotalTrailerCount ( ) const
inline

Definition at line 112 of file PndMvdReadInToPix4TBData.h.

References fTotalTrailerCount.

Bool_t PndMvdReadInToPix4TBData::HitToFilter ( PndSdsDigiTopix4 hit)

Definition at line 420 of file PndMvdReadInToPix4TBData.cxx.

References PndSdsDigiTopix4::GetLeadingEdge(), and PndSdsDigiTopix4::GetTrailingEdge().

Referenced by AnalyzeToPixFrame().

421 {
422  int leadingEdge = hit.GetLeadingEdge();
423  int trailingEdge = hit.GetTrailingEdge();
424  if (leadingEdge == 2729 || leadingEdge == 2730)
425  return true;
426  if (trailingEdge == 2730 || trailingEdge == 2731)
427  return true;
428  return false;
429 }
UInt_t GetLeadingEdge() const
UInt_t GetTrailingEdge() const
void PndMvdReadInToPix4TBData::Init ( )

Definition at line 41 of file PndMvdReadInToPix4TBData.cxx.

References fFileCounter, fFileHandle, and fFileNames.

Referenced by PndMQTopix4Sampler::Init().

41  {
42  //std::cout << "PndMvdReadInToPix4TBData::Init called" << std::endl;
43 // for (int i = 0; i < fFileName.size(); i++){
44  std::ifstream* ifs = new std::ifstream(fFileNames[fFileCounter], std::ios::binary);
45  if (ifs->good() == kFALSE)
46  LOG(ERROR) << "File: " << fFileNames[fFileCounter] << " is good: " << ifs->good();
47  fFileCounter++;
48  fFileHandle=ifs;
49 // }
50 }
std::vector< std::string > fFileNames
PndSdsDigiTopix4 PndMvdReadInToPix4TBData::ProcessData ( ULong64_t &  data,
ToPix4::frameHeader header,
Double_t clockFrequency 
)

todo: check if sqrt(12) has to be added

Definition at line 492 of file PndMvdReadInToPix4TBData.cxx.

References PndTopix4::BitAnalyzePixelData(), Double_t, fCorrectHitCount, fFE, ToPix4::frameHeader::fFrameCount, ToPix4::pixel::fLeadingEdge, ToPix4::pixel::fPixelNumber, fSuperFrameCount, fTimeStampCorrection, fTopix, fTotalHeaderCount, fTotalHitCount, ToPix4::pixel::fTrailingEdge, fVerbose, and PndTopix4::PixelNumberToMatrixAddress().

Referenced by AnalyzeToPixFrame().

493 {
494  if (fVerbose > 1) std::cout << "PndMvdReadInToPix4TBData::ProcessData raw Data: " << data << std::endl;
495  pixel pixelData = fTopix.BitAnalyzePixelData(data);
496  std::pair<UInt_t, UInt_t> pixelAddress = fTopix.PixelNumberToMatrixAddress(pixelData.fPixelNumber);
497 
498  Int_t frameCountHeader = header.fFrameCount;
499  if (pixelData.fLeadingEdge > pixelData.fTrailingEdge){
500  frameCountHeader--;
501  //std::cout << "PndMvdReadInToPix4TBData::ProcessData frameCount corrected" << std::endl;
502  }
503  Double_t timestamp = ((Double_t)fSuperFrameCount * 256. * 4096. + (Double_t)frameCountHeader * 4096. + (Double_t)pixelData.fLeadingEdge)/clockFrequency * 1000.;
504  timestamp += fTimeStampCorrection;
505  Double_t timestamp_independent = ((Double_t) fTotalHeaderCount * 4096. + (Double_t)pixelData.fLeadingEdge)/clockFrequency * 1000.;
506 
507  std::vector<Int_t> indices; // just for compatibility with PndSdsDigiPixel
508 // return PndSdsDigiTopix4(indices, 0, 0, fFE, pixelAddress.first, pixelAddress.second, pixelData.fLeadingEdge, pixelData.fTrailingEdge, header.fFrameCount, timestamp, fCorrectHitCount,fTotalHitCount, timestamp_independent);
509  PndSdsDigiTopix4 result(indices, 0, fFE - 1, 0, pixelAddress.first, pixelAddress.second, pixelData.fLeadingEdge, pixelData.fTrailingEdge, header.fFrameCount, timestamp, fCorrectHitCount,fTotalHitCount, timestamp_independent);
510  result.SetTimeStampError(1/clockFrequency * 1000);
511  return result;
512 
513 }
Data class to store the digi output of a pixel module.
ToPix4::pixel BitAnalyzePixelData(ULong64_t &data)
Definition: PndTopix4.cxx:91
Double_t
std::pair< UInt_t, UInt_t > PixelNumberToMatrixAddress(UInt_t pixelnumber)
Definition: PndTopix4.cxx:128
UInt_t fLeadingEdge
Definition: PndTopix4.h:36
UInt_t fPixelNumber
Definition: PndTopix4.h:33
UInt_t fTrailingEdge
Definition: PndTopix4.h:37
Bool_t PndMvdReadInToPix4TBData::ReadInData ( std::vector< std::vector< PndSdsDigiTopix4 > > &  data)

Definition at line 52 of file PndMvdReadInToPix4TBData.cxx.

References AnalyzeData(), Bool_t, fClockFrequency, fTopix, PndTopix4::GetRawData(), and ReadInDataFromFile().

52  {
53  ULong_t dataword=0;
54  Bool_t endOfFile = kFALSE;
55 
56 // fOutputArrayAllHeader = allheaderContainer;
57  std::vector<ULong64_t> rawArray;
58  TMrfData_8b* mrfData = 0;
59  endOfFile |= ReadInDataFromFile(mrfData);
60  if (mrfData != 0){
61  rawArray = fTopix.GetRawData(mrfData);
62  delete(mrfData);
63  }
64 // endOfFile |= ReadInRawData(fFileHandle, rawArray);
65  data = AnalyzeData(rawArray, fClockFrequency);
66  return endOfFile;
67 }
virtual Bool_t ReadInDataFromFile(TMrfData_8b *&data)
std::vector< std::vector< PndSdsDigiTopix4 > > AnalyzeData(std::vector< ULong64_t > &rawData, Double_t clockFrequency)
std::vector< ULong64_t > GetRawData(TMrfData_8b *data)
Definition: PndTopix4.cxx:25
Base interface class for data storage and manipulation. Compatible with IO classes from MRF Suite...
Bool_t PndMvdReadInToPix4TBData::ReadInDataFromFile ( TMrfData_8b *&  data)
virtual

Definition at line 69 of file PndMvdReadInToPix4TBData.cxx.

References Bool_t, DEBUG, fFE, fFileCounter, fFileHandle, fFileNames, and fVerbose.

Referenced by ReadInData(), and PndMQTopix4Sampler::Run().

70 {
71  Bool_t endOfFile = kFALSE;
72 
73  if (fFileHandle->good()) {
74  if (fVerbose > 1)
75  LOG(DEBUG) << "PndMvdReadInToPix4TBData::ReadInRawData reading file ";
76  try {
77  boost::archive::binary_iarchive iar(*fFileHandle); //this line causes an "Invalid Signature Error" at the end of the file but the file is still good
78  iar >> data;
79  } catch (boost::archive::archive_exception& exception) {
80  LOG(WARN) << "PndMvdReadInToPix4TBData::ReadInRawData: Error found in reading file "
81  << " : " << fFileHandle->good() << " " << fFileHandle->eof() << " Exception: "
82  << exception.code << " " << exception.what();
83 
84  if (exception.code == 3) {
85  if (fFileCounter < fFileNames.size()) {
86  LOG(INFO) << fFE << " open new file " << fFileNames[fFileCounter];
87  fFileHandle->close();
88  delete (fFileHandle);
89  std::ifstream* ifs = new std::ifstream(fFileNames[fFileCounter], std::ios::binary);
90  fFileHandle = ifs;
91  fFileCounter++;
92  return endOfFile;
93  } else {
94  LOG(INFO) << fFE << " All files read! Finishing FE ";
95  endOfFile = kTRUE;
96  return endOfFile;
97  }
98  }
99  return kTRUE;
100  }
101  } else {
102  LOG(ERROR) << fFE << " An error occured ";
103  LOG(ERROR) << fFE << " fFileHandle->good() " << fFileHandle->good();
104  LOG(ERROR) << fFE << " fFileHandle->eof() " << fFileHandle->eof();
105  LOG(ERROR) << fFE << " fFileHandle->fail() " << fFileHandle->fail();
106  LOG(ERROR) << fFE << " fFileHandle->bad() " << fFileHandle->bad();
107 
108  endOfFile = kTRUE;
109  return endOfFile;
110  }
111  return endOfFile;
112 }
std::vector< std::string > fFileNames
#define DEBUG
void PndMvdReadInToPix4TBData::SetClockFrequency ( Double_t  val)
inline

Definition at line 91 of file PndMvdReadInToPix4TBData.h.

References fClockFrequency, and val.

Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
void PndMvdReadInToPix4TBData::SetFE ( Int_t  val)
inline

Definition at line 93 of file PndMvdReadInToPix4TBData.h.

References fFE, and val.

Referenced by PndMQTopix4Processor::SetProperty().

93 {fFE = val;}
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
void PndMvdReadInToPix4TBData::SetFileName ( std::vector< std::string >  fileName)
inline

Definition at line 56 of file PndMvdReadInToPix4TBData.h.

References fFileNames, and i.

Referenced by SetFileName().

56  {
57 
58  std::cout << "number of entires " << fileName.size() << std::endl;
59  for(int i=0; i < fileName.size();i++)
60  {
61  std::cout << i<< " " << fileName[i] << std::endl;
62  }
63  fFileNames= fileName;
64  }
std::vector< std::string > fFileNames
Int_t i
Definition: run_full.C:25
void PndMvdReadInToPix4TBData::SetFileName ( std::string  fileName)
inline

Definition at line 66 of file PndMvdReadInToPix4TBData.h.

References SetFileName().

66  {
67  std::vector<std::string> names;
68  names.push_back(fileName);
69  SetFileName(names);
70  }
void SetFileName(std::vector< std::string > fileName)
void PndMvdReadInToPix4TBData::SetFilter ( Bool_t  val)
inline

Definition at line 118 of file PndMvdReadInToPix4TBData.h.

References fFilter, and val.

Referenced by PndMQTopix4Processor::Run(), and PndMQTopix4Processor::SetFilter().

118 { fFilter = val;}
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
void PndMvdReadInToPix4TBData::SetTimeStampCorrection ( Double_t  val)
inline

Definition at line 92 of file PndMvdReadInToPix4TBData.h.

References fTimeStampCorrection, and val.

Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
void PndMvdReadInToPix4TBData::SetVerbose ( Int_t  val)
inline

Definition at line 121 of file PndMvdReadInToPix4TBData.h.

References fVerbose, and val.

121 {fVerbose = val;}
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11

Member Data Documentation

Double_t PndMvdReadInToPix4TBData::fClockFrequency
private

Definition at line 126 of file PndMvdReadInToPix4TBData.h.

Referenced by ReadInData(), and SetClockFrequency().

UInt_t PndMvdReadInToPix4TBData::fCorrectFrameCount
private

Definition at line 162 of file PndMvdReadInToPix4TBData.h.

Referenced by GetCorrectFrameCount().

UInt_t PndMvdReadInToPix4TBData::fCorrectHitCount
private

Definition at line 143 of file PndMvdReadInToPix4TBData.h.

Referenced by AnalyzeToPixFrame(), GetCorrectHitCount(), and ProcessData().

UInt_t PndMvdReadInToPix4TBData::fCRCLossFrameCount
private

Definition at line 137 of file PndMvdReadInToPix4TBData.h.

Referenced by CheckDataIntegrity(), and GetCRCLossFrameCount().

UInt_t PndMvdReadInToPix4TBData::fCRCLossHitCount
private

Definition at line 142 of file PndMvdReadInToPix4TBData.h.

Referenced by CheckDataIntegrity(), and GetCRCLossHitCount().

UInt_t PndMvdReadInToPix4TBData::fDoubleHeader
private

Definition at line 155 of file PndMvdReadInToPix4TBData.h.

Referenced by BuildFrame(), and GetDoubleHeader().

UInt_t PndMvdReadInToPix4TBData::fDoubleTrailer
private

Definition at line 156 of file PndMvdReadInToPix4TBData.h.

Referenced by BuildFrame(), and GetDoubleTrailer().

Int_t PndMvdReadInToPix4TBData::fFE
private
Int_t PndMvdReadInToPix4TBData::fFileCounter
private

Definition at line 166 of file PndMvdReadInToPix4TBData.h.

Referenced by Init(), and ReadInDataFromFile().

std::ifstream* PndMvdReadInToPix4TBData::fFileHandle
private

Definition at line 125 of file PndMvdReadInToPix4TBData.h.

Referenced by Init(), ReadInDataFromFile(), and ~PndMvdReadInToPix4TBData().

std::vector<std::string> PndMvdReadInToPix4TBData::fFileNames
private

Definition at line 124 of file PndMvdReadInToPix4TBData.h.

Referenced by Init(), ReadInDataFromFile(), and SetFileName().

Bool_t PndMvdReadInToPix4TBData::fFilter
private

Definition at line 145 of file PndMvdReadInToPix4TBData.h.

Referenced by AnalyzeToPixFrame(), and SetFilter().

Bool_t PndMvdReadInToPix4TBData::fFirstHeader
private

Definition at line 151 of file PndMvdReadInToPix4TBData.h.

Referenced by BuildFrame().

PndHammingDecoder PndMvdReadInToPix4TBData::fHamming
private

Definition at line 170 of file PndMvdReadInToPix4TBData.h.

Referenced by CheckDataIntegrity().

UInt_t PndMvdReadInToPix4TBData::fHammingLossFrameCount
private

Definition at line 136 of file PndMvdReadInToPix4TBData.h.

Referenced by CheckDataIntegrity(), and GetHammingLossFrameCount().

UInt_t PndMvdReadInToPix4TBData::fHammingLossHitCount
private

Definition at line 141 of file PndMvdReadInToPix4TBData.h.

Referenced by CheckDataIntegrity(), and GetHammingLossHitCount().

Bool_t PndMvdReadInToPix4TBData::fHeaderPresent
private

Definition at line 152 of file PndMvdReadInToPix4TBData.h.

Referenced by BuildFrame().

UInt_t PndMvdReadInToPix4TBData::fNFilteredHits
private

Definition at line 146 of file PndMvdReadInToPix4TBData.h.

Referenced by AnalyzeToPixFrame(), and GetNFilteredHits().

UInt_t PndMvdReadInToPix4TBData::fNonSequentialFC
private

Definition at line 135 of file PndMvdReadInToPix4TBData.h.

Referenced by AnalyzeToPixFrame(), and GetNonSequenctialFC().

UInt_t PndMvdReadInToPix4TBData::fOldAllHeaderCount
private

Definition at line 132 of file PndMvdReadInToPix4TBData.h.

Referenced by BuildFrame().

UInt_t PndMvdReadInToPix4TBData::fOldFrameCount
private

Definition at line 131 of file PndMvdReadInToPix4TBData.h.

Referenced by AnalyzeToPixFrame(), and GetDeltaFrameCount().

UInt_t PndMvdReadInToPix4TBData::fPreFrameLossHitCount
private

Definition at line 140 of file PndMvdReadInToPix4TBData.h.

Referenced by BuildFrame(), and GetPreFrameLossHitCount().

ToPix4::frameHeader PndMvdReadInToPix4TBData::fRecentAllFrameHeader
private

Definition at line 149 of file PndMvdReadInToPix4TBData.h.

ToPix4::frameHeader PndMvdReadInToPix4TBData::fRecentFrameHeader
private
ToPix4::frameTrailer PndMvdReadInToPix4TBData::fRecentFrameTrailer
private

Definition at line 150 of file PndMvdReadInToPix4TBData.h.

Referenced by AnalyzeToPixFrame().

std::vector<int> PndMvdReadInToPix4TBData::fStatusValues
private
UInt_t PndMvdReadInToPix4TBData::fSuperFrameCount
private

Definition at line 134 of file PndMvdReadInToPix4TBData.h.

Referenced by AnalyzeToPixFrame(), GetSuperFrameCount(), and ProcessData().

Double_t PndMvdReadInToPix4TBData::fTimeStampCorrection
private

Definition at line 127 of file PndMvdReadInToPix4TBData.h.

Referenced by ProcessData(), and SetTimeStampCorrection().

PndTopix4 PndMvdReadInToPix4TBData::fTopix
private
std::vector<ULong64_t> PndMvdReadInToPix4TBData::fToPixFrame
private

Definition at line 168 of file PndMvdReadInToPix4TBData.h.

Referenced by AnalyzeData(), AnalyzeToPixFrame(), and BuildFrame().

UInt_t PndMvdReadInToPix4TBData::fTotalFrameCount
private

Definition at line 161 of file PndMvdReadInToPix4TBData.h.

Referenced by GetTotalFrameCount().

UInt_t PndMvdReadInToPix4TBData::fTotalHeaderCount
private

Definition at line 158 of file PndMvdReadInToPix4TBData.h.

Referenced by GetTotalHeaderCount(), and ProcessData().

UInt_t PndMvdReadInToPix4TBData::fTotalHitCount
private

Definition at line 139 of file PndMvdReadInToPix4TBData.h.

Referenced by BuildFrame(), GetTotalHitCount(), and ProcessData().

UInt_t PndMvdReadInToPix4TBData::fTotalTrailerCount
private

Definition at line 159 of file PndMvdReadInToPix4TBData.h.

Referenced by BuildFrame(), and GetTotalTrailerCount().

Bool_t PndMvdReadInToPix4TBData::fTrailerPresent
private

Definition at line 153 of file PndMvdReadInToPix4TBData.h.

Referenced by BuildFrame().

Int_t PndMvdReadInToPix4TBData::fVerbose
private

The documentation for this class was generated from the following files: