Belle II Software  release-05-01-25
RawFTSWFormat_v1.h
1 //+
2 // File : RawFTSWFormat_v1.h
3 // Description : Module to handle raw data from COPPER
4 //
5 // Author : Satoru Yamada, IPNS, KEK
6 // Date : 7 - Mar - 2016
7 //-
8 
9 #ifndef RAWFTSWFORMAT_V1_H
10 #define RAWFTSWFORMAT_V1_H
11 #include <rawdata/dataobjects/RawFTSWFormat.h>
12 
13 namespace Belle2 {
25  public:
26 
30  //RawFTSWFormat_v1(int* bufin, int nwords);
32  virtual ~RawFTSWFormat_v1();
33 
34  /* //! Get # of words in this buffer */
35  /* int GetNwords(int n); */
36 
38  int GetNwordsHeader(int n) OVERRIDE_CPP17;
39 
41  unsigned int GetFTSWNodeID(int n) OVERRIDE_CPP17;
42 
44  unsigned int GetEveNo(int n) OVERRIDE_CPP17;
45 
47  unsigned int GetTTCtimeTRGType(int n) OVERRIDE_CPP17;
48 
50  unsigned int GetTTUtime(int n) OVERRIDE_CPP17;
51 
53  int GetTTCtime(int n) OVERRIDE_CPP17;
54 
56  int GetTRGType(int n) OVERRIDE_CPP17;
57 
59  void GetTTTimeVal(int n, struct timeval* tv) OVERRIDE_CPP17;
60 
62  void GetTTTimeSpec(int n, struct timespec* ts) OVERRIDE_CPP17;
63 
65  unsigned long long int GetTTTimeNs(int n) OVERRIDE_CPP17;
66 
68  unsigned int GetMagicTrailer(int n) OVERRIDE_CPP17;
69 
71  void CheckData(int n,
72  unsigned int prev_evenum, unsigned int* cur_evenum,
73  unsigned int prev_exprunsubrun_no, unsigned int* cur_exprunsubrun_no) OVERRIDE_CPP17;
74 
76  unsigned int GetExpRunSubrun(int n) OVERRIDE_CPP17;
77 
79  int GetRunNo(int n) OVERRIDE_CPP17;
80 
81 
83  int GetSubRunNo(int n) OVERRIDE_CPP17;
84 
86  int GetRunNoSubRunNo(int n) OVERRIDE_CPP17;
87 
89  int GetExpNo(int n) OVERRIDE_CPP17;
90 
92  int Get15bitTLUTag(int n) OVERRIDE_CPP17;
93 
94  enum {
95  POS_NWORDS = 0,
96  POS_HDR_NWORDS = 1,
97  POS_NUMEVE_NUMNODES = 2,
98  POS_EXP_RUN_NO = 3,
99  POS_EVE_NO = 4,
100  POS_NA_1 = 5,
101  POS_NODE_ID = 6,
102  POS_NA_2 = 7,
103  POS_TT_CTIME_TRGTYPE = 8,
104  POS_TT_UTIME = 9,
105  POS_FTSW_3 = 10,
106  POS_FTSW_4 = 11,
107  POS_RSVD_1 = 12,
108  POS_MAGIC_1 = 13
109  };
110 
111  enum {
112  EXP_MASK = 0xFFC00000,
113  EXP_SHIFT = 22,
114  RUNNO_MASK = 0x003FFF00,
115  RUNNO_SHIFT = 8,
116  SUBRUNNO_MASK = 0x000000FF,
117  TTCTIME_MASK = 0x7FFFFFF0,
118  TTCTIME_SHIFT = 4,
119  TRGTYPE_MASK = 0xF
120  };
121 
122  enum {
123  SIZE_FTSW_PACKET = 14
124  };
125  //#endif
126 
127  enum {
128  FTSW_MAGIC_TRAILER = 0x7FFF0000
129  };
130 
131  protected :
132 
133  };
134 
135  inline unsigned int RawFTSWFormat_v1::GetExpRunSubrun(int n)
136  {
137  return (unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]);
138 
139  }
140 
141 
142  inline int RawFTSWFormat_v1::GetRunNo(int n)
143  {
144  return (((unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]) & RUNNO_MASK)
145  >> RUNNO_SHIFT);
146  }
147 
149  {
150  return (m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ] & SUBRUNNO_MASK);
151  }
152 
154  {
155  return ((unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]) &
156  (RUNNO_MASK | SUBRUNNO_MASK));
157  }
158 
159  inline int RawFTSWFormat_v1::GetExpNo(int n)
160  {
161  return (((unsigned int)(m_buffer[ GetBufferPos(n) + POS_EXP_RUN_NO ]) & EXP_MASK)
162  >> EXP_SHIFT);
163  }
164 
166 }
167 
168 #endif
Belle2::RawFTSWFormat_v1::Get15bitTLUTag
int Get15bitTLUTag(int n) OVERRIDE_CPP17
DESY test only.
Definition: RawFTSWFormat_v1.cc:23
Belle2::RawDataBlockFormat::m_buffer
int * m_buffer
Buffer.
Definition: RawDataBlockFormat.h:98
Belle2::RawDataBlockFormat::GetBufferPos
virtual int GetBufferPos(int n)
get position of data block in word
Definition: RawDataBlockFormat.cc:30
Belle2::RawFTSWFormat_v1::RawFTSWFormat_v1
RawFTSWFormat_v1()
Default constructor.
Definition: RawFTSWFormat_v1.cc:14
Belle2::RawFTSWFormat_v1::GetTTUtime
unsigned int GetTTUtime(int n) OVERRIDE_CPP17
get unixtime of the trigger
Definition: RawFTSWFormat_v1.cc:45
Belle2::RawFTSWFormat_v1::GetTTCtimeTRGType
unsigned int GetTTCtimeTRGType(int n) OVERRIDE_CPP17
Get a word containing ctime and trigger type info.
Definition: RawFTSWFormat_v1.cc:28
Belle2::RawFTSWFormat_v1::GetEveNo
unsigned int GetEveNo(int n) OVERRIDE_CPP17
Get event #.
Definition: RawFTSWFormat_v1.cc:82
Belle2::RawFTSWFormat_v1::GetRunNoSubRunNo
int GetRunNoSubRunNo(int n) OVERRIDE_CPP17
get a word cotaining run # and subrun #
Definition: RawFTSWFormat_v1.h:153
Belle2::RawFTSWFormat_v1::GetFTSWNodeID
unsigned int GetFTSWNodeID(int n) OVERRIDE_CPP17
Get Node # ( should be "TTD " )
Definition: RawFTSWFormat_v1.cc:77
Belle2::RawFTSWFormat_v1::GetTTTimeVal
void GetTTTimeVal(int n, struct timeval *tv) OVERRIDE_CPP17
Get timeval from ctime and utime.
Definition: RawFTSWFormat_v1.cc:50
Belle2::RawFTSWFormat_v1::CheckData
void CheckData(int n, unsigned int prev_evenum, unsigned int *cur_evenum, unsigned int prev_exprunsubrun_no, unsigned int *cur_exprunsubrun_no) OVERRIDE_CPP17
check the data contents
Definition: RawFTSWFormat_v1.cc:92
Belle2::RawFTSWFormat_v1::GetTTTimeSpec
void GetTTTimeSpec(int n, struct timespec *ts) OVERRIDE_CPP17
Get timespec from ctime and utime.
Definition: RawFTSWFormat_v1.cc:58
Belle2::RawFTSWFormat_v1::GetExpRunSubrun
unsigned int GetExpRunSubrun(int n) OVERRIDE_CPP17
Exp# (10bit) run# (14bit) restart # (8bit)
Definition: RawFTSWFormat_v1.h:135
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::RawFTSWFormat_v1::~RawFTSWFormat_v1
virtual ~RawFTSWFormat_v1()
Constructor using existing pointer to raw data buffer.
Definition: RawFTSWFormat_v1.cc:18
Belle2::RawFTSWFormat_v1::GetNwordsHeader
int GetNwordsHeader(int n) OVERRIDE_CPP17
Get # of words of header.
Definition: RawFTSWFormat_v1.cc:71
Belle2::RawFTSWFormat_v1::GetMagicTrailer
unsigned int GetMagicTrailer(int n) OVERRIDE_CPP17
Get magic number for data corruption check.
Definition: RawFTSWFormat_v1.cc:87
Belle2::RawFTSWFormat_v1::GetExpNo
int GetExpNo(int n) OVERRIDE_CPP17
Get Exp #.
Definition: RawFTSWFormat_v1.h:159
Belle2::RawFTSWFormat
The Raw FTSW class.
Definition: RawFTSWFormat.h:24
Belle2::RawFTSWFormat_v1::GetRunNo
int GetRunNo(int n) OVERRIDE_CPP17
Get run #.
Definition: RawFTSWFormat_v1.h:142
Belle2::RawFTSWFormat_v1::GetSubRunNo
int GetSubRunNo(int n) OVERRIDE_CPP17
Get subrun #.
Definition: RawFTSWFormat_v1.h:148
Belle2::RawFTSWFormat_v1::GetTRGType
int GetTRGType(int n) OVERRIDE_CPP17
Get trgtype.
Definition: RawFTSWFormat_v1.cc:40
Belle2::RawFTSWFormat_v1::GetTTCtime
int GetTTCtime(int n) OVERRIDE_CPP17
Get ctime of the trigger.
Definition: RawFTSWFormat_v1.cc:35
Belle2::RawFTSWFormat_v1
The Raw FTSW class ver.1 .
Definition: RawFTSWFormat_v1.h:24
Belle2::RawFTSWFormat_v1::GetTTTimeNs
unsigned long long int GetTTTimeNs(int n) OVERRIDE_CPP17
Get time in ns since epoch from ctime and utime.
Definition: RawFTSWFormat_v1.cc:66