PandaRoot
PndMvdPastaDigi.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  * PndMvdPastaDigi.h
15  *
16  * Created on: 23.09.2017
17  * Author: Stockmanns
18  */
19 
20 #ifndef MVD_MVDTESTBEAM_PASTATB_PNDMVDPASTADIGIFULL_H_
21 #define MVD_MVDTESTBEAM_PASTATB_PNDMVDPASTADIGIFULL_H_
22 
23 #include "Rtypes.h"
24 #include "TObject.h"
25 
26 #include <ostream>
27 
28 class RunSummary : public TObject {
29  public:
30  RunSummary();
32  int fCrcMatchCount;
35  std::vector<ULong64_t> fAllCountedFrames;
37 
42 
43  ClassDef(RunSummary, 1);
44 };
45 
46 class ThresholdDataFullMode : public TObject {
47  public:
50  int t_coarse;
51  int t_soc;
52  int t_eoc;
53  int channelId;
54  int tacId;
55 
56  friend std::ostream &operator<<(std::ostream &out, const ThresholdDataFullMode &data)
57  {
58  out << "t_coarse: " << data.t_coarse << " t_soc " << data.t_soc << " t_eoc " << data.t_eoc << " channelId " << data.channelId << " tacId " << data.tacId;
59  return out;
60  }
62 };
63 
64 class FrameHeader : public TObject {
65  public:
66  FrameHeader();
68  ULong64_t frameId;
69  int nEvents;
71 };
72 
73 class PndMvdPastaDigi : public TObject {
74  public:
75  enum branchId { TIME, ENERGY, UNDEFINED };
76 
78  PndMvdPastaDigi(FrameHeader header, ThresholdDataFullMode time, ThresholdDataFullMode energy) : fFrameHeader(header), fTimeBranch(time), fEnergyBranch(energy)
79  {
80  fToT = CalcTot();
81  fTimeStamp = CalcTimeStamp();
82  };
83 
84  virtual ~PndMvdPastaDigi();
85 
86  void SetTimeBranch(ThresholdDataFullMode time) { fTimeBranch = time; }
87  void SetEnergyBranch(ThresholdDataFullMode energy) { fEnergyBranch = energy; }
88  void SetHeader(FrameHeader header) { fFrameHeader = header; }
89 
90  ULong64_t CalcTimeStamp()
91  {
92  ULong64_t timeStamp = fFrameHeader.frameId * 1024 + fTimeBranch.t_coarse;
93  fTimeStamp = timeStamp;
94  return timeStamp;
95  }
96 
97  int CalcTot()
98  {
99  int tot = fEnergyBranch.t_coarse - fTimeBranch.t_coarse;
100 
101  if (tot < 0) {
102  tot += 1024;
103  }
104  fToT = tot;
105  return tot;
106  }
107 
108  int GetTot() { return fToT; }
109 
110  ULong64_t GetTimeStamp() { return fTimeStamp; };
111  int GetChannelId(branchId id);
112 
113  friend std::ostream &operator<<(std::ostream &out, const PndMvdPastaDigi &digi)
114  {
115  out << std::dec << " Header: nHits " << digi.fFrameHeader.nEvents << " frameId: " << digi.fFrameHeader.frameId << std::endl;
116  out << "TimeBranch: " << digi.fTimeBranch << std::endl;
117  out << "EnergyBranch: " << digi.fEnergyBranch << std::endl;
118  return out;
119  }
120 
121  private:
122  ThresholdDataFullMode fTimeBranch;
123  ThresholdDataFullMode fEnergyBranch;
124  FrameHeader fFrameHeader;
125  ULong64_t fTimeStamp;
126  int fToT;
127 
129 };
130 
131 #endif /* MVD_MVDTESTBEAM_PASTATB_PNDMVDPASTADIGIFULL_H_ */
void SetTimeBranch(ThresholdDataFullMode time)
void SetEnergyBranch(ThresholdDataFullMode energy)
int fWrongFrameCount
count of all frames where the expected frame ID did not match the frameID in the header ...
int fWrongHitCount
count of all frames where the hits in the header do not match the data
int fSingleWordFrames
count of all frames with just one word. This is an error a frame has at least two words ...
PndMvdPastaDigi(FrameHeader header, ThresholdDataFullMode time, ThresholdDataFullMode energy)
friend std::ostream & operator<<(std::ostream &out, const PndMvdPastaDigi &digi)
ULong64_t frameId
void SetHeader(FrameHeader header)
ULong64_t GetTimeStamp()
int fAllPartialResets
count of all partial resets detected
int fMissingFrames
count of all missing frames (not very reliable)
int fCrcErrorCount
count of all frames with wrong CRC
std::vector< ULong64_t > fAllCountedFrames
counts all frames within a partial reset
ULong64_t CalcTimeStamp()
ClassDef(RunSummary, 1)
int fSuperFrameCount
count of frame counter overflow (should not happen because the frame counter is HUGE ...
friend std::ostream & operator<<(std::ostream &out, const ThresholdDataFullMode &data)
int fCrcMatchCount
count of all frames with correct CRC