PandaRoot
PndMvdPastaDigi.h
Go to the documentation of this file.
1 /*
2  * PndMvdPastaDigi.h
3  *
4  * Created on: 23.09.2017
5  * Author: Stockmanns
6  */
7 
8 #ifndef MVD_MVDTESTBEAM_PASTATB_PNDMVDPASTADIGIFULL_H_
9 #define MVD_MVDTESTBEAM_PASTATB_PNDMVDPASTADIGIFULL_H_
10 
11 #include "Rtypes.h"
12 #include "TObject.h"
13 
14 #include <ostream>
15 
16 class RunSummary : public TObject {
17  public:
18  RunSummary();
20  int fCrcMatchCount;
23  std::vector<ULong64_t> fAllCountedFrames;
25 
30 
31  ClassDef(RunSummary, 1);
32 };
33 
34 class ThresholdDataFullMode : public TObject {
35  public:
38  int t_coarse;
39  int t_soc;
40  int t_eoc;
41  int channelId;
42  int tacId;
43 
44  friend std::ostream &operator<<(std::ostream &out, const ThresholdDataFullMode &data)
45  {
46  out << "t_coarse: " << data.t_coarse << " t_soc " << data.t_soc << " t_eoc " << data.t_eoc << " channelId " << data.channelId << " tacId " << data.tacId;
47  return out;
48  }
50 };
51 
52 class FrameHeader : public TObject {
53  public:
54  FrameHeader();
56  ULong64_t frameId;
57  int nEvents;
59 };
60 
61 class PndMvdPastaDigi : public TObject {
62  public:
63  enum branchId { TIME, ENERGY, UNDEFINED };
64 
66  PndMvdPastaDigi(FrameHeader header, ThresholdDataFullMode time, ThresholdDataFullMode energy) : fFrameHeader(header), fTimeBranch(time), fEnergyBranch(energy)
67  {
68  fToT = CalcTot();
69  fTimeStamp = CalcTimeStamp();
70  };
71 
72  virtual ~PndMvdPastaDigi();
73 
74  void SetTimeBranch(ThresholdDataFullMode time) { fTimeBranch = time; }
75  void SetEnergyBranch(ThresholdDataFullMode energy) { fEnergyBranch = energy; }
76  void SetHeader(FrameHeader header) { fFrameHeader = header; }
77 
78  ULong64_t CalcTimeStamp()
79  {
80  ULong64_t timeStamp = fFrameHeader.frameId * 1024 + fTimeBranch.t_coarse;
81  fTimeStamp = timeStamp;
82  return timeStamp;
83  }
84 
85  int CalcTot()
86  {
87  int tot = fEnergyBranch.t_coarse - fTimeBranch.t_coarse;
88 
89  if (tot < 0) {
90  tot += 1024;
91  }
92  fToT = tot;
93  return tot;
94  }
95 
96  int GetTot() { return fToT; }
97 
98  ULong64_t GetTimeStamp() { return fTimeStamp; };
99  int GetChannelId(branchId id);
100 
101  friend std::ostream &operator<<(std::ostream &out, const PndMvdPastaDigi &digi)
102  {
103  out << std::dec << " Header: nHits " << digi.fFrameHeader.nEvents << " frameId: " << digi.fFrameHeader.frameId << std::endl;
104  out << "TimeBranch: " << digi.fTimeBranch << std::endl;
105  out << "EnergyBranch: " << digi.fEnergyBranch << std::endl;
106  return out;
107  }
108 
109  private:
110  ThresholdDataFullMode fTimeBranch;
111  ThresholdDataFullMode fEnergyBranch;
112  FrameHeader fFrameHeader;
113  ULong64_t fTimeStamp;
114  int fToT;
115 
117 };
118 
119 #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